@shiqianjiang/ceru-plugin-cli 0.3.16 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +26 -7
- package/assets/compatibility.json +18 -0
- package/dist/compatibility.d.ts +24 -0
- package/dist/compatibility.js +119 -0
- package/dist/component.d.ts +6 -0
- package/dist/component.js +60 -0
- package/dist/dev-music.d.ts +19 -0
- package/dist/dev-music.js +81 -0
- package/dist/dev-plugin-services.d.ts +10 -0
- package/dist/dev-plugin-services.js +67 -0
- package/dist/dev.d.ts +1 -9
- package/dist/dev.js +53 -713
- package/dist/frameworks.d.ts +5 -2
- package/dist/frameworks.js +43 -6
- package/dist/index.d.ts +1 -1
- package/dist/index.js +54 -23
- package/dist/init.js +3 -3
- package/dist/migrate.d.ts +3 -0
- package/dist/migrate.js +109 -0
- package/dist/project.d.ts +5 -2
- package/dist/project.js +131 -43
- package/dist/test-hooks.d.ts +1 -0
- package/dist/test-hooks.js +209 -0
- package/dist/test-services.d.ts +4 -0
- package/dist/test-services.js +54 -0
- package/dist/watch-vue-types.d.ts +17 -0
- package/dist/watch-vue-types.js +145 -0
- package/package.json +10 -6
- package/schemas/config.schema.json +954 -452
- package/templates/account-qrcode/js/.vscode/extensions.json +3 -0
- package/templates/account-qrcode/js/.vscode/launch.json +19 -0
- package/templates/account-qrcode/js/.vscode/settings.json +20 -0
- package/templates/account-qrcode/js/.vscode/tasks.json +43 -0
- package/templates/account-qrcode/js/README.md +15 -0
- package/templates/account-qrcode/js/_gitignore +6 -0
- package/templates/account-qrcode/js/ceru-plugin.code-workspace +8 -0
- package/templates/account-qrcode/js/ceru.plugin.json +62 -0
- package/templates/account-qrcode/js/package.json +24 -0
- package/templates/account-qrcode/js/src/Login.vue +25 -0
- package/templates/account-qrcode/js/src/index.js +25 -0
- package/templates/account-qrcode/js/src/login-html.js +23 -0
- package/templates/account-qrcode/js/tsconfig.json +17 -0
- package/templates/account-qrcode/ts/.vscode/extensions.json +3 -0
- package/templates/account-qrcode/ts/.vscode/launch.json +19 -0
- package/templates/account-qrcode/ts/.vscode/settings.json +20 -0
- package/templates/account-qrcode/ts/.vscode/tasks.json +43 -0
- package/templates/account-qrcode/ts/README.md +15 -0
- package/templates/account-qrcode/ts/_gitignore +6 -0
- package/templates/account-qrcode/ts/ceru-plugin.code-workspace +8 -0
- package/templates/account-qrcode/ts/ceru.plugin.json +62 -0
- package/templates/account-qrcode/ts/package.json +24 -0
- package/templates/account-qrcode/ts/src/Login.vue +25 -0
- package/templates/account-qrcode/ts/src/index.ts +25 -0
- package/templates/account-qrcode/ts/src/login-html.ts +23 -0
- package/templates/account-qrcode/ts/tsconfig.json +17 -0
- package/templates/connected-library/js/.vscode/launch.json +12 -29
- package/templates/connected-library/js/.vscode/tasks.json +2 -3
- package/templates/connected-library/js/README.md +26 -12
- package/templates/connected-library/js/ceru.plugin.json +122 -50
- package/templates/connected-library/js/package.json +5 -5
- package/templates/connected-library/js/src/index.js +46 -5
- package/templates/connected-library/js/src/settings.js +28 -0
- package/templates/connected-library/ts/.vscode/launch.json +12 -29
- package/templates/connected-library/ts/.vscode/tasks.json +2 -3
- package/templates/connected-library/ts/README.md +26 -12
- package/templates/connected-library/ts/ceru.plugin.json +122 -50
- package/templates/connected-library/ts/package.json +5 -5
- package/templates/connected-library/ts/src/index.ts +46 -5
- package/templates/connected-library/ts/src/settings.ts +28 -0
- package/templates/encrypted-source/README.md +86 -0
- package/templates/encrypted-source/js/.prettierrc.json +5 -0
- package/templates/encrypted-source/js/.vscode/ceru.code-snippets +55 -0
- package/templates/encrypted-source/js/.vscode/extensions.json +3 -0
- package/templates/encrypted-source/js/.vscode/launch.json +15 -0
- package/templates/encrypted-source/js/.vscode/settings.json +20 -0
- package/templates/encrypted-source/js/.vscode/tasks.json +40 -0
- package/templates/encrypted-source/js/DEMO.md +77 -0
- package/templates/encrypted-source/js/README.md +13 -0
- package/templates/encrypted-source/js/_gitignore +6 -0
- package/templates/encrypted-source/js/ceru-plugin.code-workspace +8 -0
- package/templates/encrypted-source/js/ceru.plugin.json +95 -0
- package/templates/encrypted-source/js/package.json +26 -0
- package/templates/encrypted-source/js/resources/xor-byte.wasm +0 -0
- package/templates/encrypted-source/js/resources/xor-byte.wat +5 -0
- package/templates/encrypted-source/js/src/demo.js +200 -0
- package/templates/encrypted-source/js/src/fixtures.js +118 -0
- package/templates/encrypted-source/js/src/index.js +4 -0
- package/templates/encrypted-source/js/tests/demo.test.mjs +357 -0
- package/templates/encrypted-source/js/tsconfig.json +16 -0
- package/templates/encrypted-source/ts/.prettierrc.json +5 -0
- package/templates/encrypted-source/ts/.vscode/ceru.code-snippets +55 -0
- package/templates/encrypted-source/ts/.vscode/extensions.json +3 -0
- package/templates/encrypted-source/ts/.vscode/launch.json +15 -0
- package/templates/encrypted-source/ts/.vscode/settings.json +20 -0
- package/templates/encrypted-source/ts/.vscode/tasks.json +40 -0
- package/templates/encrypted-source/ts/DEMO.md +77 -0
- package/templates/encrypted-source/ts/README.md +13 -0
- package/templates/encrypted-source/ts/_gitignore +6 -0
- package/templates/encrypted-source/ts/ceru-plugin.code-workspace +8 -0
- package/templates/encrypted-source/ts/ceru.plugin.json +95 -0
- package/templates/encrypted-source/ts/package.json +26 -0
- package/templates/encrypted-source/ts/resources/xor-byte.wasm +0 -0
- package/templates/encrypted-source/ts/resources/xor-byte.wat +5 -0
- package/templates/encrypted-source/ts/src/demo.ts +212 -0
- package/templates/encrypted-source/ts/src/fixtures.ts +125 -0
- package/templates/encrypted-source/ts/src/index.ts +4 -0
- package/templates/encrypted-source/ts/tests/demo.test.mjs +357 -0
- package/templates/encrypted-source/ts/tsconfig.json +17 -0
- package/templates/guest-adapter/js/.vscode/launch.json +12 -29
- package/templates/guest-adapter/js/.vscode/tasks.json +2 -3
- package/templates/guest-adapter/js/README.md +10 -10
- package/templates/guest-adapter/js/ceru.plugin.json +67 -62
- package/templates/guest-adapter/js/package.json +5 -5
- package/templates/guest-adapter/js/src/index.js +1 -1
- package/templates/guest-adapter/js/src/settings.js +8 -0
- package/templates/guest-adapter/ts/.vscode/launch.json +12 -29
- package/templates/guest-adapter/ts/.vscode/tasks.json +2 -3
- package/templates/guest-adapter/ts/README.md +10 -10
- package/templates/guest-adapter/ts/ceru.plugin.json +67 -62
- package/templates/guest-adapter/ts/package.json +5 -5
- package/templates/guest-adapter/ts/src/index.ts +1 -1
- package/templates/guest-adapter/ts/src/settings.ts +8 -0
- package/templates/importer/js/.vscode/launch.json +12 -29
- package/templates/importer/js/.vscode/tasks.json +2 -3
- package/templates/importer/js/README.md +10 -10
- package/templates/importer/js/ceru.plugin.json +23 -21
- package/templates/importer/js/package.json +5 -5
- package/templates/importer/ts/.vscode/launch.json +12 -29
- package/templates/importer/ts/.vscode/tasks.json +2 -3
- package/templates/importer/ts/README.md +10 -10
- package/templates/importer/ts/ceru.plugin.json +23 -21
- package/templates/importer/ts/package.json +5 -5
- package/templates/page-extension/js/.vscode/extensions.json +3 -0
- package/templates/page-extension/js/.vscode/launch.json +19 -0
- package/templates/page-extension/js/.vscode/settings.json +20 -0
- package/templates/page-extension/js/.vscode/tasks.json +43 -0
- package/templates/page-extension/js/README.md +9 -0
- package/templates/page-extension/js/_gitignore +6 -0
- package/templates/page-extension/js/ceru-plugin.code-workspace +8 -0
- package/templates/page-extension/js/ceru.plugin.json +94 -0
- package/templates/page-extension/js/package.json +24 -0
- package/templates/page-extension/js/src/Open.vue +6 -0
- package/templates/page-extension/js/src/Search.vue +62 -0
- package/templates/page-extension/js/src/index.js +54 -0
- package/templates/page-extension/js/tsconfig.json +17 -0
- package/templates/page-extension/ts/.vscode/extensions.json +3 -0
- package/templates/page-extension/ts/.vscode/launch.json +19 -0
- package/templates/page-extension/ts/.vscode/settings.json +20 -0
- package/templates/page-extension/ts/.vscode/tasks.json +43 -0
- package/templates/page-extension/ts/README.md +9 -0
- package/templates/page-extension/ts/_gitignore +6 -0
- package/templates/page-extension/ts/ceru-plugin.code-workspace +8 -0
- package/templates/page-extension/ts/ceru.plugin.json +94 -0
- package/templates/page-extension/ts/package.json +24 -0
- package/templates/page-extension/ts/src/Open.vue +6 -0
- package/templates/page-extension/ts/src/Search.vue +62 -0
- package/templates/page-extension/ts/src/index.ts +54 -0
- package/templates/page-extension/ts/tsconfig.json +17 -0
- package/templates/playback-hook/js/.prettierrc.json +5 -0
- package/templates/playback-hook/js/.vscode/extensions.json +3 -0
- package/templates/playback-hook/js/.vscode/launch.json +19 -0
- package/templates/playback-hook/js/.vscode/settings.json +20 -0
- package/templates/playback-hook/js/.vscode/tasks.json +50 -0
- package/templates/playback-hook/js/README.md +24 -0
- package/templates/playback-hook/js/_gitignore +6 -0
- package/templates/playback-hook/js/ceru-plugin.code-workspace +8 -0
- package/templates/playback-hook/js/ceru.plugin.json +36 -0
- package/templates/playback-hook/js/package.json +23 -0
- package/templates/playback-hook/js/src/index.js +25 -0
- package/templates/playback-hook/js/tests/hooks.json +316 -0
- package/templates/playback-hook/js/tsconfig.json +16 -0
- package/templates/playback-hook/ts/.prettierrc.json +5 -0
- package/templates/playback-hook/ts/.vscode/extensions.json +3 -0
- package/templates/playback-hook/ts/.vscode/launch.json +19 -0
- package/templates/playback-hook/ts/.vscode/settings.json +20 -0
- package/templates/playback-hook/ts/.vscode/tasks.json +50 -0
- package/templates/playback-hook/ts/README.md +24 -0
- package/templates/playback-hook/ts/_gitignore +6 -0
- package/templates/playback-hook/ts/ceru-plugin.code-workspace +8 -0
- package/templates/playback-hook/ts/ceru.plugin.json +36 -0
- package/templates/playback-hook/ts/package.json +23 -0
- package/templates/playback-hook/ts/src/index.ts +25 -0
- package/templates/playback-hook/ts/tests/hooks.json +316 -0
- package/templates/playback-hook/ts/tsconfig.json +16 -0
- package/templates/player-skin/js/.vscode/extensions.json +3 -0
- package/templates/player-skin/js/.vscode/launch.json +19 -0
- package/templates/player-skin/js/.vscode/settings.json +20 -0
- package/templates/player-skin/js/.vscode/tasks.json +43 -0
- package/templates/player-skin/js/README.md +11 -0
- package/templates/player-skin/js/_gitignore +6 -0
- package/templates/player-skin/js/assets/studio-preview.svg +15 -0
- package/templates/player-skin/js/ceru-plugin.code-workspace +8 -0
- package/templates/player-skin/js/ceru.plugin.json +77 -0
- package/templates/player-skin/js/package.json +24 -0
- package/templates/player-skin/js/src/Artwork.vue +9 -0
- package/templates/player-skin/js/src/Background.vue +15 -0
- package/templates/player-skin/js/src/BuiltinLyrics.vue +15 -0
- package/templates/player-skin/js/src/Lyrics.vue +28 -0
- package/templates/player-skin/js/tsconfig.json +17 -0
- package/templates/player-skin/ts/.vscode/extensions.json +3 -0
- package/templates/player-skin/ts/.vscode/launch.json +19 -0
- package/templates/player-skin/ts/.vscode/settings.json +20 -0
- package/templates/player-skin/ts/.vscode/tasks.json +43 -0
- package/templates/player-skin/ts/README.md +11 -0
- package/templates/player-skin/ts/_gitignore +6 -0
- package/templates/player-skin/ts/assets/studio-preview.svg +15 -0
- package/templates/player-skin/ts/ceru-plugin.code-workspace +8 -0
- package/templates/player-skin/ts/ceru.plugin.json +77 -0
- package/templates/player-skin/ts/package.json +24 -0
- package/templates/player-skin/ts/src/Artwork.vue +9 -0
- package/templates/player-skin/ts/src/Background.vue +15 -0
- package/templates/player-skin/ts/src/BuiltinLyrics.vue +15 -0
- package/templates/player-skin/ts/src/Lyrics.vue +28 -0
- package/templates/player-skin/ts/tsconfig.json +17 -0
- package/templates/react/js/.vscode/launch.json +12 -29
- package/templates/react/js/.vscode/tasks.json +2 -3
- package/templates/react/js/README.md +10 -10
- package/templates/react/js/ceru.plugin.json +27 -22
- package/templates/react/js/package.json +5 -5
- package/templates/react/js/src/index.js +1 -1
- package/templates/react/ts/.vscode/launch.json +12 -29
- package/templates/react/ts/.vscode/tasks.json +2 -3
- package/templates/react/ts/README.md +10 -10
- package/templates/react/ts/ceru.plugin.json +27 -22
- package/templates/react/ts/package.json +5 -5
- package/templates/react/ts/src/index.ts +1 -1
- package/templates/snapshot.json +152 -6
- package/templates/source/js/.vscode/launch.json +12 -29
- package/templates/source/js/.vscode/tasks.json +2 -3
- package/templates/source/js/README.md +12 -10
- package/templates/source/js/ceru.plugin.json +44 -26
- package/templates/source/js/package.json +5 -5
- package/templates/source/js/src/index.js +10 -8
- package/templates/source/ts/.vscode/launch.json +12 -29
- package/templates/source/ts/.vscode/tasks.json +2 -3
- package/templates/source/ts/README.md +12 -10
- package/templates/source/ts/ceru.plugin.json +44 -26
- package/templates/source/ts/package.json +5 -5
- package/templates/source/ts/src/index.ts +10 -8
- package/templates/vue/js/.vscode/launch.json +12 -29
- package/templates/vue/js/.vscode/tasks.json +2 -3
- package/templates/vue/js/README.md +10 -10
- package/templates/vue/js/ceru.plugin.json +27 -22
- package/templates/vue/js/package.json +5 -5
- package/templates/vue/js/src/index.js +1 -1
- package/templates/vue/ts/.vscode/launch.json +12 -29
- package/templates/vue/ts/.vscode/tasks.json +2 -3
- package/templates/vue/ts/README.md +10 -10
- package/templates/vue/ts/ceru.plugin.json +27 -22
- package/templates/vue/ts/package.json +5 -5
- package/templates/vue/ts/src/index.ts +1 -1
- package/templates/vue-tsx/js/.vscode/launch.json +12 -29
- package/templates/vue-tsx/js/.vscode/tasks.json +2 -3
- package/templates/vue-tsx/js/README.md +10 -10
- package/templates/vue-tsx/js/ceru.plugin.json +27 -22
- package/templates/vue-tsx/js/package.json +5 -5
- package/templates/vue-tsx/js/src/index.js +1 -1
- package/templates/vue-tsx/ts/.vscode/launch.json +12 -29
- package/templates/vue-tsx/ts/.vscode/tasks.json +2 -3
- package/templates/vue-tsx/ts/README.md +10 -10
- package/templates/vue-tsx/ts/ceru.plugin.json +27 -22
- package/templates/vue-tsx/ts/package.json +5 -5
- package/templates/vue-tsx/ts/src/index.ts +1 -1
- package/templates/web-dist/js/.vscode/launch.json +12 -29
- package/templates/web-dist/js/.vscode/tasks.json +2 -3
- package/templates/web-dist/js/README.md +10 -10
- package/templates/web-dist/js/ceru.plugin.json +27 -22
- package/templates/web-dist/js/package.json +5 -5
- package/templates/web-dist/js/src/index.js +1 -1
- package/templates/web-dist/ts/.vscode/launch.json +12 -29
- package/templates/web-dist/ts/.vscode/tasks.json +2 -3
- package/templates/web-dist/ts/README.md +10 -10
- package/templates/web-dist/ts/ceru.plugin.json +27 -22
- package/templates/web-dist/ts/package.json +5 -5
- package/templates/web-dist/ts/src/index.ts +1 -1
- package/templates/web-surface/js/.vscode/launch.json +12 -29
- package/templates/web-surface/js/.vscode/tasks.json +2 -3
- package/templates/web-surface/js/README.md +10 -10
- package/templates/web-surface/js/ceru.plugin.json +35 -35
- package/templates/web-surface/js/package.json +5 -5
- package/templates/web-surface/js/src/index.js +1 -1
- package/templates/web-surface/ts/.vscode/launch.json +12 -29
- package/templates/web-surface/ts/.vscode/tasks.json +2 -3
- package/templates/web-surface/ts/README.md +10 -10
- package/templates/web-surface/ts/ceru.plugin.json +35 -35
- package/templates/web-surface/ts/package.json +5 -5
- package/templates/web-surface/ts/src/index.ts +1 -1
- package/assets/core-contracts.js +0 -1
- package/assets/electron-app/main.cjs +0 -1
- package/assets/electron-app/package.json +0 -8
- package/assets/electron.cjs +0 -42
- package/assets/index.html +0 -94
- package/assets/native-view.js +0 -197
- package/assets/playground.js +0 -883
- package/assets/sandbox.js +0 -67
- package/assets/style.css +0 -337
- package/dist/socket-broker.d.ts +0 -23
- package/dist/socket-broker.js +0 -229
- package/templates/connected-library/js/ui/settings.json +0 -24
- package/templates/connected-library/ts/ui/settings.json +0 -24
- package/templates/guest-adapter/js/ui/settings.json +0 -14
- package/templates/guest-adapter/ts/ui/settings.json +0 -14
|
@@ -9,6 +9,6 @@ export default definePlugin(async (ctx) => {
|
|
|
9
9
|
await ctx.ui.setState('page', { status: '页面已关闭' })
|
|
10
10
|
})
|
|
11
11
|
ctx.actions.register('hello', async () => {
|
|
12
|
-
await ctx.ui.notify({ key: 'hello', level: 'info', message: 'Hello Ceru
|
|
12
|
+
await ctx.ui.notify({ key: 'hello', level: 'info', message: 'Hello Ceru v3!' })
|
|
13
13
|
})
|
|
14
14
|
})
|
|
@@ -2,35 +2,18 @@
|
|
|
2
2
|
"version": "0.2.0",
|
|
3
3
|
"configurations": [
|
|
4
4
|
{
|
|
5
|
-
"name": "
|
|
6
|
-
"type": "
|
|
7
|
-
"request": "
|
|
8
|
-
"
|
|
9
|
-
"
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
"
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
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
|
|
5
|
+
"name": "Watch Ceru plugin",
|
|
6
|
+
"type": "node",
|
|
7
|
+
"request": "launch",
|
|
8
|
+
"program": "${workspaceFolder}/node_modules/@shiqianjiang/ceru-plugin-cli/dist/bin.js",
|
|
9
|
+
"args": [
|
|
10
|
+
"dev"
|
|
11
|
+
],
|
|
12
|
+
"cwd": "${workspaceFolder}",
|
|
13
|
+
"console": "integratedTerminal",
|
|
14
|
+
"skipFiles": [
|
|
15
|
+
"<node_internals>/**"
|
|
16
|
+
]
|
|
34
17
|
}
|
|
35
18
|
]
|
|
36
19
|
}
|
|
@@ -14,14 +14,13 @@
|
|
|
14
14
|
"background": {
|
|
15
15
|
"activeOnStart": true,
|
|
16
16
|
"beginsPattern": "^.*$",
|
|
17
|
-
"endsPattern": "^
|
|
17
|
+
"endsPattern": "^CERU_BUILD_READY "
|
|
18
18
|
}
|
|
19
19
|
},
|
|
20
20
|
"command": "node",
|
|
21
21
|
"args": [
|
|
22
22
|
"${workspaceFolder}/node_modules/@shiqianjiang/ceru-plugin-cli/dist/bin.js",
|
|
23
|
-
"dev"
|
|
24
|
-
"--ensure-running"
|
|
23
|
+
"dev"
|
|
25
24
|
],
|
|
26
25
|
"options": {
|
|
27
26
|
"cwd": "${workspaceFolder}"
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
# web-surface / ts
|
|
2
2
|
|
|
3
|
-
Ceru Music
|
|
3
|
+
Ceru Music v3 插件开发模板。此目录是源码,不是安装包。
|
|
4
4
|
|
|
5
5
|
## 运行 demo
|
|
6
6
|
|
|
7
|
-
1.
|
|
7
|
+
1. 使用匹配的 v3 脚手架创建工程(本地开发套件可使用其 `npm run create` 命令):
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
ceru-plugin init my-plugin --template web-surface --lang ts
|
|
10
10
|
|
|
11
11
|
2. 进入目录,运行 npm install。
|
|
12
|
-
3. 运行 npm run dev
|
|
12
|
+
3. 运行 npm run dev,在澜音「设置 → 插件管理 → 管理设置 → 插件开发者模式」添加终端打印的 JS 文件。
|
|
13
13
|
4. 修改 src 中的代码;保存后自动类型检查并重载。
|
|
14
14
|
5. 运行 npm run build,只分发 dist/plugin.js。
|
|
15
15
|
|
|
16
16
|
## 编辑器
|
|
17
17
|
|
|
18
|
-
VS Code 按 F5 选择
|
|
19
|
-
|
|
18
|
+
VS Code 按 F5 选择 Watch Ceru plugin,会启动本地构建监听,不会另开 Electron。
|
|
19
|
+
已在终端运行 npm run dev 时不必再按 F5。
|
|
20
20
|
配置文件有 JSON Schema 提示,SDK 提供参数类型、图标名称与 Lodash 方法补全。
|
|
21
21
|
|
|
22
22
|
## 宿主资源
|
|
@@ -26,16 +26,16 @@ VS Code 按 F5 选择 Launch Ceru plugin;已有调试窗口时选择 Attach to
|
|
|
26
26
|
- 默认封面:await ctx.assets.url('placeholder.cover')。
|
|
27
27
|
- 共享工具:ctx.utils.lodash。
|
|
28
28
|
|
|
29
|
-
Vue
|
|
29
|
+
视图是否自带框架由清单的 `entry.views[].kind` 决定:`web` 页面打包自己用到的框架;`native` 由宿主绘制;`component` 复用宿主提供的 Vue、TDesign 和音乐组件。开发宿主风格的页面可选 `page-extension` 模板,播放器区域可选 `player-skin`,不需要复制桌面组件源码。
|
|
30
30
|
TypeScript、Vue 编译器、构建工具与开发服务器不会进入产物。
|
|
31
|
-
运行 npm run
|
|
31
|
+
运行 `npm run typecheck` 只检查工程,不生成发行文件。可选 `npm run preview` 验证构建产物并打印路径;将该文件加入桌面的插件开发者模式即可预览,不会启动服务器。
|
|
32
32
|
|
|
33
33
|
若 VS Code 打开的是父目录,请打开本工程的 ceru-plugin.code-workspace,
|
|
34
|
-
再在“运行和调试”中选择
|
|
34
|
+
再在“运行和调试”中选择 Watch Ceru plugin。
|
|
35
35
|
F5 执行当前下拉框中的配置,不会自动选择终端所在的子工程。
|
|
36
36
|
|
|
37
37
|
## 边界
|
|
38
38
|
|
|
39
|
-
本模板面向
|
|
39
|
+
本模板面向 v3 协议。需要支持 v3 的宿主。
|
|
40
40
|
凭据保险箱、完整音乐业务和 Guest 安装需要正式 Host;不支持的调试调用会明确报错。
|
|
41
41
|
不要把私人 API Key、卡密或发行私钥提交到仓库。
|
|
@@ -1,27 +1,29 @@
|
|
|
1
1
|
{
|
|
2
2
|
"manifest": {
|
|
3
|
-
"manifestVersion":
|
|
3
|
+
"manifestVersion": 3,
|
|
4
4
|
"id": "local.ts",
|
|
5
5
|
"name": "ts",
|
|
6
6
|
"version": "0.1.0",
|
|
7
|
-
"description": "A Ceru Music
|
|
7
|
+
"description": "A Ceru Music v3 web-surface plugin",
|
|
8
|
+
"dataSchemas": {
|
|
9
|
+
"config": 1,
|
|
10
|
+
"state": 1
|
|
11
|
+
},
|
|
8
12
|
"engines": {
|
|
9
|
-
"hostApi": "^
|
|
10
|
-
"logicRuntime": "ceru-js@1"
|
|
11
|
-
"uiSchema": "^1.0.0"
|
|
13
|
+
"hostApi": "^3.0.0",
|
|
14
|
+
"logicRuntime": "ceru-js@1"
|
|
12
15
|
},
|
|
13
|
-
"
|
|
16
|
+
"entry": {
|
|
14
17
|
"logic": {
|
|
15
|
-
"entry": "logic.main",
|
|
16
18
|
"activation": [
|
|
17
19
|
"onCommand:hello"
|
|
18
|
-
]
|
|
20
|
+
],
|
|
21
|
+
"module": "logic.main"
|
|
19
22
|
},
|
|
20
|
-
"
|
|
23
|
+
"views": [
|
|
21
24
|
{
|
|
22
25
|
"id": "page",
|
|
23
26
|
"kind": "web",
|
|
24
|
-
"entry": "view.main",
|
|
25
27
|
"title": "插件页面",
|
|
26
28
|
"presentation": {
|
|
27
29
|
"kind": "drawer",
|
|
@@ -31,37 +33,47 @@
|
|
|
31
33
|
"lifecycle": {
|
|
32
34
|
"openAction": "page.open",
|
|
33
35
|
"closeAction": "page.close"
|
|
34
|
-
}
|
|
36
|
+
},
|
|
37
|
+
"module": "view.main"
|
|
35
38
|
}
|
|
36
39
|
]
|
|
37
40
|
},
|
|
38
|
-
"
|
|
39
|
-
"
|
|
41
|
+
"provides": {
|
|
42
|
+
"actions": [
|
|
40
43
|
{
|
|
41
44
|
"id": "hello",
|
|
42
|
-
"title": "Hello"
|
|
43
|
-
"action": "hello"
|
|
45
|
+
"title": "Hello"
|
|
44
46
|
},
|
|
45
47
|
{
|
|
46
48
|
"id": "page.open",
|
|
47
|
-
"title": "打开页面"
|
|
48
|
-
"action": "page.open"
|
|
49
|
+
"title": "打开页面"
|
|
49
50
|
},
|
|
50
51
|
{
|
|
51
52
|
"id": "page.close",
|
|
52
|
-
"title": "关闭页面"
|
|
53
|
-
"action": "page.close"
|
|
53
|
+
"title": "关闭页面"
|
|
54
54
|
}
|
|
55
|
-
]
|
|
56
|
-
|
|
55
|
+
]
|
|
56
|
+
},
|
|
57
|
+
"uses": {
|
|
58
|
+
"permissions": []
|
|
59
|
+
},
|
|
60
|
+
"ui": {
|
|
61
|
+
"pages": [
|
|
57
62
|
{
|
|
58
63
|
"id": "page",
|
|
59
64
|
"group": "library",
|
|
60
65
|
"title": "ts",
|
|
61
|
-
"view": "page"
|
|
66
|
+
"view": "page",
|
|
67
|
+
"mount": "sidebar"
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
"id": "settings",
|
|
71
|
+
"title": "插件设置",
|
|
72
|
+
"view": "page",
|
|
73
|
+
"mount": "settings"
|
|
62
74
|
}
|
|
63
75
|
],
|
|
64
|
-
"
|
|
76
|
+
"slots": [
|
|
65
77
|
{
|
|
66
78
|
"id": "search-note",
|
|
67
79
|
"slot": "search.source-selector.after",
|
|
@@ -69,19 +81,7 @@
|
|
|
69
81
|
"view": "page",
|
|
70
82
|
"order": 10
|
|
71
83
|
}
|
|
72
|
-
],
|
|
73
|
-
"settingsPages": [
|
|
74
|
-
{
|
|
75
|
-
"id": "settings",
|
|
76
|
-
"title": "插件设置",
|
|
77
|
-
"view": "page"
|
|
78
|
-
}
|
|
79
84
|
]
|
|
80
|
-
},
|
|
81
|
-
"permissions": [],
|
|
82
|
-
"dataSchemas": {
|
|
83
|
-
"config": 1,
|
|
84
|
-
"state": 1
|
|
85
85
|
}
|
|
86
86
|
},
|
|
87
87
|
"entries": {
|
|
@@ -6,17 +6,17 @@
|
|
|
6
6
|
"scripts": {
|
|
7
7
|
"dev": "ceru-plugin dev",
|
|
8
8
|
"build": "ceru-plugin build",
|
|
9
|
-
"typecheck": "
|
|
9
|
+
"typecheck": "ceru-plugin typecheck",
|
|
10
10
|
"validate": "ceru-plugin validate dist/plugin.js",
|
|
11
|
-
"preview": "ceru-plugin preview dist/plugin.js"
|
|
11
|
+
"preview": "ceru-plugin preview dist/plugin.js",
|
|
12
|
+
"check:compat": "ceru-plugin check-compat"
|
|
12
13
|
},
|
|
13
14
|
"dependencies": {
|
|
14
|
-
"@shiqianjiang/ceru-plugin-sdk": "^0.
|
|
15
|
+
"@shiqianjiang/ceru-plugin-sdk": "^3.0.0"
|
|
15
16
|
},
|
|
16
17
|
"devDependencies": {
|
|
17
|
-
"@shiqianjiang/ceru-plugin-cli": "^0.
|
|
18
|
+
"@shiqianjiang/ceru-plugin-cli": "^3.0.0",
|
|
18
19
|
"typescript": "~5.9.3",
|
|
19
|
-
"electron": "^44.4.2",
|
|
20
20
|
"prettier": "^3.6.2"
|
|
21
21
|
}
|
|
22
22
|
}
|
|
@@ -9,6 +9,6 @@ export default definePlugin(async (ctx) => {
|
|
|
9
9
|
await ctx.ui.setState('page', { status: '页面已关闭' })
|
|
10
10
|
})
|
|
11
11
|
ctx.actions.register('hello', async () => {
|
|
12
|
-
await ctx.ui.notify({ key: 'hello', level: 'info', message: 'Hello Ceru
|
|
12
|
+
await ctx.ui.notify({ key: 'hello', level: 'info', message: 'Hello Ceru v3!' })
|
|
13
13
|
})
|
|
14
14
|
})
|
package/assets/core-contracts.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var d=e=>!!e&&typeof e=="object"&&!Array.isArray(e),a=(e,r=4096)=>typeof e=="string"&&e.length<=r,u=e=>Number.isFinite(e)&&Number(e)>=0;function h(e,r){if(!Array.isArray(e)||e.length>1e4)throw new Error("Invalid lyric words");let t=r;for(let n of e){if(!d(n)||!u(n.startTimeMs)||!u(n.endTimeMs)||n.endTimeMs<n.startTimeMs||n.startTimeMs<t||!a(n.text,65536)||n.translation!==void 0&&!a(n.translation,65536)||n.romanization!==void 0&&!a(n.romanization,65536))throw new Error("Invalid lyric word");t=n.startTimeMs}}function g(e){if(!Array.isArray(e)||e.length>16)throw new Error("Invalid lyric alternatives");for(let r of e){if(!d(r)||!a(r.text,65536)||r.language!==void 0&&!a(r.language,128))throw new Error("Invalid lyric alternative");r.words!==void 0&&h(r.words,0)}}function m(e){if(!d(e)||!["providerId","kind","id"].every(r=>a(e[r],2048)&&e[r].length>0)||e.pluginId!==void 0&&(!a(e.pluginId,2048)||!e.pluginId))throw new Error("Invalid resource reference");if(e.connectionId!==void 0&&(!a(e.connectionId,2048)||!e.connectionId))throw new Error("Invalid resource connection");if(e.scope!==void 0&&(e.scope!=="provider"||e.kind!=="track"||e.connectionId!==void 0))throw new Error("Provider scope requires a public track without a connection");if(e.pluginId===void 0&&e.scope!=="provider")throw new Error("Private resources require an owning plugin");if(e.data!==void 0){if(!d(e.data))throw new Error("Invalid resource private data");let r;try{r=JSON.stringify(e.data)}catch{throw new Error("Resource private data must be JSON")}if(new TextEncoder().encode(r).byteLength>64*1024)throw new Error("Resource private data exceeds 64 KiB")}}function R(e,r){if(m(e),e.kind!=="track")throw new Error("Expected a track reference");if(!a(r,2048)||!r)throw new Error("Invalid target plugin");if(e.pluginId===r)return e;if(e.scope!=="provider")throw new Error("Private tracks must stay with their owner");return{pluginId:r,providerId:e.providerId,kind:"track",id:e.id,scope:"provider"}}function b(e){if(!d(e)||!Array.isArray(e.items)||e.items.length>1e4)throw new Error("Invalid content page");if(e.nextCursor!=null&&(!a(e.nextCursor,2048)||!e.nextCursor.length))throw new Error("Invalid pagination cursor");for(let r of e.items){if(!d(r)||!a(r.title)||!Array.isArray(r.capabilities)||!r.capabilities.every(t=>a(t,128)))throw new Error("Invalid content item");if(m(r.ref),r.ref.kind==="track"){if(!d(r.metadata)||!Array.isArray(r.metadata.artists)||!r.metadata.artists.every(s=>a(s)))throw new Error("Track metadata must contain artists");if(r.metadata.durationMs!==void 0&&!u(r.metadata.durationMs))throw new Error("Invalid track duration");let{qualities:t,qualitySizes:n,qualitySizeLabels:o,hash:l}=r.metadata;if(l!==void 0&&!a(l,4096))throw new Error("Invalid track hash");if(o!==void 0&&(!d(o)||Object.keys(o).length>128||Object.entries(o).some(([s,i])=>!t?.includes(s)||!a(i,128))))throw new Error("Invalid track quality size labels");if(t!==void 0&&(!Array.isArray(t)||t.length>128||!t.every(s=>a(s,128)&&!!s)))throw new Error("Invalid track qualities");if(n!==void 0&&(!d(n)||Object.keys(n).length>128||Object.entries(n).some(([s,i])=>!t?.includes(s)||!Number.isSafeInteger(i)||Number(i)<=0)))throw new Error("Invalid track quality sizes")}if(r.ref.kind==="playlist"&&r.playlist!==void 0){if(!d(r.playlist))throw new Error("Invalid playlist metadata");if(r.playlist.trackCount!==void 0&&(!Number.isInteger(r.playlist.trackCount)||r.playlist.trackCount<0))throw new Error("Invalid playlist track count")}if(r.ref.kind==="chart"&&r.chart!==void 0&&!d(r.chart))throw new Error("Invalid chart metadata")}}function M(e){if(!d(e)||typeof e.ok!="boolean")throw new Error("Invalid resolve result");if(e.ok){if(!a(e.url,8192))throw new Error("Invalid playback URL");let r=new URL(e.url);if(!["http:","https:"].includes(r.protocol))throw new Error("Invalid playback protocol");if(e.expiresAt!==void 0&&!u(e.expiresAt))throw new Error("Invalid playback expiry");if(e.requestHeaders!==void 0){if(!d(e.requestHeaders)||Object.keys(e.requestHeaders).length>32)throw new Error("Invalid playback request headers");for(let[t,n]of Object.entries(e.requestHeaders))if(!/^[!#$%&'*+.^_`|~0-9A-Za-z-]{1,128}$/.test(t)||/^(host|connection|content-length|transfer-encoding|proxy-.*|upgrade)$/i.test(t)||typeof n!="string"||n.length>8192||/[\r\n]/.test(n))throw new Error("Invalid playback request header")}return}if(!d(e.error)||!a(e.error.code,128)||!a(e.error.message,65536))throw new Error("Invalid music fault")}function N(e){return d(e)&&e.format===void 0&&e.version===1&&Array.isArray(e.lines)?{...e,format:"crlyric"}:e}function T(e){if(!d(e)||e.format!=="crlyric"||e.version!==1||!Number.isFinite(e.offsetMs)||!Array.isArray(e.lines)||e.lines.length>2e4)throw new Error("Invalid lyrics document");if(m(e.track),e.track.kind!=="track")throw new Error("Lyrics must reference a track");let r=-1;for(let t of e.lines){if(!d(t)||!u(t.startTimeMs)||t.startTimeMs<r||!a(t.text,65536))throw new Error("Invalid lyric line");if(r=t.startTimeMs,t.endTimeMs!==void 0&&(!u(t.endTimeMs)||t.endTimeMs<t.startTimeMs))throw new Error("Invalid lyric line end");for(let n of["translation","romanization"])if(t[n]!==void 0&&!a(t[n],65536))throw new Error("Invalid lyric translation");t.translations!==void 0&&g(t.translations),t.romanizations!==void 0&&g(t.romanizations),t.words!==void 0&&h(t.words,t.startTimeMs)}if(e.plainText!==void 0&&!a(e.plainText,1048576))throw new Error("Invalid plain lyrics")}function q(e){return async(r,t)=>{let n=await e(r,t);return A(n),n}}function k(e,r=new Set){if(!(e===null||typeof e=="string"||typeof e=="boolean")&&!(typeof e=="number"&&Number.isFinite(e))){if(!e||typeof e!="object"||r.has(e))throw new Error("Native view must contain JSON data only");if(!Array.isArray(e)&&Object.getPrototypeOf(e)!==Object.prototype&&Object.getPrototypeOf(e)!==null)throw new Error("Native view must contain JSON data only");r.add(e);for(let t of Object.values(e))t!==void 0&&k(t,r);r.delete(e)}}function A(e,r){k(e);let t=e,n=(i,c=500)=>typeof i=="string"&&i.length<=c,o=i=>n(i,128)&&!!i&&(!r||r.has(i));if(!t||t.type!=="page"||!Array.isArray(t.sections)||t.sections.length>24||t.title!==void 0&&!n(t.title)||t.description!==void 0&&!n(t.description,4e3))throw new Error("Invalid native view");let l=i=>{if(i!==void 0&&(!Array.isArray(i)||i.length>16))throw new Error("Invalid native actions");for(let c of i??[])if(!c||!n(c.label,100)||!c.label||!o(c.action)||c.primary!==void 0&&typeof c.primary!="boolean"||JSON.stringify(c.input??{}).length>16384)throw new Error("Invalid native action")};l(t.actions);let s=new Set;for(let i of t.sections){if(!i||!n(i.id,128)||!i.id||s.has(i.id)||!["grid","list"].includes(i.layout)||i.title!==void 0&&!n(i.title)||i.onOpen!==void 0&&!o(i.onOpen)||i.onPlay!==void 0&&!o(i.onPlay))throw new Error("Invalid native section");s.add(i.id),l(i.itemActions),b({items:i.items})}}function L(e){let r=e;if(!r||typeof r!="object"||Array.isArray(r)||typeof r.signedIn!="boolean"||typeof r.displayName!="string"||!r.displayName.length||r.displayName.length>200||r.badge!==void 0&&(typeof r.badge!="string"||r.badge.length>80))throw new Error("Invalid account summary");if(r.avatarUrl!==void 0&&(typeof r.avatarUrl!="string"||r.avatarUrl.length>8192||!/^https?:\/\//i.test(r.avatarUrl)))throw new Error("Invalid account avatar URL")}function U(e,r){let t=e;if(!t||typeof t!="object"||Array.isArray(t)||!["search","playlist","charts","downloads","account","settings"].includes(t.page)||t.query!==void 0&&(typeof t.query!="string"||t.query.length>8192))throw new Error("Invalid Host navigation request");if(t.ref!==void 0&&m(t.ref),t.sectionId!==void 0){if(t.page!=="playlist"||typeof t.sectionId!="string"||!t.sectionId.length||t.sectionId.length>128)throw new Error("sectionId is only valid for playlist navigation");if(r&&!r.contributes?.playlistSections?.some(n=>n.id===t.sectionId))throw new Error("Unknown playlist section: "+t.sectionId)}}var x={network:{title:"\u8BBF\u95EE\u516C\u7F51\u670D\u52A1",permissions:["network.request","network.socket"]},localNetwork:{title:"\u8BBF\u95EE\u5C40\u57DF\u7F51\u4E0E\u672C\u673A\u670D\u52A1",permissions:["network.private","network.discovery"]},account:{title:"\u8BFB\u53D6\u767B\u5F55\u72B6\u6001\u4E0E\u57FA\u672C\u8D26\u53F7\u8D44\u6599",permissions:["account.profile"]},libraryRead:{title:"\u8BFB\u53D6\u6B4C\u5355\u4E0E\u6536\u85CF",permissions:["library.read"]},libraryManage:{title:"\u521B\u5EFA\u548C\u4FEE\u6539\u6B4C\u5355\u4E0E\u6536\u85CF",permissions:["library.write"]},libraryDelete:{title:"\u5220\u9664\u6B4C\u5355\u4E0E\u6B4C\u66F2\u8BB0\u5F55",permissions:["library.delete"]},playbackRead:{title:"\u8BFB\u53D6\u64AD\u653E\u72B6\u6001\u548C\u961F\u5217",permissions:["player.read"]},playbackControl:{title:"\u63A7\u5236\u64AD\u653E\u548C\u64AD\u653E\u961F\u5217",permissions:["player.control","playback.fallback.hold"]},downloads:{title:"\u7BA1\u7406\u4E0B\u8F7D\u4EFB\u52A1",permissions:["downloads.create","downloads.manage"]},files:{title:"\u4F7F\u7528\u7528\u6237\u9009\u5B9A\u7684\u6587\u4EF6",permissions:["files.read","files.write"]},localMusic:{title:"\u7D22\u5F15\u672C\u5730\u97F3\u4E50\u548C\u7F16\u8F91\u6807\u7B7E",permissions:["localMusic.read","localMusic.write"]},clipboardRead:{title:"\u8BFB\u53D6\u526A\u8D34\u677F",permissions:["clipboard.read"]},clipboardWrite:{title:"\u5199\u5165\u526A\u8D34\u677F",permissions:["clipboard.write"]},notifications:{title:"\u53D1\u9001\u7CFB\u7EDF\u901A\u77E5",permissions:["notifications.system"]},external:{title:"\u5728\u7CFB\u7EDF\u6D4F\u89C8\u5668\u6253\u5F00\u94FE\u63A5",permissions:["external.open"]},settingsRead:{title:"\u8BFB\u53D6\u8F6F\u4EF6\u504F\u597D",permissions:["settings.read"]},settingsWrite:{title:"\u4FEE\u6539\u8F6F\u4EF6\u504F\u597D",permissions:["settings.write"]},window:{title:"\u63A7\u5236\u8F6F\u4EF6\u7A97\u53E3",permissions:["window.control"]},hotkeys:{title:"\u6CE8\u518C\u5168\u5C40\u5FEB\u6377\u952E",permissions:["hotkeys.register"]},sharing:{title:"\u53D1\u5E03\u548C\u64A4\u9500\u5206\u4EAB",permissions:["sharing.publish","sharing.revoke"]},roomsRead:{title:"\u8BFB\u53D6\u4E00\u8D77\u542C\u623F\u95F4\u72B6\u6001",permissions:["rooms.read"]},roomsControl:{title:"\u52A0\u5165\u623F\u95F4\u548C\u63A7\u5236\u4E00\u8D77\u542C",permissions:["rooms.control"]},ai:{title:"\u4F7F\u7528\u8F6F\u4EF6 AI \u670D\u52A1",permissions:["ai.use"]},devices:{title:"\u63A7\u5236\u97F3\u9891\u8BBE\u5907\u4E0E\u6295\u653E",permissions:["devices.control"]},uiAppearance:{title:"\u4FEE\u6539\u8F6F\u4EF6\u5168\u5C40\u5916\u89C2",permissions:["ui.styles.global"]},background:{title:"\u540E\u53F0\u4EFB\u52A1",permissions:["background.run"]},credentials:{title:"\u4F7F\u7528\u672C\u63D2\u4EF6\u5DF2\u4FDD\u5B58\u7684\u8FDE\u63A5\u51ED\u636E",permissions:["credentials.use"]},credentialExport:{title:"\u8BFB\u53D6\u672C\u63D2\u4EF6\u8FDE\u63A5\u51ED\u636E\u660E\u6587",permissions:["credentials.read"]},guestPlugins:{title:"\u5B89\u88C5\u548C\u8FD0\u884C\u517C\u5BB9\u5B50\u63D2\u4EF6",permissions:["guests.manage","guests.run"]},services:{title:"\u8C03\u7528\u5176\u4ED6\u63D2\u4EF6\u63D0\u4F9B\u7684\u670D\u52A1",permissions:["services.consume"]}};function H(e){return Object.keys(x).find(r=>x[r].permissions.includes(e))}var p=e=>!!e&&typeof e=="object"&&!Array.isArray(e),f=(e,r=4096)=>typeof e=="string"&&e.length<=r,S=e=>Number.isFinite(e)&&Number(e)>=0;function I(e){if(!p(e)||!["providerId","kind","id"].every(r=>f(e[r],2048)&&e[r].length>0)||e.pluginId!==void 0&&(!f(e.pluginId,2048)||!e.pluginId))throw new Error("Invalid resource reference");if(e.connectionId!==void 0&&(!f(e.connectionId,2048)||!e.connectionId))throw new Error("Invalid resource connection");if(e.scope!==void 0&&(e.scope!=="provider"||e.kind!=="track"||e.connectionId!==void 0))throw new Error("Provider scope requires a public track without a connection");if(e.pluginId===void 0&&e.scope!=="provider")throw new Error("Private resources require an owning plugin");if(e.data!==void 0){if(!p(e.data))throw new Error("Invalid resource private data");let r;try{r=JSON.stringify(e.data)}catch{throw new Error("Resource private data must be JSON")}if(new TextEncoder().encode(r).byteLength>64*1024)throw new Error("Resource private data exceeds 64 KiB")}}function w(e){if(!p(e)||!Array.isArray(e.items)||e.items.length>1e4)throw new Error("Invalid content page");if(e.nextCursor!=null&&(!f(e.nextCursor,2048)||!e.nextCursor.length))throw new Error("Invalid pagination cursor");for(let r of e.items){if(!p(r)||!f(r.title)||!Array.isArray(r.capabilities)||!r.capabilities.every(t=>f(t,128)))throw new Error("Invalid content item");if(I(r.ref),r.ref.kind==="track"){if(!p(r.metadata)||!Array.isArray(r.metadata.artists)||!r.metadata.artists.every(s=>f(s)))throw new Error("Track metadata must contain artists");if(r.metadata.durationMs!==void 0&&!S(r.metadata.durationMs))throw new Error("Invalid track duration");let{qualities:t,qualitySizes:n,qualitySizeLabels:o,hash:l}=r.metadata;if(l!==void 0&&!f(l,4096))throw new Error("Invalid track hash");if(o!==void 0&&(!p(o)||Object.keys(o).length>128||Object.entries(o).some(([s,i])=>!t?.includes(s)||!f(i,128))))throw new Error("Invalid track quality size labels");if(t!==void 0&&(!Array.isArray(t)||t.length>128||!t.every(s=>f(s,128)&&!!s)))throw new Error("Invalid track qualities");if(n!==void 0&&(!p(n)||Object.keys(n).length>128||Object.entries(n).some(([s,i])=>!t?.includes(s)||!Number.isSafeInteger(i)||Number(i)<=0)))throw new Error("Invalid track quality sizes")}if(r.ref.kind==="playlist"&&r.playlist!==void 0){if(!p(r.playlist))throw new Error("Invalid playlist metadata");if(r.playlist.trackCount!==void 0&&(!Number.isInteger(r.playlist.trackCount)||r.playlist.trackCount<0))throw new Error("Invalid playlist track count")}if(r.ref.kind==="chart"&&r.chart!==void 0&&!p(r.chart))throw new Error("Invalid chart metadata")}}function E(e,r=new Set){if(!(e===null||typeof e=="string"||typeof e=="boolean")&&!(typeof e=="number"&&Number.isFinite(e))){if(!e||typeof e!="object"||r.has(e))throw new Error("Native view must contain JSON data only");if(!Array.isArray(e)&&Object.getPrototypeOf(e)!==Object.prototype&&Object.getPrototypeOf(e)!==null)throw new Error("Native view must contain JSON data only");r.add(e);for(let t of Object.values(e))t!==void 0&&E(t,r);r.delete(e)}}function y(e,r){E(e);let t=e,n=(i,c=500)=>typeof i=="string"&&i.length<=c,o=i=>n(i,128)&&!!i&&(!r||r.has(i));if(!t||t.type!=="page"||!Array.isArray(t.sections)||t.sections.length>24||t.title!==void 0&&!n(t.title)||t.description!==void 0&&!n(t.description,4e3))throw new Error("Invalid native view");let l=i=>{if(i!==void 0&&(!Array.isArray(i)||i.length>16))throw new Error("Invalid native actions");for(let c of i??[])if(!c||!n(c.label,100)||!c.label||!o(c.action)||c.primary!==void 0&&typeof c.primary!="boolean"||JSON.stringify(c.input??{}).length>16384)throw new Error("Invalid native action")};l(t.actions);let s=new Set;for(let i of t.sections){if(!i||!n(i.id,128)||!i.id||s.has(i.id)||!["grid","list"].includes(i.layout)||i.title!==void 0&&!n(i.title)||i.onOpen!==void 0&&!o(i.onOpen)||i.onPlay!==void 0&&!o(i.onPlay))throw new Error("Invalid native section");s.add(i.id),l(i.itemActions),w({items:i.items})}}var v=class{constructor(r,t,n){this.surface=r;this.dispatch=n;if(this.actions=new Set(t.contributes?.commands?.map(o=>o.action)),r.kind==="native"&&!this.actions.has(r.entry))throw new Error("Missing native render action: "+r.entry);for(let o of Object.values(r.lifecycle??{}))if(!this.actions.has(o))throw new Error("Unknown surface lifecycle action: "+o)}surface;dispatch;closed=!1;opened=!1;opening;closing;pending=new Set;actions;open(){return this.closed?Promise.reject(new Error("Surface is closed")):(this.opened||(this.opened=!0,this.opening=this.surface.lifecycle?.openAction?this.invoke(this.surface.lifecycle.openAction,{}):Promise.resolve()),this.opening)}async invoke(r,t={}){if(this.closed)throw new Error("Surface is closed");if(!this.actions.has(r))throw new Error("Undeclared surface action: "+r);if(this.pending.size>=32||JSON.stringify(t).length>128*1024)throw new Error("Surface request exceeds limit");let n=new AbortController;this.pending.add(n);try{let o=await this.dispatch(r,t,n.signal);if(this.closed)throw new Error("Surface is closed");return this.surface.kind==="native"&&r===this.surface.entry&&y(o,this.actions),o}finally{this.pending.delete(n)}}close(){if(this.closing)return this.closing;this.closed=!0;for(let t of this.pending)t.abort();this.pending.clear();let r=this.surface.lifecycle?.closeAction;return this.closing=Promise.resolve().then(async()=>{r&&await this.dispatch(r,{})}),this.closing}};export{x as PERMISSION_GROUPS,v as SurfaceSession,L as assertAccountSummary,b as assertContentPage,T as assertLyricsDocument,A as assertNativeView,U as assertNavigationRequest,M as assertResolveResult,m as assertResourceRef,q as defineNativeView,N as normalizeLegacyLyrics,H as permissionGroup,R as retargetTrackRef};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
require('../electron.cjs')
|
package/assets/electron.cjs
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
const { app, BrowserWindow } = require('electron')
|
|
2
|
-
const origin = process.env.CERU_DEV_ORIGIN
|
|
3
|
-
const debugPort = process.env.CERU_DEV_DEBUG_PORT || '9223'
|
|
4
|
-
const visibility = process.env.CERU_DEV_HIDDEN === '1' ? 'hidden' : 'visible'
|
|
5
|
-
if (!/^http:\/\/127\.0\.0\.1:\d+$/.test(origin || ''))
|
|
6
|
-
throw new Error('Invalid development Host origin')
|
|
7
|
-
console.log('[Ceru Electron] launching', origin, 'debug port', debugPort)
|
|
8
|
-
app.commandLine.appendSwitch('remote-debugging-address', '127.0.0.1')
|
|
9
|
-
app.commandLine.appendSwitch('remote-debugging-port', debugPort || '9223')
|
|
10
|
-
app.whenReady().then(() => {
|
|
11
|
-
console.log('[Ceru Electron] ready')
|
|
12
|
-
const window = new BrowserWindow({
|
|
13
|
-
title: 'Ceru Plugin Dev',
|
|
14
|
-
width: 1420,
|
|
15
|
-
height: 960,
|
|
16
|
-
show: visibility !== 'hidden',
|
|
17
|
-
webPreferences: {
|
|
18
|
-
sandbox: true,
|
|
19
|
-
contextIsolation: true,
|
|
20
|
-
nodeIntegration: false,
|
|
21
|
-
partition: 'ceru-plugin-dev-' + Date.now(),
|
|
22
|
-
},
|
|
23
|
-
})
|
|
24
|
-
window.webContents.session.setPermissionRequestHandler((_wc, _permission, callback) =>
|
|
25
|
-
callback(false),
|
|
26
|
-
)
|
|
27
|
-
window.webContents.session.webRequest.onBeforeRequest(
|
|
28
|
-
{ urls: ['http://*/*', 'https://*/*', 'ws://*/*', 'wss://*/*'] },
|
|
29
|
-
(details, callback) => {
|
|
30
|
-
callback({ cancel: !details.url.startsWith(origin + '/') })
|
|
31
|
-
},
|
|
32
|
-
)
|
|
33
|
-
window.webContents.setWindowOpenHandler(() => ({ action: 'deny' }))
|
|
34
|
-
window.webContents.on('will-navigate', (event, url) => {
|
|
35
|
-
if (!url.startsWith(origin + '/')) event.preventDefault()
|
|
36
|
-
})
|
|
37
|
-
window.webContents.on('will-frame-navigate', (event) => {
|
|
38
|
-
if (!event.url.startsWith(origin + '/')) event.preventDefault()
|
|
39
|
-
})
|
|
40
|
-
window.loadURL(origin + '/').catch((error) => console.error('[Ceru Electron] load failed', error))
|
|
41
|
-
})
|
|
42
|
-
app.on('window-all-closed', () => app.quit())
|
package/assets/index.html
DELETED
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
<!doctype html>
|
|
2
|
-
<html lang="zh-CN">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="utf-8" />
|
|
5
|
-
<meta name="viewport" content="width=device-width,initial-scale=1" />
|
|
6
|
-
<title>Ceru Plugin Dev</title>
|
|
7
|
-
<link rel="stylesheet" href="/style.css" />
|
|
8
|
-
</head>
|
|
9
|
-
<body>
|
|
10
|
-
<header>
|
|
11
|
-
<div>
|
|
12
|
-
<span class="badge">CERU / DEV HOST</span>
|
|
13
|
-
<h1 id="plugin-name">插件调试工作台</h1>
|
|
14
|
-
<p id="plugin-meta">TypeScript · 单文件构建 · 隔离运行</p>
|
|
15
|
-
</div>
|
|
16
|
-
<div class="header-actions">
|
|
17
|
-
<span id="status" class="status">启动中</span><button id="restart">重新运行</button
|
|
18
|
-
><button id="stop">停止</button>
|
|
19
|
-
</div>
|
|
20
|
-
</header>
|
|
21
|
-
<div id="build-error" class="error hidden"></div>
|
|
22
|
-
<main>
|
|
23
|
-
<aside>
|
|
24
|
-
<section>
|
|
25
|
-
<h2>能力注册</h2>
|
|
26
|
-
<div id="registrations"></div>
|
|
27
|
-
</section>
|
|
28
|
-
<section>
|
|
29
|
-
<h2>界面与兼容模块</h2>
|
|
30
|
-
<div id="views"></div>
|
|
31
|
-
</section>
|
|
32
|
-
<section>
|
|
33
|
-
<h2>运行时配置</h2>
|
|
34
|
-
<p class="hint">仅保存在当前开发会话中。</p>
|
|
35
|
-
<textarea id="config" spellcheck="false">{}</textarea
|
|
36
|
-
><button id="apply-config">应用配置并重载</button>
|
|
37
|
-
</section>
|
|
38
|
-
<section>
|
|
39
|
-
<h2>权限模拟</h2>
|
|
40
|
-
<div id="permissions"></div>
|
|
41
|
-
</section>
|
|
42
|
-
</aside>
|
|
43
|
-
<article>
|
|
44
|
-
<section>
|
|
45
|
-
<h2>搜索与解析</h2>
|
|
46
|
-
<div class="row">
|
|
47
|
-
<select id="provider" disabled aria-label="搜索来源"></select
|
|
48
|
-
><input id="query" placeholder="输入关键词" disabled /><button id="search" class="primary" disabled>
|
|
49
|
-
调用搜索</button
|
|
50
|
-
><button id="cancel" disabled>取消调用</button>
|
|
51
|
-
</div>
|
|
52
|
-
<p id="search-status" class="hint" role="status" aria-live="polite">正在读取插件能力…</p>
|
|
53
|
-
<div id="results" class="results">
|
|
54
|
-
<div class="empty">插件启动后可以调用已注册的搜索方法。</div>
|
|
55
|
-
</div>
|
|
56
|
-
<pre id="result-detail"></pre>
|
|
57
|
-
</section>
|
|
58
|
-
<section>
|
|
59
|
-
<div class="row"><h2>界面预览</h2><button id="close-view">关闭页面</button></div>
|
|
60
|
-
<div id="preview" class="preview"><div class="empty">选择左侧的页面。</div></div>
|
|
61
|
-
</section>
|
|
62
|
-
<section>
|
|
63
|
-
<h2>宿主资源</h2>
|
|
64
|
-
<p class="hint">
|
|
65
|
-
平台图标可直接写入 Manifest:<code>icon: { kind: 'host', name: 'platform.tx' }</code>
|
|
66
|
-
</p>
|
|
67
|
-
<div id="icons" class="icons"></div>
|
|
68
|
-
<div id="static-assets" class="static-assets"></div>
|
|
69
|
-
<p class="hint">工具:<code>ctx.utils.lodash</code> · 64 个带类型提示的常用方法</p>
|
|
70
|
-
</section>
|
|
71
|
-
</article>
|
|
72
|
-
<section class="log-column">
|
|
73
|
-
<div class="row">
|
|
74
|
-
<h2>运行日志</h2>
|
|
75
|
-
<button id="clear-log">清空</button>
|
|
76
|
-
</div>
|
|
77
|
-
<p class="hint">
|
|
78
|
-
使用 VS Code 的 “Attach to Ceru plugin” 或 Electron DevTools 调试 TS
|
|
79
|
-
源码。日志已对常见敏感字段脱敏。
|
|
80
|
-
</p>
|
|
81
|
-
<div id="logs"></div>
|
|
82
|
-
</section>
|
|
83
|
-
</main>
|
|
84
|
-
<div id="runners" class="hidden"></div>
|
|
85
|
-
<footer>
|
|
86
|
-
这是开发 Host。实际运行逻辑与界面;网络默认拒绝。生产安装授权、凭据保险箱、Guest
|
|
87
|
-
安装及完整音乐业务仍由正式 Host 实现。
|
|
88
|
-
</footer>
|
|
89
|
-
<script nonce="{{NONCE}}">
|
|
90
|
-
window.CERU_DEV_TOKEN={{TOKEN}};
|
|
91
|
-
</script>
|
|
92
|
-
<script type="module" src="/playground.js"></script>
|
|
93
|
-
</body>
|
|
94
|
-
</html>
|