@shiqianjiang/ceru-plugin-sdk 0.3.15 → 0.3.16

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.
@@ -16,6 +16,7 @@ export declare function createLegacyHttpBridge(host: PluginContext): {
16
16
  };
17
17
  raw: import("./manifest.js").JsonValue;
18
18
  url: string;
19
+ finalUrl: any;
19
20
  }>;
20
21
  cancelHttp(): void;
21
22
  };
@@ -105,6 +105,9 @@ export function createLegacyHttpBridge(host) {
105
105
  headers: { ...response.headers, ...(firstLocation ? { location: url.href } : {}) },
106
106
  raw: response.body,
107
107
  url: url.href,
108
+ // 重定向由 Host 内部跟随,Location 头不会回传;用最终地址补上,
109
+ // 让需要还原短链的适配器(如 QQ 音乐 ?__= 短链)拿到真实目标。
110
+ finalUrl: typeof response.url === 'string' ? response.url : url.href,
108
111
  };
109
112
  })();
110
113
  return {
package/dist/music.d.ts CHANGED
@@ -87,4 +87,5 @@ export declare function assertResourceRef(value: unknown): asserts value is Reso
87
87
  export declare function retargetTrackRef(ref: ResourceRef, pluginId: string): ResourceRef;
88
88
  export declare function assertContentPage(value: unknown): void;
89
89
  export declare function assertResolveResult(value: unknown): asserts value is ResolveResult;
90
+ export declare function normalizeLegacyLyrics(value: unknown): unknown;
90
91
  export declare function assertLyricsDocument(value: unknown): asserts value is LyricsDocument;
package/dist/music.js CHANGED
@@ -146,6 +146,14 @@ export function assertResolveResult(value) {
146
146
  if (!record(value.error) || !text(value.error.code, 128) || !text(value.error.message, 65536))
147
147
  throw new Error('Invalid music fault');
148
148
  }
149
+ export function normalizeLegacyLyrics(value) {
150
+ if (record(value) &&
151
+ value.format === undefined &&
152
+ value.version === 1 &&
153
+ Array.isArray(value.lines))
154
+ return { ...value, format: 'crlyric' };
155
+ return value;
156
+ }
149
157
  export function assertLyricsDocument(value) {
150
158
  if (!record(value) ||
151
159
  value.format !== 'crlyric' ||
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shiqianjiang/ceru-plugin-sdk",
3
- "version": "0.3.15",
3
+ "version": "0.3.16",
4
4
  "description": "Typed authoring contracts for Ceru Music v2 single-file plugins",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",