mol_crypto_lib 0.1.1290 → 0.1.1292

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.mjs CHANGED
@@ -110,27 +110,19 @@ var $node = new Proxy({ require }, {
110
110
  return target.require(name);
111
111
  if (name[0] === '.')
112
112
  return target.require(name);
113
- const path = target.require('path');
114
- const fs = target.require('fs');
115
- let dir = path.resolve('.');
116
- const suffix = `./node_modules/${name}`;
117
- const $$ = $;
118
- while (!fs.existsSync(path.join(dir, suffix))) {
119
- const parent = path.resolve(dir, '..');
120
- if (parent === dir) {
121
- $$.$mol_exec('.', 'npm', 'install', '--omit=dev', name);
122
- try {
123
- $$.$mol_exec('.', 'npm', 'install', '--omit=dev', '@types/' + name);
124
- }
125
- catch (e) {
126
- if ($$.$mol_fail_catch(e)) {
127
- $$.$mol_fail_log(e);
128
- }
129
- }
130
- break;
113
+ try {
114
+ target.require.resolve(name);
115
+ }
116
+ catch {
117
+ const $$ = $;
118
+ $$.$mol_exec('.', 'npm', 'install', '--omit=dev', name);
119
+ try {
120
+ $$.$mol_exec('.', 'npm', 'install', '--omit=dev', '@types/' + name);
131
121
  }
132
- else {
133
- dir = parent;
122
+ catch (e) {
123
+ if ($$.$mol_fail_catch(e)) {
124
+ $$.$mol_fail_log(e);
125
+ }
134
126
  }
135
127
  }
136
128
  try {
@@ -1761,7 +1753,10 @@ var $;
1761
1753
  command: args_raw.join(' '),
1762
1754
  dir: $node.path.relative('', dir),
1763
1755
  });
1764
- return this.$mol_run_spawn_sync(app, args, { shell: true, cwd: dir, env });
1756
+ const res = this.$mol_run_spawn_sync(app, args, { shell: true, cwd: dir, env });
1757
+ if (res.status)
1758
+ $mol_fail(new Error(res.stderr.toString() || 'Exit(' + res.status + ')'));
1759
+ return res;
1765
1760
  }
1766
1761
  const sub = this.$mol_run_spawn(app, args, {
1767
1762
  shell: true,