mol_conform 0.0.156 → 0.0.158
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 -31
- package/node.test.js.map +1 -1
- package/package.json +1 -1
package/node.test.js
CHANGED
|
@@ -272,34 +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
|
-
|
|
296
|
-
}
|
|
297
|
-
const mam_node_modules = target.require('node:path').join(process.cwd(), 'node_modules');
|
|
298
|
-
if (!process.env.NODE_PATH?.includes(mam_node_modules)) {
|
|
299
|
-
process.env.NODE_PATH = `${mam_node_modules}${process.env.NODE_PATH ? `:${process.env.NODE_PATH}` : ''}`;
|
|
300
|
-
target.require('node:module').Module._initPaths();
|
|
290
|
+
if (this.$mol_promise_like(e))
|
|
291
|
+
this.$mol_fail_hidden(e);
|
|
292
|
+
this.$mol_fail_log(e);
|
|
301
293
|
}
|
|
302
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);
|
|
303
310
|
return target.require(name);
|
|
304
311
|
},
|
|
305
312
|
set(target, name, value) {
|
|
@@ -307,7 +314,6 @@ var $node = new Proxy({ require }, {
|
|
|
307
314
|
return true;
|
|
308
315
|
},
|
|
309
316
|
});
|
|
310
|
-
const cache = new Map();
|
|
311
317
|
require = (req => Object.assign(function require(name) {
|
|
312
318
|
return $node[name];
|
|
313
319
|
}, req))(require);
|
|
@@ -2287,16 +2293,6 @@ var $;
|
|
|
2287
2293
|
});
|
|
2288
2294
|
})($ || ($ = {}));
|
|
2289
2295
|
|
|
2290
|
-
;
|
|
2291
|
-
"use strict";
|
|
2292
|
-
var $;
|
|
2293
|
-
(function ($) {
|
|
2294
|
-
function $mol_exec(dir, command, ...args) {
|
|
2295
|
-
return this.$mol_run.spawn({ command: [command, ...args], dir });
|
|
2296
|
-
}
|
|
2297
|
-
$.$mol_exec = $mol_exec;
|
|
2298
|
-
})($ || ($ = {}));
|
|
2299
|
-
|
|
2300
2296
|
;
|
|
2301
2297
|
"use strict";
|
|
2302
2298
|
var $;
|