@zhin.js/plugin-game-hub 1.0.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/README.md +3 -0
- package/commands/games/[action:string=].ts +17 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.js +2 -0
- package/lib/index.js.map +1 -0
- package/package.json +65 -0
- package/plugin.ts +13 -0
- package/schema.json +4 -0
- package/src/index.ts +2 -0
package/README.md
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { defineCommand } from '@zhin.js/command';
|
|
2
|
+
import { formatRuntimeGamesHelp, getRuntimeGame } from '@zhin.js/game-kit';
|
|
3
|
+
|
|
4
|
+
export default defineCommand({
|
|
5
|
+
description: 'Game hub — list loaded games',
|
|
6
|
+
async execute({ params }) {
|
|
7
|
+
const action = String(params.action ?? '').trim();
|
|
8
|
+
if (action) {
|
|
9
|
+
const game = getRuntimeGame(action);
|
|
10
|
+
if (game) {
|
|
11
|
+
const start = game.quickStart ? ` ${game.quickStart}` : '';
|
|
12
|
+
return `发送 \`${game.commandPrefix}${start}\` 开始 ${game.title}`;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
return formatRuntimeGamesHelp();
|
|
16
|
+
},
|
|
17
|
+
});
|
package/lib/index.d.ts
ADDED
package/lib/index.js
ADDED
package/lib/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
|
package/package.json
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@zhin.js/plugin-game-hub",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Zhin.js 游戏大厅 — 列出已加载的游戏插件 (Plugin Runtime)",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./lib/index.js",
|
|
7
|
+
"types": "./lib/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./lib/index.d.ts",
|
|
11
|
+
"development": "./src/index.ts",
|
|
12
|
+
"import": "./lib/index.js"
|
|
13
|
+
},
|
|
14
|
+
"./package.json": "./package.json"
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"plugin.ts",
|
|
18
|
+
"schema.json",
|
|
19
|
+
"commands",
|
|
20
|
+
"src",
|
|
21
|
+
"lib",
|
|
22
|
+
"README.md"
|
|
23
|
+
],
|
|
24
|
+
"license": "MIT",
|
|
25
|
+
"dependencies": {
|
|
26
|
+
"@zhin.js/command": "1.0.0",
|
|
27
|
+
"@zhin.js/game-kit": "1.0.1",
|
|
28
|
+
"@zhin.js/plugin-runtime": "1.0.0"
|
|
29
|
+
},
|
|
30
|
+
"devDependencies": {
|
|
31
|
+
"typescript": "^6.0.3",
|
|
32
|
+
"vitest": "^4.1.10"
|
|
33
|
+
},
|
|
34
|
+
"repository": {
|
|
35
|
+
"type": "git",
|
|
36
|
+
"url": "git+https://github.com/zhinjs/zhin.git",
|
|
37
|
+
"directory": "plugins/games/hub"
|
|
38
|
+
},
|
|
39
|
+
"publishConfig": {
|
|
40
|
+
"access": "public",
|
|
41
|
+
"registry": "https://registry.npmjs.org"
|
|
42
|
+
},
|
|
43
|
+
"engines": {
|
|
44
|
+
"node": "^20.19.0 || >=22.12.0"
|
|
45
|
+
},
|
|
46
|
+
"zhin": {
|
|
47
|
+
"protocol": 1,
|
|
48
|
+
"type": "plugin",
|
|
49
|
+
"entry": "./plugin.ts",
|
|
50
|
+
"engine": "^1.0.0",
|
|
51
|
+
"runtime": "trusted",
|
|
52
|
+
"features": [
|
|
53
|
+
{
|
|
54
|
+
"package": "@zhin.js/command",
|
|
55
|
+
"api": "^1.0.0"
|
|
56
|
+
}
|
|
57
|
+
],
|
|
58
|
+
"plugins": []
|
|
59
|
+
},
|
|
60
|
+
"scripts": {
|
|
61
|
+
"build": "tsc",
|
|
62
|
+
"clean": "rimraf lib",
|
|
63
|
+
"test": "NODE_OPTIONS=--experimental-strip-types vitest run --root ../../.. plugins/games/hub/tests"
|
|
64
|
+
}
|
|
65
|
+
}
|
package/plugin.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { definePlugin } from '@zhin.js/plugin-runtime';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Plugin Runtime game hub — lists games registered via `registerRuntimeGame`.
|
|
5
|
+
* Interactive hub menus are deferred; `/games` command shows help text.
|
|
6
|
+
*/
|
|
7
|
+
export default definePlugin({
|
|
8
|
+
name: 'game-hub',
|
|
9
|
+
metadata: {
|
|
10
|
+
displayName: 'Game Hub',
|
|
11
|
+
},
|
|
12
|
+
setup() {},
|
|
13
|
+
});
|
package/schema.json
ADDED
package/src/index.ts
ADDED