ee-core 2.9.2 → 2.10.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.
- package/LICENSE +21 -21
- package/README.md +65 -65
- package/addon/index.js +34 -34
- package/addon/window/index.js +98 -98
- package/bin/tools.js +8 -8
- package/config/cache.js +41 -38
- package/config/config.default.js +331 -330
- package/config/index.js +86 -73
- package/const/channel.js +17 -17
- package/const/index.js +8 -8
- package/controller/baseContextClass.js +34 -34
- package/controller/index.js +34 -34
- package/core/index.js +10 -10
- package/core/lib/ee.js +216 -216
- package/core/lib/loader/context_loader.js +106 -106
- package/core/lib/loader/ee_loader.js +435 -435
- package/core/lib/loader/file_loader.js +326 -326
- package/core/lib/loader/mixin/addon.js +32 -32
- package/core/lib/loader/mixin/config.js +130 -130
- package/core/lib/loader/mixin/controller.js +125 -125
- package/core/lib/loader/mixin/service.js +28 -28
- package/core/lib/utils/base_context_class.js +34 -34
- package/core/lib/utils/function.js +30 -30
- package/core/lib/utils/index.js +133 -133
- package/core/lib/utils/sequencify.js +59 -59
- package/core/lib/utils/timing.js +77 -77
- package/cross/index.js +183 -183
- package/cross/spawnProcess.js +183 -183
- package/ee/appLoader.js +48 -48
- package/ee/application.js +99 -99
- package/ee/baseApp.js +103 -102
- package/ee/eeApp.js +408 -408
- package/ee/index.js +57 -57
- package/electron/app/index.js +64 -58
- package/electron/index.js +19 -19
- package/electron/window/index.js +73 -73
- package/electron/window/winState.js +186 -186
- package/exception/index.js +112 -112
- package/html/boot.html +98 -98
- package/html/cross-failure.html +28 -28
- package/html/failure.html +28 -28
- package/html/index.js +13 -13
- package/httpclient/index.js +161 -161
- package/index.js +54 -54
- package/jobs/baseJobClass.js +16 -16
- package/jobs/child/app.js +58 -65
- package/jobs/child/forkProcess.js +145 -145
- package/jobs/child/index.js +82 -82
- package/jobs/child-pool/index.js +213 -213
- package/jobs/index.js +8 -8
- package/jobs/load-balancer/algorithm/index.js +11 -11
- package/jobs/load-balancer/algorithm/minimumConnection.js +18 -18
- package/jobs/load-balancer/algorithm/polling.js +11 -11
- package/jobs/load-balancer/algorithm/random.js +9 -9
- package/jobs/load-balancer/algorithm/specify.js +14 -14
- package/jobs/load-balancer/algorithm/weights.js +21 -21
- package/jobs/load-balancer/algorithm/weightsMinimumConnection.js +29 -29
- package/jobs/load-balancer/algorithm/weightsPolling.js +22 -22
- package/jobs/load-balancer/algorithm/weightsRandom.js +16 -16
- package/jobs/load-balancer/consts.js +9 -9
- package/jobs/load-balancer/index.js +201 -201
- package/jobs/load-balancer/scheduler.js +31 -31
- package/jobs/renderer/index.js +141 -141
- package/jobs/renderer/loadView.js +40 -40
- package/jobs/unification.js +63 -63
- package/loader/index.js +172 -172
- package/log/index.js +68 -68
- package/log/logger.js +86 -80
- package/main/index.js +56 -56
- package/message/childMessage.js +54 -54
- package/message/index.js +18 -18
- package/old-utils/index.js +91 -91
- package/package.json +38 -38
- package/ps/index.js +371 -371
- package/services/baseContextClass.js +34 -34
- package/services/index.js +40 -40
- package/socket/httpServer.js +147 -147
- package/socket/index.js +81 -81
- package/socket/io.js +27 -27
- package/socket/ipcServer.js +112 -112
- package/socket/socketServer.js +69 -67
- package/storage/index.js +38 -38
- package/storage/jsondb/adapters/Base.js +23 -23
- package/storage/jsondb/adapters/FileSync.js +64 -52
- package/storage/jsondb/main.js +55 -42
- package/storage/jsondbStorage.js +195 -195
- package/storage/sqliteStorage.js +123 -123
- package/utils/co.js +237 -237
- package/utils/copyto.js +160 -160
- package/utils/depd/index.js +538 -538
- package/utils/depd/lib/browser/index.js +77 -77
- package/utils/extend.js +73 -73
- package/utils/get-port/index.d.ts +64 -64
- package/utils/get-port/index.js +148 -148
- package/utils/helper.js +220 -220
- package/utils/index.js +160 -160
- package/utils/ip.js +261 -261
- package/utils/is.js +145 -145
- package/utils/json.js +72 -72
- package/utils/pargv.js +263 -263
- package/utils/time/index.js +19 -19
- package/utils/time/ms.js +162 -162
- package/utils/wrap.js +35 -35
package/utils/copyto.js
CHANGED
|
@@ -1,161 +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;
|
|
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
161
|
}
|