@eggjs/utils 5.0.2-beta.10 → 5.0.2-beta.11
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/dist/import.js +2 -2
- package/package.json +2 -2
package/dist/import.js
CHANGED
|
@@ -28,7 +28,7 @@ try {
|
|
|
28
28
|
}
|
|
29
29
|
const detectedIsESM = isESM;
|
|
30
30
|
const nodeMajorVersion = parseInt(process.versions.node.split(".", 1)[0], 10);
|
|
31
|
-
const supportImportMetaResolve = nodeMajorVersion >= 18;
|
|
31
|
+
const supportImportMetaResolve = nodeMajorVersion >= 18 && typeof import.meta !== "undefined" && typeof import.meta.resolve === "function";
|
|
32
32
|
let _customRequire;
|
|
33
33
|
function getRequire() {
|
|
34
34
|
if (!_customRequire) if (typeof __require !== "undefined" && __require.extensions) _customRequire = __require;
|
|
@@ -223,7 +223,7 @@ function importResolve(filepath, options) {
|
|
|
223
223
|
if (moduleFilePath.startsWith("file://")) moduleFilePath = fileURLToPath(moduleFilePath);
|
|
224
224
|
debug("[importResolve] import.meta.resolve %o => %o", filepath, moduleFilePath);
|
|
225
225
|
if (!fs.statSync(moduleFilePath, { throwIfNoEntry: false })?.isFile()) throw new TypeError(`Cannot find module ${filepath}, because ${moduleFilePath} does not exists`);
|
|
226
|
-
} else moduleFilePath = getRequire().resolve(filepath);
|
|
226
|
+
} else moduleFilePath = getRequire().resolve(filepath, paths ? { paths } : void 0);
|
|
227
227
|
debug("[importResolve:success] %o, options: %o => %o, isESM: %s", filepath, options, moduleFilePath, isESM);
|
|
228
228
|
return moduleFilePath;
|
|
229
229
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eggjs/utils",
|
|
3
|
-
"version": "5.0.2-beta.
|
|
3
|
+
"version": "5.0.2-beta.11",
|
|
4
4
|
"description": "Utils for all egg projects",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"egg",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"access": "public"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@eggjs/typings": "4.1.2-beta.
|
|
32
|
+
"@eggjs/typings": "4.1.2-beta.11"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"coffee": "5",
|