jsir 2.0.3 → 2.0.4
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/evalCode.js +2 -3
- package/package.json +3 -26
- package/util.js +8 -18
package/evalCode.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
const {info: $info, msg: $msg, warn: $warn, error: $error,
|
|
2
2
|
infoStr: $infoStr, msgStr: $msgStr, warnStr: $warnStr, errorStr: $errorStr,
|
|
3
3
|
tableStr: $tableStr, nableStr: $nableStr,
|
|
4
|
-
errorMsg: $errorMsg, errorStack: $errorStack
|
|
5
|
-
importG: $import} = require("./util");
|
|
4
|
+
errorMsg: $errorMsg, errorStack: $errorStack} = require("./util");
|
|
6
5
|
require = require("./util").requireG;
|
|
7
6
|
module.exports = async ($text = '', $cmdName = '', $args = [],
|
|
8
7
|
$data,
|
|
@@ -16,7 +15,7 @@ module.exports = async ($text = '', $cmdName = '', $args = [],
|
|
|
16
15
|
const $defArgs = () => $args;
|
|
17
16
|
const $context = {
|
|
18
17
|
global, $data,
|
|
19
|
-
$require, $requires,
|
|
18
|
+
$require, $requires,
|
|
20
19
|
$info, $msg, $warn, $error,
|
|
21
20
|
$infoStr, $msgStr, $warnStr, $errorStr,
|
|
22
21
|
$tableStr, $nableStr,
|
package/package.json
CHANGED
|
@@ -1,47 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jsir",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.4",
|
|
4
4
|
"description": "js script manager tool",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
7
|
-
"test": "
|
|
7
|
+
"test": "cmd/oaa.js"
|
|
8
8
|
},
|
|
9
9
|
"bin": {
|
|
10
|
-
"jsir-see": "cmd/see.js",
|
|
11
|
-
"jsir-sc": "cmd/solComplie.js",
|
|
12
|
-
"jsir-sd": "cmd/solDeploy.js",
|
|
13
|
-
"jsir-st": "cmd/solTest.js",
|
|
14
|
-
"jsir-scd": "cmd/solCd.js",
|
|
15
|
-
"jsir-stt": "cmd/solTt.js",
|
|
16
|
-
"jsir-cleanLog": "cmd/cleanLog.js",
|
|
17
|
-
"jsir-staticServer": "cmd/staticServer.js",
|
|
18
|
-
"jsir-dirServer": "cmd/dirServer.js",
|
|
19
|
-
"jsir-stop": "cmd/stop.js",
|
|
20
|
-
"jsir-mock": "cmd/mockServer.js",
|
|
21
|
-
"jsir-ethDataServer": "cmd/ethDataServer.js",
|
|
22
|
-
"jsir-configServer": "cmd/configServer.js",
|
|
23
10
|
"jsir": "cmd/oaa.js"
|
|
24
11
|
},
|
|
25
12
|
"keywords": [],
|
|
26
13
|
"author": "",
|
|
27
14
|
"license": "ISC",
|
|
28
15
|
"dependencies": {
|
|
29
|
-
"abi-decoder": "^2.4.0",
|
|
30
|
-
"address": "^1.1.2",
|
|
31
16
|
"axios": "^0.20.0",
|
|
32
17
|
"bignumber.js": "^9.0.0",
|
|
33
18
|
"chokidar": "^3.5.2",
|
|
34
19
|
"console.table": "^0.10.0",
|
|
35
20
|
"dayjs": "^1.10.4",
|
|
36
|
-
"ethereumjs-tx": "^1.3.7",
|
|
37
|
-
"ethereumjs-util": "^7.1.3",
|
|
38
|
-
"ethers": "^5.1.0",
|
|
39
21
|
"global-dirs": "^3.0.0",
|
|
40
|
-
"
|
|
41
|
-
"pad": "^3.2.0",
|
|
42
|
-
"server": "^1.0.30",
|
|
43
|
-
"urlencode": "^1.1.0",
|
|
44
|
-
"web3": "^1.6.1",
|
|
45
|
-
"web3-eth-contract": "^1.6.1"
|
|
22
|
+
"pad": "^3.2.0"
|
|
46
23
|
}
|
|
47
24
|
}
|
package/util.js
CHANGED
|
@@ -394,20 +394,6 @@ function requireG(module){
|
|
|
394
394
|
return require(path);
|
|
395
395
|
}
|
|
396
396
|
|
|
397
|
-
async function importG(module) {
|
|
398
|
-
try {
|
|
399
|
-
let result = await import(module);
|
|
400
|
-
if (result) {
|
|
401
|
-
return result
|
|
402
|
-
}
|
|
403
|
-
} catch (e) {}
|
|
404
|
-
let path = globalDirectories.npm.packages + '/' + module + '/index.js';
|
|
405
|
-
if (!fs.existsSync(path)) {
|
|
406
|
-
throw `ERROR: ${module} not found, use [npm install -g ${module}] to install it`;
|
|
407
|
-
}
|
|
408
|
-
return await import(path);
|
|
409
|
-
}
|
|
410
|
-
|
|
411
397
|
function validStr(str, name) {
|
|
412
398
|
if (!vl(str) || typeof str !== 'string') {
|
|
413
399
|
throw "invalid cipher " + name;
|
|
@@ -448,7 +434,7 @@ function aesDecipher(str, key){
|
|
|
448
434
|
}
|
|
449
435
|
}
|
|
450
436
|
|
|
451
|
-
function getConfig(key, defaultVal) {
|
|
437
|
+
function getConfig(key, defaultVal = '') {
|
|
452
438
|
let configInit = {}
|
|
453
439
|
if (key) {
|
|
454
440
|
configInit[key] = ''
|
|
@@ -459,7 +445,7 @@ function getConfig(key, defaultVal) {
|
|
|
459
445
|
}
|
|
460
446
|
|
|
461
447
|
let config = JSON.parse(String(fs.readFileSync(configFile)))
|
|
462
|
-
if (
|
|
448
|
+
if (key === undefined) {
|
|
463
449
|
return config
|
|
464
450
|
}
|
|
465
451
|
let actConfigKeys = Object.keys(config);
|
|
@@ -473,7 +459,12 @@ function getConfig(key, defaultVal) {
|
|
|
473
459
|
if (writeFlag) {
|
|
474
460
|
fs.writeFileSync(configFile, JSON.stringify(config, null, 2))
|
|
475
461
|
}
|
|
476
|
-
let val
|
|
462
|
+
let val
|
|
463
|
+
if (!(key in config)) {
|
|
464
|
+
val = defaultVal
|
|
465
|
+
} else {
|
|
466
|
+
val = config[key]
|
|
467
|
+
}
|
|
477
468
|
if (typeof val === "string") {
|
|
478
469
|
val = trim(val)
|
|
479
470
|
}
|
|
@@ -1319,6 +1310,5 @@ module.exports = {
|
|
|
1319
1310
|
iarrayDataFile,
|
|
1320
1311
|
isArgsMatch,
|
|
1321
1312
|
draftQuery,
|
|
1322
|
-
importG,
|
|
1323
1313
|
getTextComments
|
|
1324
1314
|
}
|