mol_plot_all 1.2.1177 → 1.2.1178

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.js CHANGED
@@ -1991,27 +1991,19 @@ var $node = new Proxy({ require }, {
1991
1991
  return target.require(name);
1992
1992
  if (name[0] === '.')
1993
1993
  return target.require(name);
1994
- const path = target.require('path');
1995
- const fs = target.require('fs');
1996
- let dir = path.resolve('.');
1997
- const suffix = `./node_modules/${name}`;
1998
- const $$ = $;
1999
- while (!fs.existsSync(path.join(dir, suffix))) {
2000
- const parent = path.resolve(dir, '..');
2001
- if (parent === dir) {
2002
- $$.$mol_exec('.', 'npm', 'install', '--omit=dev', name);
2003
- try {
2004
- $$.$mol_exec('.', 'npm', 'install', '--omit=dev', '@types/' + name);
2005
- }
2006
- catch (e) {
2007
- if ($$.$mol_fail_catch(e)) {
2008
- $$.$mol_fail_log(e);
2009
- }
2010
- }
2011
- break;
1994
+ try {
1995
+ target.require.resolve(name);
1996
+ }
1997
+ catch {
1998
+ const $$ = $;
1999
+ $$.$mol_exec('.', 'npm', 'install', '--omit=dev', name);
2000
+ try {
2001
+ $$.$mol_exec('.', 'npm', 'install', '--omit=dev', '@types/' + name);
2012
2002
  }
2013
- else {
2014
- dir = parent;
2003
+ catch (e) {
2004
+ if ($$.$mol_fail_catch(e)) {
2005
+ $$.$mol_fail_log(e);
2006
+ }
2015
2007
  }
2016
2008
  }
2017
2009
  try {
@@ -2145,7 +2137,10 @@ var $;
2145
2137
  command: args_raw.join(' '),
2146
2138
  dir: $node.path.relative('', dir),
2147
2139
  });
2148
- return this.$mol_run_spawn_sync(app, args, { shell: true, cwd: dir, env });
2140
+ const res = this.$mol_run_spawn_sync(app, args, { shell: true, cwd: dir, env });
2141
+ if (res.status)
2142
+ $mol_fail(new Error(res.stderr.toString() || 'Exit(' + res.status + ')'));
2143
+ return res;
2149
2144
  }
2150
2145
  const sub = this.$mol_run_spawn(app, args, {
2151
2146
  shell: true,