mol_text_distance 0.0.1386 → 0.0.1387
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
|
@@ -227,29 +227,41 @@ var $;
|
|
|
227
227
|
|
|
228
228
|
;
|
|
229
229
|
"use strict";
|
|
230
|
-
var
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
return target.require(name);
|
|
237
|
-
if (name[0] === '.')
|
|
238
|
-
return target.require(name);
|
|
230
|
+
var $;
|
|
231
|
+
(function ($) {
|
|
232
|
+
const path = require('path');
|
|
233
|
+
const mod = require('module');
|
|
234
|
+
const localRequire = mod.createRequire(path.join(process.cwd(), 'package.json'));
|
|
235
|
+
function $node_autoinstall(name) {
|
|
239
236
|
try {
|
|
240
|
-
|
|
237
|
+
localRequire.resolve(name);
|
|
241
238
|
}
|
|
242
239
|
catch {
|
|
243
|
-
|
|
240
|
+
this.$mol_run.spawn({ command: ['npm', 'install', '--omit=dev', name], dir: '.' });
|
|
244
241
|
try {
|
|
245
|
-
|
|
242
|
+
this.$mol_run.spawn({ command: ['npm', 'install', '--omit=dev', '@types/' + name], dir: '.' });
|
|
246
243
|
}
|
|
247
244
|
catch (e) {
|
|
248
|
-
if (
|
|
249
|
-
|
|
250
|
-
|
|
245
|
+
if (this.$mol_promise_like(e))
|
|
246
|
+
this.$mol_fail_hidden(e);
|
|
247
|
+
this.$mol_fail_log(e);
|
|
251
248
|
}
|
|
252
249
|
}
|
|
250
|
+
}
|
|
251
|
+
$.$node_autoinstall = $node_autoinstall;
|
|
252
|
+
})($ || ($ = {}));
|
|
253
|
+
|
|
254
|
+
;
|
|
255
|
+
"use strict";
|
|
256
|
+
var $node = new Proxy({ require }, {
|
|
257
|
+
get(target, name, wrapper) {
|
|
258
|
+
if (target[name])
|
|
259
|
+
return target[name];
|
|
260
|
+
if ($.$node_internal_check(name))
|
|
261
|
+
return target.require(name);
|
|
262
|
+
if (name[0] === '.')
|
|
263
|
+
return target.require(name);
|
|
264
|
+
$.$node_autoinstall(name);
|
|
253
265
|
return target.require(name);
|
|
254
266
|
},
|
|
255
267
|
set(target, name, value) {
|
|
@@ -257,7 +269,6 @@ var $node = new Proxy({ require }, {
|
|
|
257
269
|
return true;
|
|
258
270
|
},
|
|
259
271
|
});
|
|
260
|
-
const cache = new Map();
|
|
261
272
|
require = (req => Object.assign(function require(name) {
|
|
262
273
|
return $node[name];
|
|
263
274
|
}, req))(require);
|
|
@@ -2237,16 +2248,6 @@ var $;
|
|
|
2237
2248
|
});
|
|
2238
2249
|
})($ || ($ = {}));
|
|
2239
2250
|
|
|
2240
|
-
;
|
|
2241
|
-
"use strict";
|
|
2242
|
-
var $;
|
|
2243
|
-
(function ($) {
|
|
2244
|
-
function $mol_exec(dir, command, ...args) {
|
|
2245
|
-
return this.$mol_run.spawn({ command: [command, ...args], dir });
|
|
2246
|
-
}
|
|
2247
|
-
$.$mol_exec = $mol_exec;
|
|
2248
|
-
})($ || ($ = {}));
|
|
2249
|
-
|
|
2250
2251
|
;
|
|
2251
2252
|
"use strict";
|
|
2252
2253
|
var $;
|