mol_tree2 1.0.604 → 1.0.606
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/node.d.ts +87 -5
- package/node.d.ts.map +1 -0
- package/node.deps.json +1 -1
- package/node.js +381 -53
- package/node.js.map +1 -1
- package/node.meta.tree +2 -0
- package/node.mjs +381 -53
- package/node.test.js +500 -113
- package/node.test.js.map +1 -1
- package/package.json +9 -1
- package/web.d.ts +87 -5
- package/web.d.ts.map +1 -0
- package/web.deps.json +1 -1
- package/web.js +381 -53
- package/web.js.map +1 -1
- package/web.meta.tree +2 -0
- package/web.mjs +381 -53
- package/web.test.js +113 -54
- package/web.test.js.map +1 -1
package/node.js
CHANGED
|
@@ -11,7 +11,7 @@ var $;
|
|
|
11
11
|
(function ($) {
|
|
12
12
|
})($ || ($ = {}));
|
|
13
13
|
module.exports = $;
|
|
14
|
-
|
|
14
|
+
|
|
15
15
|
;
|
|
16
16
|
|
|
17
17
|
$node[ "../mam.ts" ] = $node[ "../mam.ts" ] = module.exports }.call( {} , {} )
|
|
@@ -38,7 +38,7 @@ var $;
|
|
|
38
38
|
}
|
|
39
39
|
$.$mol_ambient = $mol_ambient;
|
|
40
40
|
})($ || ($ = {}));
|
|
41
|
-
|
|
41
|
+
|
|
42
42
|
;
|
|
43
43
|
"use strict";
|
|
44
44
|
var $;
|
|
@@ -75,7 +75,7 @@ var $;
|
|
|
75
75
|
value: (obj) => instances.has(obj),
|
|
76
76
|
});
|
|
77
77
|
})($ || ($ = {}));
|
|
78
|
-
|
|
78
|
+
|
|
79
79
|
;
|
|
80
80
|
"use strict";
|
|
81
81
|
var $;
|
|
@@ -131,7 +131,7 @@ var $;
|
|
|
131
131
|
}
|
|
132
132
|
$.$mol_owning_catch = $mol_owning_catch;
|
|
133
133
|
})($ || ($ = {}));
|
|
134
|
-
|
|
134
|
+
|
|
135
135
|
;
|
|
136
136
|
"use strict";
|
|
137
137
|
var $;
|
|
@@ -141,7 +141,7 @@ var $;
|
|
|
141
141
|
}
|
|
142
142
|
$.$mol_fail = $mol_fail;
|
|
143
143
|
})($ || ($ = {}));
|
|
144
|
-
|
|
144
|
+
|
|
145
145
|
;
|
|
146
146
|
"use strict";
|
|
147
147
|
var $;
|
|
@@ -151,10 +151,10 @@ var $;
|
|
|
151
151
|
}
|
|
152
152
|
$.$mol_fail_hidden = $mol_fail_hidden;
|
|
153
153
|
})($ || ($ = {}));
|
|
154
|
-
|
|
154
|
+
|
|
155
155
|
;
|
|
156
156
|
"use strict";
|
|
157
|
-
|
|
157
|
+
|
|
158
158
|
;
|
|
159
159
|
"use strict";
|
|
160
160
|
var $;
|
|
@@ -186,7 +186,7 @@ var $;
|
|
|
186
186
|
}
|
|
187
187
|
$.$mol_func_name_from = $mol_func_name_from;
|
|
188
188
|
})($ || ($ = {}));
|
|
189
|
-
|
|
189
|
+
|
|
190
190
|
;
|
|
191
191
|
"use strict";
|
|
192
192
|
var $;
|
|
@@ -229,7 +229,7 @@ var $;
|
|
|
229
229
|
}
|
|
230
230
|
$.$mol_object2 = $mol_object2;
|
|
231
231
|
})($ || ($ = {}));
|
|
232
|
-
|
|
232
|
+
|
|
233
233
|
;
|
|
234
234
|
"use strict";
|
|
235
235
|
var $;
|
|
@@ -296,7 +296,7 @@ var $;
|
|
|
296
296
|
}
|
|
297
297
|
$.$mol_span = $mol_span;
|
|
298
298
|
})($ || ($ = {}));
|
|
299
|
-
|
|
299
|
+
|
|
300
300
|
;
|
|
301
301
|
"use strict";
|
|
302
302
|
var $;
|
|
@@ -314,7 +314,7 @@ var $;
|
|
|
314
314
|
}
|
|
315
315
|
$.$mol_error_syntax = $mol_error_syntax;
|
|
316
316
|
})($ || ($ = {}));
|
|
317
|
-
|
|
317
|
+
|
|
318
318
|
;
|
|
319
319
|
"use strict";
|
|
320
320
|
var $;
|
|
@@ -403,7 +403,7 @@ var $;
|
|
|
403
403
|
}
|
|
404
404
|
$.$mol_tree2_from_string = $mol_tree2_from_string;
|
|
405
405
|
})($ || ($ = {}));
|
|
406
|
-
|
|
406
|
+
|
|
407
407
|
;
|
|
408
408
|
"use strict";
|
|
409
409
|
var $;
|
|
@@ -436,7 +436,7 @@ var $;
|
|
|
436
436
|
}
|
|
437
437
|
$.$mol_tree2_to_string = $mol_tree2_to_string;
|
|
438
438
|
})($ || ($ = {}));
|
|
439
|
-
|
|
439
|
+
|
|
440
440
|
;
|
|
441
441
|
"use strict";
|
|
442
442
|
var $;
|
|
@@ -571,22 +571,23 @@ var $;
|
|
|
571
571
|
});
|
|
572
572
|
return this.clone(sub);
|
|
573
573
|
}
|
|
574
|
+
hack_self(belt, context = {}) {
|
|
575
|
+
let handle = belt[this.type] || belt[''];
|
|
576
|
+
if (!handle || handle === Object.prototype[this.type]) {
|
|
577
|
+
handle = (input, belt, context) => [
|
|
578
|
+
input.clone(input.hack(belt, context), context.span)
|
|
579
|
+
];
|
|
580
|
+
}
|
|
581
|
+
try {
|
|
582
|
+
return handle(this, belt, context);
|
|
583
|
+
}
|
|
584
|
+
catch (error) {
|
|
585
|
+
error.message += `\n${this.clone([])}${this.span}`;
|
|
586
|
+
$mol_fail_hidden(error);
|
|
587
|
+
}
|
|
588
|
+
}
|
|
574
589
|
hack(belt, context = {}) {
|
|
575
|
-
return [].concat(...this.kids.map(child =>
|
|
576
|
-
let handle = belt[child.type] || belt[''];
|
|
577
|
-
if (!handle || handle === Object.prototype[child.type]) {
|
|
578
|
-
handle = (input, belt, context) => [
|
|
579
|
-
input.clone(input.hack(belt, context), context.span)
|
|
580
|
-
];
|
|
581
|
-
}
|
|
582
|
-
try {
|
|
583
|
-
return handle(child, belt, context);
|
|
584
|
-
}
|
|
585
|
-
catch (error) {
|
|
586
|
-
error.message += `\n${child.clone([])}${child.span}`;
|
|
587
|
-
$mol_fail_hidden(error);
|
|
588
|
-
}
|
|
589
|
-
}));
|
|
590
|
+
return [].concat(...this.kids.map(child => child.hack_self(belt, context)));
|
|
590
591
|
}
|
|
591
592
|
error(message, Class = Error) {
|
|
592
593
|
return this.span.error(`${message}\n${this.clone([])}`, Class);
|
|
@@ -600,7 +601,7 @@ var $;
|
|
|
600
601
|
}
|
|
601
602
|
$.$mol_tree2_empty = $mol_tree2_empty;
|
|
602
603
|
})($ || ($ = {}));
|
|
603
|
-
|
|
604
|
+
|
|
604
605
|
;
|
|
605
606
|
"use strict";
|
|
606
607
|
var $;
|
|
@@ -650,7 +651,278 @@ var $;
|
|
|
650
651
|
}
|
|
651
652
|
$.$mol_tree2_from_json = $mol_tree2_from_json;
|
|
652
653
|
})($ || ($ = {}));
|
|
653
|
-
|
|
654
|
+
|
|
655
|
+
;
|
|
656
|
+
"use strict";
|
|
657
|
+
var $;
|
|
658
|
+
(function ($) {
|
|
659
|
+
class $mol_view_tree2_error extends Error {
|
|
660
|
+
spans;
|
|
661
|
+
constructor(message, spans) {
|
|
662
|
+
super(message);
|
|
663
|
+
this.spans = spans;
|
|
664
|
+
}
|
|
665
|
+
toJSON() {
|
|
666
|
+
return {
|
|
667
|
+
message: this.message,
|
|
668
|
+
spans: this.spans
|
|
669
|
+
};
|
|
670
|
+
}
|
|
671
|
+
}
|
|
672
|
+
$.$mol_view_tree2_error = $mol_view_tree2_error;
|
|
673
|
+
class $mol_view_tree2_error_suggestions {
|
|
674
|
+
suggestions;
|
|
675
|
+
constructor(suggestions) {
|
|
676
|
+
this.suggestions = suggestions;
|
|
677
|
+
}
|
|
678
|
+
toString() {
|
|
679
|
+
return this.suggestions.map(suggestion => `\`${suggestion}\``).join(', ');
|
|
680
|
+
}
|
|
681
|
+
toJSON() {
|
|
682
|
+
return this.suggestions;
|
|
683
|
+
}
|
|
684
|
+
}
|
|
685
|
+
$.$mol_view_tree2_error_suggestions = $mol_view_tree2_error_suggestions;
|
|
686
|
+
function $mol_view_tree2_error_str(strings, ...parts) {
|
|
687
|
+
const spans = [];
|
|
688
|
+
for (const part of parts) {
|
|
689
|
+
if (part instanceof $mol_span)
|
|
690
|
+
spans.push(part);
|
|
691
|
+
if (Array.isArray(part) && part.length > 0 && part[0] instanceof $mol_span)
|
|
692
|
+
spans.push(...part);
|
|
693
|
+
}
|
|
694
|
+
return new $mol_view_tree2_error(join(strings, parts), spans);
|
|
695
|
+
}
|
|
696
|
+
$.$mol_view_tree2_error_str = $mol_view_tree2_error_str;
|
|
697
|
+
function join(strings, objects) {
|
|
698
|
+
let result = '';
|
|
699
|
+
let obj_pos = 0;
|
|
700
|
+
let obj_len = objects.length;
|
|
701
|
+
for (const str of strings) {
|
|
702
|
+
result += str;
|
|
703
|
+
if (obj_pos < obj_len) {
|
|
704
|
+
const obj = objects[obj_pos++];
|
|
705
|
+
if (Array.isArray(obj))
|
|
706
|
+
result += obj.map(item => `\`${item}\``).join(', ');
|
|
707
|
+
else
|
|
708
|
+
result += `\`${String(obj)}\``;
|
|
709
|
+
}
|
|
710
|
+
}
|
|
711
|
+
return result;
|
|
712
|
+
}
|
|
713
|
+
})($ || ($ = {}));
|
|
714
|
+
|
|
715
|
+
;
|
|
716
|
+
"use strict";
|
|
717
|
+
var $;
|
|
718
|
+
(function ($) {
|
|
719
|
+
function $mol_view_tree2_child(tree) {
|
|
720
|
+
if (tree.kids.length === 0) {
|
|
721
|
+
return this.$mol_fail($mol_view_tree2_error_str `Required one child at ${tree.span}`);
|
|
722
|
+
}
|
|
723
|
+
if (tree.kids.length > 1) {
|
|
724
|
+
return this.$mol_fail($mol_view_tree2_error_str `Should be only one child at ${tree.span}`);
|
|
725
|
+
}
|
|
726
|
+
return tree.kids[0];
|
|
727
|
+
}
|
|
728
|
+
$.$mol_view_tree2_child = $mol_view_tree2_child;
|
|
729
|
+
})($ || ($ = {}));
|
|
730
|
+
|
|
731
|
+
;
|
|
732
|
+
"use strict";
|
|
733
|
+
var $;
|
|
734
|
+
(function ($) {
|
|
735
|
+
function $mol_view_tree2_classes(defs) {
|
|
736
|
+
return defs.clone(defs.hack({
|
|
737
|
+
'-': () => []
|
|
738
|
+
}));
|
|
739
|
+
}
|
|
740
|
+
$.$mol_view_tree2_classes = $mol_view_tree2_classes;
|
|
741
|
+
})($ || ($ = {}));
|
|
742
|
+
|
|
743
|
+
;
|
|
744
|
+
"use strict";
|
|
745
|
+
var $;
|
|
746
|
+
(function ($) {
|
|
747
|
+
function $mol_view_tree2_normalize(defs) {
|
|
748
|
+
return defs.clone($mol_view_tree2_classes(defs).kids.map(cl => cl.clone([
|
|
749
|
+
this.$mol_view_tree2_class_super(cl).clone(this.$mol_view_tree2_class_props(cl))
|
|
750
|
+
])));
|
|
751
|
+
}
|
|
752
|
+
$.$mol_view_tree2_normalize = $mol_view_tree2_normalize;
|
|
753
|
+
})($ || ($ = {}));
|
|
754
|
+
|
|
755
|
+
;
|
|
756
|
+
"use strict";
|
|
757
|
+
var $;
|
|
758
|
+
(function ($) {
|
|
759
|
+
const class_regex = /^[$A-Z][$\w<>\[\]()"'?|]+$/;
|
|
760
|
+
function $mol_view_tree2_class_match(klass) {
|
|
761
|
+
if (!klass?.type)
|
|
762
|
+
return false;
|
|
763
|
+
if (klass.type === 'NaN' || klass.type === 'Infinity')
|
|
764
|
+
return false;
|
|
765
|
+
return class_regex.test(klass.type);
|
|
766
|
+
}
|
|
767
|
+
$.$mol_view_tree2_class_match = $mol_view_tree2_class_match;
|
|
768
|
+
})($ || ($ = {}));
|
|
769
|
+
|
|
770
|
+
;
|
|
771
|
+
"use strict";
|
|
772
|
+
var $;
|
|
773
|
+
(function ($) {
|
|
774
|
+
const err = $mol_view_tree2_error_str;
|
|
775
|
+
function $mol_view_tree2_class_super(klass) {
|
|
776
|
+
if (!$mol_view_tree2_class_match(klass))
|
|
777
|
+
return this.$mol_fail(err `Wrong class name at ${klass.span}`);
|
|
778
|
+
const superclass = klass.kids.length === 1 ? klass.kids[0] : undefined;
|
|
779
|
+
if (!superclass)
|
|
780
|
+
return this.$mol_fail(err `No super class at ${klass.span}`);
|
|
781
|
+
if (!$mol_view_tree2_class_match(superclass))
|
|
782
|
+
return this.$mol_fail(err `Wrong super class name ${JSON.stringify(superclass.type).replace(/(^"|"$)/g, "")} at ${superclass.span}`);
|
|
783
|
+
return superclass;
|
|
784
|
+
}
|
|
785
|
+
$.$mol_view_tree2_class_super = $mol_view_tree2_class_super;
|
|
786
|
+
})($ || ($ = {}));
|
|
787
|
+
|
|
788
|
+
;
|
|
789
|
+
"use strict";
|
|
790
|
+
var $;
|
|
791
|
+
(function ($) {
|
|
792
|
+
const err = $mol_view_tree2_error_str;
|
|
793
|
+
function $mol_view_tree2_class_props(klass) {
|
|
794
|
+
let props = this.$mol_view_tree2_class_super(klass);
|
|
795
|
+
props = props.clone(props.hack({
|
|
796
|
+
'': (node, belt) => {
|
|
797
|
+
const normal = node.type.replace(/!\w+/, '*');
|
|
798
|
+
if (node.type === normal)
|
|
799
|
+
return [node.clone(node.hack(belt))];
|
|
800
|
+
return [node.struct(normal, node.hack(belt))];
|
|
801
|
+
}
|
|
802
|
+
}));
|
|
803
|
+
const props_inner = {};
|
|
804
|
+
const add_inner = (prop) => {
|
|
805
|
+
const prev = props_inner[prop.type];
|
|
806
|
+
if (prev && prev.kids[0]?.type !== prop.kids[0]?.type) {
|
|
807
|
+
this.$mol_fail(err `Different kids ${prev.span} vs ${prop.span}`);
|
|
808
|
+
}
|
|
809
|
+
props_inner[prop.type] = prop;
|
|
810
|
+
};
|
|
811
|
+
const upper = (operator, belt, context) => {
|
|
812
|
+
const prop = this.$mol_view_tree2_child(operator);
|
|
813
|
+
const defs = prop.hack(belt, { factory: prop });
|
|
814
|
+
if (defs.length)
|
|
815
|
+
add_inner(prop.clone(defs));
|
|
816
|
+
return [operator.clone([prop.clone([])])];
|
|
817
|
+
};
|
|
818
|
+
const props_root = props.hack({
|
|
819
|
+
'<=': upper,
|
|
820
|
+
'<=>': upper,
|
|
821
|
+
'^': (operator, belt, context) => {
|
|
822
|
+
if (operator.kids.length === 0)
|
|
823
|
+
return [operator];
|
|
824
|
+
return upper(operator, belt, context);
|
|
825
|
+
},
|
|
826
|
+
'': (left, belt, context) => {
|
|
827
|
+
let right;
|
|
828
|
+
const operator = left.kids[0];
|
|
829
|
+
if (operator?.type === '=>' && context.factory) {
|
|
830
|
+
right = operator.kids[0];
|
|
831
|
+
if (!right)
|
|
832
|
+
this.$mol_fail(err `Need a child ${operator.span}`);
|
|
833
|
+
if (!context.factory)
|
|
834
|
+
this.$mol_fail(err `Need a parent ${left.span}`);
|
|
835
|
+
add_inner(right.clone([
|
|
836
|
+
right.struct('=', [
|
|
837
|
+
context.factory.clone([left.clone([])]),
|
|
838
|
+
]),
|
|
839
|
+
]));
|
|
840
|
+
}
|
|
841
|
+
if (right)
|
|
842
|
+
context = { factory: right.clone([]) };
|
|
843
|
+
else if (operator && !context.factory && $mol_view_tree2_class_match(operator)) {
|
|
844
|
+
context = { factory: left.clone([]) };
|
|
845
|
+
}
|
|
846
|
+
return [left.clone(left.hack(belt, context))];
|
|
847
|
+
}
|
|
848
|
+
}, { factory: undefined });
|
|
849
|
+
return [...props_root, ...Object.values(props_inner)];
|
|
850
|
+
}
|
|
851
|
+
$.$mol_view_tree2_class_props = $mol_view_tree2_class_props;
|
|
852
|
+
})($ || ($ = {}));
|
|
853
|
+
|
|
854
|
+
;
|
|
855
|
+
"use strict";
|
|
856
|
+
var $;
|
|
857
|
+
(function ($) {
|
|
858
|
+
const err = $mol_view_tree2_error_str;
|
|
859
|
+
function $mol_view_tree2_value_type(val) {
|
|
860
|
+
switch (val.type) {
|
|
861
|
+
case 'true': return 'bool';
|
|
862
|
+
case 'false': return 'bool';
|
|
863
|
+
case 'null': return 'null';
|
|
864
|
+
case '*': return 'dict';
|
|
865
|
+
case '@': return 'locale';
|
|
866
|
+
case '': return 'string';
|
|
867
|
+
case '<=': return 'get';
|
|
868
|
+
case '<=>': return 'bind';
|
|
869
|
+
case '=>': return 'put';
|
|
870
|
+
}
|
|
871
|
+
const first_char = val.type && val.type[0];
|
|
872
|
+
if (first_char === '/')
|
|
873
|
+
return 'list';
|
|
874
|
+
if (Number(val.type).toString() == val.type)
|
|
875
|
+
return 'number';
|
|
876
|
+
if (/^[$A-Z]/.test(first_char))
|
|
877
|
+
return 'object';
|
|
878
|
+
return this.$mol_fail(err `Unknown value type ${val.type} at ${val.span}`);
|
|
879
|
+
}
|
|
880
|
+
$.$mol_view_tree2_value_type = $mol_view_tree2_value_type;
|
|
881
|
+
})($ || ($ = {}));
|
|
882
|
+
|
|
883
|
+
;
|
|
884
|
+
"use strict";
|
|
885
|
+
var $;
|
|
886
|
+
(function ($) {
|
|
887
|
+
const err = $mol_view_tree2_error_str;
|
|
888
|
+
function $mol_view_tree2_value(value) {
|
|
889
|
+
const type = value.type;
|
|
890
|
+
const kids = value.kids;
|
|
891
|
+
if (type === '') {
|
|
892
|
+
if (kids.length === 0)
|
|
893
|
+
return value.data(JSON.stringify(value.value));
|
|
894
|
+
return value.data(JSON.stringify(kids.map(node => node.value).join('\n')));
|
|
895
|
+
}
|
|
896
|
+
if (kids.length !== 0)
|
|
897
|
+
return this.$mol_fail(err `Kids are not allowed at ${value.span}, use ${example}`);
|
|
898
|
+
if (type === 'false' || type === 'true')
|
|
899
|
+
return value.data(type);
|
|
900
|
+
if (type === 'null')
|
|
901
|
+
return value.data(type);
|
|
902
|
+
if (Number(type).toString() === type.replace(/^\+/, ''))
|
|
903
|
+
return value.data(type);
|
|
904
|
+
return this.$mol_fail(err `Value ${value.toString()} not allowed at ${value.span}, use ${example}`);
|
|
905
|
+
}
|
|
906
|
+
$.$mol_view_tree2_value = $mol_view_tree2_value;
|
|
907
|
+
const example = new $mol_view_tree2_error_suggestions([
|
|
908
|
+
'false',
|
|
909
|
+
'true',
|
|
910
|
+
'123',
|
|
911
|
+
'null',
|
|
912
|
+
'\\some'
|
|
913
|
+
]);
|
|
914
|
+
})($ || ($ = {}));
|
|
915
|
+
|
|
916
|
+
;
|
|
917
|
+
"use strict";
|
|
918
|
+
var $;
|
|
919
|
+
(function ($) {
|
|
920
|
+
function $mol_view_tree2_value_number(type) {
|
|
921
|
+
return type.match(/[\+\-]*NaN/) || !Number.isNaN(Number(type));
|
|
922
|
+
}
|
|
923
|
+
$.$mol_view_tree2_value_number = $mol_view_tree2_value_number;
|
|
924
|
+
})($ || ($ = {}));
|
|
925
|
+
|
|
654
926
|
;
|
|
655
927
|
"use strict";
|
|
656
928
|
var $;
|
|
@@ -848,7 +1120,7 @@ var $;
|
|
|
848
1120
|
return [
|
|
849
1121
|
input.data(input.type),
|
|
850
1122
|
];
|
|
851
|
-
if (
|
|
1123
|
+
if ($mol_view_tree2_value_number(input.type))
|
|
852
1124
|
return [
|
|
853
1125
|
input.data(input.type)
|
|
854
1126
|
];
|
|
@@ -858,7 +1130,7 @@ var $;
|
|
|
858
1130
|
}
|
|
859
1131
|
$.$mol_tree2_js_to_text = $mol_tree2_js_to_text;
|
|
860
1132
|
})($ || ($ = {}));
|
|
861
|
-
|
|
1133
|
+
|
|
862
1134
|
;
|
|
863
1135
|
"use strict";
|
|
864
1136
|
var $;
|
|
@@ -887,7 +1159,7 @@ var $;
|
|
|
887
1159
|
}
|
|
888
1160
|
$.$mol_tree2_span_imprint = $mol_tree2_span_imprint;
|
|
889
1161
|
})($ || ($ = {}));
|
|
890
|
-
|
|
1162
|
+
|
|
891
1163
|
;
|
|
892
1164
|
"use strict";
|
|
893
1165
|
var $;
|
|
@@ -915,7 +1187,7 @@ var $;
|
|
|
915
1187
|
}
|
|
916
1188
|
$.$mol_tree2_span_reuse = $mol_tree2_span_reuse;
|
|
917
1189
|
})($ || ($ = {}));
|
|
918
|
-
|
|
1190
|
+
|
|
919
1191
|
;
|
|
920
1192
|
"use strict";
|
|
921
1193
|
var $;
|
|
@@ -956,7 +1228,7 @@ var $;
|
|
|
956
1228
|
}
|
|
957
1229
|
$.$mol_tree2_text_to_string = $mol_tree2_text_to_string;
|
|
958
1230
|
})($ || ($ = {}));
|
|
959
|
-
|
|
1231
|
+
|
|
960
1232
|
;
|
|
961
1233
|
"use strict";
|
|
962
1234
|
var $;
|
|
@@ -982,7 +1254,10 @@ var $;
|
|
|
982
1254
|
}
|
|
983
1255
|
$.$mol_vlq_encode = $mol_vlq_encode;
|
|
984
1256
|
})($ || ($ = {}));
|
|
985
|
-
|
|
1257
|
+
|
|
1258
|
+
;
|
|
1259
|
+
"use strict";
|
|
1260
|
+
|
|
986
1261
|
;
|
|
987
1262
|
"use strict";
|
|
988
1263
|
var $;
|
|
@@ -1066,7 +1341,56 @@ var $;
|
|
|
1066
1341
|
}
|
|
1067
1342
|
$.$mol_tree2_text_to_sourcemap = $mol_tree2_text_to_sourcemap;
|
|
1068
1343
|
})($ || ($ = {}));
|
|
1069
|
-
|
|
1344
|
+
|
|
1345
|
+
;
|
|
1346
|
+
"use strict";
|
|
1347
|
+
var $;
|
|
1348
|
+
(function ($) {
|
|
1349
|
+
function $mol_sourcemap_url(uri, type = 'js') {
|
|
1350
|
+
if (type === 'css')
|
|
1351
|
+
return `\n/*# sourceMappingURL=${uri}*/`;
|
|
1352
|
+
return `\n//# sourceMappingURL=${uri}`;
|
|
1353
|
+
}
|
|
1354
|
+
$.$mol_sourcemap_url = $mol_sourcemap_url;
|
|
1355
|
+
})($ || ($ = {}));
|
|
1356
|
+
|
|
1357
|
+
;
|
|
1358
|
+
"use strict";
|
|
1359
|
+
var $;
|
|
1360
|
+
(function ($) {
|
|
1361
|
+
const prefix = '# sourceMappingURL=data:application/json,';
|
|
1362
|
+
const end_comment = ' */';
|
|
1363
|
+
function $mol_sourcemap_dataurl_decode(data) {
|
|
1364
|
+
const index = data.lastIndexOf(prefix);
|
|
1365
|
+
if (index === -1)
|
|
1366
|
+
return undefined;
|
|
1367
|
+
data = data.substring(index + prefix.length);
|
|
1368
|
+
if (data.endsWith(end_comment))
|
|
1369
|
+
data = data.substring(0, data.length - end_comment.length);
|
|
1370
|
+
const decoded = this.decodeURIComponent(data);
|
|
1371
|
+
try {
|
|
1372
|
+
const map = JSON.parse(decoded);
|
|
1373
|
+
if (!map)
|
|
1374
|
+
return undefined;
|
|
1375
|
+
if (typeof map.mappings === 'string' && map.mappings.startsWith(';;')) {
|
|
1376
|
+
map.mappings = map.mappings.substring(2);
|
|
1377
|
+
}
|
|
1378
|
+
return map;
|
|
1379
|
+
}
|
|
1380
|
+
catch (e) {
|
|
1381
|
+
if (e instanceof Error)
|
|
1382
|
+
e.message += ', origin=' + decoded;
|
|
1383
|
+
$mol_fail_hidden(e);
|
|
1384
|
+
}
|
|
1385
|
+
}
|
|
1386
|
+
$.$mol_sourcemap_dataurl_decode = $mol_sourcemap_dataurl_decode;
|
|
1387
|
+
function $mol_sourcemap_dataurl_encode(map, type = 'js') {
|
|
1388
|
+
const str = JSON.stringify({ ...map, mappings: ';;' + map.mappings });
|
|
1389
|
+
return this.$mol_sourcemap_url('data:application/json,' + this.encodeURIComponent(str), type);
|
|
1390
|
+
}
|
|
1391
|
+
$.$mol_sourcemap_dataurl_encode = $mol_sourcemap_dataurl_encode;
|
|
1392
|
+
})($ || ($ = {}));
|
|
1393
|
+
|
|
1070
1394
|
;
|
|
1071
1395
|
"use strict";
|
|
1072
1396
|
var $;
|
|
@@ -1074,14 +1398,8 @@ var $;
|
|
|
1074
1398
|
function $mol_tree2_text_to_string_mapped(text, type) {
|
|
1075
1399
|
const code = this.$mol_tree2_text_to_string(text);
|
|
1076
1400
|
const map = this.$mol_tree2_text_to_sourcemap(text);
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
const map_uri = `data:application/json,${this.encodeURIComponent(JSON.stringify(map))}`;
|
|
1080
|
-
if (type === 'js')
|
|
1081
|
-
res += `\n//# sourceMappingURL=${map_uri}`;
|
|
1082
|
-
else
|
|
1083
|
-
res += `\n/*# sourceMappingURL=${map_uri} */`;
|
|
1084
|
-
return res;
|
|
1401
|
+
const chunk = this.$mol_sourcemap_dataurl_encode(map, type);
|
|
1402
|
+
return code + chunk;
|
|
1085
1403
|
}
|
|
1086
1404
|
$.$mol_tree2_text_to_string_mapped = $mol_tree2_text_to_string_mapped;
|
|
1087
1405
|
function $mol_tree2_text_to_string_mapped_js(text) {
|
|
@@ -1093,7 +1411,17 @@ var $;
|
|
|
1093
1411
|
}
|
|
1094
1412
|
$.$mol_tree2_text_to_string_mapped_css = $mol_tree2_text_to_string_mapped_css;
|
|
1095
1413
|
})($ || ($ = {}));
|
|
1096
|
-
|
|
1414
|
+
|
|
1415
|
+
;
|
|
1416
|
+
"use strict";
|
|
1417
|
+
var $;
|
|
1418
|
+
(function ($) {
|
|
1419
|
+
function $mol_guard_defined(value) {
|
|
1420
|
+
return value !== null && value !== undefined;
|
|
1421
|
+
}
|
|
1422
|
+
$.$mol_guard_defined = $mol_guard_defined;
|
|
1423
|
+
})($ || ($ = {}));
|
|
1424
|
+
|
|
1097
1425
|
;
|
|
1098
1426
|
"use strict";
|
|
1099
1427
|
var $;
|
|
@@ -1105,13 +1433,13 @@ var $;
|
|
|
1105
1433
|
'https://sokra.github.io/source-map-visualization/#base64',
|
|
1106
1434
|
btoa(code),
|
|
1107
1435
|
btoa(JSON.stringify(map)),
|
|
1108
|
-
...map.sourcesContent.map(btoa),
|
|
1436
|
+
...map.sourcesContent?.filter($mol_guard_defined).map(btoa) ?? [],
|
|
1109
1437
|
].join(',');
|
|
1110
1438
|
return uri;
|
|
1111
1439
|
}
|
|
1112
1440
|
$.$mol_tree2_text_to_sourcemap_vis = $mol_tree2_text_to_sourcemap_vis;
|
|
1113
1441
|
})($ || ($ = {}));
|
|
1114
|
-
|
|
1442
|
+
|
|
1115
1443
|
;
|
|
1116
1444
|
"use strict";
|
|
1117
1445
|
var $;
|
|
@@ -1162,7 +1490,7 @@ var $;
|
|
|
1162
1490
|
}
|
|
1163
1491
|
$.$mol_tree2_to_json = $mol_tree2_to_json;
|
|
1164
1492
|
})($ || ($ = {}));
|
|
1165
|
-
|
|
1493
|
+
|
|
1166
1494
|
;
|
|
1167
1495
|
"use strict";
|
|
1168
1496
|
var $;
|
|
@@ -1198,7 +1526,7 @@ var $;
|
|
|
1198
1526
|
}
|
|
1199
1527
|
$.$mol_tree2_to_stream = $mol_tree2_to_stream;
|
|
1200
1528
|
})($ || ($ = {}));
|
|
1201
|
-
|
|
1529
|
+
|
|
1202
1530
|
;
|
|
1203
1531
|
"use strict";
|
|
1204
1532
|
var $;
|
|
@@ -1260,7 +1588,7 @@ var $;
|
|
|
1260
1588
|
}
|
|
1261
1589
|
$.$mol_tree2_xml_from_dom = $mol_tree2_xml_from_dom;
|
|
1262
1590
|
})($ || ($ = {}));
|
|
1263
|
-
|
|
1591
|
+
|
|
1264
1592
|
;
|
|
1265
1593
|
"use strict";
|
|
1266
1594
|
var $;
|
|
@@ -1276,7 +1604,7 @@ var $;
|
|
|
1276
1604
|
}
|
|
1277
1605
|
$.$mol_html_encode = $mol_html_encode;
|
|
1278
1606
|
})($ || ($ = {}));
|
|
1279
|
-
|
|
1607
|
+
|
|
1280
1608
|
;
|
|
1281
1609
|
"use strict";
|
|
1282
1610
|
var $;
|
|
@@ -1360,6 +1688,6 @@ var $;
|
|
|
1360
1688
|
}
|
|
1361
1689
|
$.$mol_tree2_xml_to_text = $mol_tree2_xml_to_text;
|
|
1362
1690
|
})($ || ($ = {}));
|
|
1363
|
-
|
|
1691
|
+
|
|
1364
1692
|
|
|
1365
1693
|
//# sourceMappingURL=node.js.map
|