mol_dump_lib 0.0.493 → 0.0.495
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 +103 -64
- package/node.d.ts.map +1 -1
- package/node.deps.json +1 -1
- package/node.js +171 -44
- package/node.js.map +1 -1
- package/node.mjs +171 -44
- package/node.test.js +348 -125
- package/node.test.js.map +1 -1
- package/package.json +4 -2
- package/web.d.ts +55 -54
- package/web.d.ts.map +1 -1
- package/web.deps.json +1 -1
- package/web.js +15 -3
- package/web.js.map +1 -1
- package/web.mjs +15 -3
- package/web.test.js +71 -36
- package/web.test.js.map +1 -1
package/web.mjs
CHANGED
|
@@ -4525,10 +4525,19 @@ var $;
|
|
|
4525
4525
|
"use strict";
|
|
4526
4526
|
var $;
|
|
4527
4527
|
(function ($) {
|
|
4528
|
+
const factories = new WeakMap();
|
|
4529
|
+
function factory(val) {
|
|
4530
|
+
let make = factories.get(val);
|
|
4531
|
+
if (make)
|
|
4532
|
+
return make;
|
|
4533
|
+
make = $mol_func_name_from((...args) => new val(...args), val);
|
|
4534
|
+
factories.set(val, make);
|
|
4535
|
+
return make;
|
|
4536
|
+
}
|
|
4528
4537
|
function $mol_wire_sync(obj) {
|
|
4529
4538
|
return new Proxy(obj, {
|
|
4530
4539
|
get(obj, field) {
|
|
4531
|
-
|
|
4540
|
+
let val = obj[field];
|
|
4532
4541
|
if (typeof val !== 'function')
|
|
4533
4542
|
return val;
|
|
4534
4543
|
const temp = $mol_wire_task.getter(val);
|
|
@@ -4537,10 +4546,13 @@ var $;
|
|
|
4537
4546
|
return fiber.sync();
|
|
4538
4547
|
};
|
|
4539
4548
|
},
|
|
4549
|
+
construct(obj, args) {
|
|
4550
|
+
const temp = $mol_wire_task.getter(factory(obj));
|
|
4551
|
+
return temp(obj, args).sync();
|
|
4552
|
+
},
|
|
4540
4553
|
apply(obj, self, args) {
|
|
4541
4554
|
const temp = $mol_wire_task.getter(obj);
|
|
4542
|
-
|
|
4543
|
-
return fiber.sync();
|
|
4555
|
+
return temp(self, args).sync();
|
|
4544
4556
|
},
|
|
4545
4557
|
});
|
|
4546
4558
|
}
|
package/web.test.js
CHANGED
|
@@ -1191,42 +1191,6 @@ var $;
|
|
|
1191
1191
|
});
|
|
1192
1192
|
})($ || ($ = {}));
|
|
1193
1193
|
|
|
1194
|
-
;
|
|
1195
|
-
"use strict";
|
|
1196
|
-
var $;
|
|
1197
|
-
(function ($_1) {
|
|
1198
|
-
$mol_test({
|
|
1199
|
-
'test types'($) {
|
|
1200
|
-
class A {
|
|
1201
|
-
static a() {
|
|
1202
|
-
return Promise.resolve('');
|
|
1203
|
-
}
|
|
1204
|
-
static b() {
|
|
1205
|
-
return $mol_wire_sync(this).a();
|
|
1206
|
-
}
|
|
1207
|
-
}
|
|
1208
|
-
},
|
|
1209
|
-
});
|
|
1210
|
-
})($ || ($ = {}));
|
|
1211
|
-
|
|
1212
|
-
;
|
|
1213
|
-
"use strict";
|
|
1214
|
-
var $;
|
|
1215
|
-
(function ($) {
|
|
1216
|
-
function $mol_wait_timeout_async(timeout) {
|
|
1217
|
-
const promise = $mol_promise();
|
|
1218
|
-
const task = new this.$mol_after_timeout(timeout, () => promise.done());
|
|
1219
|
-
return Object.assign(promise, {
|
|
1220
|
-
destructor: () => task.destructor()
|
|
1221
|
-
});
|
|
1222
|
-
}
|
|
1223
|
-
$.$mol_wait_timeout_async = $mol_wait_timeout_async;
|
|
1224
|
-
function $mol_wait_timeout(timeout) {
|
|
1225
|
-
return this.$mol_wire_sync(this).$mol_wait_timeout_async(timeout);
|
|
1226
|
-
}
|
|
1227
|
-
$.$mol_wait_timeout = $mol_wait_timeout;
|
|
1228
|
-
})($ || ($ = {}));
|
|
1229
|
-
|
|
1230
1194
|
;
|
|
1231
1195
|
"use strict";
|
|
1232
1196
|
var $;
|
|
@@ -1280,6 +1244,77 @@ var $;
|
|
|
1280
1244
|
});
|
|
1281
1245
|
})($ || ($ = {}));
|
|
1282
1246
|
|
|
1247
|
+
;
|
|
1248
|
+
"use strict";
|
|
1249
|
+
var $;
|
|
1250
|
+
(function ($_1) {
|
|
1251
|
+
$mol_test({
|
|
1252
|
+
'test types'($) {
|
|
1253
|
+
class A {
|
|
1254
|
+
static a() {
|
|
1255
|
+
return Promise.resolve('');
|
|
1256
|
+
}
|
|
1257
|
+
static b() {
|
|
1258
|
+
return $mol_wire_sync(this).a();
|
|
1259
|
+
}
|
|
1260
|
+
}
|
|
1261
|
+
},
|
|
1262
|
+
async 'test method from host'($) {
|
|
1263
|
+
let count = 0;
|
|
1264
|
+
class A {
|
|
1265
|
+
static a() {
|
|
1266
|
+
return $mol_wire_sync(this).b();
|
|
1267
|
+
}
|
|
1268
|
+
static b() { return Promise.resolve(++count); }
|
|
1269
|
+
}
|
|
1270
|
+
$mol_assert_equal(await $mol_wire_async(A).a(), 1, count);
|
|
1271
|
+
},
|
|
1272
|
+
async 'test function'($) {
|
|
1273
|
+
let count = 0;
|
|
1274
|
+
class A {
|
|
1275
|
+
static a() {
|
|
1276
|
+
return $mol_wire_sync(this.b)();
|
|
1277
|
+
}
|
|
1278
|
+
static b() { return Promise.resolve(++count); }
|
|
1279
|
+
}
|
|
1280
|
+
$mol_assert_equal(await $mol_wire_async(A).a(), 1, count);
|
|
1281
|
+
},
|
|
1282
|
+
async 'test construct itself'($) {
|
|
1283
|
+
class A {
|
|
1284
|
+
static instances = [];
|
|
1285
|
+
static a() {
|
|
1286
|
+
const a = new ($mol_wire_sync(A))();
|
|
1287
|
+
this.instances.push(a);
|
|
1288
|
+
$mol_wire_sync(this).b();
|
|
1289
|
+
}
|
|
1290
|
+
static b() { return Promise.resolve(); }
|
|
1291
|
+
}
|
|
1292
|
+
await $mol_wire_async(A).a();
|
|
1293
|
+
$mol_assert_equal(A.instances.length, 2);
|
|
1294
|
+
$mol_assert_equal(A.instances[0] instanceof A);
|
|
1295
|
+
$mol_assert_equal(A.instances[0], A.instances[1]);
|
|
1296
|
+
}
|
|
1297
|
+
});
|
|
1298
|
+
})($ || ($ = {}));
|
|
1299
|
+
|
|
1300
|
+
;
|
|
1301
|
+
"use strict";
|
|
1302
|
+
var $;
|
|
1303
|
+
(function ($) {
|
|
1304
|
+
function $mol_wait_timeout_async(timeout) {
|
|
1305
|
+
const promise = $mol_promise();
|
|
1306
|
+
const task = new this.$mol_after_timeout(timeout, () => promise.done());
|
|
1307
|
+
return Object.assign(promise, {
|
|
1308
|
+
destructor: () => task.destructor()
|
|
1309
|
+
});
|
|
1310
|
+
}
|
|
1311
|
+
$.$mol_wait_timeout_async = $mol_wait_timeout_async;
|
|
1312
|
+
function $mol_wait_timeout(timeout) {
|
|
1313
|
+
return this.$mol_wire_sync(this).$mol_wait_timeout_async(timeout);
|
|
1314
|
+
}
|
|
1315
|
+
$.$mol_wait_timeout = $mol_wait_timeout;
|
|
1316
|
+
})($ || ($ = {}));
|
|
1317
|
+
|
|
1283
1318
|
;
|
|
1284
1319
|
"use strict";
|
|
1285
1320
|
var $;
|