ee-core 2.12.0 → 4.0.0-beta.1

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 (96) hide show
  1. package/app/application.js +31 -0
  2. package/app/boot.js +81 -0
  3. package/app/dir.js +27 -0
  4. package/app/events.js +56 -0
  5. package/app/index.js +7 -0
  6. package/config/config_loader.js +19 -23
  7. package/config/default_config.js +110 -0
  8. package/config/index.js +20 -37
  9. package/const/channel.js +26 -16
  10. package/const/index.js +0 -4
  11. package/controller/controller_loader.js +78 -0
  12. package/controller/index.js +18 -19
  13. package/core/index.js +6 -5
  14. package/core/{lib/loader → loader}/file_loader.js +39 -156
  15. package/core/utils/index.js +83 -0
  16. package/core/{lib/utils → utils}/timing.js +3 -2
  17. package/cross/cross.js +152 -0
  18. package/cross/index.js +6 -181
  19. package/cross/spawnProcess.js +34 -51
  20. package/electron/app/index.js +38 -54
  21. package/electron/index.js +13 -17
  22. package/electron/window/index.js +260 -65
  23. package/exception/index.js +34 -32
  24. package/html/index.js +7 -10
  25. package/index.js +4 -52
  26. package/jobs/child/app.js +10 -10
  27. package/jobs/child/forkProcess.js +29 -45
  28. package/jobs/child/index.js +13 -10
  29. package/jobs/child-pool/index.js +13 -11
  30. package/jobs/index.js +2 -4
  31. package/loader/index.js +91 -143
  32. package/log/index.js +74 -57
  33. package/log/logger.js +75 -80
  34. package/message/childMessage.js +13 -13
  35. package/message/index.js +7 -16
  36. package/package.json +2 -2
  37. package/ps/index.js +136 -229
  38. package/socket/httpServer.js +46 -43
  39. package/socket/index.js +52 -69
  40. package/socket/ipcServer.js +80 -94
  41. package/socket/socketServer.js +31 -24
  42. package/storage/index.js +5 -37
  43. package/storage/sqliteStorage.js +18 -18
  44. package/utils/extend.js +10 -5
  45. package/utils/helper.js +38 -42
  46. package/utils/index.js +40 -23
  47. package/utils/ip.js +5 -45
  48. package/utils/is.js +107 -141
  49. package/utils/json.js +15 -7
  50. package/utils/pargv.js +5 -1
  51. package/utils/{get-port → port}/index.js +4 -26
  52. package/utils/wrap.js +8 -3
  53. package/addon/index.js +0 -35
  54. package/addon/window/index.js +0 -99
  55. package/bin/tools.js +0 -8
  56. package/config/cache.js +0 -62
  57. package/config/config.default.js +0 -331
  58. package/controller/baseContextClass.js +0 -25
  59. package/core/lib/ee.js +0 -216
  60. package/core/lib/loader/context_loader.js +0 -106
  61. package/core/lib/loader/ee_loader.js +0 -435
  62. package/core/lib/loader/mixin/addon.js +0 -32
  63. package/core/lib/loader/mixin/config.js +0 -130
  64. package/core/lib/loader/mixin/controller.js +0 -125
  65. package/core/lib/loader/mixin/service.js +0 -28
  66. package/core/lib/utils/base_context_class.js +0 -34
  67. package/core/lib/utils/function.js +0 -30
  68. package/core/lib/utils/index.js +0 -133
  69. package/core/lib/utils/sequencify.js +0 -59
  70. package/ee/appLoader.js +0 -48
  71. package/ee/application.js +0 -101
  72. package/ee/baseApp.js +0 -99
  73. package/ee/eeApp.js +0 -406
  74. package/ee/index.js +0 -58
  75. package/electron/window/winState.js +0 -186
  76. package/httpclient/index.js +0 -161
  77. package/jobs/baseJobClass.js +0 -16
  78. package/jobs/renderer/index.js +0 -141
  79. package/jobs/renderer/loadView.js +0 -41
  80. package/jobs/unification.js +0 -64
  81. package/main/index.js +0 -57
  82. package/old-utils/index.js +0 -91
  83. package/services/baseContextClass.js +0 -24
  84. package/services/index.js +0 -41
  85. package/socket/io.js +0 -28
  86. package/storage/jsondb/adapters/Base.js +0 -23
  87. package/storage/jsondb/adapters/FileSync.js +0 -64
  88. package/storage/jsondb/main.js +0 -55
  89. package/storage/jsondbStorage.js +0 -196
  90. package/utils/co.js +0 -237
  91. package/utils/copyto.js +0 -161
  92. package/utils/depd/index.js +0 -538
  93. package/utils/depd/lib/browser/index.js +0 -77
  94. package/utils/get-port/index.d.ts +0 -64
  95. package/utils/time/index.js +0 -20
  96. package/utils/time/ms.js +0 -162
@@ -1,74 +1,269 @@
1
+ 'use strict';
2
+
3
+ const debug = require('debug')('ee-core:electron:window');
1
4
  const is = require('is-type-of');
2
- const { BrowserWindow, Menu } = require('electron');
3
- const Conf = require('../../config/cache');
4
- const Ps = require('../../ps');
5
- const EEMainWindow = Symbol('Ee#electron#mainWindow');
6
-
7
- const Window = {
8
-
9
- /**
10
- * 获取 mainWindow
11
- */
12
- getMainWindow() {
13
- if (!this[EEMainWindow]) {
14
- this[EEMainWindow] = this.createMainWindow();
15
- }
5
+ const path = require('path');
6
+ const axios = require('axios');
7
+ const { BrowserWindow } = require('electron');
8
+ const { getConfig } = require('../../config');
9
+ const { eventBus, WindowReady } = require('../../app/events');
10
+ const { env, isDev, getBaseDir } = require('../../ps');
11
+ const { loadFile } = require('../../loader');
12
+ const { isFileProtocol } = require('../../utils');
13
+ const { getHtmlFilepath } = require('../../html');
14
+ const { fileIsExist, sleep } = require('../../utils/helper');
15
+ const { coreLogger } = require('../../log');
16
+ const { extend } = require('../../utils/extend');
17
+ const { cross } = require('../../cross');
18
+
19
+ const Instance = {
20
+ mainWindow: null,
21
+ closeAndQuit: true,
22
+ };
23
+
24
+ // getMainWindow
25
+ function getMainWindow() {
26
+ return Instance.mainWindow;
27
+ }
28
+
29
+ // Create the main application window
30
+ function createMainWindow() {
31
+ const { openDevTools, windowsOption } = getConfig();
32
+ const win = new BrowserWindow(windowsOption);
33
+ Instance.mainWindow = win;
16
34
 
17
- return this[EEMainWindow] || null;
18
- },
19
-
20
- /**
21
- * 创建应用主窗口
22
- */
23
- createMainWindow() {
24
-
25
- // todo
26
- // const protocolName = 'eefile';
27
- // protocol.registerFileProtocol(protocolName, (request, callback) => {
28
- // const url = request.url.substring(protocolName.length + 3);
29
- // console.log('[ee-core] [lib/eeApp] registerFileProtocol ----url: ', url);
30
- // callback({ path: path.normalize(decodeURIComponent(url)) })
31
- // });
32
-
33
- const config = Conf.all();
34
- const win = new BrowserWindow(config.windowsOption);
35
- this[EEMainWindow] = win;
36
-
37
- // 菜单显示/隐藏
38
- if (config.openAppMenu === 'dev-show' && Ps.isProd()) {
39
- Menu.setApplicationMenu(null);
40
- } else if (config.openAppMenu === false) {
41
- Menu.setApplicationMenu(null);
42
- } else {
43
- // nothing
35
+ // DevTools
36
+ if (is.object(openDevTools)) {
37
+ win.webContents.openDevTools(openDevTools);
38
+ } else if (openDevTools === true) {
39
+ win.webContents.openDevTools({
40
+ mode: 'bottom'
41
+ });
42
+ }
43
+
44
+ eventBus.emitLifecycle(WindowReady);
45
+ return win;
46
+ }
47
+
48
+ // restored window
49
+ function restoreMainWindow() {
50
+ if (Instance.mainWindow) {
51
+ if (Instance.mainWindow.isMinimized()) {
52
+ Instance.mainWindow.restore();
44
53
  }
54
+ Instance.mainWindow.show();
55
+ Instance.mainWindow.focus();
56
+ }
57
+ }
45
58
 
46
- // DevTools
47
- if (is.object(config.openDevTools)) {
48
- win.webContents.openDevTools(config.openDevTools);
49
- } else if (config.openDevTools === true) {
50
- win.webContents.openDevTools({
51
- mode: 'undocked'
52
- });
53
- } else {
54
- //
59
+ // Set the flag for exiting after close all windows
60
+ function setCloseAndQuit(flag) {
61
+ Instance.closeAndQuit = flag;
62
+ }
63
+
64
+ function getCloseAndQuit() {
65
+ return Instance.closeAndQuit;
66
+ }
67
+
68
+ // load server
69
+ // type: remote | single
70
+ async function loadServer() {
71
+ let type = 'spa';
72
+ let url = '';
73
+ const { remote, mainServer } = getConfig();
74
+ const win = getMainWindow();
75
+
76
+ // remote model
77
+ if (remote.enable == true) {
78
+ type = 'remote';
79
+ url = remote.url;
80
+ loadMainUrl(type, url);
81
+ return;
82
+ }
83
+
84
+ // 开发环境
85
+ if (isDev()) {
86
+ let url;
87
+ let load = 'url';
88
+
89
+ const binFile = path.join(getBaseDir(), "./cmd/bin.js");
90
+ const binConfig = loadFile(binFile);
91
+ const { dev } = binConfig;
92
+ // tips: match with ee-bin
93
+ const frontendConf = extend(true, {
94
+ protocol: 'http://',
95
+ hostname: 'localhost',
96
+ port: 8080,
97
+ indexPath: 'index.html',
98
+ }, dev.frontend);
99
+ const electronConf = extend(true, {
100
+ loadingPage: '/public/html/loading.html',
101
+ }, dev.electron);
102
+
103
+ url = frontendConf.protocol + frontendConf.hostname + ':' + frontendConf.port;
104
+ if (isFileProtocol(frontendConf.protocol)) {
105
+ url = path.join(getBaseDir(), frontendConf.directory, frontendConf.indexPath);
106
+ load = 'file';
55
107
  }
56
-
57
- return win;
58
- },
59
-
60
- /**
61
- * 还原窗口
62
- */
63
- restoreMainWindow() {
64
- if (this[EEMainWindow]) {
65
- if (this[EEMainWindow].isMinimized()) {
66
- this[EEMainWindow].restore();
108
+
109
+ // Check if UI serve is started, load a boot page first
110
+ if (load == 'url') {
111
+ // loading page
112
+ let lp = getHtmlFilepath('boot.html');
113
+ if (electronConf.hasOwnProperty('loadingPage') && electronConf.loadingPage != '') {
114
+ lp = path.join(getBaseDir(), electronConf.loadingPage);
115
+ }
116
+ _loadingPage(lp);
117
+
118
+ // check frontend is ready
119
+ const retryTimes = frontendConf.force === true ? 3 : 60;
120
+ let count = 0;
121
+ let frontendReady = false;
122
+ while(!frontendReady && count < retryTimes){
123
+ await sleep(1 * 1000);
124
+ try {
125
+ await axios({
126
+ method: 'get',
127
+ url,
128
+ timeout: 1000,
129
+ proxy: false,
130
+ headers: {
131
+ 'Accept': 'text/html, application/json, text/plain, */*',
132
+ },
133
+ //responseType: 'text',
134
+ });
135
+ frontendReady = true;
136
+ } catch(err) {
137
+ // console.warn(err.stack)
138
+ }
139
+ count++;
140
+ }
141
+ debug('it takes %d seconds to start the frontend', count);
142
+
143
+ if (frontendReady == false && frontendConf.force !== true) {
144
+ const bootFailurePage = getHtmlFilepath('failure.html');
145
+ win.loadFile(bootFailurePage);
146
+ coreLogger.error(`[ee-core] Please check the ${url} !`);
147
+ return;
67
148
  }
68
- this[EEMainWindow].show();
69
- this[EEMainWindow].focus();
70
149
  }
150
+
151
+ loadMainUrl(type, url, load);
152
+ return;
71
153
  }
72
- };
73
154
 
74
- module.exports = Window;
155
+ // 生产环境
156
+ // cross takeover web
157
+ if (mainServer.takeover.length > 0) {
158
+ await crossTakeover()
159
+ return
160
+ }
161
+
162
+ // 主进程
163
+ url = path.join(getBaseDir(), mainServer.indexPath);
164
+ loadMainUrl(type, url, 'file');
165
+ }
166
+
167
+ /**
168
+ * 主服务
169
+ * @params load <string> value: "url" 、 "file"
170
+ */
171
+ function loadMainUrl(type, url, load = 'url') {
172
+ const { mainServer } = getConfig();
173
+ const mainWindow = getMainWindow();
174
+ coreLogger.info('[ee-core] Env: %s, Type: %s', env(), type);
175
+ coreLogger.info('[ee-core] App running at: %s', url);
176
+ if (load == 'file') {
177
+ mainWindow.loadFile(url, mainServer.options)
178
+ .then()
179
+ .catch((err)=>{
180
+ coreLogger.error(`[ee-core] Please check the ${url} !`);
181
+ });
182
+ } else {
183
+ mainWindow.loadURL(url, mainServer.options)
184
+ .then()
185
+ .catch((err)=>{
186
+ coreLogger.error(`[ee-core] Please check the ${url} !`);
187
+ });
188
+ }
189
+ }
190
+
191
+ // loading page
192
+ function _loadingPage(name) {
193
+ if (!fileIsExist(name)) {
194
+ return
195
+ }
196
+ const win = getMainWindow();
197
+ win.loadFile(name);
198
+ }
199
+
200
+ /**
201
+ * cross takeover web
202
+ */
203
+ async function crossTakeover() {
204
+ const crossConf = getConfig().cross;
205
+ const mainConf = getConfig().mainServer;
206
+
207
+ // loading page
208
+ if (mainConf.loadingPage.length > 0) {
209
+ const lp = path.join(getBaseDir, mainConf.loadingPage);
210
+ _loadingPage(lp);
211
+ }
212
+
213
+ // cross service url
214
+ const service = mainConf.takeover;
215
+ if (!crossConf.hasOwnProperty(service)) {
216
+ throw new Error(`[ee-core] Please Check the value of mainServer.takeover in the config file !`);
217
+ }
218
+ // check service
219
+ if (crossConf[service].enable != true) {
220
+ throw new Error(`[ee-core] Please Check the value of cross.${service} enable is true !`);
221
+ }
222
+
223
+ const entityName = crossConf[service].name;
224
+ const url = cross.getUrl(entityName);
225
+
226
+ // 循环检查
227
+ let count = 0;
228
+ let serviceReady = false;
229
+ const times = isDev() ? 20 : 100;
230
+ const sleeptime = isDev() ? 1000 : 200;
231
+ while(!serviceReady && count < times){
232
+ await sleep(sleeptime);
233
+ try {
234
+ await axios({
235
+ method: 'get',
236
+ url,
237
+ timeout: 100,
238
+ proxy: false,
239
+ headers: {
240
+ 'Accept': 'text/html, application/json, text/plain, */*',
241
+ },
242
+ });
243
+ serviceReady = true;
244
+ } catch(err) {
245
+ // console.warn(err.stack)
246
+ }
247
+ count++;
248
+ }
249
+ debug('it takes %d seconds to start the cross serivce', count * sleeptime);
250
+
251
+ if (serviceReady == false) {
252
+ const bootFailurePage = getHtmlFilepath('cross-failure.html');
253
+ const mainWindow = getMainWindow();
254
+ mainWindow.loadFile(bootFailurePage);
255
+ throw new Error(`[ee-core] Please check cross service [${service}] ${url} !`)
256
+ }
257
+
258
+ coreLogger.info(`[ee-core] cross service [${service}] is started successfully`);
259
+ loadMainUrl('spa', url);
260
+ }
261
+
262
+ module.exports = {
263
+ getMainWindow,
264
+ createMainWindow,
265
+ restoreMainWindow,
266
+ setCloseAndQuit,
267
+ getCloseAndQuit,
268
+ loadServer
269
+ };
@@ -1,20 +1,22 @@
1
- const Log = require('../log');
2
- const Ps = require('../ps');
3
- const Conf = require('../config/cache');
4
- const Message = require('../message');
1
+ 'use strict';
2
+
3
+ const { coreLogger } = require('../log');
4
+ const { isForkedChild, isRenderer, isDev, isMain } = require('../ps');
5
+ const { getConfig } = require('../config');
6
+ const { childMessage } = require('../message');
5
7
 
6
8
  /**
7
9
  * 捕获异常
8
10
  */
9
- exports.start = function() {
10
- this.uncaughtExceptionHandler();
11
- this.unhandledRejectionHandler();
11
+ function loadException() {
12
+ uncaughtExceptionHandler();
13
+ unhandledRejectionHandler();
12
14
  }
13
15
 
14
16
  /**
15
17
  * 当进程上抛出异常而没有被捕获时触发该事件,并且使异常静默。
16
18
  */
17
- exports.uncaughtExceptionHandler = function() {
19
+ function uncaughtExceptionHandler() {
18
20
  process.on('uncaughtException', function(err) {
19
21
  if (!(err instanceof Error)) {
20
22
  err = new Error(String(err));
@@ -24,7 +26,7 @@ exports.uncaughtExceptionHandler = function() {
24
26
  err.name = 'unhandledExceptionError';
25
27
  }
26
28
 
27
- Log.coreLogger.error(err);
29
+ coreLogger.error(err);
28
30
 
29
31
  _devError(err);
30
32
 
@@ -35,21 +37,20 @@ exports.uncaughtExceptionHandler = function() {
35
37
  /**
36
38
  * 当进程上抛出异常而没有被捕获时触发该事件。
37
39
  */
38
- exports.uncaughtExceptionMonitorHandler = function() {
39
- // process.on('uncaughtExceptionMonitor', function(err, origin) {
40
- // if (!(err instanceof Error)) {
41
- // err = new Error(String(err));
42
- // }
43
-
44
- // Log.coreLogger.error('uncaughtExceptionMonitor:',err);
45
- // });
40
+ function uncaughtExceptionMonitorHandler() {
41
+ process.on('uncaughtExceptionMonitor', function(err, origin) {
42
+ if (!(err instanceof Error)) {
43
+ err = new Error(String(err));
44
+ }
45
+ coreLogger.error('uncaughtExceptionMonitor:',err);
46
+ });
46
47
  }
47
48
 
48
49
  /**
49
50
  * 当promise中reject的异常在同步任务中没有使用catch捕获就会触发该事件,
50
51
  * 即便是在异步情况下使用了catch也会触发该事件
51
52
  */
52
- exports.unhandledRejectionHandler = function() {
53
+ function unhandledRejectionHandler() {
53
54
  process.on('unhandledRejection', function(err) {
54
55
  if (!(err instanceof Error)) {
55
56
  const newError = new Error(String(err));
@@ -64,11 +65,8 @@ exports.unhandledRejectionHandler = function() {
64
65
  if (err.name === 'Error') {
65
66
  err.name = 'unhandledRejectionError';
66
67
  }
67
-
68
- Log.coreLogger.error(err);
69
-
68
+ coreLogger.error(err);
70
69
  _devError(err);
71
-
72
70
  _exit();
73
71
  });
74
72
  }
@@ -77,8 +75,8 @@ exports.unhandledRejectionHandler = function() {
77
75
  * 如果是子进程,发送错误到主进程控制台
78
76
  */
79
77
  function _devError (err) {
80
- if (Ps.isForkedChild() && Ps.isDev()) {
81
- Message.childMessage.sendErrorToTerminal(err);
78
+ if (isForkedChild() && isDev()) {
79
+ childMessage.sendErrorToTerminal(err);
82
80
  }
83
81
  }
84
82
 
@@ -86,16 +84,13 @@ function _devError (err) {
86
84
  * 捕获异常后是否退出
87
85
  */
88
86
  function _exit () {
89
- let cfg = Conf.getValue('exception');
90
- if (!cfg) {
91
- return;
92
- }
87
+ const { mainExit, childExit, rendererExit } = getConfig().exception;
93
88
 
94
- if (Ps.isMain() && cfg.mainExit == true) {
89
+ if (isMain() && mainExit == true) {
95
90
  _delayExit();
96
- } else if (Ps.isForkedChild() && cfg.childExit == true) {
91
+ } else if (isForkedChild() && childExit == true) {
97
92
  _delayExit();
98
- } else if (Ps.isRenderer() && cfg.rendererExit == true) {
93
+ } else if (isRenderer() && rendererExit == true) {
99
94
  _delayExit();
100
95
  } else {
101
96
  // other
@@ -110,4 +105,11 @@ function _delayExit() {
110
105
  setTimeout(() => {
111
106
  process.exit();
112
107
  }, 1500)
113
- }
108
+ }
109
+
110
+ module.exports = {
111
+ loadException,
112
+ uncaughtExceptionHandler,
113
+ unhandledRejectionHandler,
114
+ uncaughtExceptionMonitorHandler
115
+ };
package/html/index.js CHANGED
@@ -1,14 +1,11 @@
1
1
  const path = require('path');
2
2
 
3
- /**
4
- * Html
5
- */
6
- const Html = {
7
- getFilepath(name){
8
- const pagePath = path.join(__dirname, name);
9
- return pagePath;
10
- },
11
-
3
+ // Html
4
+ function getHtmlFilepath(name){
5
+ const pagePath = path.join(__dirname, name);
6
+ return pagePath;
12
7
  }
13
8
 
14
- module.exports = Html;
9
+ module.exports = {
10
+ getHtmlFilepath
11
+ };
package/index.js CHANGED
@@ -1,55 +1,7 @@
1
- /**
2
- * @namespace EeCore
3
- */
1
+ 'use strict';
4
2
 
5
- /**
6
- * @member {ElectronEgg} EeCore#Index
7
- * @since 1.0.0
8
- */
9
- const ElectronEgg = require('./main');
10
-
11
- /**
12
- * @member {app} EeCore#app
13
- * @since 1.0.0
14
- */
15
- const EE = require('./ee');
16
-
17
- /**
18
- * @member {Controller} EeCore#Controller
19
- * @since 1.0.0
20
- */
21
- const Controller = require('./controller/baseContextClass');
22
-
23
- /**
24
- * @member {Service} EeCore#Service
25
- * @since 1.0.0
26
- */
27
- const Service = require('./services/baseContextClass');
28
-
29
- /**
30
- * @member {Storage}
31
- * @since 1.0.0
32
- */
33
- const Storage = require('./storage');
34
-
35
- /**
36
- * @member {Utils}
37
- * @since 1.0.0
38
- */
39
- const Utils = require('./old-utils');
40
-
41
- /**
42
- * @member {Socket}
43
- * @since 1.0.0
44
- */
45
- const Socket = require('./socket');
3
+ const { ElectronEgg } = require('./app');
46
4
 
47
5
  module.exports = {
48
- ElectronEgg,
49
- Application: EE.Application,
50
- Controller,
51
- Service,
52
- Storage,
53
- Socket,
54
- Utils
55
- };
6
+ ElectronEgg
7
+ }
package/jobs/child/app.js CHANGED
@@ -1,11 +1,11 @@
1
1
 
2
2
  const is = require('is-type-of');
3
- const Exception = require('ee-core/exception');
4
- const Loader = require('ee-core/loader');
5
- const Log = require('ee-core/log');
6
- const UtilsCore = require('ee-core/core/lib/utils');
3
+ const { loadException } = require('ee-core/exception');
4
+ const { requireFile } = require('ee-core/loader');
5
+ const { coreLogger } = require('ee-core/log');
6
+ const { isBytecodeClass } = require('ee-core/core/utils');
7
7
 
8
- Exception.start();
8
+ loadException();
9
9
  const commands = ['run'];
10
10
 
11
11
  class ChildApp {
@@ -20,7 +20,7 @@ class ChildApp {
20
20
  _initEvents() {
21
21
  process.on('message', this._handleMessage.bind(this));
22
22
  process.once('exit', (code) => {
23
- Log.coreLogger.info(`[ee-core] [jobs/child] received a exit from main-process, code:${code}, pid:${process.pid}`);
23
+ coreLogger.info(`[ee-core] [jobs/child] received a exit from main-process, code:${code}, pid:${process.pid}`);
24
24
  });
25
25
  }
26
26
 
@@ -37,7 +37,7 @@ class ChildApp {
37
37
  break;
38
38
  default:
39
39
  }
40
- Log.coreLogger.info(`[ee-core] [jobs/child] received a message from main-process, message: ${JSON.stringify(m)}`);
40
+ coreLogger.info(`[ee-core] [jobs/child] received a message from main-process, message: ${JSON.stringify(m)}`);
41
41
  }
42
42
 
43
43
  /**
@@ -45,8 +45,8 @@ class ChildApp {
45
45
  */
46
46
  run(msg = {}) {
47
47
  const {jobPath, jobParams, jobFunc, jobFuncParams} = msg;
48
- let mod = Loader.loadJsFile(jobPath);
49
- if (is.class(mod) || UtilsCore.isBytecodeClass(mod)) {
48
+ let mod = requireFile(jobPath);
49
+ if (is.class(mod) || isBytecodeClass(mod)) {
50
50
  if (!this.jobMap.has(jobPath)) {
51
51
  const instance = new mod(...jobParams);
52
52
  instance.handle(...jobParams);
@@ -58,7 +58,7 @@ class ChildApp {
58
58
 
59
59
  } else if (is.function(mod)) {
60
60
  mod(jobParams);
61
- }
61
+ }
62
62
  }
63
63
  }
64
64