@eggjs/utils 5.0.2-beta.12 → 5.0.2-beta.14

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.
Files changed (2) hide show
  1. package/dist/import.js +7 -0
  2. package/package.json +2 -2
package/dist/import.js CHANGED
@@ -284,6 +284,13 @@ async function importModule(filepath, options) {
284
284
  }
285
285
  return obj$1;
286
286
  }
287
+ const _moduleImporter = globalThis.__EGG_MODULE_IMPORTER__;
288
+ if (_moduleImporter) {
289
+ let obj$1 = await _moduleImporter(moduleFilePath);
290
+ if (obj$1 && typeof obj$1 === "object" && obj$1.default?.__esModule === true && obj$1.default && "default" in obj$1.default) obj$1 = obj$1.default;
291
+ if (options?.importDefaultOnly && obj$1 && typeof obj$1 === "object" && "default" in obj$1) obj$1 = obj$1.default;
292
+ return obj$1;
293
+ }
287
294
  let obj;
288
295
  if (isESM) {
289
296
  const fileUrl = pathToFileURL(moduleFilePath).toString();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eggjs/utils",
3
- "version": "5.0.2-beta.12",
3
+ "version": "5.0.2-beta.14",
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.12"
32
+ "@eggjs/typings": "4.1.2-beta.14"
33
33
  },
34
34
  "devDependencies": {
35
35
  "coffee": "5",