@linkdesk/plugin-sdk 0.1.72 → 0.1.73
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
CHANGED
|
@@ -18,7 +18,7 @@ npm install -D @linkdesk/plugin-sdk
|
|
|
18
18
|
> 自动生成,**勿手改**——由 `scripts/generate-api-cheatsheet.mjs` 从 `@linkdesk/contracts` 的 `linkdesk.d.ts` 现读产出,
|
|
19
19
|
> `npm run check` 机械盯漂。完整签名与逐方法说明见 `linkdesk.d.ts` 本体(IDE 里可直接跳转)。
|
|
20
20
|
|
|
21
|
-
**16 个域接口 → 47 个命名空间 /
|
|
21
|
+
**16 个域接口 → 47 个命名空间 / 255 个方法**,全部经 `window.linkdesk.<命名空间>.<方法>` 调用。 (plus 1 deprecated alias/es `config`, not counted twice)
|
|
22
22
|
|
|
23
23
|
| Namespace | Methods | Method | Notes |
|
|
24
24
|
|:--|:--:|:--|:--|
|
|
@@ -49,7 +49,7 @@ npm install -D @linkdesk/plugin-sdk
|
|
|
49
49
|
| `path` | 6 | `appDataDir`° `normalize` `join` `basename` `dirname` `extname` | 路径工具——壳/池双端注入(editor/file-tree 池插件消费 normalize/join 等) |
|
|
50
50
|
| `env` | 1 | `get` | 环境信息——对标 VS Code ExtensionContext |
|
|
51
51
|
| `search` | 1 | `searchFiles` | 文件搜索——全文搜索/替换(IPC 到壳/主进程执行) |
|
|
52
|
-
| `encoding` |
|
|
52
|
+
| `encoding` | 4 | `detect` `decode` `encode` `isBinary` | 编码检测/转换(主进程 EncodingService) |
|
|
53
53
|
| `decorations` | 4 | `registerProvider` `unregisterProvider` `getDecoration` `onDidChange` | 文件装饰——池内本地注册表(零 IPC) |
|
|
54
54
|
| `fileAssociation` | 1 | `getPluginFor` | 文件关联——扩展名→插件 ID(主进程 FileAssociationService 直答) |
|
|
55
55
|
| `langDef` | 1 | `get` | langDef——语言定义注册表(主进程直答) |
|
|
@@ -229,6 +229,7 @@ export const linkdeskMock: Record<string, unknown> = {
|
|
|
229
229
|
detect: async (..._args: unknown[]) => { console.info("[linkdesk-mock] encoding.detect", ..._args); return ""; },
|
|
230
230
|
decode: async (..._args: unknown[]) => { console.info("[linkdesk-mock] encoding.decode", ..._args); return ""; },
|
|
231
231
|
encode: async (..._args: unknown[]) => { console.info("[linkdesk-mock] encoding.encode", ..._args); },
|
|
232
|
+
isBinary: async (..._args: unknown[]) => { console.info("[linkdesk-mock] encoding.isBinary", ..._args); return false; },
|
|
232
233
|
},
|
|
233
234
|
decorations: {
|
|
234
235
|
registerProvider: (..._args: unknown[]) => { console.info("[linkdesk-mock] decorations.registerProvider", ..._args); },
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@linkdesk/plugin-sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.73",
|
|
4
4
|
"description": "@linkdesk/plugin-sdk——LinkDesk 插件作者 SDK(对标 @types/vscode):window.linkdesk.* 类型 + 一键 build(.linkdesk-plugin) + dev 宿主 + plugin.json 验证 + eslint 门禁(E6#54d)。作者 npm i 后零壳源码依赖。",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$comment": "宿主保留面账(生成式·E6#111b/1.32 定稿,1.49 补 version)——插件不得占用这些名字。消费方有**两条腿,互不覆盖**:① **壳腿** = 壳仓 `scripts/audit-plugin-scope.mjs`(跨容器普查,读本账 + 反向核对实况)与 `src/core/registry/host-reserved.generated.ts`(壳**运行时**仲裁读的生成副本);② **SDK 腿** = `@linkdesk/plugin-sdk` 的四个 `check-*-ownership`(随包下发本账的副本 `schemas/host-reserved.json`,在**插件仓 CI** 判红)。为什么必须两条腿:壳腿看不见插件仓的源码,SDK 腿看不见壳的运行时——各自的射程都到不了对面。**改本表 = 一次公共面决策**:动手前先问「**这是公共面,还是漏网的借用?**」——公共面(多人正当读写、按约定共享)该进本账的设计里单列,借用(某插件用了宿主的名字)一律判红、不许宽恕;**新增条目要在这一段或对应家族的 why 里写明判据**,别只加一个名字。改完必须重跑生成器 `npm run audit:plugin-scope:regen`(scripts/gen-host-reserved.mjs)——账 + SDK 副本 + 运行时副本**三份同源**,手改任一份都会被判漂。**双向对账门禁在哪**:`node scripts/gen-host-reserved.mjs --check`(四向:实况→账 / 账→实况 / SDK 副本逐字节 / 运行时副本逐元素),已接在 `npm run check` 里;实况多一条报 `ledger-missing`、账多一条报 `ledger-stale`、家族整段缺失/为空另有专门的报警。`version` = 本账**形状**的修订号(见生成器 `LEDGER_VERSION` 的抬版规则),不是 settings 迁移版本。⚠️ configKeys 含**退役键**(曾被宿主使用、现已不再写入的键):退役键**不腾出保留面**——老 settings.json 里可能还留着值,插件此刻占它 = 顶掉的是宿主的历史数据(且迁移代码仍会读它)。📌 **`retired[]` = 退役登记栏**(E6#116/本账 version 2 起):**人工栏**——生成器**原样携带**(不扫描、不由实况推)。每条 = { name, kind, since, why, replacedBy, landing, approvedBy }:谁批的(必须**用户本人**签的日期)、为什么、替身是谁、还剩哪个活口。**退役 ≠ 删除**:退役名**不腾位**(同上——老值还在),所以它照旧留在本账对应家族里,只是不再是对插件许过的面。🔴 它**不是黑名单**:只供人读与作者侧提示,⛔ 不许任何门禁拿它去拦插件;「有登记即放行」的唯一出口在`scripts/check-api-surface-additive.mjs`(面被拿走 + 有登记 ⇒ 放行),本栏自身的自洽对账在 `scripts/check-retired-ledger.mjs`。⚠️ 运行时副本**不下发** `retired`(`renderRuntimeModule` 只渲染显式家族常量,运行时对它没有可执行判断);SDK 副本随本账**逐字节**含它——「要不要给作者侧提示退役名」= 格 6 的取舍点。",
|
|
3
|
-
"version":
|
|
3
|
+
"version": 3,
|
|
4
4
|
"commandPrefixes": [
|
|
5
5
|
"app.",
|
|
6
6
|
"core.",
|
|
@@ -66,6 +66,8 @@
|
|
|
66
66
|
"updateButtonLabel"
|
|
67
67
|
],
|
|
68
68
|
"contextKeysPublic": [
|
|
69
|
+
"resourceExtname",
|
|
70
|
+
"resourceIsFile",
|
|
69
71
|
"settingFollowTheme",
|
|
70
72
|
"settingHasTitle",
|
|
71
73
|
"settingKey",
|
|
@@ -477,14 +477,15 @@
|
|
|
477
477
|
},
|
|
478
478
|
"fileAssociations": {
|
|
479
479
|
"type": "array",
|
|
480
|
-
"description": "File associations — file extension → plugin routing (consumed by the main-process plugin-manifest-loader). Declare only the extension plus an optional open command; this plugin's own pluginId comes from the top-level `pluginId` field (see the top-level pluginId description for the directory-name fallback).",
|
|
480
|
+
"description": "File associations — file extension → plugin routing (consumed by the main-process plugin-manifest-loader). Declare only the extension plus an optional open command or role; this plugin's own pluginId comes from the top-level `pluginId` field (see the top-level pluginId description for the directory-name fallback).",
|
|
481
481
|
"items": {
|
|
482
482
|
"type": "object",
|
|
483
483
|
"required": ["extension"],
|
|
484
484
|
"properties": {
|
|
485
485
|
"extension": { "type": "string", "description": "File extension — without the dot, e.g. dxf / stl / step" },
|
|
486
486
|
"command": { "type": "string", "description": "Optional — command ID to run when opening a file with this extension" },
|
|
487
|
-
"displayName": { "type": "string", "description": "Optional — display name in the 'Open with…' picker" }
|
|
487
|
+
"displayName": { "type": "string", "description": "Optional — display name in the 'Open with…' picker" },
|
|
488
|
+
"role": { "type": "string", "enum": ["text-fallback"], "description": "Optional — role declaration, attached to this specific entry. \"text-fallback\": this plugin is a candidate for the shell's default text editor fallback (used when no plugin declares the file's extension). The shell picks the active holder; installing a second holder never silently drifts the current default. First version defines only \"text-fallback\"." }
|
|
488
489
|
},
|
|
489
490
|
"additionalProperties": false
|
|
490
491
|
}
|