jsir 2.2.5 → 2.2.6

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 CHANGED
@@ -2036,9 +2036,6 @@ async function evalText($text = '', $cmdName = '', $args = []) {
2036
2036
  let $require = async (matchItem) => {
2037
2037
  return await _requireSource(currSpace, matchItem)
2038
2038
  }
2039
- // 兼容module.exports
2040
- $text.replace(/^module\.exports\s*=\s*/m, 'return ')
2041
-
2042
2039
  return await evalCode(addErrorTag($text), $cmdName, $args,
2043
2040
  $data, $file,
2044
2041
  $require, $requires,
package/deps/evalCode.js CHANGED
@@ -22,6 +22,8 @@ module.exports = async ($text = '', $cmdName = '', $args = [],
22
22
  $currentSpace, $homeDir, $lib, $cmdMap
23
23
  }
24
24
  let console = $lib.createConsole($cmdName);
25
+ // 兼容module.exports
26
+ $text = $text.replace(/^module\.exports\s*=\s*/m, 'return ')
25
27
  return await eval(`(async ()=>{${$text};
26
28
  })()`)
27
29
  }
package/deps/util.js CHANGED
@@ -763,8 +763,8 @@ function requireG(moduleName){
763
763
  } catch (e) {}
764
764
  let path = moduleDir + '/' + moduleName;
765
765
  if (!fs.existsSync(path)) {
766
- console.log(warnStr(`.npm install ${moduleName}`))
767
- throw `${moduleName} not found, use .npm install to add it`;
766
+ console.log(warnStr(`npm install ${moduleName}`))
767
+ throw `${moduleName} not found, use npm install to add it`;
768
768
  }
769
769
  return require(path);
770
770
  }
@@ -784,8 +784,8 @@ async function importG(moduleName) {
784
784
  } catch (e) {}
785
785
  let path = moduleDir + '/' + moduleName;
786
786
  if (!fs.existsSync(path)) {
787
- console.log(warnStr(`.npm install ${moduleName}`))
788
- throw `${moduleName} not found, use .npm install to add it`;
787
+ console.log(warnStr(`npm install ${moduleName}`))
788
+ throw `${moduleName} not found, use npm install to add it`;
789
789
  }
790
790
  return await import(require.resolve(path));
791
791
  }
@@ -919,7 +919,7 @@ function toBigNum(str) {
919
919
 
920
920
  function reget(str, reg) {
921
921
  `
922
- reget(/aaa(bbb)ccc/, str)
922
+ reget(str, /aaa(bbb)ccc/)
923
923
  return bbb
924
924
  `
925
925
  let r = reg.exec(str)
@@ -928,7 +928,7 @@ function reget(str, reg) {
928
928
 
929
929
  function regEach(str, reg, fn) {
930
930
  `
931
- regEach(/aaa(bbb)ccc/, str, fn)
931
+ regEach(str, /aaa(bbb)ccc/, fn)
932
932
  fn([aaa(bbb)ccc, bbb])
933
933
  return void
934
934
  `
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jsir",
3
- "version": "2.2.5",
3
+ "version": "2.2.6",
4
4
  "description": "JavaScript Script Management Tool",
5
5
  "main": "index.js",
6
6
  "scripts": {