mol_mutable 0.0.1112 → 0.0.1114
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
|
@@ -219,34 +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
|
-
|
|
243
|
-
}
|
|
244
|
-
const mam_node_modules = target.require('node:path').join(process.cwd(), 'node_modules');
|
|
245
|
-
if (!process.env.NODE_PATH?.includes(mam_node_modules)) {
|
|
246
|
-
process.env.NODE_PATH = `${mam_node_modules}${process.env.NODE_PATH ? `:${process.env.NODE_PATH}` : ''}`;
|
|
247
|
-
target.require('node:module').Module._initPaths();
|
|
237
|
+
if (this.$mol_promise_like(e))
|
|
238
|
+
this.$mol_fail_hidden(e);
|
|
239
|
+
this.$mol_fail_log(e);
|
|
248
240
|
}
|
|
249
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);
|
|
250
257
|
return target.require(name);
|
|
251
258
|
},
|
|
252
259
|
set(target, name, value) {
|
|
@@ -254,7 +261,6 @@ var $node = new Proxy({ require }, {
|
|
|
254
261
|
return true;
|
|
255
262
|
},
|
|
256
263
|
});
|
|
257
|
-
const cache = new Map();
|
|
258
264
|
require = (req => Object.assign(function require(name) {
|
|
259
265
|
return $node[name];
|
|
260
266
|
}, req))(require);
|
|
@@ -2219,16 +2225,6 @@ var $;
|
|
|
2219
2225
|
});
|
|
2220
2226
|
})($ || ($ = {}));
|
|
2221
2227
|
|
|
2222
|
-
;
|
|
2223
|
-
"use strict";
|
|
2224
|
-
var $;
|
|
2225
|
-
(function ($) {
|
|
2226
|
-
function $mol_exec(dir, command, ...args) {
|
|
2227
|
-
return this.$mol_run.spawn({ command: [command, ...args], dir });
|
|
2228
|
-
}
|
|
2229
|
-
$.$mol_exec = $mol_exec;
|
|
2230
|
-
})($ || ($ = {}));
|
|
2231
|
-
|
|
2232
2228
|
;
|
|
2233
2229
|
"use strict";
|
|
2234
2230
|
var $;
|