mm_os 2.8.3 → 2.8.5

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.
@@ -36,7 +36,10 @@ class Drive extends Item {
36
36
  this.param;
37
37
  // sql模板配置 + 函数
38
38
  this.sql;
39
+
39
40
  /* 通用项 */
41
+ // 默认启用热更新
42
+ this.mode = 2;
40
43
  // 配置参数
41
44
  this.config = {
42
45
  // 名称, 由中英文和下“_”组成, 用于修改或卸载 例如: demo
@@ -18,6 +18,8 @@ class Api extends Index {
18
18
  this.Drive = Drive;
19
19
  this.type = "api";
20
20
  this.title = title;
21
+ // 默认启用热更新
22
+ this.mode = 2;
21
23
  }
22
24
  }
23
25
 
@@ -55,7 +57,7 @@ Api.prototype.run = async function(ctx, db) {
55
57
  for (var i = 0, o; o = lt[i++];) {
56
58
  if (o.config.state === 1 && path.has(o.config.path)) {
57
59
  var ret = await o.run(ctx, db);
58
- if (this.mode) {
60
+ if (this.mode > 2) {
59
61
  o.load(o.filename);
60
62
  }
61
63
  if (ret) {
@@ -14,7 +14,8 @@ class Drive extends Item {
14
14
  constructor(dir) {
15
15
  super(dir, __dirname);
16
16
  this.default_file = "./cmd.json";
17
-
17
+ // 默认启用热更新
18
+ this.mode = 2;
18
19
  // 开关 true为开启, false为关闭
19
20
  this.onOff = true;
20
21
 
@@ -21,6 +21,8 @@ class Cmd extends Index {
21
21
  this.list_before = [];
22
22
  this.list_main = [];
23
23
  this.list_after = [];
24
+ // 默认启用热更新
25
+ this.mode = 2;
24
26
  }
25
27
  }
26
28
 
@@ -15,7 +15,8 @@ class Drive extends Item {
15
15
  constructor(dir) {
16
16
  super(dir, __dirname);
17
17
  this.default_file = "./component.json";
18
-
18
+ // 默认启用热更新
19
+ this.mode = 2;
19
20
  /* 通用项 */
20
21
  // 配置参数
21
22
  this.config = {
@@ -19,6 +19,8 @@ class Component extends Index {
19
19
  this.type = "component";
20
20
  this.title = title;
21
21
  this.list = [];
22
+ // 默认启用热更新
23
+ this.mode = 2;
22
24
  }
23
25
  }
24
26
 
@@ -14,7 +14,7 @@ class Drive extends Item {
14
14
  constructor(dir) {
15
15
  super(dir, __dirname);
16
16
  this.default_file = "./event.json";
17
-
17
+
18
18
  /* 通用项 */
19
19
  // 配置参数
20
20
  this.config = {
@@ -18,7 +18,8 @@ class Event extends Index {
18
18
  this.Drive = Drive;
19
19
  this.type = "event";
20
20
  this.title = title;
21
-
21
+ // 默认启用热更新
22
+ this.mode = 2;
22
23
  /* === 验证 === */
23
24
  // 验证前
24
25
  this.list_before = [];
@@ -149,7 +150,7 @@ Event.prototype.doing = async function(o, ctx, db) {
149
150
  if (types.isPromise(ret)) {
150
151
  ret = await ret;
151
152
  }
152
- if (this.mode) {
153
+ if (this.mode > 2) {
153
154
  o.load(o.filename);
154
155
  }
155
156
  return ret;
@@ -167,7 +168,7 @@ Event.prototype.run_sub = async function(list, target, ctx, db) {
167
168
  for (var i = 0, o; o = list[i++];) {
168
169
  if (o.config.state === 1 && target.has(o.config.target)) {
169
170
  var ret = await o.run(ctx, db);
170
- if (this.mode) {
171
+ if (this.mode > 2) {
171
172
  o.load(o.filename);
172
173
  }
173
174
  if (ret) {
@@ -151,7 +151,7 @@ Eventer.prototype.doing = async function(o, ...msg) {
151
151
  if (types.isPromise(ret)) {
152
152
  ret = await ret;
153
153
  }
154
- if (this.mode) {
154
+ if (this.mode > 2) {
155
155
  o.load(o.filename);
156
156
  }
157
157
  } catch (err) {
@@ -28,7 +28,8 @@ class Drive extends Item {
28
28
 
29
29
  // 模板路径
30
30
  this.tpl_path = "./tpl/";
31
-
31
+ // 默认启用热更新
32
+ this.mode = 2;
32
33
  /* 通用项 */
33
34
  // 配置参数
34
35
  this.config = {
@@ -563,4 +564,4 @@ Drive.prototype.update_vue = async function(route_path, cover) {
563
564
  }
564
565
  };
565
566
 
566
- module.exports = Drive;
567
+ module.exports = Drive;
@@ -18,6 +18,8 @@ class Nav extends Index {
18
18
  this.Drive = Drive;
19
19
  this.type = "nav";
20
20
  this.title = title;
21
+ // 默认启用热更新
22
+ this.mode = 2;
21
23
  }
22
24
  }
23
25
 
@@ -13,7 +13,8 @@ class Drive extends Item {
13
13
  constructor(dir) {
14
14
  super(dir, __dirname);
15
15
  this.default_file = "./param.json";
16
-
16
+ // 默认启用热更新
17
+ this.mode = 2;
17
18
  /* 通用项 */
18
19
  // 配置参数
19
20
  this.config = {
@@ -18,6 +18,8 @@ class Param extends Index {
18
18
  this.Drive = Drive;
19
19
  this.type = "param";
20
20
  this.title = title;
21
+ // 默认启用热更新
22
+ this.mode = 2;
21
23
  }
22
24
  }
23
25
 
@@ -17,7 +17,8 @@ class Drive extends Item {
17
17
  constructor(dir) {
18
18
  super(dir, __dirname);
19
19
  this.default_file = "./plugin.json";
20
-
20
+ // 默认启用热更新
21
+ this.mode = 2;
21
22
  /**
22
23
  * 当前语言
23
24
  */
@@ -19,6 +19,8 @@ class Plugin extends Index {
19
19
  this.Drive = Drive;
20
20
  this.type = "plugin";
21
21
  this.title = title;
22
+ // 默认启用热更新
23
+ this.mode = 2;
22
24
  }
23
25
  }
24
26
 
@@ -19,7 +19,8 @@ class Drive extends Item {
19
19
  this.save_dir = './file/';
20
20
  // 读取文件目录
21
21
  this.url_path = "/file/";
22
-
22
+ // 默认启用热更新
23
+ this.mode = 2;
23
24
  /* 通用项 */
24
25
  this.params = null;
25
26
  // 配置参数
@@ -18,6 +18,8 @@ class Sql extends Index {
18
18
  this.Drive = Drive;
19
19
  this.type = "sql";
20
20
  this.title = title;
21
+ // 默认启用热更新
22
+ this.mode = 2;
21
23
  }
22
24
  }
23
25
 
@@ -66,7 +68,7 @@ Sql.prototype.run = async function(name, query, body, db) {
66
68
  var obj = this.get(name);
67
69
  if (obj) {
68
70
  var ret = await obj.run(query, body, db);
69
- if (this.mode) {
71
+ if (this.mode > 2) {
70
72
  o.load(o.filename);
71
73
  }
72
74
  return ret;
@@ -74,7 +74,7 @@ class Drive extends Item {
74
74
  }
75
75
  }
76
76
  if (this.config.convert_amd) {
77
- this.mode(true);
77
+ this.run_mode(true);
78
78
  }
79
79
  }
80
80
  }
@@ -95,7 +95,7 @@ Drive.prototype.loadObj = function(obj) {
95
95
  $.push(this.config, obj, true);
96
96
  var cg = this.config;
97
97
  if (cg.convert_amd) {
98
- this.mode(true);
98
+ this.run_mode(true);
99
99
  }
100
100
  var f = cg.func_file;
101
101
  if (f) {
@@ -142,10 +142,10 @@ Drive.prototype.main = async function(ctx, path) {
142
142
  Drive.prototype.after = async function(ctx, path) {};
143
143
 
144
144
  /**
145
- * 切换模式
145
+ * 切换运行模式
146
146
  * @param {Boolean} convert_amd 是否将ES6转换AMD
147
147
  */
148
- Drive.prototype.mode = async function(convert_amd) {
148
+ Drive.prototype.run_mode = async function(convert_amd) {
149
149
  var cg = this.config;
150
150
  if (convert_amd) {
151
151
  this.main = async function main(ctx, path) {
@@ -61,7 +61,10 @@ Task.prototype.load_item = function(dir, cg, file) {
61
61
  var drive = new this.Drive(dir);
62
62
  drive.loadObj(cg);
63
63
  drive.filename = file;
64
- drive.task_admin = this;
64
+ var _this = this;
65
+ drive.admin = function() {
66
+ return this;
67
+ };
65
68
  this.list.push(drive);
66
69
  };
67
70
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mm_os",
3
- "version": "2.8.3",
3
+ "version": "2.8.5",
4
4
  "description": "这是超级美眉服务端框架,用于快速构建应用程序。",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -42,7 +42,7 @@
42
42
  "mm_html": "^1.1.6",
43
43
  "mm_koa_proxy": "^1.0.0",
44
44
  "mm_logs": "^1.1.7",
45
- "mm_machine": "^1.8.5",
45
+ "mm_machine": "^1.8.9",
46
46
  "mm_mongodb": "^1.4.2",
47
47
  "mm_mqtt": "^1.0.6",
48
48
  "mm_mysql": "^1.8.9",