@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.
Files changed (314) hide show
  1. package/ASSET_LICENSE +238 -0
  2. package/LICENSE +21 -0
  3. package/NOTICE +1 -0
  4. package/README.md +29 -0
  5. package/assets/catalog.json +1 -0
  6. package/assets/electron-app/main.cjs +1 -0
  7. package/assets/electron-app/package.json +8 -0
  8. package/assets/electron.cjs +42 -0
  9. package/assets/index.html +93 -0
  10. package/assets/originals/account.svg +1 -0
  11. package/assets/originals/add.svg +1 -0
  12. package/assets/originals/app.logo.svg +10 -0
  13. package/assets/originals/chart.svg +1 -0
  14. package/assets/originals/close.svg +1 -0
  15. package/assets/originals/cloud.svg +1 -0
  16. package/assets/originals/download.svg +1 -0
  17. package/assets/originals/heart.svg +1 -0
  18. package/assets/originals/import.svg +1 -0
  19. package/assets/originals/info.svg +1 -0
  20. package/assets/originals/library.svg +1 -0
  21. package/assets/originals/music-note.svg +1 -0
  22. package/assets/originals/pause.svg +1 -0
  23. package/assets/originals/placeholder.avatar.webp +0 -0
  24. package/assets/originals/placeholder.cover.png +0 -0
  25. package/assets/originals/platform.all.svg +1 -0
  26. package/assets/originals/platform.kg.svg +1 -0
  27. package/assets/originals/platform.kw.svg +1 -0
  28. package/assets/originals/platform.local.svg +1 -0
  29. package/assets/originals/platform.mg.svg +1 -0
  30. package/assets/originals/platform.tx.svg +1 -0
  31. package/assets/originals/platform.wy.svg +1 -0
  32. package/assets/originals/play.svg +1 -0
  33. package/assets/originals/refresh.svg +1 -0
  34. package/assets/originals/search.svg +1 -0
  35. package/assets/originals/server.svg +1 -0
  36. package/assets/originals/settings.svg +1 -0
  37. package/assets/originals/share.svg +1 -0
  38. package/assets/playground.js +446 -0
  39. package/assets/sandbox.js +36 -0
  40. package/assets/shared-react.js +77 -0
  41. package/assets/shared-vue.js +44 -0
  42. package/assets/style.css +264 -0
  43. package/assets/vendor-licenses/lodash-es.txt +47 -0
  44. package/assets/vendor-licenses/react-dom.txt +21 -0
  45. package/assets/vendor-licenses/react.txt +21 -0
  46. package/assets/vendor-licenses/scheduler.txt +21 -0
  47. package/assets/vendor-licenses/vue.txt +21 -0
  48. package/assets/vendor-licenses/vue_reactivity.txt +21 -0
  49. package/assets/vendor-licenses/vue_runtime-core.txt +21 -0
  50. package/assets/vendor-licenses/vue_runtime-dom.txt +21 -0
  51. package/assets/vendor-licenses/vue_shared.txt +21 -0
  52. package/dist/bin.d.ts +2 -0
  53. package/dist/bin.js +6 -0
  54. package/dist/dev.d.ts +7 -0
  55. package/dist/dev.js +507 -0
  56. package/dist/frameworks.d.ts +9 -0
  57. package/dist/frameworks.js +310 -0
  58. package/dist/index.d.ts +2 -0
  59. package/dist/index.js +206 -0
  60. package/dist/project.d.ts +34 -0
  61. package/dist/project.js +342 -0
  62. package/package.json +67 -0
  63. package/schemas/config.schema.json +610 -0
  64. package/templates/connected-library/js/.prettierrc.json +5 -0
  65. package/templates/connected-library/js/.vscode/ceru.code-snippets +27 -0
  66. package/templates/connected-library/js/.vscode/extensions.json +3 -0
  67. package/templates/connected-library/js/.vscode/launch.json +30 -0
  68. package/templates/connected-library/js/.vscode/settings.json +20 -0
  69. package/templates/connected-library/js/.vscode/tasks.json +36 -0
  70. package/templates/connected-library/js/README.md +38 -0
  71. package/templates/connected-library/js/_gitignore +6 -0
  72. package/templates/connected-library/js/ceru.plugin.json +76 -0
  73. package/templates/connected-library/js/package.json +21 -0
  74. package/templates/connected-library/js/src/index.js +38 -0
  75. package/templates/connected-library/js/tsconfig.json +16 -0
  76. package/templates/connected-library/js/ui/settings.json +24 -0
  77. package/templates/connected-library/ts/.prettierrc.json +5 -0
  78. package/templates/connected-library/ts/.vscode/ceru.code-snippets +27 -0
  79. package/templates/connected-library/ts/.vscode/extensions.json +3 -0
  80. package/templates/connected-library/ts/.vscode/launch.json +30 -0
  81. package/templates/connected-library/ts/.vscode/settings.json +20 -0
  82. package/templates/connected-library/ts/.vscode/tasks.json +36 -0
  83. package/templates/connected-library/ts/README.md +38 -0
  84. package/templates/connected-library/ts/_gitignore +6 -0
  85. package/templates/connected-library/ts/ceru.plugin.json +76 -0
  86. package/templates/connected-library/ts/package.json +21 -0
  87. package/templates/connected-library/ts/src/index.ts +38 -0
  88. package/templates/connected-library/ts/tsconfig.json +16 -0
  89. package/templates/connected-library/ts/ui/settings.json +24 -0
  90. package/templates/guest-adapter/js/.prettierrc.json +5 -0
  91. package/templates/guest-adapter/js/.vscode/ceru.code-snippets +27 -0
  92. package/templates/guest-adapter/js/.vscode/extensions.json +3 -0
  93. package/templates/guest-adapter/js/.vscode/launch.json +30 -0
  94. package/templates/guest-adapter/js/.vscode/settings.json +20 -0
  95. package/templates/guest-adapter/js/.vscode/tasks.json +36 -0
  96. package/templates/guest-adapter/js/README.md +38 -0
  97. package/templates/guest-adapter/js/_gitignore +6 -0
  98. package/templates/guest-adapter/js/ceru.plugin.json +95 -0
  99. package/templates/guest-adapter/js/package.json +21 -0
  100. package/templates/guest-adapter/js/src/guest.js +6 -0
  101. package/templates/guest-adapter/js/src/index.js +8 -0
  102. package/templates/guest-adapter/js/tsconfig.json +16 -0
  103. package/templates/guest-adapter/js/ui/settings.json +14 -0
  104. package/templates/guest-adapter/ts/.prettierrc.json +5 -0
  105. package/templates/guest-adapter/ts/.vscode/ceru.code-snippets +27 -0
  106. package/templates/guest-adapter/ts/.vscode/extensions.json +3 -0
  107. package/templates/guest-adapter/ts/.vscode/launch.json +30 -0
  108. package/templates/guest-adapter/ts/.vscode/settings.json +20 -0
  109. package/templates/guest-adapter/ts/.vscode/tasks.json +36 -0
  110. package/templates/guest-adapter/ts/README.md +38 -0
  111. package/templates/guest-adapter/ts/_gitignore +6 -0
  112. package/templates/guest-adapter/ts/ceru.plugin.json +95 -0
  113. package/templates/guest-adapter/ts/package.json +21 -0
  114. package/templates/guest-adapter/ts/src/guest.ts +6 -0
  115. package/templates/guest-adapter/ts/src/index.ts +8 -0
  116. package/templates/guest-adapter/ts/tsconfig.json +16 -0
  117. package/templates/guest-adapter/ts/ui/settings.json +14 -0
  118. package/templates/importer/js/.prettierrc.json +5 -0
  119. package/templates/importer/js/.vscode/ceru.code-snippets +27 -0
  120. package/templates/importer/js/.vscode/extensions.json +3 -0
  121. package/templates/importer/js/.vscode/launch.json +30 -0
  122. package/templates/importer/js/.vscode/settings.json +20 -0
  123. package/templates/importer/js/.vscode/tasks.json +36 -0
  124. package/templates/importer/js/README.md +38 -0
  125. package/templates/importer/js/_gitignore +6 -0
  126. package/templates/importer/js/ceru.plugin.json +63 -0
  127. package/templates/importer/js/package.json +21 -0
  128. package/templates/importer/js/src/index.js +37 -0
  129. package/templates/importer/js/tsconfig.json +16 -0
  130. package/templates/importer/js/ui/settings.json +24 -0
  131. package/templates/importer/ts/.prettierrc.json +5 -0
  132. package/templates/importer/ts/.vscode/ceru.code-snippets +27 -0
  133. package/templates/importer/ts/.vscode/extensions.json +3 -0
  134. package/templates/importer/ts/.vscode/launch.json +30 -0
  135. package/templates/importer/ts/.vscode/settings.json +20 -0
  136. package/templates/importer/ts/.vscode/tasks.json +36 -0
  137. package/templates/importer/ts/README.md +38 -0
  138. package/templates/importer/ts/_gitignore +6 -0
  139. package/templates/importer/ts/ceru.plugin.json +63 -0
  140. package/templates/importer/ts/package.json +21 -0
  141. package/templates/importer/ts/src/index.ts +37 -0
  142. package/templates/importer/ts/tsconfig.json +16 -0
  143. package/templates/importer/ts/ui/settings.json +24 -0
  144. package/templates/react/js/.prettierrc.json +5 -0
  145. package/templates/react/js/.vscode/ceru.code-snippets +27 -0
  146. package/templates/react/js/.vscode/extensions.json +3 -0
  147. package/templates/react/js/.vscode/launch.json +30 -0
  148. package/templates/react/js/.vscode/settings.json +20 -0
  149. package/templates/react/js/.vscode/tasks.json +36 -0
  150. package/templates/react/js/README.md +36 -0
  151. package/templates/react/js/_gitignore +6 -0
  152. package/templates/react/js/ceru.plugin.json +60 -0
  153. package/templates/react/js/package.json +25 -0
  154. package/templates/react/js/src/App.jsx +22 -0
  155. package/templates/react/js/src/index.js +7 -0
  156. package/templates/react/js/src/view.jsx +8 -0
  157. package/templates/react/js/tsconfig.json +16 -0
  158. package/templates/react/ts/.prettierrc.json +5 -0
  159. package/templates/react/ts/.vscode/ceru.code-snippets +27 -0
  160. package/templates/react/ts/.vscode/extensions.json +3 -0
  161. package/templates/react/ts/.vscode/launch.json +30 -0
  162. package/templates/react/ts/.vscode/settings.json +20 -0
  163. package/templates/react/ts/.vscode/tasks.json +36 -0
  164. package/templates/react/ts/README.md +36 -0
  165. package/templates/react/ts/_gitignore +6 -0
  166. package/templates/react/ts/ceru.plugin.json +60 -0
  167. package/templates/react/ts/package.json +25 -0
  168. package/templates/react/ts/src/App.tsx +23 -0
  169. package/templates/react/ts/src/index.ts +7 -0
  170. package/templates/react/ts/src/view.tsx +8 -0
  171. package/templates/react/ts/tsconfig.json +16 -0
  172. package/templates/snapshot.json +257 -0
  173. package/templates/source/js/.prettierrc.json +5 -0
  174. package/templates/source/js/.vscode/ceru.code-snippets +27 -0
  175. package/templates/source/js/.vscode/extensions.json +3 -0
  176. package/templates/source/js/.vscode/launch.json +30 -0
  177. package/templates/source/js/.vscode/settings.json +20 -0
  178. package/templates/source/js/.vscode/tasks.json +36 -0
  179. package/templates/source/js/README.md +38 -0
  180. package/templates/source/js/_gitignore +6 -0
  181. package/templates/source/js/ceru.plugin.json +51 -0
  182. package/templates/source/js/package.json +21 -0
  183. package/templates/source/js/src/index.js +50 -0
  184. package/templates/source/js/tsconfig.json +16 -0
  185. package/templates/source/ts/.prettierrc.json +5 -0
  186. package/templates/source/ts/.vscode/ceru.code-snippets +27 -0
  187. package/templates/source/ts/.vscode/extensions.json +3 -0
  188. package/templates/source/ts/.vscode/launch.json +30 -0
  189. package/templates/source/ts/.vscode/settings.json +20 -0
  190. package/templates/source/ts/.vscode/tasks.json +36 -0
  191. package/templates/source/ts/README.md +38 -0
  192. package/templates/source/ts/_gitignore +6 -0
  193. package/templates/source/ts/ceru.plugin.json +51 -0
  194. package/templates/source/ts/package.json +21 -0
  195. package/templates/source/ts/src/index.ts +50 -0
  196. package/templates/source/ts/tsconfig.json +16 -0
  197. package/templates/vue/js/.prettierrc.json +5 -0
  198. package/templates/vue/js/.vscode/ceru.code-snippets +27 -0
  199. package/templates/vue/js/.vscode/extensions.json +3 -0
  200. package/templates/vue/js/.vscode/launch.json +30 -0
  201. package/templates/vue/js/.vscode/settings.json +20 -0
  202. package/templates/vue/js/.vscode/tasks.json +36 -0
  203. package/templates/vue/js/README.md +36 -0
  204. package/templates/vue/js/_gitignore +6 -0
  205. package/templates/vue/js/ceru.plugin.json +59 -0
  206. package/templates/vue/js/package.json +22 -0
  207. package/templates/vue/js/src/App.vue +31 -0
  208. package/templates/vue/js/src/env.d.ts +5 -0
  209. package/templates/vue/js/src/index.js +7 -0
  210. package/templates/vue/js/src/view.js +8 -0
  211. package/templates/vue/js/tsconfig.json +17 -0
  212. package/templates/vue/ts/.prettierrc.json +5 -0
  213. package/templates/vue/ts/.vscode/ceru.code-snippets +27 -0
  214. package/templates/vue/ts/.vscode/extensions.json +3 -0
  215. package/templates/vue/ts/.vscode/launch.json +30 -0
  216. package/templates/vue/ts/.vscode/settings.json +20 -0
  217. package/templates/vue/ts/.vscode/tasks.json +36 -0
  218. package/templates/vue/ts/README.md +36 -0
  219. package/templates/vue/ts/_gitignore +6 -0
  220. package/templates/vue/ts/ceru.plugin.json +59 -0
  221. package/templates/vue/ts/package.json +22 -0
  222. package/templates/vue/ts/src/App.vue +32 -0
  223. package/templates/vue/ts/src/env.d.ts +5 -0
  224. package/templates/vue/ts/src/index.ts +7 -0
  225. package/templates/vue/ts/src/view.ts +8 -0
  226. package/templates/vue/ts/tsconfig.json +17 -0
  227. package/templates/vue-tsx/js/.prettierrc.json +5 -0
  228. package/templates/vue-tsx/js/.vscode/ceru.code-snippets +27 -0
  229. package/templates/vue-tsx/js/.vscode/extensions.json +3 -0
  230. package/templates/vue-tsx/js/.vscode/launch.json +30 -0
  231. package/templates/vue-tsx/js/.vscode/settings.json +20 -0
  232. package/templates/vue-tsx/js/.vscode/tasks.json +36 -0
  233. package/templates/vue-tsx/js/README.md +36 -0
  234. package/templates/vue-tsx/js/_gitignore +6 -0
  235. package/templates/vue-tsx/js/ceru.plugin.json +59 -0
  236. package/templates/vue-tsx/js/package.json +22 -0
  237. package/templates/vue-tsx/js/src/App.jsx +14 -0
  238. package/templates/vue-tsx/js/src/env.d.ts +5 -0
  239. package/templates/vue-tsx/js/src/index.js +7 -0
  240. package/templates/vue-tsx/js/src/view.js +8 -0
  241. package/templates/vue-tsx/js/tsconfig.json +17 -0
  242. package/templates/vue-tsx/ts/.prettierrc.json +5 -0
  243. package/templates/vue-tsx/ts/.vscode/ceru.code-snippets +27 -0
  244. package/templates/vue-tsx/ts/.vscode/extensions.json +3 -0
  245. package/templates/vue-tsx/ts/.vscode/launch.json +30 -0
  246. package/templates/vue-tsx/ts/.vscode/settings.json +20 -0
  247. package/templates/vue-tsx/ts/.vscode/tasks.json +36 -0
  248. package/templates/vue-tsx/ts/README.md +36 -0
  249. package/templates/vue-tsx/ts/_gitignore +6 -0
  250. package/templates/vue-tsx/ts/ceru.plugin.json +59 -0
  251. package/templates/vue-tsx/ts/package.json +22 -0
  252. package/templates/vue-tsx/ts/src/App.tsx +15 -0
  253. package/templates/vue-tsx/ts/src/env.d.ts +5 -0
  254. package/templates/vue-tsx/ts/src/index.ts +7 -0
  255. package/templates/vue-tsx/ts/src/view.ts +8 -0
  256. package/templates/vue-tsx/ts/tsconfig.json +17 -0
  257. package/templates/web-dist/js/.prettierrc.json +5 -0
  258. package/templates/web-dist/js/.vscode/ceru.code-snippets +27 -0
  259. package/templates/web-dist/js/.vscode/extensions.json +3 -0
  260. package/templates/web-dist/js/.vscode/launch.json +30 -0
  261. package/templates/web-dist/js/.vscode/settings.json +20 -0
  262. package/templates/web-dist/js/.vscode/tasks.json +36 -0
  263. package/templates/web-dist/js/README.md +38 -0
  264. package/templates/web-dist/js/_gitignore +6 -0
  265. package/templates/web-dist/js/ceru.plugin.json +57 -0
  266. package/templates/web-dist/js/package.json +21 -0
  267. package/templates/web-dist/js/src/index.js +7 -0
  268. package/templates/web-dist/js/tsconfig.json +16 -0
  269. package/templates/web-dist/js/web-dist/index.html +14 -0
  270. package/templates/web-dist/js/web-dist/main.js +4 -0
  271. package/templates/web-dist/js/web-dist/sample.png +0 -0
  272. package/templates/web-dist/js/web-dist/style.css +11 -0
  273. package/templates/web-dist/ts/.prettierrc.json +5 -0
  274. package/templates/web-dist/ts/.vscode/ceru.code-snippets +27 -0
  275. package/templates/web-dist/ts/.vscode/extensions.json +3 -0
  276. package/templates/web-dist/ts/.vscode/launch.json +30 -0
  277. package/templates/web-dist/ts/.vscode/settings.json +20 -0
  278. package/templates/web-dist/ts/.vscode/tasks.json +36 -0
  279. package/templates/web-dist/ts/README.md +38 -0
  280. package/templates/web-dist/ts/_gitignore +6 -0
  281. package/templates/web-dist/ts/ceru.plugin.json +57 -0
  282. package/templates/web-dist/ts/package.json +21 -0
  283. package/templates/web-dist/ts/src/index.ts +7 -0
  284. package/templates/web-dist/ts/tsconfig.json +16 -0
  285. package/templates/web-dist/ts/web-dist/index.html +14 -0
  286. package/templates/web-dist/ts/web-dist/main.js +4 -0
  287. package/templates/web-dist/ts/web-dist/sample.png +0 -0
  288. package/templates/web-dist/ts/web-dist/style.css +11 -0
  289. package/templates/web-surface/js/.prettierrc.json +5 -0
  290. package/templates/web-surface/js/.vscode/ceru.code-snippets +27 -0
  291. package/templates/web-surface/js/.vscode/extensions.json +3 -0
  292. package/templates/web-surface/js/.vscode/launch.json +30 -0
  293. package/templates/web-surface/js/.vscode/settings.json +20 -0
  294. package/templates/web-surface/js/.vscode/tasks.json +36 -0
  295. package/templates/web-surface/js/README.md +36 -0
  296. package/templates/web-surface/js/_gitignore +6 -0
  297. package/templates/web-surface/js/ceru.plugin.json +55 -0
  298. package/templates/web-surface/js/package.json +21 -0
  299. package/templates/web-surface/js/src/index.js +7 -0
  300. package/templates/web-surface/js/src/view.js +8 -0
  301. package/templates/web-surface/js/tsconfig.json +16 -0
  302. package/templates/web-surface/ts/.prettierrc.json +5 -0
  303. package/templates/web-surface/ts/.vscode/ceru.code-snippets +27 -0
  304. package/templates/web-surface/ts/.vscode/extensions.json +3 -0
  305. package/templates/web-surface/ts/.vscode/launch.json +30 -0
  306. package/templates/web-surface/ts/.vscode/settings.json +20 -0
  307. package/templates/web-surface/ts/.vscode/tasks.json +36 -0
  308. package/templates/web-surface/ts/README.md +36 -0
  309. package/templates/web-surface/ts/_gitignore +6 -0
  310. package/templates/web-surface/ts/ceru.plugin.json +55 -0
  311. package/templates/web-surface/ts/package.json +21 -0
  312. package/templates/web-surface/ts/src/index.ts +7 -0
  313. package/templates/web-surface/ts/src/view.ts +8 -0
  314. 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,38 @@
1
+ # connected-library / js
2
+
3
+ Ceru Music v2 插件开发模板。此目录是源码,不是安装包。
4
+
5
+ ## 运行 demo
6
+
7
+ 1. 使用脚手架创建工程:
8
+
9
+ npm create ceru-plugin@latest my-plugin -- --template connected-library --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、卡密或发行私钥提交到仓库。
37
+
38
+ 此 demo 展示连接表单和状态更新;点击“演示连接”不会联网或保存密码。
@@ -0,0 +1,6 @@
1
+ node_modules/
2
+ dist/
3
+ .keys/
4
+ .ceru-dev/
5
+ *.private.pem
6
+ *.tsbuildinfo
@@ -0,0 +1,76 @@
1
+ {
2
+ "manifest": {
3
+ "manifestVersion": 2,
4
+ "id": "local.js",
5
+ "name": "js",
6
+ "version": "0.1.0",
7
+ "description": "A Ceru Music v2 connected-library 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", "onProvider:catalog"]
17
+ },
18
+ "surfaces": [
19
+ {
20
+ "id": "settings",
21
+ "kind": "schema",
22
+ "entry": "schema.settings"
23
+ }
24
+ ]
25
+ },
26
+ "contributes": {
27
+ "commands": [
28
+ {
29
+ "id": "hello",
30
+ "title": "Hello",
31
+ "action": "hello"
32
+ },
33
+ {
34
+ "id": "connect",
35
+ "title": "演示连接",
36
+ "action": "connection.connect",
37
+ "view": "settings"
38
+ }
39
+ ],
40
+ "providers": [
41
+ {
42
+ "id": "catalog",
43
+ "name": "js",
44
+ "protocols": ["music.search@1", "music.resolve@1"],
45
+ "icon": {
46
+ "kind": "host",
47
+ "name": "music-note"
48
+ },
49
+ "connectionMode": "multiple"
50
+ }
51
+ ],
52
+ "settingsPages": [
53
+ {
54
+ "id": "settings",
55
+ "title": "插件设置",
56
+ "view": "settings"
57
+ }
58
+ ]
59
+ },
60
+ "permissions": [],
61
+ "dataSchemas": {
62
+ "config": 1,
63
+ "state": 1
64
+ }
65
+ },
66
+ "entries": {
67
+ "logic.main": "src/index.js"
68
+ },
69
+ "resources": {
70
+ "schema.settings": {
71
+ "path": "ui/settings.json",
72
+ "type": "json"
73
+ }
74
+ },
75
+ "output": "dist/plugin.js"
76
+ }
@@ -0,0 +1,21 @@
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
+ }
21
+ }
@@ -0,0 +1,38 @@
1
+ import { definePlugin } from '@shiqianjiang/ceru-plugin-sdk'
2
+
3
+ export default definePlugin(async (ctx) => {
4
+ await ctx.ui.setState('settings', {
5
+ serverUrl: 'https://music.example.com',
6
+ status: '等待演示连接',
7
+ })
8
+ ctx.actions.register('hello', () => ctx.ui.openView('settings'))
9
+
10
+ ctx.actions.register('connection.connect', async (input) => {
11
+ if (
12
+ !input ||
13
+ typeof input !== 'object' ||
14
+ Array.isArray(input) ||
15
+ typeof input.serverUrl !== 'string'
16
+ ) {
17
+ throw new Error('请输入服务器地址')
18
+ }
19
+ const server = new URL(input.serverUrl)
20
+ if (!['http:', 'https:'].includes(server.protocol)) throw new Error('只支持 HTTP(S) 地址')
21
+
22
+ // 本地 demo 不联网,也不收集密码。真实连接应使用 Host 的凭据与网络 API。
23
+ await ctx.ui.setState('settings', {
24
+ serverUrl: server.origin,
25
+ status: '演示连接成功:' + server.origin + '(未发出网络请求)',
26
+ })
27
+ return { status: 'demo-connected', origin: server.origin }
28
+ })
29
+
30
+ ctx.providers.register('catalog', {
31
+ async search() {
32
+ return { items: [] }
33
+ },
34
+ async resolve() {
35
+ return ctx.playback.failure({ code: 'UNSUPPORTED', message: '请接入真实音乐库 API' })
36
+ },
37
+ })
38
+ })
@@ -0,0 +1,16 @@
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": "react-jsx"
14
+ },
15
+ "include": ["src"]
16
+ }
@@ -0,0 +1,24 @@
1
+ {
2
+ "schemaVersion": "1.0",
3
+ "id": "settings",
4
+ "root": {
5
+ "type": "section",
6
+ "title": "音乐库连接 demo",
7
+ "children": [
8
+ {
9
+ "type": "text-input",
10
+ "label": "服务器地址",
11
+ "bind": "serverUrl"
12
+ },
13
+ {
14
+ "type": "button",
15
+ "label": "演示连接",
16
+ "action": "connection.connect"
17
+ },
18
+ {
19
+ "type": "text",
20
+ "bind": "status"
21
+ }
22
+ ]
23
+ }
24
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "singleQuote": true,
3
+ "semi": false,
4
+ "printWidth": 100
5
+ }
@@ -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,3 @@
1
+ {
2
+ "recommendations": ["esbenp.prettier-vscode"]
3
+ }
@@ -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,38 @@
1
+ # connected-library / ts
2
+
3
+ Ceru Music v2 插件开发模板。此目录是源码,不是安装包。
4
+
5
+ ## 运行 demo
6
+
7
+ 1. 使用脚手架创建工程:
8
+
9
+ npm create ceru-plugin@latest my-plugin -- --template connected-library --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、卡密或发行私钥提交到仓库。
37
+
38
+ 此 demo 展示连接表单和状态更新;点击“演示连接”不会联网或保存密码。
@@ -0,0 +1,6 @@
1
+ node_modules/
2
+ dist/
3
+ .keys/
4
+ .ceru-dev/
5
+ *.private.pem
6
+ *.tsbuildinfo
@@ -0,0 +1,76 @@
1
+ {
2
+ "manifest": {
3
+ "manifestVersion": 2,
4
+ "id": "local.ts",
5
+ "name": "ts",
6
+ "version": "0.1.0",
7
+ "description": "A Ceru Music v2 connected-library 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", "onProvider:catalog"]
17
+ },
18
+ "surfaces": [
19
+ {
20
+ "id": "settings",
21
+ "kind": "schema",
22
+ "entry": "schema.settings"
23
+ }
24
+ ]
25
+ },
26
+ "contributes": {
27
+ "commands": [
28
+ {
29
+ "id": "hello",
30
+ "title": "Hello",
31
+ "action": "hello"
32
+ },
33
+ {
34
+ "id": "connect",
35
+ "title": "演示连接",
36
+ "action": "connection.connect",
37
+ "view": "settings"
38
+ }
39
+ ],
40
+ "providers": [
41
+ {
42
+ "id": "catalog",
43
+ "name": "ts",
44
+ "protocols": ["music.search@1", "music.resolve@1"],
45
+ "icon": {
46
+ "kind": "host",
47
+ "name": "music-note"
48
+ },
49
+ "connectionMode": "multiple"
50
+ }
51
+ ],
52
+ "settingsPages": [
53
+ {
54
+ "id": "settings",
55
+ "title": "插件设置",
56
+ "view": "settings"
57
+ }
58
+ ]
59
+ },
60
+ "permissions": [],
61
+ "dataSchemas": {
62
+ "config": 1,
63
+ "state": 1
64
+ }
65
+ },
66
+ "entries": {
67
+ "logic.main": "src/index.ts"
68
+ },
69
+ "resources": {
70
+ "schema.settings": {
71
+ "path": "ui/settings.json",
72
+ "type": "json"
73
+ }
74
+ },
75
+ "output": "dist/plugin.js"
76
+ }
@@ -0,0 +1,21 @@
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
+ }
21
+ }
@@ -0,0 +1,38 @@
1
+ import { definePlugin } from '@shiqianjiang/ceru-plugin-sdk'
2
+
3
+ export default definePlugin(async (ctx) => {
4
+ await ctx.ui.setState('settings', {
5
+ serverUrl: 'https://music.example.com',
6
+ status: '等待演示连接',
7
+ })
8
+ ctx.actions.register('hello', () => ctx.ui.openView('settings'))
9
+
10
+ ctx.actions.register('connection.connect', async (input) => {
11
+ if (
12
+ !input ||
13
+ typeof input !== 'object' ||
14
+ Array.isArray(input) ||
15
+ typeof input.serverUrl !== 'string'
16
+ ) {
17
+ throw new Error('请输入服务器地址')
18
+ }
19
+ const server = new URL(input.serverUrl)
20
+ if (!['http:', 'https:'].includes(server.protocol)) throw new Error('只支持 HTTP(S) 地址')
21
+
22
+ // 本地 demo 不联网,也不收集密码。真实连接应使用 Host 的凭据与网络 API。
23
+ await ctx.ui.setState('settings', {
24
+ serverUrl: server.origin,
25
+ status: '演示连接成功:' + server.origin + '(未发出网络请求)',
26
+ })
27
+ return { status: 'demo-connected', origin: server.origin }
28
+ })
29
+
30
+ ctx.providers.register('catalog', {
31
+ async search() {
32
+ return { items: [] }
33
+ },
34
+ async resolve() {
35
+ return ctx.playback.failure({ code: 'UNSUPPORTED', message: '请接入真实音乐库 API' })
36
+ },
37
+ })
38
+ })
@@ -0,0 +1,16 @@
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": "react-jsx"
14
+ },
15
+ "include": ["src"]
16
+ }
@@ -0,0 +1,24 @@
1
+ {
2
+ "schemaVersion": "1.0",
3
+ "id": "settings",
4
+ "root": {
5
+ "type": "section",
6
+ "title": "音乐库连接 demo",
7
+ "children": [
8
+ {
9
+ "type": "text-input",
10
+ "label": "服务器地址",
11
+ "bind": "serverUrl"
12
+ },
13
+ {
14
+ "type": "button",
15
+ "label": "演示连接",
16
+ "action": "connection.connect"
17
+ },
18
+ {
19
+ "type": "text",
20
+ "bind": "status"
21
+ }
22
+ ]
23
+ }
24
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "singleQuote": true,
3
+ "semi": false,
4
+ "printWidth": 100
5
+ }
@@ -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,3 @@
1
+ {
2
+ "recommendations": ["esbenp.prettier-vscode"]
3
+ }