mol_compare_deep 0.0.1347 → 0.0.1348
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 +1 -1
- package/node.js.map +1 -1
- package/node.mjs +1 -1
- package/node.test.js +209 -100
- package/node.test.js.map +1 -1
- package/package.json +1 -1
- package/web.js +1 -1
- package/web.js.map +1 -1
- package/web.mjs +1 -1
- package/web.test.js +3 -22
- package/web.test.js.map +1 -1
package/node.js
CHANGED
|
@@ -59,7 +59,7 @@ var $;
|
|
|
59
59
|
if (left instanceof RegExp)
|
|
60
60
|
return left.source === right.source && left.flags === right.flags;
|
|
61
61
|
if (left instanceof Error)
|
|
62
|
-
return left.message === right.message && left.stack
|
|
62
|
+
return left.message === right.message && $mol_compare_deep(left.stack, right.stack);
|
|
63
63
|
let left_cache = $.$mol_compare_deep_cache.get(left);
|
|
64
64
|
if (left_cache) {
|
|
65
65
|
const right_cache = left_cache.get(right);
|
package/node.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["-","../../../../mam.ts","../../../../mol/compare/deep/deep.ts"],"names":[],"mappings":";;;AAAA;AACA;AACA;AACA;;ACHA,KAAK,CAAC,eAAe,GAAG,EAAE,CAAC;AAK3B,IAAU,CAAC,CAMV;AAND,WAAU,CAAC;AAMX,CAAC,EANS,CAAC,KAAD,CAAC,QAMV;AAED,MAAM,CAAC,OAAO,GAAG,CAAC,CAAA;;;ADblB;AACA;AACA;;;;;;;;;;;;;;;AEFA,IAAU,CAAC,CA6JV;AA7JD,WAAU,CAAC;IAEC,yBAAuB,GAAG,IAAI,OAAO,EAAoC,CAAA;IAMpF,SAAgB,iBAAiB,CAAW,IAAW,EAAE,KAAY;QAEpE,IAAI,MAAM,CAAC,EAAE,CAAE,IAAI,EAAG,KAAK,CAAE;YAAG,OAAO,IAAI,CAAA;QAE3C,IAAI,IAAI,KAAK,IAAI;YAAG,OAAO,KAAK,CAAA;QAChC,IAAI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B,CAAE,IAAI,CAAE,CAAA;QACpD,MAAM,UAAU,GAAG,MAAM,CAAC,mBAAmB,CAAE,KAAK,CAAE,CAAA;QAEtD,IAAI,CAAC,aAAa,CAAE,SAAS,EAAE,UAAU,CAAE;YAAG,OAAO,KAAK,CAAA;QAE1D,KAAK,IAAI,GAAG,IAAI,SAAS,EAAG,CAAC;YAC5B,IAAI,CAAC,iBAAiB,CAAI,IAAa,CAAE,GAAG,CAAE,EAAI,KAAc,CAAE,GAAG,CAAE,CAAE;gBAAG,OAAO,KAAK,CAAA;QACzF,CAAC;QAED,MAAM,SAAS,GAAG,MAAM,CAAC,qBAAqB,CAAE,IAAI,CAAE,CAAA;QACtD,MAAM,UAAU,GAAG,MAAM,CAAC,qBAAqB,CAAE,KAAK,CAAE,CAAA;QAExD,IAAI,CAAC,aAAa,CAAE,SAAS,EAAE,UAAU,CAAE;YAAG,OAAO,KAAK,CAAA;QAE1D,KAAK,IAAI,GAAG,IAAI,SAAS,EAAG,CAAC;YAC5B,IAAI,CAAC,iBAAiB,CAAI,IAAa,CAAE,GAAG,CAAE,EAAI,KAAc,CAAE,GAAG,CAAE,CAAE;gBAAG,OAAO,KAAK,CAAA;QACzF,CAAC;QAED,OAAO,IAAI,CAAA;IACZ,CAAC;IAED,SAAS,iBAAiB,CAAE,IAAQ,EAAE,KAAS;QAC9C,OAAO,MAAM,CAAC,EAAE,CACd,IAAY,CAAE,MAAM,CAAC,WAAW,CAAE,CAAE,SAAS,CAAE,EAC/C,KAAa,CAAE,MAAM,CAAC,WAAW,CAAE,CAAE,SAAS,CAAE,CACjD,CAAA;IACF,CAAC;AAEF,CAAC,EA7JS,CAAC,KAAD,CAAC,QA6JV;;","sourcesContent":[null,"Error.stackTraceLimit = 50;\n\ndeclare let _$_: { new(): {} } & typeof globalThis\ndeclare class $ extends _$_ {}\n\nnamespace $ {\n\texport type $ = typeof $$\n\texport declare class $$ extends $ {}\n\tnamespace $$ {\n\t\texport type $$ = $\n\t}\n}\n\nmodule.exports = $\n","namespace $ {\n\n\texport let $mol_compare_deep_cache = new WeakMap< any , WeakMap< any , boolean > >()\n\t\n\t/**\n\t * Deeply compares two values. Returns true if equal.\n\t * Define `Symbol.toPrimitive` to customize.\n\t */\n\texport function $mol_compare_deep< Value >( left: Value, right: Value ): boolean {\n\n\t\tif( Object.is( left , right ) ) return true\n\n\t\tif( left === null ) return false\n\t\tif( right === null ) return false\n\n\t\tif( typeof left !== 'object' ) return false\n\t\tif( typeof right !== 'object' ) return false\n\n\t\tconst left_proto = Reflect.getPrototypeOf( left as any )\n\t\tconst right_proto = Reflect.getPrototypeOf( right as any )\n\t\t\n\t\tif( left_proto !== right_proto ) return false\n\n\t\tif( left instanceof Boolean ) return Object.is( left.valueOf(), ( right as any )['valueOf']() )\n\t\tif( left instanceof Number ) return Object.is( left.valueOf(), ( right as any )['valueOf']() )\n\t\tif( left instanceof String ) return Object.is( left.valueOf(), ( right as any )['valueOf']() )\n\t\tif( left instanceof Date ) return Object.is( left.valueOf(), ( right as any )['valueOf']() )\n\t\tif( left instanceof RegExp ) return left.source === (right as any).source && left.flags === (right as any).flags\n\t\tif( left instanceof Error ) return left.message === (right as any).message && left.stack === (right as any).stack\n\n\t\tlet left_cache = $mol_compare_deep_cache.get( left )\n\t\tif( left_cache ) {\n\n\t\t\tconst right_cache = left_cache.get( right )\n\t\t\tif( typeof right_cache === 'boolean' ) return right_cache\n\n\t\t} else {\n\t\t\t\n\t\t\tleft_cache = new WeakMap< any , boolean >()\n\t\t\t$mol_compare_deep_cache.set( left , left_cache )\n\n\t\t}\n\n\t\tleft_cache.set(right, true);\n\n\t\tlet result!: boolean\n\n\t\ttry {\n\t\t\t\n\t\t\tif( !left_proto ) result = compare_pojo( left, right as any )\n\t\t\telse if( !Reflect.getPrototypeOf( left_proto ) ) result = compare_pojo( left, right as any )\n\t\t\telse if( Symbol.toPrimitive in left ) result = compare_primitive( left, right )\n\t\t\telse if( Array.isArray( left ) ) result = compare_array( left, right as any )\n\t\t\telse if( left instanceof Set ) result = compare_set( left, right as any )\n\t\t\telse if( left instanceof Map ) result = compare_map( left, right as any )\n\t\t\telse if( ArrayBuffer.isView( left ) ) result = compare_buffer( left, right as any )\n\t\t\telse if( Symbol.iterator in left ) result = compare_iterator( ( left as any )[ Symbol.iterator ](), ( right as any )[ Symbol.iterator ]() )\n\t\t\telse result = false\n\n\t\t} finally {\n\t\t\tleft_cache.set( right , result )\n\t\t}\n\t\t\n\t\treturn result\n\t}\n\n\tfunction compare_array< Value extends any[] >( left: Value, right: Value ): boolean {\n\t\t\n\t\tconst len = left.length\n\t\tif( len !== right.length ) return false\n\t\t\n\t\tfor( let i = 0; i < len; ++i ) {\n\t\t\tif( !$mol_compare_deep( left[i] , right[i] ) ) return false\n\t\t}\n\t\t\n\t\treturn true\n\t}\n\t\n\tfunction compare_buffer( left: ArrayBufferView, right: ArrayBufferView ): boolean {\n\t\t\n\t\tconst len = left.byteLength\n\t\tif( len !== right.byteLength ) return false\n\t\t\n\t\tif( left instanceof DataView ) return compare_buffer(\n\t\t\tnew Uint8Array( left.buffer, left.byteOffset, left.byteLength ),\n\t\t\tnew Uint8Array( right.buffer, right.byteOffset, right.byteLength ),\n\t\t)\n\t\t\n\t\tfor( let i = 0; i < len; ++i ) {\n\t\t\tif( (left as any)[i] !== (right as any)[i] ) return false\n\t\t}\n\t\t\n\t\treturn true\n\t}\n\t\n\tfunction compare_iterator< Value extends IterableIterator<any> >(\n\t\tleft: Value,\n\t\tright: Value,\n\t): boolean {\n\t\t\n\t\twhile( true ) {\n\n\t\t\tconst left_next = left.next()\n\t\t\tconst right_next = right.next()\n\n\t\t\tif( left_next.done !== right_next.done ) return false\n\t\t\tif( left_next.done ) break\n\n\t\t\tif( !$mol_compare_deep( left_next.value , right_next.value ) ) return false\n\n\t\t}\n\n\t\treturn true\n\n\t}\n\t\n\tfunction compare_set< Value extends Set<any> >( left: Value, right: Value ): boolean {\n\t\tif( left.size !== right.size ) return false\n\t\treturn compare_iterator( left.values(), right.values() )\n\t}\n\t\n\tfunction compare_map< Key, Value >( left: Map< Key, Value > , right: Map< Key, Value > ): boolean {\n\t\tif( left.size !== right.size ) return false\n\t\treturn compare_iterator( left.keys(), right.keys() )\n\t\t\t&& compare_iterator( left.values(), right.values() )\n\t}\n\t\n\tfunction compare_pojo( left: {}, right: {} ): boolean {\n\t\t\n\t\tconst left_keys = Object.getOwnPropertyNames( left )\n\t\tconst right_keys = Object.getOwnPropertyNames( right )\n\t\t\n\t\tif( !compare_array( left_keys, right_keys ) ) return false\n\n\t\tfor( let key of left_keys ) {\n\t\t\tif( !$mol_compare_deep( ( left as any )[ key ], ( right as any )[ key ] ) ) return false\n\t\t}\n\n\t\tconst left_syms = Object.getOwnPropertySymbols( left )\n\t\tconst right_syms = Object.getOwnPropertySymbols( right )\n\t\t\n\t\tif( !compare_array( left_syms, right_syms ) ) return false\n\n\t\tfor( let key of left_syms ) {\n\t\t\tif( !$mol_compare_deep( ( left as any )[ key ], ( right as any )[ key ] ) ) return false\n\t\t}\n\n\t\treturn true\n\t}\n\t\n\tfunction compare_primitive( left: {}, right: {} ): boolean {\n\t\treturn Object.is(\n\t\t\t(left as any)[ Symbol.toPrimitive ]( 'default' ),\n\t\t\t(right as any)[ Symbol.toPrimitive ]( 'default' ),\n\t\t)\n\t}\n\t\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["-","../../../../mam.ts","../../../../mol/compare/deep/deep.ts"],"names":[],"mappings":";;;AAAA;AACA;AACA;AACA;;ACHA,KAAK,CAAC,eAAe,GAAG,EAAE,CAAC;AAK3B,IAAU,CAAC,CAMV;AAND,WAAU,CAAC;AAMX,CAAC,EANS,CAAC,KAAD,CAAC,QAMV;AAED,MAAM,CAAC,OAAO,GAAG,CAAC,CAAA;;;ADblB;AACA;AACA;;;;;;;;;;;;;;;AEFA,IAAU,CAAC,CA6JV;AA7JD,WAAU,CAAC;IAEC,yBAAuB,GAAG,IAAI,OAAO,EAAoC,CAAA;IAMpF,SAAgB,iBA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AD,CAAC,QA6JV;;","sourcesContent":[null,"Error.stackTraceLimit = 50;\n\ndeclare let _$_: { new(): {} } & typeof globalThis\ndeclare class $ extends _$_ {}\n\nnamespace $ {\n\texport type $ = typeof $$\n\texport declare class $$ extends $ {}\n\tnamespace $$ {\n\t\texport type $$ = $\n\t}\n}\n\nmodule.exports = $\n","namespace $ {\n\n\texport let $mol_compare_deep_cache = new WeakMap< any , WeakMap< any , boolean > >()\n\t\n\t/**\n\t * Deeply compares two values. Returns true if equal.\n\t * Define `Symbol.toPrimitive` to customize.\n\t */\n\texport function $mol_compare_deep< Value >( left: Value, right: Value ): boolean {\n\n\t\tif( Object.is( left , right ) ) return true\n\n\t\tif( left === null ) return false\n\t\tif( right === null ) return false\n\n\t\tif( typeof left !== 'object' ) return false\n\t\tif( typeof right !== 'object' ) return false\n\n\t\tconst left_proto = Reflect.getPrototypeOf( left as any )\n\t\tconst right_proto = Reflect.getPrototypeOf( right as any )\n\t\t\n\t\tif( left_proto !== right_proto ) return false\n\n\t\tif( left instanceof Boolean ) return Object.is( left.valueOf(), ( right as any )['valueOf']() )\n\t\tif( left instanceof Number ) return Object.is( left.valueOf(), ( right as any )['valueOf']() )\n\t\tif( left instanceof String ) return Object.is( left.valueOf(), ( right as any )['valueOf']() )\n\t\tif( left instanceof Date ) return Object.is( left.valueOf(), ( right as any )['valueOf']() )\n\t\tif( left instanceof RegExp ) return left.source === (right as any).source && left.flags === (right as any).flags\n\t\tif( left instanceof Error ) return left.message === (right as any).message && $mol_compare_deep( left.stack, (right as any).stack )\n\n\t\tlet left_cache = $mol_compare_deep_cache.get( left )\n\t\tif( left_cache ) {\n\n\t\t\tconst right_cache = left_cache.get( right )\n\t\t\tif( typeof right_cache === 'boolean' ) return right_cache\n\n\t\t} else {\n\t\t\t\n\t\t\tleft_cache = new WeakMap< any , boolean >()\n\t\t\t$mol_compare_deep_cache.set( left , left_cache )\n\n\t\t}\n\n\t\tleft_cache.set(right, true);\n\n\t\tlet result!: boolean\n\n\t\ttry {\n\t\t\t\n\t\t\tif( !left_proto ) result = compare_pojo( left, right as any )\n\t\t\telse if( !Reflect.getPrototypeOf( left_proto ) ) result = compare_pojo( left, right as any )\n\t\t\telse if( Symbol.toPrimitive in left ) result = compare_primitive( left, right )\n\t\t\telse if( Array.isArray( left ) ) result = compare_array( left, right as any )\n\t\t\telse if( left instanceof Set ) result = compare_set( left, right as any )\n\t\t\telse if( left instanceof Map ) result = compare_map( left, right as any )\n\t\t\telse if( ArrayBuffer.isView( left ) ) result = compare_buffer( left, right as any )\n\t\t\telse if( Symbol.iterator in left ) result = compare_iterator( ( left as any )[ Symbol.iterator ](), ( right as any )[ Symbol.iterator ]() )\n\t\t\telse result = false\n\n\t\t} finally {\n\t\t\tleft_cache.set( right , result )\n\t\t}\n\t\t\n\t\treturn result\n\t}\n\n\tfunction compare_array< Value extends any[] >( left: Value, right: Value ): boolean {\n\t\t\n\t\tconst len = left.length\n\t\tif( len !== right.length ) return false\n\t\t\n\t\tfor( let i = 0; i < len; ++i ) {\n\t\t\tif( !$mol_compare_deep( left[i] , right[i] ) ) return false\n\t\t}\n\t\t\n\t\treturn true\n\t}\n\t\n\tfunction compare_buffer( left: ArrayBufferView, right: ArrayBufferView ): boolean {\n\t\t\n\t\tconst len = left.byteLength\n\t\tif( len !== right.byteLength ) return false\n\t\t\n\t\tif( left instanceof DataView ) return compare_buffer(\n\t\t\tnew Uint8Array( left.buffer, left.byteOffset, left.byteLength ),\n\t\t\tnew Uint8Array( right.buffer, right.byteOffset, right.byteLength ),\n\t\t)\n\t\t\n\t\tfor( let i = 0; i < len; ++i ) {\n\t\t\tif( (left as any)[i] !== (right as any)[i] ) return false\n\t\t}\n\t\t\n\t\treturn true\n\t}\n\t\n\tfunction compare_iterator< Value extends IterableIterator<any> >(\n\t\tleft: Value,\n\t\tright: Value,\n\t): boolean {\n\t\t\n\t\twhile( true ) {\n\n\t\t\tconst left_next = left.next()\n\t\t\tconst right_next = right.next()\n\n\t\t\tif( left_next.done !== right_next.done ) return false\n\t\t\tif( left_next.done ) break\n\n\t\t\tif( !$mol_compare_deep( left_next.value , right_next.value ) ) return false\n\n\t\t}\n\n\t\treturn true\n\n\t}\n\t\n\tfunction compare_set< Value extends Set<any> >( left: Value, right: Value ): boolean {\n\t\tif( left.size !== right.size ) return false\n\t\treturn compare_iterator( left.values(), right.values() )\n\t}\n\t\n\tfunction compare_map< Key, Value >( left: Map< Key, Value > , right: Map< Key, Value > ): boolean {\n\t\tif( left.size !== right.size ) return false\n\t\treturn compare_iterator( left.keys(), right.keys() )\n\t\t\t&& compare_iterator( left.values(), right.values() )\n\t}\n\t\n\tfunction compare_pojo( left: {}, right: {} ): boolean {\n\t\t\n\t\tconst left_keys = Object.getOwnPropertyNames( left )\n\t\tconst right_keys = Object.getOwnPropertyNames( right )\n\t\t\n\t\tif( !compare_array( left_keys, right_keys ) ) return false\n\n\t\tfor( let key of left_keys ) {\n\t\t\tif( !$mol_compare_deep( ( left as any )[ key ], ( right as any )[ key ] ) ) return false\n\t\t}\n\n\t\tconst left_syms = Object.getOwnPropertySymbols( left )\n\t\tconst right_syms = Object.getOwnPropertySymbols( right )\n\t\t\n\t\tif( !compare_array( left_syms, right_syms ) ) return false\n\n\t\tfor( let key of left_syms ) {\n\t\t\tif( !$mol_compare_deep( ( left as any )[ key ], ( right as any )[ key ] ) ) return false\n\t\t}\n\n\t\treturn true\n\t}\n\t\n\tfunction compare_primitive( left: {}, right: {} ): boolean {\n\t\treturn Object.is(\n\t\t\t(left as any)[ Symbol.toPrimitive ]( 'default' ),\n\t\t\t(right as any)[ Symbol.toPrimitive ]( 'default' ),\n\t\t)\n\t}\n\t\n}\n"]}
|
package/node.mjs
CHANGED
|
@@ -59,7 +59,7 @@ var $;
|
|
|
59
59
|
if (left instanceof RegExp)
|
|
60
60
|
return left.source === right.source && left.flags === right.flags;
|
|
61
61
|
if (left instanceof Error)
|
|
62
|
-
return left.message === right.message && left.stack
|
|
62
|
+
return left.message === right.message && $mol_compare_deep(left.stack, right.stack);
|
|
63
63
|
let left_cache = $.$mol_compare_deep_cache.get(left);
|
|
64
64
|
if (left_cache) {
|
|
65
65
|
const right_cache = left_cache.get(right);
|
package/node.test.js
CHANGED
|
@@ -50,7 +50,7 @@ var $;
|
|
|
50
50
|
if (left instanceof RegExp)
|
|
51
51
|
return left.source === right.source && left.flags === right.flags;
|
|
52
52
|
if (left instanceof Error)
|
|
53
|
-
return left.message === right.message && left.stack
|
|
53
|
+
return left.message === right.message && $mol_compare_deep(left.stack, right.stack);
|
|
54
54
|
let left_cache = $.$mol_compare_deep_cache.get(left);
|
|
55
55
|
if (left_cache) {
|
|
56
56
|
const right_cache = left_cache.get(right);
|
|
@@ -318,80 +318,6 @@ var $;
|
|
|
318
318
|
$.$mol_test_complete = $mol_test_complete;
|
|
319
319
|
})($ || ($ = {}));
|
|
320
320
|
|
|
321
|
-
;
|
|
322
|
-
"use strict";
|
|
323
|
-
var $;
|
|
324
|
-
(function ($) {
|
|
325
|
-
function $mol_fail_log(error) {
|
|
326
|
-
if ($mol_promise_like(error))
|
|
327
|
-
return false;
|
|
328
|
-
if (!$mol_fail_catch(error))
|
|
329
|
-
return false;
|
|
330
|
-
console.error(error);
|
|
331
|
-
return true;
|
|
332
|
-
}
|
|
333
|
-
$.$mol_fail_log = $mol_fail_log;
|
|
334
|
-
})($ || ($ = {}));
|
|
335
|
-
|
|
336
|
-
;
|
|
337
|
-
"use strict";
|
|
338
|
-
var $;
|
|
339
|
-
(function ($_1) {
|
|
340
|
-
$mol_test_mocks.push($ => $.$mol_fail_log = () => false);
|
|
341
|
-
})($ || ($ = {}));
|
|
342
|
-
|
|
343
|
-
;
|
|
344
|
-
"use strict";
|
|
345
|
-
var $node = new Proxy({ require }, {
|
|
346
|
-
get(target, name, wrapper) {
|
|
347
|
-
if (target[name])
|
|
348
|
-
return target[name];
|
|
349
|
-
if (name.startsWith('node:'))
|
|
350
|
-
return target.require(name);
|
|
351
|
-
if (name[0] === '.')
|
|
352
|
-
return target.require(name);
|
|
353
|
-
const mod = target.require('module');
|
|
354
|
-
if (mod.builtinModules.indexOf(name) >= 0)
|
|
355
|
-
return target.require(name);
|
|
356
|
-
try {
|
|
357
|
-
target.require.resolve(name);
|
|
358
|
-
}
|
|
359
|
-
catch {
|
|
360
|
-
const $$ = $;
|
|
361
|
-
$$.$mol_exec('.', 'npm', 'install', '--omit=dev', name);
|
|
362
|
-
try {
|
|
363
|
-
$$.$mol_exec('.', 'npm', 'install', '--omit=dev', '@types/' + name);
|
|
364
|
-
}
|
|
365
|
-
catch (e) {
|
|
366
|
-
if ($$.$mol_fail_catch(e)) {
|
|
367
|
-
$$.$mol_fail_log(e);
|
|
368
|
-
}
|
|
369
|
-
}
|
|
370
|
-
}
|
|
371
|
-
try {
|
|
372
|
-
return target.require(name);
|
|
373
|
-
}
|
|
374
|
-
catch (error) {
|
|
375
|
-
if ($.$mol_fail_catch(error) && error.code === 'ERR_REQUIRE_ESM') {
|
|
376
|
-
const module = cache.get(name);
|
|
377
|
-
if (module)
|
|
378
|
-
return module;
|
|
379
|
-
throw import(name).then(module => cache.set(name, module));
|
|
380
|
-
}
|
|
381
|
-
$.$mol_fail_log(error);
|
|
382
|
-
return null;
|
|
383
|
-
}
|
|
384
|
-
},
|
|
385
|
-
set(target, name, value) {
|
|
386
|
-
target[name] = value;
|
|
387
|
-
return true;
|
|
388
|
-
},
|
|
389
|
-
});
|
|
390
|
-
const cache = new Map();
|
|
391
|
-
require = (req => Object.assign(function require(name) {
|
|
392
|
-
return $node[name];
|
|
393
|
-
}, req))(require);
|
|
394
|
-
|
|
395
321
|
;
|
|
396
322
|
"use strict";
|
|
397
323
|
var $;
|
|
@@ -417,7 +343,7 @@ var $;
|
|
|
417
343
|
catch (error) {
|
|
418
344
|
$.$mol_fail = fail;
|
|
419
345
|
if (typeof ErrorRight === 'string') {
|
|
420
|
-
$mol_assert_equal(error.message, ErrorRight);
|
|
346
|
+
$mol_assert_equal(error.message ?? error, ErrorRight);
|
|
421
347
|
}
|
|
422
348
|
else {
|
|
423
349
|
$mol_assert_equal(error instanceof ErrorRight, true);
|
|
@@ -441,7 +367,7 @@ var $;
|
|
|
441
367
|
continue;
|
|
442
368
|
if (!$mol_compare_deep(args[i], args[j]))
|
|
443
369
|
continue;
|
|
444
|
-
$mol_fail(new Error(`
|
|
370
|
+
return $mol_fail(new Error(`Uniquesess assertion failure`, { cause: { [i]: args[i], [i]: args[i] } }));
|
|
445
371
|
}
|
|
446
372
|
}
|
|
447
373
|
}
|
|
@@ -452,29 +378,10 @@ var $;
|
|
|
452
378
|
continue;
|
|
453
379
|
if (args[0] instanceof $mol_dom_context.Element && args[i] instanceof $mol_dom_context.Element && args[0].outerHTML === args[i].outerHTML)
|
|
454
380
|
continue;
|
|
455
|
-
return $mol_fail(new Error(`args[0]
|
|
381
|
+
return $mol_fail(new Error(`Equality assertion failure`, { cause: { 0: args[0], [i]: args[i] } }));
|
|
456
382
|
}
|
|
457
383
|
}
|
|
458
384
|
$.$mol_assert_equal = $mol_assert_equal;
|
|
459
|
-
const print = (val) => {
|
|
460
|
-
if (!val)
|
|
461
|
-
return val;
|
|
462
|
-
if (typeof val === 'bigint')
|
|
463
|
-
return String(val) + 'n';
|
|
464
|
-
if (typeof val === 'symbol')
|
|
465
|
-
return `Symbol(${val.description})`;
|
|
466
|
-
if (typeof val !== 'object')
|
|
467
|
-
return val;
|
|
468
|
-
if ('outerHTML' in val)
|
|
469
|
-
return val.outerHTML;
|
|
470
|
-
try {
|
|
471
|
-
return JSON.stringify(val, (k, v) => typeof v === 'bigint' ? String(v) : v, '\t');
|
|
472
|
-
}
|
|
473
|
-
catch (error) {
|
|
474
|
-
console.error(error);
|
|
475
|
-
return val;
|
|
476
|
-
}
|
|
477
|
-
};
|
|
478
385
|
})($ || ($ = {}));
|
|
479
386
|
|
|
480
387
|
;
|
|
@@ -515,6 +422,106 @@ var $;
|
|
|
515
422
|
});
|
|
516
423
|
})($ || ($ = {}));
|
|
517
424
|
|
|
425
|
+
;
|
|
426
|
+
"use strict";
|
|
427
|
+
var $;
|
|
428
|
+
(function ($) {
|
|
429
|
+
function $mol_try(handler) {
|
|
430
|
+
try {
|
|
431
|
+
return handler();
|
|
432
|
+
}
|
|
433
|
+
catch (error) {
|
|
434
|
+
return error;
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
$.$mol_try = $mol_try;
|
|
438
|
+
})($ || ($ = {}));
|
|
439
|
+
|
|
440
|
+
;
|
|
441
|
+
"use strict";
|
|
442
|
+
var $;
|
|
443
|
+
(function ($) {
|
|
444
|
+
$mol_test({
|
|
445
|
+
'return result without errors'() {
|
|
446
|
+
$mol_assert_equal($mol_try(() => false), false);
|
|
447
|
+
},
|
|
448
|
+
});
|
|
449
|
+
})($ || ($ = {}));
|
|
450
|
+
|
|
451
|
+
;
|
|
452
|
+
"use strict";
|
|
453
|
+
var $;
|
|
454
|
+
(function ($) {
|
|
455
|
+
function $mol_fail_log(error) {
|
|
456
|
+
if ($mol_promise_like(error))
|
|
457
|
+
return false;
|
|
458
|
+
if (!$mol_fail_catch(error))
|
|
459
|
+
return false;
|
|
460
|
+
$mol_try(() => { $mol_fail_hidden(error); });
|
|
461
|
+
return true;
|
|
462
|
+
}
|
|
463
|
+
$.$mol_fail_log = $mol_fail_log;
|
|
464
|
+
})($ || ($ = {}));
|
|
465
|
+
|
|
466
|
+
;
|
|
467
|
+
"use strict";
|
|
468
|
+
var $;
|
|
469
|
+
(function ($_1) {
|
|
470
|
+
$mol_test_mocks.push($ => $.$mol_fail_log = () => false);
|
|
471
|
+
})($ || ($ = {}));
|
|
472
|
+
|
|
473
|
+
;
|
|
474
|
+
"use strict";
|
|
475
|
+
var $node = new Proxy({ require }, {
|
|
476
|
+
get(target, name, wrapper) {
|
|
477
|
+
if (target[name])
|
|
478
|
+
return target[name];
|
|
479
|
+
if (name.startsWith('node:'))
|
|
480
|
+
return target.require(name);
|
|
481
|
+
if (name[0] === '.')
|
|
482
|
+
return target.require(name);
|
|
483
|
+
const mod = target.require('module');
|
|
484
|
+
if (mod.builtinModules.indexOf(name) >= 0)
|
|
485
|
+
return target.require(name);
|
|
486
|
+
try {
|
|
487
|
+
target.require.resolve(name);
|
|
488
|
+
}
|
|
489
|
+
catch {
|
|
490
|
+
const $$ = $;
|
|
491
|
+
$$.$mol_exec('.', 'npm', 'install', '--omit=dev', name);
|
|
492
|
+
try {
|
|
493
|
+
$$.$mol_exec('.', 'npm', 'install', '--omit=dev', '@types/' + name);
|
|
494
|
+
}
|
|
495
|
+
catch (e) {
|
|
496
|
+
if ($$.$mol_fail_catch(e)) {
|
|
497
|
+
$$.$mol_fail_log(e);
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
try {
|
|
502
|
+
return target.require(name);
|
|
503
|
+
}
|
|
504
|
+
catch (error) {
|
|
505
|
+
if ($.$mol_fail_catch(error) && error.code === 'ERR_REQUIRE_ESM') {
|
|
506
|
+
const module = cache.get(name);
|
|
507
|
+
if (module)
|
|
508
|
+
return module;
|
|
509
|
+
throw import(name).then(module => cache.set(name, module));
|
|
510
|
+
}
|
|
511
|
+
$.$mol_fail_log(error);
|
|
512
|
+
return null;
|
|
513
|
+
}
|
|
514
|
+
},
|
|
515
|
+
set(target, name, value) {
|
|
516
|
+
target[name] = value;
|
|
517
|
+
return true;
|
|
518
|
+
},
|
|
519
|
+
});
|
|
520
|
+
const cache = new Map();
|
|
521
|
+
require = (req => Object.assign(function require(name) {
|
|
522
|
+
return $node[name];
|
|
523
|
+
}, req))(require);
|
|
524
|
+
|
|
518
525
|
;
|
|
519
526
|
"use strict";
|
|
520
527
|
var $;
|
|
@@ -1610,7 +1617,7 @@ var $;
|
|
|
1610
1617
|
get: () => stack_get() + '\n' + [
|
|
1611
1618
|
this.cause ?? 'no cause',
|
|
1612
1619
|
...this.errors.flatMap(e => [
|
|
1613
|
-
e.stack,
|
|
1620
|
+
String(e.stack),
|
|
1614
1621
|
...e instanceof $mol_error_mix || !e.cause ? [] : [e.cause]
|
|
1615
1622
|
])
|
|
1616
1623
|
].map(frame_normalize).join('\n')
|
|
@@ -1848,6 +1855,17 @@ var $;
|
|
|
1848
1855
|
$.$mol_dev_format_register = $mol_dev_format_register;
|
|
1849
1856
|
$.$mol_dev_format_head = Symbol('$mol_dev_format_head');
|
|
1850
1857
|
$.$mol_dev_format_body = Symbol('$mol_dev_format_body');
|
|
1858
|
+
function $mol_dev_format_button(label, click) {
|
|
1859
|
+
return $mol_dev_format_auto({
|
|
1860
|
+
[$.$mol_dev_format_head]() {
|
|
1861
|
+
return $mol_dev_format_span({ color: 'cornflowerblue' }, label);
|
|
1862
|
+
},
|
|
1863
|
+
[$.$mol_dev_format_body]() {
|
|
1864
|
+
Promise.resolve().then(click);
|
|
1865
|
+
return $mol_dev_format_span({});
|
|
1866
|
+
}
|
|
1867
|
+
});
|
|
1868
|
+
}
|
|
1851
1869
|
$mol_dev_format_register({
|
|
1852
1870
|
header: (val, config = false) => {
|
|
1853
1871
|
if (config)
|
|
@@ -1865,13 +1883,41 @@ var $;
|
|
|
1865
1883
|
if (typeof val === 'function') {
|
|
1866
1884
|
return $mol_dev_format_native(val);
|
|
1867
1885
|
}
|
|
1886
|
+
if (Error.isError(val)) {
|
|
1887
|
+
return $mol_dev_format_span({}, $mol_dev_format_native(val), ' ', $mol_dev_format_button('throw', () => $mol_fail_hidden(val)));
|
|
1888
|
+
}
|
|
1889
|
+
if (val instanceof Promise) {
|
|
1890
|
+
return $.$mol_dev_format_shade($mol_dev_format_native(val), ' ', val[Symbol.toStringTag] ?? '');
|
|
1891
|
+
}
|
|
1868
1892
|
if (Symbol.toStringTag in val) {
|
|
1869
1893
|
return $mol_dev_format_native(val);
|
|
1870
1894
|
}
|
|
1871
1895
|
return null;
|
|
1872
1896
|
},
|
|
1873
|
-
hasBody: val =>
|
|
1874
|
-
|
|
1897
|
+
hasBody: (val, config = false) => {
|
|
1898
|
+
if (config)
|
|
1899
|
+
return false;
|
|
1900
|
+
if (!val)
|
|
1901
|
+
return false;
|
|
1902
|
+
if (val[$.$mol_dev_format_body])
|
|
1903
|
+
return true;
|
|
1904
|
+
return false;
|
|
1905
|
+
},
|
|
1906
|
+
body: (val, config = false) => {
|
|
1907
|
+
if (config)
|
|
1908
|
+
return null;
|
|
1909
|
+
if (!val)
|
|
1910
|
+
return null;
|
|
1911
|
+
if ($.$mol_dev_format_body in val) {
|
|
1912
|
+
try {
|
|
1913
|
+
return val[$.$mol_dev_format_body]();
|
|
1914
|
+
}
|
|
1915
|
+
catch (error) {
|
|
1916
|
+
return $.$mol_dev_format_accent($mol_dev_format_native(val), '💨', $mol_dev_format_native(error), '');
|
|
1917
|
+
}
|
|
1918
|
+
}
|
|
1919
|
+
return null;
|
|
1920
|
+
},
|
|
1875
1921
|
});
|
|
1876
1922
|
function $mol_dev_format_native(obj) {
|
|
1877
1923
|
if (typeof obj === 'undefined')
|
|
@@ -1937,6 +1983,69 @@ var $;
|
|
|
1937
1983
|
$.$mol_dev_format_indent = $.$mol_dev_format_div.bind(null, {
|
|
1938
1984
|
'margin-left': '13px'
|
|
1939
1985
|
});
|
|
1986
|
+
class Stack extends Array {
|
|
1987
|
+
toString() {
|
|
1988
|
+
return this.join('\n');
|
|
1989
|
+
}
|
|
1990
|
+
}
|
|
1991
|
+
class Call extends Object {
|
|
1992
|
+
type;
|
|
1993
|
+
function;
|
|
1994
|
+
method;
|
|
1995
|
+
eval;
|
|
1996
|
+
source;
|
|
1997
|
+
offset;
|
|
1998
|
+
pos;
|
|
1999
|
+
object;
|
|
2000
|
+
flags;
|
|
2001
|
+
[Symbol.toStringTag];
|
|
2002
|
+
constructor(call) {
|
|
2003
|
+
super();
|
|
2004
|
+
this.type = call.getTypeName() ?? '';
|
|
2005
|
+
this.function = call.getFunctionName() ?? '';
|
|
2006
|
+
this.method = call.getMethodName() ?? '';
|
|
2007
|
+
if (this.method === this.function)
|
|
2008
|
+
this.method = '';
|
|
2009
|
+
this.pos = [call.getEnclosingLineNumber() ?? 0, call.getEnclosingColumnNumber() ?? 0];
|
|
2010
|
+
this.eval = call.getEvalOrigin() ?? '';
|
|
2011
|
+
this.source = call.getScriptNameOrSourceURL() ?? '';
|
|
2012
|
+
this.object = call.getThis();
|
|
2013
|
+
this.offset = call.getPosition();
|
|
2014
|
+
const flags = [];
|
|
2015
|
+
if (call.isAsync())
|
|
2016
|
+
flags.push('async');
|
|
2017
|
+
if (call.isConstructor())
|
|
2018
|
+
flags.push('constructor');
|
|
2019
|
+
if (call.isEval())
|
|
2020
|
+
flags.push('eval');
|
|
2021
|
+
if (call.isNative())
|
|
2022
|
+
flags.push('native');
|
|
2023
|
+
if (call.isPromiseAll())
|
|
2024
|
+
flags.push('PromiseAll');
|
|
2025
|
+
if (call.isToplevel())
|
|
2026
|
+
flags.push('top');
|
|
2027
|
+
this.flags = flags;
|
|
2028
|
+
const type = this.type ? this.type + '.' : '';
|
|
2029
|
+
const func = this.function || '<anon>';
|
|
2030
|
+
const method = this.method ? ' [' + this.method + '] ' : '';
|
|
2031
|
+
this[Symbol.toStringTag] = `${type}${func}${method}`;
|
|
2032
|
+
}
|
|
2033
|
+
[Symbol.toPrimitive]() {
|
|
2034
|
+
return this.toString();
|
|
2035
|
+
}
|
|
2036
|
+
toString() {
|
|
2037
|
+
const object = this.object || '';
|
|
2038
|
+
const label = this[Symbol.toStringTag];
|
|
2039
|
+
const source = `${this.source}:${this.pos.join(':')} #${this.offset}`;
|
|
2040
|
+
return `\tat ${object}${label} (${source})`;
|
|
2041
|
+
}
|
|
2042
|
+
[$.$mol_dev_format_head]() {
|
|
2043
|
+
return $.$mol_dev_format_div({}, $mol_dev_format_native(this), $.$mol_dev_format_shade(' '), ...this.object ? [
|
|
2044
|
+
$mol_dev_format_native(this.object),
|
|
2045
|
+
] : [], ...this.method ? [$.$mol_dev_format_shade(' ', ' [', this.method, ']')] : [], $.$mol_dev_format_shade(' ', this.flags.join(', ')));
|
|
2046
|
+
}
|
|
2047
|
+
}
|
|
2048
|
+
Error.prepareStackTrace ??= (error, stack) => new Stack(...stack.map(call => new Call(call)));
|
|
1940
2049
|
})($ || ($ = {}));
|
|
1941
2050
|
|
|
1942
2051
|
;
|