mol_mutable 0.0.1113 → 0.0.1115
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.test.js +27 -26
- package/node.test.js.map +1 -1
- package/package.json +1 -1
package/node.test.js
CHANGED
|
@@ -219,29 +219,41 @@ var $;
|
|
|
219
219
|
|
|
220
220
|
;
|
|
221
221
|
"use strict";
|
|
222
|
-
var
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
return target.require(name);
|
|
229
|
-
if (name[0] === '.')
|
|
230
|
-
return target.require(name);
|
|
222
|
+
var $;
|
|
223
|
+
(function ($) {
|
|
224
|
+
const path = require('path');
|
|
225
|
+
const mod = require('module');
|
|
226
|
+
const localRequire = mod.createRequire(path.join(process.cwd(), 'package.json'));
|
|
227
|
+
function $node_autoinstall(name) {
|
|
231
228
|
try {
|
|
232
|
-
|
|
229
|
+
localRequire.resolve(name);
|
|
233
230
|
}
|
|
234
231
|
catch {
|
|
235
|
-
|
|
232
|
+
this.$mol_run.spawn({ command: ['npm', 'install', '--omit=dev', name], dir: '.' });
|
|
236
233
|
try {
|
|
237
|
-
|
|
234
|
+
this.$mol_run.spawn({ command: ['npm', 'install', '--omit=dev', '@types/' + name], dir: '.' });
|
|
238
235
|
}
|
|
239
236
|
catch (e) {
|
|
240
|
-
if (
|
|
241
|
-
|
|
242
|
-
|
|
237
|
+
if (this.$mol_promise_like(e))
|
|
238
|
+
this.$mol_fail_hidden(e);
|
|
239
|
+
this.$mol_fail_log(e);
|
|
243
240
|
}
|
|
244
241
|
}
|
|
242
|
+
}
|
|
243
|
+
$.$node_autoinstall = $node_autoinstall;
|
|
244
|
+
})($ || ($ = {}));
|
|
245
|
+
|
|
246
|
+
;
|
|
247
|
+
"use strict";
|
|
248
|
+
var $node = new Proxy({ require }, {
|
|
249
|
+
get(target, name, wrapper) {
|
|
250
|
+
if (target[name])
|
|
251
|
+
return target[name];
|
|
252
|
+
if ($.$node_internal_check(name))
|
|
253
|
+
return target.require(name);
|
|
254
|
+
if (name[0] === '.')
|
|
255
|
+
return target.require(name);
|
|
256
|
+
$.$node_autoinstall(name);
|
|
245
257
|
return target.require(name);
|
|
246
258
|
},
|
|
247
259
|
set(target, name, value) {
|
|
@@ -249,7 +261,6 @@ var $node = new Proxy({ require }, {
|
|
|
249
261
|
return true;
|
|
250
262
|
},
|
|
251
263
|
});
|
|
252
|
-
const cache = new Map();
|
|
253
264
|
require = (req => Object.assign(function require(name) {
|
|
254
265
|
return $node[name];
|
|
255
266
|
}, req))(require);
|
|
@@ -2214,16 +2225,6 @@ var $;
|
|
|
2214
2225
|
});
|
|
2215
2226
|
})($ || ($ = {}));
|
|
2216
2227
|
|
|
2217
|
-
;
|
|
2218
|
-
"use strict";
|
|
2219
|
-
var $;
|
|
2220
|
-
(function ($) {
|
|
2221
|
-
function $mol_exec(dir, command, ...args) {
|
|
2222
|
-
return this.$mol_run.spawn({ command: [command, ...args], dir });
|
|
2223
|
-
}
|
|
2224
|
-
$.$mol_exec = $mol_exec;
|
|
2225
|
-
})($ || ($ = {}));
|
|
2226
|
-
|
|
2227
2228
|
;
|
|
2228
2229
|
"use strict";
|
|
2229
2230
|
var $;
|