mol_data_all 1.1.1678 → 1.1.1680
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
|
@@ -749,34 +749,41 @@ var $;
|
|
|
749
749
|
|
|
750
750
|
;
|
|
751
751
|
"use strict";
|
|
752
|
-
var
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
return target.require(name);
|
|
759
|
-
if (name[0] === '.')
|
|
760
|
-
return target.require(name);
|
|
752
|
+
var $;
|
|
753
|
+
(function ($) {
|
|
754
|
+
const path = require('path');
|
|
755
|
+
const mod = require('module');
|
|
756
|
+
const localRequire = mod.createRequire(path.join(process.cwd(), 'package.json'));
|
|
757
|
+
function $node_autoinstall(name) {
|
|
761
758
|
try {
|
|
762
|
-
|
|
759
|
+
localRequire.resolve(name);
|
|
763
760
|
}
|
|
764
761
|
catch {
|
|
765
|
-
|
|
762
|
+
this.$mol_run.spawn({ command: ['npm', 'install', '--omit=dev', name], dir: '.' });
|
|
766
763
|
try {
|
|
767
|
-
|
|
764
|
+
this.$mol_run.spawn({ command: ['npm', 'install', '--omit=dev', '@types/' + name], dir: '.' });
|
|
768
765
|
}
|
|
769
766
|
catch (e) {
|
|
770
|
-
if (
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
}
|
|
774
|
-
const mam_node_modules = target.require('node:path').join(process.cwd(), 'node_modules');
|
|
775
|
-
if (!process.env.NODE_PATH?.includes(mam_node_modules)) {
|
|
776
|
-
process.env.NODE_PATH = `${mam_node_modules}${process.env.NODE_PATH ? `:${process.env.NODE_PATH}` : ''}`;
|
|
777
|
-
target.require('node:module').Module._initPaths();
|
|
767
|
+
if (this.$mol_promise_like(e))
|
|
768
|
+
this.$mol_fail_hidden(e);
|
|
769
|
+
this.$mol_fail_log(e);
|
|
778
770
|
}
|
|
779
771
|
}
|
|
772
|
+
}
|
|
773
|
+
$.$node_autoinstall = $node_autoinstall;
|
|
774
|
+
})($ || ($ = {}));
|
|
775
|
+
|
|
776
|
+
;
|
|
777
|
+
"use strict";
|
|
778
|
+
var $node = new Proxy({ require }, {
|
|
779
|
+
get(target, name, wrapper) {
|
|
780
|
+
if (target[name])
|
|
781
|
+
return target[name];
|
|
782
|
+
if ($.$node_internal_check(name))
|
|
783
|
+
return target.require(name);
|
|
784
|
+
if (name[0] === '.')
|
|
785
|
+
return target.require(name);
|
|
786
|
+
$.$node_autoinstall(name);
|
|
780
787
|
return target.require(name);
|
|
781
788
|
},
|
|
782
789
|
set(target, name, value) {
|
|
@@ -784,7 +791,6 @@ var $node = new Proxy({ require }, {
|
|
|
784
791
|
return true;
|
|
785
792
|
},
|
|
786
793
|
});
|
|
787
|
-
const cache = new Map();
|
|
788
794
|
require = (req => Object.assign(function require(name) {
|
|
789
795
|
return $node[name];
|
|
790
796
|
}, req))(require);
|
|
@@ -2680,16 +2686,6 @@ var $;
|
|
|
2680
2686
|
});
|
|
2681
2687
|
})($ || ($ = {}));
|
|
2682
2688
|
|
|
2683
|
-
;
|
|
2684
|
-
"use strict";
|
|
2685
|
-
var $;
|
|
2686
|
-
(function ($) {
|
|
2687
|
-
function $mol_exec(dir, command, ...args) {
|
|
2688
|
-
return this.$mol_run.spawn({ command: [command, ...args], dir });
|
|
2689
|
-
}
|
|
2690
|
-
$.$mol_exec = $mol_exec;
|
|
2691
|
-
})($ || ($ = {}));
|
|
2692
|
-
|
|
2693
2689
|
;
|
|
2694
2690
|
"use strict";
|
|
2695
2691
|
var $;
|