ee-core 1.5.2-beta.2 → 2.0.0-beta.2

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 (61) hide show
  1. package/config/config.default.js +8 -1
  2. package/core/lib/ee.js +1 -1
  3. package/core/lib/loader/ee_loader.js +23 -45
  4. package/core/lib/loader/mixin/config.js +6 -11
  5. package/core/lib/loader/mixin/controller.js +3 -2
  6. package/core/lib/utils/function.js +30 -0
  7. package/core/lib/utils/index.js +6 -0
  8. package/index.js +2 -2
  9. package/lib/appLoader.js +0 -5
  10. package/lib/application.js +12 -9
  11. package/lib/baseApp.js +9 -26
  12. package/lib/eeApp.js +18 -52
  13. package/{lib/constant.js → module/const/index.js} +3 -0
  14. package/module/exception/index.js +16 -0
  15. package/{lib/httpclient.js → module/httpclient/index.js} +45 -11
  16. package/module/jobs/child/app.js +23 -0
  17. package/module/jobs/child/forkProcess.js +104 -0
  18. package/module/jobs/child/index.js +35 -0
  19. package/module/jobs/index.js +56 -0
  20. package/module/jobs/renderer/index.js +140 -0
  21. package/module/jobs/renderer/loadView.js +40 -0
  22. package/module/loader/index.js +130 -0
  23. package/module/log/index.js +53 -0
  24. package/module/log/logger.js +61 -0
  25. package/module/message/index.js +13 -0
  26. package/module/message/ipcMain.js +160 -0
  27. package/module/message/ipcRender.js +0 -0
  28. package/{lib → module}/socket/ipcServer.js +6 -8
  29. package/{lib → module}/socket/socketClient.js +4 -3
  30. package/{lib → module}/socket/socketServer.js +4 -3
  31. package/module/socket/start.js +22 -0
  32. package/{lib → module}/storage/index.js +16 -13
  33. package/module/storage/jsondb/adapters/Base.js +14 -0
  34. package/module/storage/jsondb/adapters/FileSync.js +32 -0
  35. package/{lib/storage/lowdb → module/storage/jsondb}/main.js +6 -10
  36. package/{lib/storage/lowdbStorage.js → module/storage/jsondbStorage.js} +12 -14
  37. package/{lib → module}/storage/sqliteStorage.js +7 -11
  38. package/module/utils/copyto.js +161 -0
  39. package/module/utils/helper.js +117 -0
  40. package/module/utils/index.js +120 -0
  41. package/module/utils/json.js +72 -0
  42. package/module/utils/ps.js +196 -0
  43. package/{utils → module/utils}/wrap.js +0 -2
  44. package/package.json +3 -7
  45. package/tools/encrypt.js +2 -2
  46. package/utils/index.js +17 -135
  47. package/lib/logger.js +0 -47
  48. package/lib/socket/start.js +0 -22
  49. package/lib/storage/lowdb/adapters/Base.js +0 -15
  50. package/lib/storage/lowdb/adapters/FileAsync.js +0 -41
  51. package/lib/storage/lowdb/adapters/FileSync.js +0 -39
  52. package/lib/storage/lowdb/adapters/LocalStorage.js +0 -20
  53. package/lib/storage/lowdb/adapters/Memory.js +0 -8
  54. package/lib/storage/lowdb/adapters/_stringify.js +0 -4
  55. package/lib/storage/lowdb/common.js +0 -33
  56. package/lib/storage/lowdb/fp.js +0 -23
  57. package/lib/storage/lowdb/isPromise.js +0 -6
  58. package/lib/storage/lowdb/nano.js +0 -5
  59. package/utils/common.js +0 -91
  60. /package/{lib → module}/socket/httpServer.js +0 -0
  61. /package/{lib → module}/socket/io.js +0 -0
@@ -0,0 +1,161 @@
1
+ /*!
2
+ * copy-to - index.js
3
+ * Copyright(c) 2014 dead_horse <dead_horse@qq.com>
4
+ * MIT Licensed
5
+ */
6
+
7
+ 'use strict';
8
+
9
+ /**
10
+ * slice() reference.
11
+ */
12
+
13
+ var slice = Array.prototype.slice;
14
+
15
+ /**
16
+ * Expose copy
17
+ *
18
+ * ```
19
+ * copy({foo: 'nar', hello: 'copy'}).to({hello: 'world'});
20
+ * copy({foo: 'nar', hello: 'copy'}).toCover({hello: 'world'});
21
+ * ```
22
+ *
23
+ * @param {Object} src
24
+ * @return {Copy}
25
+ */
26
+
27
+ module.exports = Copy;
28
+
29
+
30
+ /**
31
+ * Copy
32
+ * @param {Object} src
33
+ * @param {Boolean} withAccess
34
+ */
35
+
36
+ function Copy(src, withAccess) {
37
+ if (!(this instanceof Copy)) return new Copy(src, withAccess);
38
+ this.src = src;
39
+ this._withAccess = withAccess;
40
+ }
41
+
42
+ /**
43
+ * copy properties include getter and setter
44
+ * @param {[type]} val [description]
45
+ * @return {[type]} [description]
46
+ */
47
+
48
+ Copy.prototype.withAccess = function (w) {
49
+ this._withAccess = w !== false;
50
+ return this;
51
+ };
52
+
53
+ /**
54
+ * pick keys in src
55
+ *
56
+ * @api: public
57
+ */
58
+
59
+ Copy.prototype.pick = function(keys) {
60
+ if (!Array.isArray(keys)) {
61
+ keys = slice.call(arguments);
62
+ }
63
+ if (keys.length) {
64
+ this.keys = keys;
65
+ }
66
+ return this;
67
+ };
68
+
69
+ /**
70
+ * copy src to target,
71
+ * do not cover any property target has
72
+ * @param {Object} to
73
+ *
74
+ * @api: public
75
+ */
76
+
77
+ Copy.prototype.to = function(to) {
78
+ to = to || {};
79
+
80
+ if (!this.src) return to;
81
+ var keys = this.keys || Object.keys(this.src);
82
+
83
+ if (!this._withAccess) {
84
+ for (var i = 0; i < keys.length; i++) {
85
+ var key = keys[i];
86
+ if (to[key] !== undefined) continue;
87
+ to[key] = this.src[key];
88
+ }
89
+ return to;
90
+ }
91
+
92
+ for (var i = 0; i < keys.length; i++) {
93
+ var key = keys[i];
94
+ if (!notDefined(to, key)) continue;
95
+ var getter = this.src.__lookupGetter__(key);
96
+ var setter = this.src.__lookupSetter__(key);
97
+ if (getter) to.__defineGetter__(key, getter);
98
+ if (setter) to.__defineSetter__(key, setter);
99
+
100
+ if (!getter && !setter) {
101
+ to[key] = this.src[key];
102
+ }
103
+ }
104
+ return to;
105
+ };
106
+
107
+ /**
108
+ * copy src to target,
109
+ * override any property target has
110
+ * @param {Object} to
111
+ *
112
+ * @api: public
113
+ */
114
+
115
+ Copy.prototype.toCover = function(to) {
116
+ var keys = this.keys || Object.keys(this.src);
117
+
118
+ for (var i = 0; i < keys.length; i++) {
119
+ var key = keys[i];
120
+ delete to[key];
121
+ var getter = this.src.__lookupGetter__(key);
122
+ var setter = this.src.__lookupSetter__(key);
123
+ if (getter) to.__defineGetter__(key, getter);
124
+ if (setter) to.__defineSetter__(key, setter);
125
+
126
+ if (!getter && !setter) {
127
+ to[key] = this.src[key];
128
+ }
129
+ }
130
+ };
131
+
132
+ Copy.prototype.override = Copy.prototype.toCover;
133
+
134
+ /**
135
+ * append another object to src
136
+ * @param {Obj} obj
137
+ * @return {Copy}
138
+ */
139
+
140
+ Copy.prototype.and = function (obj) {
141
+ var src = {};
142
+ this.to(src);
143
+ this.src = obj;
144
+ this.to(src);
145
+ this.src = src;
146
+
147
+ return this;
148
+ };
149
+
150
+ /**
151
+ * check obj[key] if not defiend
152
+ * @param {Object} obj
153
+ * @param {String} key
154
+ * @return {Boolean}
155
+ */
156
+
157
+ function notDefined(obj, key) {
158
+ return obj[key] === undefined
159
+ && obj.__lookupGetter__(key) === undefined
160
+ && obj.__lookupSetter__(key) === undefined;
161
+ }
@@ -0,0 +1,117 @@
1
+ const fs = require('fs');
2
+ const path = require('path');
3
+ const mkdirp = require('mkdirp');
4
+ const convert = require('koa-convert');
5
+ const is = require('is-type-of');
6
+ const co = require('co');
7
+
8
+ /**
9
+ * fnDebounce
10
+ *
11
+ * @param {Function} fn - 回调函数
12
+ * @param {Time} delayTime - 延迟时间(ms)
13
+ * @param {Boolean} isImediate - 是否需要立即调用
14
+ * @param {type} args - 回调函数传入参数
15
+ */
16
+ exports.fnDebounce = function() {
17
+ const fnObject = {};
18
+ let timer;
19
+
20
+ return (fn, delayTime, isImediate, args) => {
21
+ const setTimer = () => {
22
+ timer = setTimeout(() => {
23
+ fn(args);
24
+ clearTimeout(timer);
25
+ delete fnObject[fn];
26
+ }, delayTime);
27
+
28
+ fnObject[fn] = { delayTime, timer };
29
+ };
30
+
31
+ if (!delayTime || isImediate) return fn(args);
32
+
33
+ if (fnObject[fn]) {
34
+ clearTimeout(timer);
35
+ setTimer(fn, delayTime, args);
36
+ } else {
37
+ setTimer(fn, delayTime, args);
38
+ }
39
+ };
40
+ }
41
+
42
+ /**
43
+ * 随机10位字符串
44
+ */
45
+ exports.getRandomString = function() {
46
+ return Math.random().toString(36).substring(2);
47
+ };
48
+
49
+ /**
50
+ * 创建文件夹
51
+ */
52
+ exports.mkdir = function(filepath, opt = {}) {
53
+ mkdirp.sync(filepath, opt);
54
+ return
55
+ }
56
+
57
+ /**
58
+ * 修改文件权限
59
+ */
60
+ exports.chmodPath = function(path, mode) {
61
+ let files = [];
62
+ if (fs.existsSync(path)) {
63
+ files = fs.readdirSync(path);
64
+ files.forEach((file, index) => {
65
+ const curPath = path + '/' + file;
66
+ if (fs.statSync(curPath).isDirectory()) {
67
+ this.chmodPath(curPath, mode); // 递归删除文件夹
68
+ } else {
69
+ fs.chmodSync(curPath, mode);
70
+ }
71
+ });
72
+ fs.chmodSync(path, mode);
73
+ }
74
+ };
75
+
76
+ /**
77
+ * 版本号比较
78
+ */
79
+ exports.compareVersion = function (v1, v2) {
80
+ v1 = v1.split('.')
81
+ v2 = v2.split('.')
82
+ const len = Math.max(v1.length, v2.length)
83
+
84
+ while (v1.length < len) {
85
+ v1.push('0')
86
+ }
87
+ while (v2.length < len) {
88
+ v2.push('0')
89
+ }
90
+
91
+ for (let i = 0; i < len; i++) {
92
+ const num1 = parseInt(v1[i])
93
+ const num2 = parseInt(v2[i])
94
+
95
+ if (num1 > num2) {
96
+ return 1
97
+ } else if (num1 < num2) {
98
+ return -1
99
+ }
100
+ }
101
+
102
+ return 0
103
+ }
104
+
105
+ /**
106
+ * 执行一个函数
107
+ */
108
+ exports.callFn = async function (fn, args, ctx) {
109
+ args = args || [];
110
+ if (!is.function(fn)) return;
111
+ if (is.generatorFunction(fn)) fn = co.wrap(fn);
112
+ return ctx ? fn.call(ctx, ...args) : fn(...args);
113
+ }
114
+
115
+ exports.middleware = function (fn) {
116
+ return is.generatorFunction(fn) ? convert(fn) : fn;
117
+ }
@@ -0,0 +1,120 @@
1
+ const path = require('path');
2
+ const eis = require('electron-is');
3
+ const Storage = require('../storage');
4
+ const Constants = require('../const');
5
+ const Ps = require('./ps');
6
+ const Helper = require('./helper');
7
+ const UtilsJson = require('./json');
8
+ const Copy = require('./copyto');
9
+
10
+ /**
11
+ * other module
12
+ */
13
+ Copy(Ps)
14
+ .and(Helper)
15
+ .to(exports);
16
+
17
+ /**
18
+ * 获取项目根目录package.json
19
+ */
20
+ exports.getPackage = function() {
21
+ const json = UtilsJson.readSync(path.join(this.getHomeDir(), 'package.json'));
22
+
23
+ return json;
24
+ };
25
+
26
+ /**
27
+ * 获取 coredb
28
+ */
29
+ exports.getCoreDB = function() {
30
+ const coreDB = Storage.connection('system');
31
+ return coreDB;
32
+ }
33
+
34
+ /**
35
+ * 获取 ee配置
36
+ */
37
+ exports.getEeConfig = function() {
38
+ const cdb = this.getCoreDB();
39
+ const config = cdb.getItem('config');
40
+
41
+ return config;
42
+ }
43
+
44
+ /**
45
+ * 获取 app version
46
+ */
47
+ exports.getAppVersion = function() {
48
+ const cdb = this.getCoreDB();
49
+ const v = cdb.getItem('config').appVersion;
50
+ return v;
51
+ }
52
+
53
+ /**
54
+ * 获取 插件配置
55
+ */
56
+ exports.getAddonConfig = function() {
57
+ const cdb = this.getCoreDB();
58
+ const cfg = cdb.getItem('config').addons;
59
+ return cfg;
60
+ }
61
+
62
+ /**
63
+ * 获取 mainServer配置
64
+ */
65
+ exports.getMainServerConfig = function() {
66
+ const cdb = this.getCoreDB();
67
+ const cfg = cdb.getItem('config').mainServer;
68
+ return cfg;
69
+ }
70
+
71
+ /**
72
+ * 获取 httpServer配置
73
+ */
74
+ exports.getHttpServerConfig = function() {
75
+ const cdb = this.getCoreDB();
76
+ const cfg = cdb.getItem('config').httpServer;
77
+ return cfg;
78
+ }
79
+
80
+ /**
81
+ * 获取 socketServer配置
82
+ */
83
+ exports.getSocketServerConfig = function() {
84
+ const cdb = this.getCoreDB();
85
+ const cfg = cdb.getItem('config').socketServer;
86
+ return cfg;
87
+ }
88
+
89
+ /**
90
+ * 获取 socket channel
91
+ */
92
+ exports.getSocketChannel = function() {
93
+ return Constants.socketIo.channel;
94
+ }
95
+
96
+ /**
97
+ * 获取 额外资源目录
98
+ */
99
+ exports.getExtraResourcesDir = function() {
100
+ const execDir = this.getExecDir();
101
+ const isPackaged = this.isPackaged();
102
+
103
+
104
+ // 资源路径不同
105
+ let dir = '';
106
+ if (isPackaged) {
107
+ // 打包后 execDir为 应用程序 exe\dmg\dep软件所在目录;打包前该值是项目根目录
108
+ // windows和MacOs不一样
109
+ dir = path.join(execDir, "resources", "extraResources");
110
+ if (eis.macOS()) {
111
+ dir = path.join(execDir, "..", "Resources", "extraResources");
112
+ }
113
+ } else {
114
+ // 打包前
115
+ dir = path.join(execDir, "build", "extraResources");
116
+ }
117
+ return dir;
118
+ }
119
+
120
+
@@ -0,0 +1,72 @@
1
+ const fs = require('fs');
2
+ const path = require('path');
3
+ const mkdirp = require('mkdirp');
4
+
5
+ exports.strictParse = function (str) {
6
+ const obj = JSON.parse(str);
7
+ if (!obj || typeof obj !== 'object') {
8
+ throw new Error('JSON string is not object');
9
+ }
10
+ return obj;
11
+ };
12
+
13
+ exports.readSync = function(filepath) {
14
+ if (!fs.existsSync(filepath)) {
15
+ throw new Error(filepath + ' is not found');
16
+ }
17
+ return JSON.parse(fs.readFileSync(filepath));
18
+ };
19
+
20
+ exports.writeSync = function(filepath, str, options) {
21
+ options = options || {};
22
+ if (!('space' in options)) {
23
+ options.space = 2;
24
+ }
25
+
26
+ mkdirp.sync(path.dirname(filepath));
27
+ if (typeof str === 'object') {
28
+ str = JSON.stringify(str, options.replacer, options.space) + '\n';
29
+ }
30
+
31
+ fs.writeFileSync(filepath, str);
32
+ };
33
+
34
+ exports.read = function(filepath) {
35
+ return fs.stat(filepath)
36
+ .then(function(stats) {
37
+ if (!stats.isFile()) {
38
+ throw new Error(filepath + ' is not found');
39
+ }
40
+ return fs.readFile(filepath);
41
+ })
42
+ .then(function(buf) {
43
+ return JSON.parse(buf);
44
+ });
45
+ };
46
+
47
+ exports.write = function(filepath, str, options) {
48
+ options = options || {};
49
+ if (!('space' in options)) {
50
+ options.space = 2;
51
+ }
52
+
53
+ if (typeof str === 'object') {
54
+ str = JSON.stringify(str, options.replacer, options.space) + '\n';
55
+ }
56
+
57
+ return mkdir(path.dirname(filepath))
58
+ .then(function() {
59
+ return fs.writeFile(filepath, str);
60
+ });
61
+ };
62
+
63
+ function mkdir(dir) {
64
+ return new Promise(function(resolve, reject) {
65
+ mkdirp(dir, function(err) {
66
+ if (err) {
67
+ return reject(err);
68
+ }
69
+ resolve();
70
+ });
71
+ });
72
+ }
@@ -0,0 +1,196 @@
1
+ const path = require('path');
2
+
3
+ /**
4
+ * 当前进程的所有env
5
+ */
6
+ exports.allEnv = function() {
7
+ return process.env;
8
+ }
9
+
10
+ /**
11
+ * 当前环境 - local | prod
12
+ */
13
+ exports.env = function() {
14
+ return process.env.EE_SERVER_ENV;
15
+ }
16
+
17
+ /**
18
+ * 获取 当前环境
19
+ */
20
+ exports.getEnv = this.env
21
+
22
+ /**
23
+ * 是否为开发环境
24
+ */
25
+ exports.isDev = function() {
26
+ if ( process.env.EE_SERVER_ENV === 'development' ||
27
+ process.env.EE_SERVER_ENV === 'dev' ||
28
+ process.env.EE_SERVER_ENV === 'local'
29
+ ) {
30
+ return true;
31
+ }
32
+
33
+ if ( process.env.NODE_ENV === 'development' ||
34
+ process.env.NODE_ENV === 'dev' ||
35
+ process.env.NODE_ENV === 'local'
36
+ ) {
37
+ return true;
38
+ }
39
+
40
+ return false;
41
+ };
42
+
43
+ /**
44
+ * 是否为渲染进程
45
+ */
46
+ exports.isRenderer = function() {
47
+ return (typeof process === 'undefined' ||
48
+ !process ||
49
+ process.type === 'renderer');
50
+ };
51
+
52
+ /**
53
+ * 是否为主进程
54
+ */
55
+ exports.isMain = function() {
56
+ return ( typeof process !== 'undefined' &&
57
+ process.type === 'browser');
58
+ };
59
+
60
+ /**
61
+ * 是否为node子进程
62
+ */
63
+ exports.isForkedChild = function() {
64
+ return (Number(process.env.ELECTRON_RUN_AS_NODE) === 1);
65
+ };
66
+
67
+ /**
68
+ * 当前进程类型
69
+ */
70
+ exports.processType = function() {
71
+ let type = '';
72
+ if (this.isMain()) {
73
+ type = 'browser';
74
+ } else if (this.isRenderer()) {
75
+ type = 'renderer';
76
+ } else if (this.isForkedChild()) {
77
+ type = 'child';
78
+ }
79
+
80
+ return type;
81
+ };
82
+
83
+ /**
84
+ * 获取数据存储路径
85
+ */
86
+ exports.getHomeDir = function () {
87
+ return process.env.EE_HOME;
88
+ }
89
+
90
+ /**
91
+ * 获取数据存储路径
92
+ */
93
+ exports.getStorageDir = function () {
94
+ const storageDir = path.join(this.getRootDir(), 'data');
95
+ return storageDir;
96
+ }
97
+
98
+ /**
99
+ * 获取日志存储路径
100
+ */
101
+ exports.getLogDir = function () {
102
+ const dir = path.join(this.getRootDir(), 'logs');
103
+ return dir;
104
+ }
105
+
106
+ /**
107
+ * 获取root目录 (dev-项目根目录,pro-app user data目录)
108
+ */
109
+ exports.getRootDir = function () {
110
+ const appDir = this.isDev() ? process.env.EE_HOME : process.env.EE_APP_USER_DATA;
111
+ return appDir;
112
+ }
113
+
114
+ /**
115
+ * 获取base目录
116
+ */
117
+ exports.getBaseDir = function() {
118
+ return process.env.EE_BASE_DIR;
119
+ }
120
+
121
+ /**
122
+ * 获取electron目录
123
+ */
124
+ exports.getElectronDir = function() {
125
+ return process.env.EE_BASE_DIR;
126
+ }
127
+
128
+ /**
129
+ * 获取 appUserData目录
130
+ */
131
+ exports.getAppUserDataDir = function() {
132
+ return process.env.EE_APP_USER_DATA;
133
+ }
134
+
135
+ /**
136
+ * 获取数据存储路径
137
+ */
138
+ exports.getHomeDir = function () {
139
+ return process.env.EE_HOME;
140
+ }
141
+
142
+ /**
143
+ * 获取 exec目录
144
+ */
145
+ exports.getExecDir = function() {
146
+ return process.env.EE_EXEC_DIR;
147
+ }
148
+
149
+ /**
150
+ * 获取操作系统用户目录
151
+ */
152
+ exports.getUserHomeDir = function () {
153
+ return process.env.EE_USER_HOME;
154
+ }
155
+
156
+ /**
157
+ * 获取主进程端口
158
+ */
159
+ exports.getMainPort = function () {
160
+ return process.env.EE_MAIN_PORT;
161
+ }
162
+
163
+ /**
164
+ * 获取内置socket端口
165
+ */
166
+ exports.getSocketPort = function () {
167
+ return process.env.EE_SOCKET_PORT;
168
+ }
169
+
170
+ /**
171
+ * 获取内置http端口
172
+ */
173
+ exports.getHttpPort = function () {
174
+ return process.env.EE_HTTP_PORT;
175
+ }
176
+
177
+ /**
178
+ * 是否打包
179
+ */
180
+ exports.isPackaged = function () {
181
+ return process.env.EE_IS_PACKAGED === 'true';
182
+ }
183
+
184
+ /**
185
+ * 是否加密
186
+ */
187
+ exports.isEncrypted = function () {
188
+ return process.env.EE_IS_ENCRYPTED === 'true';
189
+ }
190
+
191
+ /**
192
+ * 是否热重启
193
+ */
194
+ exports.isHotReload = function () {
195
+ return process.env.HOT_RELOAD === 'true';
196
+ }
@@ -1,5 +1,3 @@
1
- 'use strict';
2
-
3
1
  const assert = require('assert');
4
2
  const is = require('is-type-of');
5
3
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ee-core",
3
- "version": "1.5.2-beta.2",
3
+ "version": "2.0.0-beta.2",
4
4
  "description": "ee core",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -25,7 +25,6 @@
25
25
  "fs-extra": "^10.0.0",
26
26
  "get-port": "^5.1.1",
27
27
  "globby": "^10.0.0",
28
- "graceful-fs": "^4.1.3",
29
28
  "humanize-ms": "^1.2.1",
30
29
  "is-type-of": "^1.2.1",
31
30
  "javascript-obfuscator": "^4.0.0",
@@ -35,14 +34,11 @@
35
34
  "koa-static": "^5.0.0",
36
35
  "koa2-cors": "^2.0.6",
37
36
  "lodash": "^4.17.21",
38
- "lowdb": "^1.0.0",
37
+ "mkdirp": "^2.1.3",
39
38
  "path-to-regexp": "^6.2.0",
40
- "pify": "^6.1.0",
41
39
  "socket.io": "^4.4.1",
42
40
  "socket.io-client": "^4.4.1",
43
- "steno": "^0.4.1",
44
- "urllib": "^2.38.0",
45
- "utility": "^1.17.0"
41
+ "urllib": "^2.38.0"
46
42
  },
47
43
  "devDependencies": {}
48
44
  }
package/tools/encrypt.js CHANGED
@@ -5,9 +5,9 @@ const fs = require('fs');
5
5
  const fsPro = require('fs-extra');
6
6
  const is = require('is-type-of');
7
7
  const bytenode = require('bytenode');
8
- const utility = require('utility');
9
8
  const crypto = require('crypto');
10
9
  const JavaScriptObfuscator = require('javascript-obfuscator');
10
+ const utilsJson = require('../module/utils/json');
11
11
 
12
12
  class Encrypt {
13
13
  constructor() {
@@ -86,7 +86,7 @@ class Encrypt {
86
86
  const content = {
87
87
  nameMap: {}
88
88
  };
89
- utility.writeJSONSync(this.tmpFile, content);
89
+ utilsJson.writeSync(this.tmpFile, content);
90
90
  }
91
91
  }
92
92