@shiqianjiang/ceru-plugin-sdk 0.2.1 → 0.2.3
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 +2 -0
- package/dist/index.d.ts +4 -1
- package/dist/index.js +3 -0
- package/dist/manifest.d.ts +4 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -21,4 +21,6 @@ const icon = hostIcon('platform.tx')
|
|
|
21
21
|
|
|
22
22
|
CLI 并非必需。插件也可以直接写成 `exports.manifest`、`exports.activate`、`exports.surfaces` 的单个 JavaScript 文件,通过 `require('@ceru/http')` 等内置模块使用相同能力。第三方 npm 包必须在发行前打入文件。
|
|
23
23
|
|
|
24
|
+
运行配置通过 `await ctx.config.get<PluginConfig>()` 读取。配置默认值来自静态 `exports.manifest.config`,个性化发行值来自签名后的 `personalization.config`;Host 递归合并后再交给插件。`definePluginConfig()` 可为外部 TS/JS 配置保留完整字段提示。
|
|
25
|
+
|
|
24
26
|
[完整指南与示例](https://github.com/CeruMusic/CeruMusic-Plugin-Cli#readme)
|
package/dist/index.d.ts
CHANGED
|
@@ -148,6 +148,8 @@ export interface PluginContext extends HostServices {
|
|
|
148
148
|
readonly plugin: {
|
|
149
149
|
id: string;
|
|
150
150
|
version: string;
|
|
151
|
+
/** The validated installed manifest. Runtime configuration is manifest.config. */
|
|
152
|
+
manifest: Readonly<PluginManifest>;
|
|
151
153
|
};
|
|
152
154
|
/** 当前 Host 的协议版本与共享资源版本。 */
|
|
153
155
|
readonly host: {
|
|
@@ -178,7 +180,7 @@ export interface PluginContext extends HostServices {
|
|
|
178
180
|
};
|
|
179
181
|
/** 已验证的配置。凭据字段由 Host 替换为引用,不返回主密钥。 */
|
|
180
182
|
config: {
|
|
181
|
-
get<T
|
|
183
|
+
get<T = JsonObject>(): Promise<Readonly<T>>;
|
|
182
184
|
};
|
|
183
185
|
/** Uses the application's own local/cloud playlists after Host permission checks. */
|
|
184
186
|
library: LibraryAPI;
|
|
@@ -310,6 +312,7 @@ export declare function definePlugin(entry: LogicEntry): LogicEntry;
|
|
|
310
312
|
export declare function defineSurface(entry: SurfaceEntry): SurfaceEntry;
|
|
311
313
|
export declare function defineGuestAdapter(entry: GuestEntry): GuestEntry;
|
|
312
314
|
export declare function defineManifest(manifest: PluginManifest): PluginManifest;
|
|
315
|
+
export declare function definePluginConfig<const T extends JsonObject>(config: T): T;
|
|
313
316
|
export declare function failure(error: MusicFault): ResolveResult;
|
|
314
317
|
/** 基础声明式界面;由 Host 渲染,不会把插件函数放进主界面组件树。 */
|
|
315
318
|
export type UINode = {
|
package/dist/index.js
CHANGED
|
@@ -19,6 +19,9 @@ export function defineGuestAdapter(entry) {
|
|
|
19
19
|
export function defineManifest(manifest) {
|
|
20
20
|
return manifest;
|
|
21
21
|
}
|
|
22
|
+
export function definePluginConfig(config) {
|
|
23
|
+
return config;
|
|
24
|
+
}
|
|
22
25
|
export function failure(error) {
|
|
23
26
|
return { ok: false, error };
|
|
24
27
|
}
|
package/dist/manifest.d.ts
CHANGED
|
@@ -27,6 +27,7 @@ export interface ProviderDeclaration {
|
|
|
27
27
|
id: string;
|
|
28
28
|
name: string;
|
|
29
29
|
protocols: string[];
|
|
30
|
+
qualities?: string[];
|
|
30
31
|
icon?: IconRef;
|
|
31
32
|
connectionMode?: 'none' | 'single' | 'multiple';
|
|
32
33
|
}
|
|
@@ -75,6 +76,9 @@ export interface PluginManifest {
|
|
|
75
76
|
author?: string;
|
|
76
77
|
publisher?: string;
|
|
77
78
|
license?: string;
|
|
79
|
+
homepage?: string;
|
|
80
|
+
/** Static defaults for ctx.config. Build-time @file sugar is expanded into this object. */
|
|
81
|
+
config?: JsonObject;
|
|
78
82
|
engines: {
|
|
79
83
|
hostApi: string;
|
|
80
84
|
logicRuntime: string;
|