mol_compare_deep 0.0.404 → 0.0.405
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.deps.json +1 -1
- package/node.js +13 -13
- package/node.js.map +1 -1
- package/node.mjs +13 -13
- package/node.mjs.map +1 -1
- package/node.test.js +586 -586
- package/node.test.js.map +1 -1
- package/package.json +1 -1
- package/web.deps.json +1 -1
- package/web.js +13 -13
- package/web.js.map +1 -1
- package/web.mjs +13 -13
- package/web.mjs.map +1 -1
- package/web.test.js +333 -333
- package/web.test.js.map +1 -1
package/node.test.js
CHANGED
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
"use strict";
|
|
3
|
+
Error.stackTraceLimit = 50;
|
|
4
|
+
var $;
|
|
5
|
+
(function ($) {
|
|
6
|
+
})($ || ($ = {}));
|
|
7
|
+
module.exports = $;
|
|
8
|
+
//mam.ts
|
|
9
|
+
;
|
|
2
10
|
"use strict"
|
|
3
11
|
|
|
4
12
|
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
@@ -11,14 +19,6 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
11
19
|
var $ = ( typeof module === 'object' ) ? ( module['export'+'s'] = globalThis ) : globalThis
|
|
12
20
|
$.$$ = $
|
|
13
21
|
|
|
14
|
-
;
|
|
15
|
-
"use strict";
|
|
16
|
-
Error.stackTraceLimit = 50;
|
|
17
|
-
var $;
|
|
18
|
-
(function ($) {
|
|
19
|
-
})($ || ($ = {}));
|
|
20
|
-
module.exports = $;
|
|
21
|
-
//mam.ts
|
|
22
22
|
;
|
|
23
23
|
"use strict";
|
|
24
24
|
var $;
|
|
@@ -147,6 +147,63 @@ var $;
|
|
|
147
147
|
;
|
|
148
148
|
"use strict";
|
|
149
149
|
var $;
|
|
150
|
+
(function ($) {
|
|
151
|
+
})($ || ($ = {}));
|
|
152
|
+
//mol/dom/context/context.ts
|
|
153
|
+
;
|
|
154
|
+
"use strict";
|
|
155
|
+
//node/node.ts
|
|
156
|
+
;
|
|
157
|
+
"use strict";
|
|
158
|
+
var $node = new Proxy({ require }, {
|
|
159
|
+
get(target, name, wrapper) {
|
|
160
|
+
if (target[name])
|
|
161
|
+
return target[name];
|
|
162
|
+
const mod = target.require('module');
|
|
163
|
+
if (mod.builtinModules.indexOf(name) >= 0)
|
|
164
|
+
return target.require(name);
|
|
165
|
+
if (name[0] === '.')
|
|
166
|
+
return target.require(name);
|
|
167
|
+
const path = target.require('path');
|
|
168
|
+
const fs = target.require('fs');
|
|
169
|
+
let dir = path.resolve('.');
|
|
170
|
+
const suffix = `./node_modules/${name}`;
|
|
171
|
+
const $$ = $;
|
|
172
|
+
while (!fs.existsSync(path.join(dir, suffix))) {
|
|
173
|
+
const parent = path.resolve(dir, '..');
|
|
174
|
+
if (parent === dir) {
|
|
175
|
+
$$.$mol_exec('.', 'npm', 'install', '--omit=dev', name);
|
|
176
|
+
try {
|
|
177
|
+
$$.$mol_exec('.', 'npm', 'install', '--omit=dev', '@types/' + name);
|
|
178
|
+
}
|
|
179
|
+
catch { }
|
|
180
|
+
break;
|
|
181
|
+
}
|
|
182
|
+
else {
|
|
183
|
+
dir = parent;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
return target.require(name);
|
|
187
|
+
},
|
|
188
|
+
set(target, name, value) {
|
|
189
|
+
target[name] = value;
|
|
190
|
+
return true;
|
|
191
|
+
},
|
|
192
|
+
});
|
|
193
|
+
require = (req => Object.assign(function require(name) {
|
|
194
|
+
return $node[name];
|
|
195
|
+
}, req))(require);
|
|
196
|
+
//node/node.node.ts
|
|
197
|
+
;
|
|
198
|
+
"use strict";
|
|
199
|
+
var $;
|
|
200
|
+
(function ($) {
|
|
201
|
+
$.$mol_dom_context = new $node.jsdom.JSDOM('', { url: 'https://localhost/' }).window;
|
|
202
|
+
})($ || ($ = {}));
|
|
203
|
+
//mol/dom/context/context.node.ts
|
|
204
|
+
;
|
|
205
|
+
"use strict";
|
|
206
|
+
var $;
|
|
150
207
|
(function ($) {
|
|
151
208
|
function $mol_fail(error) {
|
|
152
209
|
throw error;
|
|
@@ -158,22 +215,82 @@ var $;
|
|
|
158
215
|
"use strict";
|
|
159
216
|
var $;
|
|
160
217
|
(function ($) {
|
|
161
|
-
function $
|
|
162
|
-
|
|
218
|
+
function $mol_dom_render_children(el, childNodes) {
|
|
219
|
+
const node_set = new Set(childNodes);
|
|
220
|
+
let nextNode = el.firstChild;
|
|
221
|
+
for (let view of childNodes) {
|
|
222
|
+
if (view == null)
|
|
223
|
+
continue;
|
|
224
|
+
if (view instanceof $mol_dom_context.Node) {
|
|
225
|
+
while (true) {
|
|
226
|
+
if (!nextNode) {
|
|
227
|
+
el.appendChild(view);
|
|
228
|
+
break;
|
|
229
|
+
}
|
|
230
|
+
if (nextNode == view) {
|
|
231
|
+
nextNode = nextNode.nextSibling;
|
|
232
|
+
break;
|
|
233
|
+
}
|
|
234
|
+
else {
|
|
235
|
+
if (node_set.has(nextNode)) {
|
|
236
|
+
el.insertBefore(view, nextNode);
|
|
237
|
+
break;
|
|
238
|
+
}
|
|
239
|
+
else {
|
|
240
|
+
const nn = nextNode.nextSibling;
|
|
241
|
+
el.removeChild(nextNode);
|
|
242
|
+
nextNode = nn;
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
else {
|
|
248
|
+
if (nextNode && nextNode.nodeName === '#text') {
|
|
249
|
+
const str = String(view);
|
|
250
|
+
if (nextNode.nodeValue !== str)
|
|
251
|
+
nextNode.nodeValue = str;
|
|
252
|
+
nextNode = nextNode.nextSibling;
|
|
253
|
+
}
|
|
254
|
+
else {
|
|
255
|
+
const textNode = $mol_dom_context.document.createTextNode(String(view));
|
|
256
|
+
el.insertBefore(textNode, nextNode);
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
while (nextNode) {
|
|
261
|
+
const currNode = nextNode;
|
|
262
|
+
nextNode = currNode.nextSibling;
|
|
263
|
+
el.removeChild(currNode);
|
|
264
|
+
}
|
|
163
265
|
}
|
|
164
|
-
$.$
|
|
266
|
+
$.$mol_dom_render_children = $mol_dom_render_children;
|
|
165
267
|
})($ || ($ = {}));
|
|
166
|
-
//mol/
|
|
268
|
+
//mol/dom/render/children/children.ts
|
|
269
|
+
;
|
|
270
|
+
"use strict";
|
|
271
|
+
//mol/type/error/error.ts
|
|
272
|
+
;
|
|
273
|
+
"use strict";
|
|
274
|
+
//mol/type/assert/assert.ts
|
|
275
|
+
;
|
|
276
|
+
"use strict";
|
|
277
|
+
//mol/type/assert/assert.test.ts
|
|
278
|
+
;
|
|
279
|
+
"use strict";
|
|
280
|
+
//mol/type/partial/deep/deep.ts
|
|
281
|
+
;
|
|
282
|
+
"use strict";
|
|
283
|
+
//mol/type/partial/deep/deep.test.ts
|
|
167
284
|
;
|
|
168
285
|
"use strict";
|
|
169
286
|
var $;
|
|
170
287
|
(function ($) {
|
|
171
|
-
function $
|
|
172
|
-
|
|
288
|
+
function $mol_fail_hidden(error) {
|
|
289
|
+
throw error;
|
|
173
290
|
}
|
|
174
|
-
$.$
|
|
291
|
+
$.$mol_fail_hidden = $mol_fail_hidden;
|
|
175
292
|
})($ || ($ = {}));
|
|
176
|
-
//mol/
|
|
293
|
+
//mol/fail/hidden/hidden.ts
|
|
177
294
|
;
|
|
178
295
|
"use strict";
|
|
179
296
|
var $;
|
|
@@ -265,256 +382,23 @@ var $;
|
|
|
265
382
|
"use strict";
|
|
266
383
|
var $;
|
|
267
384
|
(function ($) {
|
|
385
|
+
function $mol_test_complete() {
|
|
386
|
+
process.exit(0);
|
|
387
|
+
}
|
|
388
|
+
$.$mol_test_complete = $mol_test_complete;
|
|
268
389
|
})($ || ($ = {}));
|
|
269
|
-
//mol/
|
|
270
|
-
;
|
|
271
|
-
"use strict";
|
|
272
|
-
//node/node.ts
|
|
273
|
-
;
|
|
274
|
-
"use strict";
|
|
275
|
-
var $node = new Proxy({ require }, {
|
|
276
|
-
get(target, name, wrapper) {
|
|
277
|
-
if (target[name])
|
|
278
|
-
return target[name];
|
|
279
|
-
const mod = target.require('module');
|
|
280
|
-
if (mod.builtinModules.indexOf(name) >= 0)
|
|
281
|
-
return target.require(name);
|
|
282
|
-
if (name[0] === '.')
|
|
283
|
-
return target.require(name);
|
|
284
|
-
const path = target.require('path');
|
|
285
|
-
const fs = target.require('fs');
|
|
286
|
-
let dir = path.resolve('.');
|
|
287
|
-
const suffix = `./node_modules/${name}`;
|
|
288
|
-
const $$ = $;
|
|
289
|
-
while (!fs.existsSync(path.join(dir, suffix))) {
|
|
290
|
-
const parent = path.resolve(dir, '..');
|
|
291
|
-
if (parent === dir) {
|
|
292
|
-
$$.$mol_exec('.', 'npm', 'install', '--omit=dev', name);
|
|
293
|
-
try {
|
|
294
|
-
$$.$mol_exec('.', 'npm', 'install', '--omit=dev', '@types/' + name);
|
|
295
|
-
}
|
|
296
|
-
catch { }
|
|
297
|
-
break;
|
|
298
|
-
}
|
|
299
|
-
else {
|
|
300
|
-
dir = parent;
|
|
301
|
-
}
|
|
302
|
-
}
|
|
303
|
-
return target.require(name);
|
|
304
|
-
},
|
|
305
|
-
set(target, name, value) {
|
|
306
|
-
target[name] = value;
|
|
307
|
-
return true;
|
|
308
|
-
},
|
|
309
|
-
});
|
|
310
|
-
require = (req => Object.assign(function require(name) {
|
|
311
|
-
return $node[name];
|
|
312
|
-
}, req))(require);
|
|
313
|
-
//node/node.node.ts
|
|
390
|
+
//mol/test/test.node.test.ts
|
|
314
391
|
;
|
|
315
392
|
"use strict";
|
|
316
393
|
var $;
|
|
317
394
|
(function ($) {
|
|
318
|
-
function $
|
|
319
|
-
const
|
|
320
|
-
|
|
321
|
-
const deep = stack.length;
|
|
322
|
-
let logged = false;
|
|
323
|
-
stack.push(() => {
|
|
324
|
-
logged = true;
|
|
325
|
-
self.$mol_log3_area.call(self, event);
|
|
326
|
-
});
|
|
327
|
-
return () => {
|
|
328
|
-
if (logged)
|
|
329
|
-
self.console.groupEnd();
|
|
330
|
-
if (stack.length > deep)
|
|
331
|
-
stack.length = deep;
|
|
332
|
-
};
|
|
395
|
+
function $mol_dom_serialize(node) {
|
|
396
|
+
const serializer = new $mol_dom_context.XMLSerializer;
|
|
397
|
+
return serializer.serializeToString(node);
|
|
333
398
|
}
|
|
334
|
-
$.$
|
|
335
|
-
$.$mol_log3_stack = [];
|
|
399
|
+
$.$mol_dom_serialize = $mol_dom_serialize;
|
|
336
400
|
})($ || ($ = {}));
|
|
337
|
-
//mol/
|
|
338
|
-
;
|
|
339
|
-
"use strict";
|
|
340
|
-
var $;
|
|
341
|
-
(function ($) {
|
|
342
|
-
class $mol_term_color {
|
|
343
|
-
static reset = this.ansi(0, 0);
|
|
344
|
-
static bold = this.ansi(1, 22);
|
|
345
|
-
static italic = this.ansi(3, 23);
|
|
346
|
-
static underline = this.ansi(4, 24);
|
|
347
|
-
static inverse = this.ansi(7, 27);
|
|
348
|
-
static hidden = this.ansi(8, 28);
|
|
349
|
-
static strike = this.ansi(9, 29);
|
|
350
|
-
static gray = this.ansi(90, 39);
|
|
351
|
-
static red = this.ansi(91, 39);
|
|
352
|
-
static green = this.ansi(92, 39);
|
|
353
|
-
static yellow = this.ansi(93, 39);
|
|
354
|
-
static blue = this.ansi(94, 39);
|
|
355
|
-
static magenta = this.ansi(95, 39);
|
|
356
|
-
static cyan = this.ansi(96, 39);
|
|
357
|
-
static Gray = (str) => this.inverse(this.gray(str));
|
|
358
|
-
static Red = (str) => this.inverse(this.red(str));
|
|
359
|
-
static Green = (str) => this.inverse(this.green(str));
|
|
360
|
-
static Yellow = (str) => this.inverse(this.yellow(str));
|
|
361
|
-
static Blue = (str) => this.inverse(this.blue(str));
|
|
362
|
-
static Magenta = (str) => this.inverse(this.magenta(str));
|
|
363
|
-
static Cyan = (str) => this.inverse(this.cyan(str));
|
|
364
|
-
static ansi(open, close) {
|
|
365
|
-
if (typeof process === 'undefined')
|
|
366
|
-
return String;
|
|
367
|
-
if (!process.stdout.isTTY)
|
|
368
|
-
return String;
|
|
369
|
-
const prefix = `\x1b[${open}m`;
|
|
370
|
-
const postfix = `\x1b[${close}m`;
|
|
371
|
-
const suffix_regexp = new RegExp(postfix.replace('[', '\\['), 'g');
|
|
372
|
-
return function colorer(str) {
|
|
373
|
-
str = String(str);
|
|
374
|
-
if (str === '')
|
|
375
|
-
return str;
|
|
376
|
-
const suffix = str.replace(suffix_regexp, prefix);
|
|
377
|
-
return prefix + suffix + postfix;
|
|
378
|
-
};
|
|
379
|
-
}
|
|
380
|
-
}
|
|
381
|
-
$.$mol_term_color = $mol_term_color;
|
|
382
|
-
})($ || ($ = {}));
|
|
383
|
-
//mol/term/color/color.ts
|
|
384
|
-
;
|
|
385
|
-
"use strict";
|
|
386
|
-
var $;
|
|
387
|
-
(function ($) {
|
|
388
|
-
function $mol_log3_node_make(level, output, type, color) {
|
|
389
|
-
return function $mol_log3_logger(event) {
|
|
390
|
-
if (!event.time)
|
|
391
|
-
event = { time: new Date().toISOString(), ...event };
|
|
392
|
-
const tree = this.$mol_tree.fromJSON(event).clone({ type });
|
|
393
|
-
let str = color(tree.toString());
|
|
394
|
-
this.console[level](str);
|
|
395
|
-
const self = this;
|
|
396
|
-
return () => self.console.groupEnd();
|
|
397
|
-
};
|
|
398
|
-
}
|
|
399
|
-
$.$mol_log3_node_make = $mol_log3_node_make;
|
|
400
|
-
$.$mol_log3_come = $mol_log3_node_make('info', 'stdout', 'come', $mol_term_color.blue);
|
|
401
|
-
$.$mol_log3_done = $mol_log3_node_make('info', 'stdout', 'done', $mol_term_color.green);
|
|
402
|
-
$.$mol_log3_fail = $mol_log3_node_make('error', 'stderr', 'fail', $mol_term_color.red);
|
|
403
|
-
$.$mol_log3_warn = $mol_log3_node_make('warn', 'stderr', 'warn', $mol_term_color.yellow);
|
|
404
|
-
$.$mol_log3_rise = $mol_log3_node_make('log', 'stdout', 'rise', $mol_term_color.magenta);
|
|
405
|
-
$.$mol_log3_area = $mol_log3_node_make('log', 'stdout', 'area', $mol_term_color.cyan);
|
|
406
|
-
})($ || ($ = {}));
|
|
407
|
-
//mol/log3/log3.node.ts
|
|
408
|
-
;
|
|
409
|
-
"use strict";
|
|
410
|
-
var $;
|
|
411
|
-
(function ($_1) {
|
|
412
|
-
$mol_test_mocks.push($ => {
|
|
413
|
-
$.$mol_log3_come = () => { };
|
|
414
|
-
$.$mol_log3_done = () => { };
|
|
415
|
-
$.$mol_log3_fail = () => { };
|
|
416
|
-
$.$mol_log3_warn = () => { };
|
|
417
|
-
$.$mol_log3_rise = () => { };
|
|
418
|
-
$.$mol_log3_area = () => () => { };
|
|
419
|
-
});
|
|
420
|
-
})($ || ($ = {}));
|
|
421
|
-
//mol/log3/log3.test.ts
|
|
422
|
-
;
|
|
423
|
-
"use strict";
|
|
424
|
-
var $;
|
|
425
|
-
(function ($) {
|
|
426
|
-
function $mol_env() {
|
|
427
|
-
return {};
|
|
428
|
-
}
|
|
429
|
-
$.$mol_env = $mol_env;
|
|
430
|
-
})($ || ($ = {}));
|
|
431
|
-
//mol/env/env.ts
|
|
432
|
-
;
|
|
433
|
-
"use strict";
|
|
434
|
-
var $;
|
|
435
|
-
(function ($) {
|
|
436
|
-
$.$mol_env = function $mol_env() {
|
|
437
|
-
return this.process.env;
|
|
438
|
-
};
|
|
439
|
-
})($ || ($ = {}));
|
|
440
|
-
//mol/env/env.node.ts
|
|
441
|
-
;
|
|
442
|
-
"use strict";
|
|
443
|
-
var $;
|
|
444
|
-
(function ($) {
|
|
445
|
-
function $mol_exec(dir, command, ...args) {
|
|
446
|
-
let [app, ...args0] = command.split(' ');
|
|
447
|
-
args = [...args0, ...args];
|
|
448
|
-
this.$mol_log3_come({
|
|
449
|
-
place: '$mol_exec',
|
|
450
|
-
dir: $node.path.relative('', dir),
|
|
451
|
-
message: 'Run',
|
|
452
|
-
command: `${app} ${args.join(' ')}`,
|
|
453
|
-
});
|
|
454
|
-
var res = $node['child_process'].spawnSync(app, args, {
|
|
455
|
-
cwd: $node.path.resolve(dir),
|
|
456
|
-
shell: true,
|
|
457
|
-
env: this.$mol_env(),
|
|
458
|
-
});
|
|
459
|
-
if (res.status || res.error)
|
|
460
|
-
return $mol_fail(res.error || new Error(res.stderr.toString()));
|
|
461
|
-
if (!res.stdout)
|
|
462
|
-
res.stdout = Buffer.from([]);
|
|
463
|
-
return res;
|
|
464
|
-
}
|
|
465
|
-
$.$mol_exec = $mol_exec;
|
|
466
|
-
})($ || ($ = {}));
|
|
467
|
-
//mol/exec/exec.node.ts
|
|
468
|
-
;
|
|
469
|
-
"use strict";
|
|
470
|
-
var $;
|
|
471
|
-
(function ($) {
|
|
472
|
-
$.$mol_dom_context = new $node.jsdom.JSDOM('', { url: 'https://localhost/' }).window;
|
|
473
|
-
})($ || ($ = {}));
|
|
474
|
-
//mol/dom/context/context.node.ts
|
|
475
|
-
;
|
|
476
|
-
"use strict";
|
|
477
|
-
var $;
|
|
478
|
-
(function ($) {
|
|
479
|
-
function $mol_dom_serialize(node) {
|
|
480
|
-
const serializer = new $mol_dom_context.XMLSerializer;
|
|
481
|
-
return serializer.serializeToString(node);
|
|
482
|
-
}
|
|
483
|
-
$.$mol_dom_serialize = $mol_dom_serialize;
|
|
484
|
-
})($ || ($ = {}));
|
|
485
|
-
//mol/dom/serialize/serialize.ts
|
|
486
|
-
;
|
|
487
|
-
"use strict";
|
|
488
|
-
var $;
|
|
489
|
-
(function ($) {
|
|
490
|
-
$mol_test({
|
|
491
|
-
'must be false'() {
|
|
492
|
-
$mol_assert_not(0);
|
|
493
|
-
},
|
|
494
|
-
'must be true'() {
|
|
495
|
-
$mol_assert_ok(1);
|
|
496
|
-
},
|
|
497
|
-
'two must be equal'() {
|
|
498
|
-
$mol_assert_equal(2, 2);
|
|
499
|
-
},
|
|
500
|
-
'three must be equal'() {
|
|
501
|
-
$mol_assert_equal(2, 2, 2);
|
|
502
|
-
},
|
|
503
|
-
'two must be unique'() {
|
|
504
|
-
$mol_assert_unique([3], [3]);
|
|
505
|
-
},
|
|
506
|
-
'three must be unique'() {
|
|
507
|
-
$mol_assert_unique([3], [3], [3]);
|
|
508
|
-
},
|
|
509
|
-
'two must be alike'() {
|
|
510
|
-
$mol_assert_like([3], [3]);
|
|
511
|
-
},
|
|
512
|
-
'three must be alike'() {
|
|
513
|
-
$mol_assert_like([3], [3], [3]);
|
|
514
|
-
},
|
|
515
|
-
});
|
|
516
|
-
})($ || ($ = {}));
|
|
517
|
-
//mol/assert/assert.test.ts
|
|
401
|
+
//mol/dom/serialize/serialize.ts
|
|
518
402
|
;
|
|
519
403
|
"use strict";
|
|
520
404
|
var $;
|
|
@@ -612,236 +496,173 @@ var $;
|
|
|
612
496
|
;
|
|
613
497
|
"use strict";
|
|
614
498
|
var $;
|
|
615
|
-
(function ($
|
|
499
|
+
(function ($) {
|
|
616
500
|
$mol_test({
|
|
617
|
-
'
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
$
|
|
501
|
+
'must be false'() {
|
|
502
|
+
$mol_assert_not(0);
|
|
503
|
+
},
|
|
504
|
+
'must be true'() {
|
|
505
|
+
$mol_assert_ok(1);
|
|
506
|
+
},
|
|
507
|
+
'two must be equal'() {
|
|
508
|
+
$mol_assert_equal(2, 2);
|
|
509
|
+
},
|
|
510
|
+
'three must be equal'() {
|
|
511
|
+
$mol_assert_equal(2, 2, 2);
|
|
512
|
+
},
|
|
513
|
+
'two must be unique'() {
|
|
514
|
+
$mol_assert_unique([3], [3]);
|
|
515
|
+
},
|
|
516
|
+
'three must be unique'() {
|
|
517
|
+
$mol_assert_unique([3], [3], [3]);
|
|
518
|
+
},
|
|
519
|
+
'two must be alike'() {
|
|
520
|
+
$mol_assert_like([3], [3]);
|
|
521
|
+
},
|
|
522
|
+
'three must be alike'() {
|
|
523
|
+
$mol_assert_like([3], [3], [3]);
|
|
622
524
|
},
|
|
623
525
|
});
|
|
624
526
|
})($ || ($ = {}));
|
|
625
|
-
//mol/
|
|
527
|
+
//mol/assert/assert.test.ts
|
|
626
528
|
;
|
|
627
529
|
"use strict";
|
|
628
530
|
var $;
|
|
629
531
|
(function ($) {
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
catch { }
|
|
646
|
-
}
|
|
647
|
-
named.add(func);
|
|
648
|
-
return name;
|
|
649
|
-
}
|
|
650
|
-
$.$mol_func_name = $mol_func_name;
|
|
651
|
-
function $mol_func_name_from(target, source) {
|
|
652
|
-
Object.defineProperty(target, 'name', { value: source.name });
|
|
653
|
-
return target;
|
|
532
|
+
function $mol_log3_area_lazy(event) {
|
|
533
|
+
const self = this;
|
|
534
|
+
const stack = self.$mol_log3_stack;
|
|
535
|
+
const deep = stack.length;
|
|
536
|
+
let logged = false;
|
|
537
|
+
stack.push(() => {
|
|
538
|
+
logged = true;
|
|
539
|
+
self.$mol_log3_area.call(self, event);
|
|
540
|
+
});
|
|
541
|
+
return () => {
|
|
542
|
+
if (logged)
|
|
543
|
+
self.console.groupEnd();
|
|
544
|
+
if (stack.length > deep)
|
|
545
|
+
stack.length = deep;
|
|
546
|
+
};
|
|
654
547
|
}
|
|
655
|
-
$.$
|
|
548
|
+
$.$mol_log3_area_lazy = $mol_log3_area_lazy;
|
|
549
|
+
$.$mol_log3_stack = [];
|
|
656
550
|
})($ || ($ = {}));
|
|
657
|
-
//mol/
|
|
551
|
+
//mol/log3/log3.ts
|
|
658
552
|
;
|
|
659
553
|
"use strict";
|
|
660
554
|
var $;
|
|
661
555
|
(function ($) {
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
}
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
const textNode = $mol_dom_context.document.createTextNode(String(view));
|
|
700
|
-
el.insertBefore(textNode, nextNode);
|
|
701
|
-
}
|
|
702
|
-
}
|
|
703
|
-
}
|
|
704
|
-
while (nextNode) {
|
|
705
|
-
const currNode = nextNode;
|
|
706
|
-
nextNode = currNode.nextSibling;
|
|
707
|
-
el.removeChild(currNode);
|
|
556
|
+
class $mol_term_color {
|
|
557
|
+
static reset = this.ansi(0, 0);
|
|
558
|
+
static bold = this.ansi(1, 22);
|
|
559
|
+
static italic = this.ansi(3, 23);
|
|
560
|
+
static underline = this.ansi(4, 24);
|
|
561
|
+
static inverse = this.ansi(7, 27);
|
|
562
|
+
static hidden = this.ansi(8, 28);
|
|
563
|
+
static strike = this.ansi(9, 29);
|
|
564
|
+
static gray = this.ansi(90, 39);
|
|
565
|
+
static red = this.ansi(91, 39);
|
|
566
|
+
static green = this.ansi(92, 39);
|
|
567
|
+
static yellow = this.ansi(93, 39);
|
|
568
|
+
static blue = this.ansi(94, 39);
|
|
569
|
+
static magenta = this.ansi(95, 39);
|
|
570
|
+
static cyan = this.ansi(96, 39);
|
|
571
|
+
static Gray = (str) => this.inverse(this.gray(str));
|
|
572
|
+
static Red = (str) => this.inverse(this.red(str));
|
|
573
|
+
static Green = (str) => this.inverse(this.green(str));
|
|
574
|
+
static Yellow = (str) => this.inverse(this.yellow(str));
|
|
575
|
+
static Blue = (str) => this.inverse(this.blue(str));
|
|
576
|
+
static Magenta = (str) => this.inverse(this.magenta(str));
|
|
577
|
+
static Cyan = (str) => this.inverse(this.cyan(str));
|
|
578
|
+
static ansi(open, close) {
|
|
579
|
+
if (typeof process === 'undefined')
|
|
580
|
+
return String;
|
|
581
|
+
if (!process.stdout.isTTY)
|
|
582
|
+
return String;
|
|
583
|
+
const prefix = `\x1b[${open}m`;
|
|
584
|
+
const postfix = `\x1b[${close}m`;
|
|
585
|
+
const suffix_regexp = new RegExp(postfix.replace('[', '\\['), 'g');
|
|
586
|
+
return function colorer(str) {
|
|
587
|
+
str = String(str);
|
|
588
|
+
if (str === '')
|
|
589
|
+
return str;
|
|
590
|
+
const suffix = str.replace(suffix_regexp, prefix);
|
|
591
|
+
return prefix + suffix + postfix;
|
|
592
|
+
};
|
|
708
593
|
}
|
|
709
594
|
}
|
|
710
|
-
$.$
|
|
711
|
-
})($ || ($ = {}));
|
|
712
|
-
//mol/dom/render/children/children.ts
|
|
713
|
-
;
|
|
714
|
-
"use strict";
|
|
715
|
-
//mol/type/error/error.ts
|
|
716
|
-
;
|
|
717
|
-
"use strict";
|
|
718
|
-
//mol/type/assert/assert.test.ts
|
|
719
|
-
;
|
|
720
|
-
"use strict";
|
|
721
|
-
//mol/type/assert/assert.ts
|
|
722
|
-
;
|
|
723
|
-
"use strict";
|
|
724
|
-
//mol/type/equals/equals.test.ts
|
|
725
|
-
;
|
|
726
|
-
"use strict";
|
|
727
|
-
//mol/type/equals/equals.ts
|
|
728
|
-
;
|
|
729
|
-
"use strict";
|
|
730
|
-
//mol/type/partial/deep/deep.test.ts
|
|
731
|
-
;
|
|
732
|
-
"use strict";
|
|
733
|
-
//mol/type/partial/deep/deep.ts
|
|
734
|
-
;
|
|
735
|
-
"use strict";
|
|
736
|
-
var $;
|
|
737
|
-
(function ($) {
|
|
738
|
-
$.$mol_ambient_ref = Symbol('$mol_ambient_ref');
|
|
739
|
-
function $mol_ambient(overrides) {
|
|
740
|
-
return Object.setPrototypeOf(overrides, this || $);
|
|
741
|
-
}
|
|
742
|
-
$.$mol_ambient = $mol_ambient;
|
|
595
|
+
$.$mol_term_color = $mol_term_color;
|
|
743
596
|
})($ || ($ = {}));
|
|
744
|
-
//mol/
|
|
597
|
+
//mol/term/color/color.ts
|
|
745
598
|
;
|
|
746
599
|
"use strict";
|
|
747
600
|
var $;
|
|
748
601
|
(function ($) {
|
|
749
|
-
$
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
}
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
const proxy = $mol_delegate({}, () => new Foo);
|
|
781
|
-
$mol_assert_equal(Object.getPrototypeOf(proxy), Foo.prototype);
|
|
782
|
-
},
|
|
783
|
-
'setPrototypeOf'() {
|
|
784
|
-
class Foo {
|
|
785
|
-
}
|
|
786
|
-
const target = {};
|
|
787
|
-
const proxy = $mol_delegate({}, () => target);
|
|
788
|
-
Object.setPrototypeOf(proxy, Foo.prototype);
|
|
789
|
-
$mol_assert_equal(Object.getPrototypeOf(target), Foo.prototype);
|
|
790
|
-
},
|
|
791
|
-
'instanceof'() {
|
|
792
|
-
class Foo {
|
|
793
|
-
}
|
|
794
|
-
const proxy = $mol_delegate({}, () => new Foo);
|
|
795
|
-
$mol_assert_ok(proxy instanceof Foo);
|
|
796
|
-
$mol_assert_ok(proxy instanceof $mol_delegate);
|
|
797
|
-
},
|
|
798
|
-
'autobind'() {
|
|
799
|
-
class Foo {
|
|
800
|
-
}
|
|
801
|
-
const proxy = $mol_delegate({}, () => new Foo);
|
|
802
|
-
$mol_assert_ok(proxy instanceof Foo);
|
|
803
|
-
$mol_assert_ok(proxy instanceof $mol_delegate);
|
|
804
|
-
},
|
|
602
|
+
function $mol_log3_node_make(level, output, type, color) {
|
|
603
|
+
return function $mol_log3_logger(event) {
|
|
604
|
+
if (!event.time)
|
|
605
|
+
event = { time: new Date().toISOString(), ...event };
|
|
606
|
+
const tree = this.$mol_tree.fromJSON(event).clone({ type });
|
|
607
|
+
let str = color(tree.toString());
|
|
608
|
+
this.console[level](str);
|
|
609
|
+
const self = this;
|
|
610
|
+
return () => self.console.groupEnd();
|
|
611
|
+
};
|
|
612
|
+
}
|
|
613
|
+
$.$mol_log3_node_make = $mol_log3_node_make;
|
|
614
|
+
$.$mol_log3_come = $mol_log3_node_make('info', 'stdout', 'come', $mol_term_color.blue);
|
|
615
|
+
$.$mol_log3_done = $mol_log3_node_make('info', 'stdout', 'done', $mol_term_color.green);
|
|
616
|
+
$.$mol_log3_fail = $mol_log3_node_make('error', 'stderr', 'fail', $mol_term_color.red);
|
|
617
|
+
$.$mol_log3_warn = $mol_log3_node_make('warn', 'stderr', 'warn', $mol_term_color.yellow);
|
|
618
|
+
$.$mol_log3_rise = $mol_log3_node_make('log', 'stdout', 'rise', $mol_term_color.magenta);
|
|
619
|
+
$.$mol_log3_area = $mol_log3_node_make('log', 'stdout', 'area', $mol_term_color.cyan);
|
|
620
|
+
})($ || ($ = {}));
|
|
621
|
+
//mol/log3/log3.node.ts
|
|
622
|
+
;
|
|
623
|
+
"use strict";
|
|
624
|
+
var $;
|
|
625
|
+
(function ($_1) {
|
|
626
|
+
$mol_test_mocks.push($ => {
|
|
627
|
+
$.$mol_log3_come = () => { };
|
|
628
|
+
$.$mol_log3_done = () => { };
|
|
629
|
+
$.$mol_log3_fail = () => { };
|
|
630
|
+
$.$mol_log3_warn = () => { };
|
|
631
|
+
$.$mol_log3_rise = () => { };
|
|
632
|
+
$.$mol_log3_area = () => () => { };
|
|
805
633
|
});
|
|
806
634
|
})($ || ($ = {}));
|
|
807
|
-
//mol/
|
|
635
|
+
//mol/log3/log3.test.ts
|
|
808
636
|
;
|
|
809
637
|
"use strict";
|
|
810
638
|
var $;
|
|
811
639
|
(function ($) {
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
const proxy = new Proxy(proto, {
|
|
815
|
-
get: (_, field) => {
|
|
816
|
-
const obj = target();
|
|
817
|
-
let val = Reflect.get(obj, field);
|
|
818
|
-
if (typeof val === 'function') {
|
|
819
|
-
val = val.bind(obj);
|
|
820
|
-
}
|
|
821
|
-
return val;
|
|
822
|
-
},
|
|
823
|
-
has: (_, field) => Reflect.has(target(), field),
|
|
824
|
-
set: (_, field, value) => Reflect.set(target(), field, value),
|
|
825
|
-
getOwnPropertyDescriptor: (_, field) => Reflect.getOwnPropertyDescriptor(target(), field),
|
|
826
|
-
ownKeys: () => Reflect.ownKeys(target()),
|
|
827
|
-
getPrototypeOf: () => Reflect.getPrototypeOf(target()),
|
|
828
|
-
setPrototypeOf: (_, donor) => Reflect.setPrototypeOf(target(), donor),
|
|
829
|
-
isExtensible: () => Reflect.isExtensible(target()),
|
|
830
|
-
preventExtensions: () => Reflect.preventExtensions(target()),
|
|
831
|
-
apply: (_, self, args) => Reflect.apply(target(), self, args),
|
|
832
|
-
construct: (_, args, retarget) => Reflect.construct(target(), args, retarget),
|
|
833
|
-
defineProperty: (_, field, descr) => Reflect.defineProperty(target(), field, descr),
|
|
834
|
-
deleteProperty: (_, field) => Reflect.deleteProperty(target(), field),
|
|
835
|
-
});
|
|
836
|
-
instances.add(proxy);
|
|
837
|
-
return proxy;
|
|
640
|
+
function $mol_env() {
|
|
641
|
+
return {};
|
|
838
642
|
}
|
|
839
|
-
$.$
|
|
840
|
-
Reflect.defineProperty($mol_delegate, Symbol.hasInstance, {
|
|
841
|
-
value: (obj) => instances.has(obj),
|
|
842
|
-
});
|
|
643
|
+
$.$mol_env = $mol_env;
|
|
843
644
|
})($ || ($ = {}));
|
|
844
|
-
//mol/
|
|
645
|
+
//mol/env/env.ts
|
|
646
|
+
;
|
|
647
|
+
"use strict";
|
|
648
|
+
var $;
|
|
649
|
+
(function ($) {
|
|
650
|
+
$.$mol_env = function $mol_env() {
|
|
651
|
+
return this.process.env;
|
|
652
|
+
};
|
|
653
|
+
})($ || ($ = {}));
|
|
654
|
+
//mol/env/env.node.ts
|
|
655
|
+
;
|
|
656
|
+
"use strict";
|
|
657
|
+
var $;
|
|
658
|
+
(function ($) {
|
|
659
|
+
$.$mol_ambient_ref = Symbol('$mol_ambient_ref');
|
|
660
|
+
function $mol_ambient(overrides) {
|
|
661
|
+
return Object.setPrototypeOf(overrides, this || $);
|
|
662
|
+
}
|
|
663
|
+
$.$mol_ambient = $mol_ambient;
|
|
664
|
+
})($ || ($ = {}));
|
|
665
|
+
//mol/ambient/ambient.ts
|
|
845
666
|
;
|
|
846
667
|
"use strict";
|
|
847
668
|
var $;
|
|
@@ -900,12 +721,18 @@ var $;
|
|
|
900
721
|
//mol/owning/owning.ts
|
|
901
722
|
;
|
|
902
723
|
"use strict";
|
|
903
|
-
//mol/type/
|
|
724
|
+
//mol/type/equals/equals.ts
|
|
725
|
+
;
|
|
726
|
+
"use strict";
|
|
727
|
+
//mol/type/equals/equals.test.ts
|
|
904
728
|
;
|
|
905
729
|
"use strict";
|
|
906
730
|
//mol/type/writable/writable.ts
|
|
907
731
|
;
|
|
908
732
|
"use strict";
|
|
733
|
+
//mol/type/writable/writable.test.ts
|
|
734
|
+
;
|
|
735
|
+
"use strict";
|
|
909
736
|
var $;
|
|
910
737
|
(function ($) {
|
|
911
738
|
class $mol_object2 {
|
|
@@ -950,63 +777,103 @@ var $;
|
|
|
950
777
|
;
|
|
951
778
|
"use strict";
|
|
952
779
|
var $;
|
|
953
|
-
(function ($
|
|
780
|
+
(function ($) {
|
|
781
|
+
const instances = new WeakSet();
|
|
782
|
+
function $mol_delegate(proto, target) {
|
|
783
|
+
const proxy = new Proxy(proto, {
|
|
784
|
+
get: (_, field) => {
|
|
785
|
+
const obj = target();
|
|
786
|
+
let val = Reflect.get(obj, field);
|
|
787
|
+
if (typeof val === 'function') {
|
|
788
|
+
val = val.bind(obj);
|
|
789
|
+
}
|
|
790
|
+
return val;
|
|
791
|
+
},
|
|
792
|
+
has: (_, field) => Reflect.has(target(), field),
|
|
793
|
+
set: (_, field, value) => Reflect.set(target(), field, value),
|
|
794
|
+
getOwnPropertyDescriptor: (_, field) => Reflect.getOwnPropertyDescriptor(target(), field),
|
|
795
|
+
ownKeys: () => Reflect.ownKeys(target()),
|
|
796
|
+
getPrototypeOf: () => Reflect.getPrototypeOf(target()),
|
|
797
|
+
setPrototypeOf: (_, donor) => Reflect.setPrototypeOf(target(), donor),
|
|
798
|
+
isExtensible: () => Reflect.isExtensible(target()),
|
|
799
|
+
preventExtensions: () => Reflect.preventExtensions(target()),
|
|
800
|
+
apply: (_, self, args) => Reflect.apply(target(), self, args),
|
|
801
|
+
construct: (_, args, retarget) => Reflect.construct(target(), args, retarget),
|
|
802
|
+
defineProperty: (_, field, descr) => Reflect.defineProperty(target(), field, descr),
|
|
803
|
+
deleteProperty: (_, field) => Reflect.deleteProperty(target(), field),
|
|
804
|
+
});
|
|
805
|
+
instances.add(proxy);
|
|
806
|
+
return proxy;
|
|
807
|
+
}
|
|
808
|
+
$.$mol_delegate = $mol_delegate;
|
|
809
|
+
Reflect.defineProperty($mol_delegate, Symbol.hasInstance, {
|
|
810
|
+
value: (obj) => instances.has(obj),
|
|
811
|
+
});
|
|
812
|
+
})($ || ($ = {}));
|
|
813
|
+
//mol/delegate/delegate.ts
|
|
814
|
+
;
|
|
815
|
+
"use strict";
|
|
816
|
+
var $;
|
|
817
|
+
(function ($) {
|
|
954
818
|
$mol_test({
|
|
955
|
-
'
|
|
956
|
-
$
|
|
957
|
-
$mol_assert_equal(
|
|
958
|
-
$mol_assert_equal($mol_tree.fromString("foo\n\n\n").sub.length, 1);
|
|
959
|
-
$mol_assert_equal($mol_tree.fromString("=foo\n\\bar\n").sub.length, 2);
|
|
960
|
-
$mol_assert_equal($mol_tree.fromString("=foo\n\\bar\n").sub[1].data, "bar");
|
|
961
|
-
$mol_assert_equal($mol_tree.fromString("foo bar \\pol").sub[0].sub[0].sub[0].data, "pol");
|
|
962
|
-
$mol_assert_equal($mol_tree.fromString("foo bar\n\t\\pol\n\t\\men").sub[0].sub[0].sub[1].data, "men");
|
|
963
|
-
$mol_assert_equal($mol_tree.fromString('foo bar \\text\n').toString(), 'foo bar \\text\n');
|
|
964
|
-
},
|
|
965
|
-
'inserting'() {
|
|
966
|
-
$mol_assert_equal($mol_tree.fromString('a b c d').insert(new $mol_tree, 'a', 'b', 'c').toString(), 'a b \\\n');
|
|
967
|
-
$mol_assert_equal($mol_tree.fromString('a b').insert(new $mol_tree, 'a', 'b', 'c', 'd').toString(), 'a b c \\\n');
|
|
968
|
-
$mol_assert_equal($mol_tree.fromString('a b c d').insert(new $mol_tree, 0, 0, 0).toString(), 'a b \\\n');
|
|
969
|
-
$mol_assert_equal($mol_tree.fromString('a b').insert(new $mol_tree, 0, 0, 0, 0).toString(), 'a b \\\n\t\\\n');
|
|
970
|
-
$mol_assert_equal($mol_tree.fromString('a b c d').insert(new $mol_tree, null, null, null).toString(), 'a b \\\n');
|
|
971
|
-
$mol_assert_equal($mol_tree.fromString('a b').insert(new $mol_tree, null, null, null, null).toString(), 'a b \\\n\t\\\n');
|
|
819
|
+
'get'() {
|
|
820
|
+
const proxy = $mol_delegate({}, () => ({ foo: 777 }));
|
|
821
|
+
$mol_assert_equal(proxy.foo, 777);
|
|
972
822
|
},
|
|
973
|
-
'
|
|
974
|
-
$
|
|
975
|
-
$mol_assert_equal(
|
|
976
|
-
$mol_assert_equal($mol_tree.fromJSON([0, 1, 2.3]).toString(), '/\n\t0\n\t1\n\t2.3\n');
|
|
977
|
-
$mol_assert_equal($mol_tree.fromJSON(['', 'foo', 'bar\nbaz']).toString(), '/\n\t\\\n\t\\foo\n\t\\\n\t\t\\bar\n\t\t\\baz\n');
|
|
978
|
-
$mol_assert_equal($mol_tree.fromJSON({ 'foo': false, 'bar\nbaz': 'lol' }).toString(), '*\n\tfoo false\n\t\\\n\t\t\\bar\n\t\t\\baz\n\t\t\\lol\n');
|
|
823
|
+
'has'() {
|
|
824
|
+
const proxy = $mol_delegate({}, () => ({ foo: 777 }));
|
|
825
|
+
$mol_assert_equal('foo' in proxy, true);
|
|
979
826
|
},
|
|
980
|
-
'
|
|
981
|
-
|
|
982
|
-
$
|
|
983
|
-
|
|
984
|
-
$mol_assert_equal(
|
|
985
|
-
$mol_assert_equal(JSON.stringify($mol_tree.fromString('*\n\tfoo false\n\t\\\n\t\t\\bar\n\t\t\\baz\n\t\t\\lol\n').sub[0]), '{"foo":false,"bar\\nbaz":"lol"}');
|
|
827
|
+
'set'() {
|
|
828
|
+
const target = { foo: 777 };
|
|
829
|
+
const proxy = $mol_delegate({}, () => target);
|
|
830
|
+
proxy.foo = 123;
|
|
831
|
+
$mol_assert_equal(target.foo, 123);
|
|
986
832
|
},
|
|
987
|
-
'
|
|
988
|
-
const
|
|
989
|
-
|
|
990
|
-
|
|
833
|
+
'getOwnPropertyDescriptor'() {
|
|
834
|
+
const proxy = $mol_delegate({}, () => ({ foo: 777 }));
|
|
835
|
+
$mol_assert_like(Object.getOwnPropertyDescriptor(proxy, 'foo'), {
|
|
836
|
+
value: 777,
|
|
837
|
+
writable: true,
|
|
838
|
+
enumerable: true,
|
|
839
|
+
configurable: true,
|
|
991
840
|
});
|
|
992
|
-
$mol_assert_equal(res.toString(), new $mol_tree({ type: 'foo 777 xxx' }).toString());
|
|
993
841
|
},
|
|
994
|
-
'
|
|
995
|
-
const
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
842
|
+
'ownKeys'() {
|
|
843
|
+
const proxy = $mol_delegate({}, () => ({ foo: 777, [Symbol.toStringTag]: 'bar' }));
|
|
844
|
+
$mol_assert_like(Reflect.ownKeys(proxy), ['foo', Symbol.toStringTag]);
|
|
845
|
+
},
|
|
846
|
+
'getPrototypeOf'() {
|
|
847
|
+
class Foo {
|
|
1000
848
|
}
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
849
|
+
const proxy = $mol_delegate({}, () => new Foo);
|
|
850
|
+
$mol_assert_equal(Object.getPrototypeOf(proxy), Foo.prototype);
|
|
851
|
+
},
|
|
852
|
+
'setPrototypeOf'() {
|
|
853
|
+
class Foo {
|
|
854
|
+
}
|
|
855
|
+
const target = {};
|
|
856
|
+
const proxy = $mol_delegate({}, () => target);
|
|
857
|
+
Object.setPrototypeOf(proxy, Foo.prototype);
|
|
858
|
+
$mol_assert_equal(Object.getPrototypeOf(target), Foo.prototype);
|
|
859
|
+
},
|
|
860
|
+
'instanceof'() {
|
|
861
|
+
class Foo {
|
|
862
|
+
}
|
|
863
|
+
const proxy = $mol_delegate({}, () => new Foo);
|
|
864
|
+
$mol_assert_ok(proxy instanceof Foo);
|
|
865
|
+
$mol_assert_ok(proxy instanceof $mol_delegate);
|
|
866
|
+
},
|
|
867
|
+
'autobind'() {
|
|
868
|
+
class Foo {
|
|
869
|
+
}
|
|
870
|
+
const proxy = $mol_delegate({}, () => new Foo);
|
|
871
|
+
$mol_assert_ok(proxy instanceof Foo);
|
|
872
|
+
$mol_assert_ok(proxy instanceof $mol_delegate);
|
|
1006
873
|
},
|
|
1007
874
|
});
|
|
1008
875
|
})($ || ($ = {}));
|
|
1009
|
-
//mol/
|
|
876
|
+
//mol/delegate/delegate.test.ts
|
|
1010
877
|
;
|
|
1011
878
|
"use strict";
|
|
1012
879
|
var $;
|
|
@@ -1340,93 +1207,90 @@ var $;
|
|
|
1340
1207
|
;
|
|
1341
1208
|
"use strict";
|
|
1342
1209
|
var $;
|
|
1343
|
-
(function ($) {
|
|
1210
|
+
(function ($_1) {
|
|
1344
1211
|
$mol_test({
|
|
1345
|
-
'
|
|
1346
|
-
$mol_assert_equal(
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
$mol_assert_equal(
|
|
1351
|
-
$mol_assert_equal(
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
const dom = $mol_jsx("div", { class: 'foo bar' });
|
|
1355
|
-
$mol_assert_equal(dom.outerHTML, '<div class="foo bar"></div>');
|
|
1356
|
-
},
|
|
1357
|
-
'Define styles'() {
|
|
1358
|
-
const dom = $mol_jsx("div", { style: { color: 'red' } });
|
|
1359
|
-
$mol_assert_equal(dom.outerHTML, '<div style="color: red;"></div>');
|
|
1360
|
-
},
|
|
1361
|
-
'Define dataset'() {
|
|
1362
|
-
const dom = $mol_jsx("div", { dataset: { foo: 'bar' } });
|
|
1363
|
-
$mol_assert_equal(dom.outerHTML, '<div data-foo="bar"></div>');
|
|
1364
|
-
},
|
|
1365
|
-
'Define attributes'() {
|
|
1366
|
-
const dom = $mol_jsx("div", { lang: "ru", hidden: true });
|
|
1367
|
-
$mol_assert_equal(dom.outerHTML, '<div lang="ru" hidden=""></div>');
|
|
1368
|
-
},
|
|
1369
|
-
'Define child nodes'() {
|
|
1370
|
-
const dom = $mol_jsx("div", null,
|
|
1371
|
-
"hello",
|
|
1372
|
-
$mol_jsx("strong", null, "world"),
|
|
1373
|
-
"!");
|
|
1374
|
-
$mol_assert_equal(dom.outerHTML, '<div>hello<strong>world</strong>!</div>');
|
|
1212
|
+
'tree parsing'() {
|
|
1213
|
+
$mol_assert_equal($mol_tree.fromString("foo\nbar\n").sub.length, 2);
|
|
1214
|
+
$mol_assert_equal($mol_tree.fromString("foo\nbar\n").sub[1].type, "bar");
|
|
1215
|
+
$mol_assert_equal($mol_tree.fromString("foo\n\n\n").sub.length, 1);
|
|
1216
|
+
$mol_assert_equal($mol_tree.fromString("=foo\n\\bar\n").sub.length, 2);
|
|
1217
|
+
$mol_assert_equal($mol_tree.fromString("=foo\n\\bar\n").sub[1].data, "bar");
|
|
1218
|
+
$mol_assert_equal($mol_tree.fromString("foo bar \\pol").sub[0].sub[0].sub[0].data, "pol");
|
|
1219
|
+
$mol_assert_equal($mol_tree.fromString("foo bar\n\t\\pol\n\t\\men").sub[0].sub[0].sub[1].data, "men");
|
|
1220
|
+
$mol_assert_equal($mol_tree.fromString('foo bar \\text\n').toString(), 'foo bar \\text\n');
|
|
1375
1221
|
},
|
|
1376
|
-
'
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
$mol_assert_equal(
|
|
1222
|
+
'inserting'() {
|
|
1223
|
+
$mol_assert_equal($mol_tree.fromString('a b c d').insert(new $mol_tree, 'a', 'b', 'c').toString(), 'a b \\\n');
|
|
1224
|
+
$mol_assert_equal($mol_tree.fromString('a b').insert(new $mol_tree, 'a', 'b', 'c', 'd').toString(), 'a b c \\\n');
|
|
1225
|
+
$mol_assert_equal($mol_tree.fromString('a b c d').insert(new $mol_tree, 0, 0, 0).toString(), 'a b \\\n');
|
|
1226
|
+
$mol_assert_equal($mol_tree.fromString('a b').insert(new $mol_tree, 0, 0, 0, 0).toString(), 'a b \\\n\t\\\n');
|
|
1227
|
+
$mol_assert_equal($mol_tree.fromString('a b c d').insert(new $mol_tree, null, null, null).toString(), 'a b \\\n');
|
|
1228
|
+
$mol_assert_equal($mol_tree.fromString('a b').insert(new $mol_tree, null, null, null, null).toString(), 'a b \\\n\t\\\n');
|
|
1382
1229
|
},
|
|
1383
|
-
'
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
};
|
|
1389
|
-
const Bar = (props, icon) => {
|
|
1390
|
-
return $mol_jsx("span", null,
|
|
1391
|
-
icon,
|
|
1392
|
-
$mol_jsx("i", { id: "label" }));
|
|
1393
|
-
};
|
|
1394
|
-
const dom = $mol_jsx(Foo, { id: "foo" });
|
|
1395
|
-
$mol_assert_equal(dom.outerHTML, '<div id="foo" class="Foo"><span id="foo/bar" class="Foo_bar Bar"><img id="foo/icon" class="Foo_icon"><i id="foo/bar/label" class="Foo_bar_label Bar_label"></i></span></div>');
|
|
1230
|
+
'fromJSON'() {
|
|
1231
|
+
$mol_assert_equal($mol_tree.fromJSON([]).toString(), '/\n');
|
|
1232
|
+
$mol_assert_equal($mol_tree.fromJSON([false, true]).toString(), '/\n\tfalse\n\ttrue\n');
|
|
1233
|
+
$mol_assert_equal($mol_tree.fromJSON([0, 1, 2.3]).toString(), '/\n\t0\n\t1\n\t2.3\n');
|
|
1234
|
+
$mol_assert_equal($mol_tree.fromJSON(['', 'foo', 'bar\nbaz']).toString(), '/\n\t\\\n\t\\foo\n\t\\\n\t\t\\bar\n\t\t\\baz\n');
|
|
1235
|
+
$mol_assert_equal($mol_tree.fromJSON({ 'foo': false, 'bar\nbaz': 'lol' }).toString(), '*\n\tfoo false\n\t\\\n\t\t\\bar\n\t\t\\baz\n\t\t\\lol\n');
|
|
1396
1236
|
},
|
|
1397
|
-
'
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
};
|
|
1403
|
-
$mol_assert_fail(() => $mol_jsx(App, { id: "foo" }), 'JSX already has tag with id "foo/bar"');
|
|
1237
|
+
'toJSON'() {
|
|
1238
|
+
$mol_assert_equal(JSON.stringify($mol_tree.fromString('/\n').sub[0]), '[]');
|
|
1239
|
+
$mol_assert_equal(JSON.stringify($mol_tree.fromString('/\n\tfalse\n\ttrue\n').sub[0]), '[false,true]');
|
|
1240
|
+
$mol_assert_equal(JSON.stringify($mol_tree.fromString('/\n\t0\n\t1\n\t2.3\n').sub[0]), '[0,1,2.3]');
|
|
1241
|
+
$mol_assert_equal(JSON.stringify($mol_tree.fromString('/\n\t\\\n\t\\foo\n\t\\\n\t\t\\bar\n\t\t\\baz\n').sub[0]), '["","foo","bar\\nbaz"]');
|
|
1242
|
+
$mol_assert_equal(JSON.stringify($mol_tree.fromString('*\n\tfoo false\n\t\\\n\t\t\\bar\n\t\t\\baz\n\t\t\\lol\n').sub[0]), '{"foo":false,"bar\\nbaz":"lol"}');
|
|
1404
1243
|
},
|
|
1405
|
-
'
|
|
1406
|
-
const
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
};
|
|
1410
|
-
|
|
1411
|
-
return $mol_jsx("span", null, props.icon());
|
|
1412
|
-
};
|
|
1413
|
-
const dom = $mol_jsx(Foo, { id: "app" });
|
|
1414
|
-
$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>');
|
|
1244
|
+
'hack'() {
|
|
1245
|
+
const res = $mol_tree.fromString(`foo bar xxx`).hack({
|
|
1246
|
+
'': (tree, context) => [tree.hack(context)],
|
|
1247
|
+
'bar': (tree, context) => [tree.hack(context).clone({ type: '777' })],
|
|
1248
|
+
});
|
|
1249
|
+
$mol_assert_equal(res.toString(), new $mol_tree({ type: 'foo 777 xxx' }).toString());
|
|
1415
1250
|
},
|
|
1416
|
-
'
|
|
1417
|
-
const
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
$
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1251
|
+
'errors handling'($) {
|
|
1252
|
+
const errors = [];
|
|
1253
|
+
class Tree extends $mol_tree {
|
|
1254
|
+
static $ = $.$mol_ambient({
|
|
1255
|
+
$mol_fail: error => errors.push(error.message)
|
|
1256
|
+
});
|
|
1257
|
+
}
|
|
1258
|
+
Tree.fromString(`
|
|
1259
|
+
\t \tfoo
|
|
1260
|
+
bar \\data
|
|
1261
|
+
`, 'test');
|
|
1262
|
+
$mol_assert_like(errors, ['Syntax error at test:2\n \tfoo']);
|
|
1426
1263
|
},
|
|
1427
1264
|
});
|
|
1428
1265
|
})($ || ($ = {}));
|
|
1429
|
-
//mol/
|
|
1266
|
+
//mol/tree/tree.test.ts
|
|
1267
|
+
;
|
|
1268
|
+
"use strict";
|
|
1269
|
+
var $;
|
|
1270
|
+
(function ($) {
|
|
1271
|
+
function $mol_exec(dir, command, ...args) {
|
|
1272
|
+
let [app, ...args0] = command.split(' ');
|
|
1273
|
+
args = [...args0, ...args];
|
|
1274
|
+
this.$mol_log3_come({
|
|
1275
|
+
place: '$mol_exec',
|
|
1276
|
+
dir: $node.path.relative('', dir),
|
|
1277
|
+
message: 'Run',
|
|
1278
|
+
command: `${app} ${args.join(' ')}`,
|
|
1279
|
+
});
|
|
1280
|
+
var res = $node['child_process'].spawnSync(app, args, {
|
|
1281
|
+
cwd: $node.path.resolve(dir),
|
|
1282
|
+
shell: true,
|
|
1283
|
+
env: this.$mol_env(),
|
|
1284
|
+
});
|
|
1285
|
+
if (res.status || res.error)
|
|
1286
|
+
return $mol_fail(res.error || new Error(res.stderr.toString()));
|
|
1287
|
+
if (!res.stdout)
|
|
1288
|
+
res.stdout = Buffer.from([]);
|
|
1289
|
+
return res;
|
|
1290
|
+
}
|
|
1291
|
+
$.$mol_exec = $mol_exec;
|
|
1292
|
+
})($ || ($ = {}));
|
|
1293
|
+
//mol/exec/exec.node.ts
|
|
1430
1294
|
;
|
|
1431
1295
|
"use strict";
|
|
1432
1296
|
var $;
|
|
@@ -1551,6 +1415,142 @@ var $;
|
|
|
1551
1415
|
;
|
|
1552
1416
|
"use strict";
|
|
1553
1417
|
var $;
|
|
1418
|
+
(function ($) {
|
|
1419
|
+
$mol_test({
|
|
1420
|
+
'Make empty div'() {
|
|
1421
|
+
$mol_assert_equal(($mol_jsx("div", null)).outerHTML, '<div></div>');
|
|
1422
|
+
},
|
|
1423
|
+
'Define native field'() {
|
|
1424
|
+
const dom = $mol_jsx("input", { value: '123' });
|
|
1425
|
+
$mol_assert_equal(dom.outerHTML, '<input value="123">');
|
|
1426
|
+
$mol_assert_equal(dom.value, '123');
|
|
1427
|
+
},
|
|
1428
|
+
'Define classes'() {
|
|
1429
|
+
const dom = $mol_jsx("div", { class: 'foo bar' });
|
|
1430
|
+
$mol_assert_equal(dom.outerHTML, '<div class="foo bar"></div>');
|
|
1431
|
+
},
|
|
1432
|
+
'Define styles'() {
|
|
1433
|
+
const dom = $mol_jsx("div", { style: { color: 'red' } });
|
|
1434
|
+
$mol_assert_equal(dom.outerHTML, '<div style="color: red;"></div>');
|
|
1435
|
+
},
|
|
1436
|
+
'Define dataset'() {
|
|
1437
|
+
const dom = $mol_jsx("div", { dataset: { foo: 'bar' } });
|
|
1438
|
+
$mol_assert_equal(dom.outerHTML, '<div data-foo="bar"></div>');
|
|
1439
|
+
},
|
|
1440
|
+
'Define attributes'() {
|
|
1441
|
+
const dom = $mol_jsx("div", { lang: "ru", hidden: true });
|
|
1442
|
+
$mol_assert_equal(dom.outerHTML, '<div lang="ru" hidden=""></div>');
|
|
1443
|
+
},
|
|
1444
|
+
'Define child nodes'() {
|
|
1445
|
+
const dom = $mol_jsx("div", null,
|
|
1446
|
+
"hello",
|
|
1447
|
+
$mol_jsx("strong", null, "world"),
|
|
1448
|
+
"!");
|
|
1449
|
+
$mol_assert_equal(dom.outerHTML, '<div>hello<strong>world</strong>!</div>');
|
|
1450
|
+
},
|
|
1451
|
+
'Function as component'() {
|
|
1452
|
+
const Button = (props, target) => {
|
|
1453
|
+
return $mol_jsx("button", { title: props.hint }, target());
|
|
1454
|
+
};
|
|
1455
|
+
const dom = $mol_jsx(Button, { id: "foo", hint: "click me" }, () => 'hey!');
|
|
1456
|
+
$mol_assert_equal(dom.outerHTML, '<button id="foo" title="click me" class="Button">hey!</button>');
|
|
1457
|
+
},
|
|
1458
|
+
'Nested guid generation'() {
|
|
1459
|
+
const Foo = () => {
|
|
1460
|
+
return $mol_jsx("div", null,
|
|
1461
|
+
$mol_jsx(Bar, { id: "bar" },
|
|
1462
|
+
$mol_jsx("img", { id: "icon" })));
|
|
1463
|
+
};
|
|
1464
|
+
const Bar = (props, icon) => {
|
|
1465
|
+
return $mol_jsx("span", null,
|
|
1466
|
+
icon,
|
|
1467
|
+
$mol_jsx("i", { id: "label" }));
|
|
1468
|
+
};
|
|
1469
|
+
const dom = $mol_jsx(Foo, { id: "foo" });
|
|
1470
|
+
$mol_assert_equal(dom.outerHTML, '<div id="foo" class="Foo"><span id="foo/bar" class="Foo_bar Bar"><img id="foo/icon" class="Foo_icon"><i id="foo/bar/label" class="Foo_bar_label Bar_label"></i></span></div>');
|
|
1471
|
+
},
|
|
1472
|
+
'Fail on non unique ids'() {
|
|
1473
|
+
const App = () => {
|
|
1474
|
+
return $mol_jsx("div", null,
|
|
1475
|
+
$mol_jsx("span", { id: "bar" }),
|
|
1476
|
+
$mol_jsx("span", { id: "bar" }));
|
|
1477
|
+
};
|
|
1478
|
+
$mol_assert_fail(() => $mol_jsx(App, { id: "foo" }), 'JSX already has tag with id "foo/bar"');
|
|
1479
|
+
},
|
|
1480
|
+
'Owner based guid generationn'() {
|
|
1481
|
+
const Foo = () => {
|
|
1482
|
+
return $mol_jsx("div", null,
|
|
1483
|
+
$mol_jsx(Bar, { id: "middle", icon: () => $mol_jsx("img", { id: "icon" }) }));
|
|
1484
|
+
};
|
|
1485
|
+
const Bar = (props) => {
|
|
1486
|
+
return $mol_jsx("span", null, props.icon());
|
|
1487
|
+
};
|
|
1488
|
+
const dom = $mol_jsx(Foo, { id: "app" });
|
|
1489
|
+
$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>');
|
|
1490
|
+
},
|
|
1491
|
+
'Fail on same ids from different caller'() {
|
|
1492
|
+
const Foo = () => {
|
|
1493
|
+
return $mol_jsx("div", null,
|
|
1494
|
+
$mol_jsx("img", { id: "icon" }),
|
|
1495
|
+
$mol_jsx(Bar, { id: "bar", icon: () => $mol_jsx("img", { id: "icon" }) }));
|
|
1496
|
+
};
|
|
1497
|
+
const Bar = (props) => {
|
|
1498
|
+
return $mol_jsx("span", null, props.icon());
|
|
1499
|
+
};
|
|
1500
|
+
$mol_assert_fail(() => $mol_jsx(Foo, { id: "foo" }), 'JSX already has tag with id "foo/icon"');
|
|
1501
|
+
},
|
|
1502
|
+
});
|
|
1503
|
+
})($ || ($ = {}));
|
|
1504
|
+
//mol/jsx/jsx.test.tsx
|
|
1505
|
+
;
|
|
1506
|
+
"use strict";
|
|
1507
|
+
var $;
|
|
1508
|
+
(function ($) {
|
|
1509
|
+
const named = new WeakSet();
|
|
1510
|
+
function $mol_func_name(func) {
|
|
1511
|
+
let name = func.name;
|
|
1512
|
+
if (name?.length > 1)
|
|
1513
|
+
return name;
|
|
1514
|
+
if (named.has(func))
|
|
1515
|
+
return name;
|
|
1516
|
+
for (let key in this) {
|
|
1517
|
+
try {
|
|
1518
|
+
if (this[key] !== func)
|
|
1519
|
+
continue;
|
|
1520
|
+
name = key;
|
|
1521
|
+
Object.defineProperty(func, 'name', { value: name });
|
|
1522
|
+
break;
|
|
1523
|
+
}
|
|
1524
|
+
catch { }
|
|
1525
|
+
}
|
|
1526
|
+
named.add(func);
|
|
1527
|
+
return name;
|
|
1528
|
+
}
|
|
1529
|
+
$.$mol_func_name = $mol_func_name;
|
|
1530
|
+
function $mol_func_name_from(target, source) {
|
|
1531
|
+
Object.defineProperty(target, 'name', { value: source.name });
|
|
1532
|
+
return target;
|
|
1533
|
+
}
|
|
1534
|
+
$.$mol_func_name_from = $mol_func_name_from;
|
|
1535
|
+
})($ || ($ = {}));
|
|
1536
|
+
//mol/func/name/name.ts
|
|
1537
|
+
;
|
|
1538
|
+
"use strict";
|
|
1539
|
+
var $;
|
|
1540
|
+
(function ($_1) {
|
|
1541
|
+
$mol_test({
|
|
1542
|
+
'FQN of anon function'($) {
|
|
1543
|
+
const $$ = Object.assign($, { $mol_func_name_test: (() => () => { })() });
|
|
1544
|
+
$mol_assert_equal($$.$mol_func_name_test.name, '');
|
|
1545
|
+
$mol_assert_equal($$.$mol_func_name($$.$mol_func_name_test), '$mol_func_name_test');
|
|
1546
|
+
$mol_assert_equal($$.$mol_func_name_test.name, '$mol_func_name_test');
|
|
1547
|
+
},
|
|
1548
|
+
});
|
|
1549
|
+
})($ || ($ = {}));
|
|
1550
|
+
//mol/func/name/name.test.ts
|
|
1551
|
+
;
|
|
1552
|
+
"use strict";
|
|
1553
|
+
var $;
|
|
1554
1554
|
(function ($) {
|
|
1555
1555
|
$mol_test({
|
|
1556
1556
|
'nulls & undefineds'() {
|