Skip to content

Commit

Permalink
Deploying to gh-pages from @ b352636 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
nin-jin committed Nov 5, 2024
1 parent 693ee97 commit bdb792e
Show file tree
Hide file tree
Showing 16 changed files with 767 additions and 635 deletions.
507 changes: 254 additions & 253 deletions node.d.ts

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion node.d.ts.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion node.deps.json

Large diffs are not rendered by default.

18 changes: 15 additions & 3 deletions node.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion node.js.map

Large diffs are not rendered by default.

18 changes: 15 additions & 3 deletions node.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2094,10 +2094,19 @@ var $;
"use strict";
var $;
(function ($) {
const factories = new WeakMap();
function factory(val) {
let make = factories.get(val);
if (make)
return make;
make = $mol_func_name_from((...args) => new val(...args), val);
factories.set(val, make);
return make;
}
function $mol_wire_sync(obj) {
return new Proxy(obj, {
get(obj, field) {
const val = obj[field];
let val = obj[field];
if (typeof val !== 'function')
return val;
const temp = $mol_wire_task.getter(val);
Expand All @@ -2106,10 +2115,13 @@ var $;
return fiber.sync();
};
},
construct(obj, args) {
const temp = $mol_wire_task.getter(factory(obj));
return temp(obj, args).sync();
},
apply(obj, self, args) {
const temp = $mol_wire_task.getter(obj);
const fiber = temp(self, args);
return fiber.sync();
return temp(self, args).sync();
},
});
}
Expand Down
229 changes: 138 additions & 91 deletions node.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2085,10 +2085,19 @@ var $;
"use strict";
var $;
(function ($) {
const factories = new WeakMap();
function factory(val) {
let make = factories.get(val);
if (make)
return make;
make = $mol_func_name_from((...args) => new val(...args), val);
factories.set(val, make);
return make;
}
function $mol_wire_sync(obj) {
return new Proxy(obj, {
get(obj, field) {
const val = obj[field];
let val = obj[field];
if (typeof val !== 'function')
return val;
const temp = $mol_wire_task.getter(val);
Expand All @@ -2097,10 +2106,13 @@ var $;
return fiber.sync();
};
},
construct(obj, args) {
const temp = $mol_wire_task.getter(factory(obj));
return temp(obj, args).sync();
},
apply(obj, self, args) {
const temp = $mol_wire_task.getter(obj);
const fiber = temp(self, args);
return fiber.sync();
return temp(self, args).sync();
},
});
}
Expand Down Expand Up @@ -13213,85 +13225,6 @@ var $;
});
})($ || ($ = {}));

;
"use strict";
var $;
(function ($) {
$mol_test({
'auto name'() {
class Invalid extends $mol_error_mix {
}
const mix = new Invalid('foo');
$mol_assert_equal(mix.name, 'Invalid_Error');
},
'simpe mix'() {
const mix = new $mol_error_mix('foo', {}, new Error('bar'), new Error('lol'));
$mol_assert_equal(mix.message, 'foo');
$mol_assert_equal(mix.errors.map(e => e.message), ['bar', 'lol']);
},
'provide additional info'() {
class Invalid extends $mol_error_mix {
}
const mix = new $mol_error_mix('Wrong password', {}, new Invalid('Too short', { value: 'p@ssw0rd', hint: '> 8 letters' }), new Invalid('Too simple', { value: 'p@ssw0rd', hint: 'need capital letter' }));
const hints = [];
if (mix instanceof $mol_error_mix) {
for (const er of mix.errors) {
if (er instanceof Invalid) {
hints.push(er.cause?.hint ?? '');
}
}
}
$mol_assert_equal(hints, ['> 8 letters', 'need capital letter']);
},
});
})($ || ($ = {}));

;
"use strict";
var $;
(function ($_1) {
$mol_test({
'test types'($) {
class A {
static a() {
return Promise.resolve('');
}
static b() {
return $mol_wire_sync(this).a();
}
}
},
});
})($ || ($ = {}));

;
"use strict";
var $;
(function ($_1) {
$mol_test({
async 'exec timeout auto kill child process'($) {
let close_mock = () => { };
const context_mock = $.$mol_ambient({
$mol_run_spawn: () => ({
on(name, cb) {
if (name === 'exit')
close_mock = cb;
},
kill() { close_mock(); }
})
});
let message = '';
try {
const res = await $mol_wire_async(context_mock).$mol_run({ command: 'sleep 10', dir: '.', timeout: 10, env: { 'MOL_RUN_ASYNC': '1' } });
}
catch (e) {
message = e.message;
}
$mol_assert_equal(message, 'Run error, timeout');
}
});
})($ || ($ = {}));

;
"use strict";
var $;
Expand Down Expand Up @@ -13539,6 +13472,39 @@ var $;
});
})($ || ($ = {}));

;
"use strict";
var $;
(function ($) {
$mol_test({
'auto name'() {
class Invalid extends $mol_error_mix {
}
const mix = new Invalid('foo');
$mol_assert_equal(mix.name, 'Invalid_Error');
},
'simpe mix'() {
const mix = new $mol_error_mix('foo', {}, new Error('bar'), new Error('lol'));
$mol_assert_equal(mix.message, 'foo');
$mol_assert_equal(mix.errors.map(e => e.message), ['bar', 'lol']);
},
'provide additional info'() {
class Invalid extends $mol_error_mix {
}
const mix = new $mol_error_mix('Wrong password', {}, new Invalid('Too short', { value: 'p@ssw0rd', hint: '> 8 letters' }), new Invalid('Too simple', { value: 'p@ssw0rd', hint: 'need capital letter' }));
const hints = [];
if (mix instanceof $mol_error_mix) {
for (const er of mix.errors) {
if (er instanceof Invalid) {
hints.push(er.cause?.hint ?? '');
}
}
}
$mol_assert_equal(hints, ['> 8 letters', 'need capital letter']);
},
});
})($ || ($ = {}));

;
"use strict";
var $;
Expand Down Expand Up @@ -13726,15 +13692,6 @@ var $;
});
})($ || ($ = {}));

;
"use strict";
var $;
(function ($_1) {
$mol_test_mocks.push($ => {
$.$mol_after_timeout = $mol_after_mock_timeout;
});
})($ || ($ = {}));

;
"use strict";
var $;
Expand Down Expand Up @@ -13788,6 +13745,96 @@ var $;
});
})($ || ($ = {}));

;
"use strict";
var $;
(function ($_1) {
$mol_test({
'test types'($) {
class A {
static a() {
return Promise.resolve('');
}
static b() {
return $mol_wire_sync(this).a();
}
}
},
async 'test method from host'($) {
let count = 0;
class A {
static a() {
return $mol_wire_sync(this).b();
}
static b() { return Promise.resolve(++count); }
}
$mol_assert_equal(await $mol_wire_async(A).a(), 1, count);
},
async 'test function'($) {
let count = 0;
class A {
static a() {
return $mol_wire_sync(this.b)();
}
static b() { return Promise.resolve(++count); }
}
$mol_assert_equal(await $mol_wire_async(A).a(), 1, count);
},
async 'test construct itself'($) {
class A {
static instances = [];
static a() {
const a = new ($mol_wire_sync(A))();
this.instances.push(a);
$mol_wire_sync(this).b();
}
static b() { return Promise.resolve(); }
}
await $mol_wire_async(A).a();
$mol_assert_equal(A.instances.length, 2);
$mol_assert_equal(A.instances[0] instanceof A);
$mol_assert_equal(A.instances[0], A.instances[1]);
}
});
})($ || ($ = {}));

;
"use strict";
var $;
(function ($_1) {
$mol_test_mocks.push($ => {
$.$mol_after_timeout = $mol_after_mock_timeout;
});
})($ || ($ = {}));

;
"use strict";
var $;
(function ($_1) {
$mol_test({
async 'exec timeout auto kill child process'($) {
let close_mock = () => { };
const context_mock = $.$mol_ambient({
$mol_run_spawn: () => ({
on(name, cb) {
if (name === 'exit')
close_mock = cb;
},
kill() { close_mock(); }
})
});
let message = '';
try {
const res = await $mol_wire_async(context_mock).$mol_run({ command: 'sleep 10', dir: '.', timeout: 10, env: { 'MOL_RUN_ASYNC': '1' } });
}
catch (e) {
message = e.message;
}
$mol_assert_equal(message, 'Run error, timeout');
}
});
})($ || ($ = {}));

;
"use strict";
var $;
Expand Down
2 changes: 1 addition & 1 deletion node.test.js.map

Large diffs are not rendered by default.

Loading

0 comments on commit bdb792e

Please sign in to comment.