@midwayjs/info 3.11.12 → 3.12.0

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.
@@ -104,7 +104,7 @@ let InfoService = class InfoService {
104
104
  ];
105
105
  const info = {};
106
106
  for (const modName of npmModuleList) {
107
- const modulePkg = (0, utils_1.safeRequire)((0, path_1.join)(modName, 'package.json'));
107
+ const modulePkg = this.midwayInformationService.getPkg();
108
108
  if (modulePkg) {
109
109
  info[modName] = modulePkg.version;
110
110
  }
package/dist/utils.js CHANGED
@@ -1,9 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.safeContent = exports.renderToHtml = exports.bitToMB = exports.safeRequire = void 0;
4
+ const fs_1 = require("fs");
4
5
  function safeRequire(mod, defaultValue) {
5
6
  try {
6
- return require(mod);
7
+ if (!(0, fs_1.existsSync)(mod)) {
8
+ return defaultValue;
9
+ }
10
+ return JSON.parse((0, fs_1.readFileSync)(mod, 'utf8'));
7
11
  }
8
12
  catch (e) {
9
13
  return defaultValue;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@midwayjs/info",
3
3
  "description": "midway info",
4
- "version": "3.11.12",
4
+ "version": "3.12.0",
5
5
  "main": "dist/index",
6
6
  "typings": "index.d.ts",
7
7
  "files": [
@@ -13,11 +13,11 @@
13
13
  "picomatch": "2.3.1"
14
14
  },
15
15
  "devDependencies": {
16
- "@midwayjs/core": "^3.11.11",
17
- "@midwayjs/express": "^3.11.12",
18
- "@midwayjs/koa": "^3.11.12",
19
- "@midwayjs/mock": "^3.11.12",
20
- "@midwayjs/serverless-fc-starter": "^3.11.11",
16
+ "@midwayjs/core": "^3.12.0",
17
+ "@midwayjs/express": "^3.12.0",
18
+ "@midwayjs/koa": "^3.12.0",
19
+ "@midwayjs/mock": "^3.12.0",
20
+ "@midwayjs/serverless-fc-starter": "^3.12.0",
21
21
  "@midwayjs/serverless-scf-starter": "^3.10.14"
22
22
  },
23
23
  "keywords": [
@@ -39,5 +39,5 @@
39
39
  "type": "git",
40
40
  "url": "https://github.com/midwayjs/midway.git"
41
41
  },
42
- "gitHead": "7454a59cd57e693a04e4c887535c9193354e2980"
42
+ "gitHead": "0e9a08cd078c4c4dedfa753a8c1025806cc0b0a2"
43
43
  }