mol_compare_deep 0.0.403 → 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 +521 -521
- 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 +301 -301
- 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,224 +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
|
|
401
|
+
//mol/dom/serialize/serialize.ts
|
|
486
402
|
;
|
|
487
403
|
"use strict";
|
|
488
404
|
var $;
|
|
@@ -613,118 +529,129 @@ var $;
|
|
|
613
529
|
"use strict";
|
|
614
530
|
var $;
|
|
615
531
|
(function ($) {
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
catch { }
|
|
632
|
-
}
|
|
633
|
-
named.add(func);
|
|
634
|
-
return name;
|
|
635
|
-
}
|
|
636
|
-
$.$mol_func_name = $mol_func_name;
|
|
637
|
-
function $mol_func_name_from(target, source) {
|
|
638
|
-
Object.defineProperty(target, 'name', { value: source.name });
|
|
639
|
-
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
|
+
};
|
|
640
547
|
}
|
|
641
|
-
$.$
|
|
548
|
+
$.$mol_log3_area_lazy = $mol_log3_area_lazy;
|
|
549
|
+
$.$mol_log3_stack = [];
|
|
642
550
|
})($ || ($ = {}));
|
|
643
|
-
//mol/
|
|
551
|
+
//mol/log3/log3.ts
|
|
644
552
|
;
|
|
645
553
|
"use strict";
|
|
646
554
|
var $;
|
|
647
|
-
(function ($
|
|
648
|
-
$
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
555
|
+
(function ($) {
|
|
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
|
+
};
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
$.$mol_term_color = $mol_term_color;
|
|
656
596
|
})($ || ($ = {}));
|
|
657
|
-
//mol/
|
|
597
|
+
//mol/term/color/color.ts
|
|
658
598
|
;
|
|
659
599
|
"use strict";
|
|
660
600
|
var $;
|
|
661
601
|
(function ($) {
|
|
662
|
-
function $
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
break;
|
|
673
|
-
}
|
|
674
|
-
if (nextNode == view) {
|
|
675
|
-
nextNode = nextNode.nextSibling;
|
|
676
|
-
break;
|
|
677
|
-
}
|
|
678
|
-
else {
|
|
679
|
-
if (node_set.has(nextNode)) {
|
|
680
|
-
el.insertBefore(view, nextNode);
|
|
681
|
-
break;
|
|
682
|
-
}
|
|
683
|
-
else {
|
|
684
|
-
const nn = nextNode.nextSibling;
|
|
685
|
-
el.removeChild(nextNode);
|
|
686
|
-
nextNode = nn;
|
|
687
|
-
}
|
|
688
|
-
}
|
|
689
|
-
}
|
|
690
|
-
}
|
|
691
|
-
else {
|
|
692
|
-
if (nextNode && nextNode.nodeName === '#text') {
|
|
693
|
-
const str = String(view);
|
|
694
|
-
if (nextNode.nodeValue !== str)
|
|
695
|
-
nextNode.nodeValue = str;
|
|
696
|
-
nextNode = nextNode.nextSibling;
|
|
697
|
-
}
|
|
698
|
-
else {
|
|
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);
|
|
708
|
-
}
|
|
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
|
+
};
|
|
709
612
|
}
|
|
710
|
-
$.$
|
|
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);
|
|
711
620
|
})($ || ($ = {}));
|
|
712
|
-
//mol/
|
|
713
|
-
;
|
|
714
|
-
"use strict";
|
|
715
|
-
//mol/type/partial/deep/deep.ts
|
|
716
|
-
;
|
|
717
|
-
"use strict";
|
|
718
|
-
//mol/type/error/error.ts
|
|
621
|
+
//mol/log3/log3.node.ts
|
|
719
622
|
;
|
|
720
623
|
"use strict";
|
|
721
|
-
|
|
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 = () => () => { };
|
|
633
|
+
});
|
|
634
|
+
})($ || ($ = {}));
|
|
635
|
+
//mol/log3/log3.test.ts
|
|
722
636
|
;
|
|
723
637
|
"use strict";
|
|
724
|
-
|
|
638
|
+
var $;
|
|
639
|
+
(function ($) {
|
|
640
|
+
function $mol_env() {
|
|
641
|
+
return {};
|
|
642
|
+
}
|
|
643
|
+
$.$mol_env = $mol_env;
|
|
644
|
+
})($ || ($ = {}));
|
|
645
|
+
//mol/env/env.ts
|
|
725
646
|
;
|
|
726
647
|
"use strict";
|
|
727
|
-
|
|
648
|
+
var $;
|
|
649
|
+
(function ($) {
|
|
650
|
+
$.$mol_env = function $mol_env() {
|
|
651
|
+
return this.process.env;
|
|
652
|
+
};
|
|
653
|
+
})($ || ($ = {}));
|
|
654
|
+
//mol/env/env.node.ts
|
|
728
655
|
;
|
|
729
656
|
"use strict";
|
|
730
657
|
var $;
|
|
@@ -794,15 +721,15 @@ var $;
|
|
|
794
721
|
//mol/owning/owning.ts
|
|
795
722
|
;
|
|
796
723
|
"use strict";
|
|
797
|
-
//mol/type/writable/writable.ts
|
|
798
|
-
;
|
|
799
|
-
"use strict";
|
|
800
724
|
//mol/type/equals/equals.ts
|
|
801
725
|
;
|
|
802
726
|
"use strict";
|
|
803
727
|
//mol/type/equals/equals.test.ts
|
|
804
728
|
;
|
|
805
729
|
"use strict";
|
|
730
|
+
//mol/type/writable/writable.ts
|
|
731
|
+
;
|
|
732
|
+
"use strict";
|
|
806
733
|
//mol/type/writable/writable.test.ts
|
|
807
734
|
;
|
|
808
735
|
"use strict";
|
|
@@ -850,6 +777,106 @@ var $;
|
|
|
850
777
|
;
|
|
851
778
|
"use strict";
|
|
852
779
|
var $;
|
|
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 ($) {
|
|
818
|
+
$mol_test({
|
|
819
|
+
'get'() {
|
|
820
|
+
const proxy = $mol_delegate({}, () => ({ foo: 777 }));
|
|
821
|
+
$mol_assert_equal(proxy.foo, 777);
|
|
822
|
+
},
|
|
823
|
+
'has'() {
|
|
824
|
+
const proxy = $mol_delegate({}, () => ({ foo: 777 }));
|
|
825
|
+
$mol_assert_equal('foo' in proxy, true);
|
|
826
|
+
},
|
|
827
|
+
'set'() {
|
|
828
|
+
const target = { foo: 777 };
|
|
829
|
+
const proxy = $mol_delegate({}, () => target);
|
|
830
|
+
proxy.foo = 123;
|
|
831
|
+
$mol_assert_equal(target.foo, 123);
|
|
832
|
+
},
|
|
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,
|
|
840
|
+
});
|
|
841
|
+
},
|
|
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 {
|
|
848
|
+
}
|
|
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);
|
|
873
|
+
},
|
|
874
|
+
});
|
|
875
|
+
})($ || ($ = {}));
|
|
876
|
+
//mol/delegate/delegate.test.ts
|
|
877
|
+
;
|
|
878
|
+
"use strict";
|
|
879
|
+
var $;
|
|
853
880
|
(function ($) {
|
|
854
881
|
$.$mol_tree_convert = Symbol('$mol_tree_convert');
|
|
855
882
|
class $mol_tree extends $mol_object2 {
|
|
@@ -1164,119 +1191,19 @@ var $;
|
|
|
1164
1191
|
hack(context) {
|
|
1165
1192
|
const sub = [].concat(...this.sub.map(child => {
|
|
1166
1193
|
const handle = context[child.type] || context[''];
|
|
1167
|
-
if (!handle)
|
|
1168
|
-
$mol_fail(child.error('Handler not defined'));
|
|
1169
|
-
return handle(child, context);
|
|
1170
|
-
}));
|
|
1171
|
-
return this.clone({ sub });
|
|
1172
|
-
}
|
|
1173
|
-
error(message) {
|
|
1174
|
-
return new Error(`${message}:\n${this} ${this.baseUri}:${this.row}:${this.col}`);
|
|
1175
|
-
}
|
|
1176
|
-
}
|
|
1177
|
-
$.$mol_tree = $mol_tree;
|
|
1178
|
-
})($ || ($ = {}));
|
|
1179
|
-
//mol/tree/tree.ts
|
|
1180
|
-
;
|
|
1181
|
-
"use strict";
|
|
1182
|
-
var $;
|
|
1183
|
-
(function ($) {
|
|
1184
|
-
const instances = new WeakSet();
|
|
1185
|
-
function $mol_delegate(proto, target) {
|
|
1186
|
-
const proxy = new Proxy(proto, {
|
|
1187
|
-
get: (_, field) => {
|
|
1188
|
-
const obj = target();
|
|
1189
|
-
let val = Reflect.get(obj, field);
|
|
1190
|
-
if (typeof val === 'function') {
|
|
1191
|
-
val = val.bind(obj);
|
|
1192
|
-
}
|
|
1193
|
-
return val;
|
|
1194
|
-
},
|
|
1195
|
-
has: (_, field) => Reflect.has(target(), field),
|
|
1196
|
-
set: (_, field, value) => Reflect.set(target(), field, value),
|
|
1197
|
-
getOwnPropertyDescriptor: (_, field) => Reflect.getOwnPropertyDescriptor(target(), field),
|
|
1198
|
-
ownKeys: () => Reflect.ownKeys(target()),
|
|
1199
|
-
getPrototypeOf: () => Reflect.getPrototypeOf(target()),
|
|
1200
|
-
setPrototypeOf: (_, donor) => Reflect.setPrototypeOf(target(), donor),
|
|
1201
|
-
isExtensible: () => Reflect.isExtensible(target()),
|
|
1202
|
-
preventExtensions: () => Reflect.preventExtensions(target()),
|
|
1203
|
-
apply: (_, self, args) => Reflect.apply(target(), self, args),
|
|
1204
|
-
construct: (_, args, retarget) => Reflect.construct(target(), args, retarget),
|
|
1205
|
-
defineProperty: (_, field, descr) => Reflect.defineProperty(target(), field, descr),
|
|
1206
|
-
deleteProperty: (_, field) => Reflect.deleteProperty(target(), field),
|
|
1207
|
-
});
|
|
1208
|
-
instances.add(proxy);
|
|
1209
|
-
return proxy;
|
|
1210
|
-
}
|
|
1211
|
-
$.$mol_delegate = $mol_delegate;
|
|
1212
|
-
Reflect.defineProperty($mol_delegate, Symbol.hasInstance, {
|
|
1213
|
-
value: (obj) => instances.has(obj),
|
|
1214
|
-
});
|
|
1215
|
-
})($ || ($ = {}));
|
|
1216
|
-
//mol/delegate/delegate.ts
|
|
1217
|
-
;
|
|
1218
|
-
"use strict";
|
|
1219
|
-
var $;
|
|
1220
|
-
(function ($) {
|
|
1221
|
-
$mol_test({
|
|
1222
|
-
'get'() {
|
|
1223
|
-
const proxy = $mol_delegate({}, () => ({ foo: 777 }));
|
|
1224
|
-
$mol_assert_equal(proxy.foo, 777);
|
|
1225
|
-
},
|
|
1226
|
-
'has'() {
|
|
1227
|
-
const proxy = $mol_delegate({}, () => ({ foo: 777 }));
|
|
1228
|
-
$mol_assert_equal('foo' in proxy, true);
|
|
1229
|
-
},
|
|
1230
|
-
'set'() {
|
|
1231
|
-
const target = { foo: 777 };
|
|
1232
|
-
const proxy = $mol_delegate({}, () => target);
|
|
1233
|
-
proxy.foo = 123;
|
|
1234
|
-
$mol_assert_equal(target.foo, 123);
|
|
1235
|
-
},
|
|
1236
|
-
'getOwnPropertyDescriptor'() {
|
|
1237
|
-
const proxy = $mol_delegate({}, () => ({ foo: 777 }));
|
|
1238
|
-
$mol_assert_like(Object.getOwnPropertyDescriptor(proxy, 'foo'), {
|
|
1239
|
-
value: 777,
|
|
1240
|
-
writable: true,
|
|
1241
|
-
enumerable: true,
|
|
1242
|
-
configurable: true,
|
|
1243
|
-
});
|
|
1244
|
-
},
|
|
1245
|
-
'ownKeys'() {
|
|
1246
|
-
const proxy = $mol_delegate({}, () => ({ foo: 777, [Symbol.toStringTag]: 'bar' }));
|
|
1247
|
-
$mol_assert_like(Reflect.ownKeys(proxy), ['foo', Symbol.toStringTag]);
|
|
1248
|
-
},
|
|
1249
|
-
'getPrototypeOf'() {
|
|
1250
|
-
class Foo {
|
|
1251
|
-
}
|
|
1252
|
-
const proxy = $mol_delegate({}, () => new Foo);
|
|
1253
|
-
$mol_assert_equal(Object.getPrototypeOf(proxy), Foo.prototype);
|
|
1254
|
-
},
|
|
1255
|
-
'setPrototypeOf'() {
|
|
1256
|
-
class Foo {
|
|
1257
|
-
}
|
|
1258
|
-
const target = {};
|
|
1259
|
-
const proxy = $mol_delegate({}, () => target);
|
|
1260
|
-
Object.setPrototypeOf(proxy, Foo.prototype);
|
|
1261
|
-
$mol_assert_equal(Object.getPrototypeOf(target), Foo.prototype);
|
|
1262
|
-
},
|
|
1263
|
-
'instanceof'() {
|
|
1264
|
-
class Foo {
|
|
1265
|
-
}
|
|
1266
|
-
const proxy = $mol_delegate({}, () => new Foo);
|
|
1267
|
-
$mol_assert_ok(proxy instanceof Foo);
|
|
1268
|
-
$mol_assert_ok(proxy instanceof $mol_delegate);
|
|
1269
|
-
},
|
|
1270
|
-
'autobind'() {
|
|
1271
|
-
class Foo {
|
|
1272
|
-
}
|
|
1273
|
-
const proxy = $mol_delegate({}, () => new Foo);
|
|
1274
|
-
$mol_assert_ok(proxy instanceof Foo);
|
|
1275
|
-
$mol_assert_ok(proxy instanceof $mol_delegate);
|
|
1276
|
-
},
|
|
1277
|
-
});
|
|
1194
|
+
if (!handle)
|
|
1195
|
+
$mol_fail(child.error('Handler not defined'));
|
|
1196
|
+
return handle(child, context);
|
|
1197
|
+
}));
|
|
1198
|
+
return this.clone({ sub });
|
|
1199
|
+
}
|
|
1200
|
+
error(message) {
|
|
1201
|
+
return new Error(`${message}:\n${this} ${this.baseUri}:${this.row}:${this.col}`);
|
|
1202
|
+
}
|
|
1203
|
+
}
|
|
1204
|
+
$.$mol_tree = $mol_tree;
|
|
1278
1205
|
})($ || ($ = {}));
|
|
1279
|
-
//mol/
|
|
1206
|
+
//mol/tree/tree.ts
|
|
1280
1207
|
;
|
|
1281
1208
|
"use strict";
|
|
1282
1209
|
var $;
|
|
@@ -1341,92 +1268,29 @@ var $;
|
|
|
1341
1268
|
"use strict";
|
|
1342
1269
|
var $;
|
|
1343
1270
|
(function ($) {
|
|
1344
|
-
$
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
$
|
|
1352
|
-
}
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
$
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
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>');
|
|
1375
|
-
},
|
|
1376
|
-
'Function as component'() {
|
|
1377
|
-
const Button = (props, target) => {
|
|
1378
|
-
return $mol_jsx("button", { title: props.hint }, target());
|
|
1379
|
-
};
|
|
1380
|
-
const dom = $mol_jsx(Button, { id: "foo", hint: "click me" }, () => 'hey!');
|
|
1381
|
-
$mol_assert_equal(dom.outerHTML, '<button id="foo" title="click me" class="Button">hey!</button>');
|
|
1382
|
-
},
|
|
1383
|
-
'Nested guid generation'() {
|
|
1384
|
-
const Foo = () => {
|
|
1385
|
-
return $mol_jsx("div", null,
|
|
1386
|
-
$mol_jsx(Bar, { id: "bar" },
|
|
1387
|
-
$mol_jsx("img", { id: "icon" })));
|
|
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>');
|
|
1396
|
-
},
|
|
1397
|
-
'Fail on non unique ids'() {
|
|
1398
|
-
const App = () => {
|
|
1399
|
-
return $mol_jsx("div", null,
|
|
1400
|
-
$mol_jsx("span", { id: "bar" }),
|
|
1401
|
-
$mol_jsx("span", { id: "bar" }));
|
|
1402
|
-
};
|
|
1403
|
-
$mol_assert_fail(() => $mol_jsx(App, { id: "foo" }), 'JSX already has tag with id "foo/bar"');
|
|
1404
|
-
},
|
|
1405
|
-
'Owner based guid generationn'() {
|
|
1406
|
-
const Foo = () => {
|
|
1407
|
-
return $mol_jsx("div", null,
|
|
1408
|
-
$mol_jsx(Bar, { id: "middle", icon: () => $mol_jsx("img", { id: "icon" }) }));
|
|
1409
|
-
};
|
|
1410
|
-
const Bar = (props) => {
|
|
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>');
|
|
1415
|
-
},
|
|
1416
|
-
'Fail on same ids from different caller'() {
|
|
1417
|
-
const Foo = () => {
|
|
1418
|
-
return $mol_jsx("div", null,
|
|
1419
|
-
$mol_jsx("img", { id: "icon" }),
|
|
1420
|
-
$mol_jsx(Bar, { id: "bar", icon: () => $mol_jsx("img", { id: "icon" }) }));
|
|
1421
|
-
};
|
|
1422
|
-
const Bar = (props) => {
|
|
1423
|
-
return $mol_jsx("span", null, props.icon());
|
|
1424
|
-
};
|
|
1425
|
-
$mol_assert_fail(() => $mol_jsx(Foo, { id: "foo" }), 'JSX already has tag with id "foo/icon"');
|
|
1426
|
-
},
|
|
1427
|
-
});
|
|
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;
|
|
1428
1292
|
})($ || ($ = {}));
|
|
1429
|
-
//mol/
|
|
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'() {
|