@get-bb/plugin-sdk 0.5.9 → 0.5.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.
- package/README.md +6 -4
- package/bundled-types/bb-plugin-sdk-app.d.ts +246 -25
- package/bundled-types/bb-plugin-sdk-internal-plugin-app-collector.d.ts +2 -1
- package/bundled-types/bb-plugin-sdk-testing-app.d.ts +43 -13
- package/bundled-types/bb-plugin-sdk-testing.d.ts +6 -0
- package/bundled-types/bb-plugin-sdk.d.ts +250 -23
- package/dist/app.js +139 -41
- package/dist/internal/plugin-app-collector.js +11 -0
- package/dist/testing/app.js +94 -0
- package/dist/testing/index.js +18 -0
- package/package.json +1 -1
package/dist/app.js
CHANGED
|
@@ -1,45 +1,139 @@
|
|
|
1
1
|
// src/app.ts
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
var
|
|
35
|
-
var
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
var
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
2
|
+
function runtimeHost() {
|
|
3
|
+
return globalThis.__bbPluginRuntime;
|
|
4
|
+
}
|
|
5
|
+
function installedApp() {
|
|
6
|
+
return runtimeHost()?.pluginSdkApp;
|
|
7
|
+
}
|
|
8
|
+
function runtimeMember(name) {
|
|
9
|
+
const member = installedApp()?.[name];
|
|
10
|
+
if (member === void 0) {
|
|
11
|
+
throw new Error(
|
|
12
|
+
`@get-bb/plugin-sdk/app: ${name} needs the bb app's plugin runtime. In tests, call installTestPluginRuntime() from @get-bb/plugin-sdk/testing/app first.`
|
|
13
|
+
);
|
|
14
|
+
}
|
|
15
|
+
return member;
|
|
16
|
+
}
|
|
17
|
+
function runtimeFunction(name) {
|
|
18
|
+
const forward = (...args) => runtimeMember(name)(...args);
|
|
19
|
+
return forward;
|
|
20
|
+
}
|
|
21
|
+
function runtimeComponent(name) {
|
|
22
|
+
function RuntimeComponent(props) {
|
|
23
|
+
const react = runtimeHost()?.react;
|
|
24
|
+
if (react === void 0) {
|
|
25
|
+
throw new Error(
|
|
26
|
+
`@get-bb/plugin-sdk/app: ${name} needs React on the bb plugin runtime. In tests, call installTestPluginRuntime() from @get-bb/plugin-sdk/testing/app first.`
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
return react.createElement(runtimeMember(name), props);
|
|
30
|
+
}
|
|
31
|
+
RuntimeComponent.displayName = name;
|
|
32
|
+
return RuntimeComponent;
|
|
33
|
+
}
|
|
34
|
+
var experimental_Icon = runtimeComponent("experimental_Icon");
|
|
35
|
+
var experimental_ProviderIcon = runtimeComponent(
|
|
36
|
+
"experimental_ProviderIcon"
|
|
37
|
+
);
|
|
38
|
+
var definePluginApp = (setup) => {
|
|
39
|
+
const app = installedApp();
|
|
40
|
+
if (app?.definePluginApp !== void 0) return app.definePluginApp(setup);
|
|
41
|
+
if (typeof setup !== "function") {
|
|
42
|
+
throw new Error("definePluginApp expects a setup function");
|
|
43
|
+
}
|
|
44
|
+
return Object.freeze({ __bbPluginApp: true, setup });
|
|
45
|
+
};
|
|
46
|
+
var ThreadChat = runtimeComponent("ThreadChat");
|
|
47
|
+
var Markdown = runtimeComponent("Markdown");
|
|
48
|
+
var experimental_FileLink = runtimeComponent("experimental_FileLink");
|
|
49
|
+
var UrlLink = runtimeComponent("UrlLink");
|
|
50
|
+
var experimental_NewThreadComposer = runtimeComponent(
|
|
51
|
+
"experimental_NewThreadComposer"
|
|
52
|
+
);
|
|
53
|
+
var experimental_ProviderModelPicker = runtimeComponent(
|
|
54
|
+
"experimental_ProviderModelPicker"
|
|
55
|
+
);
|
|
56
|
+
var experimental_PermissionModePicker = runtimeComponent(
|
|
57
|
+
"experimental_PermissionModePicker"
|
|
58
|
+
);
|
|
59
|
+
var experimental_BranchPicker = runtimeComponent(
|
|
60
|
+
"experimental_BranchPicker"
|
|
61
|
+
);
|
|
62
|
+
var experimental_useBranches = runtimeFunction(
|
|
63
|
+
"experimental_useBranches"
|
|
64
|
+
);
|
|
65
|
+
var experimental_useCheckoutState = runtimeFunction(
|
|
66
|
+
"experimental_useCheckoutState"
|
|
67
|
+
);
|
|
68
|
+
var experimental_SourceCode = runtimeComponent(
|
|
69
|
+
"experimental_SourceCode"
|
|
70
|
+
);
|
|
71
|
+
var experimental_Diff = runtimeComponent("experimental_Diff");
|
|
72
|
+
var useRpc = runtimeFunction("useRpc");
|
|
73
|
+
var useRealtime = runtimeFunction("useRealtime");
|
|
74
|
+
var useRealtimeConnectionState = runtimeFunction(
|
|
75
|
+
"useRealtimeConnectionState"
|
|
76
|
+
);
|
|
77
|
+
var useSettings = runtimeFunction("useSettings");
|
|
78
|
+
var useBbContext = runtimeFunction("useBbContext");
|
|
79
|
+
var experimental_usePluginId = runtimeFunction(
|
|
80
|
+
"experimental_usePluginId"
|
|
81
|
+
);
|
|
82
|
+
var useBbNavigate = runtimeFunction("useBbNavigate");
|
|
83
|
+
var experimental_useAppPanel = runtimeFunction(
|
|
84
|
+
"experimental_useAppPanel"
|
|
85
|
+
);
|
|
86
|
+
var experimental_useFixedTabTarget = runtimeFunction(
|
|
87
|
+
"experimental_useFixedTabTarget"
|
|
88
|
+
);
|
|
89
|
+
var useComposer = runtimeFunction("useComposer");
|
|
90
|
+
var useComposerView = runtimeFunction("useComposerView");
|
|
91
|
+
var experimental_useSidebarThreads = runtimeFunction(
|
|
92
|
+
"experimental_useSidebarThreads"
|
|
93
|
+
);
|
|
94
|
+
var experimental_useSidebarThreadActions = runtimeFunction(
|
|
95
|
+
"experimental_useSidebarThreadActions"
|
|
96
|
+
);
|
|
97
|
+
var experimental_useSidebarThreadPullRequest = runtimeFunction(
|
|
98
|
+
"experimental_useSidebarThreadPullRequest"
|
|
99
|
+
);
|
|
100
|
+
var experimental_useSidebarThreadSplit = runtimeFunction(
|
|
101
|
+
"experimental_useSidebarThreadSplit"
|
|
102
|
+
);
|
|
103
|
+
var experimental_useSidebarNavigation = runtimeFunction(
|
|
104
|
+
"experimental_useSidebarNavigation"
|
|
105
|
+
);
|
|
106
|
+
var experimental_useSidebarNavigationSplit = runtimeFunction(
|
|
107
|
+
"experimental_useSidebarNavigationSplit"
|
|
108
|
+
);
|
|
109
|
+
var experimental_SidebarNavigationIcon = runtimeComponent(
|
|
110
|
+
"experimental_SidebarNavigationIcon"
|
|
111
|
+
);
|
|
112
|
+
var useSidebarThreadDraft = runtimeFunction("useSidebarThreadDraft");
|
|
113
|
+
var useSidebarThreadDraftIds = runtimeFunction(
|
|
114
|
+
"useSidebarThreadDraftIds"
|
|
115
|
+
);
|
|
116
|
+
var useSidebarThreadRowStatus = runtimeFunction(
|
|
117
|
+
"useSidebarThreadRowStatus"
|
|
118
|
+
);
|
|
119
|
+
var useSidebarThreadRowStatuses = runtimeFunction(
|
|
120
|
+
"useSidebarThreadRowStatuses"
|
|
121
|
+
);
|
|
122
|
+
var useSidebarSplitLayout = runtimeFunction("useSidebarSplitLayout");
|
|
123
|
+
var useSidebarThreadShortcut = runtimeFunction(
|
|
124
|
+
"useSidebarThreadShortcut"
|
|
125
|
+
);
|
|
126
|
+
var ThreadTitle = runtimeComponent("ThreadTitle");
|
|
127
|
+
var useEnvironmentProviders = runtimeFunction(
|
|
128
|
+
"useEnvironmentProviders"
|
|
129
|
+
);
|
|
130
|
+
var useSdk = runtimeFunction("useSdk");
|
|
131
|
+
var experimental_useProviders = runtimeFunction(
|
|
132
|
+
"experimental_useProviders"
|
|
133
|
+
);
|
|
134
|
+
var experimental_useCodeTheme = runtimeFunction(
|
|
135
|
+
"experimental_useCodeTheme"
|
|
136
|
+
);
|
|
43
137
|
export {
|
|
44
138
|
Markdown,
|
|
45
139
|
ThreadChat,
|
|
@@ -54,13 +148,17 @@ export {
|
|
|
54
148
|
experimental_PermissionModePicker,
|
|
55
149
|
experimental_ProviderIcon,
|
|
56
150
|
experimental_ProviderModelPicker,
|
|
151
|
+
experimental_SidebarNavigationIcon,
|
|
57
152
|
experimental_SourceCode,
|
|
58
153
|
experimental_useAppPanel,
|
|
59
154
|
experimental_useBranches,
|
|
60
155
|
experimental_useCheckoutState,
|
|
61
156
|
experimental_useCodeTheme,
|
|
62
157
|
experimental_useFixedTabTarget,
|
|
158
|
+
experimental_usePluginId,
|
|
63
159
|
experimental_useProviders,
|
|
160
|
+
experimental_useSidebarNavigation,
|
|
161
|
+
experimental_useSidebarNavigationSplit,
|
|
64
162
|
experimental_useSidebarThreadActions,
|
|
65
163
|
experimental_useSidebarThreadPullRequest,
|
|
66
164
|
experimental_useSidebarThreadSplit,
|
|
@@ -446,6 +446,7 @@ function collectPluginAppRegistrations(definition, onComposerCustomizationReject
|
|
|
446
446
|
sidebarFooterActions: [],
|
|
447
447
|
experimentalSidebarFooterItems: [],
|
|
448
448
|
experimentalSidebarNavigations: [],
|
|
449
|
+
experimentalSidebarHeaders: [],
|
|
449
450
|
threadLists: [],
|
|
450
451
|
threadHeaderActions: [],
|
|
451
452
|
browserToolbarActions: [],
|
|
@@ -474,6 +475,7 @@ function collectPluginAppRegistrations(definition, onComposerCustomizationReject
|
|
|
474
475
|
pendingInteraction: /* @__PURE__ */ new Set(),
|
|
475
476
|
sidebarFooterItem: /* @__PURE__ */ new Set(),
|
|
476
477
|
sidebarNavigation: /* @__PURE__ */ new Set(),
|
|
478
|
+
sidebarHeader: /* @__PURE__ */ new Set(),
|
|
477
479
|
threadList: /* @__PURE__ */ new Set(),
|
|
478
480
|
threadHeaderAction: /* @__PURE__ */ new Set(),
|
|
479
481
|
browserToolbarAction: /* @__PURE__ */ new Set(),
|
|
@@ -683,6 +685,15 @@ function collectPluginAppRegistrations(definition, onComposerCustomizationReject
|
|
|
683
685
|
)
|
|
684
686
|
);
|
|
685
687
|
},
|
|
688
|
+
experimental_sidebarHeader(registration) {
|
|
689
|
+
collected.experimentalSidebarHeaders.push(
|
|
690
|
+
collectTitledComponent(
|
|
691
|
+
"slots.experimental_sidebarHeader",
|
|
692
|
+
seenIds.sidebarHeader,
|
|
693
|
+
registration
|
|
694
|
+
)
|
|
695
|
+
);
|
|
696
|
+
},
|
|
686
697
|
experimental_threadList(registration) {
|
|
687
698
|
collected.threadLists.push(
|
|
688
699
|
collectTitledComponent(
|
package/dist/testing/app.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
// src/testing/app.tsx
|
|
2
|
+
import * as React from "react";
|
|
2
3
|
import {
|
|
3
4
|
createContext,
|
|
4
5
|
useContext,
|
|
@@ -620,6 +621,7 @@ function collectPluginAppRegistrations(definition, onComposerCustomizationReject
|
|
|
620
621
|
sidebarFooterActions: [],
|
|
621
622
|
experimentalSidebarFooterItems: [],
|
|
622
623
|
experimentalSidebarNavigations: [],
|
|
624
|
+
experimentalSidebarHeaders: [],
|
|
623
625
|
threadLists: [],
|
|
624
626
|
threadHeaderActions: [],
|
|
625
627
|
browserToolbarActions: [],
|
|
@@ -648,6 +650,7 @@ function collectPluginAppRegistrations(definition, onComposerCustomizationReject
|
|
|
648
650
|
pendingInteraction: /* @__PURE__ */ new Set(),
|
|
649
651
|
sidebarFooterItem: /* @__PURE__ */ new Set(),
|
|
650
652
|
sidebarNavigation: /* @__PURE__ */ new Set(),
|
|
653
|
+
sidebarHeader: /* @__PURE__ */ new Set(),
|
|
651
654
|
threadList: /* @__PURE__ */ new Set(),
|
|
652
655
|
threadHeaderAction: /* @__PURE__ */ new Set(),
|
|
653
656
|
browserToolbarAction: /* @__PURE__ */ new Set(),
|
|
@@ -857,6 +860,15 @@ function collectPluginAppRegistrations(definition, onComposerCustomizationReject
|
|
|
857
860
|
)
|
|
858
861
|
);
|
|
859
862
|
},
|
|
863
|
+
experimental_sidebarHeader(registration) {
|
|
864
|
+
collected.experimentalSidebarHeaders.push(
|
|
865
|
+
collectTitledComponent(
|
|
866
|
+
"slots.experimental_sidebarHeader",
|
|
867
|
+
seenIds.sidebarHeader,
|
|
868
|
+
registration
|
|
869
|
+
)
|
|
870
|
+
);
|
|
871
|
+
},
|
|
860
872
|
experimental_threadList(registration) {
|
|
861
873
|
collected.threadLists.push(
|
|
862
874
|
collectTitledComponent(
|
|
@@ -1100,6 +1112,19 @@ function TestThreadTitle({ threadId }) {
|
|
|
1100
1112
|
if (thread === void 0) return null;
|
|
1101
1113
|
return /* @__PURE__ */ jsx("span", { "data-thread-title": threadId, children: thread.displayTitle });
|
|
1102
1114
|
}
|
|
1115
|
+
function TestSidebarNavigationIcon({
|
|
1116
|
+
icon,
|
|
1117
|
+
className
|
|
1118
|
+
}) {
|
|
1119
|
+
return /* @__PURE__ */ jsx(
|
|
1120
|
+
"span",
|
|
1121
|
+
{
|
|
1122
|
+
"aria-hidden": "true",
|
|
1123
|
+
className,
|
|
1124
|
+
"data-sidebar-navigation-icon": icon.kind === "host" ? icon.name : `${icon.pluginId}/${icon.icon ?? ""}`
|
|
1125
|
+
}
|
|
1126
|
+
);
|
|
1127
|
+
}
|
|
1103
1128
|
function SlotLifecycleGuard({
|
|
1104
1129
|
children,
|
|
1105
1130
|
onUnmount
|
|
@@ -1550,6 +1575,9 @@ var testPluginSdkApp = {
|
|
|
1550
1575
|
useBbContext() {
|
|
1551
1576
|
return useSlotEnv("useBbContext").bbContext;
|
|
1552
1577
|
},
|
|
1578
|
+
experimental_usePluginId() {
|
|
1579
|
+
return useSlotEnv("experimental_usePluginId").pluginId;
|
|
1580
|
+
},
|
|
1553
1581
|
useBbNavigate() {
|
|
1554
1582
|
return useSlotEnv("useBbNavigate").navigate;
|
|
1555
1583
|
},
|
|
@@ -1679,6 +1707,28 @@ var testPluginSdkApp = {
|
|
|
1679
1707
|
return env.sidebarShortcuts.get(threadId) ?? null;
|
|
1680
1708
|
},
|
|
1681
1709
|
ThreadTitle: TestThreadTitle,
|
|
1710
|
+
experimental_useSidebarNavigation() {
|
|
1711
|
+
return useSlotEnv("experimental_useSidebarNavigation").sidebarNavigation;
|
|
1712
|
+
},
|
|
1713
|
+
experimental_useSidebarNavigationSplit(itemId, _options) {
|
|
1714
|
+
const env = useSlotEnv("experimental_useSidebarNavigationSplit");
|
|
1715
|
+
return useMemo(
|
|
1716
|
+
() => ({
|
|
1717
|
+
splitProps: {
|
|
1718
|
+
onPointerDown: () => {
|
|
1719
|
+
env.sidebarNavigationCalls.push({
|
|
1720
|
+
method: "beginSplitDrag",
|
|
1721
|
+
itemId
|
|
1722
|
+
});
|
|
1723
|
+
}
|
|
1724
|
+
},
|
|
1725
|
+
isAvailable: true,
|
|
1726
|
+
layout: null
|
|
1727
|
+
}),
|
|
1728
|
+
[env, itemId]
|
|
1729
|
+
);
|
|
1730
|
+
},
|
|
1731
|
+
experimental_SidebarNavigationIcon: TestSidebarNavigationIcon,
|
|
1682
1732
|
useEnvironmentProviders() {
|
|
1683
1733
|
return useSlotEnv("useEnvironmentProviders").environmentProviders;
|
|
1684
1734
|
},
|
|
@@ -1722,6 +1772,7 @@ function installTestPluginRuntime() {
|
|
|
1722
1772
|
const host = globalThis;
|
|
1723
1773
|
host.__bbPluginRuntime = {
|
|
1724
1774
|
...host.__bbPluginRuntime,
|
|
1775
|
+
react: host.__bbPluginRuntime?.react ?? React,
|
|
1725
1776
|
pluginSdkApp: testPluginSdkApp
|
|
1726
1777
|
};
|
|
1727
1778
|
}
|
|
@@ -1868,6 +1919,7 @@ function strictJsonRoundTrip(value, label) {
|
|
|
1868
1919
|
return JSON.parse(JSON.stringify(value));
|
|
1869
1920
|
}
|
|
1870
1921
|
function renderSlot(registration, props, options = {}) {
|
|
1922
|
+
installTestPluginRuntime();
|
|
1871
1923
|
const rpcCalls = [];
|
|
1872
1924
|
const rpcHandlers = options.rpc ?? {};
|
|
1873
1925
|
const rpcClient = {
|
|
@@ -1965,6 +2017,43 @@ function renderSlot(registration, props, options = {}) {
|
|
|
1965
2017
|
}
|
|
1966
2018
|
};
|
|
1967
2019
|
const sidebarActionCalls = [];
|
|
2020
|
+
const sidebarNavigationCalls = [];
|
|
2021
|
+
const sidebarNavigation = {
|
|
2022
|
+
items: options.sidebarNavigation?.items ?? [],
|
|
2023
|
+
activeItemId: options.sidebarNavigation?.activeItemId ?? null,
|
|
2024
|
+
isShortcutModifierHeld: options.sidebarNavigation?.isShortcutModifierHeld ?? false,
|
|
2025
|
+
actions: {
|
|
2026
|
+
activate(itemId, activationOptions) {
|
|
2027
|
+
sidebarNavigationCalls.push({
|
|
2028
|
+
method: "activate",
|
|
2029
|
+
itemId,
|
|
2030
|
+
openInSplit: activationOptions.openInSplit
|
|
2031
|
+
});
|
|
2032
|
+
},
|
|
2033
|
+
setVisible(itemId, isVisible) {
|
|
2034
|
+
sidebarNavigationCalls.push({
|
|
2035
|
+
method: "setVisible",
|
|
2036
|
+
itemId,
|
|
2037
|
+
isVisible
|
|
2038
|
+
});
|
|
2039
|
+
},
|
|
2040
|
+
setOrder(itemIds) {
|
|
2041
|
+
sidebarNavigationCalls.push({
|
|
2042
|
+
method: "setOrder",
|
|
2043
|
+
itemIds: [...itemIds]
|
|
2044
|
+
});
|
|
2045
|
+
},
|
|
2046
|
+
openCustomize() {
|
|
2047
|
+
sidebarNavigationCalls.push({ method: "openCustomize" });
|
|
2048
|
+
},
|
|
2049
|
+
openDetails(itemId) {
|
|
2050
|
+
sidebarNavigationCalls.push({ method: "openDetails", itemId });
|
|
2051
|
+
},
|
|
2052
|
+
async disablePlugin(itemId) {
|
|
2053
|
+
sidebarNavigationCalls.push({ method: "disablePlugin", itemId });
|
|
2054
|
+
}
|
|
2055
|
+
}
|
|
2056
|
+
};
|
|
1968
2057
|
const sidebarPullRequests = new Map(
|
|
1969
2058
|
Object.entries(options.sidebarPullRequests ?? {})
|
|
1970
2059
|
);
|
|
@@ -2220,6 +2309,7 @@ ${block}
|
|
|
2220
2309
|
realtimeConnection,
|
|
2221
2310
|
settingsState: { values: options.settings, isLoading: false },
|
|
2222
2311
|
bbContext: { projectId, threadId },
|
|
2312
|
+
pluginId: options.pluginId ?? "test-plugin",
|
|
2223
2313
|
navigate,
|
|
2224
2314
|
navigateCalls,
|
|
2225
2315
|
appPanel,
|
|
@@ -2235,6 +2325,8 @@ ${block}
|
|
|
2235
2325
|
sidebarRowStatuses,
|
|
2236
2326
|
sidebarShortcuts,
|
|
2237
2327
|
sidebarSplitLayout: options.sidebarSplitLayout ?? null,
|
|
2328
|
+
sidebarNavigation,
|
|
2329
|
+
sidebarNavigationCalls,
|
|
2238
2330
|
environmentProviders,
|
|
2239
2331
|
sdk,
|
|
2240
2332
|
sdkCalls,
|
|
@@ -2306,6 +2398,7 @@ ${block}
|
|
|
2306
2398
|
navigateCalls,
|
|
2307
2399
|
experimental_fixedTabOpenCalls,
|
|
2308
2400
|
sidebarActionCalls,
|
|
2401
|
+
sidebarNavigationCalls,
|
|
2309
2402
|
sdkCalls,
|
|
2310
2403
|
composer: composerLog,
|
|
2311
2404
|
behavior: {
|
|
@@ -2319,6 +2412,7 @@ ${block}
|
|
|
2319
2412
|
navigateCalls,
|
|
2320
2413
|
experimental_fixedTabOpenCalls,
|
|
2321
2414
|
sidebarActionCalls,
|
|
2415
|
+
sidebarNavigationCalls,
|
|
2322
2416
|
sdkCalls,
|
|
2323
2417
|
composer: composerLog
|
|
2324
2418
|
},
|
package/dist/testing/index.js
CHANGED
|
@@ -3360,6 +3360,7 @@ function createFakePluginHostInternal(options, sharedState) {
|
|
|
3360
3360
|
const machineProviders = /* @__PURE__ */ new Map();
|
|
3361
3361
|
const serverAccessProviders = /* @__PURE__ */ new Map();
|
|
3362
3362
|
const disposeHooks = [];
|
|
3363
|
+
const installHandlers = [];
|
|
3363
3364
|
const serviceControllers = [];
|
|
3364
3365
|
let nextInteractionId = 1;
|
|
3365
3366
|
const pendingInteractions = /* @__PURE__ */ new Map();
|
|
@@ -3685,6 +3686,13 @@ function createFakePluginHostInternal(options, sharedState) {
|
|
|
3685
3686
|
onDispose(hook) {
|
|
3686
3687
|
assertLive();
|
|
3687
3688
|
disposeHooks.push(hook);
|
|
3689
|
+
},
|
|
3690
|
+
onInstall(handler) {
|
|
3691
|
+
assertLive();
|
|
3692
|
+
if (typeof handler !== "function") {
|
|
3693
|
+
throw new Error("onInstall expects a function");
|
|
3694
|
+
}
|
|
3695
|
+
installHandlers.push(handler);
|
|
3688
3696
|
}
|
|
3689
3697
|
};
|
|
3690
3698
|
async function disposeHost(cleanupStorage) {
|
|
@@ -4223,6 +4231,16 @@ function createFakePluginHostInternal(options, sharedState) {
|
|
|
4223
4231
|
},
|
|
4224
4232
|
async dispose() {
|
|
4225
4233
|
await disposeHost(true);
|
|
4234
|
+
},
|
|
4235
|
+
async install() {
|
|
4236
|
+
assertLive();
|
|
4237
|
+
for (const handler of [...installHandlers]) {
|
|
4238
|
+
try {
|
|
4239
|
+
await handler();
|
|
4240
|
+
} catch (error) {
|
|
4241
|
+
emitLog("warn", `install handler failed: ${errorMessage(error)}`);
|
|
4242
|
+
}
|
|
4243
|
+
}
|
|
4226
4244
|
}
|
|
4227
4245
|
};
|
|
4228
4246
|
fakeHostDisposers.set(harness, disposeHost);
|