mm_machine 2.0.1 → 2.0.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.
- package/README.md +488 -122
- package/app/test1/demo.json +10 -0
- package/app/test1/index.js +30 -0
- package/app/test2/after.js +6 -0
- package/app/test2/demo.json +10 -0
- package/app/test2/main.js +18 -0
- package/demo/test1/config_demo.json +34 -0
- package/demo/test1/index.js +1 -1
- package/demo/test2/config_demo.json +68 -0
- package/index.js +317 -322
- package/item.js +327 -240
- package/package.json +8 -5
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
var counter = 0;
|
|
2
|
+
|
|
3
|
+
function test() {
|
|
4
|
+
console.log("测试模块1执行", counter++);
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
function main() {
|
|
8
|
+
test();
|
|
9
|
+
return { message: "测试模块1返回", value: counter };
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
exports.main = main;
|
|
13
|
+
|
|
14
|
+
exports.main_before = function() {
|
|
15
|
+
console.log("测试模块1前置钩子");
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
exports.main_after = async function(ret) {
|
|
19
|
+
console.log("测试模块1后置钩子", ret);
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
exports.load = function() {
|
|
23
|
+
console.log("加载测试模块1");
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
exports.init = function() {
|
|
27
|
+
console.log("初始化测试模块1");
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
console.log("测试模块1被引用");
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
var count = 0;
|
|
2
|
+
|
|
3
|
+
function main() {
|
|
4
|
+
console.log("测试模块2执行", count++);
|
|
5
|
+
return { result: "测试模块2结果", count: count };
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
exports.main = main;
|
|
9
|
+
|
|
10
|
+
exports.load = function() {
|
|
11
|
+
console.log("加载测试模块2");
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
exports.init = function() {
|
|
15
|
+
console.log("初始化测试模块2");
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
console.log("测试模块2被引用");
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
/**
|
|
3
|
+
* 名称, 由中英文和下“_”组成, 用于卸载接口 例如: demo
|
|
4
|
+
*/
|
|
5
|
+
"name": "demo1",
|
|
6
|
+
/**
|
|
7
|
+
* 标题, 介绍作用
|
|
8
|
+
*/
|
|
9
|
+
"title": "示例脚本1",
|
|
10
|
+
/**
|
|
11
|
+
* 描述, 用于描述该有什么用的
|
|
12
|
+
*/
|
|
13
|
+
"description": "用于测试动态加载、更新、卸载、删除脚本",
|
|
14
|
+
/**
|
|
15
|
+
* 文件路径, 当调用函数不存在时,会先从文件中加载
|
|
16
|
+
*/
|
|
17
|
+
"func_file": "./index.js",
|
|
18
|
+
/**
|
|
19
|
+
* 回调函数名 用于决定调用脚本的哪个函数
|
|
20
|
+
*/
|
|
21
|
+
"func_name": "",
|
|
22
|
+
/**
|
|
23
|
+
* 排序
|
|
24
|
+
*/
|
|
25
|
+
"sort": 10,
|
|
26
|
+
/**
|
|
27
|
+
* 状态, 0表示未启用, 1表示启用
|
|
28
|
+
*/
|
|
29
|
+
"state": 0,
|
|
30
|
+
/**
|
|
31
|
+
* 显示, 0表示不显示, 1表示显示
|
|
32
|
+
*/
|
|
33
|
+
"show": 0
|
|
34
|
+
}
|
package/demo/test1/index.js
CHANGED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
[{
|
|
2
|
+
/**
|
|
3
|
+
* 名称, 由中英文和下“_”组成, 用于卸载接口 例如: demo
|
|
4
|
+
*/
|
|
5
|
+
"name": "demo2",
|
|
6
|
+
/**
|
|
7
|
+
* 标题, 介绍作用
|
|
8
|
+
*/
|
|
9
|
+
"title": "示例脚本2",
|
|
10
|
+
/**
|
|
11
|
+
* 描述, 用于描述该有什么用的
|
|
12
|
+
*/
|
|
13
|
+
"description": "用于测试动态加载、更新、卸载、删除脚本",
|
|
14
|
+
/**
|
|
15
|
+
* 文件路径, 当调用函数不存在时,会先从文件中加载
|
|
16
|
+
*/
|
|
17
|
+
"func_file": "./main.js",
|
|
18
|
+
/**
|
|
19
|
+
* 回调函数名 用于决定调用脚本的哪个函数
|
|
20
|
+
*/
|
|
21
|
+
"func_name": "",
|
|
22
|
+
/**
|
|
23
|
+
* 排序
|
|
24
|
+
*/
|
|
25
|
+
"sort": 10,
|
|
26
|
+
/**
|
|
27
|
+
* 状态, 0表示未启用, 1表示启用
|
|
28
|
+
*/
|
|
29
|
+
"state": 1,
|
|
30
|
+
/**
|
|
31
|
+
* 显示, 0表示不显示, 1表示显示
|
|
32
|
+
*/
|
|
33
|
+
"show": 0
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
/**
|
|
37
|
+
* 名称, 由中英文和下“_”组成, 用于卸载接口 例如: demo
|
|
38
|
+
*/
|
|
39
|
+
"name": "demo3",
|
|
40
|
+
/**
|
|
41
|
+
* 标题, 介绍作用
|
|
42
|
+
*/
|
|
43
|
+
"title": "示例脚本3",
|
|
44
|
+
/**
|
|
45
|
+
* 描述, 用于描述该有什么用的
|
|
46
|
+
*/
|
|
47
|
+
"description": "用于测试动态加载、更新、卸载、删除脚本",
|
|
48
|
+
/**
|
|
49
|
+
* 文件路径, 当调用函数不存在时,会先从文件中加载
|
|
50
|
+
*/
|
|
51
|
+
"func_file": "./after.js",
|
|
52
|
+
/**
|
|
53
|
+
* 回调函数名 用于决定调用脚本的哪个函数
|
|
54
|
+
*/
|
|
55
|
+
"func_name": "main",
|
|
56
|
+
/**
|
|
57
|
+
* 排序
|
|
58
|
+
*/
|
|
59
|
+
"sort": 10,
|
|
60
|
+
/**
|
|
61
|
+
* 状态, 0表示未启用, 1表示启用
|
|
62
|
+
*/
|
|
63
|
+
"state": 1,
|
|
64
|
+
/**
|
|
65
|
+
* 显示, 0表示不显示, 1表示显示
|
|
66
|
+
*/
|
|
67
|
+
"show": 0
|
|
68
|
+
}]
|