@tapd/tplugin-core 1.26.1-alpha.0 → 1.27.1-alpha.0
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/package.json +2 -2
- package/src/core.js +1 -0
- package/src/index.js +7 -0
- package/src/tools.js +18 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tapd/tplugin-core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.27.1-alpha.0",
|
|
4
4
|
"main": "src/index.js",
|
|
5
5
|
"description": "tplugin-core",
|
|
6
6
|
"scripts": {
|
|
@@ -33,5 +33,5 @@
|
|
|
33
33
|
"src",
|
|
34
34
|
"!src/config.js"
|
|
35
35
|
],
|
|
36
|
-
"gitHead": "
|
|
36
|
+
"gitHead": "a23e3e1c9abf32817b331e964aaf7fdacc40fc08"
|
|
37
37
|
}
|
package/src/core.js
CHANGED
|
@@ -119,6 +119,7 @@ class EventHandler {
|
|
|
119
119
|
async exec(basePath = '', reload = '') {
|
|
120
120
|
const data = this.data || {};
|
|
121
121
|
const func = data.function ? data.function.replace('/', path.sep) : '';
|
|
122
|
+
console._stdout.write(JSON.stringify({"PLUGIN_Handler": func})+'\n');
|
|
122
123
|
|
|
123
124
|
// 识别请求类型
|
|
124
125
|
const reqType = data.type || 'function';
|
package/src/index.js
CHANGED
|
@@ -7,6 +7,8 @@
|
|
|
7
7
|
|
|
8
8
|
const EventHandler = require('./core');
|
|
9
9
|
const sdk = require('./tapd');
|
|
10
|
+
const tools = require('./tools');
|
|
11
|
+
|
|
10
12
|
|
|
11
13
|
const Handler = function (args) {
|
|
12
14
|
return new EventHandler(args);
|
|
@@ -22,4 +24,9 @@ Object.defineProperty(Handler, 'tapdSdk', { get() {
|
|
|
22
24
|
return sdk;
|
|
23
25
|
} });
|
|
24
26
|
|
|
27
|
+
// 暴露tools类
|
|
28
|
+
Object.defineProperty(Handler, 'tools', { get() {
|
|
29
|
+
return tools;
|
|
30
|
+
} });
|
|
31
|
+
|
|
25
32
|
module.exports = Handler;
|
package/src/tools.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
/**
|
|
3
|
+
* custom_log_1() 输出日志到CUSTOM_Index1索引
|
|
4
|
+
* @param {string} text - 日志索引
|
|
5
|
+
*/
|
|
6
|
+
custom_log_1(text){
|
|
7
|
+
console._stdout.write(JSON.stringify({"CUSTOM_Index1": text})+'\n');
|
|
8
|
+
},
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* custom_log_2() 输出日志到CUSTOM_Index2索引
|
|
12
|
+
* @param {string} text - 日志索引
|
|
13
|
+
*/
|
|
14
|
+
custom_log_2(text){
|
|
15
|
+
console._stdout.write(JSON.stringify({"CUSTOM_Index2": text})+'\n');
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
};
|