@linkdesk/contracts 0.1.16 → 0.1.18
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 +4 -3
- package/linkdesk.d.ts +7 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -38,9 +38,10 @@ Its surface is `linkdesk.d.ts` (regenerated by `npm run contracts:check` / the g
|
|
|
38
38
|
|
|
39
39
|
```bash
|
|
40
40
|
# 1. bump contracts/package.json version (0.x backward-compatible → patch)
|
|
41
|
-
# 2. publish — 🔴
|
|
42
|
-
|
|
43
|
-
#
|
|
41
|
+
# 2. publish — 🔴 FROM INSIDE THIS FOLDER. Do NOT write `npm publish contracts` from the repo root:
|
|
42
|
+
# a bare name is treated as a *package spec*, so npm resolves the registry's unrelated `contracts`
|
|
43
|
+
# package instead of this directory. And `--workspace=<name>` only works for packages/*.
|
|
44
|
+
cd contracts && npm publish --registry=https://registry.npmjs.org
|
|
44
45
|
# 3. record the baseline (run in the LinkDesk repo root)
|
|
45
46
|
npm run release:mark
|
|
46
47
|
```
|
package/linkdesk.d.ts
CHANGED
|
@@ -92,12 +92,19 @@ export interface CommandsAPI {
|
|
|
92
92
|
* plugin.json contributes.commands 未声明的命令经 meta 注册后同样可见/可执行。
|
|
93
93
|
* 真相源分工:壳 CommandRegistry = 显示真相源(title/category/when 唯一权威),
|
|
94
94
|
* 池 = 执行真相源(handler 唯一权威,永不跨进程)——meta 只同步显示面。
|
|
95
|
+
* 🔴 **E6#111b:`meta.pluginId` = 注册方显式申报的真身份**(可选,只做加法)。
|
|
96
|
+
* 命令归属解析优先级 = ① plugin.json 声明面 → ② 本字段 → ③ 名字第一段推定。
|
|
97
|
+
* 声明过的命令**不必填**(① 已权威);只有「声明里没有、名字又不带自己前缀」的命令需要它,
|
|
98
|
+
* 否则该命令会被算到名字第一段那个属主头上(借他人前缀 ⇒ 归属错、且异归属顶替拦不住)。
|
|
99
|
+
* 照 `notifications.source` 先例(`ui.ts:26-32`):池是单进程共享 realm,
|
|
100
|
+
* 所有插件共用同一个 `window.linkdesk` ⇒ **无从自动注入,只能作者显式报**。
|
|
95
101
|
*/
|
|
96
102
|
registerCommand(commandId: string,
|
|
97
103
|
handler: (...args: any[]) => Promise<unknown> | unknown, meta?: {
|
|
98
104
|
title?: string;
|
|
99
105
|
category?: string;
|
|
100
106
|
when?: string;
|
|
107
|
+
pluginId?: string;
|
|
101
108
|
}): void;
|
|
102
109
|
/** 注销插件的池内命令(约定:命令 ID 格式为 "pluginId.commandName")——随视图 unmount 调用 */
|
|
103
110
|
unregisterCommands(pluginId: string): void;
|