mol_db 0.0.582 → 0.0.584

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.js CHANGED
@@ -275,248 +275,167 @@ var $;
275
275
  "use strict";
276
276
  var $;
277
277
  (function ($) {
278
- $.$mol_tree_convert = Symbol('$mol_tree_convert');
279
- class $mol_tree extends $mol_object2 {
280
- type;
281
- data;
282
- sub;
283
- baseUri;
278
+ class $mol_span extends $mol_object2 {
279
+ uri;
280
+ source;
284
281
  row;
285
282
  col;
286
283
  length;
287
- constructor(config = {}) {
284
+ constructor(uri, source, row, col, length) {
288
285
  super();
289
- this.type = config.type || '';
290
- if (config.value !== undefined) {
291
- var sub = $mol_tree.values(config.value);
292
- if (config.type || sub.length > 1) {
293
- this.sub = [...sub, ...(config.sub || [])];
294
- this.data = config.data || '';
295
- }
296
- else {
297
- this.data = sub[0].data;
298
- this.sub = config.sub || [];
299
- }
300
- }
301
- else {
302
- this.data = config.data || '';
303
- this.sub = config.sub || [];
304
- }
305
- this.baseUri = config.baseUri || '';
306
- this.row = config.row || 0;
307
- this.col = config.col || 0;
308
- this.length = config.length || 0;
309
- }
310
- static values(str, baseUri) {
311
- return str.split('\n').map((data, index) => new $mol_tree({
312
- data: data,
313
- baseUri: baseUri,
314
- row: index + 1,
315
- length: data.length,
316
- }));
286
+ this.uri = uri;
287
+ this.source = source;
288
+ this.row = row;
289
+ this.col = col;
290
+ this.length = length;
291
+ this[Symbol.toStringTag] = `${this.uri}#${this.row}:${this.col}/${this.length}`;
317
292
  }
318
- clone(config = {}) {
319
- return new $mol_tree({
320
- type: ('type' in config) ? config.type : this.type,
321
- data: ('data' in config) ? config.data : this.data,
322
- sub: ('sub' in config) ? config.sub : this.sub,
323
- baseUri: ('baseUri' in config) ? config.baseUri : this.baseUri,
324
- row: ('row' in config) ? config.row : this.row,
325
- col: ('col' in config) ? config.col : this.col,
326
- length: ('length' in config) ? config.length : this.length,
327
- value: config.value
328
- });
293
+ static unknown = $mol_span.begin('?');
294
+ static begin(uri, source = '') {
295
+ return new $mol_span(uri, source, 1, 1, 0);
296
+ }
297
+ static end(uri, source) {
298
+ return new $mol_span(uri, source, 1, source.length + 1, length);
299
+ }
300
+ static entire(uri, source) {
301
+ return new $mol_span(uri, source, 1, 1, source.length);
302
+ }
303
+ toString() {
304
+ return this[Symbol.toStringTag];
329
305
  }
330
- make(config) {
331
- return new $mol_tree({
332
- baseUri: this.baseUri,
306
+ toJSON() {
307
+ return {
308
+ uri: this.uri,
333
309
  row: this.row,
334
310
  col: this.col,
335
- length: this.length,
336
- ...config,
337
- });
338
- }
339
- make_data(value, sub) {
340
- return this.make({ value, sub });
341
- }
342
- make_struct(type, sub) {
343
- return this.make({ type, sub });
344
- }
345
- static fromString(str, baseUri) {
346
- var root = new $mol_tree({ baseUri: baseUri });
347
- var stack = [root];
348
- var row = 0;
349
- var prefix = str.replace(/^\n?(\t*)[\s\S]*/, '$1');
350
- var lines = str.replace(new RegExp('^\\t{0,' + prefix.length + '}', 'mg'), '').split('\n');
351
- lines.forEach(line => {
352
- ++row;
353
- var chunks = /^(\t*)((?:[^\n\t\\ ]+ *)*)(\\[^\n]*)?(.*?)(?:$|\n)/m.exec(line);
354
- if (!chunks || chunks[4])
355
- return this.$.$mol_fail(new Error(`Syntax error at ${baseUri}:${row}\n${line}`));
356
- var indent = chunks[1];
357
- var path = chunks[2];
358
- var data = chunks[3];
359
- var deep = indent.length;
360
- var types = path ? path.replace(/ $/, '').split(/ +/) : [];
361
- if (stack.length <= deep)
362
- return this.$.$mol_fail(new Error(`Too many tabs at ${baseUri}:${row}\n${line}`));
363
- stack.length = deep + 1;
364
- var parent = stack[deep];
365
- let col = deep;
366
- types.forEach(type => {
367
- if (!type)
368
- return this.$.$mol_fail(new Error(`Unexpected space symbol ${baseUri}:${row}\n${line}`));
369
- var next = new $mol_tree({ type, baseUri, row, col, length: type.length });
370
- const parent_sub = parent.sub;
371
- parent_sub.push(next);
372
- parent = next;
373
- col += type.length + 1;
374
- });
375
- if (data) {
376
- var next = new $mol_tree({ data: data.substring(1), baseUri, row, col, length: data.length });
377
- const parent_sub = parent.sub;
378
- parent_sub.push(next);
379
- parent = next;
380
- }
381
- stack.push(parent);
382
- });
383
- return root;
384
- }
385
- static fromJSON(json, baseUri = '') {
386
- switch (true) {
387
- case typeof json === 'boolean':
388
- case typeof json === 'number':
389
- case json === null:
390
- return new $mol_tree({
391
- type: String(json),
392
- baseUri: baseUri
393
- });
394
- case typeof json === 'string':
395
- return new $mol_tree({
396
- value: json,
397
- baseUri: baseUri
398
- });
399
- case Array.isArray(json):
400
- return new $mol_tree({
401
- type: "/",
402
- sub: json.map(json => $mol_tree.fromJSON(json, baseUri))
403
- });
404
- case json instanceof Date:
405
- return new $mol_tree({
406
- value: json.toISOString(),
407
- baseUri: baseUri
408
- });
409
- default:
410
- if (typeof json[$.$mol_tree_convert] === 'function') {
411
- return json[$.$mol_tree_convert]();
412
- }
413
- if (typeof json.toJSON === 'function') {
414
- return $mol_tree.fromJSON(json.toJSON());
415
- }
416
- if (json instanceof Error) {
417
- const { name, message, stack } = json;
418
- json = { ...json, name, message, stack };
419
- }
420
- var sub = [];
421
- for (var key in json) {
422
- if (json[key] === undefined)
423
- continue;
424
- const subsub = $mol_tree.fromJSON(json[key], baseUri);
425
- if (/^[^\n\t\\ ]+$/.test(key)) {
426
- var child = new $mol_tree({
427
- type: key,
428
- baseUri: baseUri,
429
- sub: [subsub],
430
- });
431
- }
432
- else {
433
- var child = new $mol_tree({
434
- value: key,
435
- baseUri: baseUri,
436
- sub: [subsub],
437
- });
438
- }
439
- sub.push(child);
440
- }
441
- return new $mol_tree({
442
- type: "*",
443
- sub: sub,
444
- baseUri: baseUri
445
- });
446
- }
311
+ length: this.length
312
+ };
447
313
  }
448
- get uri() {
449
- return this.baseUri + '#' + this.row + ':' + this.col;
314
+ error(message, Class = Error) {
315
+ return new Class(`${message}${this}`);
316
+ }
317
+ span(row, col, length) {
318
+ return new $mol_span(this.uri, this.source, row, col, length);
319
+ }
320
+ after(length = 0) {
321
+ return new $mol_span(this.uri, this.source, this.row, this.col + this.length, length);
322
+ }
323
+ slice(begin, end = -1) {
324
+ let len = this.length;
325
+ if (begin < 0)
326
+ begin += len;
327
+ if (end < 0)
328
+ end += len;
329
+ if (begin < 0 || begin > len)
330
+ this.$.$mol_fail(`Begin value '${begin}' out of range ${this}`);
331
+ if (end < 0 || end > len)
332
+ this.$.$mol_fail(`End value '${end}' out of range ${this}`);
333
+ if (end < begin)
334
+ this.$.$mol_fail(`End value '${end}' can't be less than begin value ${this}`);
335
+ return this.span(this.row, this.col + begin, end - begin);
450
336
  }
451
- toString(prefix = '') {
452
- var output = '';
453
- if (this.type.length) {
337
+ }
338
+ $.$mol_span = $mol_span;
339
+ })($ || ($ = {}));
340
+ //mol/span/span.ts
341
+ ;
342
+ "use strict";
343
+ var $;
344
+ (function ($) {
345
+ function $mol_tree2_to_string(tree) {
346
+ let output = [];
347
+ function dump(tree, prefix = '') {
348
+ if (tree.type.length) {
454
349
  if (!prefix.length) {
455
350
  prefix = "\t";
456
351
  }
457
- output += this.type;
458
- if (this.sub.length == 1) {
459
- return output + ' ' + this.sub[0].toString(prefix);
352
+ output.push(tree.type);
353
+ if (tree.kids.length == 1) {
354
+ output.push(' ');
355
+ dump(tree.kids[0], prefix);
356
+ return;
460
357
  }
461
- output += "\n";
358
+ output.push("\n");
462
359
  }
463
- else if (this.data.length || prefix.length) {
464
- output += "\\" + this.data + "\n";
360
+ else if (tree.value.length || prefix.length) {
361
+ output.push("\\" + tree.value + "\n");
465
362
  }
466
- for (var child of this.sub) {
467
- output += prefix;
468
- output += child.toString(prefix + "\t");
363
+ for (const kid of tree.kids) {
364
+ output.push(prefix);
365
+ dump(kid, prefix + "\t");
469
366
  }
470
- return output;
471
367
  }
472
- toJSON() {
473
- if (!this.type)
474
- return this.value;
475
- if (this.type === 'true')
476
- return true;
477
- if (this.type === 'false')
478
- return false;
479
- if (this.type === 'null')
480
- return null;
481
- if (this.type === '*') {
482
- var obj = {};
483
- for (var child of this.sub) {
484
- if (child.type === '-')
485
- continue;
486
- var key = child.type || child.clone({ sub: child.sub.slice(0, child.sub.length - 1) }).value;
487
- var val = child.sub[child.sub.length - 1].toJSON();
488
- if (val !== undefined)
489
- obj[key] = val;
490
- }
491
- return obj;
492
- }
493
- if (this.type === '/') {
494
- var res = [];
495
- this.sub.forEach(child => {
496
- if (child.type === '-')
497
- return;
498
- var val = child.toJSON();
499
- if (val !== undefined)
500
- res.push(val);
368
+ dump(tree);
369
+ return output.join('');
370
+ }
371
+ $.$mol_tree2_to_string = $mol_tree2_to_string;
372
+ })($ || ($ = {}));
373
+ //mol/tree2/to/string/string.ts
374
+ ;
375
+ "use strict";
376
+ var $;
377
+ (function ($) {
378
+ class $mol_tree2 extends Object {
379
+ type;
380
+ value;
381
+ kids;
382
+ span;
383
+ constructor(type, value, kids, span) {
384
+ super();
385
+ this.type = type;
386
+ this.value = value;
387
+ this.kids = kids;
388
+ this.span = span;
389
+ this[Symbol.toStringTag] = type || '\\' + value;
390
+ }
391
+ static list(kids, span = $mol_span.unknown) {
392
+ return new $mol_tree2('', '', kids, span);
393
+ }
394
+ list(kids) {
395
+ return $mol_tree2.list(kids, this.span);
396
+ }
397
+ static data(value, kids = [], span = $mol_span.unknown) {
398
+ const chunks = value.split('\n');
399
+ if (chunks.length > 1) {
400
+ let kid_span = span.span(span.row, span.col, 0);
401
+ const data = chunks.map(chunk => {
402
+ kid_span = kid_span.after(chunk.length);
403
+ return new $mol_tree2('', chunk, [], kid_span);
501
404
  });
502
- return res;
405
+ kids = [...data, ...kids];
406
+ value = '';
503
407
  }
504
- if (this.type === 'time') {
505
- return new Date(this.value);
408
+ return new $mol_tree2('', value, kids, span);
409
+ }
410
+ data(value, kids = []) {
411
+ return $mol_tree2.data(value, kids, this.span);
412
+ }
413
+ static struct(type, kids = [], span = $mol_span.unknown) {
414
+ if (/[ \n\t\\]/.test(type)) {
415
+ $$.$mol_fail(span.error(`Wrong type ${JSON.stringify(type)}`));
506
416
  }
507
- const numb = Number(this.type);
508
- if (!Number.isNaN(numb) || this.type === 'NaN')
509
- return numb;
510
- throw new Error(`Unknown type (${this.type}) at ${this.uri}`);
417
+ return new $mol_tree2(type, '', kids, span);
418
+ }
419
+ struct(type, kids = []) {
420
+ return $mol_tree2.struct(type, kids, this.span);
511
421
  }
512
- get value() {
422
+ clone(kids, span = this.span) {
423
+ return new $mol_tree2(this.type, this.value, kids, span);
424
+ }
425
+ text() {
513
426
  var values = [];
514
- for (var child of this.sub) {
515
- if (child.type)
427
+ for (var kid of this.kids) {
428
+ if (kid.type)
516
429
  continue;
517
- values.push(child.value);
430
+ values.push(kid.value);
518
431
  }
519
- return this.data + values.join("\n");
432
+ return this.value + values.join('\n');
433
+ }
434
+ static fromString(str, uri = 'unknown') {
435
+ return $$.$mol_tree2_from_string(str, uri);
436
+ }
437
+ toString() {
438
+ return $$.$mol_tree2_to_string(this);
520
439
  }
521
440
  insert(value, ...path) {
522
441
  if (path.length === 0)
@@ -524,83 +443,252 @@ var $;
524
443
  const type = path[0];
525
444
  if (typeof type === 'string') {
526
445
  let replaced = false;
527
- const sub = this.sub.map((item, index) => {
446
+ const sub = this.kids.map((item, index) => {
528
447
  if (item.type !== type)
529
448
  return item;
530
449
  replaced = true;
531
450
  return item.insert(value, ...path.slice(1));
532
- });
533
- if (!replaced)
534
- sub.push(new $mol_tree({ type }).insert(value, ...path.slice(1)));
535
- return this.clone({ sub });
451
+ }).filter(Boolean);
452
+ if (!replaced && value) {
453
+ sub.push(this.struct(type, []).insert(value, ...path.slice(1)));
454
+ }
455
+ return this.clone(sub);
536
456
  }
537
457
  else if (typeof type === 'number') {
538
- const sub = this.sub.slice();
539
- sub[type] = (sub[type] || new $mol_tree).insert(value, ...path.slice(1));
540
- return this.clone({ sub });
458
+ const sub = this.kids.slice();
459
+ sub[type] = (sub[type] || this.list([]))
460
+ .insert(value, ...path.slice(1));
461
+ return this.clone(sub.filter(Boolean));
541
462
  }
542
463
  else {
543
- return this.clone({ sub: ((this.sub.length === 0) ? [new $mol_tree()] : this.sub).map(item => item.insert(value, ...path.slice(1))) });
464
+ const kids = ((this.kids.length === 0) ? [this.list([])] : this.kids)
465
+ .map(item => item.insert(value, ...path.slice(1)))
466
+ .filter(Boolean);
467
+ return this.clone(kids);
544
468
  }
545
469
  }
546
470
  select(...path) {
547
- var next = [this];
548
- for (var type of path) {
471
+ let next = [this];
472
+ for (const type of path) {
549
473
  if (!next.length)
550
474
  break;
551
- var prev = next;
475
+ const prev = next;
552
476
  next = [];
553
477
  for (var item of prev) {
554
478
  switch (typeof (type)) {
555
479
  case 'string':
556
- for (var child of item.sub) {
557
- if (!type || (child.type == type)) {
480
+ for (var child of item.kids) {
481
+ if (child.type == type) {
558
482
  next.push(child);
559
483
  }
560
484
  }
561
485
  break;
562
486
  case 'number':
563
- if (type < item.sub.length)
564
- next.push(item.sub[type]);
487
+ if (type < item.kids.length)
488
+ next.push(item.kids[type]);
565
489
  break;
566
- default: next.push(...item.sub);
490
+ default: next.push(...item.kids);
567
491
  }
568
492
  }
569
493
  }
570
- return new $mol_tree({ sub: next });
494
+ return this.list(next);
571
495
  }
572
496
  filter(path, value) {
573
- var sub = this.sub.filter(function (item) {
497
+ const sub = this.kids.filter(item => {
574
498
  var found = item.select(...path);
575
- if (value == null) {
576
- return Boolean(found.sub.length);
499
+ if (value === undefined) {
500
+ return Boolean(found.kids.length);
577
501
  }
578
502
  else {
579
- return found.sub.some(child => child.value == value);
503
+ return found.kids.some(child => child.value == value);
580
504
  }
581
505
  });
582
- return new $mol_tree({ sub: sub });
583
- }
584
- transform(visit, stack = []) {
585
- const sub_stack = [this, ...stack];
586
- return visit(sub_stack, () => this.sub.map(node => node.transform(visit, sub_stack)).filter(n => n));
587
- }
588
- hack(context) {
589
- const sub = [].concat(...this.sub.map(child => {
590
- const handle = context[child.type] || context[''];
591
- if (!handle)
592
- $mol_fail(child.error('Handler not defined'));
593
- return handle(child, context);
506
+ return this.clone(sub);
507
+ }
508
+ hack(belt, context = {}) {
509
+ return [].concat(...this.kids.map(child => {
510
+ let handle = belt[child.type] || belt[''];
511
+ if (!handle || handle === Object.prototype[child.type]) {
512
+ handle = (input, belt, context) => [
513
+ input.clone(input.hack(belt, context), context.span)
514
+ ];
515
+ }
516
+ try {
517
+ return handle(child, belt, context);
518
+ }
519
+ catch (error) {
520
+ error.message += `\n${child.clone([])}${child.span}`;
521
+ $mol_fail_hidden(error);
522
+ }
594
523
  }));
595
- return this.clone({ sub });
596
524
  }
597
- error(message) {
598
- return new Error(`${message}:\n${this} ${this.baseUri}:${this.row}:${this.col}`);
525
+ error(message, Class = Error) {
526
+ return this.span.error(`${message}\n${this.clone([])}`, Class);
527
+ }
528
+ }
529
+ $.$mol_tree2 = $mol_tree2;
530
+ class $mol_tree2_empty extends $mol_tree2 {
531
+ constructor() {
532
+ super('', '', [], $mol_span.unknown);
533
+ }
534
+ }
535
+ $.$mol_tree2_empty = $mol_tree2_empty;
536
+ })($ || ($ = {}));
537
+ //mol/tree2/tree2.ts
538
+ ;
539
+ "use strict";
540
+ var $;
541
+ (function ($) {
542
+ class $mol_error_syntax extends SyntaxError {
543
+ reason;
544
+ line;
545
+ span;
546
+ constructor(reason, line, span) {
547
+ super(`${reason}\n${span}\n${line.substring(0, span.col - 1).replace(/\S/g, ' ')}${''.padEnd(span.length, '!')}\n${line}`);
548
+ this.reason = reason;
549
+ this.line = line;
550
+ this.span = span;
551
+ }
552
+ }
553
+ $.$mol_error_syntax = $mol_error_syntax;
554
+ })($ || ($ = {}));
555
+ //mol/error/syntax/syntax.ts
556
+ ;
557
+ "use strict";
558
+ var $;
559
+ (function ($) {
560
+ function $mol_tree2_from_string(str, uri = '?') {
561
+ const span = $mol_span.entire(uri, str);
562
+ var root = $mol_tree2.list([], span);
563
+ var stack = [root];
564
+ var pos = 0, row = 0, min_indent = 0;
565
+ while (str.length > pos) {
566
+ var indent = 0;
567
+ var line_start = pos;
568
+ row++;
569
+ while (str.length > pos && str[pos] == '\t') {
570
+ indent++;
571
+ pos++;
572
+ }
573
+ if (!root.kids.length) {
574
+ min_indent = indent;
575
+ }
576
+ indent -= min_indent;
577
+ if (indent < 0 || indent >= stack.length) {
578
+ const sp = span.span(row, 1, pos - line_start);
579
+ while (str.length > pos && str[pos] != '\n') {
580
+ pos++;
581
+ }
582
+ if (indent < 0) {
583
+ if (str.length > pos) {
584
+ this.$mol_fail(new this.$mol_error_syntax(`Too few tabs`, str.substring(line_start, pos), sp));
585
+ }
586
+ }
587
+ else {
588
+ this.$mol_fail(new this.$mol_error_syntax(`Too many tabs`, str.substring(line_start, pos), sp));
589
+ }
590
+ }
591
+ stack.length = indent + 1;
592
+ var parent = stack[indent];
593
+ while (str.length > pos && str[pos] != '\\' && str[pos] != '\n') {
594
+ var error_start = pos;
595
+ while (str.length > pos && (str[pos] == ' ' || str[pos] == '\t')) {
596
+ pos++;
597
+ }
598
+ if (pos > error_start) {
599
+ let line_end = str.indexOf('\n', pos);
600
+ if (line_end === -1)
601
+ line_end = str.length;
602
+ const sp = span.span(row, error_start - line_start, pos - error_start + 1);
603
+ this.$mol_fail(new this.$mol_error_syntax(`Wrong nodes separator`, str.substring(line_start, line_end), sp));
604
+ }
605
+ var type_start = pos;
606
+ while (str.length > pos &&
607
+ str[pos] != '\\' &&
608
+ str[pos] != ' ' &&
609
+ str[pos] != '\t' &&
610
+ str[pos] != '\n') {
611
+ pos++;
612
+ }
613
+ if (pos > type_start) {
614
+ let next = new $mol_tree2(str.slice(type_start, pos), '', [], span.span(row, type_start - line_start + 1, pos - type_start));
615
+ const parent_kids = parent.kids;
616
+ parent_kids.push(next);
617
+ parent = next;
618
+ }
619
+ if (str.length > pos && str[pos] == ' ') {
620
+ pos++;
621
+ }
622
+ }
623
+ if (str.length > pos && str[pos] == '\\') {
624
+ var data_start = pos;
625
+ while (str.length > pos && str[pos] != '\n') {
626
+ pos++;
627
+ }
628
+ let next = new $mol_tree2('', str.slice(data_start + 1, pos), [], span.span(row, data_start - line_start + 2, pos - data_start - 1));
629
+ const parent_kids = parent.kids;
630
+ parent_kids.push(next);
631
+ parent = next;
632
+ }
633
+ if (str.length === pos && stack.length > 0) {
634
+ const sp = span.span(row, pos - line_start + 1, 1);
635
+ this.$mol_fail(new this.$mol_error_syntax(`Undexpected EOF, LF required`, str.substring(line_start, str.length), sp));
636
+ }
637
+ stack.push(parent);
638
+ pos++;
639
+ }
640
+ return root;
641
+ }
642
+ $.$mol_tree2_from_string = $mol_tree2_from_string;
643
+ })($ || ($ = {}));
644
+ //mol/tree2/from/string/string.ts
645
+ ;
646
+ "use strict";
647
+ var $;
648
+ (function ($) {
649
+ function $mol_tree2_from_json(json, span = $mol_span.unknown) {
650
+ if (typeof json === 'boolean' || typeof json === 'number' || json === null) {
651
+ return new $mol_tree2(String(json), '', [], span);
652
+ }
653
+ if (typeof json === 'string') {
654
+ return $mol_tree2.data(json, [], span);
655
+ }
656
+ if (Array.isArray(json)) {
657
+ const sub = json.map(json => $mol_tree2_from_json(json, span));
658
+ return new $mol_tree2('/', '', sub, span);
659
+ }
660
+ if (ArrayBuffer.isView(json)) {
661
+ const buf = new Uint8Array(json.buffer, json.byteOffset, json.byteLength);
662
+ return $mol_tree2.data(String.fromCharCode(...buf), [], span);
663
+ }
664
+ if (json instanceof Date) {
665
+ return new $mol_tree2('', json.toISOString(), [], span);
666
+ }
667
+ if (typeof json.toJSON === 'function') {
668
+ return $mol_tree2_from_json(json.toJSON());
669
+ }
670
+ if (json instanceof Error) {
671
+ const { name, message, stack } = json;
672
+ json = { ...json, name, message, stack };
673
+ }
674
+ const sub = [];
675
+ for (var key in json) {
676
+ const val = json[key];
677
+ if (val === undefined)
678
+ continue;
679
+ const subsub = $mol_tree2_from_json(val, span);
680
+ if (/^[^\n\t\\ ]+$/.test(key)) {
681
+ sub.push(new $mol_tree2(key, '', [subsub], span));
682
+ }
683
+ else {
684
+ sub.push($mol_tree2.data(key, [subsub], span));
685
+ }
599
686
  }
687
+ return new $mol_tree2('*', '', sub, span);
600
688
  }
601
- $.$mol_tree = $mol_tree;
689
+ $.$mol_tree2_from_json = $mol_tree2_from_json;
602
690
  })($ || ($ = {}));
603
- //mol/tree/tree.ts
691
+ //mol/tree2/from/json/json.ts
604
692
  ;
605
693
  "use strict";
606
694
  var $;
@@ -655,7 +743,8 @@ var $;
655
743
  return function $mol_log3_logger(event) {
656
744
  if (!event.time)
657
745
  event = { time: new Date().toISOString(), ...event };
658
- const tree = this.$mol_tree.fromJSON(event).clone({ type });
746
+ let tree = this.$mol_tree2_from_json(event);
747
+ tree = tree.struct(type, tree.kids);
659
748
  let str = color(tree.toString());
660
749
  this.console[level](str);
661
750
  const self = this;