@midwayjs/core 3.11.12-beta.2 → 3.11.12-beta.3
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.
|
@@ -7,12 +7,11 @@ const error_1 = require("../error");
|
|
|
7
7
|
const constants_1 = require("../constants");
|
|
8
8
|
const decorator_1 = require("../decorator");
|
|
9
9
|
async function requireModule(modulePath, type) {
|
|
10
|
-
var _a;
|
|
11
10
|
if (type === 'commonjs') {
|
|
12
11
|
return require(modulePath);
|
|
13
12
|
}
|
|
14
13
|
else {
|
|
15
|
-
return await (
|
|
14
|
+
return await import(modulePath);
|
|
16
15
|
}
|
|
17
16
|
}
|
|
18
17
|
class AbstractFileDetector {
|
package/dist/util/index.js
CHANGED
|
@@ -61,11 +61,10 @@ exports.safeRequire = safeRequire;
|
|
|
61
61
|
* @since 3.12.0
|
|
62
62
|
*/
|
|
63
63
|
const loadModule = async (p, options = {}) => {
|
|
64
|
-
var _a;
|
|
65
|
-
|
|
66
|
-
options.
|
|
67
|
-
options.
|
|
68
|
-
options.loadMode = (_d = options.loadMode) !== null && _d !== void 0 ? _d : 'commonjs';
|
|
64
|
+
var _a, _b, _c;
|
|
65
|
+
options.enableCache = (_a = options.enableCache) !== null && _a !== void 0 ? _a : true;
|
|
66
|
+
options.safeLoad = (_b = options.safeLoad) !== null && _b !== void 0 ? _b : false;
|
|
67
|
+
options.loadMode = (_c = options.loadMode) !== null && _c !== void 0 ? _c : 'commonjs';
|
|
69
68
|
if (p.startsWith(`.${path_1.sep}`) || p.startsWith(`..${path_1.sep}`)) {
|
|
70
69
|
p = (0, path_1.resolve)((0, path_1.dirname)(module.parent.filename), p);
|
|
71
70
|
}
|
|
@@ -75,7 +74,7 @@ const loadModule = async (p, options = {}) => {
|
|
|
75
74
|
return require(p);
|
|
76
75
|
}
|
|
77
76
|
else {
|
|
78
|
-
return await (
|
|
77
|
+
return await import(p);
|
|
79
78
|
}
|
|
80
79
|
}
|
|
81
80
|
else {
|