@shiqianjiang/ceru-plugin-cli 0.1.1 → 0.2.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 +9 -5
- package/assets/catalog.json +1 -1
- package/assets/core-contracts.js +1 -0
- package/assets/index.html +94 -93
- package/assets/playground.js +293 -30
- package/assets/sandbox.js +50 -19
- package/assets/style.css +16 -0
- package/dist/dependencies.d.ts +6 -0
- package/dist/dependencies.js +45 -0
- package/dist/dev.d.ts +2 -0
- package/dist/dev.js +297 -144
- package/dist/frameworks.d.ts +2 -2
- package/dist/frameworks.js +11 -29
- package/dist/index.js +12 -4
- package/dist/project.d.ts +1 -0
- package/dist/project.js +48 -21
- package/dist/socket-broker.d.ts +23 -0
- package/dist/socket-broker.js +230 -0
- package/package.json +71 -67
- package/schemas/config.schema.json +349 -0
- package/templates/connected-library/js/.vscode/ceru.code-snippets +37 -9
- package/templates/connected-library/js/.vscode/launch.json +36 -46
- package/templates/connected-library/js/.vscode/tasks.json +11 -3
- package/templates/connected-library/js/README.md +7 -2
- package/templates/connected-library/js/ceru-plugin.code-workspace +8 -0
- package/templates/connected-library/js/package.json +4 -3
- package/templates/connected-library/js/src/index.js +7 -5
- package/templates/connected-library/ts/.vscode/ceru.code-snippets +37 -9
- package/templates/connected-library/ts/.vscode/launch.json +36 -46
- package/templates/connected-library/ts/.vscode/tasks.json +11 -3
- package/templates/connected-library/ts/README.md +7 -2
- package/templates/connected-library/ts/ceru-plugin.code-workspace +8 -0
- package/templates/connected-library/ts/package.json +4 -3
- package/templates/connected-library/ts/src/index.ts +7 -5
- package/templates/guest-adapter/js/.vscode/ceru.code-snippets +37 -9
- package/templates/guest-adapter/js/.vscode/launch.json +36 -46
- package/templates/guest-adapter/js/.vscode/tasks.json +11 -3
- package/templates/guest-adapter/js/README.md +7 -2
- package/templates/guest-adapter/js/ceru-plugin.code-workspace +8 -0
- package/templates/guest-adapter/js/package.json +4 -3
- package/templates/guest-adapter/ts/.vscode/ceru.code-snippets +37 -9
- package/templates/guest-adapter/ts/.vscode/launch.json +36 -46
- package/templates/guest-adapter/ts/.vscode/tasks.json +11 -3
- package/templates/guest-adapter/ts/README.md +7 -2
- package/templates/guest-adapter/ts/ceru-plugin.code-workspace +8 -0
- package/templates/guest-adapter/ts/package.json +4 -3
- package/templates/importer/js/.vscode/ceru.code-snippets +37 -9
- package/templates/importer/js/.vscode/launch.json +36 -46
- package/templates/importer/js/.vscode/tasks.json +11 -3
- package/templates/importer/js/README.md +8 -3
- package/templates/importer/js/ceru-plugin.code-workspace +8 -0
- package/templates/importer/js/ceru.plugin.json +8 -24
- package/templates/importer/js/package.json +4 -3
- package/templates/importer/js/src/index.js +28 -34
- package/templates/importer/ts/.vscode/ceru.code-snippets +37 -9
- package/templates/importer/ts/.vscode/launch.json +36 -46
- package/templates/importer/ts/.vscode/tasks.json +11 -3
- package/templates/importer/ts/README.md +8 -3
- package/templates/importer/ts/ceru-plugin.code-workspace +8 -0
- package/templates/importer/ts/ceru.plugin.json +8 -24
- package/templates/importer/ts/package.json +4 -3
- package/templates/importer/ts/src/index.ts +28 -34
- package/templates/react/js/.vscode/ceru.code-snippets +37 -9
- package/templates/react/js/.vscode/launch.json +36 -46
- package/templates/react/js/.vscode/tasks.json +11 -3
- package/templates/react/js/README.md +7 -2
- package/templates/react/js/ceru-plugin.code-workspace +8 -0
- package/templates/react/js/ceru.plugin.json +1 -5
- package/templates/react/js/package.json +4 -3
- package/templates/react/ts/.vscode/ceru.code-snippets +37 -9
- package/templates/react/ts/.vscode/launch.json +36 -46
- package/templates/react/ts/.vscode/tasks.json +11 -3
- package/templates/react/ts/README.md +7 -2
- package/templates/react/ts/ceru-plugin.code-workspace +8 -0
- package/templates/react/ts/ceru.plugin.json +1 -5
- package/templates/react/ts/package.json +4 -3
- package/templates/snapshot.json +22 -2
- package/templates/source/js/.vscode/ceru.code-snippets +37 -9
- package/templates/source/js/.vscode/launch.json +36 -46
- package/templates/source/js/.vscode/tasks.json +11 -3
- package/templates/source/js/README.md +7 -2
- package/templates/source/js/ceru-plugin.code-workspace +8 -0
- package/templates/source/js/ceru.plugin.json +9 -0
- package/templates/source/js/package.json +4 -3
- package/templates/source/js/src/index.js +29 -26
- package/templates/source/ts/.vscode/ceru.code-snippets +37 -9
- package/templates/source/ts/.vscode/launch.json +36 -46
- package/templates/source/ts/.vscode/tasks.json +11 -3
- package/templates/source/ts/README.md +7 -2
- package/templates/source/ts/ceru-plugin.code-workspace +8 -0
- package/templates/source/ts/ceru.plugin.json +9 -0
- package/templates/source/ts/package.json +4 -3
- package/templates/source/ts/src/index.ts +29 -26
- package/templates/vue/js/.vscode/ceru.code-snippets +37 -9
- package/templates/vue/js/.vscode/launch.json +36 -46
- package/templates/vue/js/.vscode/tasks.json +11 -3
- package/templates/vue/js/README.md +7 -2
- package/templates/vue/js/ceru-plugin.code-workspace +8 -0
- package/templates/vue/js/ceru.plugin.json +1 -4
- package/templates/vue/js/package.json +4 -3
- package/templates/vue/ts/.vscode/ceru.code-snippets +37 -9
- package/templates/vue/ts/.vscode/launch.json +36 -46
- package/templates/vue/ts/.vscode/tasks.json +11 -3
- package/templates/vue/ts/README.md +7 -2
- package/templates/vue/ts/ceru-plugin.code-workspace +8 -0
- package/templates/vue/ts/ceru.plugin.json +1 -4
- package/templates/vue/ts/package.json +4 -3
- package/templates/vue-tsx/js/.vscode/ceru.code-snippets +37 -9
- package/templates/vue-tsx/js/.vscode/launch.json +36 -46
- package/templates/vue-tsx/js/.vscode/tasks.json +11 -3
- package/templates/vue-tsx/js/README.md +7 -2
- package/templates/vue-tsx/js/ceru-plugin.code-workspace +8 -0
- package/templates/vue-tsx/js/ceru.plugin.json +1 -4
- package/templates/vue-tsx/js/package.json +4 -3
- package/templates/vue-tsx/ts/.vscode/ceru.code-snippets +37 -9
- package/templates/vue-tsx/ts/.vscode/launch.json +36 -46
- package/templates/vue-tsx/ts/.vscode/tasks.json +11 -3
- package/templates/vue-tsx/ts/README.md +7 -2
- package/templates/vue-tsx/ts/ceru-plugin.code-workspace +8 -0
- package/templates/vue-tsx/ts/ceru.plugin.json +1 -4
- package/templates/vue-tsx/ts/package.json +4 -3
- package/templates/web-dist/js/.vscode/ceru.code-snippets +37 -9
- package/templates/web-dist/js/.vscode/launch.json +36 -46
- package/templates/web-dist/js/.vscode/tasks.json +11 -3
- package/templates/web-dist/js/README.md +7 -2
- package/templates/web-dist/js/ceru-plugin.code-workspace +8 -0
- package/templates/web-dist/js/package.json +4 -3
- package/templates/web-dist/ts/.vscode/ceru.code-snippets +37 -9
- package/templates/web-dist/ts/.vscode/launch.json +36 -46
- package/templates/web-dist/ts/.vscode/tasks.json +11 -3
- package/templates/web-dist/ts/README.md +7 -2
- package/templates/web-dist/ts/ceru-plugin.code-workspace +8 -0
- package/templates/web-dist/ts/package.json +4 -3
- package/templates/web-surface/js/.vscode/ceru.code-snippets +37 -9
- package/templates/web-surface/js/.vscode/launch.json +36 -46
- package/templates/web-surface/js/.vscode/tasks.json +11 -3
- package/templates/web-surface/js/README.md +7 -2
- package/templates/web-surface/js/ceru-plugin.code-workspace +8 -0
- package/templates/web-surface/js/ceru.plugin.json +9 -0
- package/templates/web-surface/js/package.json +4 -3
- package/templates/web-surface/js/src/view.js +4 -1
- package/templates/web-surface/js/ui/search-note.css +3 -0
- package/templates/web-surface/ts/.vscode/ceru.code-snippets +37 -9
- package/templates/web-surface/ts/.vscode/launch.json +36 -46
- package/templates/web-surface/ts/.vscode/tasks.json +11 -3
- package/templates/web-surface/ts/README.md +7 -2
- package/templates/web-surface/ts/ceru-plugin.code-workspace +8 -0
- package/templates/web-surface/ts/ceru.plugin.json +9 -0
- package/templates/web-surface/ts/package.json +4 -3
- package/templates/web-surface/ts/src/view.ts +4 -1
- package/templates/web-surface/ts/ui/search-note.css +3 -0
- package/assets/shared-react.js +0 -77
- package/assets/shared-vue.js +0 -44
package/templates/snapshot.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 1,
|
|
3
3
|
"source": "https://github.com/CeruMusic/CeruMusic-Plugin-Template",
|
|
4
|
-
"digest": "sha256:
|
|
4
|
+
"digest": "sha256:eb68b7d77e117cdbc4cf8e9fff3b0bc5d99d5aa67d962f5821ebdbb16960c63e",
|
|
5
5
|
"files": [
|
|
6
6
|
"connected-library/js/_gitignore",
|
|
7
7
|
"connected-library/js/.prettierrc.json",
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
"connected-library/js/.vscode/launch.json",
|
|
11
11
|
"connected-library/js/.vscode/settings.json",
|
|
12
12
|
"connected-library/js/.vscode/tasks.json",
|
|
13
|
+
"connected-library/js/ceru-plugin.code-workspace",
|
|
13
14
|
"connected-library/js/ceru.plugin.json",
|
|
14
15
|
"connected-library/js/package.json",
|
|
15
16
|
"connected-library/js/README.md",
|
|
@@ -23,6 +24,7 @@
|
|
|
23
24
|
"connected-library/ts/.vscode/launch.json",
|
|
24
25
|
"connected-library/ts/.vscode/settings.json",
|
|
25
26
|
"connected-library/ts/.vscode/tasks.json",
|
|
27
|
+
"connected-library/ts/ceru-plugin.code-workspace",
|
|
26
28
|
"connected-library/ts/ceru.plugin.json",
|
|
27
29
|
"connected-library/ts/package.json",
|
|
28
30
|
"connected-library/ts/README.md",
|
|
@@ -36,6 +38,7 @@
|
|
|
36
38
|
"guest-adapter/js/.vscode/launch.json",
|
|
37
39
|
"guest-adapter/js/.vscode/settings.json",
|
|
38
40
|
"guest-adapter/js/.vscode/tasks.json",
|
|
41
|
+
"guest-adapter/js/ceru-plugin.code-workspace",
|
|
39
42
|
"guest-adapter/js/ceru.plugin.json",
|
|
40
43
|
"guest-adapter/js/package.json",
|
|
41
44
|
"guest-adapter/js/README.md",
|
|
@@ -50,6 +53,7 @@
|
|
|
50
53
|
"guest-adapter/ts/.vscode/launch.json",
|
|
51
54
|
"guest-adapter/ts/.vscode/settings.json",
|
|
52
55
|
"guest-adapter/ts/.vscode/tasks.json",
|
|
56
|
+
"guest-adapter/ts/ceru-plugin.code-workspace",
|
|
53
57
|
"guest-adapter/ts/ceru.plugin.json",
|
|
54
58
|
"guest-adapter/ts/package.json",
|
|
55
59
|
"guest-adapter/ts/README.md",
|
|
@@ -64,6 +68,7 @@
|
|
|
64
68
|
"importer/js/.vscode/launch.json",
|
|
65
69
|
"importer/js/.vscode/settings.json",
|
|
66
70
|
"importer/js/.vscode/tasks.json",
|
|
71
|
+
"importer/js/ceru-plugin.code-workspace",
|
|
67
72
|
"importer/js/ceru.plugin.json",
|
|
68
73
|
"importer/js/package.json",
|
|
69
74
|
"importer/js/README.md",
|
|
@@ -77,6 +82,7 @@
|
|
|
77
82
|
"importer/ts/.vscode/launch.json",
|
|
78
83
|
"importer/ts/.vscode/settings.json",
|
|
79
84
|
"importer/ts/.vscode/tasks.json",
|
|
85
|
+
"importer/ts/ceru-plugin.code-workspace",
|
|
80
86
|
"importer/ts/ceru.plugin.json",
|
|
81
87
|
"importer/ts/package.json",
|
|
82
88
|
"importer/ts/README.md",
|
|
@@ -90,6 +96,7 @@
|
|
|
90
96
|
"react/js/.vscode/launch.json",
|
|
91
97
|
"react/js/.vscode/settings.json",
|
|
92
98
|
"react/js/.vscode/tasks.json",
|
|
99
|
+
"react/js/ceru-plugin.code-workspace",
|
|
93
100
|
"react/js/ceru.plugin.json",
|
|
94
101
|
"react/js/package.json",
|
|
95
102
|
"react/js/README.md",
|
|
@@ -104,6 +111,7 @@
|
|
|
104
111
|
"react/ts/.vscode/launch.json",
|
|
105
112
|
"react/ts/.vscode/settings.json",
|
|
106
113
|
"react/ts/.vscode/tasks.json",
|
|
114
|
+
"react/ts/ceru-plugin.code-workspace",
|
|
107
115
|
"react/ts/ceru.plugin.json",
|
|
108
116
|
"react/ts/package.json",
|
|
109
117
|
"react/ts/README.md",
|
|
@@ -118,6 +126,7 @@
|
|
|
118
126
|
"source/js/.vscode/launch.json",
|
|
119
127
|
"source/js/.vscode/settings.json",
|
|
120
128
|
"source/js/.vscode/tasks.json",
|
|
129
|
+
"source/js/ceru-plugin.code-workspace",
|
|
121
130
|
"source/js/ceru.plugin.json",
|
|
122
131
|
"source/js/package.json",
|
|
123
132
|
"source/js/README.md",
|
|
@@ -130,6 +139,7 @@
|
|
|
130
139
|
"source/ts/.vscode/launch.json",
|
|
131
140
|
"source/ts/.vscode/settings.json",
|
|
132
141
|
"source/ts/.vscode/tasks.json",
|
|
142
|
+
"source/ts/ceru-plugin.code-workspace",
|
|
133
143
|
"source/ts/ceru.plugin.json",
|
|
134
144
|
"source/ts/package.json",
|
|
135
145
|
"source/ts/README.md",
|
|
@@ -142,6 +152,7 @@
|
|
|
142
152
|
"vue-tsx/js/.vscode/launch.json",
|
|
143
153
|
"vue-tsx/js/.vscode/settings.json",
|
|
144
154
|
"vue-tsx/js/.vscode/tasks.json",
|
|
155
|
+
"vue-tsx/js/ceru-plugin.code-workspace",
|
|
145
156
|
"vue-tsx/js/ceru.plugin.json",
|
|
146
157
|
"vue-tsx/js/package.json",
|
|
147
158
|
"vue-tsx/js/README.md",
|
|
@@ -157,6 +168,7 @@
|
|
|
157
168
|
"vue-tsx/ts/.vscode/launch.json",
|
|
158
169
|
"vue-tsx/ts/.vscode/settings.json",
|
|
159
170
|
"vue-tsx/ts/.vscode/tasks.json",
|
|
171
|
+
"vue-tsx/ts/ceru-plugin.code-workspace",
|
|
160
172
|
"vue-tsx/ts/ceru.plugin.json",
|
|
161
173
|
"vue-tsx/ts/package.json",
|
|
162
174
|
"vue-tsx/ts/README.md",
|
|
@@ -172,6 +184,7 @@
|
|
|
172
184
|
"vue/js/.vscode/launch.json",
|
|
173
185
|
"vue/js/.vscode/settings.json",
|
|
174
186
|
"vue/js/.vscode/tasks.json",
|
|
187
|
+
"vue/js/ceru-plugin.code-workspace",
|
|
175
188
|
"vue/js/ceru.plugin.json",
|
|
176
189
|
"vue/js/package.json",
|
|
177
190
|
"vue/js/README.md",
|
|
@@ -187,6 +200,7 @@
|
|
|
187
200
|
"vue/ts/.vscode/launch.json",
|
|
188
201
|
"vue/ts/.vscode/settings.json",
|
|
189
202
|
"vue/ts/.vscode/tasks.json",
|
|
203
|
+
"vue/ts/ceru-plugin.code-workspace",
|
|
190
204
|
"vue/ts/ceru.plugin.json",
|
|
191
205
|
"vue/ts/package.json",
|
|
192
206
|
"vue/ts/README.md",
|
|
@@ -202,6 +216,7 @@
|
|
|
202
216
|
"web-dist/js/.vscode/launch.json",
|
|
203
217
|
"web-dist/js/.vscode/settings.json",
|
|
204
218
|
"web-dist/js/.vscode/tasks.json",
|
|
219
|
+
"web-dist/js/ceru-plugin.code-workspace",
|
|
205
220
|
"web-dist/js/ceru.plugin.json",
|
|
206
221
|
"web-dist/js/package.json",
|
|
207
222
|
"web-dist/js/README.md",
|
|
@@ -218,6 +233,7 @@
|
|
|
218
233
|
"web-dist/ts/.vscode/launch.json",
|
|
219
234
|
"web-dist/ts/.vscode/settings.json",
|
|
220
235
|
"web-dist/ts/.vscode/tasks.json",
|
|
236
|
+
"web-dist/ts/ceru-plugin.code-workspace",
|
|
221
237
|
"web-dist/ts/ceru.plugin.json",
|
|
222
238
|
"web-dist/ts/package.json",
|
|
223
239
|
"web-dist/ts/README.md",
|
|
@@ -234,12 +250,14 @@
|
|
|
234
250
|
"web-surface/js/.vscode/launch.json",
|
|
235
251
|
"web-surface/js/.vscode/settings.json",
|
|
236
252
|
"web-surface/js/.vscode/tasks.json",
|
|
253
|
+
"web-surface/js/ceru-plugin.code-workspace",
|
|
237
254
|
"web-surface/js/ceru.plugin.json",
|
|
238
255
|
"web-surface/js/package.json",
|
|
239
256
|
"web-surface/js/README.md",
|
|
240
257
|
"web-surface/js/src/index.js",
|
|
241
258
|
"web-surface/js/src/view.js",
|
|
242
259
|
"web-surface/js/tsconfig.json",
|
|
260
|
+
"web-surface/js/ui/search-note.css",
|
|
243
261
|
"web-surface/ts/_gitignore",
|
|
244
262
|
"web-surface/ts/.prettierrc.json",
|
|
245
263
|
"web-surface/ts/.vscode/ceru.code-snippets",
|
|
@@ -247,11 +265,13 @@
|
|
|
247
265
|
"web-surface/ts/.vscode/launch.json",
|
|
248
266
|
"web-surface/ts/.vscode/settings.json",
|
|
249
267
|
"web-surface/ts/.vscode/tasks.json",
|
|
268
|
+
"web-surface/ts/ceru-plugin.code-workspace",
|
|
250
269
|
"web-surface/ts/ceru.plugin.json",
|
|
251
270
|
"web-surface/ts/package.json",
|
|
252
271
|
"web-surface/ts/README.md",
|
|
253
272
|
"web-surface/ts/src/index.ts",
|
|
254
273
|
"web-surface/ts/src/view.ts",
|
|
255
|
-
"web-surface/ts/tsconfig.json"
|
|
274
|
+
"web-surface/ts/tsconfig.json",
|
|
275
|
+
"web-surface/ts/ui/search-note.css"
|
|
256
276
|
]
|
|
257
277
|
}
|
|
@@ -1,17 +1,45 @@
|
|
|
1
1
|
{
|
|
2
2
|
"Host platform icon": {
|
|
3
3
|
"prefix": "ceru-icon",
|
|
4
|
-
"body": [
|
|
5
|
-
|
|
6
|
-
],
|
|
7
|
-
"description": "使用宿主平台图标,无需打入插件"
|
|
4
|
+
"body": ["{ kind: 'host', name: 'platform.${1:tx}' }"],
|
|
5
|
+
"description": "使用宿主平台图标,无需打入插件",
|
|
8
6
|
},
|
|
9
7
|
"Host lodash": {
|
|
10
8
|
"prefix": "ceru-lodash",
|
|
9
|
+
"body": ["ctx.utils.lodash.${1:uniqBy}(${2:items}, ${3:key})"],
|
|
10
|
+
"description": "调用宿主的带类型 Lodash 工具",
|
|
11
|
+
},
|
|
12
|
+
"Host HTTP client": {
|
|
13
|
+
"prefix": "ceru-http",
|
|
14
|
+
"body": [
|
|
15
|
+
"const http = ctx.http.create({",
|
|
16
|
+
" baseURL: '${1:https://example.com}',",
|
|
17
|
+
" permissionKey: '${2:api}',",
|
|
18
|
+
" requestPermission: true,",
|
|
19
|
+
"})",
|
|
20
|
+
],
|
|
21
|
+
"description": "使用宿主 Axios 代理;无需将请求库打入插件",
|
|
22
|
+
},
|
|
23
|
+
"Permission group": {
|
|
24
|
+
"prefix": "ceru-permission-group",
|
|
11
25
|
"body": [
|
|
12
|
-
"ctx.
|
|
26
|
+
"const permission = await ctx.permissions.requestGroup({",
|
|
27
|
+
" group: '${1:libraryRead}',",
|
|
28
|
+
" intent: operation.userIntent,",
|
|
29
|
+
"})",
|
|
13
30
|
],
|
|
14
|
-
"description": "
|
|
31
|
+
"description": "一次申请一组用户可理解的能力",
|
|
32
|
+
},
|
|
33
|
+
"Grouped music provider": {
|
|
34
|
+
"prefix": "ceru-provider",
|
|
35
|
+
"body": [
|
|
36
|
+
"ctx.providers.register('${1:catalog}', {",
|
|
37
|
+
" tracks: { search: ${2:searchTracks}, resolve: ${3:resolveTrack}, lyrics: ${4:getLyrics} },",
|
|
38
|
+
" playlists: { search: ${5:searchPlaylists}, categories: ${6:getCategories}, list: ${7:listPlaylists}, get: ${8:getPlaylist} },",
|
|
39
|
+
" charts: { list: ${9:listCharts}, getTracks: ${10:getChartTracks} },",
|
|
40
|
+
"})",
|
|
41
|
+
],
|
|
42
|
+
"description": "注册分组 Provider,返回标准歌曲/歌单/歌词 JSON",
|
|
15
43
|
},
|
|
16
44
|
"Source rate limit": {
|
|
17
45
|
"prefix": "ceru-rate-limit",
|
|
@@ -20,8 +48,8 @@
|
|
|
20
48
|
" code: 'RATE_LIMITED',",
|
|
21
49
|
" message: '${1:请稍后重试}',",
|
|
22
50
|
" recovery: { mode: 'await-user', maxWaitMs: 60000 }",
|
|
23
|
-
"})"
|
|
51
|
+
"})",
|
|
24
52
|
],
|
|
25
|
-
"description": "返回结构化限流结果,由 Host 决定换源与交互"
|
|
26
|
-
}
|
|
53
|
+
"description": "返回结构化限流结果,由 Host 决定换源与交互",
|
|
54
|
+
},
|
|
27
55
|
}
|
|
@@ -1,46 +1,36 @@
|
|
|
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": [
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
"
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
],
|
|
38
|
-
"address": "127.0.0.1",
|
|
39
|
-
"urlFilter": "http://127.0.0.1:4179/*",
|
|
40
|
-
"targetTypes": [
|
|
41
|
-
"page",
|
|
42
|
-
"iframe"
|
|
43
|
-
]
|
|
44
|
-
}
|
|
45
|
-
]
|
|
46
|
-
}
|
|
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
|
+
"address": "127.0.0.1",
|
|
17
|
+
"urlFilter": "http://127.0.0.1:4179/",
|
|
18
|
+
"timeout": 30000
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"name": "Attach to Ceru plugin",
|
|
22
|
+
"type": "pwa-chrome",
|
|
23
|
+
"request": "attach",
|
|
24
|
+
"port": 9223,
|
|
25
|
+
"webRoot": "${workspaceFolder}",
|
|
26
|
+
"sourceMaps": true,
|
|
27
|
+
"sourceMapPathOverrides": {
|
|
28
|
+
"ceru:///*": "${workspaceFolder}/*"
|
|
29
|
+
},
|
|
30
|
+
"skipFiles": ["**/node_modules/**"],
|
|
31
|
+
"address": "127.0.0.1",
|
|
32
|
+
"urlFilter": "http://127.0.0.1:4179/",
|
|
33
|
+
"timeout": 30000
|
|
34
|
+
}
|
|
35
|
+
]
|
|
36
|
+
}
|
|
@@ -3,8 +3,7 @@
|
|
|
3
3
|
"tasks": [
|
|
4
4
|
{
|
|
5
5
|
"label": "Ceru: dev",
|
|
6
|
-
"type": "
|
|
7
|
-
"script": "dev",
|
|
6
|
+
"type": "process",
|
|
8
7
|
"isBackground": true,
|
|
9
8
|
"problemMatcher": {
|
|
10
9
|
"owner": "ceru",
|
|
@@ -15,8 +14,17 @@
|
|
|
15
14
|
"background": {
|
|
16
15
|
"activeOnStart": true,
|
|
17
16
|
"beginsPattern": "^.*$",
|
|
18
|
-
"endsPattern": "^
|
|
17
|
+
"endsPattern": "^CERU_DEBUG_READY "
|
|
19
18
|
}
|
|
19
|
+
},
|
|
20
|
+
"command": "node",
|
|
21
|
+
"args": [
|
|
22
|
+
"${workspaceFolder}/node_modules/@shiqianjiang/ceru-plugin-cli/dist/bin.js",
|
|
23
|
+
"dev",
|
|
24
|
+
"--ensure-running"
|
|
25
|
+
],
|
|
26
|
+
"options": {
|
|
27
|
+
"cwd": "${workspaceFolder}"
|
|
20
28
|
}
|
|
21
29
|
},
|
|
22
30
|
{
|
|
@@ -26,8 +26,13 @@ VS Code 按 F5 选择 Launch Ceru plugin;已有调试窗口时选择 Attach to
|
|
|
26
26
|
- 默认封面:await ctx.assets.url('placeholder.cover')。
|
|
27
27
|
- 共享工具:ctx.utils.lodash。
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
Vue/React 的生产运行代码、页面和样式直接编入发行 JS,宿主不提供框架。
|
|
30
|
+
TypeScript、Vue 编译器、构建工具与开发服务器不会进入产物。
|
|
31
|
+
运行 npm run preview 可只加载 dist/plugin.js 检查发布后的行为。
|
|
32
|
+
|
|
33
|
+
若 VS Code 打开的是父目录,请打开本工程的 ceru-plugin.code-workspace,
|
|
34
|
+
再在“运行和调试”中选择 Launch Ceru plugin;已经运行 npm/pnpm dev 时选择 Attach to Ceru plugin。
|
|
35
|
+
F5 执行当前下拉框中的配置,不会自动选择终端所在的子工程。
|
|
31
36
|
|
|
32
37
|
## 边界
|
|
33
38
|
|
|
@@ -35,6 +35,15 @@
|
|
|
35
35
|
},
|
|
36
36
|
"connectionMode": "none"
|
|
37
37
|
}
|
|
38
|
+
],
|
|
39
|
+
"homeSections": [
|
|
40
|
+
{
|
|
41
|
+
"id": "catalog-playlists",
|
|
42
|
+
"title": "歌单",
|
|
43
|
+
"kind": "playlists",
|
|
44
|
+
"icon": { "kind": "host", "name": "library" },
|
|
45
|
+
"providerIds": ["catalog"]
|
|
46
|
+
}
|
|
38
47
|
]
|
|
39
48
|
},
|
|
40
49
|
"permissions": [],
|
|
@@ -7,13 +7,14 @@
|
|
|
7
7
|
"dev": "ceru-plugin dev",
|
|
8
8
|
"build": "ceru-plugin build",
|
|
9
9
|
"typecheck": "tsc --noEmit",
|
|
10
|
-
"validate": "ceru-plugin validate dist/plugin.js"
|
|
10
|
+
"validate": "ceru-plugin validate dist/plugin.js",
|
|
11
|
+
"preview": "ceru-plugin preview dist/plugin.js"
|
|
11
12
|
},
|
|
12
13
|
"dependencies": {
|
|
13
|
-
"@shiqianjiang/ceru-plugin-sdk": "^0.
|
|
14
|
+
"@shiqianjiang/ceru-plugin-sdk": "^0.2.0"
|
|
14
15
|
},
|
|
15
16
|
"devDependencies": {
|
|
16
|
-
"@shiqianjiang/ceru-plugin-cli": "^0.
|
|
17
|
+
"@shiqianjiang/ceru-plugin-cli": "^0.2.0",
|
|
17
18
|
"typescript": "~5.9.3",
|
|
18
19
|
"electron": "^44.4.2",
|
|
19
20
|
"prettier": "^3.6.2"
|
|
@@ -17,34 +17,37 @@ export default definePlugin((ctx) => {
|
|
|
17
17
|
})
|
|
18
18
|
|
|
19
19
|
ctx.providers.register('catalog', {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
20
|
+
tracks: {
|
|
21
|
+
async search(request) {
|
|
22
|
+
const query = ctx.utils.lodash.trim(request.query).toLowerCase()
|
|
23
|
+
const matches = tracks.filter((track) =>
|
|
24
|
+
(track.title + ' ' + track.artist).toLowerCase().includes(query),
|
|
25
|
+
)
|
|
25
26
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
27
|
+
return {
|
|
28
|
+
items: matches.slice(0, Math.max(1, Math.min(request.limit, 100))).map((track) => ({
|
|
29
|
+
ref: {
|
|
30
|
+
pluginId: ctx.plugin.id,
|
|
31
|
+
providerId: 'catalog',
|
|
32
|
+
kind: 'track',
|
|
33
|
+
id: track.id,
|
|
34
|
+
},
|
|
35
|
+
title: track.title,
|
|
36
|
+
subtitle: track.artist,
|
|
37
|
+
playable: false,
|
|
38
|
+
metadata: { artists: [track.artist] },
|
|
39
|
+
capabilities: [],
|
|
40
|
+
})),
|
|
41
|
+
}
|
|
42
|
+
},
|
|
41
43
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
44
|
+
async resolve() {
|
|
45
|
+
// 演示不会伪造播放地址。真实解析器返回 { ok: true, url, expiresAt? }。
|
|
46
|
+
return ctx.playback.failure({
|
|
47
|
+
code: 'UNSUPPORTED',
|
|
48
|
+
message: '这是本地搜索 demo,尚未连接真实的音源服务。',
|
|
49
|
+
})
|
|
50
|
+
},
|
|
48
51
|
},
|
|
49
52
|
})
|
|
50
53
|
})
|
|
@@ -1,17 +1,45 @@
|
|
|
1
1
|
{
|
|
2
2
|
"Host platform icon": {
|
|
3
3
|
"prefix": "ceru-icon",
|
|
4
|
-
"body": [
|
|
5
|
-
|
|
6
|
-
],
|
|
7
|
-
"description": "使用宿主平台图标,无需打入插件"
|
|
4
|
+
"body": ["{ kind: 'host', name: 'platform.${1:tx}' }"],
|
|
5
|
+
"description": "使用宿主平台图标,无需打入插件",
|
|
8
6
|
},
|
|
9
7
|
"Host lodash": {
|
|
10
8
|
"prefix": "ceru-lodash",
|
|
9
|
+
"body": ["ctx.utils.lodash.${1:uniqBy}(${2:items}, ${3:key})"],
|
|
10
|
+
"description": "调用宿主的带类型 Lodash 工具",
|
|
11
|
+
},
|
|
12
|
+
"Host HTTP client": {
|
|
13
|
+
"prefix": "ceru-http",
|
|
14
|
+
"body": [
|
|
15
|
+
"const http = ctx.http.create({",
|
|
16
|
+
" baseURL: '${1:https://example.com}',",
|
|
17
|
+
" permissionKey: '${2:api}',",
|
|
18
|
+
" requestPermission: true,",
|
|
19
|
+
"})",
|
|
20
|
+
],
|
|
21
|
+
"description": "使用宿主 Axios 代理;无需将请求库打入插件",
|
|
22
|
+
},
|
|
23
|
+
"Permission group": {
|
|
24
|
+
"prefix": "ceru-permission-group",
|
|
11
25
|
"body": [
|
|
12
|
-
"ctx.
|
|
26
|
+
"const permission = await ctx.permissions.requestGroup({",
|
|
27
|
+
" group: '${1:libraryRead}',",
|
|
28
|
+
" intent: operation.userIntent,",
|
|
29
|
+
"})",
|
|
13
30
|
],
|
|
14
|
-
"description": "
|
|
31
|
+
"description": "一次申请一组用户可理解的能力",
|
|
32
|
+
},
|
|
33
|
+
"Grouped music provider": {
|
|
34
|
+
"prefix": "ceru-provider",
|
|
35
|
+
"body": [
|
|
36
|
+
"ctx.providers.register('${1:catalog}', {",
|
|
37
|
+
" tracks: { search: ${2:searchTracks}, resolve: ${3:resolveTrack}, lyrics: ${4:getLyrics} },",
|
|
38
|
+
" playlists: { search: ${5:searchPlaylists}, categories: ${6:getCategories}, list: ${7:listPlaylists}, get: ${8:getPlaylist} },",
|
|
39
|
+
" charts: { list: ${9:listCharts}, getTracks: ${10:getChartTracks} },",
|
|
40
|
+
"})",
|
|
41
|
+
],
|
|
42
|
+
"description": "注册分组 Provider,返回标准歌曲/歌单/歌词 JSON",
|
|
15
43
|
},
|
|
16
44
|
"Source rate limit": {
|
|
17
45
|
"prefix": "ceru-rate-limit",
|
|
@@ -20,8 +48,8 @@
|
|
|
20
48
|
" code: 'RATE_LIMITED',",
|
|
21
49
|
" message: '${1:请稍后重试}',",
|
|
22
50
|
" recovery: { mode: 'await-user', maxWaitMs: 60000 }",
|
|
23
|
-
"})"
|
|
51
|
+
"})",
|
|
24
52
|
],
|
|
25
|
-
"description": "返回结构化限流结果,由 Host 决定换源与交互"
|
|
26
|
-
}
|
|
53
|
+
"description": "返回结构化限流结果,由 Host 决定换源与交互",
|
|
54
|
+
},
|
|
27
55
|
}
|
|
@@ -1,46 +1,36 @@
|
|
|
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": [
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
"
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
],
|
|
38
|
-
"address": "127.0.0.1",
|
|
39
|
-
"urlFilter": "http://127.0.0.1:4179/*",
|
|
40
|
-
"targetTypes": [
|
|
41
|
-
"page",
|
|
42
|
-
"iframe"
|
|
43
|
-
]
|
|
44
|
-
}
|
|
45
|
-
]
|
|
46
|
-
}
|
|
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
|
+
"address": "127.0.0.1",
|
|
17
|
+
"urlFilter": "http://127.0.0.1:4179/",
|
|
18
|
+
"timeout": 30000
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"name": "Attach to Ceru plugin",
|
|
22
|
+
"type": "pwa-chrome",
|
|
23
|
+
"request": "attach",
|
|
24
|
+
"port": 9223,
|
|
25
|
+
"webRoot": "${workspaceFolder}",
|
|
26
|
+
"sourceMaps": true,
|
|
27
|
+
"sourceMapPathOverrides": {
|
|
28
|
+
"ceru:///*": "${workspaceFolder}/*"
|
|
29
|
+
},
|
|
30
|
+
"skipFiles": ["**/node_modules/**"],
|
|
31
|
+
"address": "127.0.0.1",
|
|
32
|
+
"urlFilter": "http://127.0.0.1:4179/",
|
|
33
|
+
"timeout": 30000
|
|
34
|
+
}
|
|
35
|
+
]
|
|
36
|
+
}
|
|
@@ -3,8 +3,7 @@
|
|
|
3
3
|
"tasks": [
|
|
4
4
|
{
|
|
5
5
|
"label": "Ceru: dev",
|
|
6
|
-
"type": "
|
|
7
|
-
"script": "dev",
|
|
6
|
+
"type": "process",
|
|
8
7
|
"isBackground": true,
|
|
9
8
|
"problemMatcher": {
|
|
10
9
|
"owner": "ceru",
|
|
@@ -15,8 +14,17 @@
|
|
|
15
14
|
"background": {
|
|
16
15
|
"activeOnStart": true,
|
|
17
16
|
"beginsPattern": "^.*$",
|
|
18
|
-
"endsPattern": "^
|
|
17
|
+
"endsPattern": "^CERU_DEBUG_READY "
|
|
19
18
|
}
|
|
19
|
+
},
|
|
20
|
+
"command": "node",
|
|
21
|
+
"args": [
|
|
22
|
+
"${workspaceFolder}/node_modules/@shiqianjiang/ceru-plugin-cli/dist/bin.js",
|
|
23
|
+
"dev",
|
|
24
|
+
"--ensure-running"
|
|
25
|
+
],
|
|
26
|
+
"options": {
|
|
27
|
+
"cwd": "${workspaceFolder}"
|
|
20
28
|
}
|
|
21
29
|
},
|
|
22
30
|
{
|
|
@@ -26,8 +26,13 @@ VS Code 按 F5 选择 Launch Ceru plugin;已有调试窗口时选择 Attach to
|
|
|
26
26
|
- 默认封面:await ctx.assets.url('placeholder.cover')。
|
|
27
27
|
- 共享工具:ctx.utils.lodash。
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
Vue/React 的生产运行代码、页面和样式直接编入发行 JS,宿主不提供框架。
|
|
30
|
+
TypeScript、Vue 编译器、构建工具与开发服务器不会进入产物。
|
|
31
|
+
运行 npm run preview 可只加载 dist/plugin.js 检查发布后的行为。
|
|
32
|
+
|
|
33
|
+
若 VS Code 打开的是父目录,请打开本工程的 ceru-plugin.code-workspace,
|
|
34
|
+
再在“运行和调试”中选择 Launch Ceru plugin;已经运行 npm/pnpm dev 时选择 Attach to Ceru plugin。
|
|
35
|
+
F5 执行当前下拉框中的配置,不会自动选择终端所在的子工程。
|
|
31
36
|
|
|
32
37
|
## 边界
|
|
33
38
|
|