@linkdesk/plugin-sdk 0.1.87 → 0.1.88
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 +43 -43
- package/dev-host/linkdesk-mock.generated.ts +11 -11
- package/package.json +2 -1
- package/schemas/host-css-names.json +3 -0
package/README.md
CHANGED
|
@@ -15,60 +15,60 @@ npm install -D @linkdesk/plugin-sdk
|
|
|
15
15
|
|
|
16
16
|
<!-- BEGIN API-CHEATSHEET -->
|
|
17
17
|
|
|
18
|
-
>
|
|
19
|
-
> `npm run check`
|
|
18
|
+
> Auto-generated, **do not edit by hand**—produced live by `scripts/generate-api-cheatsheet.mjs` reading `linkdesk.d.ts` from `@linkdesk/contracts`;
|
|
19
|
+
> `npm run check` mechanically watches for drift. For full signatures and per-method notes see `linkdesk.d.ts` itself (jump to it straight from the IDE).
|
|
20
20
|
|
|
21
|
-
**16
|
|
21
|
+
**16 domain interfaces → 47 namespaces / 260 methods**, all invoked via `window.linkdesk.<namespace>.<method>`. (plus 1 deprecated alias/es `config`, not counted twice)
|
|
22
22
|
|
|
23
23
|
| Namespace | Methods | Method | Notes |
|
|
24
24
|
|:--|:--:|:--|:--|
|
|
25
|
-
| `commands` | 5 | `execute` `executeCommand` `registerCommand` `unregisterCommands` `getCommands` |
|
|
26
|
-
| `configuration` | 15 | `get` `set` `getSchema` `onChange` `getConfigurationContributions` `inspectConfiguration` `getUserSettings` `onDidChangeConfiguration` `onPluginLifecycleChange` `consumeSettingsGroup` `onRequestSettingsGroup` `consumeScrollToSetting` `onRequestScrollToSetting` `consumeOpenKeybindings` `onRequestOpenKeybindings` |
|
|
27
|
-
| `config` | 15 |
|
|
25
|
+
| `commands` | 5 | `execute` `executeCommand` `registerCommand` `unregisterCommands` `getCommands` | Commands — modeled after VS Code vscode.commands |
|
|
26
|
+
| `configuration` | 15 | `get` `set` `getSchema` `onChange` `getConfigurationContributions` `inspectConfiguration` `getUserSettings` `onDidChangeConfiguration` `onPluginLifecycleChange` `consumeSettingsGroup` `onRequestSettingsGroup` `consumeScrollToSetting` `onRequestScrollToSetting` `consumeOpenKeybindings` `onRequestOpenKeybindings` | Configuration — the new name — modeled after VS Code vscode… |
|
|
27
|
+
| `config` | 15 | (deprecated alias → `configuration`) | @deprecated — backward-compatibility alias |
|
|
28
28
|
| `theme` | 11 | `getCurrent` `getAvailable` `apply` `listRecipes` `getActive` `getEffectiveTokens` `setRecipe` `setColorway` `resetAppearance` `resetMix` `getBaselineSeeds` | —— |
|
|
29
29
|
| `language` | 5 | `getCurrent` `getAvailable` `set` `getInitial` `onChange` | —— |
|
|
30
|
-
| `appearance` | 2 | `importImage` `revealStorage` |
|
|
30
|
+
| `appearance` | 2 | `importImage` `revealStorage` | appearance assets — locally picked images are copied into m… |
|
|
31
31
|
| `storage` ⚠️ | 2 | `revealCache` `cacheDir` | —— |
|
|
32
32
|
| `tabs` | 9 | `create` `openOrFocus` `focus` `close` `focusBySourceId` `updateLabelBySourceId` `closeBySourceId` `onDidChangeActiveTab` `list` | —— |
|
|
33
33
|
| `keybindings` | 13 | `getKeybindings` `getConflicts` `registerKeybinding` `saveUserKeybindings` `removeKeybindingForCommand` `resetKeybindingToDefault` `clearKeybindingForCommand` `findKeybindingForCommand` `setKeybindingCaptureActive` `keyboardEventToKeyString` `onChange` `syncToMainProcess`° `onForwardedEvent`° | —— |
|
|
34
|
-
| `notifications` | 3 | `show` `list` `subscribe` |
|
|
35
|
-
| `menu` | 2 | `registerItems` `getItems` |
|
|
36
|
-
| `contextKey` | 1 | `set` | ContextKey
|
|
37
|
-
| `dialog` | 5 | `confirm` `alert` `open` `openFile` `confirmContent` |
|
|
38
|
-
| `quickPick` | 1 | `show` |
|
|
39
|
-
| `quickPickHost` | 6 | `registerHost` `onShow` `select` `highlight` `close` `itemAction` | QuickPick
|
|
40
|
-
| `dialogHost` | 5 | `onShow` `current` `pending` `confirm` `cancel` | Dialog
|
|
41
|
-
| `floatingPanelHost` | 4 | `onShow` `action` `registerBoundsHost` `getBounds` |
|
|
42
|
-
| `serial` | 11 | `listPorts` `getStatus` `openPort` `closePort` `sendData` `sendText` `setDtr` `setRts` `onData` `onStats` `onSystem` |
|
|
43
|
-
| `clipboard` | 3 | `readText` `writeText` `writeFileList` |
|
|
44
|
-
| `p2p` | 2 | `send` `on` | p2p
|
|
45
|
-
| `events` | 4 | `on` `emit` `heartbeat`° `notifyTheme`° |
|
|
46
|
-
| `pluginState` | 3 | `get` `set` `onChange` |
|
|
47
|
-
| `workspace` | 8 | `getFolders` `getActive` `setActive` `openFolder` `addFolder` `removeFolder` `onDidChangeFolders` `onDidChangeActiveWorkspace` |
|
|
48
|
-
| `filesystem` | 12 | `readTextFile` `writeTextFile` `exists` `createDir` `copy` `rename` `remove` `listDir` `readBinaryFile` `writeBinaryFile` `watch` `readdir`° |
|
|
49
|
-
| `path` | 6 | `appDataDir`° `normalize` `join` `basename` `dirname` `extname` |
|
|
50
|
-
| `env` | 1 | `get` |
|
|
51
|
-
| `search` | 1 | `searchFiles` |
|
|
52
|
-
| `encoding` | 4 | `detect` `decode` `encode` `isBinary` |
|
|
53
|
-
| `decorations` | 4 | `registerProvider` `unregisterProvider` `getDecoration` `onDidChange` |
|
|
54
|
-
| `fileAssociation` | 4 | `getPluginFor` `listHandlersFor` `setDefault` `setDefaultBulk` |
|
|
55
|
-
| `langDef` | 1 | `get` | langDef
|
|
56
|
-
| `lsp` | 4 | `spawn` `write` `dispose` `onData` | LSP
|
|
57
|
-
| `protocol` | 3 | `listProtocols` `getActiveProtocolId` `setActiveProtocolId` | protocol
|
|
58
|
-
| `viewContainer` | 4 | `getViewContainer` `getViews` `getView` `registerView` | viewContainer
|
|
59
|
-
| `plugins` | 14 | `resolvePath` `resolveEntry`° `getCompatibility`° `listDirs`° `listAll`° `listDisabledDirs`° `readManifest`° `readAllManifests`° `packageDownload`° `packageExtract`° `packageCancel`° `packageUpdateCheck`° `packageStageUpdate`° `packageCommitUpdate`° |
|
|
60
|
-
| `pluginManager` | 13 | `list` `enable` `disable` `uninstall` `install` `installWithProgress`° `reinstall` `getDisabled` `getUninstalled` `isDisabled` `update`° `checkUpdates`° `notifyManifestChanged`° |
|
|
61
|
-
| `bridge` ⚠️ | 4 | `onRequest` `respond` `broadcast` `notifyConfigChanged` |
|
|
62
|
-
| `pool` | 32 | `pushLayout` `onReady` `toggleDevTools` `onSidebarAction` `onTabAction` `onTabBarRects` `onDragPosition` `pushAdsorbHint` `onAdsorbIndex` `pushQuickPick` `onQuickPickAction` `pushDialog` `onDialogAction` `pushFloatingPanel` `onFloatingPanelAction` `onMemoryPressure` `createWindow` `closeWindow` `onWindowClosed` `onWindowBoundsChanged` `getLayout` `onLayout` `ready` `sidebarAction` `tabAction` `tabBarRects` `dragPosition` `onAdsorbHint` `adsorbIndex` `registerBeforeClose` `unregisterBeforeClose` `beforeClose` |
|
|
63
|
-
| `window` | 11 | `minimize` `maximize` `unmaximize` `close` `setZoom` `toggleDevTools` `isMaximized` `onMaximizeChange` `setAlwaysOnTop` `isAlwaysOnTop` `onAlwaysOnTopChange` |
|
|
64
|
-
| `shell` | 7 | `showItemInFolder` `openInTerminal` `pluginLocation` `openPluginFolder` `startDrag` `relaunch`° `openExternal` |
|
|
65
|
-
| `hotExit` ⚠️ | 3 | `save` `load` `clear` |
|
|
66
|
-
| `getFilePath` | 0 | (top-level function)`getFilePath: (file: File) => string;` | OS
|
|
34
|
+
| `notifications` | 3 | `show` `list` `subscribe` | Notifications — plugins raise notifications ( the only noti… |
|
|
35
|
+
| `menu` | 2 | `registerItems` `getItems` | Menus — declarative read/write for plugins |
|
|
36
|
+
| `contextKey` | 1 | `set` | ContextKey — plugins SET state for the shell's when clauses… |
|
|
37
|
+
| `dialog` | 5 | `confirm` `alert` `open` `openFile` `confirmContent` | Dialogs — confirm/alert/file selection |
|
|
38
|
+
| `quickPick` | 1 | `show` | plugin quickPick picker — local bridge inside the pool (zer… |
|
|
39
|
+
| `quickPickHost` | 6 | `registerHost` `onShow` `select` `highlight` `close` `itemAction` | QuickPick host rendering bridge — consumed by the pool's Qu… |
|
|
40
|
+
| `dialogHost` | 5 | `onShow` `current` `pending` `confirm` `cancel` | Dialog dumb-render subscription — consumed by the pool's Di… |
|
|
41
|
+
| `floatingPanelHost` | 4 | `onShow` `action` `registerBoundsHost` `getBounds` | (type B): floating panel dumb-render subscription — consume… |
|
|
42
|
+
| `serial` | 11 | `listPorts` `getStatus` `openPort` `closePort` `sendData` `sendText` `setDtr` `setRts` `onData` `onStats` `onSystem` | Serial — read/write/listen, modeled after VS Code SerialPor… |
|
|
43
|
+
| `clipboard` | 3 | `readText` `writeText` `writeFileList` | Clipboard — read/write the system clipboard |
|
|
44
|
+
| `p2p` | 2 | `send` `on` | p2p targeted inter-plugin push — same pattern as bridge.bro… |
|
|
45
|
+
| `events` | 4 | `on` `emit` `heartbeat`° `notifyTheme`° | Generic event subscribe + publish — the inter-plugin data p… |
|
|
46
|
+
| `pluginState` | 3 | `get` `set` `onChange` | plugin persistent storage — centralized cache + file persis… |
|
|
47
|
+
| `workspace` | 8 | `getFolders` `getActive` `setActive` `openFolder` `addFolder` `removeFolder` `onDidChangeFolders` `onDidChangeActiveWorkspace` | Workspace — injected by the pool preload (the shell side us… |
|
|
48
|
+
| `filesystem` | 12 | `readTextFile` `writeTextFile` `exists` `createDir` `copy` `rename` `remove` `listDir` `readBinaryFile` `writeBinaryFile` `watch` `readdir`° | Filesystem — plugin read/write (path validation is performe… |
|
|
49
|
+
| `path` | 6 | `appDataDir`° `normalize` `join` `basename` `dirname` `extname` | Path utilities — injected on both shell/pool ends (in-pool … |
|
|
50
|
+
| `env` | 1 | `get` | Environment info — modeled after VS Code ExtensionContext |
|
|
51
|
+
| `search` | 1 | `searchFiles` | file search — full-text search/replace (executed via IPC in… |
|
|
52
|
+
| `encoding` | 4 | `detect` `decode` `encode` `isBinary` | encoding detection/conversion (main-process EncodingService) |
|
|
53
|
+
| `decorations` | 4 | `registerProvider` `unregisterProvider` `getDecoration` `onDidChange` | file decorations — a local in-pool registry (zero IPC). Sha… |
|
|
54
|
+
| `fileAssociation` | 4 | `getPluginFor` `listHandlersFor` `setDefault` `setDefaultBulk` | file associations — extension→plugin ID (answered directly … |
|
|
55
|
+
| `langDef` | 1 | `get` | langDef — language definition registry (answered directly b… |
|
|
56
|
+
| `lsp` | 4 | `spawn` `write` `dispose` `onData` | LSP bridge — autocompletion/F12/diagnostics/rename |
|
|
57
|
+
| `protocol` | 3 | `listProtocols` `getActiveProtocolId` `setActiveProtocolId` | protocol — protocol registry (answered directly by the main… |
|
|
58
|
+
| `viewContainer` | 4 | `getViewContainer` `getViews` `getView` `registerView` | viewContainer — real IPC query/update (asks the shell-side … |
|
|
59
|
+
| `plugins` | 14 | `resolvePath` `resolveEntry`° `getCompatibility`° `listDirs`° `listAll`° `listDisabledDirs`° `readManifest`° `readAllManifests`° `packageDownload`° `packageExtract`° `packageCancel`° `packageUpdateCheck`° `packageStageUpdate`° `packageCommitUpdate`° | Plugin discovery — injected on both ends: resolvePath exist… |
|
|
60
|
+
| `pluginManager` | 13 | `list` `enable` `disable` `uninstall` `install` `installWithProgress`° `reinstall` `getDisabled` `getUninstalled` `isDisabled` `update`° `checkUpdates`° `notifyManifestChanged`° | Plugin management — bridges IpcBridgeHandler → loader funct… |
|
|
61
|
+
| `bridge` ⚠️ | 4 | `onRequest` `respond` `broadcast` `notifyConfigChanged` | Shell↔plugin communication relay — shell preload only |
|
|
62
|
+
| `pool` | 32 | `pushLayout` `onReady` `toggleDevTools` `onSidebarAction` `onTabAction` `onTabBarRects` `onDragPosition` `pushAdsorbHint` `onAdsorbIndex` `pushQuickPick` `onQuickPickAction` `pushDialog` `onDialogAction` `pushFloatingPanel` `onFloatingPanelAction` `onMemoryPressure` `createWindow` `closeWindow` `onWindowClosed` `onWindowBoundsChanged` `getLayout` `onLayout` `ready` `sidebarAction` `tabAction` `tabBarRects` `dragPosition` `onAdsorbHint` `adsorbIndex` `registerBeforeClose` `unregisterBeforeClose` `beforeClose` | Pool control — shell preload: pushes layout + registers poo… |
|
|
63
|
+
| `window` | 11 | `minimize` `maximize` `unmaximize` `close` `setZoom` `toggleDevTools` `isMaximized` `onMaximizeChange` `setAlwaysOnTop` `isAlwaysOnTop` `onAlwaysOnTopChange` | Window control — TitleBar button mapping, injected on both … |
|
|
64
|
+
| `shell` | 7 | `showItemInFolder` `openInTerminal` `pluginLocation` `openPluginFolder` `startDrag` `relaunch`° `openExternal` | Shell-level commands — revealInOS / openInTerminal / startD… |
|
|
65
|
+
| `hotExit` ⚠️ | 3 | `save` `load` `clear` | Hot exit staging — persists unsaved editor content to disk … |
|
|
66
|
+
| `getFilePath` | 0 | (top-level function)`getFilePath: (file: File) => string;` | Get the paths of files dragged in from the OS — injected on… |
|
|
67
67
|
| `panel` | 3 | `reveal` `revealFloating` `setFloatingBounds` | —— |
|
|
68
68
|
| `settings` | 3 | `list` `getActive` `setActive` | —— |
|
|
69
69
|
| `factorySlots` | 4 | `listRoles` `list` `getActive` `setActive` | —— |
|
|
70
|
-
| `app` | 1 | `getVersion` | app
|
|
71
|
-
| `update` | 1 | `getState` | update
|
|
70
|
+
| `app` | 1 | `getVersion` | The app namespace — read-only product identity. The only ru… |
|
|
71
|
+
| `update` | 1 | `getState` | The update namespace — read-only update state (for "About"-… |
|
|
72
72
|
|
|
73
73
|
⚠️ = optional namespace in the contract (injected on one side only): `storage` `bridge` `hotExit` — check for existence before calling; on the other side it is undefined.
|
|
74
74
|
° = member marked `?` in the contract: injected in one side's preload only (almost always shell-side). **Your plugin runs in the pool** — check for existence before calling.
|
|
@@ -184,4 +184,4 @@ npm run release:mark
|
|
|
184
184
|
```
|
|
185
185
|
|
|
186
186
|
> 🔴 The shelf read has a **~3 minute replication delay** (`contracts` is visible within seconds, `plugin-sdk` takes minutes) — do **not** re-publish on a 404, npm will reject the duplicate version.
|
|
187
|
-
> Full procedure + all three measured pitfalls →
|
|
187
|
+
> Full procedure + all three measured pitfalls → the author-axis npm release dossier in the LinkDesk repository (Chinese docs tree, publishing-management series).
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* 🔥 linkdesk-mock.generated.ts
|
|
2
|
+
* 🔥 linkdesk-mock.generated.ts—dev-host window.linkdesk mock tree (auto-generated, do not edit by hand)
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* Generated from: src/core/api/linkdesk-api.ts + linkdesk-api/ (LinkDeskAPI intersection—same annotation source as linkdesk.d.ts)
|
|
5
|
+
* Generator: scripts/generate-contract.mjs (E6#27 third artifact—prevents mock/preload drift; consumed by dev-host/mock.ts via a Proxy)
|
|
6
|
+
* After changing a contract source, run `node scripts/generate-contract.mjs` (contracts:check enforces all three artifacts byte-for-byte)
|
|
7
7
|
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* Promise<void
|
|
13
|
-
* void → noop
|
|
14
|
-
*
|
|
8
|
+
* Consumer: packages/plugin-sdk/dev-host/mock.ts—injectDevMockApi() wraps this tree in a Proxy:
|
|
9
|
+
* in-tree methods = type-driven neutral defaults + a [linkdesk-mock] log line per call (mock vs real IPC is perceivable);
|
|
10
|
+
* out-of-tree paths (method names absent from the contract) = the Proxy throws "not in the linkdesk API contract".
|
|
11
|
+
* Default-value strategy ("never crash + stay perceivable"; see the local-preview-environment design doc §10.2):
|
|
12
|
+
* Promise<void/…data object> → async returns undefined; Promise<array> → []; Promise<string/boolean> → ""/false;
|
|
13
|
+
* void → noop (registerCommand etc. are called by every plugin—never throw); unsubscribe handles (onChange etc.) → noop function;
|
|
14
|
+
* other sync returns → ""/undefined. Real data/behavior goes through real IPC / linkdesk-plugin-sdk dev --real (E6#28.5).
|
|
15
15
|
*/
|
|
16
16
|
export const linkdeskMock: Record<string, unknown> = {
|
|
17
17
|
commands: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@linkdesk/plugin-sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.88",
|
|
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",
|
|
@@ -64,6 +64,7 @@
|
|
|
64
64
|
"node": ">=20.0.0"
|
|
65
65
|
},
|
|
66
66
|
"scripts": {
|
|
67
|
+
"prepublishOnly": "node ../../scripts/prepublish-auth-preflight.mjs --npm",
|
|
67
68
|
"build": "node -e \"require('node:fs').rmSync('dist',{recursive:true,force:true})\" && tsc -p tsconfig.build.json",
|
|
68
69
|
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
69
70
|
"prepack": "npm run build"
|
|
@@ -798,7 +798,9 @@
|
|
|
798
798
|
"ldk-floating-panel-resize",
|
|
799
799
|
"ldk-floating-panel-title",
|
|
800
800
|
"ldk-form-row",
|
|
801
|
+
"ldk-group-pane",
|
|
801
802
|
"ldk-group-pane-focused",
|
|
803
|
+
"ldk-group-pane-split",
|
|
802
804
|
"ldk-group-tab-bar",
|
|
803
805
|
"ldk-group-tab-close",
|
|
804
806
|
"ldk-group-tab-dirty-dot",
|
|
@@ -1147,6 +1149,7 @@
|
|
|
1147
1149
|
"ldk-status-chord",
|
|
1148
1150
|
"ldk-status-divider",
|
|
1149
1151
|
"ldk-status-text",
|
|
1152
|
+
"ldk-tab-content-split",
|
|
1150
1153
|
"ldk-theme-picker",
|
|
1151
1154
|
"ldk-theme-picker-badge",
|
|
1152
1155
|
"ldk-theme-picker-card",
|