@shiqianjiang/ceru-plugin-cli 0.1.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/ASSET_LICENSE +238 -0
- package/LICENSE +21 -0
- package/NOTICE +1 -0
- package/README.md +29 -0
- package/assets/catalog.json +1 -0
- package/assets/electron-app/main.cjs +1 -0
- package/assets/electron-app/package.json +8 -0
- package/assets/electron.cjs +42 -0
- package/assets/index.html +93 -0
- package/assets/originals/account.svg +1 -0
- package/assets/originals/add.svg +1 -0
- package/assets/originals/app.logo.svg +10 -0
- package/assets/originals/chart.svg +1 -0
- package/assets/originals/close.svg +1 -0
- package/assets/originals/cloud.svg +1 -0
- package/assets/originals/download.svg +1 -0
- package/assets/originals/heart.svg +1 -0
- package/assets/originals/import.svg +1 -0
- package/assets/originals/info.svg +1 -0
- package/assets/originals/library.svg +1 -0
- package/assets/originals/music-note.svg +1 -0
- package/assets/originals/pause.svg +1 -0
- package/assets/originals/placeholder.avatar.webp +0 -0
- package/assets/originals/placeholder.cover.png +0 -0
- package/assets/originals/platform.all.svg +1 -0
- package/assets/originals/platform.kg.svg +1 -0
- package/assets/originals/platform.kw.svg +1 -0
- package/assets/originals/platform.local.svg +1 -0
- package/assets/originals/platform.mg.svg +1 -0
- package/assets/originals/platform.tx.svg +1 -0
- package/assets/originals/platform.wy.svg +1 -0
- package/assets/originals/play.svg +1 -0
- package/assets/originals/refresh.svg +1 -0
- package/assets/originals/search.svg +1 -0
- package/assets/originals/server.svg +1 -0
- package/assets/originals/settings.svg +1 -0
- package/assets/originals/share.svg +1 -0
- package/assets/playground.js +446 -0
- package/assets/sandbox.js +36 -0
- package/assets/shared-react.js +77 -0
- package/assets/shared-vue.js +44 -0
- package/assets/style.css +264 -0
- package/assets/vendor-licenses/lodash-es.txt +47 -0
- package/assets/vendor-licenses/react-dom.txt +21 -0
- package/assets/vendor-licenses/react.txt +21 -0
- package/assets/vendor-licenses/scheduler.txt +21 -0
- package/assets/vendor-licenses/vue.txt +21 -0
- package/assets/vendor-licenses/vue_reactivity.txt +21 -0
- package/assets/vendor-licenses/vue_runtime-core.txt +21 -0
- package/assets/vendor-licenses/vue_runtime-dom.txt +21 -0
- package/assets/vendor-licenses/vue_shared.txt +21 -0
- package/dist/bin.d.ts +2 -0
- package/dist/bin.js +6 -0
- package/dist/dev.d.ts +7 -0
- package/dist/dev.js +507 -0
- package/dist/frameworks.d.ts +9 -0
- package/dist/frameworks.js +310 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +206 -0
- package/dist/project.d.ts +34 -0
- package/dist/project.js +342 -0
- package/package.json +67 -0
- package/schemas/config.schema.json +610 -0
- package/templates/connected-library/js/.prettierrc.json +5 -0
- package/templates/connected-library/js/.vscode/ceru.code-snippets +27 -0
- package/templates/connected-library/js/.vscode/extensions.json +3 -0
- package/templates/connected-library/js/.vscode/launch.json +30 -0
- package/templates/connected-library/js/.vscode/settings.json +20 -0
- package/templates/connected-library/js/.vscode/tasks.json +36 -0
- package/templates/connected-library/js/README.md +38 -0
- package/templates/connected-library/js/_gitignore +6 -0
- package/templates/connected-library/js/ceru.plugin.json +76 -0
- package/templates/connected-library/js/package.json +21 -0
- package/templates/connected-library/js/src/index.js +38 -0
- package/templates/connected-library/js/tsconfig.json +16 -0
- package/templates/connected-library/js/ui/settings.json +24 -0
- package/templates/connected-library/ts/.prettierrc.json +5 -0
- package/templates/connected-library/ts/.vscode/ceru.code-snippets +27 -0
- package/templates/connected-library/ts/.vscode/extensions.json +3 -0
- package/templates/connected-library/ts/.vscode/launch.json +30 -0
- package/templates/connected-library/ts/.vscode/settings.json +20 -0
- package/templates/connected-library/ts/.vscode/tasks.json +36 -0
- package/templates/connected-library/ts/README.md +38 -0
- package/templates/connected-library/ts/_gitignore +6 -0
- package/templates/connected-library/ts/ceru.plugin.json +76 -0
- package/templates/connected-library/ts/package.json +21 -0
- package/templates/connected-library/ts/src/index.ts +38 -0
- package/templates/connected-library/ts/tsconfig.json +16 -0
- package/templates/connected-library/ts/ui/settings.json +24 -0
- package/templates/guest-adapter/js/.prettierrc.json +5 -0
- package/templates/guest-adapter/js/.vscode/ceru.code-snippets +27 -0
- package/templates/guest-adapter/js/.vscode/extensions.json +3 -0
- package/templates/guest-adapter/js/.vscode/launch.json +30 -0
- package/templates/guest-adapter/js/.vscode/settings.json +20 -0
- package/templates/guest-adapter/js/.vscode/tasks.json +36 -0
- package/templates/guest-adapter/js/README.md +38 -0
- package/templates/guest-adapter/js/_gitignore +6 -0
- package/templates/guest-adapter/js/ceru.plugin.json +95 -0
- package/templates/guest-adapter/js/package.json +21 -0
- package/templates/guest-adapter/js/src/guest.js +6 -0
- package/templates/guest-adapter/js/src/index.js +8 -0
- package/templates/guest-adapter/js/tsconfig.json +16 -0
- package/templates/guest-adapter/js/ui/settings.json +14 -0
- package/templates/guest-adapter/ts/.prettierrc.json +5 -0
- package/templates/guest-adapter/ts/.vscode/ceru.code-snippets +27 -0
- package/templates/guest-adapter/ts/.vscode/extensions.json +3 -0
- package/templates/guest-adapter/ts/.vscode/launch.json +30 -0
- package/templates/guest-adapter/ts/.vscode/settings.json +20 -0
- package/templates/guest-adapter/ts/.vscode/tasks.json +36 -0
- package/templates/guest-adapter/ts/README.md +38 -0
- package/templates/guest-adapter/ts/_gitignore +6 -0
- package/templates/guest-adapter/ts/ceru.plugin.json +95 -0
- package/templates/guest-adapter/ts/package.json +21 -0
- package/templates/guest-adapter/ts/src/guest.ts +6 -0
- package/templates/guest-adapter/ts/src/index.ts +8 -0
- package/templates/guest-adapter/ts/tsconfig.json +16 -0
- package/templates/guest-adapter/ts/ui/settings.json +14 -0
- package/templates/importer/js/.prettierrc.json +5 -0
- package/templates/importer/js/.vscode/ceru.code-snippets +27 -0
- package/templates/importer/js/.vscode/extensions.json +3 -0
- package/templates/importer/js/.vscode/launch.json +30 -0
- package/templates/importer/js/.vscode/settings.json +20 -0
- package/templates/importer/js/.vscode/tasks.json +36 -0
- package/templates/importer/js/README.md +38 -0
- package/templates/importer/js/_gitignore +6 -0
- package/templates/importer/js/ceru.plugin.json +63 -0
- package/templates/importer/js/package.json +21 -0
- package/templates/importer/js/src/index.js +37 -0
- package/templates/importer/js/tsconfig.json +16 -0
- package/templates/importer/js/ui/settings.json +24 -0
- package/templates/importer/ts/.prettierrc.json +5 -0
- package/templates/importer/ts/.vscode/ceru.code-snippets +27 -0
- package/templates/importer/ts/.vscode/extensions.json +3 -0
- package/templates/importer/ts/.vscode/launch.json +30 -0
- package/templates/importer/ts/.vscode/settings.json +20 -0
- package/templates/importer/ts/.vscode/tasks.json +36 -0
- package/templates/importer/ts/README.md +38 -0
- package/templates/importer/ts/_gitignore +6 -0
- package/templates/importer/ts/ceru.plugin.json +63 -0
- package/templates/importer/ts/package.json +21 -0
- package/templates/importer/ts/src/index.ts +37 -0
- package/templates/importer/ts/tsconfig.json +16 -0
- package/templates/importer/ts/ui/settings.json +24 -0
- package/templates/react/js/.prettierrc.json +5 -0
- package/templates/react/js/.vscode/ceru.code-snippets +27 -0
- package/templates/react/js/.vscode/extensions.json +3 -0
- package/templates/react/js/.vscode/launch.json +30 -0
- package/templates/react/js/.vscode/settings.json +20 -0
- package/templates/react/js/.vscode/tasks.json +36 -0
- package/templates/react/js/README.md +36 -0
- package/templates/react/js/_gitignore +6 -0
- package/templates/react/js/ceru.plugin.json +60 -0
- package/templates/react/js/package.json +25 -0
- package/templates/react/js/src/App.jsx +22 -0
- package/templates/react/js/src/index.js +7 -0
- package/templates/react/js/src/view.jsx +8 -0
- package/templates/react/js/tsconfig.json +16 -0
- package/templates/react/ts/.prettierrc.json +5 -0
- package/templates/react/ts/.vscode/ceru.code-snippets +27 -0
- package/templates/react/ts/.vscode/extensions.json +3 -0
- package/templates/react/ts/.vscode/launch.json +30 -0
- package/templates/react/ts/.vscode/settings.json +20 -0
- package/templates/react/ts/.vscode/tasks.json +36 -0
- package/templates/react/ts/README.md +36 -0
- package/templates/react/ts/_gitignore +6 -0
- package/templates/react/ts/ceru.plugin.json +60 -0
- package/templates/react/ts/package.json +25 -0
- package/templates/react/ts/src/App.tsx +23 -0
- package/templates/react/ts/src/index.ts +7 -0
- package/templates/react/ts/src/view.tsx +8 -0
- package/templates/react/ts/tsconfig.json +16 -0
- package/templates/snapshot.json +257 -0
- package/templates/source/js/.prettierrc.json +5 -0
- package/templates/source/js/.vscode/ceru.code-snippets +27 -0
- package/templates/source/js/.vscode/extensions.json +3 -0
- package/templates/source/js/.vscode/launch.json +30 -0
- package/templates/source/js/.vscode/settings.json +20 -0
- package/templates/source/js/.vscode/tasks.json +36 -0
- package/templates/source/js/README.md +38 -0
- package/templates/source/js/_gitignore +6 -0
- package/templates/source/js/ceru.plugin.json +51 -0
- package/templates/source/js/package.json +21 -0
- package/templates/source/js/src/index.js +50 -0
- package/templates/source/js/tsconfig.json +16 -0
- package/templates/source/ts/.prettierrc.json +5 -0
- package/templates/source/ts/.vscode/ceru.code-snippets +27 -0
- package/templates/source/ts/.vscode/extensions.json +3 -0
- package/templates/source/ts/.vscode/launch.json +30 -0
- package/templates/source/ts/.vscode/settings.json +20 -0
- package/templates/source/ts/.vscode/tasks.json +36 -0
- package/templates/source/ts/README.md +38 -0
- package/templates/source/ts/_gitignore +6 -0
- package/templates/source/ts/ceru.plugin.json +51 -0
- package/templates/source/ts/package.json +21 -0
- package/templates/source/ts/src/index.ts +50 -0
- package/templates/source/ts/tsconfig.json +16 -0
- package/templates/vue/js/.prettierrc.json +5 -0
- package/templates/vue/js/.vscode/ceru.code-snippets +27 -0
- package/templates/vue/js/.vscode/extensions.json +3 -0
- package/templates/vue/js/.vscode/launch.json +30 -0
- package/templates/vue/js/.vscode/settings.json +20 -0
- package/templates/vue/js/.vscode/tasks.json +36 -0
- package/templates/vue/js/README.md +36 -0
- package/templates/vue/js/_gitignore +6 -0
- package/templates/vue/js/ceru.plugin.json +59 -0
- package/templates/vue/js/package.json +22 -0
- package/templates/vue/js/src/App.vue +31 -0
- package/templates/vue/js/src/env.d.ts +5 -0
- package/templates/vue/js/src/index.js +7 -0
- package/templates/vue/js/src/view.js +8 -0
- package/templates/vue/js/tsconfig.json +17 -0
- package/templates/vue/ts/.prettierrc.json +5 -0
- package/templates/vue/ts/.vscode/ceru.code-snippets +27 -0
- package/templates/vue/ts/.vscode/extensions.json +3 -0
- package/templates/vue/ts/.vscode/launch.json +30 -0
- package/templates/vue/ts/.vscode/settings.json +20 -0
- package/templates/vue/ts/.vscode/tasks.json +36 -0
- package/templates/vue/ts/README.md +36 -0
- package/templates/vue/ts/_gitignore +6 -0
- package/templates/vue/ts/ceru.plugin.json +59 -0
- package/templates/vue/ts/package.json +22 -0
- package/templates/vue/ts/src/App.vue +32 -0
- package/templates/vue/ts/src/env.d.ts +5 -0
- package/templates/vue/ts/src/index.ts +7 -0
- package/templates/vue/ts/src/view.ts +8 -0
- package/templates/vue/ts/tsconfig.json +17 -0
- package/templates/vue-tsx/js/.prettierrc.json +5 -0
- package/templates/vue-tsx/js/.vscode/ceru.code-snippets +27 -0
- package/templates/vue-tsx/js/.vscode/extensions.json +3 -0
- package/templates/vue-tsx/js/.vscode/launch.json +30 -0
- package/templates/vue-tsx/js/.vscode/settings.json +20 -0
- package/templates/vue-tsx/js/.vscode/tasks.json +36 -0
- package/templates/vue-tsx/js/README.md +36 -0
- package/templates/vue-tsx/js/_gitignore +6 -0
- package/templates/vue-tsx/js/ceru.plugin.json +59 -0
- package/templates/vue-tsx/js/package.json +22 -0
- package/templates/vue-tsx/js/src/App.jsx +14 -0
- package/templates/vue-tsx/js/src/env.d.ts +5 -0
- package/templates/vue-tsx/js/src/index.js +7 -0
- package/templates/vue-tsx/js/src/view.js +8 -0
- package/templates/vue-tsx/js/tsconfig.json +17 -0
- package/templates/vue-tsx/ts/.prettierrc.json +5 -0
- package/templates/vue-tsx/ts/.vscode/ceru.code-snippets +27 -0
- package/templates/vue-tsx/ts/.vscode/extensions.json +3 -0
- package/templates/vue-tsx/ts/.vscode/launch.json +30 -0
- package/templates/vue-tsx/ts/.vscode/settings.json +20 -0
- package/templates/vue-tsx/ts/.vscode/tasks.json +36 -0
- package/templates/vue-tsx/ts/README.md +36 -0
- package/templates/vue-tsx/ts/_gitignore +6 -0
- package/templates/vue-tsx/ts/ceru.plugin.json +59 -0
- package/templates/vue-tsx/ts/package.json +22 -0
- package/templates/vue-tsx/ts/src/App.tsx +15 -0
- package/templates/vue-tsx/ts/src/env.d.ts +5 -0
- package/templates/vue-tsx/ts/src/index.ts +7 -0
- package/templates/vue-tsx/ts/src/view.ts +8 -0
- package/templates/vue-tsx/ts/tsconfig.json +17 -0
- package/templates/web-dist/js/.prettierrc.json +5 -0
- package/templates/web-dist/js/.vscode/ceru.code-snippets +27 -0
- package/templates/web-dist/js/.vscode/extensions.json +3 -0
- package/templates/web-dist/js/.vscode/launch.json +30 -0
- package/templates/web-dist/js/.vscode/settings.json +20 -0
- package/templates/web-dist/js/.vscode/tasks.json +36 -0
- package/templates/web-dist/js/README.md +38 -0
- package/templates/web-dist/js/_gitignore +6 -0
- package/templates/web-dist/js/ceru.plugin.json +57 -0
- package/templates/web-dist/js/package.json +21 -0
- package/templates/web-dist/js/src/index.js +7 -0
- package/templates/web-dist/js/tsconfig.json +16 -0
- package/templates/web-dist/js/web-dist/index.html +14 -0
- package/templates/web-dist/js/web-dist/main.js +4 -0
- package/templates/web-dist/js/web-dist/sample.png +0 -0
- package/templates/web-dist/js/web-dist/style.css +11 -0
- package/templates/web-dist/ts/.prettierrc.json +5 -0
- package/templates/web-dist/ts/.vscode/ceru.code-snippets +27 -0
- package/templates/web-dist/ts/.vscode/extensions.json +3 -0
- package/templates/web-dist/ts/.vscode/launch.json +30 -0
- package/templates/web-dist/ts/.vscode/settings.json +20 -0
- package/templates/web-dist/ts/.vscode/tasks.json +36 -0
- package/templates/web-dist/ts/README.md +38 -0
- package/templates/web-dist/ts/_gitignore +6 -0
- package/templates/web-dist/ts/ceru.plugin.json +57 -0
- package/templates/web-dist/ts/package.json +21 -0
- package/templates/web-dist/ts/src/index.ts +7 -0
- package/templates/web-dist/ts/tsconfig.json +16 -0
- package/templates/web-dist/ts/web-dist/index.html +14 -0
- package/templates/web-dist/ts/web-dist/main.js +4 -0
- package/templates/web-dist/ts/web-dist/sample.png +0 -0
- package/templates/web-dist/ts/web-dist/style.css +11 -0
- package/templates/web-surface/js/.prettierrc.json +5 -0
- package/templates/web-surface/js/.vscode/ceru.code-snippets +27 -0
- package/templates/web-surface/js/.vscode/extensions.json +3 -0
- package/templates/web-surface/js/.vscode/launch.json +30 -0
- package/templates/web-surface/js/.vscode/settings.json +20 -0
- package/templates/web-surface/js/.vscode/tasks.json +36 -0
- package/templates/web-surface/js/README.md +36 -0
- package/templates/web-surface/js/_gitignore +6 -0
- package/templates/web-surface/js/ceru.plugin.json +55 -0
- package/templates/web-surface/js/package.json +21 -0
- package/templates/web-surface/js/src/index.js +7 -0
- package/templates/web-surface/js/src/view.js +8 -0
- package/templates/web-surface/js/tsconfig.json +16 -0
- package/templates/web-surface/ts/.prettierrc.json +5 -0
- package/templates/web-surface/ts/.vscode/ceru.code-snippets +27 -0
- package/templates/web-surface/ts/.vscode/extensions.json +3 -0
- package/templates/web-surface/ts/.vscode/launch.json +30 -0
- package/templates/web-surface/ts/.vscode/settings.json +20 -0
- package/templates/web-surface/ts/.vscode/tasks.json +36 -0
- package/templates/web-surface/ts/README.md +36 -0
- package/templates/web-surface/ts/_gitignore +6 -0
- package/templates/web-surface/ts/ceru.plugin.json +55 -0
- package/templates/web-surface/ts/package.json +21 -0
- package/templates/web-surface/ts/src/index.ts +7 -0
- package/templates/web-surface/ts/src/view.ts +8 -0
- package/templates/web-surface/ts/tsconfig.json +16 -0
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "2.0.0",
|
|
3
|
+
"tasks": [
|
|
4
|
+
{
|
|
5
|
+
"label": "Ceru: dev",
|
|
6
|
+
"type": "npm",
|
|
7
|
+
"script": "dev",
|
|
8
|
+
"isBackground": true,
|
|
9
|
+
"problemMatcher": {
|
|
10
|
+
"owner": "ceru",
|
|
11
|
+
"pattern": {
|
|
12
|
+
"regexp": "^CERU_ERROR (.*)$",
|
|
13
|
+
"message": 1
|
|
14
|
+
},
|
|
15
|
+
"background": {
|
|
16
|
+
"activeOnStart": true,
|
|
17
|
+
"beginsPattern": "^.*$",
|
|
18
|
+
"endsPattern": "^Electron debugger:"
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"label": "Ceru: typecheck",
|
|
24
|
+
"type": "npm",
|
|
25
|
+
"script": "typecheck",
|
|
26
|
+
"problemMatcher": "$tsc",
|
|
27
|
+
"group": "build"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"label": "Ceru: build",
|
|
31
|
+
"type": "npm",
|
|
32
|
+
"script": "build",
|
|
33
|
+
"problemMatcher": []
|
|
34
|
+
}
|
|
35
|
+
]
|
|
36
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# vue / ts
|
|
2
|
+
|
|
3
|
+
Ceru Music v2 插件开发模板。此目录是源码,不是安装包。
|
|
4
|
+
|
|
5
|
+
## 运行 demo
|
|
6
|
+
|
|
7
|
+
1. 使用脚手架创建工程:
|
|
8
|
+
|
|
9
|
+
npm create ceru-plugin@latest my-plugin -- --template vue --lang ts
|
|
10
|
+
|
|
11
|
+
2. 进入目录,运行 npm install。
|
|
12
|
+
3. 运行 npm run dev,打开独立 Electron 调试工作台。
|
|
13
|
+
4. 修改 src 中的代码;保存后自动类型检查并重载。
|
|
14
|
+
5. 运行 npm run build,只分发 dist/plugin.js。
|
|
15
|
+
|
|
16
|
+
## 编辑器
|
|
17
|
+
|
|
18
|
+
VS Code 按 F5 选择 Launch Ceru plugin;已有调试窗口时选择 Attach to Ceru plugin。
|
|
19
|
+
激活代码已经执行时,可点击“重新运行”再次命中断点。
|
|
20
|
+
配置文件有 JSON Schema 提示,SDK 提供参数类型、图标名称与 Lodash 方法补全。
|
|
21
|
+
|
|
22
|
+
## 宿主资源
|
|
23
|
+
|
|
24
|
+
- 平台图标:icon: { kind: 'host', name: 'platform.tx' }。
|
|
25
|
+
- 代码取图标:await ctx.icons.url('platform.tx')。
|
|
26
|
+
- 默认封面:await ctx.assets.url('placeholder.cover')。
|
|
27
|
+
- 共享工具:ctx.utils.lodash。
|
|
28
|
+
|
|
29
|
+
框架模板默认使用声明过版本的宿主 Vue/React 生产运行时;开发编译器不进入插件。
|
|
30
|
+
若需要把生产运行时一起打包,可将 ceru.plugin.json 的 sharedLibraries 改为 {}。
|
|
31
|
+
|
|
32
|
+
## 边界
|
|
33
|
+
|
|
34
|
+
本模板面向 v2 协议。开发工作台不是当前 v1 桌面 Host 的兼容层。
|
|
35
|
+
凭据保险箱、完整音乐业务和 Guest 安装需要正式 Host;不支持的调试调用会明确报错。
|
|
36
|
+
不要把私人 API Key、卡密或发行私钥提交到仓库。
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
{
|
|
2
|
+
"manifest": {
|
|
3
|
+
"manifestVersion": 2,
|
|
4
|
+
"id": "local.ts",
|
|
5
|
+
"name": "ts",
|
|
6
|
+
"version": "0.1.0",
|
|
7
|
+
"description": "A Ceru Music v2 vue plugin",
|
|
8
|
+
"engines": {
|
|
9
|
+
"hostApi": "^2.0.0",
|
|
10
|
+
"logicRuntime": "ceru-js@1",
|
|
11
|
+
"uiSchema": "^1.0.0"
|
|
12
|
+
},
|
|
13
|
+
"modules": {
|
|
14
|
+
"logic": {
|
|
15
|
+
"entry": "logic.main",
|
|
16
|
+
"activation": ["onCommand:hello"]
|
|
17
|
+
},
|
|
18
|
+
"surfaces": [
|
|
19
|
+
{
|
|
20
|
+
"id": "page",
|
|
21
|
+
"kind": "web",
|
|
22
|
+
"entry": "view.main"
|
|
23
|
+
}
|
|
24
|
+
]
|
|
25
|
+
},
|
|
26
|
+
"contributes": {
|
|
27
|
+
"commands": [
|
|
28
|
+
{
|
|
29
|
+
"id": "hello",
|
|
30
|
+
"title": "Hello",
|
|
31
|
+
"action": "hello"
|
|
32
|
+
}
|
|
33
|
+
],
|
|
34
|
+
"sidebarItems": [
|
|
35
|
+
{
|
|
36
|
+
"id": "page",
|
|
37
|
+
"group": "library",
|
|
38
|
+
"title": "ts",
|
|
39
|
+
"view": "page"
|
|
40
|
+
}
|
|
41
|
+
]
|
|
42
|
+
},
|
|
43
|
+
"permissions": [],
|
|
44
|
+
"dataSchemas": {
|
|
45
|
+
"config": 1,
|
|
46
|
+
"state": 1
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
"entries": {
|
|
50
|
+
"logic.main": "src/index.ts",
|
|
51
|
+
"view.main": "src/view.ts"
|
|
52
|
+
},
|
|
53
|
+
"resources": {},
|
|
54
|
+
"output": "dist/plugin.js",
|
|
55
|
+
"framework": "vue",
|
|
56
|
+
"sharedLibraries": {
|
|
57
|
+
"vue": "^3.5.43"
|
|
58
|
+
}
|
|
59
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "ts",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"type": "module",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"dev": "ceru-plugin dev",
|
|
8
|
+
"build": "ceru-plugin build",
|
|
9
|
+
"typecheck": "tsc --noEmit",
|
|
10
|
+
"validate": "ceru-plugin validate dist/plugin.js"
|
|
11
|
+
},
|
|
12
|
+
"dependencies": {
|
|
13
|
+
"@shiqianjiang/ceru-plugin-sdk": "^0.1.0"
|
|
14
|
+
},
|
|
15
|
+
"devDependencies": {
|
|
16
|
+
"@shiqianjiang/ceru-plugin-cli": "^0.1.0",
|
|
17
|
+
"typescript": "~5.9.3",
|
|
18
|
+
"electron": "^44.4.2",
|
|
19
|
+
"prettier": "^3.6.2",
|
|
20
|
+
"vue": "3.5.43"
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { ref, onMounted } from 'vue'
|
|
3
|
+
import type { SurfaceContext } from '@shiqianjiang/ceru-plugin-sdk'
|
|
4
|
+
const props = defineProps<{ context: SurfaceContext }>()
|
|
5
|
+
const count = ref(0)
|
|
6
|
+
const icon = ref('')
|
|
7
|
+
onMounted(async () => {
|
|
8
|
+
icon.value = await props.context.icons.url('platform.tx')
|
|
9
|
+
})
|
|
10
|
+
</script>
|
|
11
|
+
<template>
|
|
12
|
+
<main>
|
|
13
|
+
<img :src="icon" width="48" />
|
|
14
|
+
<h1>Vue 插件页面</h1>
|
|
15
|
+
<p>编辑 src/App.vue,保存后自动重载。</p>
|
|
16
|
+
<button @click="count++">计数 {{ count }}</button>
|
|
17
|
+
</main>
|
|
18
|
+
</template>
|
|
19
|
+
<style scoped>
|
|
20
|
+
main {
|
|
21
|
+
padding: 28px;
|
|
22
|
+
font: 16px system-ui;
|
|
23
|
+
color: #173b28;
|
|
24
|
+
}
|
|
25
|
+
button {
|
|
26
|
+
padding: 10px 18px;
|
|
27
|
+
border: 0;
|
|
28
|
+
border-radius: 8px;
|
|
29
|
+
background: #a6dfb7;
|
|
30
|
+
cursor: pointer;
|
|
31
|
+
}
|
|
32
|
+
</style>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { createApp } from 'vue'
|
|
2
|
+
import { defineSurface } from '@shiqianjiang/ceru-plugin-sdk'
|
|
3
|
+
import App from './App.vue'
|
|
4
|
+
export default defineSurface((ctx) => {
|
|
5
|
+
const app = createApp(App, { context: ctx })
|
|
6
|
+
app.mount(ctx.root)
|
|
7
|
+
return () => app.unmount()
|
|
8
|
+
})
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2022",
|
|
4
|
+
"module": "ESNext",
|
|
5
|
+
"moduleResolution": "Bundler",
|
|
6
|
+
"strict": true,
|
|
7
|
+
"noEmit": true,
|
|
8
|
+
"skipLibCheck": true,
|
|
9
|
+
"allowJs": true,
|
|
10
|
+
"checkJs": false,
|
|
11
|
+
"lib": ["ES2022", "DOM"],
|
|
12
|
+
"types": [],
|
|
13
|
+
"jsx": "preserve",
|
|
14
|
+
"jsxImportSource": "vue"
|
|
15
|
+
},
|
|
16
|
+
"include": ["src"]
|
|
17
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"Host platform icon": {
|
|
3
|
+
"prefix": "ceru-icon",
|
|
4
|
+
"body": [
|
|
5
|
+
"{ kind: 'host', name: 'platform.${1:tx}' }"
|
|
6
|
+
],
|
|
7
|
+
"description": "使用宿主平台图标,无需打入插件"
|
|
8
|
+
},
|
|
9
|
+
"Host lodash": {
|
|
10
|
+
"prefix": "ceru-lodash",
|
|
11
|
+
"body": [
|
|
12
|
+
"ctx.utils.lodash.${1:uniqBy}(${2:items}, ${3:key})"
|
|
13
|
+
],
|
|
14
|
+
"description": "调用宿主的带类型 Lodash 工具"
|
|
15
|
+
},
|
|
16
|
+
"Source rate limit": {
|
|
17
|
+
"prefix": "ceru-rate-limit",
|
|
18
|
+
"body": [
|
|
19
|
+
"return ctx.playback.failure({",
|
|
20
|
+
" code: 'RATE_LIMITED',",
|
|
21
|
+
" message: '${1:请稍后重试}',",
|
|
22
|
+
" recovery: { mode: 'await-user', maxWaitMs: 60000 }",
|
|
23
|
+
"})"
|
|
24
|
+
],
|
|
25
|
+
"description": "返回结构化限流结果,由 Host 决定换源与交互"
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "0.2.0",
|
|
3
|
+
"configurations": [
|
|
4
|
+
{
|
|
5
|
+
"name": "Launch Ceru plugin",
|
|
6
|
+
"type": "pwa-chrome",
|
|
7
|
+
"request": "attach",
|
|
8
|
+
"port": 9223,
|
|
9
|
+
"preLaunchTask": "Ceru: dev",
|
|
10
|
+
"webRoot": "${workspaceFolder}",
|
|
11
|
+
"sourceMaps": true,
|
|
12
|
+
"sourceMapPathOverrides": {
|
|
13
|
+
"ceru:///*": "${workspaceFolder}/*"
|
|
14
|
+
},
|
|
15
|
+
"skipFiles": ["**/node_modules/**"]
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"name": "Attach to Ceru plugin",
|
|
19
|
+
"type": "pwa-chrome",
|
|
20
|
+
"request": "attach",
|
|
21
|
+
"port": 9223,
|
|
22
|
+
"webRoot": "${workspaceFolder}",
|
|
23
|
+
"sourceMaps": true,
|
|
24
|
+
"sourceMapPathOverrides": {
|
|
25
|
+
"ceru:///*": "${workspaceFolder}/*"
|
|
26
|
+
},
|
|
27
|
+
"skipFiles": ["**/node_modules/**"]
|
|
28
|
+
}
|
|
29
|
+
]
|
|
30
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"typescript.tsdk": "node_modules/typescript/lib",
|
|
3
|
+
"typescript.enablePromptUseWorkspaceTsdk": true,
|
|
4
|
+
"editor.formatOnSave": true,
|
|
5
|
+
"[typescript]": {
|
|
6
|
+
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
|
7
|
+
},
|
|
8
|
+
"[javascript]": {
|
|
9
|
+
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
|
10
|
+
},
|
|
11
|
+
"json.schemas": [
|
|
12
|
+
{
|
|
13
|
+
"fileMatch": ["/ceru.plugin.json"],
|
|
14
|
+
"url": "./node_modules/@shiqianjiang/ceru-plugin-cli/schemas/config.schema.json"
|
|
15
|
+
}
|
|
16
|
+
],
|
|
17
|
+
"files.exclude": {
|
|
18
|
+
"**/*.tsbuildinfo": true
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "2.0.0",
|
|
3
|
+
"tasks": [
|
|
4
|
+
{
|
|
5
|
+
"label": "Ceru: dev",
|
|
6
|
+
"type": "npm",
|
|
7
|
+
"script": "dev",
|
|
8
|
+
"isBackground": true,
|
|
9
|
+
"problemMatcher": {
|
|
10
|
+
"owner": "ceru",
|
|
11
|
+
"pattern": {
|
|
12
|
+
"regexp": "^CERU_ERROR (.*)$",
|
|
13
|
+
"message": 1
|
|
14
|
+
},
|
|
15
|
+
"background": {
|
|
16
|
+
"activeOnStart": true,
|
|
17
|
+
"beginsPattern": "^.*$",
|
|
18
|
+
"endsPattern": "^Electron debugger:"
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"label": "Ceru: typecheck",
|
|
24
|
+
"type": "npm",
|
|
25
|
+
"script": "typecheck",
|
|
26
|
+
"problemMatcher": "$tsc",
|
|
27
|
+
"group": "build"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"label": "Ceru: build",
|
|
31
|
+
"type": "npm",
|
|
32
|
+
"script": "build",
|
|
33
|
+
"problemMatcher": []
|
|
34
|
+
}
|
|
35
|
+
]
|
|
36
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# vue-tsx / js
|
|
2
|
+
|
|
3
|
+
Ceru Music v2 插件开发模板。此目录是源码,不是安装包。
|
|
4
|
+
|
|
5
|
+
## 运行 demo
|
|
6
|
+
|
|
7
|
+
1. 使用脚手架创建工程:
|
|
8
|
+
|
|
9
|
+
npm create ceru-plugin@latest my-plugin -- --template vue-tsx --lang js
|
|
10
|
+
|
|
11
|
+
2. 进入目录,运行 npm install。
|
|
12
|
+
3. 运行 npm run dev,打开独立 Electron 调试工作台。
|
|
13
|
+
4. 修改 src 中的代码;保存后自动类型检查并重载。
|
|
14
|
+
5. 运行 npm run build,只分发 dist/plugin.js。
|
|
15
|
+
|
|
16
|
+
## 编辑器
|
|
17
|
+
|
|
18
|
+
VS Code 按 F5 选择 Launch Ceru plugin;已有调试窗口时选择 Attach to Ceru plugin。
|
|
19
|
+
激活代码已经执行时,可点击“重新运行”再次命中断点。
|
|
20
|
+
配置文件有 JSON Schema 提示,SDK 提供参数类型、图标名称与 Lodash 方法补全。
|
|
21
|
+
|
|
22
|
+
## 宿主资源
|
|
23
|
+
|
|
24
|
+
- 平台图标:icon: { kind: 'host', name: 'platform.tx' }。
|
|
25
|
+
- 代码取图标:await ctx.icons.url('platform.tx')。
|
|
26
|
+
- 默认封面:await ctx.assets.url('placeholder.cover')。
|
|
27
|
+
- 共享工具:ctx.utils.lodash。
|
|
28
|
+
|
|
29
|
+
框架模板默认使用声明过版本的宿主 Vue/React 生产运行时;开发编译器不进入插件。
|
|
30
|
+
若需要把生产运行时一起打包,可将 ceru.plugin.json 的 sharedLibraries 改为 {}。
|
|
31
|
+
|
|
32
|
+
## 边界
|
|
33
|
+
|
|
34
|
+
本模板面向 v2 协议。开发工作台不是当前 v1 桌面 Host 的兼容层。
|
|
35
|
+
凭据保险箱、完整音乐业务和 Guest 安装需要正式 Host;不支持的调试调用会明确报错。
|
|
36
|
+
不要把私人 API Key、卡密或发行私钥提交到仓库。
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
{
|
|
2
|
+
"manifest": {
|
|
3
|
+
"manifestVersion": 2,
|
|
4
|
+
"id": "local.js",
|
|
5
|
+
"name": "js",
|
|
6
|
+
"version": "0.1.0",
|
|
7
|
+
"description": "A Ceru Music v2 vue-tsx plugin",
|
|
8
|
+
"engines": {
|
|
9
|
+
"hostApi": "^2.0.0",
|
|
10
|
+
"logicRuntime": "ceru-js@1",
|
|
11
|
+
"uiSchema": "^1.0.0"
|
|
12
|
+
},
|
|
13
|
+
"modules": {
|
|
14
|
+
"logic": {
|
|
15
|
+
"entry": "logic.main",
|
|
16
|
+
"activation": ["onCommand:hello"]
|
|
17
|
+
},
|
|
18
|
+
"surfaces": [
|
|
19
|
+
{
|
|
20
|
+
"id": "page",
|
|
21
|
+
"kind": "web",
|
|
22
|
+
"entry": "view.main"
|
|
23
|
+
}
|
|
24
|
+
]
|
|
25
|
+
},
|
|
26
|
+
"contributes": {
|
|
27
|
+
"commands": [
|
|
28
|
+
{
|
|
29
|
+
"id": "hello",
|
|
30
|
+
"title": "Hello",
|
|
31
|
+
"action": "hello"
|
|
32
|
+
}
|
|
33
|
+
],
|
|
34
|
+
"sidebarItems": [
|
|
35
|
+
{
|
|
36
|
+
"id": "page",
|
|
37
|
+
"group": "library",
|
|
38
|
+
"title": "js",
|
|
39
|
+
"view": "page"
|
|
40
|
+
}
|
|
41
|
+
]
|
|
42
|
+
},
|
|
43
|
+
"permissions": [],
|
|
44
|
+
"dataSchemas": {
|
|
45
|
+
"config": 1,
|
|
46
|
+
"state": 1
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
"entries": {
|
|
50
|
+
"logic.main": "src/index.js",
|
|
51
|
+
"view.main": "src/view.js"
|
|
52
|
+
},
|
|
53
|
+
"resources": {},
|
|
54
|
+
"output": "dist/plugin.js",
|
|
55
|
+
"framework": "vue",
|
|
56
|
+
"sharedLibraries": {
|
|
57
|
+
"vue": "^3.5.43"
|
|
58
|
+
}
|
|
59
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "js",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"type": "module",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"dev": "ceru-plugin dev",
|
|
8
|
+
"build": "ceru-plugin build",
|
|
9
|
+
"typecheck": "tsc --noEmit",
|
|
10
|
+
"validate": "ceru-plugin validate dist/plugin.js"
|
|
11
|
+
},
|
|
12
|
+
"dependencies": {
|
|
13
|
+
"@shiqianjiang/ceru-plugin-sdk": "^0.1.0"
|
|
14
|
+
},
|
|
15
|
+
"devDependencies": {
|
|
16
|
+
"@shiqianjiang/ceru-plugin-cli": "^0.1.0",
|
|
17
|
+
"typescript": "~5.9.3",
|
|
18
|
+
"electron": "^44.4.2",
|
|
19
|
+
"prettier": "^3.6.2",
|
|
20
|
+
"vue": "3.5.43"
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { defineComponent, ref } from 'vue'
|
|
2
|
+
export default defineComponent({
|
|
3
|
+
props: { context: { type: Object, required: true } },
|
|
4
|
+
setup(props) {
|
|
5
|
+
const count = ref(0)
|
|
6
|
+
return () => (
|
|
7
|
+
<main style={{ padding: '28px', fontFamily: 'system-ui' }}>
|
|
8
|
+
<h1>Vue TSX 插件页面</h1>
|
|
9
|
+
<p>{props.context.utils.lodash.startCase('host utilities ready')}</p>
|
|
10
|
+
<button onClick={() => count.value++}>计数 {count.value}</button>
|
|
11
|
+
</main>
|
|
12
|
+
)
|
|
13
|
+
},
|
|
14
|
+
})
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { createApp } from 'vue'
|
|
2
|
+
import { defineSurface } from '@shiqianjiang/ceru-plugin-sdk'
|
|
3
|
+
import App from './App'
|
|
4
|
+
export default defineSurface((ctx) => {
|
|
5
|
+
const app = createApp(App, { context: ctx })
|
|
6
|
+
app.mount(ctx.root)
|
|
7
|
+
return () => app.unmount()
|
|
8
|
+
})
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2022",
|
|
4
|
+
"module": "ESNext",
|
|
5
|
+
"moduleResolution": "Bundler",
|
|
6
|
+
"strict": true,
|
|
7
|
+
"noEmit": true,
|
|
8
|
+
"skipLibCheck": true,
|
|
9
|
+
"allowJs": true,
|
|
10
|
+
"checkJs": false,
|
|
11
|
+
"lib": ["ES2022", "DOM"],
|
|
12
|
+
"types": [],
|
|
13
|
+
"jsx": "preserve",
|
|
14
|
+
"jsxImportSource": "vue"
|
|
15
|
+
},
|
|
16
|
+
"include": ["src"]
|
|
17
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"Host platform icon": {
|
|
3
|
+
"prefix": "ceru-icon",
|
|
4
|
+
"body": [
|
|
5
|
+
"{ kind: 'host', name: 'platform.${1:tx}' }"
|
|
6
|
+
],
|
|
7
|
+
"description": "使用宿主平台图标,无需打入插件"
|
|
8
|
+
},
|
|
9
|
+
"Host lodash": {
|
|
10
|
+
"prefix": "ceru-lodash",
|
|
11
|
+
"body": [
|
|
12
|
+
"ctx.utils.lodash.${1:uniqBy}(${2:items}, ${3:key})"
|
|
13
|
+
],
|
|
14
|
+
"description": "调用宿主的带类型 Lodash 工具"
|
|
15
|
+
},
|
|
16
|
+
"Source rate limit": {
|
|
17
|
+
"prefix": "ceru-rate-limit",
|
|
18
|
+
"body": [
|
|
19
|
+
"return ctx.playback.failure({",
|
|
20
|
+
" code: 'RATE_LIMITED',",
|
|
21
|
+
" message: '${1:请稍后重试}',",
|
|
22
|
+
" recovery: { mode: 'await-user', maxWaitMs: 60000 }",
|
|
23
|
+
"})"
|
|
24
|
+
],
|
|
25
|
+
"description": "返回结构化限流结果,由 Host 决定换源与交互"
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "0.2.0",
|
|
3
|
+
"configurations": [
|
|
4
|
+
{
|
|
5
|
+
"name": "Launch Ceru plugin",
|
|
6
|
+
"type": "pwa-chrome",
|
|
7
|
+
"request": "attach",
|
|
8
|
+
"port": 9223,
|
|
9
|
+
"preLaunchTask": "Ceru: dev",
|
|
10
|
+
"webRoot": "${workspaceFolder}",
|
|
11
|
+
"sourceMaps": true,
|
|
12
|
+
"sourceMapPathOverrides": {
|
|
13
|
+
"ceru:///*": "${workspaceFolder}/*"
|
|
14
|
+
},
|
|
15
|
+
"skipFiles": ["**/node_modules/**"]
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"name": "Attach to Ceru plugin",
|
|
19
|
+
"type": "pwa-chrome",
|
|
20
|
+
"request": "attach",
|
|
21
|
+
"port": 9223,
|
|
22
|
+
"webRoot": "${workspaceFolder}",
|
|
23
|
+
"sourceMaps": true,
|
|
24
|
+
"sourceMapPathOverrides": {
|
|
25
|
+
"ceru:///*": "${workspaceFolder}/*"
|
|
26
|
+
},
|
|
27
|
+
"skipFiles": ["**/node_modules/**"]
|
|
28
|
+
}
|
|
29
|
+
]
|
|
30
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"typescript.tsdk": "node_modules/typescript/lib",
|
|
3
|
+
"typescript.enablePromptUseWorkspaceTsdk": true,
|
|
4
|
+
"editor.formatOnSave": true,
|
|
5
|
+
"[typescript]": {
|
|
6
|
+
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
|
7
|
+
},
|
|
8
|
+
"[javascript]": {
|
|
9
|
+
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
|
10
|
+
},
|
|
11
|
+
"json.schemas": [
|
|
12
|
+
{
|
|
13
|
+
"fileMatch": ["/ceru.plugin.json"],
|
|
14
|
+
"url": "./node_modules/@shiqianjiang/ceru-plugin-cli/schemas/config.schema.json"
|
|
15
|
+
}
|
|
16
|
+
],
|
|
17
|
+
"files.exclude": {
|
|
18
|
+
"**/*.tsbuildinfo": true
|
|
19
|
+
}
|
|
20
|
+
}
|