@lvce-editor/test-worker 14.19.0 → 14.21.0
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/dist/api.d.ts +3 -0
- package/dist/testWorkerMain.js +40 -14
- package/package.json +1 -1
package/dist/api.d.ts
CHANGED
|
@@ -160,6 +160,8 @@ export type MockRequestInput = ToolCallItem | TextItem;
|
|
|
160
160
|
|
|
161
161
|
export type ChatDebugInputName = "closeDetails" | "eventCategoryFilter" | "filter" | "showEventStreamFinishedEvents" | "showInputEvents" | "showResponsePartEvents" | "timelineRangePreset" | "useDevtoolsLayout";
|
|
162
162
|
|
|
163
|
+
export type ChatDebugCategoryId = "tools" | "network";
|
|
164
|
+
|
|
163
165
|
export type TokenRow = readonly string[];
|
|
164
166
|
|
|
165
167
|
export type LayoutDirection = "horizontal" | "vertical" | number;
|
|
@@ -299,6 +301,7 @@ interface ChatDebug {
|
|
|
299
301
|
readonly appendStoredEventForTest: (event: any) => Promise<void>;
|
|
300
302
|
readonly closeDetails: () => Promise<void>;
|
|
301
303
|
readonly handleClickRefresh: () => Promise<void>;
|
|
304
|
+
readonly handleEventCategoryFilter: (filter: ChatDebugCategoryId) => Promise<void>;
|
|
302
305
|
readonly handleHeaderContextMenu: (x: number, y: number) => Promise<void>;
|
|
303
306
|
readonly handleInput: (name: ChatDebugInputName, value: string, checked: boolean) => Promise<void>;
|
|
304
307
|
readonly handlePreviewTextPointerDown: (x: number, y: number) => Promise<void>;
|
package/dist/testWorkerMain.js
CHANGED
|
@@ -1091,7 +1091,7 @@ const createMockRpc = ({
|
|
|
1091
1091
|
};
|
|
1092
1092
|
|
|
1093
1093
|
const rpcs = Object.create(null);
|
|
1094
|
-
const set$
|
|
1094
|
+
const set$6 = (id, rpc) => {
|
|
1095
1095
|
rpcs[id] = rpc;
|
|
1096
1096
|
};
|
|
1097
1097
|
const get$2 = id => {
|
|
@@ -1124,7 +1124,7 @@ const create = rpcId => {
|
|
|
1124
1124
|
const mockRpc = createMockRpc({
|
|
1125
1125
|
commandMap
|
|
1126
1126
|
});
|
|
1127
|
-
set$
|
|
1127
|
+
set$6(rpcId, mockRpc);
|
|
1128
1128
|
// @ts-ignore
|
|
1129
1129
|
mockRpc[Symbol.dispose] = () => {
|
|
1130
1130
|
remove$1(rpcId);
|
|
@@ -1133,7 +1133,7 @@ const create = rpcId => {
|
|
|
1133
1133
|
return mockRpc;
|
|
1134
1134
|
},
|
|
1135
1135
|
set(rpc) {
|
|
1136
|
-
set$
|
|
1136
|
+
set$6(rpcId, rpc);
|
|
1137
1137
|
}
|
|
1138
1138
|
};
|
|
1139
1139
|
};
|
|
@@ -1146,14 +1146,20 @@ const Web = 1;
|
|
|
1146
1146
|
const Remote = 3;
|
|
1147
1147
|
|
|
1148
1148
|
const EditorWorker = 99;
|
|
1149
|
+
const ExtensionManagementWorker = 9006;
|
|
1149
1150
|
const OpenerWorker = 4561;
|
|
1150
1151
|
const RendererWorker = 1;
|
|
1151
1152
|
const TestWorker = 9001;
|
|
1152
1153
|
|
|
1154
|
+
const {
|
|
1155
|
+
invoke: invoke$3,
|
|
1156
|
+
set: set$5
|
|
1157
|
+
} = create(EditorWorker);
|
|
1158
|
+
|
|
1153
1159
|
const {
|
|
1154
1160
|
invoke: invoke$2,
|
|
1155
1161
|
set: set$4
|
|
1156
|
-
} = create(
|
|
1162
|
+
} = create(ExtensionManagementWorker);
|
|
1157
1163
|
|
|
1158
1164
|
const {
|
|
1159
1165
|
invoke: invoke$1,
|
|
@@ -1176,14 +1182,29 @@ const sendMessagePortToOpenerWorker = async (port, rpcId) => {
|
|
|
1176
1182
|
const readFile$1 = async uri => {
|
|
1177
1183
|
return invoke('FileSystem.readFile', uri);
|
|
1178
1184
|
};
|
|
1185
|
+
const sendMessagePortToExtensionManagementWorker = async (port, rpcId) => {
|
|
1186
|
+
const command = 'Extensions.handleMessagePort';
|
|
1187
|
+
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToExtensionManagementWorker', port, command, rpcId);
|
|
1188
|
+
};
|
|
1179
1189
|
const getPreference = async key => {
|
|
1180
1190
|
return await invoke('Preferences.get', key);
|
|
1181
1191
|
};
|
|
1182
1192
|
|
|
1183
|
-
const send$
|
|
1193
|
+
const send$2 = async port => {
|
|
1184
1194
|
await sendMessagePortToEditorWorker(port, TestWorker);
|
|
1185
1195
|
};
|
|
1186
1196
|
const initializeEditorWorker = async () => {
|
|
1197
|
+
const rpc = await create$3({
|
|
1198
|
+
commandMap: {},
|
|
1199
|
+
send: send$2
|
|
1200
|
+
});
|
|
1201
|
+
set$5(rpc);
|
|
1202
|
+
};
|
|
1203
|
+
|
|
1204
|
+
const send$1 = async port => {
|
|
1205
|
+
await sendMessagePortToExtensionManagementWorker(port, TestWorker);
|
|
1206
|
+
};
|
|
1207
|
+
const initializeExtensionManagementWorker = async () => {
|
|
1187
1208
|
const rpc = await create$3({
|
|
1188
1209
|
commandMap: {},
|
|
1189
1210
|
send: send$1
|
|
@@ -2361,6 +2382,9 @@ const appendStoredEventForTest = async event => {
|
|
|
2361
2382
|
const handleClickRefresh = async () => {
|
|
2362
2383
|
await invoke('ChatDebug.handleClickRefresh');
|
|
2363
2384
|
};
|
|
2385
|
+
const handleEventCategoryFilter = async filter => {
|
|
2386
|
+
await invoke('ChatDebug.handleEventCategoryFilter', filter);
|
|
2387
|
+
};
|
|
2364
2388
|
const handleTableBodyContextMenu = async (x, y) => {
|
|
2365
2389
|
await invoke('ChatDebug.handleTableBodyContextMenu', x, y);
|
|
2366
2390
|
};
|
|
@@ -2369,6 +2393,7 @@ const ChatDebug = {
|
|
|
2369
2393
|
appendStoredEventForTest,
|
|
2370
2394
|
closeDetails,
|
|
2371
2395
|
handleClickRefresh,
|
|
2396
|
+
handleEventCategoryFilter,
|
|
2372
2397
|
handleHeaderContextMenu,
|
|
2373
2398
|
handleInput: handleInput$7,
|
|
2374
2399
|
handlePreviewTextPointerDown,
|
|
@@ -2760,7 +2785,7 @@ const areSelectionsEqual = (a, b) => {
|
|
|
2760
2785
|
};
|
|
2761
2786
|
|
|
2762
2787
|
const getEditorKey = async () => {
|
|
2763
|
-
const keys = await invoke$
|
|
2788
|
+
const keys = await invoke$3('Editor.getKeys');
|
|
2764
2789
|
if (keys.length === 0) {
|
|
2765
2790
|
throw new Error(`no editor found`);
|
|
2766
2791
|
}
|
|
@@ -3026,11 +3051,11 @@ const growSelection = async () => {
|
|
|
3026
3051
|
};
|
|
3027
3052
|
const getSelections = async () => {
|
|
3028
3053
|
const key = await getEditorKey();
|
|
3029
|
-
return invoke$
|
|
3054
|
+
return invoke$3('Editor.getSelections', key);
|
|
3030
3055
|
};
|
|
3031
3056
|
const shouldHaveText = async expectedText => {
|
|
3032
3057
|
const key = await getEditorKey();
|
|
3033
|
-
const text = await invoke$
|
|
3058
|
+
const text = await invoke$3('Editor.getText', key);
|
|
3034
3059
|
if (text !== expectedText) {
|
|
3035
3060
|
throw new Error(`Expected editor to have text ${expectedText} but was ${text}`);
|
|
3036
3061
|
}
|
|
@@ -3055,7 +3080,7 @@ const areTokensEqual = (actual, expected) => {
|
|
|
3055
3080
|
};
|
|
3056
3081
|
const shouldHaveTokens = async expectedTokens => {
|
|
3057
3082
|
const key = await getEditorKey();
|
|
3058
|
-
const text = await invoke$
|
|
3083
|
+
const text = await invoke$3('Editor.getTokens', key);
|
|
3059
3084
|
if (!areTokensEqual(text, expectedTokens)) {
|
|
3060
3085
|
const stringifiedActual = JSON.stringify(text);
|
|
3061
3086
|
const stringifiedExpected = JSON.stringify(expectedTokens);
|
|
@@ -3064,20 +3089,20 @@ const shouldHaveTokens = async expectedTokens => {
|
|
|
3064
3089
|
};
|
|
3065
3090
|
const shouldHaveSelections = async expectedSelections => {
|
|
3066
3091
|
const key = await getEditorKey();
|
|
3067
|
-
const selections = await invoke$
|
|
3092
|
+
const selections = await invoke$3('Editor.getSelections', key);
|
|
3068
3093
|
if (!areSelectionsEqual(selections, expectedSelections)) {
|
|
3069
3094
|
throw new Error(`Expected editor to have selections ${expectedSelections} but was ${selections}`);
|
|
3070
3095
|
}
|
|
3071
3096
|
};
|
|
3072
3097
|
const undo = async () => {
|
|
3073
|
-
await invoke$
|
|
3098
|
+
await invoke$3('Editor.undo');
|
|
3074
3099
|
};
|
|
3075
3100
|
const redo = async () => {
|
|
3076
|
-
await invoke$
|
|
3101
|
+
await invoke$3('Editor.redo');
|
|
3077
3102
|
};
|
|
3078
3103
|
const shouldHaveDiagnostics = async expectedDiagnostics => {
|
|
3079
3104
|
const key = await getEditorKey();
|
|
3080
|
-
const diagnostics = await invoke$
|
|
3105
|
+
const diagnostics = await invoke$3('Editor.getDiagnostics', key);
|
|
3081
3106
|
if (!areDiagnosticsEqual(diagnostics, expectedDiagnostics)) {
|
|
3082
3107
|
const stringifiedActual = JSON.stringify(diagnostics);
|
|
3083
3108
|
const stringifiedExpected = JSON.stringify(expectedDiagnostics);
|
|
@@ -3430,6 +3455,7 @@ const Explorer = {
|
|
|
3430
3455
|
const addWebExtension = async relativePath => {
|
|
3431
3456
|
// TODO compute absolutePath
|
|
3432
3457
|
const absolutePath = relativePath;
|
|
3458
|
+
await invoke$2('Extensions.addWebExtension', absolutePath);
|
|
3433
3459
|
await invoke('ExtensionMeta.addWebExtension', absolutePath);
|
|
3434
3460
|
};
|
|
3435
3461
|
const addNodeExtension = async relativePath => {
|
|
@@ -5581,7 +5607,7 @@ const initializeRendererWorker = async () => {
|
|
|
5581
5607
|
};
|
|
5582
5608
|
|
|
5583
5609
|
const listen = async () => {
|
|
5584
|
-
await Promise.all([initializeRendererWorker(), initializeEditorWorker(), initializeOpenerWorker()]);
|
|
5610
|
+
await Promise.all([initializeRendererWorker(), initializeEditorWorker(), initializeOpenerWorker(), initializeExtensionManagementWorker()]);
|
|
5585
5611
|
};
|
|
5586
5612
|
|
|
5587
5613
|
const main = async () => {
|