ee-core 1.5.0 → 1.5.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 (41) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +2 -2
  3. package/addon/window/index.js +91 -91
  4. package/bin/tools.js +17 -17
  5. package/config/config.default.js +280 -276
  6. package/core/index.js +12 -12
  7. package/core/lib/ee.js +218 -218
  8. package/core/lib/loader/context_loader.js +106 -106
  9. package/core/lib/loader/ee_loader.js +457 -457
  10. package/core/lib/loader/file_loader.js +325 -325
  11. package/core/lib/loader/mixin/addon.js +32 -32
  12. package/core/lib/loader/mixin/config.js +135 -135
  13. package/core/lib/loader/mixin/controller.js +124 -124
  14. package/core/lib/loader/mixin/service.js +28 -28
  15. package/core/lib/utils/base_context_class.js +34 -34
  16. package/core/lib/utils/index.js +127 -127
  17. package/core/lib/utils/sequencify.js +59 -59
  18. package/core/lib/utils/timing.js +77 -77
  19. package/index.js +49 -49
  20. package/lib/appLoader.js +53 -53
  21. package/lib/application.js +84 -84
  22. package/lib/baseApp.js +131 -131
  23. package/lib/constant.js +9 -9
  24. package/lib/eeApp.js +359 -335
  25. package/lib/httpclient.js +136 -136
  26. package/lib/logger.js +46 -46
  27. package/lib/socket/httpServer.js +142 -142
  28. package/lib/socket/io.js +23 -23
  29. package/lib/socket/ipcServer.js +108 -108
  30. package/lib/socket/socketClient.js +50 -50
  31. package/lib/socket/socketServer.js +76 -76
  32. package/lib/socket/start.js +22 -22
  33. package/lib/storage/index.js +33 -33
  34. package/lib/storage/lowdbStorage.js +98 -98
  35. package/lib/storage/sqliteStorage.js +127 -127
  36. package/package.json +45 -45
  37. package/tools/encrypt.js +274 -274
  38. package/tools/replaceDist.js +61 -61
  39. package/utils/common.js +90 -90
  40. package/utils/index.js +246 -246
  41. package/utils/wrap.js +37 -37
package/utils/wrap.js CHANGED
@@ -1,38 +1,38 @@
1
- 'use strict';
2
-
3
- const assert = require('assert');
4
- const is = require('is-type-of');
5
-
6
- exports.getProperties = (filepath, { caseStyle }) => {
7
- // if caseStyle is function, return the result of function
8
- if (is.function(caseStyle)) {
9
- const result = caseStyle(filepath);
10
- assert(is.array(result), `caseStyle expect an array, but got ${result}`);
11
- return result;
12
- }
13
- // use default camelize
14
- return this.defaultCamelize(filepath, caseStyle);
15
- }
16
-
17
- exports.defaultCamelize = (filepath, caseStyle) => {
18
- const properties = filepath.substring(0, filepath.lastIndexOf('.')).split('/');
19
- return properties.map(property => {
20
- if (!/^[a-z][a-z0-9_-]*$/i.test(property)) {
21
- throw new Error(`${property} is not match 'a-z0-9_-' in ${filepath}`);
22
- }
23
-
24
- property = property.replace(/[_-][a-z]/ig, s => s.substring(1).toUpperCase());
25
- let first = property[0];
26
- switch (caseStyle) {
27
- case 'lower':
28
- first = first.toLowerCase();
29
- break;
30
- case 'upper':
31
- first = first.toUpperCase();
32
- break;
33
- case 'camel':
34
- default:
35
- }
36
- return first + property.substring(1);
37
- });
1
+ 'use strict';
2
+
3
+ const assert = require('assert');
4
+ const is = require('is-type-of');
5
+
6
+ exports.getProperties = (filepath, { caseStyle }) => {
7
+ // if caseStyle is function, return the result of function
8
+ if (is.function(caseStyle)) {
9
+ const result = caseStyle(filepath);
10
+ assert(is.array(result), `caseStyle expect an array, but got ${result}`);
11
+ return result;
12
+ }
13
+ // use default camelize
14
+ return this.defaultCamelize(filepath, caseStyle);
15
+ }
16
+
17
+ exports.defaultCamelize = (filepath, caseStyle) => {
18
+ const properties = filepath.substring(0, filepath.lastIndexOf('.')).split('/');
19
+ return properties.map(property => {
20
+ if (!/^[a-z][a-z0-9_-]*$/i.test(property)) {
21
+ throw new Error(`${property} is not match 'a-z0-9_-' in ${filepath}`);
22
+ }
23
+
24
+ property = property.replace(/[_-][a-z]/ig, s => s.substring(1).toUpperCase());
25
+ let first = property[0];
26
+ switch (caseStyle) {
27
+ case 'lower':
28
+ first = first.toLowerCase();
29
+ break;
30
+ case 'upper':
31
+ first = first.toUpperCase();
32
+ break;
33
+ case 'camel':
34
+ default:
35
+ }
36
+ return first + property.substring(1);
37
+ });
38
38
  }