mol_jsx_lib 0.0.838 → 0.0.840
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 +196 -194
- package/node.d.ts.map +1 -1
- package/node.deps.json +1 -1
- package/node.js +1448 -1443
- package/node.js.map +1 -1
- package/node.mjs +1448 -1443
- package/node.test.js +1856 -1851
- package/node.test.js.map +1 -1
- package/package.json +17 -17
- package/web.js +1 -1
- package/web.js.map +1 -1
- package/web.mjs +1 -1
package/node.test.js
CHANGED
|
@@ -42,131 +42,348 @@ var $;
|
|
|
42
42
|
"use strict";
|
|
43
43
|
var $;
|
|
44
44
|
(function ($) {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
45
|
+
let $mol_wire_cursor;
|
|
46
|
+
(function ($mol_wire_cursor) {
|
|
47
|
+
$mol_wire_cursor[$mol_wire_cursor["stale"] = -1] = "stale";
|
|
48
|
+
$mol_wire_cursor[$mol_wire_cursor["doubt"] = -2] = "doubt";
|
|
49
|
+
$mol_wire_cursor[$mol_wire_cursor["fresh"] = -3] = "fresh";
|
|
50
|
+
$mol_wire_cursor[$mol_wire_cursor["final"] = -4] = "final";
|
|
51
|
+
})($mol_wire_cursor = $.$mol_wire_cursor || ($.$mol_wire_cursor = {}));
|
|
49
52
|
})($ || ($ = {}));
|
|
50
53
|
|
|
51
54
|
;
|
|
52
55
|
"use strict";
|
|
53
56
|
var $;
|
|
54
57
|
(function ($) {
|
|
55
|
-
|
|
56
|
-
|
|
58
|
+
class $mol_wire_pub extends Object {
|
|
59
|
+
data = [];
|
|
60
|
+
static get [Symbol.species]() {
|
|
61
|
+
return Array;
|
|
62
|
+
}
|
|
63
|
+
sub_from = 0;
|
|
64
|
+
get sub_list() {
|
|
65
|
+
const res = [];
|
|
66
|
+
for (let i = this.sub_from; i < this.data.length; i += 2) {
|
|
67
|
+
res.push(this.data[i]);
|
|
68
|
+
}
|
|
69
|
+
return res;
|
|
70
|
+
}
|
|
71
|
+
get sub_empty() {
|
|
72
|
+
return this.sub_from === this.data.length;
|
|
73
|
+
}
|
|
74
|
+
sub_on(sub, pub_pos) {
|
|
75
|
+
const pos = this.data.length;
|
|
76
|
+
this.data.push(sub, pub_pos);
|
|
77
|
+
return pos;
|
|
78
|
+
}
|
|
79
|
+
sub_off(sub_pos) {
|
|
80
|
+
if (!(sub_pos < this.data.length)) {
|
|
81
|
+
$mol_fail(new Error(`Wrong pos ${sub_pos}`));
|
|
82
|
+
}
|
|
83
|
+
const end = this.data.length - 2;
|
|
84
|
+
if (sub_pos !== end) {
|
|
85
|
+
this.peer_move(end, sub_pos);
|
|
86
|
+
}
|
|
87
|
+
this.data.pop();
|
|
88
|
+
this.data.pop();
|
|
89
|
+
if (this.data.length === this.sub_from)
|
|
90
|
+
this.reap();
|
|
91
|
+
}
|
|
92
|
+
reap() { }
|
|
93
|
+
promote() {
|
|
94
|
+
$mol_wire_auto()?.track_next(this);
|
|
95
|
+
}
|
|
96
|
+
fresh() { }
|
|
97
|
+
complete() { }
|
|
98
|
+
get incompleted() {
|
|
99
|
+
return false;
|
|
100
|
+
}
|
|
101
|
+
emit(quant = $mol_wire_cursor.stale) {
|
|
102
|
+
for (let i = this.sub_from; i < this.data.length; i += 2) {
|
|
103
|
+
;
|
|
104
|
+
this.data[i].absorb(quant);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
peer_move(from_pos, to_pos) {
|
|
108
|
+
const peer = this.data[from_pos];
|
|
109
|
+
const self_pos = this.data[from_pos + 1];
|
|
110
|
+
this.data[to_pos] = peer;
|
|
111
|
+
this.data[to_pos + 1] = self_pos;
|
|
112
|
+
peer.peer_repos(self_pos, to_pos);
|
|
113
|
+
}
|
|
114
|
+
peer_repos(peer_pos, self_pos) {
|
|
115
|
+
this.data[peer_pos + 1] = self_pos;
|
|
116
|
+
}
|
|
57
117
|
}
|
|
58
|
-
$.$
|
|
118
|
+
$.$mol_wire_pub = $mol_wire_pub;
|
|
59
119
|
})($ || ($ = {}));
|
|
60
120
|
|
|
61
121
|
;
|
|
62
122
|
"use strict";
|
|
63
|
-
var $;
|
|
64
|
-
(function ($) {
|
|
65
|
-
const catched = new WeakMap();
|
|
66
|
-
function $mol_fail_catch(error) {
|
|
67
|
-
if (typeof error !== 'object')
|
|
68
|
-
return false;
|
|
69
|
-
if ($mol_promise_like(error))
|
|
70
|
-
$mol_fail_hidden(error);
|
|
71
|
-
if (catched.get(error))
|
|
72
|
-
return false;
|
|
73
|
-
catched.set(error, true);
|
|
74
|
-
return true;
|
|
75
|
-
}
|
|
76
|
-
$.$mol_fail_catch = $mol_fail_catch;
|
|
77
|
-
})($ || ($ = {}));
|
|
78
123
|
|
|
79
124
|
;
|
|
80
125
|
"use strict";
|
|
81
126
|
var $;
|
|
82
127
|
(function ($) {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
if (!$mol_fail_catch(error))
|
|
87
|
-
return false;
|
|
88
|
-
console.error(error);
|
|
89
|
-
return true;
|
|
128
|
+
$.$mol_wire_auto_sub = null;
|
|
129
|
+
function $mol_wire_auto(next = $.$mol_wire_auto_sub) {
|
|
130
|
+
return $.$mol_wire_auto_sub = next;
|
|
90
131
|
}
|
|
91
|
-
$.$
|
|
132
|
+
$.$mol_wire_auto = $mol_wire_auto;
|
|
133
|
+
$.$mol_wire_affected = [];
|
|
92
134
|
})($ || ($ = {}));
|
|
93
135
|
|
|
94
136
|
;
|
|
95
137
|
"use strict";
|
|
96
|
-
var
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
if (parent === dir) {
|
|
113
|
-
$$.$mol_exec('.', 'npm', 'install', '--omit=dev', name);
|
|
138
|
+
var $;
|
|
139
|
+
(function ($) {
|
|
140
|
+
$['devtoolsFormatters'] ||= [];
|
|
141
|
+
function $mol_dev_format_register(config) {
|
|
142
|
+
$['devtoolsFormatters'].push(config);
|
|
143
|
+
}
|
|
144
|
+
$.$mol_dev_format_register = $mol_dev_format_register;
|
|
145
|
+
$.$mol_dev_format_head = Symbol('$mol_dev_format_head');
|
|
146
|
+
$.$mol_dev_format_body = Symbol('$mol_dev_format_body');
|
|
147
|
+
$mol_dev_format_register({
|
|
148
|
+
header: (val, config = false) => {
|
|
149
|
+
if (config)
|
|
150
|
+
return null;
|
|
151
|
+
if (!val)
|
|
152
|
+
return null;
|
|
153
|
+
if ($.$mol_dev_format_head in val) {
|
|
114
154
|
try {
|
|
115
|
-
|
|
155
|
+
return val[$.$mol_dev_format_head]();
|
|
156
|
+
}
|
|
157
|
+
catch (error) {
|
|
158
|
+
return $.$mol_dev_format_accent($mol_dev_format_native(val), '💨', $mol_dev_format_native(error), '');
|
|
116
159
|
}
|
|
117
|
-
catch { }
|
|
118
|
-
break;
|
|
119
160
|
}
|
|
120
|
-
|
|
121
|
-
|
|
161
|
+
if (typeof val === 'function') {
|
|
162
|
+
return $mol_dev_format_native(val);
|
|
163
|
+
}
|
|
164
|
+
if (Symbol.toStringTag in val) {
|
|
165
|
+
return $mol_dev_format_native(val);
|
|
122
166
|
}
|
|
123
|
-
}
|
|
124
|
-
try {
|
|
125
|
-
return target.require(name);
|
|
126
|
-
}
|
|
127
|
-
catch (error) {
|
|
128
|
-
$.$mol_fail_log(error);
|
|
129
167
|
return null;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
(function ($) {
|
|
145
|
-
function $mol_log3_area_lazy(event) {
|
|
146
|
-
const self = this;
|
|
147
|
-
const stack = self.$mol_log3_stack;
|
|
148
|
-
const deep = stack.length;
|
|
149
|
-
let logged = false;
|
|
150
|
-
stack.push(() => {
|
|
151
|
-
logged = true;
|
|
152
|
-
self.$mol_log3_area.call(self, event);
|
|
153
|
-
});
|
|
154
|
-
return () => {
|
|
155
|
-
if (logged)
|
|
156
|
-
self.console.groupEnd();
|
|
157
|
-
if (stack.length > deep)
|
|
158
|
-
stack.length = deep;
|
|
159
|
-
};
|
|
168
|
+
},
|
|
169
|
+
hasBody: val => val[$.$mol_dev_format_body],
|
|
170
|
+
body: val => val[$.$mol_dev_format_body](),
|
|
171
|
+
});
|
|
172
|
+
function $mol_dev_format_native(obj) {
|
|
173
|
+
if (typeof obj === 'undefined')
|
|
174
|
+
return $.$mol_dev_format_shade('undefined');
|
|
175
|
+
return [
|
|
176
|
+
'object',
|
|
177
|
+
{
|
|
178
|
+
object: obj,
|
|
179
|
+
config: true,
|
|
180
|
+
},
|
|
181
|
+
];
|
|
160
182
|
}
|
|
161
|
-
$.$
|
|
162
|
-
|
|
183
|
+
$.$mol_dev_format_native = $mol_dev_format_native;
|
|
184
|
+
function $mol_dev_format_auto(obj) {
|
|
185
|
+
if (obj == null)
|
|
186
|
+
return $.$mol_dev_format_shade(String(obj));
|
|
187
|
+
return [
|
|
188
|
+
'object',
|
|
189
|
+
{
|
|
190
|
+
object: obj,
|
|
191
|
+
config: false,
|
|
192
|
+
},
|
|
193
|
+
];
|
|
194
|
+
}
|
|
195
|
+
$.$mol_dev_format_auto = $mol_dev_format_auto;
|
|
196
|
+
function $mol_dev_format_element(element, style, ...content) {
|
|
197
|
+
const styles = [];
|
|
198
|
+
for (let key in style)
|
|
199
|
+
styles.push(`${key} : ${style[key]}`);
|
|
200
|
+
return [
|
|
201
|
+
element,
|
|
202
|
+
{
|
|
203
|
+
style: styles.join(' ; '),
|
|
204
|
+
},
|
|
205
|
+
...content,
|
|
206
|
+
];
|
|
207
|
+
}
|
|
208
|
+
$.$mol_dev_format_element = $mol_dev_format_element;
|
|
209
|
+
function $mol_dev_format_span(style, ...content) {
|
|
210
|
+
return $mol_dev_format_element('span', {
|
|
211
|
+
...style,
|
|
212
|
+
}, ...content);
|
|
213
|
+
}
|
|
214
|
+
$.$mol_dev_format_span = $mol_dev_format_span;
|
|
215
|
+
$.$mol_dev_format_div = $mol_dev_format_element.bind(null, 'div');
|
|
216
|
+
$.$mol_dev_format_ol = $mol_dev_format_element.bind(null, 'ol');
|
|
217
|
+
$.$mol_dev_format_li = $mol_dev_format_element.bind(null, 'li');
|
|
218
|
+
$.$mol_dev_format_table = $mol_dev_format_element.bind(null, 'table');
|
|
219
|
+
$.$mol_dev_format_tr = $mol_dev_format_element.bind(null, 'tr');
|
|
220
|
+
$.$mol_dev_format_td = $mol_dev_format_element.bind(null, 'td');
|
|
221
|
+
$.$mol_dev_format_accent = $mol_dev_format_span.bind(null, {
|
|
222
|
+
'color': 'magenta',
|
|
223
|
+
});
|
|
224
|
+
$.$mol_dev_format_strong = $mol_dev_format_span.bind(null, {
|
|
225
|
+
'font-weight': 'bold',
|
|
226
|
+
});
|
|
227
|
+
$.$mol_dev_format_string = $mol_dev_format_span.bind(null, {
|
|
228
|
+
'color': 'green',
|
|
229
|
+
});
|
|
230
|
+
$.$mol_dev_format_shade = $mol_dev_format_span.bind(null, {
|
|
231
|
+
'color': 'gray',
|
|
232
|
+
});
|
|
233
|
+
$.$mol_dev_format_indent = $.$mol_dev_format_div.bind(null, {
|
|
234
|
+
'margin-left': '13px'
|
|
235
|
+
});
|
|
163
236
|
})($ || ($ = {}));
|
|
164
237
|
|
|
165
238
|
;
|
|
166
239
|
"use strict";
|
|
167
240
|
var $;
|
|
168
241
|
(function ($) {
|
|
169
|
-
|
|
242
|
+
class $mol_wire_pub_sub extends $mol_wire_pub {
|
|
243
|
+
pub_from = 0;
|
|
244
|
+
cursor = $mol_wire_cursor.stale;
|
|
245
|
+
get temp() {
|
|
246
|
+
return false;
|
|
247
|
+
}
|
|
248
|
+
get pub_list() {
|
|
249
|
+
const res = [];
|
|
250
|
+
const max = this.cursor >= 0 ? this.cursor : this.sub_from;
|
|
251
|
+
for (let i = this.pub_from; i < max; i += 2) {
|
|
252
|
+
if (this.data[i])
|
|
253
|
+
res.push(this.data[i]);
|
|
254
|
+
}
|
|
255
|
+
return res;
|
|
256
|
+
}
|
|
257
|
+
track_on() {
|
|
258
|
+
this.cursor = this.pub_from;
|
|
259
|
+
const sub = $mol_wire_auto();
|
|
260
|
+
$mol_wire_auto(this);
|
|
261
|
+
return sub;
|
|
262
|
+
}
|
|
263
|
+
promote() {
|
|
264
|
+
if (this.cursor >= this.pub_from) {
|
|
265
|
+
$mol_fail(new Error('Circular subscription'));
|
|
266
|
+
}
|
|
267
|
+
super.promote();
|
|
268
|
+
}
|
|
269
|
+
track_next(pub) {
|
|
270
|
+
if (this.cursor < 0)
|
|
271
|
+
$mol_fail(new Error('Promo to non begun sub'));
|
|
272
|
+
if (this.cursor < this.sub_from) {
|
|
273
|
+
const next = this.data[this.cursor];
|
|
274
|
+
if (pub === undefined)
|
|
275
|
+
return next ?? null;
|
|
276
|
+
if (next === pub) {
|
|
277
|
+
this.cursor += 2;
|
|
278
|
+
return next;
|
|
279
|
+
}
|
|
280
|
+
if (next) {
|
|
281
|
+
if (this.sub_from < this.data.length) {
|
|
282
|
+
this.peer_move(this.sub_from, this.data.length);
|
|
283
|
+
}
|
|
284
|
+
this.peer_move(this.cursor, this.sub_from);
|
|
285
|
+
this.sub_from += 2;
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
else {
|
|
289
|
+
if (pub === undefined)
|
|
290
|
+
return null;
|
|
291
|
+
if (this.sub_from < this.data.length) {
|
|
292
|
+
this.peer_move(this.sub_from, this.data.length);
|
|
293
|
+
}
|
|
294
|
+
this.sub_from += 2;
|
|
295
|
+
}
|
|
296
|
+
this.data[this.cursor] = pub;
|
|
297
|
+
this.data[this.cursor + 1] = pub.sub_on(this, this.cursor);
|
|
298
|
+
this.cursor += 2;
|
|
299
|
+
return pub;
|
|
300
|
+
}
|
|
301
|
+
track_off(sub) {
|
|
302
|
+
$mol_wire_auto(sub);
|
|
303
|
+
if (this.cursor < 0) {
|
|
304
|
+
$mol_fail(new Error('End of non begun sub'));
|
|
305
|
+
}
|
|
306
|
+
for (let cursor = this.pub_from; cursor < this.cursor; cursor += 2) {
|
|
307
|
+
const pub = this.data[cursor];
|
|
308
|
+
pub.fresh();
|
|
309
|
+
}
|
|
310
|
+
this.cursor = $mol_wire_cursor.fresh;
|
|
311
|
+
}
|
|
312
|
+
pub_off(sub_pos) {
|
|
313
|
+
this.data[sub_pos] = undefined;
|
|
314
|
+
this.data[sub_pos + 1] = undefined;
|
|
315
|
+
}
|
|
316
|
+
destructor() {
|
|
317
|
+
for (let cursor = this.data.length - 2; cursor >= this.sub_from; cursor -= 2) {
|
|
318
|
+
const sub = this.data[cursor];
|
|
319
|
+
const pos = this.data[cursor + 1];
|
|
320
|
+
sub.pub_off(pos);
|
|
321
|
+
this.data.pop();
|
|
322
|
+
this.data.pop();
|
|
323
|
+
}
|
|
324
|
+
this.cursor = this.pub_from;
|
|
325
|
+
this.track_cut();
|
|
326
|
+
this.cursor = $mol_wire_cursor.final;
|
|
327
|
+
}
|
|
328
|
+
track_cut() {
|
|
329
|
+
if (this.cursor < this.pub_from) {
|
|
330
|
+
$mol_fail(new Error('Cut of non begun sub'));
|
|
331
|
+
}
|
|
332
|
+
let tail = 0;
|
|
333
|
+
for (let cursor = this.cursor; cursor < this.sub_from; cursor += 2) {
|
|
334
|
+
const pub = this.data[cursor];
|
|
335
|
+
pub?.sub_off(this.data[cursor + 1]);
|
|
336
|
+
if (this.sub_from < this.data.length) {
|
|
337
|
+
this.peer_move(this.data.length - 2, cursor);
|
|
338
|
+
this.data.pop();
|
|
339
|
+
this.data.pop();
|
|
340
|
+
}
|
|
341
|
+
else {
|
|
342
|
+
++tail;
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
for (; tail; --tail) {
|
|
346
|
+
this.data.pop();
|
|
347
|
+
this.data.pop();
|
|
348
|
+
}
|
|
349
|
+
this.sub_from = this.cursor;
|
|
350
|
+
}
|
|
351
|
+
complete() { }
|
|
352
|
+
complete_pubs() {
|
|
353
|
+
const limit = this.cursor < 0 ? this.sub_from : this.cursor;
|
|
354
|
+
for (let cursor = this.pub_from; cursor < limit; cursor += 2) {
|
|
355
|
+
const pub = this.data[cursor];
|
|
356
|
+
if (pub?.incompleted)
|
|
357
|
+
return;
|
|
358
|
+
}
|
|
359
|
+
for (let cursor = this.pub_from; cursor < limit; cursor += 2) {
|
|
360
|
+
const pub = this.data[cursor];
|
|
361
|
+
pub?.complete();
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
absorb(quant = $mol_wire_cursor.stale) {
|
|
365
|
+
if (this.cursor === $mol_wire_cursor.final)
|
|
366
|
+
return;
|
|
367
|
+
if (this.cursor >= quant)
|
|
368
|
+
return;
|
|
369
|
+
this.cursor = quant;
|
|
370
|
+
this.emit($mol_wire_cursor.doubt);
|
|
371
|
+
}
|
|
372
|
+
[$mol_dev_format_head]() {
|
|
373
|
+
return $mol_dev_format_native(this);
|
|
374
|
+
}
|
|
375
|
+
get pub_empty() {
|
|
376
|
+
return this.sub_from === this.pub_from;
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
$.$mol_wire_pub_sub = $mol_wire_pub_sub;
|
|
380
|
+
})($ || ($ = {}));
|
|
381
|
+
|
|
382
|
+
;
|
|
383
|
+
"use strict";
|
|
384
|
+
var $;
|
|
385
|
+
(function ($) {
|
|
386
|
+
$.$mol_ambient_ref = Symbol('$mol_ambient_ref');
|
|
170
387
|
function $mol_ambient(overrides) {
|
|
171
388
|
return Object.setPrototypeOf(overrides, this || $);
|
|
172
389
|
}
|
|
@@ -266,6 +483,16 @@ var $;
|
|
|
266
483
|
$.$mol_owning_catch = $mol_owning_catch;
|
|
267
484
|
})($ || ($ = {}));
|
|
268
485
|
|
|
486
|
+
;
|
|
487
|
+
"use strict";
|
|
488
|
+
var $;
|
|
489
|
+
(function ($) {
|
|
490
|
+
function $mol_fail_hidden(error) {
|
|
491
|
+
throw error;
|
|
492
|
+
}
|
|
493
|
+
$.$mol_fail_hidden = $mol_fail_hidden;
|
|
494
|
+
})($ || ($ = {}));
|
|
495
|
+
|
|
269
496
|
;
|
|
270
497
|
"use strict";
|
|
271
498
|
|
|
@@ -348,1358 +575,1362 @@ var $;
|
|
|
348
575
|
"use strict";
|
|
349
576
|
var $;
|
|
350
577
|
(function ($) {
|
|
351
|
-
class $
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
length;
|
|
357
|
-
constructor(uri, source, row, col, length) {
|
|
578
|
+
class $mol_after_timeout extends $mol_object2 {
|
|
579
|
+
delay;
|
|
580
|
+
task;
|
|
581
|
+
id;
|
|
582
|
+
constructor(delay, task) {
|
|
358
583
|
super();
|
|
359
|
-
this.
|
|
360
|
-
this.
|
|
361
|
-
this.
|
|
362
|
-
this.col = col;
|
|
363
|
-
this.length = length;
|
|
364
|
-
this[Symbol.toStringTag] = `${this.uri}#${this.row}:${this.col}/${this.length}`;
|
|
365
|
-
}
|
|
366
|
-
static unknown = $mol_span.begin('?');
|
|
367
|
-
static begin(uri, source = '') {
|
|
368
|
-
return new $mol_span(uri, source, 1, 1, 0);
|
|
369
|
-
}
|
|
370
|
-
static end(uri, source) {
|
|
371
|
-
return new $mol_span(uri, source, 1, source.length + 1, 0);
|
|
372
|
-
}
|
|
373
|
-
static entire(uri, source) {
|
|
374
|
-
return new $mol_span(uri, source, 1, 1, source.length);
|
|
375
|
-
}
|
|
376
|
-
toString() {
|
|
377
|
-
return this[Symbol.toStringTag];
|
|
378
|
-
}
|
|
379
|
-
toJSON() {
|
|
380
|
-
return {
|
|
381
|
-
uri: this.uri,
|
|
382
|
-
row: this.row,
|
|
383
|
-
col: this.col,
|
|
384
|
-
length: this.length
|
|
385
|
-
};
|
|
386
|
-
}
|
|
387
|
-
error(message, Class = Error) {
|
|
388
|
-
return new Class(`${message} (${this})`);
|
|
389
|
-
}
|
|
390
|
-
span(row, col, length) {
|
|
391
|
-
return new $mol_span(this.uri, this.source, row, col, length);
|
|
392
|
-
}
|
|
393
|
-
after(length = 0) {
|
|
394
|
-
return new $mol_span(this.uri, this.source, this.row, this.col + this.length, length);
|
|
584
|
+
this.delay = delay;
|
|
585
|
+
this.task = task;
|
|
586
|
+
this.id = setTimeout(task, delay);
|
|
395
587
|
}
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
if (begin < 0)
|
|
399
|
-
begin += len;
|
|
400
|
-
if (end < 0)
|
|
401
|
-
end += len;
|
|
402
|
-
if (begin < 0 || begin > len)
|
|
403
|
-
this.$.$mol_fail(this.error(`Begin value '${begin}' out of range`, RangeError));
|
|
404
|
-
if (end < 0 || end > len)
|
|
405
|
-
this.$.$mol_fail(this.error(`End value '${end}' out of range`, RangeError));
|
|
406
|
-
if (end < begin)
|
|
407
|
-
this.$.$mol_fail(this.error(`End value '${end}' can't be less than begin value`, RangeError));
|
|
408
|
-
return this.span(this.row, this.col + begin, end - begin);
|
|
588
|
+
destructor() {
|
|
589
|
+
clearTimeout(this.id);
|
|
409
590
|
}
|
|
410
591
|
}
|
|
411
|
-
$.$
|
|
592
|
+
$.$mol_after_timeout = $mol_after_timeout;
|
|
412
593
|
})($ || ($ = {}));
|
|
413
594
|
|
|
414
595
|
;
|
|
415
596
|
"use strict";
|
|
416
597
|
var $;
|
|
417
598
|
(function ($) {
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
prefix = "\t";
|
|
424
|
-
}
|
|
425
|
-
output.push(tree.type);
|
|
426
|
-
if (tree.kids.length == 1) {
|
|
427
|
-
output.push(' ');
|
|
428
|
-
dump(tree.kids[0], prefix);
|
|
429
|
-
return;
|
|
430
|
-
}
|
|
431
|
-
output.push("\n");
|
|
432
|
-
}
|
|
433
|
-
else if (tree.value.length || prefix.length) {
|
|
434
|
-
output.push("\\" + tree.value + "\n");
|
|
435
|
-
}
|
|
436
|
-
for (const kid of tree.kids) {
|
|
437
|
-
output.push(prefix);
|
|
438
|
-
dump(kid, prefix + "\t");
|
|
439
|
-
}
|
|
599
|
+
class $mol_after_frame extends $mol_after_timeout {
|
|
600
|
+
task;
|
|
601
|
+
constructor(task) {
|
|
602
|
+
super(16, task);
|
|
603
|
+
this.task = task;
|
|
440
604
|
}
|
|
441
|
-
dump(tree);
|
|
442
|
-
return output.join('');
|
|
443
605
|
}
|
|
444
|
-
$.$
|
|
606
|
+
$.$mol_after_frame = $mol_after_frame;
|
|
445
607
|
})($ || ($ = {}));
|
|
446
608
|
|
|
447
609
|
;
|
|
448
610
|
"use strict";
|
|
449
611
|
var $;
|
|
450
612
|
(function ($) {
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
613
|
+
function $mol_promise_like(val) {
|
|
614
|
+
return val && typeof val === 'object' && 'then' in val && typeof val.then === 'function';
|
|
615
|
+
}
|
|
616
|
+
$.$mol_promise_like = $mol_promise_like;
|
|
617
|
+
})($ || ($ = {}));
|
|
618
|
+
|
|
619
|
+
;
|
|
620
|
+
"use strict";
|
|
621
|
+
var $;
|
|
622
|
+
(function ($) {
|
|
623
|
+
const handled = new WeakSet();
|
|
624
|
+
class $mol_wire_fiber extends $mol_wire_pub_sub {
|
|
625
|
+
task;
|
|
626
|
+
host;
|
|
627
|
+
static warm = true;
|
|
628
|
+
static planning = new Set();
|
|
629
|
+
static reaping = new Set();
|
|
630
|
+
static plan_task = null;
|
|
631
|
+
static plan() {
|
|
632
|
+
if (this.plan_task)
|
|
633
|
+
return;
|
|
634
|
+
this.plan_task = new $mol_after_frame(() => {
|
|
635
|
+
try {
|
|
636
|
+
this.sync();
|
|
637
|
+
}
|
|
638
|
+
finally {
|
|
639
|
+
$mol_wire_fiber.plan_task = null;
|
|
640
|
+
}
|
|
641
|
+
});
|
|
469
642
|
}
|
|
470
|
-
static
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
643
|
+
static sync() {
|
|
644
|
+
while (this.planning.size) {
|
|
645
|
+
for (const fiber of this.planning) {
|
|
646
|
+
this.planning.delete(fiber);
|
|
647
|
+
if (fiber.cursor >= 0)
|
|
648
|
+
continue;
|
|
649
|
+
if (fiber.cursor === $mol_wire_cursor.final)
|
|
650
|
+
continue;
|
|
651
|
+
fiber.fresh();
|
|
652
|
+
}
|
|
480
653
|
}
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
654
|
+
while (this.reaping.size) {
|
|
655
|
+
const fibers = this.reaping;
|
|
656
|
+
this.reaping = new Set;
|
|
657
|
+
for (const fiber of fibers) {
|
|
658
|
+
if (!fiber.sub_empty)
|
|
659
|
+
continue;
|
|
660
|
+
fiber.destructor();
|
|
661
|
+
}
|
|
489
662
|
}
|
|
490
|
-
return new $mol_tree2(type, '', kids, span);
|
|
491
663
|
}
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
return new $mol_tree2(this.type, this.value, kids, span);
|
|
664
|
+
[Symbol.toStringTag];
|
|
665
|
+
cache = undefined;
|
|
666
|
+
get args() {
|
|
667
|
+
return this.data.slice(0, this.pub_from);
|
|
497
668
|
}
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
}
|
|
505
|
-
return this.value + values.join('\n');
|
|
669
|
+
result() {
|
|
670
|
+
if ($mol_promise_like(this.cache))
|
|
671
|
+
return;
|
|
672
|
+
if (this.cache instanceof Error)
|
|
673
|
+
return;
|
|
674
|
+
return this.cache;
|
|
506
675
|
}
|
|
507
|
-
|
|
508
|
-
return
|
|
676
|
+
get incompleted() {
|
|
677
|
+
return $mol_promise_like(this.cache);
|
|
509
678
|
}
|
|
510
|
-
|
|
511
|
-
return
|
|
679
|
+
field() {
|
|
680
|
+
return this.task.name + '<>';
|
|
512
681
|
}
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
if (
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
return item;
|
|
522
|
-
replaced = true;
|
|
523
|
-
return item.insert(value, ...path.slice(1));
|
|
524
|
-
}).filter(Boolean);
|
|
525
|
-
if (!replaced && value) {
|
|
526
|
-
sub.push(this.struct(type, []).insert(value, ...path.slice(1)));
|
|
527
|
-
}
|
|
528
|
-
return this.clone(sub);
|
|
529
|
-
}
|
|
530
|
-
else if (typeof type === 'number') {
|
|
531
|
-
const sub = this.kids.slice();
|
|
532
|
-
sub[type] = (sub[type] || this.list([]))
|
|
533
|
-
.insert(value, ...path.slice(1));
|
|
534
|
-
return this.clone(sub.filter(Boolean));
|
|
535
|
-
}
|
|
536
|
-
else {
|
|
537
|
-
const kids = ((this.kids.length === 0) ? [this.list([])] : this.kids)
|
|
538
|
-
.map(item => item.insert(value, ...path.slice(1)))
|
|
539
|
-
.filter(Boolean);
|
|
540
|
-
return this.clone(kids);
|
|
541
|
-
}
|
|
682
|
+
constructor(id, task, host, args) {
|
|
683
|
+
super();
|
|
684
|
+
this.task = task;
|
|
685
|
+
this.host = host;
|
|
686
|
+
if (args)
|
|
687
|
+
this.data.push(...args);
|
|
688
|
+
this.pub_from = this.sub_from = args?.length ?? 0;
|
|
689
|
+
this[Symbol.toStringTag] = id;
|
|
542
690
|
}
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
if (!next.length)
|
|
547
|
-
break;
|
|
548
|
-
const prev = next;
|
|
549
|
-
next = [];
|
|
550
|
-
for (var item of prev) {
|
|
551
|
-
switch (typeof (type)) {
|
|
552
|
-
case 'string':
|
|
553
|
-
for (var child of item.kids) {
|
|
554
|
-
if (child.type == type) {
|
|
555
|
-
next.push(child);
|
|
556
|
-
}
|
|
557
|
-
}
|
|
558
|
-
break;
|
|
559
|
-
case 'number':
|
|
560
|
-
if (type < item.kids.length)
|
|
561
|
-
next.push(item.kids[type]);
|
|
562
|
-
break;
|
|
563
|
-
default: next.push(...item.kids);
|
|
564
|
-
}
|
|
565
|
-
}
|
|
566
|
-
}
|
|
567
|
-
return this.list(next);
|
|
691
|
+
plan() {
|
|
692
|
+
$mol_wire_fiber.planning.add(this);
|
|
693
|
+
$mol_wire_fiber.plan();
|
|
568
694
|
}
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
if (value === undefined) {
|
|
573
|
-
return Boolean(found.kids.length);
|
|
574
|
-
}
|
|
575
|
-
else {
|
|
576
|
-
return found.kids.some(child => child.value == value);
|
|
577
|
-
}
|
|
578
|
-
});
|
|
579
|
-
return this.clone(sub);
|
|
695
|
+
reap() {
|
|
696
|
+
$mol_wire_fiber.reaping.add(this);
|
|
697
|
+
$mol_wire_fiber.plan();
|
|
580
698
|
}
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
if (!handle || handle === Object.prototype[this.type]) {
|
|
584
|
-
handle = (input, belt, context) => [
|
|
585
|
-
input.clone(input.hack(belt, context), context.span)
|
|
586
|
-
];
|
|
587
|
-
}
|
|
588
|
-
try {
|
|
589
|
-
return handle(this, belt, context);
|
|
590
|
-
}
|
|
591
|
-
catch (error) {
|
|
592
|
-
error.message += `\n${this.clone([])}${this.span}`;
|
|
593
|
-
$mol_fail_hidden(error);
|
|
594
|
-
}
|
|
699
|
+
toString() {
|
|
700
|
+
return this[Symbol.toStringTag];
|
|
595
701
|
}
|
|
596
|
-
|
|
597
|
-
return []
|
|
702
|
+
toJSON() {
|
|
703
|
+
return this[Symbol.toStringTag];
|
|
598
704
|
}
|
|
599
|
-
|
|
600
|
-
|
|
705
|
+
[$mol_dev_format_head]() {
|
|
706
|
+
const cursor = {
|
|
707
|
+
[$mol_wire_cursor.stale]: '🔴',
|
|
708
|
+
[$mol_wire_cursor.doubt]: '🟡',
|
|
709
|
+
[$mol_wire_cursor.fresh]: '🟢',
|
|
710
|
+
[$mol_wire_cursor.final]: '🔵',
|
|
711
|
+
}[this.cursor] ?? this.cursor.toString();
|
|
712
|
+
return $mol_dev_format_div({}, $mol_owning_check(this, this.cache)
|
|
713
|
+
? $mol_dev_format_auto({
|
|
714
|
+
[$mol_dev_format_head]: () => $mol_dev_format_shade(cursor),
|
|
715
|
+
[$mol_dev_format_body]: () => $mol_dev_format_native(this),
|
|
716
|
+
})
|
|
717
|
+
: $mol_dev_format_shade($mol_dev_format_native(this), cursor), $mol_dev_format_auto(this.cache));
|
|
601
718
|
}
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
class $mol_tree2_empty extends $mol_tree2 {
|
|
605
|
-
constructor() {
|
|
606
|
-
super('', '', [], $mol_span.unknown);
|
|
719
|
+
get $() {
|
|
720
|
+
return (this.host ?? this.task)['$'];
|
|
607
721
|
}
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
;
|
|
613
|
-
"use strict";
|
|
614
|
-
var $;
|
|
615
|
-
(function ($) {
|
|
616
|
-
class $mol_error_syntax extends SyntaxError {
|
|
617
|
-
reason;
|
|
618
|
-
line;
|
|
619
|
-
span;
|
|
620
|
-
constructor(reason, line, span) {
|
|
621
|
-
super(`${reason}\n${span}\n${line.substring(0, span.col - 1).replace(/\S/g, ' ')}${''.padEnd(span.length, '!')}\n${line}`);
|
|
622
|
-
this.reason = reason;
|
|
623
|
-
this.line = line;
|
|
624
|
-
this.span = span;
|
|
722
|
+
emit(quant = $mol_wire_cursor.stale) {
|
|
723
|
+
if (this.sub_empty)
|
|
724
|
+
this.plan();
|
|
725
|
+
else
|
|
726
|
+
super.emit(quant);
|
|
625
727
|
}
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
;
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
var stack = [root];
|
|
638
|
-
var pos = 0, row = 0, min_indent = 0;
|
|
639
|
-
while (str.length > pos) {
|
|
640
|
-
var indent = 0;
|
|
641
|
-
var line_start = pos;
|
|
642
|
-
row++;
|
|
643
|
-
while (str.length > pos && str[pos] == '\t') {
|
|
644
|
-
indent++;
|
|
645
|
-
pos++;
|
|
646
|
-
}
|
|
647
|
-
if (!root.kids.length) {
|
|
648
|
-
min_indent = indent;
|
|
649
|
-
}
|
|
650
|
-
indent -= min_indent;
|
|
651
|
-
if (indent < 0 || indent >= stack.length) {
|
|
652
|
-
const sp = span.span(row, 1, pos - line_start);
|
|
653
|
-
while (str.length > pos && str[pos] != '\n') {
|
|
654
|
-
pos++;
|
|
655
|
-
}
|
|
656
|
-
if (indent < 0) {
|
|
657
|
-
if (str.length > pos) {
|
|
658
|
-
this.$mol_fail(new this.$mol_error_syntax(`Too few tabs`, str.substring(line_start, pos), sp));
|
|
659
|
-
}
|
|
660
|
-
}
|
|
661
|
-
else {
|
|
662
|
-
this.$mol_fail(new this.$mol_error_syntax(`Too many tabs`, str.substring(line_start, pos), sp));
|
|
728
|
+
fresh() {
|
|
729
|
+
if (this.cursor === $mol_wire_cursor.fresh)
|
|
730
|
+
return;
|
|
731
|
+
if (this.cursor === $mol_wire_cursor.final)
|
|
732
|
+
return;
|
|
733
|
+
check: if (this.cursor === $mol_wire_cursor.doubt) {
|
|
734
|
+
for (let i = this.pub_from; i < this.sub_from; i += 2) {
|
|
735
|
+
;
|
|
736
|
+
this.data[i]?.fresh();
|
|
737
|
+
if (this.cursor !== $mol_wire_cursor.doubt)
|
|
738
|
+
break check;
|
|
663
739
|
}
|
|
740
|
+
this.cursor = $mol_wire_cursor.fresh;
|
|
741
|
+
return;
|
|
664
742
|
}
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
743
|
+
const bu = this.track_on();
|
|
744
|
+
let result;
|
|
745
|
+
try {
|
|
746
|
+
switch (this.pub_from) {
|
|
747
|
+
case 0:
|
|
748
|
+
result = this.task.call(this.host);
|
|
749
|
+
break;
|
|
750
|
+
case 1:
|
|
751
|
+
result = this.task.call(this.host, this.data[0]);
|
|
752
|
+
break;
|
|
753
|
+
default:
|
|
754
|
+
result = this.task.call(this.host, ...this.args);
|
|
755
|
+
break;
|
|
671
756
|
}
|
|
672
|
-
if (
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
757
|
+
if ($mol_promise_like(result) && !handled.has(result)) {
|
|
758
|
+
const put = (res) => {
|
|
759
|
+
if (this.cache === result)
|
|
760
|
+
this.put(res);
|
|
761
|
+
return res;
|
|
762
|
+
};
|
|
763
|
+
result = result.then(put, put);
|
|
678
764
|
}
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
str[pos] != '\t' &&
|
|
684
|
-
str[pos] != '\n') {
|
|
685
|
-
pos++;
|
|
765
|
+
}
|
|
766
|
+
catch (error) {
|
|
767
|
+
if (error instanceof Error || $mol_promise_like(error)) {
|
|
768
|
+
result = error;
|
|
686
769
|
}
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
const parent_kids = parent.kids;
|
|
690
|
-
parent_kids.push(next);
|
|
691
|
-
parent = next;
|
|
770
|
+
else {
|
|
771
|
+
result = new Error(String(error), { cause: error });
|
|
692
772
|
}
|
|
693
|
-
if (
|
|
694
|
-
|
|
773
|
+
if ($mol_promise_like(result) && !handled.has(result)) {
|
|
774
|
+
result = result.finally(() => {
|
|
775
|
+
if (this.cache === result)
|
|
776
|
+
this.absorb();
|
|
777
|
+
});
|
|
695
778
|
}
|
|
696
779
|
}
|
|
697
|
-
if (
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
780
|
+
if ($mol_promise_like(result) && !handled.has(result)) {
|
|
781
|
+
result = Object.assign(result, {
|
|
782
|
+
destructor: result['destructor'] ?? (() => { })
|
|
783
|
+
});
|
|
784
|
+
handled.add(result);
|
|
785
|
+
const error = new Error(`Promise in ${this}`);
|
|
786
|
+
Object.defineProperty(result, 'stack', { get: () => error.stack });
|
|
787
|
+
}
|
|
788
|
+
if (!$mol_promise_like(result)) {
|
|
789
|
+
this.track_cut();
|
|
790
|
+
}
|
|
791
|
+
this.track_off(bu);
|
|
792
|
+
this.put(result);
|
|
793
|
+
}
|
|
794
|
+
refresh() {
|
|
795
|
+
this.cursor = $mol_wire_cursor.stale;
|
|
796
|
+
this.fresh();
|
|
797
|
+
}
|
|
798
|
+
sync() {
|
|
799
|
+
if (!$mol_wire_fiber.warm) {
|
|
800
|
+
return this.result();
|
|
706
801
|
}
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
802
|
+
this.promote();
|
|
803
|
+
this.fresh();
|
|
804
|
+
if (this.cache instanceof Error) {
|
|
805
|
+
return $mol_fail_hidden(this.cache);
|
|
710
806
|
}
|
|
711
|
-
|
|
712
|
-
|
|
807
|
+
if ($mol_promise_like(this.cache)) {
|
|
808
|
+
return $mol_fail_hidden(this.cache);
|
|
809
|
+
}
|
|
810
|
+
return this.cache;
|
|
811
|
+
}
|
|
812
|
+
async async() {
|
|
813
|
+
while (true) {
|
|
814
|
+
this.fresh();
|
|
815
|
+
if (this.cache instanceof Error) {
|
|
816
|
+
$mol_fail_hidden(this.cache);
|
|
817
|
+
}
|
|
818
|
+
if (!$mol_promise_like(this.cache))
|
|
819
|
+
return this.cache;
|
|
820
|
+
await Promise.race([this.cache, this.step()]);
|
|
821
|
+
if (!$mol_promise_like(this.cache))
|
|
822
|
+
return this.cache;
|
|
823
|
+
if (this.cursor === $mol_wire_cursor.final) {
|
|
824
|
+
await new Promise(() => { });
|
|
825
|
+
}
|
|
826
|
+
}
|
|
827
|
+
}
|
|
828
|
+
step() {
|
|
829
|
+
return new Promise(done => {
|
|
830
|
+
const sub = new $mol_wire_pub_sub;
|
|
831
|
+
const prev = sub.track_on();
|
|
832
|
+
sub.track_next(this);
|
|
833
|
+
sub.track_off(prev);
|
|
834
|
+
sub.absorb = () => {
|
|
835
|
+
done(null);
|
|
836
|
+
sub.destructor();
|
|
837
|
+
};
|
|
838
|
+
});
|
|
713
839
|
}
|
|
714
|
-
return root;
|
|
715
840
|
}
|
|
716
|
-
$.$
|
|
841
|
+
$.$mol_wire_fiber = $mol_wire_fiber;
|
|
717
842
|
})($ || ($ = {}));
|
|
718
843
|
|
|
719
844
|
;
|
|
720
845
|
"use strict";
|
|
721
846
|
var $;
|
|
722
847
|
(function ($) {
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
if (
|
|
728
|
-
return
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
return
|
|
848
|
+
$.$mol_compare_deep_cache = new WeakMap();
|
|
849
|
+
function $mol_compare_deep(left, right) {
|
|
850
|
+
if (Object.is(left, right))
|
|
851
|
+
return true;
|
|
852
|
+
if (left === null)
|
|
853
|
+
return false;
|
|
854
|
+
if (right === null)
|
|
855
|
+
return false;
|
|
856
|
+
if (typeof left !== 'object')
|
|
857
|
+
return false;
|
|
858
|
+
if (typeof right !== 'object')
|
|
859
|
+
return false;
|
|
860
|
+
const left_proto = Reflect.getPrototypeOf(left);
|
|
861
|
+
const right_proto = Reflect.getPrototypeOf(right);
|
|
862
|
+
if (left_proto !== right_proto)
|
|
863
|
+
return false;
|
|
864
|
+
if (left instanceof Boolean)
|
|
865
|
+
return Object.is(left.valueOf(), right['valueOf']());
|
|
866
|
+
if (left instanceof Number)
|
|
867
|
+
return Object.is(left.valueOf(), right['valueOf']());
|
|
868
|
+
if (left instanceof String)
|
|
869
|
+
return Object.is(left.valueOf(), right['valueOf']());
|
|
870
|
+
if (left instanceof Date)
|
|
871
|
+
return Object.is(left.valueOf(), right['valueOf']());
|
|
872
|
+
if (left instanceof RegExp)
|
|
873
|
+
return left.source === right.source && left.flags === right.flags;
|
|
874
|
+
if (left instanceof Error)
|
|
875
|
+
return left.message === right.message && left.stack === right.stack;
|
|
876
|
+
let left_cache = $.$mol_compare_deep_cache.get(left);
|
|
877
|
+
if (left_cache) {
|
|
878
|
+
const right_cache = left_cache.get(right);
|
|
879
|
+
if (typeof right_cache === 'boolean')
|
|
880
|
+
return right_cache;
|
|
733
881
|
}
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
882
|
+
else {
|
|
883
|
+
left_cache = new WeakMap([[right, true]]);
|
|
884
|
+
$.$mol_compare_deep_cache.set(left, left_cache);
|
|
737
885
|
}
|
|
738
|
-
|
|
739
|
-
|
|
886
|
+
let result;
|
|
887
|
+
try {
|
|
888
|
+
if (!left_proto)
|
|
889
|
+
result = compare_pojo(left, right);
|
|
890
|
+
else if (!Reflect.getPrototypeOf(left_proto))
|
|
891
|
+
result = compare_pojo(left, right);
|
|
892
|
+
else if (Symbol.toPrimitive in left)
|
|
893
|
+
result = compare_primitive(left, right);
|
|
894
|
+
else if (Array.isArray(left))
|
|
895
|
+
result = compare_array(left, right);
|
|
896
|
+
else if (left instanceof Set)
|
|
897
|
+
result = compare_set(left, right);
|
|
898
|
+
else if (left instanceof Map)
|
|
899
|
+
result = compare_map(left, right);
|
|
900
|
+
else if (ArrayBuffer.isView(left))
|
|
901
|
+
result = compare_buffer(left, right);
|
|
902
|
+
else if (Symbol.iterator in left)
|
|
903
|
+
result = compare_iterator(left[Symbol.iterator](), right[Symbol.iterator]());
|
|
904
|
+
else
|
|
905
|
+
result = false;
|
|
740
906
|
}
|
|
741
|
-
|
|
742
|
-
|
|
907
|
+
finally {
|
|
908
|
+
left_cache.set(right, result);
|
|
743
909
|
}
|
|
744
|
-
|
|
745
|
-
|
|
910
|
+
return result;
|
|
911
|
+
}
|
|
912
|
+
$.$mol_compare_deep = $mol_compare_deep;
|
|
913
|
+
function compare_array(left, right) {
|
|
914
|
+
const len = left.length;
|
|
915
|
+
if (len !== right.length)
|
|
916
|
+
return false;
|
|
917
|
+
for (let i = 0; i < len; ++i) {
|
|
918
|
+
if (!$mol_compare_deep(left[i], right[i]))
|
|
919
|
+
return false;
|
|
746
920
|
}
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
921
|
+
return true;
|
|
922
|
+
}
|
|
923
|
+
function compare_buffer(left, right) {
|
|
924
|
+
const len = left.byteLength;
|
|
925
|
+
if (len !== right.byteLength)
|
|
926
|
+
return false;
|
|
927
|
+
if (left instanceof DataView)
|
|
928
|
+
return compare_buffer(new Uint8Array(left.buffer, left.byteOffset, left.byteLength), new Uint8Array(right.buffer, left.byteOffset, left.byteLength));
|
|
929
|
+
for (let i = 0; i < len; ++i) {
|
|
930
|
+
if (left[i] !== right[i])
|
|
931
|
+
return false;
|
|
750
932
|
}
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
const
|
|
757
|
-
if (
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
933
|
+
return true;
|
|
934
|
+
}
|
|
935
|
+
function compare_iterator(left, right) {
|
|
936
|
+
while (true) {
|
|
937
|
+
const left_next = left.next();
|
|
938
|
+
const right_next = right.next();
|
|
939
|
+
if (left_next.done !== right_next.done)
|
|
940
|
+
return false;
|
|
941
|
+
if (left_next.done)
|
|
942
|
+
break;
|
|
943
|
+
if (!$mol_compare_deep(left_next.value, right_next.value))
|
|
944
|
+
return false;
|
|
763
945
|
}
|
|
764
|
-
return
|
|
946
|
+
return true;
|
|
765
947
|
}
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
;
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
(
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
static Magenta = (str) => this.inverse(this.magenta(str));
|
|
794
|
-
static Cyan = (str) => this.inverse(this.cyan(str));
|
|
795
|
-
static ansi(open, close) {
|
|
796
|
-
if (typeof process === 'undefined')
|
|
797
|
-
return String;
|
|
798
|
-
if (!process.stdout.isTTY)
|
|
799
|
-
return String;
|
|
800
|
-
const prefix = `\x1b[${open}m`;
|
|
801
|
-
const postfix = `\x1b[${close}m`;
|
|
802
|
-
const suffix_regexp = new RegExp(postfix.replace('[', '\\['), 'g');
|
|
803
|
-
return function colorer(str) {
|
|
804
|
-
str = String(str);
|
|
805
|
-
if (str === '')
|
|
806
|
-
return str;
|
|
807
|
-
const suffix = str.replace(suffix_regexp, prefix);
|
|
808
|
-
return prefix + suffix + postfix;
|
|
809
|
-
};
|
|
948
|
+
function compare_set(left, right) {
|
|
949
|
+
if (left.size !== right.size)
|
|
950
|
+
return false;
|
|
951
|
+
return compare_iterator(left.values(), right.values());
|
|
952
|
+
}
|
|
953
|
+
function compare_map(left, right) {
|
|
954
|
+
if (left.size !== right.size)
|
|
955
|
+
return false;
|
|
956
|
+
return compare_iterator(left.keys(), right.keys())
|
|
957
|
+
&& compare_iterator(left.values(), right.values());
|
|
958
|
+
}
|
|
959
|
+
function compare_pojo(left, right) {
|
|
960
|
+
const left_keys = Object.getOwnPropertyNames(left);
|
|
961
|
+
const right_keys = Object.getOwnPropertyNames(right);
|
|
962
|
+
if (!compare_array(left_keys, right_keys))
|
|
963
|
+
return false;
|
|
964
|
+
for (let key of left_keys) {
|
|
965
|
+
if (!$mol_compare_deep(left[key], right[key]))
|
|
966
|
+
return false;
|
|
967
|
+
}
|
|
968
|
+
const left_syms = Object.getOwnPropertySymbols(left);
|
|
969
|
+
const right_syms = Object.getOwnPropertySymbols(right);
|
|
970
|
+
if (!compare_array(left_syms, right_syms))
|
|
971
|
+
return false;
|
|
972
|
+
for (let key of left_syms) {
|
|
973
|
+
if (!$mol_compare_deep(left[key], right[key]))
|
|
974
|
+
return false;
|
|
810
975
|
}
|
|
976
|
+
return true;
|
|
977
|
+
}
|
|
978
|
+
function compare_primitive(left, right) {
|
|
979
|
+
return Object.is(left[Symbol.toPrimitive]('default'), right[Symbol.toPrimitive]('default'));
|
|
811
980
|
}
|
|
812
|
-
$.$mol_term_color = $mol_term_color;
|
|
813
981
|
})($ || ($ = {}));
|
|
814
982
|
|
|
815
983
|
;
|
|
816
984
|
"use strict";
|
|
817
985
|
var $;
|
|
818
986
|
(function ($) {
|
|
819
|
-
function $
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
987
|
+
function $mol_log3_area_lazy(event) {
|
|
988
|
+
const self = this;
|
|
989
|
+
const stack = self.$mol_log3_stack;
|
|
990
|
+
const deep = stack.length;
|
|
991
|
+
let logged = false;
|
|
992
|
+
stack.push(() => {
|
|
993
|
+
logged = true;
|
|
994
|
+
self.$mol_log3_area.call(self, event);
|
|
995
|
+
});
|
|
996
|
+
return () => {
|
|
997
|
+
if (logged)
|
|
998
|
+
self.console.groupEnd();
|
|
999
|
+
if (stack.length > deep)
|
|
1000
|
+
stack.length = deep;
|
|
829
1001
|
};
|
|
830
1002
|
}
|
|
831
|
-
$.$
|
|
832
|
-
$.$
|
|
833
|
-
$.$mol_log3_done = $mol_log3_node_make('info', 'stdout', 'done', $mol_term_color.green);
|
|
834
|
-
$.$mol_log3_fail = $mol_log3_node_make('error', 'stderr', 'fail', $mol_term_color.red);
|
|
835
|
-
$.$mol_log3_warn = $mol_log3_node_make('warn', 'stderr', 'warn', $mol_term_color.yellow);
|
|
836
|
-
$.$mol_log3_rise = $mol_log3_node_make('log', 'stdout', 'rise', $mol_term_color.magenta);
|
|
837
|
-
$.$mol_log3_area = $mol_log3_node_make('log', 'stdout', 'area', $mol_term_color.cyan);
|
|
1003
|
+
$.$mol_log3_area_lazy = $mol_log3_area_lazy;
|
|
1004
|
+
$.$mol_log3_stack = [];
|
|
838
1005
|
})($ || ($ = {}));
|
|
839
1006
|
|
|
840
1007
|
;
|
|
841
1008
|
"use strict";
|
|
842
1009
|
var $;
|
|
843
1010
|
(function ($) {
|
|
844
|
-
|
|
845
|
-
|
|
1011
|
+
class $mol_span extends $mol_object2 {
|
|
1012
|
+
uri;
|
|
1013
|
+
source;
|
|
1014
|
+
row;
|
|
1015
|
+
col;
|
|
1016
|
+
length;
|
|
1017
|
+
constructor(uri, source, row, col, length) {
|
|
1018
|
+
super();
|
|
1019
|
+
this.uri = uri;
|
|
1020
|
+
this.source = source;
|
|
1021
|
+
this.row = row;
|
|
1022
|
+
this.col = col;
|
|
1023
|
+
this.length = length;
|
|
1024
|
+
this[Symbol.toStringTag] = `${this.uri}#${this.row}:${this.col}/${this.length}`;
|
|
1025
|
+
}
|
|
1026
|
+
static unknown = $mol_span.begin('?');
|
|
1027
|
+
static begin(uri, source = '') {
|
|
1028
|
+
return new $mol_span(uri, source, 1, 1, 0);
|
|
1029
|
+
}
|
|
1030
|
+
static end(uri, source) {
|
|
1031
|
+
return new $mol_span(uri, source, 1, source.length + 1, 0);
|
|
1032
|
+
}
|
|
1033
|
+
static entire(uri, source) {
|
|
1034
|
+
return new $mol_span(uri, source, 1, 1, source.length);
|
|
1035
|
+
}
|
|
1036
|
+
toString() {
|
|
1037
|
+
return this[Symbol.toStringTag];
|
|
1038
|
+
}
|
|
1039
|
+
toJSON() {
|
|
1040
|
+
return {
|
|
1041
|
+
uri: this.uri,
|
|
1042
|
+
row: this.row,
|
|
1043
|
+
col: this.col,
|
|
1044
|
+
length: this.length
|
|
1045
|
+
};
|
|
1046
|
+
}
|
|
1047
|
+
error(message, Class = Error) {
|
|
1048
|
+
return new Class(`${message} (${this})`);
|
|
1049
|
+
}
|
|
1050
|
+
span(row, col, length) {
|
|
1051
|
+
return new $mol_span(this.uri, this.source, row, col, length);
|
|
1052
|
+
}
|
|
1053
|
+
after(length = 0) {
|
|
1054
|
+
return new $mol_span(this.uri, this.source, this.row, this.col + this.length, length);
|
|
1055
|
+
}
|
|
1056
|
+
slice(begin, end = -1) {
|
|
1057
|
+
let len = this.length;
|
|
1058
|
+
if (begin < 0)
|
|
1059
|
+
begin += len;
|
|
1060
|
+
if (end < 0)
|
|
1061
|
+
end += len;
|
|
1062
|
+
if (begin < 0 || begin > len)
|
|
1063
|
+
this.$.$mol_fail(this.error(`Begin value '${begin}' out of range`, RangeError));
|
|
1064
|
+
if (end < 0 || end > len)
|
|
1065
|
+
this.$.$mol_fail(this.error(`End value '${end}' out of range`, RangeError));
|
|
1066
|
+
if (end < begin)
|
|
1067
|
+
this.$.$mol_fail(this.error(`End value '${end}' can't be less than begin value`, RangeError));
|
|
1068
|
+
return this.span(this.row, this.col + begin, end - begin);
|
|
1069
|
+
}
|
|
846
1070
|
}
|
|
847
|
-
$.$
|
|
848
|
-
})($ || ($ = {}));
|
|
849
|
-
|
|
850
|
-
;
|
|
851
|
-
"use strict";
|
|
852
|
-
var $;
|
|
853
|
-
(function ($) {
|
|
854
|
-
$.$mol_env = function $mol_env() {
|
|
855
|
-
return this.process.env;
|
|
856
|
-
};
|
|
1071
|
+
$.$mol_span = $mol_span;
|
|
857
1072
|
})($ || ($ = {}));
|
|
858
1073
|
|
|
859
1074
|
;
|
|
860
1075
|
"use strict";
|
|
861
1076
|
var $;
|
|
862
1077
|
(function ($) {
|
|
863
|
-
function $
|
|
864
|
-
let
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
1078
|
+
function $mol_tree2_to_string(tree) {
|
|
1079
|
+
let output = [];
|
|
1080
|
+
function dump(tree, prefix = '') {
|
|
1081
|
+
if (tree.type.length) {
|
|
1082
|
+
if (!prefix.length) {
|
|
1083
|
+
prefix = "\t";
|
|
1084
|
+
}
|
|
1085
|
+
output.push(tree.type);
|
|
1086
|
+
if (tree.kids.length == 1) {
|
|
1087
|
+
output.push(' ');
|
|
1088
|
+
dump(tree.kids[0], prefix);
|
|
1089
|
+
return;
|
|
1090
|
+
}
|
|
1091
|
+
output.push("\n");
|
|
1092
|
+
}
|
|
1093
|
+
else if (tree.value.length || prefix.length) {
|
|
1094
|
+
output.push("\\" + tree.value + "\n");
|
|
1095
|
+
}
|
|
1096
|
+
for (const kid of tree.kids) {
|
|
1097
|
+
output.push(prefix);
|
|
1098
|
+
dump(kid, prefix + "\t");
|
|
1099
|
+
}
|
|
879
1100
|
}
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
return res;
|
|
1101
|
+
dump(tree);
|
|
1102
|
+
return output.join('');
|
|
883
1103
|
}
|
|
884
|
-
$.$
|
|
885
|
-
})($ || ($ = {}));
|
|
886
|
-
|
|
887
|
-
;
|
|
888
|
-
"use strict";
|
|
889
|
-
var $;
|
|
890
|
-
(function ($) {
|
|
891
|
-
$.$mol_dom_context = new $node.jsdom.JSDOM('', { url: 'https://localhost/' }).window;
|
|
1104
|
+
$.$mol_tree2_to_string = $mol_tree2_to_string;
|
|
892
1105
|
})($ || ($ = {}));
|
|
893
1106
|
|
|
894
1107
|
;
|
|
895
1108
|
"use strict";
|
|
896
1109
|
var $;
|
|
897
1110
|
(function ($) {
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
1111
|
+
class $mol_tree2 extends Object {
|
|
1112
|
+
type;
|
|
1113
|
+
value;
|
|
1114
|
+
kids;
|
|
1115
|
+
span;
|
|
1116
|
+
constructor(type, value, kids, span) {
|
|
1117
|
+
super();
|
|
1118
|
+
this.type = type;
|
|
1119
|
+
this.value = value;
|
|
1120
|
+
this.kids = kids;
|
|
1121
|
+
this.span = span;
|
|
1122
|
+
this[Symbol.toStringTag] = type || '\\' + value;
|
|
1123
|
+
}
|
|
1124
|
+
static list(kids, span = $mol_span.unknown) {
|
|
1125
|
+
return new $mol_tree2('', '', kids, span);
|
|
1126
|
+
}
|
|
1127
|
+
list(kids) {
|
|
1128
|
+
return $mol_tree2.list(kids, this.span);
|
|
1129
|
+
}
|
|
1130
|
+
static data(value, kids = [], span = $mol_span.unknown) {
|
|
1131
|
+
const chunks = value.split('\n');
|
|
1132
|
+
if (chunks.length > 1) {
|
|
1133
|
+
let kid_span = span.span(span.row, span.col, 0);
|
|
1134
|
+
const data = chunks.map(chunk => {
|
|
1135
|
+
kid_span = kid_span.after(chunk.length);
|
|
1136
|
+
return new $mol_tree2('', chunk, [], kid_span);
|
|
1137
|
+
});
|
|
1138
|
+
kids = [...data, ...kids];
|
|
1139
|
+
value = '';
|
|
1140
|
+
}
|
|
1141
|
+
return new $mol_tree2('', value, kids, span);
|
|
1142
|
+
}
|
|
1143
|
+
data(value, kids = []) {
|
|
1144
|
+
return $mol_tree2.data(value, kids, this.span);
|
|
1145
|
+
}
|
|
1146
|
+
static struct(type, kids = [], span = $mol_span.unknown) {
|
|
1147
|
+
if (/[ \n\t\\]/.test(type)) {
|
|
1148
|
+
$$.$mol_fail(span.error(`Wrong type ${JSON.stringify(type)}`));
|
|
1149
|
+
}
|
|
1150
|
+
return new $mol_tree2(type, '', kids, span);
|
|
1151
|
+
}
|
|
1152
|
+
struct(type, kids = []) {
|
|
1153
|
+
return $mol_tree2.struct(type, kids, this.span);
|
|
1154
|
+
}
|
|
1155
|
+
clone(kids, span = this.span) {
|
|
1156
|
+
return new $mol_tree2(this.type, this.value, kids, span);
|
|
1157
|
+
}
|
|
1158
|
+
text() {
|
|
1159
|
+
var values = [];
|
|
1160
|
+
for (var kid of this.kids) {
|
|
1161
|
+
if (kid.type)
|
|
1162
|
+
continue;
|
|
1163
|
+
values.push(kid.value);
|
|
1164
|
+
}
|
|
1165
|
+
return this.value + values.join('\n');
|
|
1166
|
+
}
|
|
1167
|
+
static fromString(str, uri = 'unknown') {
|
|
1168
|
+
return $$.$mol_tree2_from_string(str, uri);
|
|
1169
|
+
}
|
|
1170
|
+
toString() {
|
|
1171
|
+
return $$.$mol_tree2_to_string(this);
|
|
1172
|
+
}
|
|
1173
|
+
insert(value, ...path) {
|
|
1174
|
+
if (path.length === 0)
|
|
1175
|
+
return value;
|
|
1176
|
+
const type = path[0];
|
|
1177
|
+
if (typeof type === 'string') {
|
|
1178
|
+
let replaced = false;
|
|
1179
|
+
const sub = this.kids.map((item, index) => {
|
|
1180
|
+
if (item.type !== type)
|
|
1181
|
+
return item;
|
|
1182
|
+
replaced = true;
|
|
1183
|
+
return item.insert(value, ...path.slice(1));
|
|
1184
|
+
}).filter(Boolean);
|
|
1185
|
+
if (!replaced && value) {
|
|
1186
|
+
sub.push(this.struct(type, []).insert(value, ...path.slice(1)));
|
|
1187
|
+
}
|
|
1188
|
+
return this.clone(sub);
|
|
1189
|
+
}
|
|
1190
|
+
else if (typeof type === 'number') {
|
|
1191
|
+
const sub = this.kids.slice();
|
|
1192
|
+
sub[type] = (sub[type] || this.list([]))
|
|
1193
|
+
.insert(value, ...path.slice(1));
|
|
1194
|
+
return this.clone(sub.filter(Boolean));
|
|
1195
|
+
}
|
|
1196
|
+
else {
|
|
1197
|
+
const kids = ((this.kids.length === 0) ? [this.list([])] : this.kids)
|
|
1198
|
+
.map(item => item.insert(value, ...path.slice(1)))
|
|
1199
|
+
.filter(Boolean);
|
|
1200
|
+
return this.clone(kids);
|
|
1201
|
+
}
|
|
1202
|
+
}
|
|
1203
|
+
select(...path) {
|
|
1204
|
+
let next = [this];
|
|
1205
|
+
for (const type of path) {
|
|
1206
|
+
if (!next.length)
|
|
1207
|
+
break;
|
|
1208
|
+
const prev = next;
|
|
1209
|
+
next = [];
|
|
1210
|
+
for (var item of prev) {
|
|
1211
|
+
switch (typeof (type)) {
|
|
1212
|
+
case 'string':
|
|
1213
|
+
for (var child of item.kids) {
|
|
1214
|
+
if (child.type == type) {
|
|
1215
|
+
next.push(child);
|
|
1216
|
+
}
|
|
1217
|
+
}
|
|
917
1218
|
break;
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
}
|
|
1219
|
+
case 'number':
|
|
1220
|
+
if (type < item.kids.length)
|
|
1221
|
+
next.push(item.kids[type]);
|
|
1222
|
+
break;
|
|
1223
|
+
default: next.push(...item.kids);
|
|
924
1224
|
}
|
|
925
1225
|
}
|
|
926
1226
|
}
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
1227
|
+
return this.list(next);
|
|
1228
|
+
}
|
|
1229
|
+
filter(path, value) {
|
|
1230
|
+
const sub = this.kids.filter(item => {
|
|
1231
|
+
var found = item.select(...path);
|
|
1232
|
+
if (value === undefined) {
|
|
1233
|
+
return Boolean(found.kids.length);
|
|
933
1234
|
}
|
|
934
1235
|
else {
|
|
935
|
-
|
|
936
|
-
el.insertBefore(textNode, nextNode);
|
|
1236
|
+
return found.kids.some(child => child.value == value);
|
|
937
1237
|
}
|
|
1238
|
+
});
|
|
1239
|
+
return this.clone(sub);
|
|
1240
|
+
}
|
|
1241
|
+
hack_self(belt, context = {}) {
|
|
1242
|
+
let handle = belt[this.type] || belt[''];
|
|
1243
|
+
if (!handle || handle === Object.prototype[this.type]) {
|
|
1244
|
+
handle = (input, belt, context) => [
|
|
1245
|
+
input.clone(input.hack(belt, context), context.span)
|
|
1246
|
+
];
|
|
1247
|
+
}
|
|
1248
|
+
try {
|
|
1249
|
+
return handle(this, belt, context);
|
|
1250
|
+
}
|
|
1251
|
+
catch (error) {
|
|
1252
|
+
error.message += `\n${this.clone([])}${this.span}`;
|
|
1253
|
+
$mol_fail_hidden(error);
|
|
938
1254
|
}
|
|
939
1255
|
}
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
1256
|
+
hack(belt, context = {}) {
|
|
1257
|
+
return [].concat(...this.kids.map(child => child.hack_self(belt, context)));
|
|
1258
|
+
}
|
|
1259
|
+
error(message, Class = Error) {
|
|
1260
|
+
return this.span.error(`${message}\n${this.clone([])}`, Class);
|
|
944
1261
|
}
|
|
945
1262
|
}
|
|
946
|
-
$.$
|
|
1263
|
+
$.$mol_tree2 = $mol_tree2;
|
|
1264
|
+
class $mol_tree2_empty extends $mol_tree2 {
|
|
1265
|
+
constructor() {
|
|
1266
|
+
super('', '', [], $mol_span.unknown);
|
|
1267
|
+
}
|
|
1268
|
+
}
|
|
1269
|
+
$.$mol_tree2_empty = $mol_tree2_empty;
|
|
947
1270
|
})($ || ($ = {}));
|
|
948
1271
|
|
|
949
1272
|
;
|
|
950
1273
|
"use strict";
|
|
1274
|
+
var $;
|
|
1275
|
+
(function ($) {
|
|
1276
|
+
class $mol_error_syntax extends SyntaxError {
|
|
1277
|
+
reason;
|
|
1278
|
+
line;
|
|
1279
|
+
span;
|
|
1280
|
+
constructor(reason, line, span) {
|
|
1281
|
+
super(`${reason}\n${span}\n${line.substring(0, span.col - 1).replace(/\S/g, ' ')}${''.padEnd(span.length, '!')}\n${line}`);
|
|
1282
|
+
this.reason = reason;
|
|
1283
|
+
this.line = line;
|
|
1284
|
+
this.span = span;
|
|
1285
|
+
}
|
|
1286
|
+
}
|
|
1287
|
+
$.$mol_error_syntax = $mol_error_syntax;
|
|
1288
|
+
})($ || ($ = {}));
|
|
951
1289
|
|
|
952
1290
|
;
|
|
953
1291
|
"use strict";
|
|
954
1292
|
var $;
|
|
955
1293
|
(function ($) {
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
const crumbs_self = id ? $.$mol_jsx_crumbs.replace(/(\S+)/g, `$1_${id.replace(/\/.*/i, '')}`) : $.$mol_jsx_crumbs;
|
|
969
|
-
if (Elem && $.$mol_jsx_booked) {
|
|
970
|
-
if ($.$mol_jsx_booked.has(id)) {
|
|
971
|
-
$mol_fail(new Error(`JSX already has tag with id ${JSON.stringify(guid)}`));
|
|
1294
|
+
function $mol_tree2_from_string(str, uri = '?') {
|
|
1295
|
+
const span = $mol_span.entire(uri, str);
|
|
1296
|
+
var root = $mol_tree2.list([], span);
|
|
1297
|
+
var stack = [root];
|
|
1298
|
+
var pos = 0, row = 0, min_indent = 0;
|
|
1299
|
+
while (str.length > pos) {
|
|
1300
|
+
var indent = 0;
|
|
1301
|
+
var line_start = pos;
|
|
1302
|
+
row++;
|
|
1303
|
+
while (str.length > pos && str[pos] == '\t') {
|
|
1304
|
+
indent++;
|
|
1305
|
+
pos++;
|
|
972
1306
|
}
|
|
973
|
-
|
|
974
|
-
|
|
1307
|
+
if (!root.kids.length) {
|
|
1308
|
+
min_indent = indent;
|
|
975
1309
|
}
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
continue;
|
|
986
|
-
const wrapper = function (...args) {
|
|
987
|
-
const prefix = $.$mol_jsx_prefix;
|
|
988
|
-
const booked = $.$mol_jsx_booked;
|
|
989
|
-
const crumbs = $.$mol_jsx_crumbs;
|
|
990
|
-
try {
|
|
991
|
-
$.$mol_jsx_prefix = prefix_ext;
|
|
992
|
-
$.$mol_jsx_booked = booked_ext;
|
|
993
|
-
$.$mol_jsx_crumbs = crumbs_ext;
|
|
994
|
-
return func.call(this, ...args);
|
|
995
|
-
}
|
|
996
|
-
finally {
|
|
997
|
-
$.$mol_jsx_prefix = prefix;
|
|
998
|
-
$.$mol_jsx_booked = booked;
|
|
999
|
-
$.$mol_jsx_crumbs = crumbs;
|
|
1310
|
+
indent -= min_indent;
|
|
1311
|
+
if (indent < 0 || indent >= stack.length) {
|
|
1312
|
+
const sp = span.span(row, 1, pos - line_start);
|
|
1313
|
+
while (str.length > pos && str[pos] != '\n') {
|
|
1314
|
+
pos++;
|
|
1315
|
+
}
|
|
1316
|
+
if (indent < 0) {
|
|
1317
|
+
if (str.length > pos) {
|
|
1318
|
+
this.$mol_fail(new this.$mol_error_syntax(`Too few tabs`, str.substring(line_start, pos), sp));
|
|
1000
1319
|
}
|
|
1001
|
-
};
|
|
1002
|
-
$mol_func_name_from(wrapper, func);
|
|
1003
|
-
props[field] = wrapper;
|
|
1004
|
-
}
|
|
1005
|
-
}
|
|
1006
|
-
if (typeof Elem !== 'string') {
|
|
1007
|
-
if ('prototype' in Elem) {
|
|
1008
|
-
const view = node && node[String(Elem)] || new Elem;
|
|
1009
|
-
Object.assign(view, props);
|
|
1010
|
-
view[Symbol.toStringTag] = guid;
|
|
1011
|
-
view.childNodes = childNodes;
|
|
1012
|
-
if (!view.ownerDocument)
|
|
1013
|
-
view.ownerDocument = $.$mol_jsx_document;
|
|
1014
|
-
view.className = (crumbs_self ? crumbs_self + ' ' : '') + (Elem['name'] || Elem);
|
|
1015
|
-
node = view.valueOf();
|
|
1016
|
-
node[String(Elem)] = view;
|
|
1017
|
-
return node;
|
|
1018
|
-
}
|
|
1019
|
-
else {
|
|
1020
|
-
const prefix = $.$mol_jsx_prefix;
|
|
1021
|
-
const booked = $.$mol_jsx_booked;
|
|
1022
|
-
const crumbs = $.$mol_jsx_crumbs;
|
|
1023
|
-
try {
|
|
1024
|
-
$.$mol_jsx_prefix = guid;
|
|
1025
|
-
$.$mol_jsx_booked = new Set;
|
|
1026
|
-
$.$mol_jsx_crumbs = (crumbs_self ? crumbs_self + ' ' : '') + (Elem['name'] || Elem);
|
|
1027
|
-
return Elem(props, ...childNodes);
|
|
1028
1320
|
}
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
$.$mol_jsx_booked = booked;
|
|
1032
|
-
$.$mol_jsx_crumbs = crumbs;
|
|
1321
|
+
else {
|
|
1322
|
+
this.$mol_fail(new this.$mol_error_syntax(`Too many tabs`, str.substring(line_start, pos), sp));
|
|
1033
1323
|
}
|
|
1034
1324
|
}
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1325
|
+
stack.length = indent + 1;
|
|
1326
|
+
var parent = stack[indent];
|
|
1327
|
+
while (str.length > pos && str[pos] != '\\' && str[pos] != '\n') {
|
|
1328
|
+
var error_start = pos;
|
|
1329
|
+
while (str.length > pos && (str[pos] == ' ' || str[pos] == '\t')) {
|
|
1330
|
+
pos++;
|
|
1331
|
+
}
|
|
1332
|
+
if (pos > error_start) {
|
|
1333
|
+
let line_end = str.indexOf('\n', pos);
|
|
1334
|
+
if (line_end === -1)
|
|
1335
|
+
line_end = str.length;
|
|
1336
|
+
const sp = span.span(row, error_start - line_start + 1, pos - error_start);
|
|
1337
|
+
this.$mol_fail(new this.$mol_error_syntax(`Wrong nodes separator`, str.substring(line_start, line_end), sp));
|
|
1338
|
+
}
|
|
1339
|
+
var type_start = pos;
|
|
1340
|
+
while (str.length > pos &&
|
|
1341
|
+
str[pos] != '\\' &&
|
|
1342
|
+
str[pos] != ' ' &&
|
|
1343
|
+
str[pos] != '\t' &&
|
|
1344
|
+
str[pos] != '\n') {
|
|
1345
|
+
pos++;
|
|
1346
|
+
}
|
|
1347
|
+
if (pos > type_start) {
|
|
1348
|
+
let next = new $mol_tree2(str.slice(type_start, pos), '', [], span.span(row, type_start - line_start + 1, pos - type_start));
|
|
1349
|
+
const parent_kids = parent.kids;
|
|
1350
|
+
parent_kids.push(next);
|
|
1351
|
+
parent = next;
|
|
1352
|
+
}
|
|
1353
|
+
if (str.length > pos && str[pos] == ' ') {
|
|
1354
|
+
pos++;
|
|
1355
|
+
}
|
|
1053
1356
|
}
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
Object.assign(node[key], props[key]);
|
|
1059
|
-
continue;
|
|
1357
|
+
if (str.length > pos && str[pos] == '\\') {
|
|
1358
|
+
var data_start = pos;
|
|
1359
|
+
while (str.length > pos && str[pos] != '\n') {
|
|
1360
|
+
pos++;
|
|
1060
1361
|
}
|
|
1362
|
+
let next = new $mol_tree2('', str.slice(data_start + 1, pos), [], span.span(row, data_start - line_start + 2, pos - data_start - 1));
|
|
1363
|
+
const parent_kids = parent.kids;
|
|
1364
|
+
parent_kids.push(next);
|
|
1365
|
+
parent = next;
|
|
1061
1366
|
}
|
|
1062
|
-
|
|
1063
|
-
|
|
1367
|
+
if (str.length === pos && stack.length > 0) {
|
|
1368
|
+
const sp = span.span(row, pos - line_start + 1, 1);
|
|
1369
|
+
this.$mol_fail(new this.$mol_error_syntax(`Unexpected EOF, LF required`, str.substring(line_start, str.length), sp));
|
|
1064
1370
|
}
|
|
1371
|
+
stack.push(parent);
|
|
1372
|
+
pos++;
|
|
1065
1373
|
}
|
|
1066
|
-
|
|
1067
|
-
node.className = (props?.['class'] ? props['class'] + ' ' : '') + crumbs_self;
|
|
1068
|
-
return node;
|
|
1374
|
+
return root;
|
|
1069
1375
|
}
|
|
1070
|
-
$.$
|
|
1376
|
+
$.$mol_tree2_from_string = $mol_tree2_from_string;
|
|
1071
1377
|
})($ || ($ = {}));
|
|
1072
1378
|
|
|
1073
1379
|
;
|
|
1074
1380
|
"use strict";
|
|
1075
1381
|
var $;
|
|
1076
1382
|
(function ($) {
|
|
1077
|
-
function $
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
$mol_jsx_document = next;
|
|
1081
|
-
return action();
|
|
1082
|
-
}
|
|
1083
|
-
finally {
|
|
1084
|
-
$mol_jsx_document = prev;
|
|
1383
|
+
function $mol_tree2_from_json(json, span = $mol_span.unknown) {
|
|
1384
|
+
if (typeof json === 'boolean' || typeof json === 'number' || json === null) {
|
|
1385
|
+
return new $mol_tree2(String(json), '', [], span);
|
|
1085
1386
|
}
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
})($ || ($ = {}));
|
|
1089
|
-
|
|
1090
|
-
;
|
|
1091
|
-
"use strict";
|
|
1092
|
-
var $;
|
|
1093
|
-
(function ($) {
|
|
1094
|
-
let $mol_wire_cursor;
|
|
1095
|
-
(function ($mol_wire_cursor) {
|
|
1096
|
-
$mol_wire_cursor[$mol_wire_cursor["stale"] = -1] = "stale";
|
|
1097
|
-
$mol_wire_cursor[$mol_wire_cursor["doubt"] = -2] = "doubt";
|
|
1098
|
-
$mol_wire_cursor[$mol_wire_cursor["fresh"] = -3] = "fresh";
|
|
1099
|
-
$mol_wire_cursor[$mol_wire_cursor["final"] = -4] = "final";
|
|
1100
|
-
})($mol_wire_cursor = $.$mol_wire_cursor || ($.$mol_wire_cursor = {}));
|
|
1101
|
-
})($ || ($ = {}));
|
|
1102
|
-
|
|
1103
|
-
;
|
|
1104
|
-
"use strict";
|
|
1105
|
-
var $;
|
|
1106
|
-
(function ($) {
|
|
1107
|
-
class $mol_wire_pub extends Object {
|
|
1108
|
-
data = [];
|
|
1109
|
-
static get [Symbol.species]() {
|
|
1110
|
-
return Array;
|
|
1387
|
+
if (typeof json === 'string') {
|
|
1388
|
+
return $mol_tree2.data(json, [], span);
|
|
1111
1389
|
}
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
for (let i = this.sub_from; i < this.data.length; i += 2) {
|
|
1116
|
-
res.push(this.data[i]);
|
|
1117
|
-
}
|
|
1118
|
-
return res;
|
|
1390
|
+
if (Array.isArray(json)) {
|
|
1391
|
+
const sub = json.map(json => $mol_tree2_from_json(json, span));
|
|
1392
|
+
return new $mol_tree2('/', '', sub, span);
|
|
1119
1393
|
}
|
|
1120
|
-
|
|
1121
|
-
|
|
1394
|
+
if (ArrayBuffer.isView(json)) {
|
|
1395
|
+
const buf = new Uint8Array(json.buffer, json.byteOffset, json.byteLength);
|
|
1396
|
+
return $mol_tree2.data(String.fromCharCode(...buf), [], span);
|
|
1122
1397
|
}
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
this.data.push(sub, pub_pos);
|
|
1126
|
-
return pos;
|
|
1398
|
+
if (json instanceof Date) {
|
|
1399
|
+
return new $mol_tree2('', json.toISOString(), [], span);
|
|
1127
1400
|
}
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
$mol_fail(new Error(`Wrong pos ${sub_pos}`));
|
|
1131
|
-
}
|
|
1132
|
-
const end = this.data.length - 2;
|
|
1133
|
-
if (sub_pos !== end) {
|
|
1134
|
-
this.peer_move(end, sub_pos);
|
|
1135
|
-
}
|
|
1136
|
-
this.data.pop();
|
|
1137
|
-
this.data.pop();
|
|
1138
|
-
if (this.data.length === this.sub_from)
|
|
1139
|
-
this.reap();
|
|
1401
|
+
if (typeof json.toJSON === 'function') {
|
|
1402
|
+
return $mol_tree2_from_json(json.toJSON());
|
|
1140
1403
|
}
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
$mol_wire_auto()?.track_next(this);
|
|
1404
|
+
if (json.toString !== Object.prototype.toString) {
|
|
1405
|
+
return $mol_tree2.data(json.toString(), [], span);
|
|
1144
1406
|
}
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
return false;
|
|
1407
|
+
if (json instanceof Error) {
|
|
1408
|
+
const { name, message, stack } = json;
|
|
1409
|
+
json = { ...json, name, message, stack };
|
|
1149
1410
|
}
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1411
|
+
const sub = [];
|
|
1412
|
+
for (var key in json) {
|
|
1413
|
+
const val = json[key];
|
|
1414
|
+
if (val === undefined)
|
|
1415
|
+
continue;
|
|
1416
|
+
const subsub = $mol_tree2_from_json(val, span);
|
|
1417
|
+
if (/^[^\n\t\\ ]+$/.test(key)) {
|
|
1418
|
+
sub.push(new $mol_tree2(key, '', [subsub], span));
|
|
1419
|
+
}
|
|
1420
|
+
else {
|
|
1421
|
+
sub.push($mol_tree2.data(key, [subsub], span));
|
|
1154
1422
|
}
|
|
1155
1423
|
}
|
|
1156
|
-
|
|
1157
|
-
const peer = this.data[from_pos];
|
|
1158
|
-
const self_pos = this.data[from_pos + 1];
|
|
1159
|
-
this.data[to_pos] = peer;
|
|
1160
|
-
this.data[to_pos + 1] = self_pos;
|
|
1161
|
-
peer.peer_repos(self_pos, to_pos);
|
|
1162
|
-
}
|
|
1163
|
-
peer_repos(peer_pos, self_pos) {
|
|
1164
|
-
this.data[peer_pos + 1] = self_pos;
|
|
1165
|
-
}
|
|
1166
|
-
}
|
|
1167
|
-
$.$mol_wire_pub = $mol_wire_pub;
|
|
1168
|
-
})($ || ($ = {}));
|
|
1169
|
-
|
|
1170
|
-
;
|
|
1171
|
-
"use strict";
|
|
1172
|
-
|
|
1173
|
-
;
|
|
1174
|
-
"use strict";
|
|
1175
|
-
var $;
|
|
1176
|
-
(function ($) {
|
|
1177
|
-
$.$mol_wire_auto_sub = null;
|
|
1178
|
-
function $mol_wire_auto(next = $.$mol_wire_auto_sub) {
|
|
1179
|
-
return $.$mol_wire_auto_sub = next;
|
|
1424
|
+
return new $mol_tree2('*', '', sub, span);
|
|
1180
1425
|
}
|
|
1181
|
-
$.$
|
|
1182
|
-
$.$mol_wire_affected = [];
|
|
1426
|
+
$.$mol_tree2_from_json = $mol_tree2_from_json;
|
|
1183
1427
|
})($ || ($ = {}));
|
|
1184
1428
|
|
|
1185
1429
|
;
|
|
1186
1430
|
"use strict";
|
|
1187
1431
|
var $;
|
|
1188
1432
|
(function ($) {
|
|
1189
|
-
$
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
object: obj,
|
|
1228
|
-
config: true,
|
|
1229
|
-
},
|
|
1230
|
-
];
|
|
1231
|
-
}
|
|
1232
|
-
$.$mol_dev_format_native = $mol_dev_format_native;
|
|
1233
|
-
function $mol_dev_format_auto(obj) {
|
|
1234
|
-
if (obj == null)
|
|
1235
|
-
return $.$mol_dev_format_shade(String(obj));
|
|
1236
|
-
return [
|
|
1237
|
-
'object',
|
|
1238
|
-
{
|
|
1239
|
-
object: obj,
|
|
1240
|
-
config: false,
|
|
1241
|
-
},
|
|
1242
|
-
];
|
|
1243
|
-
}
|
|
1244
|
-
$.$mol_dev_format_auto = $mol_dev_format_auto;
|
|
1245
|
-
function $mol_dev_format_element(element, style, ...content) {
|
|
1246
|
-
const styles = [];
|
|
1247
|
-
for (let key in style)
|
|
1248
|
-
styles.push(`${key} : ${style[key]}`);
|
|
1249
|
-
return [
|
|
1250
|
-
element,
|
|
1251
|
-
{
|
|
1252
|
-
style: styles.join(' ; '),
|
|
1253
|
-
},
|
|
1254
|
-
...content,
|
|
1255
|
-
];
|
|
1256
|
-
}
|
|
1257
|
-
$.$mol_dev_format_element = $mol_dev_format_element;
|
|
1258
|
-
function $mol_dev_format_span(style, ...content) {
|
|
1259
|
-
return $mol_dev_format_element('span', {
|
|
1260
|
-
...style,
|
|
1261
|
-
}, ...content);
|
|
1433
|
+
class $mol_term_color {
|
|
1434
|
+
static reset = this.ansi(0, 0);
|
|
1435
|
+
static bold = this.ansi(1, 22);
|
|
1436
|
+
static italic = this.ansi(3, 23);
|
|
1437
|
+
static underline = this.ansi(4, 24);
|
|
1438
|
+
static inverse = this.ansi(7, 27);
|
|
1439
|
+
static hidden = this.ansi(8, 28);
|
|
1440
|
+
static strike = this.ansi(9, 29);
|
|
1441
|
+
static gray = this.ansi(90, 39);
|
|
1442
|
+
static red = this.ansi(91, 39);
|
|
1443
|
+
static green = this.ansi(92, 39);
|
|
1444
|
+
static yellow = this.ansi(93, 39);
|
|
1445
|
+
static blue = this.ansi(94, 39);
|
|
1446
|
+
static magenta = this.ansi(95, 39);
|
|
1447
|
+
static cyan = this.ansi(96, 39);
|
|
1448
|
+
static Gray = (str) => this.inverse(this.gray(str));
|
|
1449
|
+
static Red = (str) => this.inverse(this.red(str));
|
|
1450
|
+
static Green = (str) => this.inverse(this.green(str));
|
|
1451
|
+
static Yellow = (str) => this.inverse(this.yellow(str));
|
|
1452
|
+
static Blue = (str) => this.inverse(this.blue(str));
|
|
1453
|
+
static Magenta = (str) => this.inverse(this.magenta(str));
|
|
1454
|
+
static Cyan = (str) => this.inverse(this.cyan(str));
|
|
1455
|
+
static ansi(open, close) {
|
|
1456
|
+
if (typeof process === 'undefined')
|
|
1457
|
+
return String;
|
|
1458
|
+
if (!process.stdout.isTTY)
|
|
1459
|
+
return String;
|
|
1460
|
+
const prefix = `\x1b[${open}m`;
|
|
1461
|
+
const postfix = `\x1b[${close}m`;
|
|
1462
|
+
const suffix_regexp = new RegExp(postfix.replace('[', '\\['), 'g');
|
|
1463
|
+
return function colorer(str) {
|
|
1464
|
+
str = String(str);
|
|
1465
|
+
if (str === '')
|
|
1466
|
+
return str;
|
|
1467
|
+
const suffix = str.replace(suffix_regexp, prefix);
|
|
1468
|
+
return prefix + suffix + postfix;
|
|
1469
|
+
};
|
|
1470
|
+
}
|
|
1262
1471
|
}
|
|
1263
|
-
$.$
|
|
1264
|
-
$.$mol_dev_format_div = $mol_dev_format_element.bind(null, 'div');
|
|
1265
|
-
$.$mol_dev_format_ol = $mol_dev_format_element.bind(null, 'ol');
|
|
1266
|
-
$.$mol_dev_format_li = $mol_dev_format_element.bind(null, 'li');
|
|
1267
|
-
$.$mol_dev_format_table = $mol_dev_format_element.bind(null, 'table');
|
|
1268
|
-
$.$mol_dev_format_tr = $mol_dev_format_element.bind(null, 'tr');
|
|
1269
|
-
$.$mol_dev_format_td = $mol_dev_format_element.bind(null, 'td');
|
|
1270
|
-
$.$mol_dev_format_accent = $mol_dev_format_span.bind(null, {
|
|
1271
|
-
'color': 'magenta',
|
|
1272
|
-
});
|
|
1273
|
-
$.$mol_dev_format_strong = $mol_dev_format_span.bind(null, {
|
|
1274
|
-
'font-weight': 'bold',
|
|
1275
|
-
});
|
|
1276
|
-
$.$mol_dev_format_string = $mol_dev_format_span.bind(null, {
|
|
1277
|
-
'color': 'green',
|
|
1278
|
-
});
|
|
1279
|
-
$.$mol_dev_format_shade = $mol_dev_format_span.bind(null, {
|
|
1280
|
-
'color': 'gray',
|
|
1281
|
-
});
|
|
1282
|
-
$.$mol_dev_format_indent = $.$mol_dev_format_div.bind(null, {
|
|
1283
|
-
'margin-left': '13px'
|
|
1284
|
-
});
|
|
1472
|
+
$.$mol_term_color = $mol_term_color;
|
|
1285
1473
|
})($ || ($ = {}));
|
|
1286
1474
|
|
|
1287
1475
|
;
|
|
1288
1476
|
"use strict";
|
|
1289
1477
|
var $;
|
|
1290
1478
|
(function ($) {
|
|
1291
|
-
function $
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1479
|
+
function $mol_log3_node_make(level, output, type, color) {
|
|
1480
|
+
return function $mol_log3_logger(event) {
|
|
1481
|
+
if (!event.time)
|
|
1482
|
+
event = { time: new Date().toISOString(), ...event };
|
|
1483
|
+
let tree = this.$mol_tree2_from_json(event);
|
|
1484
|
+
tree = tree.struct(type, tree.kids);
|
|
1485
|
+
let str = color(tree.toString());
|
|
1486
|
+
this.console[level](str);
|
|
1487
|
+
const self = this;
|
|
1488
|
+
return () => self.console.groupEnd();
|
|
1489
|
+
};
|
|
1297
1490
|
}
|
|
1298
|
-
$.$
|
|
1491
|
+
$.$mol_log3_node_make = $mol_log3_node_make;
|
|
1492
|
+
$.$mol_log3_come = $mol_log3_node_make('info', 'stdout', 'come', $mol_term_color.blue);
|
|
1493
|
+
$.$mol_log3_done = $mol_log3_node_make('info', 'stdout', 'done', $mol_term_color.green);
|
|
1494
|
+
$.$mol_log3_fail = $mol_log3_node_make('error', 'stderr', 'fail', $mol_term_color.red);
|
|
1495
|
+
$.$mol_log3_warn = $mol_log3_node_make('warn', 'stderr', 'warn', $mol_term_color.yellow);
|
|
1496
|
+
$.$mol_log3_rise = $mol_log3_node_make('log', 'stdout', 'rise', $mol_term_color.magenta);
|
|
1497
|
+
$.$mol_log3_area = $mol_log3_node_make('log', 'stdout', 'area', $mol_term_color.cyan);
|
|
1299
1498
|
})($ || ($ = {}));
|
|
1300
1499
|
|
|
1301
1500
|
;
|
|
1302
1501
|
"use strict";
|
|
1303
1502
|
var $;
|
|
1304
1503
|
(function ($) {
|
|
1305
|
-
class $
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
track_on() {
|
|
1321
|
-
this.cursor = this.pub_from;
|
|
1322
|
-
const sub = $mol_wire_auto();
|
|
1323
|
-
$mol_wire_auto(this);
|
|
1324
|
-
return sub;
|
|
1325
|
-
}
|
|
1326
|
-
promote() {
|
|
1327
|
-
if (this.cursor >= this.pub_from) {
|
|
1328
|
-
$mol_fail(new Error('Circular subscription'));
|
|
1329
|
-
}
|
|
1330
|
-
super.promote();
|
|
1331
|
-
}
|
|
1332
|
-
track_next(pub) {
|
|
1333
|
-
if (this.cursor < 0)
|
|
1334
|
-
$mol_fail(new Error('Promo to non begun sub'));
|
|
1335
|
-
if (this.cursor < this.sub_from) {
|
|
1336
|
-
const next = this.data[this.cursor];
|
|
1337
|
-
if (pub === undefined)
|
|
1338
|
-
return next ?? null;
|
|
1339
|
-
if (next === pub) {
|
|
1340
|
-
this.cursor += 2;
|
|
1341
|
-
return next;
|
|
1342
|
-
}
|
|
1343
|
-
if (next) {
|
|
1344
|
-
if (this.sub_from < this.data.length) {
|
|
1345
|
-
this.peer_move(this.sub_from, this.data.length);
|
|
1346
|
-
}
|
|
1347
|
-
this.peer_move(this.cursor, this.sub_from);
|
|
1348
|
-
this.sub_from += 2;
|
|
1504
|
+
class $mol_wire_task extends $mol_wire_fiber {
|
|
1505
|
+
static getter(task) {
|
|
1506
|
+
return function $mol_wire_task_get(host, args) {
|
|
1507
|
+
const sub = $mol_wire_auto();
|
|
1508
|
+
const existen = sub?.track_next();
|
|
1509
|
+
reuse: if (existen) {
|
|
1510
|
+
if (!existen.temp)
|
|
1511
|
+
break reuse;
|
|
1512
|
+
if (existen.host !== host)
|
|
1513
|
+
break reuse;
|
|
1514
|
+
if (existen.task !== task)
|
|
1515
|
+
break reuse;
|
|
1516
|
+
if (!$mol_compare_deep(existen.args, args))
|
|
1517
|
+
break reuse;
|
|
1518
|
+
return existen;
|
|
1349
1519
|
}
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1520
|
+
const next = new $mol_wire_task(`${host?.[Symbol.toStringTag] ?? host}.${task.name}<#>`, task, host, args);
|
|
1521
|
+
if (existen?.temp) {
|
|
1522
|
+
$$.$mol_log3_warn({
|
|
1523
|
+
place: '$mol_wire_task',
|
|
1524
|
+
message: `Non idempotency`,
|
|
1525
|
+
existen,
|
|
1526
|
+
next,
|
|
1527
|
+
hint: 'Ignore it',
|
|
1528
|
+
});
|
|
1356
1529
|
}
|
|
1357
|
-
|
|
1358
|
-
}
|
|
1359
|
-
this.data[this.cursor] = pub;
|
|
1360
|
-
this.data[this.cursor + 1] = pub.sub_on(this, this.cursor);
|
|
1361
|
-
this.cursor += 2;
|
|
1362
|
-
return pub;
|
|
1530
|
+
return next;
|
|
1531
|
+
};
|
|
1363
1532
|
}
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
if (this.cursor < 0) {
|
|
1367
|
-
$mol_fail(new Error('End of non begun sub'));
|
|
1368
|
-
}
|
|
1369
|
-
for (let cursor = this.pub_from; cursor < this.cursor; cursor += 2) {
|
|
1370
|
-
const pub = this.data[cursor];
|
|
1371
|
-
pub.fresh();
|
|
1372
|
-
}
|
|
1373
|
-
this.cursor = $mol_wire_cursor.fresh;
|
|
1533
|
+
get temp() {
|
|
1534
|
+
return true;
|
|
1374
1535
|
}
|
|
1375
|
-
|
|
1376
|
-
this.
|
|
1377
|
-
|
|
1536
|
+
complete() {
|
|
1537
|
+
if ($mol_promise_like(this.cache))
|
|
1538
|
+
return;
|
|
1539
|
+
this.destructor();
|
|
1378
1540
|
}
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1541
|
+
put(next) {
|
|
1542
|
+
const prev = this.cache;
|
|
1543
|
+
this.cache = next;
|
|
1544
|
+
if ($mol_promise_like(next)) {
|
|
1545
|
+
this.cursor = $mol_wire_cursor.fresh;
|
|
1546
|
+
if (next !== prev)
|
|
1547
|
+
this.emit();
|
|
1548
|
+
return next;
|
|
1386
1549
|
}
|
|
1387
|
-
this.cursor = this.pub_from;
|
|
1388
|
-
this.track_cut();
|
|
1389
1550
|
this.cursor = $mol_wire_cursor.final;
|
|
1551
|
+
if (this.sub_empty)
|
|
1552
|
+
this.destructor();
|
|
1553
|
+
else if (next !== prev)
|
|
1554
|
+
this.emit();
|
|
1555
|
+
return next;
|
|
1390
1556
|
}
|
|
1391
|
-
track_cut() {
|
|
1392
|
-
if (this.cursor < this.pub_from) {
|
|
1393
|
-
$mol_fail(new Error('Cut of non begun sub'));
|
|
1394
|
-
}
|
|
1395
|
-
let tail = 0;
|
|
1396
|
-
for (let cursor = this.cursor; cursor < this.sub_from; cursor += 2) {
|
|
1397
|
-
const pub = this.data[cursor];
|
|
1398
|
-
pub?.sub_off(this.data[cursor + 1]);
|
|
1399
|
-
if (this.sub_from < this.data.length) {
|
|
1400
|
-
this.peer_move(this.data.length - 2, cursor);
|
|
1401
|
-
this.data.pop();
|
|
1402
|
-
this.data.pop();
|
|
1403
|
-
}
|
|
1404
|
-
else {
|
|
1405
|
-
++tail;
|
|
1406
|
-
}
|
|
1407
|
-
}
|
|
1408
|
-
for (; tail; --tail) {
|
|
1409
|
-
this.data.pop();
|
|
1410
|
-
this.data.pop();
|
|
1411
|
-
}
|
|
1412
|
-
this.sub_from = this.cursor;
|
|
1413
|
-
}
|
|
1414
|
-
complete() { }
|
|
1415
|
-
complete_pubs() {
|
|
1416
|
-
const limit = this.cursor < 0 ? this.sub_from : this.cursor;
|
|
1417
|
-
for (let cursor = this.pub_from; cursor < limit; cursor += 2) {
|
|
1418
|
-
const pub = this.data[cursor];
|
|
1419
|
-
if (pub?.incompleted)
|
|
1420
|
-
return;
|
|
1421
|
-
}
|
|
1422
|
-
for (let cursor = this.pub_from; cursor < limit; cursor += 2) {
|
|
1423
|
-
const pub = this.data[cursor];
|
|
1424
|
-
pub?.complete();
|
|
1425
|
-
}
|
|
1426
|
-
}
|
|
1427
|
-
absorb(quant = $mol_wire_cursor.stale) {
|
|
1428
|
-
if (this.cursor === $mol_wire_cursor.final)
|
|
1429
|
-
return;
|
|
1430
|
-
if (this.cursor >= quant)
|
|
1431
|
-
return;
|
|
1432
|
-
this.cursor = quant;
|
|
1433
|
-
this.emit($mol_wire_cursor.doubt);
|
|
1434
|
-
}
|
|
1435
|
-
[$mol_dev_format_head]() {
|
|
1436
|
-
return $mol_dev_format_native(this);
|
|
1437
|
-
}
|
|
1438
|
-
get pub_empty() {
|
|
1439
|
-
return this.sub_from === this.pub_from;
|
|
1440
|
-
}
|
|
1441
1557
|
}
|
|
1442
|
-
$.$
|
|
1558
|
+
$.$mol_wire_task = $mol_wire_task;
|
|
1559
|
+
})($ || ($ = {}));
|
|
1560
|
+
|
|
1561
|
+
;
|
|
1562
|
+
"use strict";
|
|
1563
|
+
var $;
|
|
1564
|
+
(function ($) {
|
|
1565
|
+
function $mol_wire_sync(obj) {
|
|
1566
|
+
return new Proxy(obj, {
|
|
1567
|
+
get(obj, field) {
|
|
1568
|
+
const val = obj[field];
|
|
1569
|
+
if (typeof val !== 'function')
|
|
1570
|
+
return val;
|
|
1571
|
+
const temp = $mol_wire_task.getter(val);
|
|
1572
|
+
return function $mol_wire_sync(...args) {
|
|
1573
|
+
const fiber = temp(obj, args);
|
|
1574
|
+
return fiber.sync();
|
|
1575
|
+
};
|
|
1576
|
+
},
|
|
1577
|
+
apply(obj, self, args) {
|
|
1578
|
+
const temp = $mol_wire_task.getter(obj);
|
|
1579
|
+
const fiber = temp(self, args);
|
|
1580
|
+
return fiber.sync();
|
|
1581
|
+
},
|
|
1582
|
+
});
|
|
1583
|
+
}
|
|
1584
|
+
$.$mol_wire_sync = $mol_wire_sync;
|
|
1443
1585
|
})($ || ($ = {}));
|
|
1444
1586
|
|
|
1445
1587
|
;
|
|
1446
1588
|
"use strict";
|
|
1447
1589
|
var $;
|
|
1448
1590
|
(function ($) {
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
destructor() {
|
|
1460
|
-
clearTimeout(this.id);
|
|
1461
|
-
}
|
|
1591
|
+
const catched = new WeakMap();
|
|
1592
|
+
function $mol_fail_catch(error) {
|
|
1593
|
+
if (typeof error !== 'object')
|
|
1594
|
+
return false;
|
|
1595
|
+
if ($mol_promise_like(error))
|
|
1596
|
+
$mol_fail_hidden(error);
|
|
1597
|
+
if (catched.get(error))
|
|
1598
|
+
return false;
|
|
1599
|
+
catched.set(error, true);
|
|
1600
|
+
return true;
|
|
1462
1601
|
}
|
|
1463
|
-
$.$
|
|
1602
|
+
$.$mol_fail_catch = $mol_fail_catch;
|
|
1464
1603
|
})($ || ($ = {}));
|
|
1465
1604
|
|
|
1466
1605
|
;
|
|
1467
1606
|
"use strict";
|
|
1468
1607
|
var $;
|
|
1469
1608
|
(function ($) {
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1609
|
+
function $mol_fail_log(error) {
|
|
1610
|
+
if ($mol_promise_like(error))
|
|
1611
|
+
return false;
|
|
1612
|
+
if (!$mol_fail_catch(error))
|
|
1613
|
+
return false;
|
|
1614
|
+
console.error(error);
|
|
1615
|
+
return true;
|
|
1476
1616
|
}
|
|
1477
|
-
$.$
|
|
1617
|
+
$.$mol_fail_log = $mol_fail_log;
|
|
1478
1618
|
})($ || ($ = {}));
|
|
1479
1619
|
|
|
1480
1620
|
;
|
|
1481
1621
|
"use strict";
|
|
1482
|
-
var
|
|
1483
|
-
(
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1622
|
+
var $node = new Proxy({ require }, {
|
|
1623
|
+
get(target, name, wrapper) {
|
|
1624
|
+
if (target[name])
|
|
1625
|
+
return target[name];
|
|
1626
|
+
const mod = target.require('module');
|
|
1627
|
+
if (mod.builtinModules.indexOf(name) >= 0)
|
|
1628
|
+
return target.require(name);
|
|
1629
|
+
if (name[0] === '.')
|
|
1630
|
+
return target.require(name);
|
|
1631
|
+
const path = target.require('path');
|
|
1632
|
+
const fs = target.require('fs');
|
|
1633
|
+
let dir = path.resolve('.');
|
|
1634
|
+
const suffix = `./node_modules/${name}`;
|
|
1635
|
+
const $$ = $;
|
|
1636
|
+
while (!fs.existsSync(path.join(dir, suffix))) {
|
|
1637
|
+
const parent = path.resolve(dir, '..');
|
|
1638
|
+
if (parent === dir) {
|
|
1639
|
+
$$.$mol_exec('.', 'npm', 'install', '--omit=dev', name);
|
|
1496
1640
|
try {
|
|
1497
|
-
|
|
1498
|
-
}
|
|
1499
|
-
finally {
|
|
1500
|
-
$mol_wire_fiber.plan_task = null;
|
|
1501
|
-
}
|
|
1502
|
-
});
|
|
1503
|
-
}
|
|
1504
|
-
static sync() {
|
|
1505
|
-
while (this.planning.size) {
|
|
1506
|
-
for (const fiber of this.planning) {
|
|
1507
|
-
this.planning.delete(fiber);
|
|
1508
|
-
if (fiber.cursor >= 0)
|
|
1509
|
-
continue;
|
|
1510
|
-
if (fiber.cursor === $mol_wire_cursor.final)
|
|
1511
|
-
continue;
|
|
1512
|
-
fiber.fresh();
|
|
1641
|
+
$$.$mol_exec('.', 'npm', 'install', '--omit=dev', '@types/' + name);
|
|
1513
1642
|
}
|
|
1643
|
+
catch { }
|
|
1644
|
+
break;
|
|
1514
1645
|
}
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
this.reaping = new Set;
|
|
1518
|
-
for (const fiber of fibers) {
|
|
1519
|
-
if (!fiber.sub_empty)
|
|
1520
|
-
continue;
|
|
1521
|
-
fiber.destructor();
|
|
1522
|
-
}
|
|
1646
|
+
else {
|
|
1647
|
+
dir = parent;
|
|
1523
1648
|
}
|
|
1524
1649
|
}
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
get args() {
|
|
1528
|
-
return this.data.slice(0, this.pub_from);
|
|
1529
|
-
}
|
|
1530
|
-
result() {
|
|
1531
|
-
if ($mol_promise_like(this.cache))
|
|
1532
|
-
return;
|
|
1533
|
-
if (this.cache instanceof Error)
|
|
1534
|
-
return;
|
|
1535
|
-
return this.cache;
|
|
1536
|
-
}
|
|
1537
|
-
get incompleted() {
|
|
1538
|
-
return $mol_promise_like(this.cache);
|
|
1539
|
-
}
|
|
1540
|
-
field() {
|
|
1541
|
-
return this.task.name + '<>';
|
|
1542
|
-
}
|
|
1543
|
-
constructor(id, task, host, args) {
|
|
1544
|
-
super();
|
|
1545
|
-
this.task = task;
|
|
1546
|
-
this.host = host;
|
|
1547
|
-
if (args)
|
|
1548
|
-
this.data.push(...args);
|
|
1549
|
-
this.pub_from = this.sub_from = args?.length ?? 0;
|
|
1550
|
-
this[Symbol.toStringTag] = id;
|
|
1551
|
-
}
|
|
1552
|
-
plan() {
|
|
1553
|
-
$mol_wire_fiber.planning.add(this);
|
|
1554
|
-
$mol_wire_fiber.plan();
|
|
1555
|
-
}
|
|
1556
|
-
reap() {
|
|
1557
|
-
$mol_wire_fiber.reaping.add(this);
|
|
1558
|
-
$mol_wire_fiber.plan();
|
|
1559
|
-
}
|
|
1560
|
-
toString() {
|
|
1561
|
-
return this[Symbol.toStringTag];
|
|
1562
|
-
}
|
|
1563
|
-
toJSON() {
|
|
1564
|
-
return this[Symbol.toStringTag];
|
|
1565
|
-
}
|
|
1566
|
-
[$mol_dev_format_head]() {
|
|
1567
|
-
const cursor = {
|
|
1568
|
-
[$mol_wire_cursor.stale]: '🔴',
|
|
1569
|
-
[$mol_wire_cursor.doubt]: '🟡',
|
|
1570
|
-
[$mol_wire_cursor.fresh]: '🟢',
|
|
1571
|
-
[$mol_wire_cursor.final]: '🔵',
|
|
1572
|
-
}[this.cursor] ?? this.cursor.toString();
|
|
1573
|
-
return $mol_dev_format_div({}, $mol_owning_check(this, this.cache)
|
|
1574
|
-
? $mol_dev_format_auto({
|
|
1575
|
-
[$mol_dev_format_head]: () => $mol_dev_format_shade(cursor),
|
|
1576
|
-
[$mol_dev_format_body]: () => $mol_dev_format_native(this),
|
|
1577
|
-
})
|
|
1578
|
-
: $mol_dev_format_shade($mol_dev_format_native(this), cursor), $mol_dev_format_auto(this.cache));
|
|
1650
|
+
try {
|
|
1651
|
+
return $.$mol_wire_sync(target).require(name);
|
|
1579
1652
|
}
|
|
1580
|
-
|
|
1581
|
-
|
|
1653
|
+
catch (error) {
|
|
1654
|
+
if (error.code === 'ERR_REQUIRE_ESM') {
|
|
1655
|
+
return importSync(name);
|
|
1656
|
+
}
|
|
1657
|
+
$.$mol_fail_log(error);
|
|
1658
|
+
return null;
|
|
1582
1659
|
}
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1660
|
+
},
|
|
1661
|
+
set(target, name, value) {
|
|
1662
|
+
target[name] = value;
|
|
1663
|
+
return true;
|
|
1664
|
+
},
|
|
1665
|
+
});
|
|
1666
|
+
const importAsync = async (uri) => import(uri);
|
|
1667
|
+
const importSync = $.$mol_wire_sync(importAsync);
|
|
1668
|
+
require = (req => Object.assign(function require(name) {
|
|
1669
|
+
return $node[name];
|
|
1670
|
+
}, req))(require);
|
|
1671
|
+
|
|
1672
|
+
;
|
|
1673
|
+
"use strict";
|
|
1674
|
+
var $;
|
|
1675
|
+
(function ($) {
|
|
1676
|
+
function $mol_env() {
|
|
1677
|
+
return {};
|
|
1678
|
+
}
|
|
1679
|
+
$.$mol_env = $mol_env;
|
|
1680
|
+
})($ || ($ = {}));
|
|
1681
|
+
|
|
1682
|
+
;
|
|
1683
|
+
"use strict";
|
|
1684
|
+
var $;
|
|
1685
|
+
(function ($) {
|
|
1686
|
+
$.$mol_env = function $mol_env() {
|
|
1687
|
+
return this.process.env;
|
|
1688
|
+
};
|
|
1689
|
+
})($ || ($ = {}));
|
|
1690
|
+
|
|
1691
|
+
;
|
|
1692
|
+
"use strict";
|
|
1693
|
+
var $;
|
|
1694
|
+
(function ($) {
|
|
1695
|
+
function $mol_exec(dir, command, ...args) {
|
|
1696
|
+
let [app, ...args0] = command.split(' ');
|
|
1697
|
+
args = [...args0, ...args];
|
|
1698
|
+
this.$mol_log3_come({
|
|
1699
|
+
place: '$mol_exec',
|
|
1700
|
+
dir: $node.path.relative('', dir),
|
|
1701
|
+
message: 'Run',
|
|
1702
|
+
command: `${app} ${args.join(' ')}`,
|
|
1703
|
+
});
|
|
1704
|
+
var res = $node['child_process'].spawnSync(app, args, {
|
|
1705
|
+
cwd: $node.path.resolve(dir),
|
|
1706
|
+
shell: true,
|
|
1707
|
+
env: this.$mol_env(),
|
|
1708
|
+
});
|
|
1709
|
+
if (res.status || res.error) {
|
|
1710
|
+
return $mol_fail(res.error || new Error(res.stderr.toString(), { cause: res.stdout }));
|
|
1588
1711
|
}
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1712
|
+
if (!res.stdout)
|
|
1713
|
+
res.stdout = Buffer.from([]);
|
|
1714
|
+
return res;
|
|
1715
|
+
}
|
|
1716
|
+
$.$mol_exec = $mol_exec;
|
|
1717
|
+
})($ || ($ = {}));
|
|
1718
|
+
|
|
1719
|
+
;
|
|
1720
|
+
"use strict";
|
|
1721
|
+
var $;
|
|
1722
|
+
(function ($) {
|
|
1723
|
+
$.$mol_dom_context = new $node.jsdom.JSDOM('', { url: 'https://localhost/' }).window;
|
|
1724
|
+
})($ || ($ = {}));
|
|
1725
|
+
|
|
1726
|
+
;
|
|
1727
|
+
"use strict";
|
|
1728
|
+
var $;
|
|
1729
|
+
(function ($) {
|
|
1730
|
+
function $mol_dom_render_children(el, childNodes) {
|
|
1731
|
+
const node_set = new Set(childNodes);
|
|
1732
|
+
let nextNode = el.firstChild;
|
|
1733
|
+
for (let view of childNodes) {
|
|
1734
|
+
if (view == null)
|
|
1735
|
+
continue;
|
|
1736
|
+
if (view instanceof $mol_dom_context.Node) {
|
|
1737
|
+
while (true) {
|
|
1738
|
+
if (!nextNode) {
|
|
1739
|
+
el.appendChild(view);
|
|
1613
1740
|
break;
|
|
1614
|
-
|
|
1615
|
-
|
|
1741
|
+
}
|
|
1742
|
+
if (nextNode == view) {
|
|
1743
|
+
nextNode = nextNode.nextSibling;
|
|
1616
1744
|
break;
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1745
|
+
}
|
|
1746
|
+
else {
|
|
1747
|
+
if (node_set.has(nextNode)) {
|
|
1748
|
+
el.insertBefore(view, nextNode);
|
|
1749
|
+
break;
|
|
1750
|
+
}
|
|
1751
|
+
else {
|
|
1752
|
+
const nn = nextNode.nextSibling;
|
|
1753
|
+
el.removeChild(nextNode);
|
|
1754
|
+
nextNode = nn;
|
|
1755
|
+
}
|
|
1756
|
+
}
|
|
1625
1757
|
}
|
|
1626
1758
|
}
|
|
1627
|
-
|
|
1628
|
-
if (
|
|
1629
|
-
|
|
1759
|
+
else {
|
|
1760
|
+
if (nextNode && nextNode.nodeName === '#text') {
|
|
1761
|
+
const str = String(view);
|
|
1762
|
+
if (nextNode.nodeValue !== str)
|
|
1763
|
+
nextNode.nodeValue = str;
|
|
1764
|
+
nextNode = nextNode.nextSibling;
|
|
1630
1765
|
}
|
|
1631
1766
|
else {
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
if ($mol_promise_like(result) && !handled.has(result)) {
|
|
1635
|
-
result = result.finally(() => {
|
|
1636
|
-
if (this.cache === result)
|
|
1637
|
-
this.absorb();
|
|
1638
|
-
});
|
|
1767
|
+
const textNode = $mol_dom_context.document.createTextNode(String(view));
|
|
1768
|
+
el.insertBefore(textNode, nextNode);
|
|
1639
1769
|
}
|
|
1640
1770
|
}
|
|
1641
|
-
if ($mol_promise_like(result) && !handled.has(result)) {
|
|
1642
|
-
result = Object.assign(result, {
|
|
1643
|
-
destructor: result['destructor'] ?? (() => { })
|
|
1644
|
-
});
|
|
1645
|
-
handled.add(result);
|
|
1646
|
-
const error = new Error();
|
|
1647
|
-
Object.defineProperty(result, 'stack', { get: () => error.stack });
|
|
1648
|
-
}
|
|
1649
|
-
if (!$mol_promise_like(result)) {
|
|
1650
|
-
this.track_cut();
|
|
1651
|
-
}
|
|
1652
|
-
this.track_off(bu);
|
|
1653
|
-
this.put(result);
|
|
1654
1771
|
}
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1772
|
+
while (nextNode) {
|
|
1773
|
+
const currNode = nextNode;
|
|
1774
|
+
nextNode = currNode.nextSibling;
|
|
1775
|
+
el.removeChild(currNode);
|
|
1658
1776
|
}
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1777
|
+
}
|
|
1778
|
+
$.$mol_dom_render_children = $mol_dom_render_children;
|
|
1779
|
+
})($ || ($ = {}));
|
|
1780
|
+
|
|
1781
|
+
;
|
|
1782
|
+
"use strict";
|
|
1783
|
+
|
|
1784
|
+
;
|
|
1785
|
+
"use strict";
|
|
1786
|
+
var $;
|
|
1787
|
+
(function ($) {
|
|
1788
|
+
$.$mol_jsx_prefix = '';
|
|
1789
|
+
$.$mol_jsx_crumbs = '';
|
|
1790
|
+
$.$mol_jsx_booked = null;
|
|
1791
|
+
$.$mol_jsx_document = {
|
|
1792
|
+
getElementById: () => null,
|
|
1793
|
+
createElementNS: (space, name) => $mol_dom_context.document.createElementNS(space, name),
|
|
1794
|
+
createDocumentFragment: () => $mol_dom_context.document.createDocumentFragment(),
|
|
1795
|
+
};
|
|
1796
|
+
$.$mol_jsx_frag = '';
|
|
1797
|
+
function $mol_jsx(Elem, props, ...childNodes) {
|
|
1798
|
+
const id = props && props.id || '';
|
|
1799
|
+
const guid = id ? $.$mol_jsx_prefix ? $.$mol_jsx_prefix + '/' + id : id : $.$mol_jsx_prefix;
|
|
1800
|
+
const crumbs_self = id ? $.$mol_jsx_crumbs.replace(/(\S+)/g, `$1_${id.replace(/\/.*/i, '')}`) : $.$mol_jsx_crumbs;
|
|
1801
|
+
if (Elem && $.$mol_jsx_booked) {
|
|
1802
|
+
if ($.$mol_jsx_booked.has(id)) {
|
|
1803
|
+
$mol_fail(new Error(`JSX already has tag with id ${JSON.stringify(guid)}`));
|
|
1662
1804
|
}
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
if (this.cache instanceof Error) {
|
|
1666
|
-
return $mol_fail_hidden(this.cache);
|
|
1805
|
+
else {
|
|
1806
|
+
$.$mol_jsx_booked.add(id);
|
|
1667
1807
|
}
|
|
1668
|
-
|
|
1669
|
-
|
|
1808
|
+
}
|
|
1809
|
+
let node = guid ? $.$mol_jsx_document.getElementById(guid) : null;
|
|
1810
|
+
if ($.$mol_jsx_prefix) {
|
|
1811
|
+
const prefix_ext = $.$mol_jsx_prefix;
|
|
1812
|
+
const booked_ext = $.$mol_jsx_booked;
|
|
1813
|
+
const crumbs_ext = $.$mol_jsx_crumbs;
|
|
1814
|
+
for (const field in props) {
|
|
1815
|
+
const func = props[field];
|
|
1816
|
+
if (typeof func !== 'function')
|
|
1817
|
+
continue;
|
|
1818
|
+
const wrapper = function (...args) {
|
|
1819
|
+
const prefix = $.$mol_jsx_prefix;
|
|
1820
|
+
const booked = $.$mol_jsx_booked;
|
|
1821
|
+
const crumbs = $.$mol_jsx_crumbs;
|
|
1822
|
+
try {
|
|
1823
|
+
$.$mol_jsx_prefix = prefix_ext;
|
|
1824
|
+
$.$mol_jsx_booked = booked_ext;
|
|
1825
|
+
$.$mol_jsx_crumbs = crumbs_ext;
|
|
1826
|
+
return func.call(this, ...args);
|
|
1827
|
+
}
|
|
1828
|
+
finally {
|
|
1829
|
+
$.$mol_jsx_prefix = prefix;
|
|
1830
|
+
$.$mol_jsx_booked = booked;
|
|
1831
|
+
$.$mol_jsx_crumbs = crumbs;
|
|
1832
|
+
}
|
|
1833
|
+
};
|
|
1834
|
+
$mol_func_name_from(wrapper, func);
|
|
1835
|
+
props[field] = wrapper;
|
|
1670
1836
|
}
|
|
1671
|
-
return this.cache;
|
|
1672
1837
|
}
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1838
|
+
if (typeof Elem !== 'string') {
|
|
1839
|
+
if ('prototype' in Elem) {
|
|
1840
|
+
const view = node && node[String(Elem)] || new Elem;
|
|
1841
|
+
Object.assign(view, props);
|
|
1842
|
+
view[Symbol.toStringTag] = guid;
|
|
1843
|
+
view.childNodes = childNodes;
|
|
1844
|
+
if (!view.ownerDocument)
|
|
1845
|
+
view.ownerDocument = $.$mol_jsx_document;
|
|
1846
|
+
view.className = (crumbs_self ? crumbs_self + ' ' : '') + (Elem['name'] || Elem);
|
|
1847
|
+
node = view.valueOf();
|
|
1848
|
+
node[String(Elem)] = view;
|
|
1849
|
+
return node;
|
|
1850
|
+
}
|
|
1851
|
+
else {
|
|
1852
|
+
const prefix = $.$mol_jsx_prefix;
|
|
1853
|
+
const booked = $.$mol_jsx_booked;
|
|
1854
|
+
const crumbs = $.$mol_jsx_crumbs;
|
|
1855
|
+
try {
|
|
1856
|
+
$.$mol_jsx_prefix = guid;
|
|
1857
|
+
$.$mol_jsx_booked = new Set;
|
|
1858
|
+
$.$mol_jsx_crumbs = (crumbs_self ? crumbs_self + ' ' : '') + (Elem['name'] || Elem);
|
|
1859
|
+
return Elem(props, ...childNodes);
|
|
1678
1860
|
}
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
return this.cache;
|
|
1684
|
-
if (this.cursor === $mol_wire_cursor.final) {
|
|
1685
|
-
await new Promise(() => { });
|
|
1861
|
+
finally {
|
|
1862
|
+
$.$mol_jsx_prefix = prefix;
|
|
1863
|
+
$.$mol_jsx_booked = booked;
|
|
1864
|
+
$.$mol_jsx_crumbs = crumbs;
|
|
1686
1865
|
}
|
|
1687
1866
|
}
|
|
1688
1867
|
}
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1868
|
+
if (!node) {
|
|
1869
|
+
node = Elem
|
|
1870
|
+
? $.$mol_jsx_document.createElementNS(props?.xmlns ?? 'http://www.w3.org/1999/xhtml', Elem)
|
|
1871
|
+
: $.$mol_jsx_document.createDocumentFragment();
|
|
1872
|
+
}
|
|
1873
|
+
$mol_dom_render_children(node, [].concat(...childNodes));
|
|
1874
|
+
if (!Elem)
|
|
1875
|
+
return node;
|
|
1876
|
+
if (guid)
|
|
1877
|
+
node.id = guid;
|
|
1878
|
+
for (const key in props) {
|
|
1879
|
+
if (key === 'id')
|
|
1880
|
+
continue;
|
|
1881
|
+
if (typeof props[key] === 'string') {
|
|
1882
|
+
if (typeof node[key] === 'string')
|
|
1883
|
+
node[key] = props[key];
|
|
1884
|
+
node.setAttribute(key, props[key]);
|
|
1885
|
+
}
|
|
1886
|
+
else if (props[key] &&
|
|
1887
|
+
typeof props[key] === 'object' &&
|
|
1888
|
+
Reflect.getPrototypeOf(props[key]) === Reflect.getPrototypeOf({})) {
|
|
1889
|
+
if (typeof node[key] === 'object') {
|
|
1890
|
+
Object.assign(node[key], props[key]);
|
|
1891
|
+
continue;
|
|
1892
|
+
}
|
|
1893
|
+
}
|
|
1894
|
+
else {
|
|
1895
|
+
node[key] = props[key];
|
|
1896
|
+
}
|
|
1897
|
+
}
|
|
1898
|
+
if ($.$mol_jsx_crumbs)
|
|
1899
|
+
node.className = (props?.['class'] ? props['class'] + ' ' : '') + crumbs_self;
|
|
1900
|
+
return node;
|
|
1901
|
+
}
|
|
1902
|
+
$.$mol_jsx = $mol_jsx;
|
|
1903
|
+
})($ || ($ = {}));
|
|
1904
|
+
|
|
1905
|
+
;
|
|
1906
|
+
"use strict";
|
|
1907
|
+
var $;
|
|
1908
|
+
(function ($) {
|
|
1909
|
+
function $mol_jsx_attach(next, action) {
|
|
1910
|
+
const prev = $mol_jsx_document;
|
|
1911
|
+
try {
|
|
1912
|
+
$mol_jsx_document = next;
|
|
1913
|
+
return action();
|
|
1914
|
+
}
|
|
1915
|
+
finally {
|
|
1916
|
+
$mol_jsx_document = prev;
|
|
1700
1917
|
}
|
|
1701
1918
|
}
|
|
1702
|
-
$.$
|
|
1919
|
+
$.$mol_jsx_attach = $mol_jsx_attach;
|
|
1920
|
+
})($ || ($ = {}));
|
|
1921
|
+
|
|
1922
|
+
;
|
|
1923
|
+
"use strict";
|
|
1924
|
+
var $;
|
|
1925
|
+
(function ($) {
|
|
1926
|
+
function $mol_const(value) {
|
|
1927
|
+
const getter = (() => value);
|
|
1928
|
+
getter['()'] = value;
|
|
1929
|
+
getter[Symbol.toStringTag] = value;
|
|
1930
|
+
getter[$mol_dev_format_head] = () => $mol_dev_format_span({}, '()=> ', $mol_dev_format_auto(value));
|
|
1931
|
+
return getter;
|
|
1932
|
+
}
|
|
1933
|
+
$.$mol_const = $mol_const;
|
|
1703
1934
|
})($ || ($ = {}));
|
|
1704
1935
|
|
|
1705
1936
|
;
|
|
@@ -1764,206 +1995,6 @@ var $;
|
|
|
1764
1995
|
$.$mol_key = $mol_key;
|
|
1765
1996
|
})($ || ($ = {}));
|
|
1766
1997
|
|
|
1767
|
-
;
|
|
1768
|
-
"use strict";
|
|
1769
|
-
var $;
|
|
1770
|
-
(function ($) {
|
|
1771
|
-
$.$mol_compare_deep_cache = new WeakMap();
|
|
1772
|
-
function $mol_compare_deep(left, right) {
|
|
1773
|
-
if (Object.is(left, right))
|
|
1774
|
-
return true;
|
|
1775
|
-
if (left === null)
|
|
1776
|
-
return false;
|
|
1777
|
-
if (right === null)
|
|
1778
|
-
return false;
|
|
1779
|
-
if (typeof left !== 'object')
|
|
1780
|
-
return false;
|
|
1781
|
-
if (typeof right !== 'object')
|
|
1782
|
-
return false;
|
|
1783
|
-
const left_proto = Reflect.getPrototypeOf(left);
|
|
1784
|
-
const right_proto = Reflect.getPrototypeOf(right);
|
|
1785
|
-
if (left_proto !== right_proto)
|
|
1786
|
-
return false;
|
|
1787
|
-
if (left instanceof Boolean)
|
|
1788
|
-
return Object.is(left.valueOf(), right['valueOf']());
|
|
1789
|
-
if (left instanceof Number)
|
|
1790
|
-
return Object.is(left.valueOf(), right['valueOf']());
|
|
1791
|
-
if (left instanceof String)
|
|
1792
|
-
return Object.is(left.valueOf(), right['valueOf']());
|
|
1793
|
-
if (left instanceof Date)
|
|
1794
|
-
return Object.is(left.valueOf(), right['valueOf']());
|
|
1795
|
-
if (left instanceof RegExp)
|
|
1796
|
-
return left.source === right.source && left.flags === right.flags;
|
|
1797
|
-
if (left instanceof Error)
|
|
1798
|
-
return left.message === right.message && left.stack === right.stack;
|
|
1799
|
-
let left_cache = $.$mol_compare_deep_cache.get(left);
|
|
1800
|
-
if (left_cache) {
|
|
1801
|
-
const right_cache = left_cache.get(right);
|
|
1802
|
-
if (typeof right_cache === 'boolean')
|
|
1803
|
-
return right_cache;
|
|
1804
|
-
}
|
|
1805
|
-
else {
|
|
1806
|
-
left_cache = new WeakMap([[right, true]]);
|
|
1807
|
-
$.$mol_compare_deep_cache.set(left, left_cache);
|
|
1808
|
-
}
|
|
1809
|
-
let result;
|
|
1810
|
-
try {
|
|
1811
|
-
if (!left_proto)
|
|
1812
|
-
result = compare_pojo(left, right);
|
|
1813
|
-
else if (!Reflect.getPrototypeOf(left_proto))
|
|
1814
|
-
result = compare_pojo(left, right);
|
|
1815
|
-
else if (Symbol.toPrimitive in left)
|
|
1816
|
-
result = compare_primitive(left, right);
|
|
1817
|
-
else if (Array.isArray(left))
|
|
1818
|
-
result = compare_array(left, right);
|
|
1819
|
-
else if (left instanceof Set)
|
|
1820
|
-
result = compare_set(left, right);
|
|
1821
|
-
else if (left instanceof Map)
|
|
1822
|
-
result = compare_map(left, right);
|
|
1823
|
-
else if (ArrayBuffer.isView(left))
|
|
1824
|
-
result = compare_buffer(left, right);
|
|
1825
|
-
else if (Symbol.iterator in left)
|
|
1826
|
-
result = compare_iterator(left[Symbol.iterator](), right[Symbol.iterator]());
|
|
1827
|
-
else
|
|
1828
|
-
result = false;
|
|
1829
|
-
}
|
|
1830
|
-
finally {
|
|
1831
|
-
left_cache.set(right, result);
|
|
1832
|
-
}
|
|
1833
|
-
return result;
|
|
1834
|
-
}
|
|
1835
|
-
$.$mol_compare_deep = $mol_compare_deep;
|
|
1836
|
-
function compare_array(left, right) {
|
|
1837
|
-
const len = left.length;
|
|
1838
|
-
if (len !== right.length)
|
|
1839
|
-
return false;
|
|
1840
|
-
for (let i = 0; i < len; ++i) {
|
|
1841
|
-
if (!$mol_compare_deep(left[i], right[i]))
|
|
1842
|
-
return false;
|
|
1843
|
-
}
|
|
1844
|
-
return true;
|
|
1845
|
-
}
|
|
1846
|
-
function compare_buffer(left, right) {
|
|
1847
|
-
const len = left.byteLength;
|
|
1848
|
-
if (len !== right.byteLength)
|
|
1849
|
-
return false;
|
|
1850
|
-
if (left instanceof DataView)
|
|
1851
|
-
return compare_buffer(new Uint8Array(left.buffer, left.byteOffset, left.byteLength), new Uint8Array(right.buffer, left.byteOffset, left.byteLength));
|
|
1852
|
-
for (let i = 0; i < len; ++i) {
|
|
1853
|
-
if (left[i] !== right[i])
|
|
1854
|
-
return false;
|
|
1855
|
-
}
|
|
1856
|
-
return true;
|
|
1857
|
-
}
|
|
1858
|
-
function compare_iterator(left, right) {
|
|
1859
|
-
while (true) {
|
|
1860
|
-
const left_next = left.next();
|
|
1861
|
-
const right_next = right.next();
|
|
1862
|
-
if (left_next.done !== right_next.done)
|
|
1863
|
-
return false;
|
|
1864
|
-
if (left_next.done)
|
|
1865
|
-
break;
|
|
1866
|
-
if (!$mol_compare_deep(left_next.value, right_next.value))
|
|
1867
|
-
return false;
|
|
1868
|
-
}
|
|
1869
|
-
return true;
|
|
1870
|
-
}
|
|
1871
|
-
function compare_set(left, right) {
|
|
1872
|
-
if (left.size !== right.size)
|
|
1873
|
-
return false;
|
|
1874
|
-
return compare_iterator(left.values(), right.values());
|
|
1875
|
-
}
|
|
1876
|
-
function compare_map(left, right) {
|
|
1877
|
-
if (left.size !== right.size)
|
|
1878
|
-
return false;
|
|
1879
|
-
return compare_iterator(left.keys(), right.keys())
|
|
1880
|
-
&& compare_iterator(left.values(), right.values());
|
|
1881
|
-
}
|
|
1882
|
-
function compare_pojo(left, right) {
|
|
1883
|
-
const left_keys = Object.getOwnPropertyNames(left);
|
|
1884
|
-
const right_keys = Object.getOwnPropertyNames(right);
|
|
1885
|
-
if (!compare_array(left_keys, right_keys))
|
|
1886
|
-
return false;
|
|
1887
|
-
for (let key of left_keys) {
|
|
1888
|
-
if (!$mol_compare_deep(left[key], right[key]))
|
|
1889
|
-
return false;
|
|
1890
|
-
}
|
|
1891
|
-
const left_syms = Object.getOwnPropertySymbols(left);
|
|
1892
|
-
const right_syms = Object.getOwnPropertySymbols(right);
|
|
1893
|
-
if (!compare_array(left_syms, right_syms))
|
|
1894
|
-
return false;
|
|
1895
|
-
for (let key of left_syms) {
|
|
1896
|
-
if (!$mol_compare_deep(left[key], right[key]))
|
|
1897
|
-
return false;
|
|
1898
|
-
}
|
|
1899
|
-
return true;
|
|
1900
|
-
}
|
|
1901
|
-
function compare_primitive(left, right) {
|
|
1902
|
-
return Object.is(left[Symbol.toPrimitive]('default'), right[Symbol.toPrimitive]('default'));
|
|
1903
|
-
}
|
|
1904
|
-
})($ || ($ = {}));
|
|
1905
|
-
|
|
1906
|
-
;
|
|
1907
|
-
"use strict";
|
|
1908
|
-
var $;
|
|
1909
|
-
(function ($) {
|
|
1910
|
-
class $mol_wire_task extends $mol_wire_fiber {
|
|
1911
|
-
static getter(task) {
|
|
1912
|
-
return function $mol_wire_task_get(host, args) {
|
|
1913
|
-
const sub = $mol_wire_auto();
|
|
1914
|
-
const existen = sub?.track_next();
|
|
1915
|
-
reuse: if (existen) {
|
|
1916
|
-
if (!existen.temp)
|
|
1917
|
-
break reuse;
|
|
1918
|
-
if (existen.host !== host)
|
|
1919
|
-
break reuse;
|
|
1920
|
-
if (existen.task !== task)
|
|
1921
|
-
break reuse;
|
|
1922
|
-
if (!$mol_compare_deep(existen.args, args))
|
|
1923
|
-
break reuse;
|
|
1924
|
-
return existen;
|
|
1925
|
-
}
|
|
1926
|
-
const next = new $mol_wire_task(`${host?.[Symbol.toStringTag] ?? host}.${task.name}<#>`, task, host, args);
|
|
1927
|
-
if (existen?.temp) {
|
|
1928
|
-
$$.$mol_log3_warn({
|
|
1929
|
-
place: '$mol_wire_task',
|
|
1930
|
-
message: `Non idempotency`,
|
|
1931
|
-
existen,
|
|
1932
|
-
next,
|
|
1933
|
-
hint: 'Ignore it',
|
|
1934
|
-
});
|
|
1935
|
-
}
|
|
1936
|
-
return next;
|
|
1937
|
-
};
|
|
1938
|
-
}
|
|
1939
|
-
get temp() {
|
|
1940
|
-
return true;
|
|
1941
|
-
}
|
|
1942
|
-
complete() {
|
|
1943
|
-
if ($mol_promise_like(this.cache))
|
|
1944
|
-
return;
|
|
1945
|
-
this.destructor();
|
|
1946
|
-
}
|
|
1947
|
-
put(next) {
|
|
1948
|
-
const prev = this.cache;
|
|
1949
|
-
this.cache = next;
|
|
1950
|
-
if ($mol_promise_like(next)) {
|
|
1951
|
-
this.cursor = $mol_wire_cursor.fresh;
|
|
1952
|
-
if (next !== prev)
|
|
1953
|
-
this.emit();
|
|
1954
|
-
return next;
|
|
1955
|
-
}
|
|
1956
|
-
this.cursor = $mol_wire_cursor.final;
|
|
1957
|
-
if (this.sub_empty)
|
|
1958
|
-
this.destructor();
|
|
1959
|
-
else if (next !== prev)
|
|
1960
|
-
this.emit();
|
|
1961
|
-
return next;
|
|
1962
|
-
}
|
|
1963
|
-
}
|
|
1964
|
-
$.$mol_wire_task = $mol_wire_task;
|
|
1965
|
-
})($ || ($ = {}));
|
|
1966
|
-
|
|
1967
1998
|
;
|
|
1968
1999
|
"use strict";
|
|
1969
2000
|
var $;
|
|
@@ -2340,32 +2371,6 @@ var $;
|
|
|
2340
2371
|
$.$mol_wire_watch = $mol_wire_watch;
|
|
2341
2372
|
})($ || ($ = {}));
|
|
2342
2373
|
|
|
2343
|
-
;
|
|
2344
|
-
"use strict";
|
|
2345
|
-
var $;
|
|
2346
|
-
(function ($) {
|
|
2347
|
-
function $mol_wire_sync(obj) {
|
|
2348
|
-
return new Proxy(obj, {
|
|
2349
|
-
get(obj, field) {
|
|
2350
|
-
const val = obj[field];
|
|
2351
|
-
if (typeof val !== 'function')
|
|
2352
|
-
return val;
|
|
2353
|
-
const temp = $mol_wire_task.getter(val);
|
|
2354
|
-
return function $mol_wire_sync(...args) {
|
|
2355
|
-
const fiber = temp(obj, args);
|
|
2356
|
-
return fiber.sync();
|
|
2357
|
-
};
|
|
2358
|
-
},
|
|
2359
|
-
apply(obj, self, args) {
|
|
2360
|
-
const temp = $mol_wire_task.getter(obj);
|
|
2361
|
-
const fiber = temp(self, args);
|
|
2362
|
-
return fiber.sync();
|
|
2363
|
-
},
|
|
2364
|
-
});
|
|
2365
|
-
}
|
|
2366
|
-
$.$mol_wire_sync = $mol_wire_sync;
|
|
2367
|
-
})($ || ($ = {}));
|
|
2368
|
-
|
|
2369
2374
|
;
|
|
2370
2375
|
"use strict";
|
|
2371
2376
|
var $;
|
|
@@ -2874,10 +2879,6 @@ var $;
|
|
|
2874
2879
|
|
|
2875
2880
|
;
|
|
2876
2881
|
"use strict";
|
|
2877
|
-
var $;
|
|
2878
|
-
(function ($_1) {
|
|
2879
|
-
$mol_test_mocks.push($ => $.$mol_fail_log = () => false);
|
|
2880
|
-
})($ || ($ = {}));
|
|
2881
2882
|
|
|
2882
2883
|
;
|
|
2883
2884
|
"use strict";
|
|
@@ -2887,6 +2888,28 @@ var $;
|
|
|
2887
2888
|
|
|
2888
2889
|
;
|
|
2889
2890
|
"use strict";
|
|
2891
|
+
var $;
|
|
2892
|
+
(function ($_1) {
|
|
2893
|
+
$mol_test({
|
|
2894
|
+
'test types'($) {
|
|
2895
|
+
class A {
|
|
2896
|
+
static a() {
|
|
2897
|
+
return Promise.resolve('');
|
|
2898
|
+
}
|
|
2899
|
+
static b() {
|
|
2900
|
+
return $mol_wire_sync(this).a();
|
|
2901
|
+
}
|
|
2902
|
+
}
|
|
2903
|
+
},
|
|
2904
|
+
});
|
|
2905
|
+
})($ || ($ = {}));
|
|
2906
|
+
|
|
2907
|
+
;
|
|
2908
|
+
"use strict";
|
|
2909
|
+
var $;
|
|
2910
|
+
(function ($_1) {
|
|
2911
|
+
$mol_test_mocks.push($ => $.$mol_fail_log = () => false);
|
|
2912
|
+
})($ || ($ = {}));
|
|
2890
2913
|
|
|
2891
2914
|
;
|
|
2892
2915
|
"use strict";
|
|
@@ -3199,12 +3222,294 @@ var $;
|
|
|
3199
3222
|
.insert(null, 0, 0, 0)
|
|
3200
3223
|
.toString(), 'a b\n');
|
|
3201
3224
|
},
|
|
3202
|
-
'hack'($) {
|
|
3203
|
-
const res = $.$mol_tree2_from_string(`foo bar xxx\n`)
|
|
3204
|
-
.hack({
|
|
3205
|
-
'bar': (input, belt) => [input.struct('777', input.hack(belt))],
|
|
3206
|
-
});
|
|
3207
|
-
$mol_assert_equal(res.toString(), 'foo 777 xxx\n');
|
|
3225
|
+
'hack'($) {
|
|
3226
|
+
const res = $.$mol_tree2_from_string(`foo bar xxx\n`)
|
|
3227
|
+
.hack({
|
|
3228
|
+
'bar': (input, belt) => [input.struct('777', input.hack(belt))],
|
|
3229
|
+
});
|
|
3230
|
+
$mol_assert_equal(res.toString(), 'foo 777 xxx\n');
|
|
3231
|
+
},
|
|
3232
|
+
});
|
|
3233
|
+
})($ || ($ = {}));
|
|
3234
|
+
|
|
3235
|
+
;
|
|
3236
|
+
"use strict";
|
|
3237
|
+
var $;
|
|
3238
|
+
(function ($_1) {
|
|
3239
|
+
$mol_test({
|
|
3240
|
+
'tree parsing'($) {
|
|
3241
|
+
$mol_assert_equal($.$mol_tree2_from_string("foo\nbar\n").kids.length, 2);
|
|
3242
|
+
$mol_assert_equal($.$mol_tree2_from_string("foo\nbar\n").kids[1].type, "bar");
|
|
3243
|
+
$mol_assert_equal($.$mol_tree2_from_string("foo\n\n\n").kids.length, 1);
|
|
3244
|
+
$mol_assert_equal($.$mol_tree2_from_string("=foo\n\\bar\n").kids.length, 2);
|
|
3245
|
+
$mol_assert_equal($.$mol_tree2_from_string("=foo\n\\bar\n").kids[1].value, "bar");
|
|
3246
|
+
$mol_assert_equal($.$mol_tree2_from_string("foo bar \\pol\n").kids[0].kids[0].kids[0].value, "pol");
|
|
3247
|
+
$mol_assert_equal($.$mol_tree2_from_string("foo bar\n\t\\pol\n\t\\men\n").kids[0].kids[0].kids[1].value, "men");
|
|
3248
|
+
$mol_assert_equal($.$mol_tree2_from_string('foo bar \\text\n').toString(), 'foo bar \\text\n');
|
|
3249
|
+
},
|
|
3250
|
+
'Too many tabs'($) {
|
|
3251
|
+
const tree = `
|
|
3252
|
+
foo
|
|
3253
|
+
bar
|
|
3254
|
+
`;
|
|
3255
|
+
$mol_assert_fail(() => {
|
|
3256
|
+
$.$mol_tree2_from_string(tree, 'test');
|
|
3257
|
+
}, 'Too many tabs\ntest#3:1/6\n!!!!!!\n\t\t\t\t\t\tbar');
|
|
3258
|
+
},
|
|
3259
|
+
'Too few tabs'($) {
|
|
3260
|
+
const tree = `
|
|
3261
|
+
foo
|
|
3262
|
+
bar
|
|
3263
|
+
`;
|
|
3264
|
+
$mol_assert_fail(() => {
|
|
3265
|
+
$.$mol_tree2_from_string(tree, 'test');
|
|
3266
|
+
}, 'Too few tabs\ntest#3:1/4\n!!!!\n\t\t\t\tbar');
|
|
3267
|
+
},
|
|
3268
|
+
'Wrong nodes separator at start'($) {
|
|
3269
|
+
const tree = `foo\n \tbar\n`;
|
|
3270
|
+
$mol_assert_fail(() => {
|
|
3271
|
+
$.$mol_tree2_from_string(tree, 'test');
|
|
3272
|
+
}, 'Wrong nodes separator\ntest#2:1/2\n!!\n \tbar');
|
|
3273
|
+
},
|
|
3274
|
+
'Wrong nodes separator in the middle'($) {
|
|
3275
|
+
const tree = `foo bar\n`;
|
|
3276
|
+
$mol_assert_fail(() => {
|
|
3277
|
+
$.$mol_tree2_from_string(tree, 'test');
|
|
3278
|
+
}, 'Wrong nodes separator\ntest#1:5/1\n !\nfoo bar');
|
|
3279
|
+
},
|
|
3280
|
+
'Unexpected EOF, LF required'($) {
|
|
3281
|
+
const tree = ` foo`;
|
|
3282
|
+
$mol_assert_fail(() => {
|
|
3283
|
+
$.$mol_tree2_from_string(tree, 'test');
|
|
3284
|
+
}, 'Unexpected EOF, LF required\ntest#1:5/1\n !\n foo');
|
|
3285
|
+
},
|
|
3286
|
+
'Errors skip and collect'($) {
|
|
3287
|
+
const tree = `foo bar`;
|
|
3288
|
+
const errors = [];
|
|
3289
|
+
const $$ = $.$mol_ambient({
|
|
3290
|
+
$mol_fail: (error) => {
|
|
3291
|
+
errors.push(error.message);
|
|
3292
|
+
return null;
|
|
3293
|
+
}
|
|
3294
|
+
});
|
|
3295
|
+
const res = $$.$mol_tree2_from_string(tree, 'test');
|
|
3296
|
+
$mol_assert_like(errors, [
|
|
3297
|
+
'Wrong nodes separator\ntest#1:5/1\n !\nfoo bar',
|
|
3298
|
+
'Unexpected EOF, LF required\ntest#1:9/1\n !\nfoo bar',
|
|
3299
|
+
]);
|
|
3300
|
+
$mol_assert_equal(res.toString(), 'foo bar\n');
|
|
3301
|
+
},
|
|
3302
|
+
});
|
|
3303
|
+
})($ || ($ = {}));
|
|
3304
|
+
|
|
3305
|
+
;
|
|
3306
|
+
"use strict";
|
|
3307
|
+
var $;
|
|
3308
|
+
(function ($) {
|
|
3309
|
+
$mol_test({
|
|
3310
|
+
'fromJSON'() {
|
|
3311
|
+
$mol_assert_equal($mol_tree2_from_json([]).toString(), '/\n');
|
|
3312
|
+
$mol_assert_equal($mol_tree2_from_json([false, true]).toString(), '/\n\tfalse\n\ttrue\n');
|
|
3313
|
+
$mol_assert_equal($mol_tree2_from_json([0, 1, 2.3]).toString(), '/\n\t0\n\t1\n\t2.3\n');
|
|
3314
|
+
$mol_assert_equal($mol_tree2_from_json(new Uint16Array([1, 10, 256])).toString(), '\\\x01\x00\n\\\x00\x00\x01\n');
|
|
3315
|
+
$mol_assert_equal($mol_tree2_from_json(['', 'foo', 'bar\nbaz']).toString(), '/\n\t\\\n\t\\foo\n\t\\\n\t\t\\bar\n\t\t\\baz\n');
|
|
3316
|
+
$mol_assert_equal($mol_tree2_from_json({ 'foo': false, 'bar\nbaz': 'lol' }).toString(), '*\n\tfoo false\n\t\\\n\t\t\\bar\n\t\t\\baz\n\t\t\\lol\n');
|
|
3317
|
+
},
|
|
3318
|
+
});
|
|
3319
|
+
})($ || ($ = {}));
|
|
3320
|
+
|
|
3321
|
+
;
|
|
3322
|
+
"use strict";
|
|
3323
|
+
var $;
|
|
3324
|
+
(function ($_1) {
|
|
3325
|
+
$mol_test({
|
|
3326
|
+
'Collect deps'() {
|
|
3327
|
+
const pub1 = new $mol_wire_pub;
|
|
3328
|
+
const pub2 = new $mol_wire_pub;
|
|
3329
|
+
const sub = new $mol_wire_pub_sub;
|
|
3330
|
+
const bu1 = sub.track_on();
|
|
3331
|
+
try {
|
|
3332
|
+
pub1.promote();
|
|
3333
|
+
pub2.promote();
|
|
3334
|
+
pub2.promote();
|
|
3335
|
+
}
|
|
3336
|
+
finally {
|
|
3337
|
+
sub.track_cut();
|
|
3338
|
+
sub.track_off(bu1);
|
|
3339
|
+
}
|
|
3340
|
+
pub1.emit();
|
|
3341
|
+
pub2.emit();
|
|
3342
|
+
$mol_assert_like(sub.pub_list, [pub1, pub2, pub2]);
|
|
3343
|
+
const bu2 = sub.track_on();
|
|
3344
|
+
try {
|
|
3345
|
+
pub1.promote();
|
|
3346
|
+
pub1.promote();
|
|
3347
|
+
pub2.promote();
|
|
3348
|
+
}
|
|
3349
|
+
finally {
|
|
3350
|
+
sub.track_cut();
|
|
3351
|
+
sub.track_off(bu2);
|
|
3352
|
+
}
|
|
3353
|
+
pub1.emit();
|
|
3354
|
+
pub2.emit();
|
|
3355
|
+
$mol_assert_like(sub.pub_list, [pub1, pub1, pub2]);
|
|
3356
|
+
},
|
|
3357
|
+
'cyclic detection'($) {
|
|
3358
|
+
const sub1 = new $mol_wire_pub_sub;
|
|
3359
|
+
const sub2 = new $mol_wire_pub_sub;
|
|
3360
|
+
const bu1 = sub1.track_on();
|
|
3361
|
+
try {
|
|
3362
|
+
const bu2 = sub2.track_on();
|
|
3363
|
+
try {
|
|
3364
|
+
$mol_assert_fail(() => sub1.promote(), 'Circular subscription');
|
|
3365
|
+
}
|
|
3366
|
+
finally {
|
|
3367
|
+
sub2.track_cut();
|
|
3368
|
+
sub2.track_off(bu2);
|
|
3369
|
+
}
|
|
3370
|
+
}
|
|
3371
|
+
finally {
|
|
3372
|
+
sub1.track_cut();
|
|
3373
|
+
sub1.track_off(bu1);
|
|
3374
|
+
}
|
|
3375
|
+
},
|
|
3376
|
+
});
|
|
3377
|
+
})($ || ($ = {}));
|
|
3378
|
+
|
|
3379
|
+
;
|
|
3380
|
+
"use strict";
|
|
3381
|
+
var $;
|
|
3382
|
+
(function ($) {
|
|
3383
|
+
$.$mol_after_mock_queue = [];
|
|
3384
|
+
function $mol_after_mock_warp() {
|
|
3385
|
+
const queue = $.$mol_after_mock_queue.splice(0);
|
|
3386
|
+
for (const task of queue)
|
|
3387
|
+
task();
|
|
3388
|
+
}
|
|
3389
|
+
$.$mol_after_mock_warp = $mol_after_mock_warp;
|
|
3390
|
+
class $mol_after_mock_commmon extends $mol_object2 {
|
|
3391
|
+
task;
|
|
3392
|
+
promise = Promise.resolve();
|
|
3393
|
+
cancelled = false;
|
|
3394
|
+
id;
|
|
3395
|
+
constructor(task) {
|
|
3396
|
+
super();
|
|
3397
|
+
this.task = task;
|
|
3398
|
+
$.$mol_after_mock_queue.push(task);
|
|
3399
|
+
}
|
|
3400
|
+
destructor() {
|
|
3401
|
+
const index = $.$mol_after_mock_queue.indexOf(this.task);
|
|
3402
|
+
if (index >= 0)
|
|
3403
|
+
$.$mol_after_mock_queue.splice(index, 1);
|
|
3404
|
+
}
|
|
3405
|
+
}
|
|
3406
|
+
$.$mol_after_mock_commmon = $mol_after_mock_commmon;
|
|
3407
|
+
class $mol_after_mock_timeout extends $mol_after_mock_commmon {
|
|
3408
|
+
delay;
|
|
3409
|
+
constructor(delay, task) {
|
|
3410
|
+
super(task);
|
|
3411
|
+
this.delay = delay;
|
|
3412
|
+
}
|
|
3413
|
+
}
|
|
3414
|
+
$.$mol_after_mock_timeout = $mol_after_mock_timeout;
|
|
3415
|
+
})($ || ($ = {}));
|
|
3416
|
+
|
|
3417
|
+
;
|
|
3418
|
+
"use strict";
|
|
3419
|
+
var $;
|
|
3420
|
+
(function ($_1) {
|
|
3421
|
+
$mol_test_mocks.push($ => {
|
|
3422
|
+
$.$mol_after_timeout = $mol_after_mock_timeout;
|
|
3423
|
+
});
|
|
3424
|
+
})($ || ($ = {}));
|
|
3425
|
+
|
|
3426
|
+
;
|
|
3427
|
+
"use strict";
|
|
3428
|
+
var $;
|
|
3429
|
+
(function ($_1) {
|
|
3430
|
+
$mol_test_mocks.push($ => {
|
|
3431
|
+
$.$mol_after_frame = $mol_after_mock_commmon;
|
|
3432
|
+
});
|
|
3433
|
+
})($ || ($ = {}));
|
|
3434
|
+
|
|
3435
|
+
;
|
|
3436
|
+
"use strict";
|
|
3437
|
+
var $;
|
|
3438
|
+
(function ($) {
|
|
3439
|
+
$mol_test({
|
|
3440
|
+
'Sync execution'() {
|
|
3441
|
+
class Sync extends $mol_object2 {
|
|
3442
|
+
static calc(a, b) {
|
|
3443
|
+
return a + b;
|
|
3444
|
+
}
|
|
3445
|
+
}
|
|
3446
|
+
__decorate([
|
|
3447
|
+
$mol_wire_method
|
|
3448
|
+
], Sync, "calc", null);
|
|
3449
|
+
$mol_assert_equal(Sync.calc(1, 2), 3);
|
|
3450
|
+
},
|
|
3451
|
+
async 'async <=> sync'() {
|
|
3452
|
+
class SyncAsync extends $mol_object2 {
|
|
3453
|
+
static async val(a) {
|
|
3454
|
+
return a;
|
|
3455
|
+
}
|
|
3456
|
+
static sum(a, b) {
|
|
3457
|
+
const syn = $mol_wire_sync(this);
|
|
3458
|
+
return syn.val(a) + syn.val(b);
|
|
3459
|
+
}
|
|
3460
|
+
static async calc(a, b) {
|
|
3461
|
+
return 5 + await $mol_wire_async(this).sum(a, b);
|
|
3462
|
+
}
|
|
3463
|
+
}
|
|
3464
|
+
$mol_assert_equal(await SyncAsync.calc(1, 2), 8);
|
|
3465
|
+
},
|
|
3466
|
+
async 'Idempotence control'() {
|
|
3467
|
+
class Idempotence extends $mol_object2 {
|
|
3468
|
+
static logs_idemp = 0;
|
|
3469
|
+
static logs_unidemp = 0;
|
|
3470
|
+
static log_idemp() {
|
|
3471
|
+
this.logs_idemp += 1;
|
|
3472
|
+
}
|
|
3473
|
+
static log_unidemp() {
|
|
3474
|
+
this.logs_unidemp += 1;
|
|
3475
|
+
}
|
|
3476
|
+
static async val(a) {
|
|
3477
|
+
return a;
|
|
3478
|
+
}
|
|
3479
|
+
static sum(a, b) {
|
|
3480
|
+
this.log_idemp();
|
|
3481
|
+
this.log_unidemp();
|
|
3482
|
+
const syn = $mol_wire_sync(this);
|
|
3483
|
+
return syn.val(a) + syn.val(b);
|
|
3484
|
+
}
|
|
3485
|
+
static async calc(a, b) {
|
|
3486
|
+
return 5 + await $mol_wire_async(this).sum(a, b);
|
|
3487
|
+
}
|
|
3488
|
+
}
|
|
3489
|
+
__decorate([
|
|
3490
|
+
$mol_wire_method
|
|
3491
|
+
], Idempotence, "log_idemp", null);
|
|
3492
|
+
$mol_assert_equal(await Idempotence.calc(1, 2), 8);
|
|
3493
|
+
$mol_assert_equal(Idempotence.logs_idemp, 1);
|
|
3494
|
+
$mol_assert_equal(Idempotence.logs_unidemp, 3);
|
|
3495
|
+
},
|
|
3496
|
+
async 'Error handling'() {
|
|
3497
|
+
class Handle extends $mol_object2 {
|
|
3498
|
+
static async sum(a, b) {
|
|
3499
|
+
$mol_fail(new Error('test error ' + (a + b)));
|
|
3500
|
+
}
|
|
3501
|
+
static check() {
|
|
3502
|
+
try {
|
|
3503
|
+
return $mol_wire_sync(Handle).sum(1, 2);
|
|
3504
|
+
}
|
|
3505
|
+
catch (error) {
|
|
3506
|
+
if ($mol_promise_like(error))
|
|
3507
|
+
$mol_fail_hidden(error);
|
|
3508
|
+
$mol_assert_equal(error.message, 'test error 3');
|
|
3509
|
+
}
|
|
3510
|
+
}
|
|
3511
|
+
}
|
|
3512
|
+
await $mol_wire_async(Handle).check();
|
|
3208
3513
|
},
|
|
3209
3514
|
});
|
|
3210
3515
|
})($ || ($ = {}));
|
|
@@ -3214,83 +3519,50 @@ var $;
|
|
|
3214
3519
|
var $;
|
|
3215
3520
|
(function ($_1) {
|
|
3216
3521
|
$mol_test({
|
|
3217
|
-
'
|
|
3218
|
-
|
|
3219
|
-
|
|
3220
|
-
|
|
3221
|
-
|
|
3222
|
-
|
|
3223
|
-
|
|
3224
|
-
|
|
3225
|
-
|
|
3226
|
-
},
|
|
3227
|
-
'Too many tabs'($) {
|
|
3228
|
-
const tree = `
|
|
3229
|
-
foo
|
|
3230
|
-
bar
|
|
3231
|
-
`;
|
|
3232
|
-
$mol_assert_fail(() => {
|
|
3233
|
-
$.$mol_tree2_from_string(tree, 'test');
|
|
3234
|
-
}, 'Too many tabs\ntest#3:1/6\n!!!!!!\n\t\t\t\t\t\tbar');
|
|
3235
|
-
},
|
|
3236
|
-
'Too few tabs'($) {
|
|
3237
|
-
const tree = `
|
|
3238
|
-
foo
|
|
3239
|
-
bar
|
|
3240
|
-
`;
|
|
3241
|
-
$mol_assert_fail(() => {
|
|
3242
|
-
$.$mol_tree2_from_string(tree, 'test');
|
|
3243
|
-
}, 'Too few tabs\ntest#3:1/4\n!!!!\n\t\t\t\tbar');
|
|
3244
|
-
},
|
|
3245
|
-
'Wrong nodes separator at start'($) {
|
|
3246
|
-
const tree = `foo\n \tbar\n`;
|
|
3247
|
-
$mol_assert_fail(() => {
|
|
3248
|
-
$.$mol_tree2_from_string(tree, 'test');
|
|
3249
|
-
}, 'Wrong nodes separator\ntest#2:1/2\n!!\n \tbar');
|
|
3250
|
-
},
|
|
3251
|
-
'Wrong nodes separator in the middle'($) {
|
|
3252
|
-
const tree = `foo bar\n`;
|
|
3253
|
-
$mol_assert_fail(() => {
|
|
3254
|
-
$.$mol_tree2_from_string(tree, 'test');
|
|
3255
|
-
}, 'Wrong nodes separator\ntest#1:5/1\n !\nfoo bar');
|
|
3256
|
-
},
|
|
3257
|
-
'Unexpected EOF, LF required'($) {
|
|
3258
|
-
const tree = ` foo`;
|
|
3259
|
-
$mol_assert_fail(() => {
|
|
3260
|
-
$.$mol_tree2_from_string(tree, 'test');
|
|
3261
|
-
}, 'Unexpected EOF, LF required\ntest#1:5/1\n !\n foo');
|
|
3522
|
+
'test types'($) {
|
|
3523
|
+
class A {
|
|
3524
|
+
static a() {
|
|
3525
|
+
return '';
|
|
3526
|
+
}
|
|
3527
|
+
static b() {
|
|
3528
|
+
return $mol_wire_async(this).a();
|
|
3529
|
+
}
|
|
3530
|
+
}
|
|
3262
3531
|
},
|
|
3263
|
-
'
|
|
3264
|
-
|
|
3265
|
-
|
|
3266
|
-
|
|
3267
|
-
|
|
3268
|
-
|
|
3269
|
-
|
|
3532
|
+
async 'Latest method calls wins'($) {
|
|
3533
|
+
class NameLogger extends $mol_object2 {
|
|
3534
|
+
static $ = $;
|
|
3535
|
+
static first = [];
|
|
3536
|
+
static last = [];
|
|
3537
|
+
static send(next) {
|
|
3538
|
+
$mol_wire_sync(this.first).push(next);
|
|
3539
|
+
this.$.$mol_wait_timeout(0);
|
|
3540
|
+
this.last.push(next);
|
|
3270
3541
|
}
|
|
3271
|
-
}
|
|
3272
|
-
const
|
|
3273
|
-
|
|
3274
|
-
|
|
3275
|
-
|
|
3276
|
-
|
|
3277
|
-
$
|
|
3542
|
+
}
|
|
3543
|
+
const name = $mol_wire_async(NameLogger).send;
|
|
3544
|
+
name('john');
|
|
3545
|
+
const promise = name('jin');
|
|
3546
|
+
$.$mol_after_mock_warp();
|
|
3547
|
+
await promise;
|
|
3548
|
+
$mol_assert_like(NameLogger.first, ['john', 'jin']);
|
|
3549
|
+
$mol_assert_like(NameLogger.last, ['jin']);
|
|
3278
3550
|
},
|
|
3279
|
-
|
|
3280
|
-
|
|
3281
|
-
|
|
3282
|
-
|
|
3283
|
-
|
|
3284
|
-
|
|
3285
|
-
(
|
|
3286
|
-
|
|
3287
|
-
|
|
3288
|
-
|
|
3289
|
-
|
|
3290
|
-
|
|
3291
|
-
|
|
3292
|
-
$
|
|
3293
|
-
$
|
|
3551
|
+
async 'Latest function calls wins'($) {
|
|
3552
|
+
const first = [];
|
|
3553
|
+
const last = [];
|
|
3554
|
+
function send_name(next) {
|
|
3555
|
+
$mol_wire_sync(first).push(next);
|
|
3556
|
+
$.$mol_wait_timeout(0);
|
|
3557
|
+
last.push(next);
|
|
3558
|
+
}
|
|
3559
|
+
const name = $mol_wire_async(send_name);
|
|
3560
|
+
name('john');
|
|
3561
|
+
const promise = name('jin');
|
|
3562
|
+
$.$mol_after_mock_warp();
|
|
3563
|
+
await promise;
|
|
3564
|
+
$mol_assert_like(first, ['john', 'jin']);
|
|
3565
|
+
$mol_assert_like(last, ['jin']);
|
|
3294
3566
|
},
|
|
3295
3567
|
});
|
|
3296
3568
|
})($ || ($ = {}));
|
|
@@ -3360,126 +3632,27 @@ var $;
|
|
|
3360
3632
|
};
|
|
3361
3633
|
$mol_assert_fail(() => $mol_jsx(App, { id: "foo" }), 'JSX already has tag with id "foo/bar"');
|
|
3362
3634
|
},
|
|
3363
|
-
'Owner based guid generationn'() {
|
|
3364
|
-
const Foo = () => {
|
|
3365
|
-
return $mol_jsx("div", null,
|
|
3366
|
-
$mol_jsx(Bar, { id: "middle", icon: () => $mol_jsx("img", { id: "icon" }) }));
|
|
3367
|
-
};
|
|
3368
|
-
const Bar = (props) => {
|
|
3369
|
-
return $mol_jsx("span", null, props.icon());
|
|
3370
|
-
};
|
|
3371
|
-
const dom = $mol_jsx(Foo, { id: "app" });
|
|
3372
|
-
$mol_assert_equal(dom.outerHTML, '<div id="app" class="Foo"><span id="app/middle" class="Foo_middle Bar"><img id="app/icon" class="Foo_icon"></span></div>');
|
|
3373
|
-
},
|
|
3374
|
-
'Fail on same ids from different caller'() {
|
|
3375
|
-
const Foo = () => {
|
|
3376
|
-
return $mol_jsx("div", null,
|
|
3377
|
-
$mol_jsx("img", { id: "icon" }),
|
|
3378
|
-
$mol_jsx(Bar, { id: "bar", icon: () => $mol_jsx("img", { id: "icon" }) }));
|
|
3379
|
-
};
|
|
3380
|
-
const Bar = (props) => {
|
|
3381
|
-
return $mol_jsx("span", null, props.icon());
|
|
3382
|
-
};
|
|
3383
|
-
$mol_assert_fail(() => $mol_jsx(Foo, { id: "foo" }), 'JSX already has tag with id "foo/icon"');
|
|
3384
|
-
},
|
|
3385
|
-
});
|
|
3386
|
-
})($ || ($ = {}));
|
|
3387
|
-
|
|
3388
|
-
;
|
|
3389
|
-
"use strict";
|
|
3390
|
-
var $;
|
|
3391
|
-
(function ($) {
|
|
3392
|
-
function $mol_dom_parse(text, type = 'application/xhtml+xml') {
|
|
3393
|
-
const parser = new $mol_dom_context.DOMParser();
|
|
3394
|
-
const doc = parser.parseFromString(text, type);
|
|
3395
|
-
const error = doc.getElementsByTagName('parsererror');
|
|
3396
|
-
if (error.length)
|
|
3397
|
-
throw new Error(error[0].textContent);
|
|
3398
|
-
return doc;
|
|
3399
|
-
}
|
|
3400
|
-
$.$mol_dom_parse = $mol_dom_parse;
|
|
3401
|
-
})($ || ($ = {}));
|
|
3402
|
-
|
|
3403
|
-
;
|
|
3404
|
-
"use strict";
|
|
3405
|
-
var $;
|
|
3406
|
-
(function ($) {
|
|
3407
|
-
$mol_test({
|
|
3408
|
-
'Attach to document'() {
|
|
3409
|
-
const doc = $mol_dom_parse('<html><body id="foo"></body></html>');
|
|
3410
|
-
$mol_jsx_attach(doc, () => $mol_jsx("body", { id: "foo" }, "bar"));
|
|
3411
|
-
$mol_assert_equal(doc.documentElement.outerHTML, '<html><body id="foo">bar</body></html>');
|
|
3412
|
-
},
|
|
3413
|
-
});
|
|
3414
|
-
})($ || ($ = {}));
|
|
3415
|
-
|
|
3416
|
-
;
|
|
3417
|
-
"use strict";
|
|
3418
|
-
var $;
|
|
3419
|
-
(function ($) {
|
|
3420
|
-
$mol_test({
|
|
3421
|
-
'const returns stored value'() {
|
|
3422
|
-
const foo = { bar: $mol_const(Math.random()) };
|
|
3423
|
-
$mol_assert_equal(foo.bar(), foo.bar());
|
|
3424
|
-
$mol_assert_equal(foo.bar(), foo.bar['()']);
|
|
3425
|
-
},
|
|
3426
|
-
});
|
|
3427
|
-
})($ || ($ = {}));
|
|
3428
|
-
|
|
3429
|
-
;
|
|
3430
|
-
"use strict";
|
|
3431
|
-
var $;
|
|
3432
|
-
(function ($_1) {
|
|
3433
|
-
$mol_test({
|
|
3434
|
-
'Collect deps'() {
|
|
3435
|
-
const pub1 = new $mol_wire_pub;
|
|
3436
|
-
const pub2 = new $mol_wire_pub;
|
|
3437
|
-
const sub = new $mol_wire_pub_sub;
|
|
3438
|
-
const bu1 = sub.track_on();
|
|
3439
|
-
try {
|
|
3440
|
-
pub1.promote();
|
|
3441
|
-
pub2.promote();
|
|
3442
|
-
pub2.promote();
|
|
3443
|
-
}
|
|
3444
|
-
finally {
|
|
3445
|
-
sub.track_cut();
|
|
3446
|
-
sub.track_off(bu1);
|
|
3447
|
-
}
|
|
3448
|
-
pub1.emit();
|
|
3449
|
-
pub2.emit();
|
|
3450
|
-
$mol_assert_like(sub.pub_list, [pub1, pub2, pub2]);
|
|
3451
|
-
const bu2 = sub.track_on();
|
|
3452
|
-
try {
|
|
3453
|
-
pub1.promote();
|
|
3454
|
-
pub1.promote();
|
|
3455
|
-
pub2.promote();
|
|
3456
|
-
}
|
|
3457
|
-
finally {
|
|
3458
|
-
sub.track_cut();
|
|
3459
|
-
sub.track_off(bu2);
|
|
3460
|
-
}
|
|
3461
|
-
pub1.emit();
|
|
3462
|
-
pub2.emit();
|
|
3463
|
-
$mol_assert_like(sub.pub_list, [pub1, pub1, pub2]);
|
|
3635
|
+
'Owner based guid generationn'() {
|
|
3636
|
+
const Foo = () => {
|
|
3637
|
+
return $mol_jsx("div", null,
|
|
3638
|
+
$mol_jsx(Bar, { id: "middle", icon: () => $mol_jsx("img", { id: "icon" }) }));
|
|
3639
|
+
};
|
|
3640
|
+
const Bar = (props) => {
|
|
3641
|
+
return $mol_jsx("span", null, props.icon());
|
|
3642
|
+
};
|
|
3643
|
+
const dom = $mol_jsx(Foo, { id: "app" });
|
|
3644
|
+
$mol_assert_equal(dom.outerHTML, '<div id="app" class="Foo"><span id="app/middle" class="Foo_middle Bar"><img id="app/icon" class="Foo_icon"></span></div>');
|
|
3464
3645
|
},
|
|
3465
|
-
'
|
|
3466
|
-
const
|
|
3467
|
-
|
|
3468
|
-
|
|
3469
|
-
|
|
3470
|
-
|
|
3471
|
-
|
|
3472
|
-
|
|
3473
|
-
|
|
3474
|
-
|
|
3475
|
-
sub2.track_cut();
|
|
3476
|
-
sub2.track_off(bu2);
|
|
3477
|
-
}
|
|
3478
|
-
}
|
|
3479
|
-
finally {
|
|
3480
|
-
sub1.track_cut();
|
|
3481
|
-
sub1.track_off(bu1);
|
|
3482
|
-
}
|
|
3646
|
+
'Fail on same ids from different caller'() {
|
|
3647
|
+
const Foo = () => {
|
|
3648
|
+
return $mol_jsx("div", null,
|
|
3649
|
+
$mol_jsx("img", { id: "icon" }),
|
|
3650
|
+
$mol_jsx(Bar, { id: "bar", icon: () => $mol_jsx("img", { id: "icon" }) }));
|
|
3651
|
+
};
|
|
3652
|
+
const Bar = (props) => {
|
|
3653
|
+
return $mol_jsx("span", null, props.icon());
|
|
3654
|
+
};
|
|
3655
|
+
$mol_assert_fail(() => $mol_jsx(Foo, { id: "foo" }), 'JSX already has tag with id "foo/icon"');
|
|
3483
3656
|
},
|
|
3484
3657
|
});
|
|
3485
3658
|
})($ || ($ = {}));
|
|
@@ -3488,55 +3661,27 @@ var $;
|
|
|
3488
3661
|
"use strict";
|
|
3489
3662
|
var $;
|
|
3490
3663
|
(function ($) {
|
|
3491
|
-
|
|
3492
|
-
|
|
3493
|
-
const
|
|
3494
|
-
|
|
3495
|
-
|
|
3496
|
-
|
|
3497
|
-
|
|
3498
|
-
class $mol_after_mock_commmon extends $mol_object2 {
|
|
3499
|
-
task;
|
|
3500
|
-
promise = Promise.resolve();
|
|
3501
|
-
cancelled = false;
|
|
3502
|
-
id;
|
|
3503
|
-
constructor(task) {
|
|
3504
|
-
super();
|
|
3505
|
-
this.task = task;
|
|
3506
|
-
$.$mol_after_mock_queue.push(task);
|
|
3507
|
-
}
|
|
3508
|
-
destructor() {
|
|
3509
|
-
const index = $.$mol_after_mock_queue.indexOf(this.task);
|
|
3510
|
-
if (index >= 0)
|
|
3511
|
-
$.$mol_after_mock_queue.splice(index, 1);
|
|
3512
|
-
}
|
|
3513
|
-
}
|
|
3514
|
-
$.$mol_after_mock_commmon = $mol_after_mock_commmon;
|
|
3515
|
-
class $mol_after_mock_timeout extends $mol_after_mock_commmon {
|
|
3516
|
-
delay;
|
|
3517
|
-
constructor(delay, task) {
|
|
3518
|
-
super(task);
|
|
3519
|
-
this.delay = delay;
|
|
3520
|
-
}
|
|
3664
|
+
function $mol_dom_parse(text, type = 'application/xhtml+xml') {
|
|
3665
|
+
const parser = new $mol_dom_context.DOMParser();
|
|
3666
|
+
const doc = parser.parseFromString(text, type);
|
|
3667
|
+
const error = doc.getElementsByTagName('parsererror');
|
|
3668
|
+
if (error.length)
|
|
3669
|
+
throw new Error(error[0].textContent);
|
|
3670
|
+
return doc;
|
|
3521
3671
|
}
|
|
3522
|
-
$.$
|
|
3523
|
-
})($ || ($ = {}));
|
|
3524
|
-
|
|
3525
|
-
;
|
|
3526
|
-
"use strict";
|
|
3527
|
-
var $;
|
|
3528
|
-
(function ($_1) {
|
|
3529
|
-
$mol_test_mocks.push($ => {
|
|
3530
|
-
$.$mol_after_timeout = $mol_after_mock_timeout;
|
|
3531
|
-
});
|
|
3672
|
+
$.$mol_dom_parse = $mol_dom_parse;
|
|
3532
3673
|
})($ || ($ = {}));
|
|
3533
3674
|
|
|
3534
3675
|
;
|
|
3535
3676
|
"use strict";
|
|
3536
3677
|
var $;
|
|
3537
|
-
(function ($
|
|
3538
|
-
$
|
|
3539
|
-
|
|
3678
|
+
(function ($) {
|
|
3679
|
+
$mol_test({
|
|
3680
|
+
'Attach to document'() {
|
|
3681
|
+
const doc = $mol_dom_parse('<html><body id="foo"></body></html>');
|
|
3682
|
+
$mol_jsx_attach(doc, () => $mol_jsx("body", { id: "foo" }, "bar"));
|
|
3683
|
+
$mol_assert_equal(doc.documentElement.outerHTML, '<html><body id="foo">bar</body></html>');
|
|
3684
|
+
},
|
|
3540
3685
|
});
|
|
3541
3686
|
})($ || ($ = {}));
|
|
3542
3687
|
|
|
@@ -3545,79 +3690,10 @@ var $;
|
|
|
3545
3690
|
var $;
|
|
3546
3691
|
(function ($) {
|
|
3547
3692
|
$mol_test({
|
|
3548
|
-
'
|
|
3549
|
-
|
|
3550
|
-
|
|
3551
|
-
|
|
3552
|
-
}
|
|
3553
|
-
}
|
|
3554
|
-
__decorate([
|
|
3555
|
-
$mol_wire_method
|
|
3556
|
-
], Sync, "calc", null);
|
|
3557
|
-
$mol_assert_equal(Sync.calc(1, 2), 3);
|
|
3558
|
-
},
|
|
3559
|
-
async 'async <=> sync'() {
|
|
3560
|
-
class SyncAsync extends $mol_object2 {
|
|
3561
|
-
static async val(a) {
|
|
3562
|
-
return a;
|
|
3563
|
-
}
|
|
3564
|
-
static sum(a, b) {
|
|
3565
|
-
const syn = $mol_wire_sync(this);
|
|
3566
|
-
return syn.val(a) + syn.val(b);
|
|
3567
|
-
}
|
|
3568
|
-
static async calc(a, b) {
|
|
3569
|
-
return 5 + await $mol_wire_async(this).sum(a, b);
|
|
3570
|
-
}
|
|
3571
|
-
}
|
|
3572
|
-
$mol_assert_equal(await SyncAsync.calc(1, 2), 8);
|
|
3573
|
-
},
|
|
3574
|
-
async 'Idempotence control'() {
|
|
3575
|
-
class Idempotence extends $mol_object2 {
|
|
3576
|
-
static logs_idemp = 0;
|
|
3577
|
-
static logs_unidemp = 0;
|
|
3578
|
-
static log_idemp() {
|
|
3579
|
-
this.logs_idemp += 1;
|
|
3580
|
-
}
|
|
3581
|
-
static log_unidemp() {
|
|
3582
|
-
this.logs_unidemp += 1;
|
|
3583
|
-
}
|
|
3584
|
-
static async val(a) {
|
|
3585
|
-
return a;
|
|
3586
|
-
}
|
|
3587
|
-
static sum(a, b) {
|
|
3588
|
-
this.log_idemp();
|
|
3589
|
-
this.log_unidemp();
|
|
3590
|
-
const syn = $mol_wire_sync(this);
|
|
3591
|
-
return syn.val(a) + syn.val(b);
|
|
3592
|
-
}
|
|
3593
|
-
static async calc(a, b) {
|
|
3594
|
-
return 5 + await $mol_wire_async(this).sum(a, b);
|
|
3595
|
-
}
|
|
3596
|
-
}
|
|
3597
|
-
__decorate([
|
|
3598
|
-
$mol_wire_method
|
|
3599
|
-
], Idempotence, "log_idemp", null);
|
|
3600
|
-
$mol_assert_equal(await Idempotence.calc(1, 2), 8);
|
|
3601
|
-
$mol_assert_equal(Idempotence.logs_idemp, 1);
|
|
3602
|
-
$mol_assert_equal(Idempotence.logs_unidemp, 3);
|
|
3603
|
-
},
|
|
3604
|
-
async 'Error handling'() {
|
|
3605
|
-
class Handle extends $mol_object2 {
|
|
3606
|
-
static async sum(a, b) {
|
|
3607
|
-
$mol_fail(new Error('test error ' + (a + b)));
|
|
3608
|
-
}
|
|
3609
|
-
static check() {
|
|
3610
|
-
try {
|
|
3611
|
-
return $mol_wire_sync(Handle).sum(1, 2);
|
|
3612
|
-
}
|
|
3613
|
-
catch (error) {
|
|
3614
|
-
if ($mol_promise_like(error))
|
|
3615
|
-
$mol_fail_hidden(error);
|
|
3616
|
-
$mol_assert_equal(error.message, 'test error 3');
|
|
3617
|
-
}
|
|
3618
|
-
}
|
|
3619
|
-
}
|
|
3620
|
-
await $mol_wire_async(Handle).check();
|
|
3693
|
+
'const returns stored value'() {
|
|
3694
|
+
const foo = { bar: $mol_const(Math.random()) };
|
|
3695
|
+
$mol_assert_equal(foo.bar(), foo.bar());
|
|
3696
|
+
$mol_assert_equal(foo.bar(), foo.bar['()']);
|
|
3621
3697
|
},
|
|
3622
3698
|
});
|
|
3623
3699
|
})($ || ($ = {}));
|
|
@@ -3683,6 +3759,12 @@ var $;
|
|
|
3683
3759
|
});
|
|
3684
3760
|
})($ || ($ = {}));
|
|
3685
3761
|
|
|
3762
|
+
;
|
|
3763
|
+
"use strict";
|
|
3764
|
+
|
|
3765
|
+
;
|
|
3766
|
+
"use strict";
|
|
3767
|
+
|
|
3686
3768
|
;
|
|
3687
3769
|
"use strict";
|
|
3688
3770
|
var $;
|
|
@@ -4082,83 +4164,6 @@ var $;
|
|
|
4082
4164
|
});
|
|
4083
4165
|
})($ || ($ = {}));
|
|
4084
4166
|
|
|
4085
|
-
;
|
|
4086
|
-
"use strict";
|
|
4087
|
-
|
|
4088
|
-
;
|
|
4089
|
-
"use strict";
|
|
4090
|
-
|
|
4091
|
-
;
|
|
4092
|
-
"use strict";
|
|
4093
|
-
var $;
|
|
4094
|
-
(function ($_1) {
|
|
4095
|
-
$mol_test({
|
|
4096
|
-
'test types'($) {
|
|
4097
|
-
class A {
|
|
4098
|
-
static a() {
|
|
4099
|
-
return Promise.resolve('');
|
|
4100
|
-
}
|
|
4101
|
-
static b() {
|
|
4102
|
-
return $mol_wire_sync(this).a();
|
|
4103
|
-
}
|
|
4104
|
-
}
|
|
4105
|
-
},
|
|
4106
|
-
});
|
|
4107
|
-
})($ || ($ = {}));
|
|
4108
|
-
|
|
4109
|
-
;
|
|
4110
|
-
"use strict";
|
|
4111
|
-
var $;
|
|
4112
|
-
(function ($_1) {
|
|
4113
|
-
$mol_test({
|
|
4114
|
-
'test types'($) {
|
|
4115
|
-
class A {
|
|
4116
|
-
static a() {
|
|
4117
|
-
return '';
|
|
4118
|
-
}
|
|
4119
|
-
static b() {
|
|
4120
|
-
return $mol_wire_async(this).a();
|
|
4121
|
-
}
|
|
4122
|
-
}
|
|
4123
|
-
},
|
|
4124
|
-
async 'Latest method calls wins'($) {
|
|
4125
|
-
class NameLogger extends $mol_object2 {
|
|
4126
|
-
static $ = $;
|
|
4127
|
-
static first = [];
|
|
4128
|
-
static last = [];
|
|
4129
|
-
static send(next) {
|
|
4130
|
-
$mol_wire_sync(this.first).push(next);
|
|
4131
|
-
this.$.$mol_wait_timeout(0);
|
|
4132
|
-
this.last.push(next);
|
|
4133
|
-
}
|
|
4134
|
-
}
|
|
4135
|
-
const name = $mol_wire_async(NameLogger).send;
|
|
4136
|
-
name('john');
|
|
4137
|
-
const promise = name('jin');
|
|
4138
|
-
$.$mol_after_mock_warp();
|
|
4139
|
-
await promise;
|
|
4140
|
-
$mol_assert_like(NameLogger.first, ['john', 'jin']);
|
|
4141
|
-
$mol_assert_like(NameLogger.last, ['jin']);
|
|
4142
|
-
},
|
|
4143
|
-
async 'Latest function calls wins'($) {
|
|
4144
|
-
const first = [];
|
|
4145
|
-
const last = [];
|
|
4146
|
-
function send_name(next) {
|
|
4147
|
-
$mol_wire_sync(first).push(next);
|
|
4148
|
-
$.$mol_wait_timeout(0);
|
|
4149
|
-
last.push(next);
|
|
4150
|
-
}
|
|
4151
|
-
const name = $mol_wire_async(send_name);
|
|
4152
|
-
name('john');
|
|
4153
|
-
const promise = name('jin');
|
|
4154
|
-
$.$mol_after_mock_warp();
|
|
4155
|
-
await promise;
|
|
4156
|
-
$mol_assert_like(first, ['john', 'jin']);
|
|
4157
|
-
$mol_assert_like(last, ['jin']);
|
|
4158
|
-
},
|
|
4159
|
-
});
|
|
4160
|
-
})($ || ($ = {}));
|
|
4161
|
-
|
|
4162
4167
|
;
|
|
4163
4168
|
"use strict";
|
|
4164
4169
|
var $;
|