@midwayjs/web 3.1.3 → 3.1.6

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/cluster.js CHANGED
@@ -1,4 +1,5 @@
1
1
  "use strict";
2
+ var _a, _b;
2
3
  Object.defineProperty(exports, "__esModule", { value: true });
3
4
  const core_1 = require("@midwayjs/core");
4
5
  const path_1 = require("path");
@@ -13,7 +14,7 @@ function runInAgent() {
13
14
  process.env['EGG_CLUSTER_MODE'] = 'true';
14
15
  const isAgent = runInAgent();
15
16
  debug('[egg]: run with egg-scripts in worker and init midway container in cluster mode');
16
- const appDir = process.cwd();
17
+ const appDir = (_b = (_a = JSON.parse(process.argv[2])) === null || _a === void 0 ? void 0 : _a.baseDir) !== null && _b !== void 0 ? _b : process.cwd();
17
18
  let baseDir;
18
19
  if ((0, utils_1.isTypeScriptEnvironment)()) {
19
20
  baseDir = (0, path_1.join)(appDir, 'src');
package/dist/utils.js CHANGED
@@ -67,6 +67,16 @@ const getCurrentDateString = (timestamp = Date.now()) => {
67
67
  };
68
68
  exports.getCurrentDateString = getCurrentDateString;
69
69
  async function initializeAgentApplicationContext(agent) {
70
+ const applicationContext = (0, core_1.getCurrentApplicationContext)();
71
+ const agentFramework = new web_1.MidwayWebFramework(applicationContext);
72
+ agentFramework['logger'] = agent.logger;
73
+ agentFramework['appLogger'] = agent.coreLogger;
74
+ agentFramework.app = agent;
75
+ agentFramework.configService = applicationContext.get(core_1.MidwayConfigService);
76
+ agentFramework.environmentService = applicationContext.get(core_1.MidwayEnvironmentService);
77
+ agentFramework.loggerService = applicationContext.get(core_1.MidwayLoggerService);
78
+ agentFramework.informationService = applicationContext.get(core_1.MidwayInformationService);
79
+ agentFramework.overwriteApplication('agent');
70
80
  if (process.env['EGG_CLUSTER_MODE'] === 'true') {
71
81
  // init aop support
72
82
  const aspectService = (0, core_1.getCurrentApplicationContext)().get(core_1.MidwayAspectService);
@@ -108,16 +118,6 @@ async function initializeAgentApplicationContext(agent) {
108
118
  else {
109
119
  debug('[egg]: "initializeAgentApplicationContext" ignore re-init in single process');
110
120
  }
111
- const applicationContext = (0, core_1.getCurrentApplicationContext)();
112
- const agentFramework = new web_1.MidwayWebFramework(applicationContext);
113
- agentFramework['logger'] = agent.logger;
114
- agentFramework['appLogger'] = agent.coreLogger;
115
- agentFramework.app = agent;
116
- agentFramework.configService = applicationContext.get(core_1.MidwayConfigService);
117
- agentFramework.environmentService = applicationContext.get(core_1.MidwayEnvironmentService);
118
- agentFramework.loggerService = applicationContext.get(core_1.MidwayLoggerService);
119
- agentFramework.informationService = applicationContext.get(core_1.MidwayInformationService);
120
- agentFramework.overwriteApplication('agent');
121
121
  return applicationContext;
122
122
  }
123
123
  exports.initializeAgentApplicationContext = initializeAgentApplicationContext;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@midwayjs/web",
3
- "version": "3.1.3",
3
+ "version": "3.1.6",
4
4
  "description": "Midway Web Framework for Egg.js",
5
5
  "main": "dist/index",
6
6
  "typings": "dist/index.d.ts",
@@ -27,9 +27,9 @@
27
27
  ],
28
28
  "license": "MIT",
29
29
  "devDependencies": {
30
- "@midwayjs/decorator": "^3.0.10",
30
+ "@midwayjs/decorator": "^3.1.6",
31
31
  "@midwayjs/logger": "^2.15.0",
32
- "@midwayjs/mock": "^3.1.2",
32
+ "@midwayjs/mock": "^3.1.6",
33
33
  "axios": "0.26.1",
34
34
  "dayjs": "1.10.8",
35
35
  "egg-logger": "2.7.1",
@@ -46,7 +46,7 @@
46
46
  },
47
47
  "dependencies": {
48
48
  "@eggjs/router": "^2.0.0",
49
- "@midwayjs/core": "^3.1.2",
49
+ "@midwayjs/core": "^3.1.6",
50
50
  "egg": "^2.28.0",
51
51
  "egg-cluster": "^1.27.1",
52
52
  "find-up": "5.0.0",
@@ -60,5 +60,5 @@
60
60
  "engines": {
61
61
  "node": ">=12"
62
62
  },
63
- "gitHead": "98d41a7a8b40d65f43df9655b1f5b4aebcdc091a"
63
+ "gitHead": "8c157a2b1a23ca2360522dc0de58513098952391"
64
64
  }