mol_conform 0.0.157 → 0.0.159
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
|
@@ -272,29 +272,41 @@ var $;
|
|
|
272
272
|
|
|
273
273
|
;
|
|
274
274
|
"use strict";
|
|
275
|
-
var
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
return target.require(name);
|
|
282
|
-
if (name[0] === '.')
|
|
283
|
-
return target.require(name);
|
|
275
|
+
var $;
|
|
276
|
+
(function ($) {
|
|
277
|
+
const path = require('path');
|
|
278
|
+
const mod = require('module');
|
|
279
|
+
const localRequire = mod.createRequire(path.join(process.cwd(), 'package.json'));
|
|
280
|
+
function $node_autoinstall(name) {
|
|
284
281
|
try {
|
|
285
|
-
|
|
282
|
+
localRequire.resolve(name);
|
|
286
283
|
}
|
|
287
284
|
catch {
|
|
288
|
-
|
|
285
|
+
this.$mol_run.spawn({ command: ['npm', 'install', '--omit=dev', name], dir: '.' });
|
|
289
286
|
try {
|
|
290
|
-
|
|
287
|
+
this.$mol_run.spawn({ command: ['npm', 'install', '--omit=dev', '@types/' + name], dir: '.' });
|
|
291
288
|
}
|
|
292
289
|
catch (e) {
|
|
293
|
-
if (
|
|
294
|
-
|
|
295
|
-
|
|
290
|
+
if (this.$mol_promise_like(e))
|
|
291
|
+
this.$mol_fail_hidden(e);
|
|
292
|
+
this.$mol_fail_log(e);
|
|
296
293
|
}
|
|
297
294
|
}
|
|
295
|
+
}
|
|
296
|
+
$.$node_autoinstall = $node_autoinstall;
|
|
297
|
+
})($ || ($ = {}));
|
|
298
|
+
|
|
299
|
+
;
|
|
300
|
+
"use strict";
|
|
301
|
+
var $node = new Proxy({ require }, {
|
|
302
|
+
get(target, name, wrapper) {
|
|
303
|
+
if (target[name])
|
|
304
|
+
return target[name];
|
|
305
|
+
if ($.$node_internal_check(name))
|
|
306
|
+
return target.require(name);
|
|
307
|
+
if (name[0] === '.')
|
|
308
|
+
return target.require(name);
|
|
309
|
+
$.$node_autoinstall(name);
|
|
298
310
|
return target.require(name);
|
|
299
311
|
},
|
|
300
312
|
set(target, name, value) {
|
|
@@ -302,7 +314,6 @@ var $node = new Proxy({ require }, {
|
|
|
302
314
|
return true;
|
|
303
315
|
},
|
|
304
316
|
});
|
|
305
|
-
const cache = new Map();
|
|
306
317
|
require = (req => Object.assign(function require(name) {
|
|
307
318
|
return $node[name];
|
|
308
319
|
}, req))(require);
|
|
@@ -2282,16 +2293,6 @@ var $;
|
|
|
2282
2293
|
});
|
|
2283
2294
|
})($ || ($ = {}));
|
|
2284
2295
|
|
|
2285
|
-
;
|
|
2286
|
-
"use strict";
|
|
2287
|
-
var $;
|
|
2288
|
-
(function ($) {
|
|
2289
|
-
function $mol_exec(dir, command, ...args) {
|
|
2290
|
-
return this.$mol_run.spawn({ command: [command, ...args], dir });
|
|
2291
|
-
}
|
|
2292
|
-
$.$mol_exec = $mol_exec;
|
|
2293
|
-
})($ || ($ = {}));
|
|
2294
|
-
|
|
2295
2296
|
;
|
|
2296
2297
|
"use strict";
|
|
2297
2298
|
var $;
|