mol_crypto_lib 0.0.208 → 0.0.212
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 +0 -99
- package/node.deps.json +1 -1
- package/node.esm.js +6 -6
- package/node.esm.js.map +1 -1
- package/node.js +6 -6
- package/node.js.map +1 -1
- package/node.test.js +256 -250
- package/node.test.js.map +1 -1
- package/package.json +1 -1
- package/test.html +2 -2
- package/web.d.ts +0 -99
- package/web.deps.json +1 -1
- package/web.esm.js +6 -6
- package/web.esm.js.map +1 -1
- package/web.js +6 -6
- package/web.js.map +1 -1
- package/web.test.js +174 -168
- package/web.test.js.map +1 -1
package/node.test.js
CHANGED
|
@@ -19,7 +19,7 @@ var $;
|
|
|
19
19
|
(function ($) {
|
|
20
20
|
})($ || ($ = {}));
|
|
21
21
|
module.exports = $;
|
|
22
|
-
//mam.
|
|
22
|
+
//mam.ts
|
|
23
23
|
;
|
|
24
24
|
"use strict";
|
|
25
25
|
var $;
|
|
@@ -61,7 +61,7 @@ var $;
|
|
|
61
61
|
}
|
|
62
62
|
$.$mol_crypto_secret = $mol_crypto_secret;
|
|
63
63
|
})($ || ($ = {}));
|
|
64
|
-
//secret.
|
|
64
|
+
//mol/crypto/secret/secret.ts
|
|
65
65
|
;
|
|
66
66
|
"use strict";
|
|
67
67
|
var $;
|
|
@@ -117,7 +117,7 @@ var $;
|
|
|
117
117
|
$.$mol_crypto_cipher_private = $mol_crypto_cipher_private;
|
|
118
118
|
$.$mol_crypto_cipher_ecrypted_size = 128;
|
|
119
119
|
})($ || ($ = {}));
|
|
120
|
-
//cipher.
|
|
120
|
+
//mol/crypto/cipher/cipher.ts
|
|
121
121
|
;
|
|
122
122
|
"use strict";
|
|
123
123
|
var $;
|
|
@@ -173,7 +173,7 @@ var $;
|
|
|
173
173
|
$.$mol_crypto_auditor_private = $mol_crypto_auditor_private;
|
|
174
174
|
$.$mol_crypto_auditor_sign_size = 64;
|
|
175
175
|
})($ || ($ = {}));
|
|
176
|
-
//auditor.
|
|
176
|
+
//mol/crypto/auditor/auditor.ts
|
|
177
177
|
;
|
|
178
178
|
"use strict";
|
|
179
179
|
var $;
|
|
@@ -183,7 +183,7 @@ var $;
|
|
|
183
183
|
}
|
|
184
184
|
$.$mol_crypto_salt = $mol_crypto_salt;
|
|
185
185
|
})($ || ($ = {}));
|
|
186
|
-
//salt.
|
|
186
|
+
//mol/crypto/salt/salt.ts
|
|
187
187
|
;
|
|
188
188
|
"use strict";
|
|
189
189
|
var $;
|
|
@@ -193,7 +193,7 @@ var $;
|
|
|
193
193
|
}
|
|
194
194
|
$.$mol_fail = $mol_fail;
|
|
195
195
|
})($ || ($ = {}));
|
|
196
|
-
//fail.
|
|
196
|
+
//mol/fail/fail.ts
|
|
197
197
|
;
|
|
198
198
|
"use strict";
|
|
199
199
|
var $;
|
|
@@ -203,7 +203,7 @@ var $;
|
|
|
203
203
|
}
|
|
204
204
|
$.$mol_fail_hidden = $mol_fail_hidden;
|
|
205
205
|
})($ || ($ = {}));
|
|
206
|
-
//hidden.
|
|
206
|
+
//mol/fail/hidden/hidden.ts
|
|
207
207
|
;
|
|
208
208
|
"use strict";
|
|
209
209
|
var $;
|
|
@@ -213,7 +213,7 @@ var $;
|
|
|
213
213
|
}
|
|
214
214
|
$.$mol_test_complete = $mol_test_complete;
|
|
215
215
|
})($ || ($ = {}));
|
|
216
|
-
//test.node.test.
|
|
216
|
+
//mol/test/test.node.test.ts
|
|
217
217
|
;
|
|
218
218
|
"use strict";
|
|
219
219
|
var $;
|
|
@@ -231,12 +231,18 @@ var $;
|
|
|
231
231
|
$_1.$mol_test_all = [];
|
|
232
232
|
async function $mol_test_run() {
|
|
233
233
|
for (var test of $_1.$mol_test_all) {
|
|
234
|
-
let context = Object.create(
|
|
234
|
+
let context = Object.create($$);
|
|
235
235
|
for (let mock of $_1.$mol_test_mocks)
|
|
236
236
|
await mock(context);
|
|
237
|
-
|
|
237
|
+
const res = test(context);
|
|
238
|
+
if (res instanceof Promise) {
|
|
239
|
+
await new Promise((done, fail) => {
|
|
240
|
+
res.then(done, fail);
|
|
241
|
+
setTimeout(() => fail(new Error('Test timeout: ' + test.name)), 1000);
|
|
242
|
+
});
|
|
243
|
+
}
|
|
238
244
|
}
|
|
239
|
-
|
|
245
|
+
$$.$mol_log3_done({
|
|
240
246
|
place: '$mol_test',
|
|
241
247
|
message: 'All tests passed',
|
|
242
248
|
count: $_1.$mol_test_all.length,
|
|
@@ -254,7 +260,7 @@ var $;
|
|
|
254
260
|
await $mol_test_run();
|
|
255
261
|
}
|
|
256
262
|
finally {
|
|
257
|
-
|
|
263
|
+
$$.$mol_test_complete();
|
|
258
264
|
}
|
|
259
265
|
}, 0);
|
|
260
266
|
}
|
|
@@ -267,10 +273,10 @@ var $;
|
|
|
267
273
|
for (let api of forbidden) {
|
|
268
274
|
context[api] = new Proxy(function () { }, {
|
|
269
275
|
get() {
|
|
270
|
-
$
|
|
276
|
+
$mol_fail_hidden(new Error(`${api} is forbidden in tests`));
|
|
271
277
|
},
|
|
272
278
|
apply() {
|
|
273
|
-
$
|
|
279
|
+
$mol_fail_hidden(new Error(`${api} is forbidden in tests`));
|
|
274
280
|
},
|
|
275
281
|
});
|
|
276
282
|
}
|
|
@@ -298,16 +304,16 @@ var $;
|
|
|
298
304
|
},
|
|
299
305
|
});
|
|
300
306
|
})($ || ($ = {}));
|
|
301
|
-
//test.test.
|
|
307
|
+
//mol/test/test.test.ts
|
|
302
308
|
;
|
|
303
309
|
"use strict";
|
|
304
310
|
var $;
|
|
305
311
|
(function ($) {
|
|
306
312
|
})($ || ($ = {}));
|
|
307
|
-
//context.
|
|
313
|
+
//mol/dom/context/context.ts
|
|
308
314
|
;
|
|
309
315
|
"use strict";
|
|
310
|
-
//node.
|
|
316
|
+
//node/node.ts
|
|
311
317
|
;
|
|
312
318
|
"use strict";
|
|
313
319
|
var $node = new Proxy({ require }, {
|
|
@@ -346,14 +352,14 @@ var $node = new Proxy({ require }, {
|
|
|
346
352
|
require = (req => Object.assign(function require(name) {
|
|
347
353
|
return $node[name];
|
|
348
354
|
}, req))(require);
|
|
349
|
-
//node.node.
|
|
355
|
+
//node/node.node.ts
|
|
350
356
|
;
|
|
351
357
|
"use strict";
|
|
352
358
|
var $;
|
|
353
359
|
(function ($) {
|
|
354
360
|
$.$mol_dom_context = new $node.jsdom.JSDOM('', { url: 'https://localhost/' }).window;
|
|
355
361
|
})($ || ($ = {}));
|
|
356
|
-
//context.node.
|
|
362
|
+
//mol/dom/context/context.node.ts
|
|
357
363
|
;
|
|
358
364
|
"use strict";
|
|
359
365
|
var $;
|
|
@@ -364,7 +370,7 @@ var $;
|
|
|
364
370
|
for (let view of childNodes) {
|
|
365
371
|
if (view == null)
|
|
366
372
|
continue;
|
|
367
|
-
if (view instanceof
|
|
373
|
+
if (view instanceof $mol_dom_context.Node) {
|
|
368
374
|
while (true) {
|
|
369
375
|
if (!nextNode) {
|
|
370
376
|
el.appendChild(view);
|
|
@@ -395,7 +401,7 @@ var $;
|
|
|
395
401
|
nextNode = nextNode.nextSibling;
|
|
396
402
|
}
|
|
397
403
|
else {
|
|
398
|
-
const textNode =
|
|
404
|
+
const textNode = $mol_dom_context.document.createTextNode(String(view));
|
|
399
405
|
el.insertBefore(textNode, nextNode);
|
|
400
406
|
}
|
|
401
407
|
}
|
|
@@ -408,88 +414,88 @@ var $;
|
|
|
408
414
|
}
|
|
409
415
|
$.$mol_dom_render_children = $mol_dom_render_children;
|
|
410
416
|
})($ || ($ = {}));
|
|
411
|
-
//children.
|
|
417
|
+
//mol/dom/render/children/children.ts
|
|
412
418
|
;
|
|
413
419
|
"use strict";
|
|
414
|
-
//error.
|
|
420
|
+
//mol/type/error/error.ts
|
|
415
421
|
;
|
|
416
422
|
"use strict";
|
|
417
|
-
//assert.test.
|
|
423
|
+
//mol/type/assert/assert.test.ts
|
|
418
424
|
;
|
|
419
425
|
"use strict";
|
|
420
|
-
//assert.
|
|
426
|
+
//mol/type/assert/assert.ts
|
|
421
427
|
;
|
|
422
428
|
"use strict";
|
|
423
|
-
//deep.test.
|
|
429
|
+
//mol/type/partial/deep/deep.test.ts
|
|
424
430
|
;
|
|
425
431
|
"use strict";
|
|
426
|
-
//deep.
|
|
432
|
+
//mol/type/partial/deep/deep.ts
|
|
427
433
|
;
|
|
428
434
|
"use strict";
|
|
429
435
|
var $;
|
|
430
436
|
(function ($) {
|
|
431
|
-
|
|
437
|
+
$mol_test({
|
|
432
438
|
'Make empty div'() {
|
|
433
|
-
|
|
439
|
+
$mol_assert_equal(($mol_jsx("div", null)).outerHTML, '<div></div>');
|
|
434
440
|
},
|
|
435
441
|
'Define native field'() {
|
|
436
|
-
const dom =
|
|
437
|
-
|
|
438
|
-
|
|
442
|
+
const dom = $mol_jsx("input", { value: '123' });
|
|
443
|
+
$mol_assert_equal(dom.outerHTML, '<input value="123">');
|
|
444
|
+
$mol_assert_equal(dom.value, '123');
|
|
439
445
|
},
|
|
440
446
|
'Define classes'() {
|
|
441
|
-
const dom =
|
|
442
|
-
|
|
447
|
+
const dom = $mol_jsx("div", { class: 'foo bar' });
|
|
448
|
+
$mol_assert_equal(dom.outerHTML, '<div class="foo bar"></div>');
|
|
443
449
|
},
|
|
444
450
|
'Define styles'() {
|
|
445
|
-
const dom =
|
|
446
|
-
|
|
451
|
+
const dom = $mol_jsx("div", { style: { color: 'red' } });
|
|
452
|
+
$mol_assert_equal(dom.outerHTML, '<div style="color: red;"></div>');
|
|
447
453
|
},
|
|
448
454
|
'Define dataset'() {
|
|
449
|
-
const dom =
|
|
450
|
-
|
|
455
|
+
const dom = $mol_jsx("div", { dataset: { foo: 'bar' } });
|
|
456
|
+
$mol_assert_equal(dom.outerHTML, '<div data-foo="bar"></div>');
|
|
451
457
|
},
|
|
452
458
|
'Define attributes'() {
|
|
453
|
-
const dom =
|
|
454
|
-
|
|
459
|
+
const dom = $mol_jsx("div", { lang: "ru", hidden: true });
|
|
460
|
+
$mol_assert_equal(dom.outerHTML, '<div lang="ru" hidden=""></div>');
|
|
455
461
|
},
|
|
456
462
|
'Define child nodes'() {
|
|
457
|
-
const dom =
|
|
463
|
+
const dom = $mol_jsx("div", null,
|
|
458
464
|
"hello",
|
|
459
|
-
|
|
465
|
+
$mol_jsx("strong", null, "world"),
|
|
460
466
|
"!");
|
|
461
|
-
|
|
467
|
+
$mol_assert_equal(dom.outerHTML, '<div>hello<strong>world</strong>!</div>');
|
|
462
468
|
},
|
|
463
469
|
'Function as component'() {
|
|
464
470
|
const Button = ({ hint }, target) => {
|
|
465
|
-
return
|
|
471
|
+
return $mol_jsx("button", { title: hint }, target());
|
|
466
472
|
};
|
|
467
|
-
const dom =
|
|
468
|
-
|
|
473
|
+
const dom = $mol_jsx(Button, { id: "/foo", hint: "click me" }, () => 'hey!');
|
|
474
|
+
$mol_assert_equal(dom.outerHTML, '<button title="click me" id="/foo">hey!</button>');
|
|
469
475
|
},
|
|
470
476
|
'Nested guid generation'() {
|
|
471
477
|
const Foo = () => {
|
|
472
|
-
return
|
|
473
|
-
|
|
474
|
-
|
|
478
|
+
return $mol_jsx("div", null,
|
|
479
|
+
$mol_jsx(Bar, { id: "/bar" },
|
|
480
|
+
$mol_jsx("img", { id: "/icon" })));
|
|
475
481
|
};
|
|
476
482
|
const Bar = (props, icon) => {
|
|
477
|
-
return
|
|
483
|
+
return $mol_jsx("span", null, icon);
|
|
478
484
|
};
|
|
479
|
-
const dom =
|
|
480
|
-
|
|
485
|
+
const dom = $mol_jsx(Foo, { id: "/foo" });
|
|
486
|
+
$mol_assert_equal(dom.outerHTML, '<div id="/foo"><span id="/foo/bar"><img id="/foo/icon"></span></div>');
|
|
481
487
|
},
|
|
482
488
|
'Fail on non unique ids'() {
|
|
483
489
|
const App = () => {
|
|
484
|
-
return
|
|
485
|
-
|
|
486
|
-
|
|
490
|
+
return $mol_jsx("div", null,
|
|
491
|
+
$mol_jsx("span", { id: "/bar" }),
|
|
492
|
+
$mol_jsx("span", { id: "/bar" }));
|
|
487
493
|
};
|
|
488
|
-
|
|
494
|
+
$mol_assert_fail(() => $mol_jsx(App, { id: "/foo" }), 'JSX already has tag with id "/bar"');
|
|
489
495
|
},
|
|
490
496
|
});
|
|
491
497
|
})($ || ($ = {}));
|
|
492
|
-
//jsx.test.
|
|
498
|
+
//mol/jsx/jsx.test.tsx
|
|
493
499
|
;
|
|
494
500
|
"use strict";
|
|
495
501
|
var $;
|
|
@@ -498,15 +504,15 @@ var $;
|
|
|
498
504
|
$.$mol_jsx_booked = null;
|
|
499
505
|
$.$mol_jsx_document = {
|
|
500
506
|
getElementById: () => null,
|
|
501
|
-
createElementNS: (space, name) =>
|
|
502
|
-
createDocumentFragment: () =>
|
|
507
|
+
createElementNS: (space, name) => $mol_dom_context.document.createElementNS(space, name),
|
|
508
|
+
createDocumentFragment: () => $mol_dom_context.document.createDocumentFragment(),
|
|
503
509
|
};
|
|
504
510
|
$.$mol_jsx_frag = '';
|
|
505
511
|
function $mol_jsx(Elem, props, ...childNodes) {
|
|
506
512
|
const id = props && props.id || '';
|
|
507
513
|
if (Elem && $.$mol_jsx_booked) {
|
|
508
514
|
if ($.$mol_jsx_booked.has(id)) {
|
|
509
|
-
|
|
515
|
+
$mol_fail(new Error(`JSX already has tag with id ${JSON.stringify(id)}`));
|
|
510
516
|
}
|
|
511
517
|
else {
|
|
512
518
|
$.$mol_jsx_booked.add(id);
|
|
@@ -545,7 +551,7 @@ var $;
|
|
|
545
551
|
? $.$mol_jsx_document.createElementNS(props?.xmlns ?? 'http://www.w3.org/1999/xhtml', Elem)
|
|
546
552
|
: $.$mol_jsx_document.createDocumentFragment();
|
|
547
553
|
}
|
|
548
|
-
|
|
554
|
+
$mol_dom_render_children(node, [].concat(...childNodes));
|
|
549
555
|
if (!Elem)
|
|
550
556
|
return node;
|
|
551
557
|
for (const key in props) {
|
|
@@ -571,77 +577,77 @@ var $;
|
|
|
571
577
|
}
|
|
572
578
|
$.$mol_jsx = $mol_jsx;
|
|
573
579
|
})($ || ($ = {}));
|
|
574
|
-
//jsx.
|
|
580
|
+
//mol/jsx/jsx.ts
|
|
575
581
|
;
|
|
576
582
|
"use strict";
|
|
577
583
|
var $;
|
|
578
584
|
(function ($) {
|
|
579
|
-
|
|
585
|
+
$mol_test({
|
|
580
586
|
'nulls & undefineds'() {
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
587
|
+
$mol_assert_ok($mol_compare_deep(null, null));
|
|
588
|
+
$mol_assert_ok($mol_compare_deep(undefined, undefined));
|
|
589
|
+
$mol_assert_not($mol_compare_deep(undefined, null));
|
|
590
|
+
$mol_assert_not($mol_compare_deep({}, null));
|
|
585
591
|
},
|
|
586
592
|
'number'() {
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
593
|
+
$mol_assert_ok($mol_compare_deep(1, 1));
|
|
594
|
+
$mol_assert_ok($mol_compare_deep(Number.NaN, Number.NaN));
|
|
595
|
+
$mol_assert_not($mol_compare_deep(1, 2));
|
|
596
|
+
$mol_assert_ok($mol_compare_deep(Object(1), Object(1)));
|
|
597
|
+
$mol_assert_not($mol_compare_deep(Object(1), Object(2)));
|
|
592
598
|
},
|
|
593
599
|
'POJO'() {
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
+
$mol_assert_ok($mol_compare_deep({}, {}));
|
|
601
|
+
$mol_assert_not($mol_compare_deep({ a: 1 }, { b: 2 }));
|
|
602
|
+
$mol_assert_not($mol_compare_deep({ a: 1 }, { a: 2 }));
|
|
603
|
+
$mol_assert_not($mol_compare_deep({}, { a: undefined }));
|
|
604
|
+
$mol_assert_ok($mol_compare_deep({ a: 1, b: 2 }, { b: 2, a: 1 }));
|
|
605
|
+
$mol_assert_ok($mol_compare_deep({ a: { b: 1 } }, { a: { b: 1 } }));
|
|
600
606
|
},
|
|
601
607
|
'Array'() {
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
608
|
+
$mol_assert_ok($mol_compare_deep([], []));
|
|
609
|
+
$mol_assert_ok($mol_compare_deep([1, [2]], [1, [2]]));
|
|
610
|
+
$mol_assert_not($mol_compare_deep([1, 2], [1, 3]));
|
|
611
|
+
$mol_assert_not($mol_compare_deep([1, 2,], [1, 3, undefined]));
|
|
606
612
|
},
|
|
607
613
|
'Non POJO are different'() {
|
|
608
614
|
class Thing extends Object {
|
|
609
615
|
}
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
616
|
+
$mol_assert_not($mol_compare_deep(new Thing, new Thing));
|
|
617
|
+
$mol_assert_not($mol_compare_deep(() => 1, () => 1));
|
|
618
|
+
$mol_assert_not($mol_compare_deep(new RangeError('Test error'), new RangeError('Test error')));
|
|
613
619
|
},
|
|
614
620
|
'same POJOs with cyclic reference'() {
|
|
615
621
|
const a = { foo: {} };
|
|
616
622
|
a['self'] = a;
|
|
617
623
|
const b = { foo: {} };
|
|
618
624
|
b['self'] = b;
|
|
619
|
-
|
|
625
|
+
$mol_assert_ok($mol_compare_deep(a, b));
|
|
620
626
|
},
|
|
621
627
|
'Date'() {
|
|
622
|
-
|
|
623
|
-
|
|
628
|
+
$mol_assert_ok($mol_compare_deep(new Date(12345), new Date(12345)));
|
|
629
|
+
$mol_assert_not($mol_compare_deep(new Date(12345), new Date(12346)));
|
|
624
630
|
},
|
|
625
631
|
'RegExp'() {
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
632
|
+
$mol_assert_ok($mol_compare_deep(/\x22/mig, /\x22/mig));
|
|
633
|
+
$mol_assert_not($mol_compare_deep(/\x22/mig, /\x21/mig));
|
|
634
|
+
$mol_assert_not($mol_compare_deep(/\x22/mig, /\x22/mg));
|
|
629
635
|
},
|
|
630
636
|
'Map'() {
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
637
|
+
$mol_assert_ok($mol_compare_deep(new Map, new Map));
|
|
638
|
+
$mol_assert_ok($mol_compare_deep(new Map([[1, [2]]]), new Map([[1, [2]]])));
|
|
639
|
+
$mol_assert_not($mol_compare_deep(new Map([[1, 2]]), new Map([[1, 3]])));
|
|
640
|
+
$mol_assert_not($mol_compare_deep(new Map([[[1], 2]]), new Map([[[1], 2]])));
|
|
635
641
|
},
|
|
636
642
|
'Set'() {
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
643
|
+
$mol_assert_ok($mol_compare_deep(new Set, new Set));
|
|
644
|
+
$mol_assert_ok($mol_compare_deep(new Set([1, [2]]), new Set([1, [2]])));
|
|
645
|
+
$mol_assert_not($mol_compare_deep(new Set([1]), new Set([2])));
|
|
640
646
|
},
|
|
641
647
|
'Uint8Array'() {
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
648
|
+
$mol_assert_ok($mol_compare_deep(new Uint8Array, new Uint8Array));
|
|
649
|
+
$mol_assert_ok($mol_compare_deep(new Uint8Array([0]), new Uint8Array([0])));
|
|
650
|
+
$mol_assert_not($mol_compare_deep(new Uint8Array([0]), new Uint8Array([1])));
|
|
645
651
|
},
|
|
646
652
|
'Custom comparator'() {
|
|
647
653
|
class User {
|
|
@@ -655,17 +661,17 @@ var $;
|
|
|
655
661
|
return this.name;
|
|
656
662
|
}
|
|
657
663
|
}
|
|
658
|
-
|
|
659
|
-
|
|
664
|
+
$mol_assert_ok($mol_compare_deep(new User('Jin'), new User('Jin')));
|
|
665
|
+
$mol_assert_not($mol_compare_deep(new User('Jin'), new User('John')));
|
|
660
666
|
},
|
|
661
667
|
});
|
|
662
668
|
})($ || ($ = {}));
|
|
663
|
-
//deep.test.
|
|
669
|
+
//mol/compare/deep/deep.test.tsx
|
|
664
670
|
;
|
|
665
671
|
"use strict";
|
|
666
672
|
var $;
|
|
667
673
|
(function ($) {
|
|
668
|
-
|
|
674
|
+
$.$mol_compare_deep_cache = new WeakMap();
|
|
669
675
|
function $mol_compare_deep(left, right) {
|
|
670
676
|
if (Object.is(left, right))
|
|
671
677
|
return true;
|
|
@@ -691,7 +697,7 @@ var $;
|
|
|
691
697
|
return Object.is(left.valueOf(), right['valueOf']());
|
|
692
698
|
if (left instanceof RegExp)
|
|
693
699
|
return left.source === right['source'] && left.flags === right['flags'];
|
|
694
|
-
let left_cache =
|
|
700
|
+
let left_cache = $.$mol_compare_deep_cache.get(left);
|
|
695
701
|
if (left_cache) {
|
|
696
702
|
const right_cache = left_cache.get(right);
|
|
697
703
|
if (typeof right_cache === 'boolean')
|
|
@@ -699,7 +705,7 @@ var $;
|
|
|
699
705
|
}
|
|
700
706
|
else {
|
|
701
707
|
left_cache = new WeakMap([[right, true]]);
|
|
702
|
-
|
|
708
|
+
$.$mol_compare_deep_cache.set(left, left_cache);
|
|
703
709
|
}
|
|
704
710
|
let result;
|
|
705
711
|
try {
|
|
@@ -783,50 +789,50 @@ var $;
|
|
|
783
789
|
return Object.is(left[Symbol.toPrimitive]('default'), right[Symbol.toPrimitive]('default'));
|
|
784
790
|
}
|
|
785
791
|
})($ || ($ = {}));
|
|
786
|
-
//deep.
|
|
792
|
+
//mol/compare/deep/deep.ts
|
|
787
793
|
;
|
|
788
794
|
"use strict";
|
|
789
795
|
var $;
|
|
790
796
|
(function ($) {
|
|
791
797
|
function $mol_dom_serialize(node) {
|
|
792
|
-
const serializer = new
|
|
798
|
+
const serializer = new $mol_dom_context.XMLSerializer;
|
|
793
799
|
return serializer.serializeToString(node);
|
|
794
800
|
}
|
|
795
801
|
$.$mol_dom_serialize = $mol_dom_serialize;
|
|
796
802
|
})($ || ($ = {}));
|
|
797
|
-
//serialize.
|
|
803
|
+
//mol/dom/serialize/serialize.ts
|
|
798
804
|
;
|
|
799
805
|
"use strict";
|
|
800
806
|
var $;
|
|
801
807
|
(function ($) {
|
|
802
|
-
|
|
808
|
+
$mol_test({
|
|
803
809
|
'must be false'() {
|
|
804
|
-
|
|
810
|
+
$mol_assert_not(0);
|
|
805
811
|
},
|
|
806
812
|
'must be true'() {
|
|
807
|
-
|
|
813
|
+
$mol_assert_ok(1);
|
|
808
814
|
},
|
|
809
815
|
'two must be equal'() {
|
|
810
|
-
|
|
816
|
+
$mol_assert_equal(2, 2);
|
|
811
817
|
},
|
|
812
818
|
'three must be equal'() {
|
|
813
|
-
|
|
819
|
+
$mol_assert_equal(2, 2, 2);
|
|
814
820
|
},
|
|
815
821
|
'two must be unique'() {
|
|
816
|
-
|
|
822
|
+
$mol_assert_unique([3], [3]);
|
|
817
823
|
},
|
|
818
824
|
'three must be unique'() {
|
|
819
|
-
|
|
825
|
+
$mol_assert_unique([3], [3], [3]);
|
|
820
826
|
},
|
|
821
827
|
'two must be alike'() {
|
|
822
|
-
|
|
828
|
+
$mol_assert_like([3], [3]);
|
|
823
829
|
},
|
|
824
830
|
'three must be alike'() {
|
|
825
|
-
|
|
831
|
+
$mol_assert_like([3], [3], [3]);
|
|
826
832
|
},
|
|
827
833
|
});
|
|
828
834
|
})($ || ($ = {}));
|
|
829
|
-
//assert.test.
|
|
835
|
+
//mol/assert/assert.test.ts
|
|
830
836
|
;
|
|
831
837
|
"use strict";
|
|
832
838
|
var $;
|
|
@@ -834,13 +840,13 @@ var $;
|
|
|
834
840
|
function $mol_assert_ok(value) {
|
|
835
841
|
if (value)
|
|
836
842
|
return;
|
|
837
|
-
|
|
843
|
+
$mol_fail(new Error(`${value} ≠ true`));
|
|
838
844
|
}
|
|
839
845
|
$.$mol_assert_ok = $mol_assert_ok;
|
|
840
846
|
function $mol_assert_not(value) {
|
|
841
847
|
if (!value)
|
|
842
848
|
return;
|
|
843
|
-
|
|
849
|
+
$mol_fail(new Error(`${value} ≠ false`));
|
|
844
850
|
}
|
|
845
851
|
$.$mol_assert_not = $mol_assert_not;
|
|
846
852
|
function $mol_assert_fail(handler, ErrorRight) {
|
|
@@ -864,7 +870,7 @@ var $;
|
|
|
864
870
|
finally {
|
|
865
871
|
$.$mol_fail = fail;
|
|
866
872
|
}
|
|
867
|
-
|
|
873
|
+
$mol_fail(new Error('Not failed'));
|
|
868
874
|
}
|
|
869
875
|
$.$mol_assert_fail = $mol_assert_fail;
|
|
870
876
|
function $mol_assert_equal(...args) {
|
|
@@ -875,7 +881,7 @@ var $;
|
|
|
875
881
|
if (Number.isNaN(args[i]) && Number.isNaN(args[j]))
|
|
876
882
|
continue;
|
|
877
883
|
if (args[i] !== args[j])
|
|
878
|
-
|
|
884
|
+
$mol_fail(new Error(`Not equal (${i + 1}:${j + 1})\n${args[i]}\n${args[j]}`));
|
|
879
885
|
}
|
|
880
886
|
}
|
|
881
887
|
}
|
|
@@ -886,7 +892,7 @@ var $;
|
|
|
886
892
|
if (i === j)
|
|
887
893
|
continue;
|
|
888
894
|
if (args[i] === args[j] || (Number.isNaN(args[i]) && Number.isNaN(args[j]))) {
|
|
889
|
-
|
|
895
|
+
$mol_fail(new Error(`args[${i}] = args[${j}] = ${args[i]}`));
|
|
890
896
|
}
|
|
891
897
|
}
|
|
892
898
|
}
|
|
@@ -894,7 +900,7 @@ var $;
|
|
|
894
900
|
$.$mol_assert_unique = $mol_assert_unique;
|
|
895
901
|
function $mol_assert_like(head, ...tail) {
|
|
896
902
|
for (let [index, value] of Object.entries(tail)) {
|
|
897
|
-
if (
|
|
903
|
+
if (!$mol_compare_deep(value, head)) {
|
|
898
904
|
const print = (val) => {
|
|
899
905
|
if (!val)
|
|
900
906
|
return val;
|
|
@@ -910,118 +916,118 @@ var $;
|
|
|
910
916
|
return val;
|
|
911
917
|
}
|
|
912
918
|
};
|
|
913
|
-
return
|
|
919
|
+
return $mol_fail(new Error(`Not like (1:${+index + 2})\n${print(head)}\n---\n${print(value)}`));
|
|
914
920
|
}
|
|
915
921
|
}
|
|
916
922
|
}
|
|
917
923
|
$.$mol_assert_like = $mol_assert_like;
|
|
918
924
|
function $mol_assert_dom(left, right) {
|
|
919
|
-
$mol_assert_equal(
|
|
925
|
+
$mol_assert_equal($mol_dom_serialize(left), $mol_dom_serialize(right));
|
|
920
926
|
}
|
|
921
927
|
$.$mol_assert_dom = $mol_assert_dom;
|
|
922
928
|
})($ || ($ = {}));
|
|
923
|
-
//assert.
|
|
929
|
+
//mol/assert/assert.ts
|
|
924
930
|
;
|
|
925
931
|
"use strict";
|
|
926
932
|
var $;
|
|
927
933
|
(function ($) {
|
|
928
|
-
|
|
934
|
+
$mol_test({
|
|
929
935
|
async 'sizes'() {
|
|
930
|
-
const cipher = await
|
|
936
|
+
const cipher = await $mol_crypto_secret.generate();
|
|
931
937
|
const key = await cipher.serial();
|
|
932
|
-
|
|
938
|
+
$mol_assert_equal(key.byteLength, $mol_crypto_secret.size);
|
|
933
939
|
const data = new Uint8Array([1, 2, 3]);
|
|
934
|
-
const salt =
|
|
940
|
+
const salt = $mol_crypto_salt();
|
|
935
941
|
const closed = await cipher.encrypt(data, salt);
|
|
936
|
-
|
|
942
|
+
$mol_assert_equal(closed.byteLength, data.byteLength + $mol_crypto_secret.extra);
|
|
937
943
|
},
|
|
938
944
|
async 'decrypt self encrypted with auto generated key'() {
|
|
939
|
-
const cipher = await
|
|
945
|
+
const cipher = await $mol_crypto_secret.generate();
|
|
940
946
|
const data = new Uint8Array([1, 2, 3]);
|
|
941
|
-
const salt =
|
|
947
|
+
const salt = $mol_crypto_salt();
|
|
942
948
|
const closed = await cipher.encrypt(data, salt);
|
|
943
949
|
const opened = await cipher.decrypt(closed, salt);
|
|
944
|
-
|
|
950
|
+
$mol_assert_like(data, new Uint8Array(opened));
|
|
945
951
|
},
|
|
946
952
|
async 'decrypt encrypted with exported auto generated key'() {
|
|
947
953
|
const data = new Uint8Array([1, 2, 3]);
|
|
948
|
-
const salt =
|
|
949
|
-
const Alice = await
|
|
954
|
+
const salt = $mol_crypto_salt();
|
|
955
|
+
const Alice = await $mol_crypto_secret.generate();
|
|
950
956
|
const closed = await Alice.encrypt(data, salt);
|
|
951
|
-
const Bob = await
|
|
957
|
+
const Bob = await $mol_crypto_secret.from(await Alice.serial());
|
|
952
958
|
const opened = await Bob.decrypt(closed, salt);
|
|
953
|
-
|
|
959
|
+
$mol_assert_like(data, new Uint8Array(opened));
|
|
954
960
|
},
|
|
955
961
|
});
|
|
956
962
|
})($ || ($ = {}));
|
|
957
|
-
//secret.test.
|
|
963
|
+
//mol/crypto/secret/secret.test.ts
|
|
958
964
|
;
|
|
959
965
|
"use strict";
|
|
960
966
|
var $;
|
|
961
967
|
(function ($) {
|
|
962
|
-
|
|
968
|
+
$mol_test({
|
|
963
969
|
async 'sizes'() {
|
|
964
|
-
const pair = await
|
|
970
|
+
const pair = await $$.$mol_crypto_cipher_pair();
|
|
965
971
|
const key_private = await pair.private.serial();
|
|
966
|
-
|
|
967
|
-
|
|
972
|
+
$mol_assert_ok(key_private.byteLength > 630);
|
|
973
|
+
$mol_assert_ok(key_private.byteLength < 640);
|
|
968
974
|
const key_public = await pair.public.serial();
|
|
969
|
-
|
|
975
|
+
$mol_assert_equal(key_public.byteLength, $mol_crypto_cipher_public.size);
|
|
970
976
|
const data = new Uint8Array([1, 2, 3]);
|
|
971
977
|
const closed = await pair.public.encrypt(data);
|
|
972
|
-
|
|
978
|
+
$mol_assert_equal(closed.byteLength, $mol_crypto_cipher_ecrypted_size);
|
|
973
979
|
},
|
|
974
980
|
async 'decrypt self encrypted with auto generated key'() {
|
|
975
|
-
const pair = await
|
|
981
|
+
const pair = await $$.$mol_crypto_cipher_pair();
|
|
976
982
|
const data = new Uint8Array([1, 2, 3]);
|
|
977
983
|
const closed = await pair.public.encrypt(data);
|
|
978
984
|
const opened = await pair.private.decrypt(closed);
|
|
979
|
-
|
|
985
|
+
$mol_assert_like(data, new Uint8Array(opened));
|
|
980
986
|
},
|
|
981
987
|
async 'decrypt encrypted with exported auto generated key'() {
|
|
982
|
-
const pair = await
|
|
988
|
+
const pair = await $$.$mol_crypto_cipher_pair();
|
|
983
989
|
const data = new Uint8Array([1, 2, 3]);
|
|
984
|
-
const Alice = await
|
|
990
|
+
const Alice = await $mol_crypto_cipher_public.from(await pair.public.serial());
|
|
985
991
|
const closed = await Alice.encrypt(data);
|
|
986
|
-
const Bob = await
|
|
992
|
+
const Bob = await $mol_crypto_cipher_private.from(await pair.private.serial());
|
|
987
993
|
const opened = await Bob.decrypt(closed);
|
|
988
|
-
|
|
994
|
+
$mol_assert_like(data, new Uint8Array(opened));
|
|
989
995
|
},
|
|
990
996
|
});
|
|
991
997
|
})($ || ($ = {}));
|
|
992
|
-
//cipher.test.
|
|
998
|
+
//mol/crypto/cipher/cipher.test.ts
|
|
993
999
|
;
|
|
994
1000
|
"use strict";
|
|
995
1001
|
var $;
|
|
996
1002
|
(function ($) {
|
|
997
|
-
|
|
1003
|
+
$mol_test({
|
|
998
1004
|
async 'sizes'() {
|
|
999
|
-
const pair = await
|
|
1005
|
+
const pair = await $$.$mol_crypto_auditor_pair();
|
|
1000
1006
|
const key_private = await pair.private.serial();
|
|
1001
|
-
|
|
1007
|
+
$mol_assert_equal(key_private.byteLength, $mol_crypto_auditor_private.size);
|
|
1002
1008
|
const key_public = await pair.public.serial();
|
|
1003
|
-
|
|
1009
|
+
$mol_assert_equal(key_public.byteLength, $mol_crypto_auditor_public.size);
|
|
1004
1010
|
const data = new Uint8Array([1, 2, 3]);
|
|
1005
1011
|
const sign = await pair.private.sign(data);
|
|
1006
|
-
|
|
1012
|
+
$mol_assert_equal(sign.byteLength, $mol_crypto_auditor_sign_size);
|
|
1007
1013
|
},
|
|
1008
1014
|
async 'verify self signed with auto generated key'() {
|
|
1009
|
-
const auditor = await
|
|
1015
|
+
const auditor = await $$.$mol_crypto_auditor_pair();
|
|
1010
1016
|
const data = new Uint8Array([1, 2, 3]);
|
|
1011
1017
|
const sign = await auditor.private.sign(data);
|
|
1012
|
-
|
|
1018
|
+
$mol_assert_ok(await auditor.public.verify(data, sign));
|
|
1013
1019
|
},
|
|
1014
1020
|
async 'verify signed with exported auto generated key'() {
|
|
1015
|
-
const pair = await
|
|
1021
|
+
const pair = await $$.$mol_crypto_auditor_pair();
|
|
1016
1022
|
const data = new Uint8Array([1, 2, 3]);
|
|
1017
|
-
const Alice = await
|
|
1023
|
+
const Alice = await $mol_crypto_auditor_private.from(await pair.private.serial());
|
|
1018
1024
|
const sign = await Alice.sign(data);
|
|
1019
|
-
const Bob = await
|
|
1020
|
-
|
|
1025
|
+
const Bob = await $mol_crypto_auditor_public.from(await pair.public.serial());
|
|
1026
|
+
$mol_assert_ok(await Bob.verify(data, sign));
|
|
1021
1027
|
},
|
|
1022
1028
|
});
|
|
1023
1029
|
})($ || ($ = {}));
|
|
1024
|
-
//auditor.test.
|
|
1030
|
+
//mol/crypto/auditor/auditor.test.ts
|
|
1025
1031
|
;
|
|
1026
1032
|
"use strict";
|
|
1027
1033
|
var $;
|
|
@@ -1045,7 +1051,7 @@ var $;
|
|
|
1045
1051
|
$.$mol_log3_area_lazy = $mol_log3_area_lazy;
|
|
1046
1052
|
$.$mol_log3_stack = [];
|
|
1047
1053
|
})($ || ($ = {}));
|
|
1048
|
-
//log3.
|
|
1054
|
+
//mol/log3/log3.ts
|
|
1049
1055
|
;
|
|
1050
1056
|
"use strict";
|
|
1051
1057
|
var $;
|
|
@@ -1073,12 +1079,12 @@ var $;
|
|
|
1073
1079
|
$.$mol_log3_rise = $mol_log3_node_make('log', 'stdout', 'rise', 'magenta');
|
|
1074
1080
|
$.$mol_log3_area = $mol_log3_node_make('log', 'stdout', 'area', 'cyan');
|
|
1075
1081
|
})($ || ($ = {}));
|
|
1076
|
-
//log3.node.
|
|
1082
|
+
//mol/log3/log3.node.ts
|
|
1077
1083
|
;
|
|
1078
1084
|
"use strict";
|
|
1079
1085
|
var $;
|
|
1080
1086
|
(function ($_1) {
|
|
1081
|
-
$
|
|
1087
|
+
$mol_test_mocks.push($ => {
|
|
1082
1088
|
$.$mol_log3_come = () => { };
|
|
1083
1089
|
$.$mol_log3_done = () => { };
|
|
1084
1090
|
$.$mol_log3_fail = () => { };
|
|
@@ -1087,7 +1093,7 @@ var $;
|
|
|
1087
1093
|
$.$mol_log3_area = () => () => { };
|
|
1088
1094
|
});
|
|
1089
1095
|
})($ || ($ = {}));
|
|
1090
|
-
//log3.test.
|
|
1096
|
+
//mol/log3/log3.test.ts
|
|
1091
1097
|
;
|
|
1092
1098
|
"use strict";
|
|
1093
1099
|
var $;
|
|
@@ -1097,7 +1103,7 @@ var $;
|
|
|
1097
1103
|
}
|
|
1098
1104
|
$.$mol_env = $mol_env;
|
|
1099
1105
|
})($ || ($ = {}));
|
|
1100
|
-
//env.
|
|
1106
|
+
//mol/env/env.ts
|
|
1101
1107
|
;
|
|
1102
1108
|
"use strict";
|
|
1103
1109
|
var $;
|
|
@@ -1106,7 +1112,7 @@ var $;
|
|
|
1106
1112
|
return this.process.env;
|
|
1107
1113
|
};
|
|
1108
1114
|
})($ || ($ = {}));
|
|
1109
|
-
//env.node.
|
|
1115
|
+
//mol/env/env.node.ts
|
|
1110
1116
|
;
|
|
1111
1117
|
"use strict";
|
|
1112
1118
|
var $;
|
|
@@ -1126,14 +1132,14 @@ var $;
|
|
|
1126
1132
|
env: this.$mol_env(),
|
|
1127
1133
|
});
|
|
1128
1134
|
if (res.status || res.error)
|
|
1129
|
-
return
|
|
1135
|
+
return $mol_fail(res.error || new Error(res.stderr.toString()));
|
|
1130
1136
|
if (!res.stdout)
|
|
1131
1137
|
res.stdout = Buffer.from([]);
|
|
1132
1138
|
return res;
|
|
1133
1139
|
}
|
|
1134
1140
|
$.$mol_exec = $mol_exec;
|
|
1135
1141
|
})($ || ($ = {}));
|
|
1136
|
-
//exec.node.
|
|
1142
|
+
//mol/exec/exec.node.ts
|
|
1137
1143
|
;
|
|
1138
1144
|
"use strict";
|
|
1139
1145
|
var $;
|
|
@@ -1144,29 +1150,29 @@ var $;
|
|
|
1144
1150
|
}
|
|
1145
1151
|
$.$mol_ambient = $mol_ambient;
|
|
1146
1152
|
})($ || ($ = {}));
|
|
1147
|
-
//ambient.
|
|
1153
|
+
//mol/ambient/ambient.ts
|
|
1148
1154
|
;
|
|
1149
1155
|
"use strict";
|
|
1150
1156
|
var $;
|
|
1151
1157
|
(function ($) {
|
|
1152
|
-
|
|
1158
|
+
$mol_test({
|
|
1153
1159
|
'get'() {
|
|
1154
|
-
const proxy =
|
|
1155
|
-
|
|
1160
|
+
const proxy = $mol_delegate({}, () => ({ foo: 777 }));
|
|
1161
|
+
$mol_assert_equal(proxy.foo, 777);
|
|
1156
1162
|
},
|
|
1157
1163
|
'has'() {
|
|
1158
|
-
const proxy =
|
|
1159
|
-
|
|
1164
|
+
const proxy = $mol_delegate({}, () => ({ foo: 777 }));
|
|
1165
|
+
$mol_assert_equal('foo' in proxy, true);
|
|
1160
1166
|
},
|
|
1161
1167
|
'set'() {
|
|
1162
1168
|
const target = { foo: 777 };
|
|
1163
|
-
const proxy =
|
|
1169
|
+
const proxy = $mol_delegate({}, () => target);
|
|
1164
1170
|
proxy.foo = 123;
|
|
1165
|
-
|
|
1171
|
+
$mol_assert_equal(target.foo, 123);
|
|
1166
1172
|
},
|
|
1167
1173
|
'getOwnPropertyDescriptor'() {
|
|
1168
|
-
const proxy =
|
|
1169
|
-
|
|
1174
|
+
const proxy = $mol_delegate({}, () => ({ foo: 777 }));
|
|
1175
|
+
$mol_assert_like(Object.getOwnPropertyDescriptor(proxy, 'foo'), {
|
|
1170
1176
|
value: 777,
|
|
1171
1177
|
writable: true,
|
|
1172
1178
|
enumerable: true,
|
|
@@ -1174,40 +1180,40 @@ var $;
|
|
|
1174
1180
|
});
|
|
1175
1181
|
},
|
|
1176
1182
|
'ownKeys'() {
|
|
1177
|
-
const proxy =
|
|
1178
|
-
|
|
1183
|
+
const proxy = $mol_delegate({}, () => ({ foo: 777, [Symbol.toStringTag]: 'bar' }));
|
|
1184
|
+
$mol_assert_like(Reflect.ownKeys(proxy), ['foo', Symbol.toStringTag]);
|
|
1179
1185
|
},
|
|
1180
1186
|
'getPrototypeOf'() {
|
|
1181
1187
|
class Foo {
|
|
1182
1188
|
}
|
|
1183
|
-
const proxy =
|
|
1184
|
-
|
|
1189
|
+
const proxy = $mol_delegate({}, () => new Foo);
|
|
1190
|
+
$mol_assert_equal(Object.getPrototypeOf(proxy), Foo.prototype);
|
|
1185
1191
|
},
|
|
1186
1192
|
'setPrototypeOf'() {
|
|
1187
1193
|
class Foo {
|
|
1188
1194
|
}
|
|
1189
1195
|
const target = {};
|
|
1190
|
-
const proxy =
|
|
1196
|
+
const proxy = $mol_delegate({}, () => target);
|
|
1191
1197
|
Object.setPrototypeOf(proxy, Foo.prototype);
|
|
1192
|
-
|
|
1198
|
+
$mol_assert_equal(Object.getPrototypeOf(target), Foo.prototype);
|
|
1193
1199
|
},
|
|
1194
1200
|
'instanceof'() {
|
|
1195
1201
|
class Foo {
|
|
1196
1202
|
}
|
|
1197
|
-
const proxy =
|
|
1198
|
-
|
|
1199
|
-
|
|
1203
|
+
const proxy = $mol_delegate({}, () => new Foo);
|
|
1204
|
+
$mol_assert_ok(proxy instanceof Foo);
|
|
1205
|
+
$mol_assert_ok(proxy instanceof $mol_delegate);
|
|
1200
1206
|
},
|
|
1201
1207
|
'autobind'() {
|
|
1202
1208
|
class Foo {
|
|
1203
1209
|
}
|
|
1204
|
-
const proxy =
|
|
1205
|
-
|
|
1206
|
-
|
|
1210
|
+
const proxy = $mol_delegate({}, () => new Foo);
|
|
1211
|
+
$mol_assert_ok(proxy instanceof Foo);
|
|
1212
|
+
$mol_assert_ok(proxy instanceof $mol_delegate);
|
|
1207
1213
|
},
|
|
1208
1214
|
});
|
|
1209
1215
|
})($ || ($ = {}));
|
|
1210
|
-
//delegate.test.
|
|
1216
|
+
//mol/delegate/delegate.test.ts
|
|
1211
1217
|
;
|
|
1212
1218
|
"use strict";
|
|
1213
1219
|
var $;
|
|
@@ -1244,7 +1250,7 @@ var $;
|
|
|
1244
1250
|
value: (obj) => instances.has(obj),
|
|
1245
1251
|
});
|
|
1246
1252
|
})($ || ($ = {}));
|
|
1247
|
-
//delegate.
|
|
1253
|
+
//mol/delegate/delegate.ts
|
|
1248
1254
|
;
|
|
1249
1255
|
"use strict";
|
|
1250
1256
|
var $;
|
|
@@ -1256,7 +1262,7 @@ var $;
|
|
|
1256
1262
|
return false;
|
|
1257
1263
|
if (typeof having !== 'object')
|
|
1258
1264
|
return false;
|
|
1259
|
-
if (having instanceof
|
|
1265
|
+
if (having instanceof $mol_delegate)
|
|
1260
1266
|
return false;
|
|
1261
1267
|
if (typeof having['destructor'] !== 'function')
|
|
1262
1268
|
return false;
|
|
@@ -1300,30 +1306,30 @@ var $;
|
|
|
1300
1306
|
}
|
|
1301
1307
|
$.$mol_owning_catch = $mol_owning_catch;
|
|
1302
1308
|
})($ || ($ = {}));
|
|
1303
|
-
//owning.
|
|
1309
|
+
//mol/owning/owning.ts
|
|
1304
1310
|
;
|
|
1305
1311
|
"use strict";
|
|
1306
|
-
//writable.test.
|
|
1312
|
+
//mol/type/writable/writable.test.ts
|
|
1307
1313
|
;
|
|
1308
1314
|
"use strict";
|
|
1309
|
-
//writable.
|
|
1315
|
+
//mol/type/writable/writable.ts
|
|
1310
1316
|
;
|
|
1311
1317
|
"use strict";
|
|
1312
1318
|
var $;
|
|
1313
1319
|
(function ($) {
|
|
1314
1320
|
class $mol_object2 {
|
|
1315
1321
|
static $ = $;
|
|
1316
|
-
[
|
|
1322
|
+
[$mol_ambient_ref] = null;
|
|
1317
1323
|
get $() {
|
|
1318
|
-
if (this[
|
|
1319
|
-
return this[
|
|
1320
|
-
const owner =
|
|
1321
|
-
return this[
|
|
1324
|
+
if (this[$mol_ambient_ref])
|
|
1325
|
+
return this[$mol_ambient_ref];
|
|
1326
|
+
const owner = $mol_owning_get(this);
|
|
1327
|
+
return this[$mol_ambient_ref] = owner?.$ || $mol_object2.$;
|
|
1322
1328
|
}
|
|
1323
1329
|
set $(next) {
|
|
1324
|
-
if (this[
|
|
1325
|
-
|
|
1326
|
-
this[
|
|
1330
|
+
if (this[$mol_ambient_ref])
|
|
1331
|
+
$mol_fail_hidden(new Error('Context already defined'));
|
|
1332
|
+
this[$mol_ambient_ref] = next;
|
|
1327
1333
|
}
|
|
1328
1334
|
static create(init) {
|
|
1329
1335
|
const obj = new this;
|
|
@@ -1349,7 +1355,7 @@ var $;
|
|
|
1349
1355
|
}
|
|
1350
1356
|
$.$mol_object2 = $mol_object2;
|
|
1351
1357
|
})($ || ($ = {}));
|
|
1352
|
-
//object2.
|
|
1358
|
+
//mol/object2/object2.ts
|
|
1353
1359
|
;
|
|
1354
1360
|
"use strict";
|
|
1355
1361
|
var $;
|
|
@@ -1360,7 +1366,7 @@ var $;
|
|
|
1360
1366
|
let warned = false;
|
|
1361
1367
|
descr.value = function $mol_deprecated_wrapper(...args) {
|
|
1362
1368
|
if (!warned) {
|
|
1363
|
-
|
|
1369
|
+
$$.$mol_log3_warn({
|
|
1364
1370
|
place: `${host.constructor.name}::${field}`,
|
|
1365
1371
|
message: `Deprecated`,
|
|
1366
1372
|
hint: message,
|
|
@@ -1373,54 +1379,54 @@ var $;
|
|
|
1373
1379
|
}
|
|
1374
1380
|
$.$mol_deprecated = $mol_deprecated;
|
|
1375
1381
|
})($ || ($ = {}));
|
|
1376
|
-
//deprecated.
|
|
1382
|
+
//mol/deprecated/deprecated.ts
|
|
1377
1383
|
;
|
|
1378
1384
|
"use strict";
|
|
1379
1385
|
var $;
|
|
1380
1386
|
(function ($_1) {
|
|
1381
|
-
$
|
|
1387
|
+
$mol_test({
|
|
1382
1388
|
'tree parsing'() {
|
|
1383
|
-
$
|
|
1384
|
-
$
|
|
1385
|
-
$
|
|
1386
|
-
$
|
|
1387
|
-
$
|
|
1388
|
-
$
|
|
1389
|
-
$
|
|
1390
|
-
$
|
|
1389
|
+
$mol_assert_equal($mol_tree.fromString("foo\nbar\n").sub.length, 2);
|
|
1390
|
+
$mol_assert_equal($mol_tree.fromString("foo\nbar\n").sub[1].type, "bar");
|
|
1391
|
+
$mol_assert_equal($mol_tree.fromString("foo\n\n\n").sub.length, 1);
|
|
1392
|
+
$mol_assert_equal($mol_tree.fromString("=foo\n\\bar\n").sub.length, 2);
|
|
1393
|
+
$mol_assert_equal($mol_tree.fromString("=foo\n\\bar\n").sub[1].data, "bar");
|
|
1394
|
+
$mol_assert_equal($mol_tree.fromString("foo bar \\pol").sub[0].sub[0].sub[0].data, "pol");
|
|
1395
|
+
$mol_assert_equal($mol_tree.fromString("foo bar\n\t\\pol\n\t\\men").sub[0].sub[0].sub[1].data, "men");
|
|
1396
|
+
$mol_assert_equal($mol_tree.fromString('foo bar \\text\n').toString(), 'foo bar \\text\n');
|
|
1391
1397
|
},
|
|
1392
1398
|
'inserting'() {
|
|
1393
|
-
$
|
|
1394
|
-
$
|
|
1395
|
-
$
|
|
1396
|
-
$
|
|
1397
|
-
$
|
|
1398
|
-
$
|
|
1399
|
+
$mol_assert_equal($mol_tree.fromString('a b c d').insert(new $mol_tree, 'a', 'b', 'c').toString(), 'a b \\\n');
|
|
1400
|
+
$mol_assert_equal($mol_tree.fromString('a b').insert(new $mol_tree, 'a', 'b', 'c', 'd').toString(), 'a b c \\\n');
|
|
1401
|
+
$mol_assert_equal($mol_tree.fromString('a b c d').insert(new $mol_tree, 0, 0, 0).toString(), 'a b \\\n');
|
|
1402
|
+
$mol_assert_equal($mol_tree.fromString('a b').insert(new $mol_tree, 0, 0, 0, 0).toString(), 'a b \\\n\t\\\n');
|
|
1403
|
+
$mol_assert_equal($mol_tree.fromString('a b c d').insert(new $mol_tree, null, null, null).toString(), 'a b \\\n');
|
|
1404
|
+
$mol_assert_equal($mol_tree.fromString('a b').insert(new $mol_tree, null, null, null, null).toString(), 'a b \\\n\t\\\n');
|
|
1399
1405
|
},
|
|
1400
1406
|
'fromJSON'() {
|
|
1401
|
-
$
|
|
1402
|
-
$
|
|
1403
|
-
$
|
|
1404
|
-
$
|
|
1405
|
-
$
|
|
1407
|
+
$mol_assert_equal($mol_tree.fromJSON([]).toString(), '/\n');
|
|
1408
|
+
$mol_assert_equal($mol_tree.fromJSON([false, true]).toString(), '/\n\tfalse\n\ttrue\n');
|
|
1409
|
+
$mol_assert_equal($mol_tree.fromJSON([0, 1, 2.3]).toString(), '/\n\t0\n\t1\n\t2.3\n');
|
|
1410
|
+
$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');
|
|
1411
|
+
$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');
|
|
1406
1412
|
},
|
|
1407
1413
|
'toJSON'() {
|
|
1408
|
-
$
|
|
1409
|
-
$
|
|
1410
|
-
$
|
|
1411
|
-
$
|
|
1412
|
-
$
|
|
1414
|
+
$mol_assert_equal(JSON.stringify($mol_tree.fromString('/\n').sub[0]), '[]');
|
|
1415
|
+
$mol_assert_equal(JSON.stringify($mol_tree.fromString('/\n\tfalse\n\ttrue\n').sub[0]), '[false,true]');
|
|
1416
|
+
$mol_assert_equal(JSON.stringify($mol_tree.fromString('/\n\t0\n\t1\n\t2.3\n').sub[0]), '[0,1,2.3]');
|
|
1417
|
+
$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"]');
|
|
1418
|
+
$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"}');
|
|
1413
1419
|
},
|
|
1414
1420
|
'hack'() {
|
|
1415
|
-
const res = $
|
|
1421
|
+
const res = $mol_tree.fromString(`foo bar xxx`).hack({
|
|
1416
1422
|
'': (tree, context) => [tree.hack(context)],
|
|
1417
1423
|
'bar': (tree, context) => [tree.hack(context).clone({ type: '777' })],
|
|
1418
1424
|
});
|
|
1419
|
-
$
|
|
1425
|
+
$mol_assert_equal(res.toString(), new $mol_tree({ type: 'foo 777 xxx' }).toString());
|
|
1420
1426
|
},
|
|
1421
1427
|
'errors handling'($) {
|
|
1422
1428
|
const errors = [];
|
|
1423
|
-
class Tree extends $
|
|
1429
|
+
class Tree extends $mol_tree {
|
|
1424
1430
|
static $ = $.$mol_ambient({
|
|
1425
1431
|
$mol_fail: error => errors.push(error.message)
|
|
1426
1432
|
});
|
|
@@ -1429,17 +1435,17 @@ var $;
|
|
|
1429
1435
|
\t \tfoo
|
|
1430
1436
|
bar \\data
|
|
1431
1437
|
`, 'test');
|
|
1432
|
-
$
|
|
1438
|
+
$mol_assert_like(errors, ['Syntax error at test:2\n \tfoo']);
|
|
1433
1439
|
},
|
|
1434
1440
|
});
|
|
1435
1441
|
})($ || ($ = {}));
|
|
1436
|
-
//tree.test.
|
|
1442
|
+
//mol/tree/tree.test.ts
|
|
1437
1443
|
;
|
|
1438
1444
|
"use strict";
|
|
1439
1445
|
var $;
|
|
1440
1446
|
(function ($) {
|
|
1441
1447
|
$.$mol_tree_convert = Symbol('$mol_tree_convert');
|
|
1442
|
-
class $mol_tree extends
|
|
1448
|
+
class $mol_tree extends $mol_object2 {
|
|
1443
1449
|
type;
|
|
1444
1450
|
data;
|
|
1445
1451
|
sub;
|
|
@@ -1752,7 +1758,7 @@ var $;
|
|
|
1752
1758
|
const sub = [].concat(...this.sub.map(child => {
|
|
1753
1759
|
const handle = context[child.type] || context[''];
|
|
1754
1760
|
if (!handle)
|
|
1755
|
-
|
|
1761
|
+
$mol_fail(child.error('Handler not defined'));
|
|
1756
1762
|
return handle(child, context);
|
|
1757
1763
|
}));
|
|
1758
1764
|
return this.clone({ sub });
|
|
@@ -1762,16 +1768,16 @@ var $;
|
|
|
1762
1768
|
}
|
|
1763
1769
|
}
|
|
1764
1770
|
__decorate([
|
|
1765
|
-
|
|
1771
|
+
$mol_deprecated('Use $mol_tree:hack')
|
|
1766
1772
|
], $mol_tree.prototype, "transform", null);
|
|
1767
1773
|
$.$mol_tree = $mol_tree;
|
|
1768
1774
|
})($ || ($ = {}));
|
|
1769
|
-
//tree.
|
|
1775
|
+
//mol/tree/tree.ts
|
|
1770
1776
|
;
|
|
1771
1777
|
"use strict";
|
|
1772
|
-
//equals.test.
|
|
1778
|
+
//mol/type/equals/equals.test.ts
|
|
1773
1779
|
;
|
|
1774
1780
|
"use strict";
|
|
1775
|
-
//equals.
|
|
1781
|
+
//mol/type/equals/equals.ts
|
|
1776
1782
|
|
|
1777
1783
|
//# sourceMappingURL=node.test.js.map
|