mol_tree2 1.0.238 → 1.0.240
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 +78 -1
- package/node.deps.json +1 -1
- package/node.js +198 -0
- package/node.js.map +1 -1
- package/node.mjs +198 -0
- package/node.mjs.map +1 -1
- package/node.test.js +198 -198
- package/node.test.js.map +1 -1
- package/package.json +13 -2
- package/web.d.ts +8 -1
- package/web.deps.json +1 -1
- package/web.js +13 -0
- package/web.js.map +1 -1
- package/web.mjs +13 -0
- package/web.mjs.map +1 -1
- package/web.test.js +0 -13
- package/web.test.js.map +1 -1
package/node.test.js
CHANGED
|
@@ -1153,6 +1153,204 @@ var $;
|
|
|
1153
1153
|
;
|
|
1154
1154
|
"use strict";
|
|
1155
1155
|
var $;
|
|
1156
|
+
(function ($) {
|
|
1157
|
+
})($ || ($ = {}));
|
|
1158
|
+
//mol/dom/context/context.ts
|
|
1159
|
+
;
|
|
1160
|
+
"use strict";
|
|
1161
|
+
//node/node.ts
|
|
1162
|
+
;
|
|
1163
|
+
"use strict";
|
|
1164
|
+
var $node = new Proxy({ require }, {
|
|
1165
|
+
get(target, name, wrapper) {
|
|
1166
|
+
if (target[name])
|
|
1167
|
+
return target[name];
|
|
1168
|
+
const mod = target.require('module');
|
|
1169
|
+
if (mod.builtinModules.indexOf(name) >= 0)
|
|
1170
|
+
return target.require(name);
|
|
1171
|
+
if (name[0] === '.')
|
|
1172
|
+
return target.require(name);
|
|
1173
|
+
const path = target.require('path');
|
|
1174
|
+
const fs = target.require('fs');
|
|
1175
|
+
let dir = path.resolve('.');
|
|
1176
|
+
const suffix = `./node_modules/${name}`;
|
|
1177
|
+
const $$ = $;
|
|
1178
|
+
while (!fs.existsSync(path.join(dir, suffix))) {
|
|
1179
|
+
const parent = path.resolve(dir, '..');
|
|
1180
|
+
if (parent === dir) {
|
|
1181
|
+
$$.$mol_exec('.', 'npm', 'install', '--omit=dev', name);
|
|
1182
|
+
try {
|
|
1183
|
+
$$.$mol_exec('.', 'npm', 'install', '--omit=dev', '@types/' + name);
|
|
1184
|
+
}
|
|
1185
|
+
catch { }
|
|
1186
|
+
break;
|
|
1187
|
+
}
|
|
1188
|
+
else {
|
|
1189
|
+
dir = parent;
|
|
1190
|
+
}
|
|
1191
|
+
}
|
|
1192
|
+
return target.require(name);
|
|
1193
|
+
},
|
|
1194
|
+
set(target, name, value) {
|
|
1195
|
+
target[name] = value;
|
|
1196
|
+
return true;
|
|
1197
|
+
},
|
|
1198
|
+
});
|
|
1199
|
+
require = (req => Object.assign(function require(name) {
|
|
1200
|
+
return $node[name];
|
|
1201
|
+
}, req))(require);
|
|
1202
|
+
//node/node.node.ts
|
|
1203
|
+
;
|
|
1204
|
+
"use strict";
|
|
1205
|
+
var $;
|
|
1206
|
+
(function ($) {
|
|
1207
|
+
function $mol_log3_area_lazy(event) {
|
|
1208
|
+
const self = this;
|
|
1209
|
+
const stack = self.$mol_log3_stack;
|
|
1210
|
+
const deep = stack.length;
|
|
1211
|
+
let logged = false;
|
|
1212
|
+
stack.push(() => {
|
|
1213
|
+
logged = true;
|
|
1214
|
+
self.$mol_log3_area.call(self, event);
|
|
1215
|
+
});
|
|
1216
|
+
return () => {
|
|
1217
|
+
if (logged)
|
|
1218
|
+
self.console.groupEnd();
|
|
1219
|
+
if (stack.length > deep)
|
|
1220
|
+
stack.length = deep;
|
|
1221
|
+
};
|
|
1222
|
+
}
|
|
1223
|
+
$.$mol_log3_area_lazy = $mol_log3_area_lazy;
|
|
1224
|
+
$.$mol_log3_stack = [];
|
|
1225
|
+
})($ || ($ = {}));
|
|
1226
|
+
//mol/log3/log3.ts
|
|
1227
|
+
;
|
|
1228
|
+
"use strict";
|
|
1229
|
+
var $;
|
|
1230
|
+
(function ($) {
|
|
1231
|
+
class $mol_term_color {
|
|
1232
|
+
static reset = this.ansi(0, 0);
|
|
1233
|
+
static bold = this.ansi(1, 22);
|
|
1234
|
+
static italic = this.ansi(3, 23);
|
|
1235
|
+
static underline = this.ansi(4, 24);
|
|
1236
|
+
static inverse = this.ansi(7, 27);
|
|
1237
|
+
static hidden = this.ansi(8, 28);
|
|
1238
|
+
static strike = this.ansi(9, 29);
|
|
1239
|
+
static gray = this.ansi(90, 39);
|
|
1240
|
+
static red = this.ansi(91, 39);
|
|
1241
|
+
static green = this.ansi(92, 39);
|
|
1242
|
+
static yellow = this.ansi(93, 39);
|
|
1243
|
+
static blue = this.ansi(94, 39);
|
|
1244
|
+
static magenta = this.ansi(95, 39);
|
|
1245
|
+
static cyan = this.ansi(96, 39);
|
|
1246
|
+
static Gray = (str) => this.inverse(this.gray(str));
|
|
1247
|
+
static Red = (str) => this.inverse(this.red(str));
|
|
1248
|
+
static Green = (str) => this.inverse(this.green(str));
|
|
1249
|
+
static Yellow = (str) => this.inverse(this.yellow(str));
|
|
1250
|
+
static Blue = (str) => this.inverse(this.blue(str));
|
|
1251
|
+
static Magenta = (str) => this.inverse(this.magenta(str));
|
|
1252
|
+
static Cyan = (str) => this.inverse(this.cyan(str));
|
|
1253
|
+
static ansi(open, close) {
|
|
1254
|
+
if (typeof process === 'undefined')
|
|
1255
|
+
return String;
|
|
1256
|
+
if (!process.stdout.isTTY)
|
|
1257
|
+
return String;
|
|
1258
|
+
const prefix = `\x1b[${open}m`;
|
|
1259
|
+
const postfix = `\x1b[${close}m`;
|
|
1260
|
+
const suffix_regexp = new RegExp(postfix.replace('[', '\\['), 'g');
|
|
1261
|
+
return function colorer(str) {
|
|
1262
|
+
str = String(str);
|
|
1263
|
+
if (str === '')
|
|
1264
|
+
return str;
|
|
1265
|
+
const suffix = str.replace(suffix_regexp, prefix);
|
|
1266
|
+
return prefix + suffix + postfix;
|
|
1267
|
+
};
|
|
1268
|
+
}
|
|
1269
|
+
}
|
|
1270
|
+
$.$mol_term_color = $mol_term_color;
|
|
1271
|
+
})($ || ($ = {}));
|
|
1272
|
+
//mol/term/color/color.ts
|
|
1273
|
+
;
|
|
1274
|
+
"use strict";
|
|
1275
|
+
var $;
|
|
1276
|
+
(function ($) {
|
|
1277
|
+
function $mol_log3_node_make(level, output, type, color) {
|
|
1278
|
+
return function $mol_log3_logger(event) {
|
|
1279
|
+
if (!event.time)
|
|
1280
|
+
event = { time: new Date().toISOString(), ...event };
|
|
1281
|
+
let tree = this.$mol_tree2_from_json(event);
|
|
1282
|
+
tree = tree.struct(type, tree.kids);
|
|
1283
|
+
let str = color(tree.toString());
|
|
1284
|
+
this.console[level](str);
|
|
1285
|
+
const self = this;
|
|
1286
|
+
return () => self.console.groupEnd();
|
|
1287
|
+
};
|
|
1288
|
+
}
|
|
1289
|
+
$.$mol_log3_node_make = $mol_log3_node_make;
|
|
1290
|
+
$.$mol_log3_come = $mol_log3_node_make('info', 'stdout', 'come', $mol_term_color.blue);
|
|
1291
|
+
$.$mol_log3_done = $mol_log3_node_make('info', 'stdout', 'done', $mol_term_color.green);
|
|
1292
|
+
$.$mol_log3_fail = $mol_log3_node_make('error', 'stderr', 'fail', $mol_term_color.red);
|
|
1293
|
+
$.$mol_log3_warn = $mol_log3_node_make('warn', 'stderr', 'warn', $mol_term_color.yellow);
|
|
1294
|
+
$.$mol_log3_rise = $mol_log3_node_make('log', 'stdout', 'rise', $mol_term_color.magenta);
|
|
1295
|
+
$.$mol_log3_area = $mol_log3_node_make('log', 'stdout', 'area', $mol_term_color.cyan);
|
|
1296
|
+
})($ || ($ = {}));
|
|
1297
|
+
//mol/log3/log3.node.ts
|
|
1298
|
+
;
|
|
1299
|
+
"use strict";
|
|
1300
|
+
var $;
|
|
1301
|
+
(function ($) {
|
|
1302
|
+
function $mol_env() {
|
|
1303
|
+
return {};
|
|
1304
|
+
}
|
|
1305
|
+
$.$mol_env = $mol_env;
|
|
1306
|
+
})($ || ($ = {}));
|
|
1307
|
+
//mol/env/env.ts
|
|
1308
|
+
;
|
|
1309
|
+
"use strict";
|
|
1310
|
+
var $;
|
|
1311
|
+
(function ($) {
|
|
1312
|
+
$.$mol_env = function $mol_env() {
|
|
1313
|
+
return this.process.env;
|
|
1314
|
+
};
|
|
1315
|
+
})($ || ($ = {}));
|
|
1316
|
+
//mol/env/env.node.ts
|
|
1317
|
+
;
|
|
1318
|
+
"use strict";
|
|
1319
|
+
var $;
|
|
1320
|
+
(function ($) {
|
|
1321
|
+
function $mol_exec(dir, command, ...args) {
|
|
1322
|
+
let [app, ...args0] = command.split(' ');
|
|
1323
|
+
args = [...args0, ...args];
|
|
1324
|
+
this.$mol_log3_come({
|
|
1325
|
+
place: '$mol_exec',
|
|
1326
|
+
dir: $node.path.relative('', dir),
|
|
1327
|
+
message: 'Run',
|
|
1328
|
+
command: `${app} ${args.join(' ')}`,
|
|
1329
|
+
});
|
|
1330
|
+
var res = $node['child_process'].spawnSync(app, args, {
|
|
1331
|
+
cwd: $node.path.resolve(dir),
|
|
1332
|
+
shell: true,
|
|
1333
|
+
env: this.$mol_env(),
|
|
1334
|
+
});
|
|
1335
|
+
if (res.status || res.error)
|
|
1336
|
+
return $mol_fail(res.error || new Error(res.stderr.toString()));
|
|
1337
|
+
if (!res.stdout)
|
|
1338
|
+
res.stdout = Buffer.from([]);
|
|
1339
|
+
return res;
|
|
1340
|
+
}
|
|
1341
|
+
$.$mol_exec = $mol_exec;
|
|
1342
|
+
})($ || ($ = {}));
|
|
1343
|
+
//mol/exec/exec.node.ts
|
|
1344
|
+
;
|
|
1345
|
+
"use strict";
|
|
1346
|
+
var $;
|
|
1347
|
+
(function ($) {
|
|
1348
|
+
$.$mol_dom_context = new $node.jsdom.JSDOM('', { url: 'https://localhost/' }).window;
|
|
1349
|
+
})($ || ($ = {}));
|
|
1350
|
+
//mol/dom/context/context.node.ts
|
|
1351
|
+
;
|
|
1352
|
+
"use strict";
|
|
1353
|
+
var $;
|
|
1156
1354
|
(function ($) {
|
|
1157
1355
|
function $mol_tree2_xml_from_dom(dom) {
|
|
1158
1356
|
switch (dom.nodeType) {
|
|
@@ -1412,151 +1610,6 @@ var $;
|
|
|
1412
1610
|
;
|
|
1413
1611
|
"use strict";
|
|
1414
1612
|
var $;
|
|
1415
|
-
(function ($) {
|
|
1416
|
-
})($ || ($ = {}));
|
|
1417
|
-
//mol/dom/context/context.ts
|
|
1418
|
-
;
|
|
1419
|
-
"use strict";
|
|
1420
|
-
//node/node.ts
|
|
1421
|
-
;
|
|
1422
|
-
"use strict";
|
|
1423
|
-
var $node = new Proxy({ require }, {
|
|
1424
|
-
get(target, name, wrapper) {
|
|
1425
|
-
if (target[name])
|
|
1426
|
-
return target[name];
|
|
1427
|
-
const mod = target.require('module');
|
|
1428
|
-
if (mod.builtinModules.indexOf(name) >= 0)
|
|
1429
|
-
return target.require(name);
|
|
1430
|
-
if (name[0] === '.')
|
|
1431
|
-
return target.require(name);
|
|
1432
|
-
const path = target.require('path');
|
|
1433
|
-
const fs = target.require('fs');
|
|
1434
|
-
let dir = path.resolve('.');
|
|
1435
|
-
const suffix = `./node_modules/${name}`;
|
|
1436
|
-
const $$ = $;
|
|
1437
|
-
while (!fs.existsSync(path.join(dir, suffix))) {
|
|
1438
|
-
const parent = path.resolve(dir, '..');
|
|
1439
|
-
if (parent === dir) {
|
|
1440
|
-
$$.$mol_exec('.', 'npm', 'install', '--omit=dev', name);
|
|
1441
|
-
try {
|
|
1442
|
-
$$.$mol_exec('.', 'npm', 'install', '--omit=dev', '@types/' + name);
|
|
1443
|
-
}
|
|
1444
|
-
catch { }
|
|
1445
|
-
break;
|
|
1446
|
-
}
|
|
1447
|
-
else {
|
|
1448
|
-
dir = parent;
|
|
1449
|
-
}
|
|
1450
|
-
}
|
|
1451
|
-
return target.require(name);
|
|
1452
|
-
},
|
|
1453
|
-
set(target, name, value) {
|
|
1454
|
-
target[name] = value;
|
|
1455
|
-
return true;
|
|
1456
|
-
},
|
|
1457
|
-
});
|
|
1458
|
-
require = (req => Object.assign(function require(name) {
|
|
1459
|
-
return $node[name];
|
|
1460
|
-
}, req))(require);
|
|
1461
|
-
//node/node.node.ts
|
|
1462
|
-
;
|
|
1463
|
-
"use strict";
|
|
1464
|
-
var $;
|
|
1465
|
-
(function ($) {
|
|
1466
|
-
function $mol_log3_area_lazy(event) {
|
|
1467
|
-
const self = this;
|
|
1468
|
-
const stack = self.$mol_log3_stack;
|
|
1469
|
-
const deep = stack.length;
|
|
1470
|
-
let logged = false;
|
|
1471
|
-
stack.push(() => {
|
|
1472
|
-
logged = true;
|
|
1473
|
-
self.$mol_log3_area.call(self, event);
|
|
1474
|
-
});
|
|
1475
|
-
return () => {
|
|
1476
|
-
if (logged)
|
|
1477
|
-
self.console.groupEnd();
|
|
1478
|
-
if (stack.length > deep)
|
|
1479
|
-
stack.length = deep;
|
|
1480
|
-
};
|
|
1481
|
-
}
|
|
1482
|
-
$.$mol_log3_area_lazy = $mol_log3_area_lazy;
|
|
1483
|
-
$.$mol_log3_stack = [];
|
|
1484
|
-
})($ || ($ = {}));
|
|
1485
|
-
//mol/log3/log3.ts
|
|
1486
|
-
;
|
|
1487
|
-
"use strict";
|
|
1488
|
-
var $;
|
|
1489
|
-
(function ($) {
|
|
1490
|
-
class $mol_term_color {
|
|
1491
|
-
static reset = this.ansi(0, 0);
|
|
1492
|
-
static bold = this.ansi(1, 22);
|
|
1493
|
-
static italic = this.ansi(3, 23);
|
|
1494
|
-
static underline = this.ansi(4, 24);
|
|
1495
|
-
static inverse = this.ansi(7, 27);
|
|
1496
|
-
static hidden = this.ansi(8, 28);
|
|
1497
|
-
static strike = this.ansi(9, 29);
|
|
1498
|
-
static gray = this.ansi(90, 39);
|
|
1499
|
-
static red = this.ansi(91, 39);
|
|
1500
|
-
static green = this.ansi(92, 39);
|
|
1501
|
-
static yellow = this.ansi(93, 39);
|
|
1502
|
-
static blue = this.ansi(94, 39);
|
|
1503
|
-
static magenta = this.ansi(95, 39);
|
|
1504
|
-
static cyan = this.ansi(96, 39);
|
|
1505
|
-
static Gray = (str) => this.inverse(this.gray(str));
|
|
1506
|
-
static Red = (str) => this.inverse(this.red(str));
|
|
1507
|
-
static Green = (str) => this.inverse(this.green(str));
|
|
1508
|
-
static Yellow = (str) => this.inverse(this.yellow(str));
|
|
1509
|
-
static Blue = (str) => this.inverse(this.blue(str));
|
|
1510
|
-
static Magenta = (str) => this.inverse(this.magenta(str));
|
|
1511
|
-
static Cyan = (str) => this.inverse(this.cyan(str));
|
|
1512
|
-
static ansi(open, close) {
|
|
1513
|
-
if (typeof process === 'undefined')
|
|
1514
|
-
return String;
|
|
1515
|
-
if (!process.stdout.isTTY)
|
|
1516
|
-
return String;
|
|
1517
|
-
const prefix = `\x1b[${open}m`;
|
|
1518
|
-
const postfix = `\x1b[${close}m`;
|
|
1519
|
-
const suffix_regexp = new RegExp(postfix.replace('[', '\\['), 'g');
|
|
1520
|
-
return function colorer(str) {
|
|
1521
|
-
str = String(str);
|
|
1522
|
-
if (str === '')
|
|
1523
|
-
return str;
|
|
1524
|
-
const suffix = str.replace(suffix_regexp, prefix);
|
|
1525
|
-
return prefix + suffix + postfix;
|
|
1526
|
-
};
|
|
1527
|
-
}
|
|
1528
|
-
}
|
|
1529
|
-
$.$mol_term_color = $mol_term_color;
|
|
1530
|
-
})($ || ($ = {}));
|
|
1531
|
-
//mol/term/color/color.ts
|
|
1532
|
-
;
|
|
1533
|
-
"use strict";
|
|
1534
|
-
var $;
|
|
1535
|
-
(function ($) {
|
|
1536
|
-
function $mol_log3_node_make(level, output, type, color) {
|
|
1537
|
-
return function $mol_log3_logger(event) {
|
|
1538
|
-
if (!event.time)
|
|
1539
|
-
event = { time: new Date().toISOString(), ...event };
|
|
1540
|
-
let tree = this.$mol_tree2_from_json(event);
|
|
1541
|
-
tree = tree.struct(type, tree.kids);
|
|
1542
|
-
let str = color(tree.toString());
|
|
1543
|
-
this.console[level](str);
|
|
1544
|
-
const self = this;
|
|
1545
|
-
return () => self.console.groupEnd();
|
|
1546
|
-
};
|
|
1547
|
-
}
|
|
1548
|
-
$.$mol_log3_node_make = $mol_log3_node_make;
|
|
1549
|
-
$.$mol_log3_come = $mol_log3_node_make('info', 'stdout', 'come', $mol_term_color.blue);
|
|
1550
|
-
$.$mol_log3_done = $mol_log3_node_make('info', 'stdout', 'done', $mol_term_color.green);
|
|
1551
|
-
$.$mol_log3_fail = $mol_log3_node_make('error', 'stderr', 'fail', $mol_term_color.red);
|
|
1552
|
-
$.$mol_log3_warn = $mol_log3_node_make('warn', 'stderr', 'warn', $mol_term_color.yellow);
|
|
1553
|
-
$.$mol_log3_rise = $mol_log3_node_make('log', 'stdout', 'rise', $mol_term_color.magenta);
|
|
1554
|
-
$.$mol_log3_area = $mol_log3_node_make('log', 'stdout', 'area', $mol_term_color.cyan);
|
|
1555
|
-
})($ || ($ = {}));
|
|
1556
|
-
//mol/log3/log3.node.ts
|
|
1557
|
-
;
|
|
1558
|
-
"use strict";
|
|
1559
|
-
var $;
|
|
1560
1613
|
(function ($_1) {
|
|
1561
1614
|
$mol_test_mocks.push($ => {
|
|
1562
1615
|
$.$mol_log3_come = () => { };
|
|
@@ -1571,59 +1624,6 @@ var $;
|
|
|
1571
1624
|
;
|
|
1572
1625
|
"use strict";
|
|
1573
1626
|
var $;
|
|
1574
|
-
(function ($) {
|
|
1575
|
-
function $mol_env() {
|
|
1576
|
-
return {};
|
|
1577
|
-
}
|
|
1578
|
-
$.$mol_env = $mol_env;
|
|
1579
|
-
})($ || ($ = {}));
|
|
1580
|
-
//mol/env/env.ts
|
|
1581
|
-
;
|
|
1582
|
-
"use strict";
|
|
1583
|
-
var $;
|
|
1584
|
-
(function ($) {
|
|
1585
|
-
$.$mol_env = function $mol_env() {
|
|
1586
|
-
return this.process.env;
|
|
1587
|
-
};
|
|
1588
|
-
})($ || ($ = {}));
|
|
1589
|
-
//mol/env/env.node.ts
|
|
1590
|
-
;
|
|
1591
|
-
"use strict";
|
|
1592
|
-
var $;
|
|
1593
|
-
(function ($) {
|
|
1594
|
-
function $mol_exec(dir, command, ...args) {
|
|
1595
|
-
let [app, ...args0] = command.split(' ');
|
|
1596
|
-
args = [...args0, ...args];
|
|
1597
|
-
this.$mol_log3_come({
|
|
1598
|
-
place: '$mol_exec',
|
|
1599
|
-
dir: $node.path.relative('', dir),
|
|
1600
|
-
message: 'Run',
|
|
1601
|
-
command: `${app} ${args.join(' ')}`,
|
|
1602
|
-
});
|
|
1603
|
-
var res = $node['child_process'].spawnSync(app, args, {
|
|
1604
|
-
cwd: $node.path.resolve(dir),
|
|
1605
|
-
shell: true,
|
|
1606
|
-
env: this.$mol_env(),
|
|
1607
|
-
});
|
|
1608
|
-
if (res.status || res.error)
|
|
1609
|
-
return $mol_fail(res.error || new Error(res.stderr.toString()));
|
|
1610
|
-
if (!res.stdout)
|
|
1611
|
-
res.stdout = Buffer.from([]);
|
|
1612
|
-
return res;
|
|
1613
|
-
}
|
|
1614
|
-
$.$mol_exec = $mol_exec;
|
|
1615
|
-
})($ || ($ = {}));
|
|
1616
|
-
//mol/exec/exec.node.ts
|
|
1617
|
-
;
|
|
1618
|
-
"use strict";
|
|
1619
|
-
var $;
|
|
1620
|
-
(function ($) {
|
|
1621
|
-
$.$mol_dom_context = new $node.jsdom.JSDOM('', { url: 'https://localhost/' }).window;
|
|
1622
|
-
})($ || ($ = {}));
|
|
1623
|
-
//mol/dom/context/context.node.ts
|
|
1624
|
-
;
|
|
1625
|
-
"use strict";
|
|
1626
|
-
var $;
|
|
1627
1627
|
(function ($) {
|
|
1628
1628
|
function $mol_dom_render_children(el, childNodes) {
|
|
1629
1629
|
const node_set = new Set(childNodes);
|