jsir 2.0.1 → 2.0.2
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/cmd/oaa.js +6 -5
- package/evalCode.js +3 -2
- package/package.json +1 -1
package/cmd/oaa.js
CHANGED
|
@@ -341,7 +341,6 @@ $defArgs({
|
|
|
341
341
|
})
|
|
342
342
|
|
|
343
343
|
let {} = $lib // 引用内置资源
|
|
344
|
-
let [] = await $require() // 模糊引用脚本资源
|
|
345
344
|
|
|
346
345
|
console.log($args)
|
|
347
346
|
|
|
@@ -353,7 +352,6 @@ A test init script
|
|
|
353
352
|
*/
|
|
354
353
|
|
|
355
354
|
let {} = $lib // 引用内置资源
|
|
356
|
-
let [] = await $require() // 模糊引用脚本资源
|
|
357
355
|
|
|
358
356
|
return {}
|
|
359
357
|
`;
|
|
@@ -378,7 +376,7 @@ function rename(dir, oldName, newName) {
|
|
|
378
376
|
info(`${_new} renamed`)
|
|
379
377
|
}
|
|
380
378
|
_cmdMap = {
|
|
381
|
-
1: toUniqueName(
|
|
379
|
+
1: toUniqueName(_new)
|
|
382
380
|
}
|
|
383
381
|
listCmd()
|
|
384
382
|
}
|
|
@@ -1555,11 +1553,14 @@ async function evalText($text = '', $cmdName = '', $args = []) {
|
|
|
1555
1553
|
} else {
|
|
1556
1554
|
currSpace = $defaultSpace
|
|
1557
1555
|
}
|
|
1558
|
-
let $
|
|
1556
|
+
let $requires = async (...matchItems) => {
|
|
1559
1557
|
return await _requireSources(currSpace, ...matchItems)
|
|
1560
1558
|
}
|
|
1559
|
+
let $require = async (matchItem, printLog) => {
|
|
1560
|
+
return (await _requireSources(currSpace, matchItem, printLog))[0]
|
|
1561
|
+
}
|
|
1561
1562
|
try {
|
|
1562
|
-
return await evalCode($text, $cmdName, $args, $require, $
|
|
1563
|
+
return await evalCode($text, $cmdName, $args, $data, $require, $requires,
|
|
1563
1564
|
nextLine, nextText, setTips, delTips, wrapperInput, filterCmd,
|
|
1564
1565
|
currSpace, $log, $draft, $config, $homeDir, $lib)
|
|
1565
1566
|
} catch(e) {
|
package/evalCode.js
CHANGED
|
@@ -5,7 +5,8 @@ const {info: $info, msg: $msg, warn: $warn, error: $error,
|
|
|
5
5
|
importG: $import} = require("./util");
|
|
6
6
|
require = require("./util").requireG;
|
|
7
7
|
module.exports = async ($text = '', $cmdName = '', $args = [],
|
|
8
|
-
$
|
|
8
|
+
$data,
|
|
9
|
+
$require, $requires,
|
|
9
10
|
$nextLine, $nextText,
|
|
10
11
|
$setTips, $delTips,
|
|
11
12
|
$enter, $filterCmd,
|
|
@@ -15,7 +16,7 @@ module.exports = async ($text = '', $cmdName = '', $args = [],
|
|
|
15
16
|
const $defArgs = () => $args;
|
|
16
17
|
const $context = {
|
|
17
18
|
global, $data,
|
|
18
|
-
$require, $import,
|
|
19
|
+
$require, $requires, $import,
|
|
19
20
|
$info, $msg, $warn, $error,
|
|
20
21
|
$infoStr, $msgStr, $warnStr, $errorStr,
|
|
21
22
|
$tableStr, $nableStr,
|