@lvce-editor/test-worker 3.20.0 → 3.22.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 +4 -3
- package/dist/testWorkerMain.js +138 -43
- package/package.json +1 -1
package/dist/api.d.ts
CHANGED
|
@@ -141,6 +141,7 @@ declare const focusNext$5: () => Promise<void>;
|
|
|
141
141
|
declare const focusIndex$1: (index: number) => Promise<void>;
|
|
142
142
|
declare const focusPrevious$3: () => Promise<void>;
|
|
143
143
|
declare const selectItem$1: (label: string) => Promise<void>;
|
|
144
|
+
declare const selectIndex$1: (index: number) => Promise<void>;
|
|
144
145
|
declare const executeCommand: (label: string) => Promise<void>;
|
|
145
146
|
declare const setValue$2: (value: string) => Promise<void>;
|
|
146
147
|
declare const setReplaceValue: (value: string) => Promise<void>;
|
|
@@ -151,7 +152,7 @@ declare const clearSearchResults: () => Promise<void>;
|
|
|
151
152
|
declare const dismissItem: () => Promise<void>;
|
|
152
153
|
declare const focusFirst$3: () => Promise<void>;
|
|
153
154
|
declare const focusIndex$2: (index: number) => Promise<void>;
|
|
154
|
-
declare const selectIndex$
|
|
155
|
+
declare const selectIndex$2: (index: number) => Promise<void>;
|
|
155
156
|
declare const focusNext$6: () => Promise<void>;
|
|
156
157
|
declare const handleWheel$1: (deltaMode: number, deltaY: number) => Promise<void>;
|
|
157
158
|
declare const focusNextPage: () => Promise<void>;
|
|
@@ -250,10 +251,10 @@ declare namespace Problems {
|
|
|
250
251
|
export { show$1 as show };
|
|
251
252
|
}
|
|
252
253
|
declare namespace QuickPick {
|
|
253
|
-
export { executeCommand, focusIndex$1 as focusIndex, focusNext$5 as focusNext, focusPrevious$3 as focusPrevious, open$3 as open, selectItem$1 as selectItem, setValue$1 as setValue };
|
|
254
|
+
export { executeCommand, focusIndex$1 as focusIndex, focusNext$5 as focusNext, focusPrevious$3 as focusPrevious, open$3 as open, selectIndex$1 as selectIndex, selectItem$1 as selectItem, setValue$1 as setValue };
|
|
254
255
|
}
|
|
255
256
|
declare namespace Search {
|
|
256
|
-
export { clearSearchResults, dismissItem, focusFirst$3 as focusFirst, focusIndex$2 as focusIndex, focusNext$6 as focusNext, focusNextPage, focusPrevious$4 as focusPrevious, focusPreviousPage, handleWheel$1 as handleWheel, replaceAll, selectIndex$
|
|
257
|
+
export { clearSearchResults, dismissItem, focusFirst$3 as focusFirst, focusIndex$2 as focusIndex, focusNext$6 as focusNext, focusNextPage, focusPrevious$4 as focusPrevious, focusPreviousPage, handleWheel$1 as handleWheel, replaceAll, selectIndex$2 as selectIndex, setExcludeValue, setIncludeValue, setReplaceValue, setValue$2 as setValue, toggleMatchCase, toggleMatchWholeWord, togglePreserveCase, toggleReplace, toggleSearchDetails, toggleUseRegularExpression };
|
|
257
258
|
}
|
|
258
259
|
declare namespace Settings {
|
|
259
260
|
export { update };
|
package/dist/testWorkerMain.js
CHANGED
|
@@ -420,6 +420,100 @@ const IpcChildWithModuleWorkerAndMessagePort$1 = {
|
|
|
420
420
|
listen: listen$6,
|
|
421
421
|
wrap: wrap$e
|
|
422
422
|
};
|
|
423
|
+
const addListener = (emitter, type, callback) => {
|
|
424
|
+
if ('addEventListener' in emitter) {
|
|
425
|
+
emitter.addEventListener(type, callback);
|
|
426
|
+
} else {
|
|
427
|
+
emitter.on(type, callback);
|
|
428
|
+
}
|
|
429
|
+
};
|
|
430
|
+
const removeListener = (emitter, type, callback) => {
|
|
431
|
+
if ('removeEventListener' in emitter) {
|
|
432
|
+
emitter.removeEventListener(type, callback);
|
|
433
|
+
} else {
|
|
434
|
+
emitter.off(type, callback);
|
|
435
|
+
}
|
|
436
|
+
};
|
|
437
|
+
const getFirstEvent = (eventEmitter, eventMap) => {
|
|
438
|
+
const {
|
|
439
|
+
resolve,
|
|
440
|
+
promise
|
|
441
|
+
} = withResolvers();
|
|
442
|
+
const listenerMap = Object.create(null);
|
|
443
|
+
const cleanup = value => {
|
|
444
|
+
for (const event of Object.keys(eventMap)) {
|
|
445
|
+
removeListener(eventEmitter, event, listenerMap[event]);
|
|
446
|
+
}
|
|
447
|
+
resolve(value);
|
|
448
|
+
};
|
|
449
|
+
for (const [event, type] of Object.entries(eventMap)) {
|
|
450
|
+
const listener = event => {
|
|
451
|
+
cleanup({
|
|
452
|
+
type,
|
|
453
|
+
event
|
|
454
|
+
});
|
|
455
|
+
};
|
|
456
|
+
addListener(eventEmitter, event, listener);
|
|
457
|
+
listenerMap[event] = listener;
|
|
458
|
+
}
|
|
459
|
+
return promise;
|
|
460
|
+
};
|
|
461
|
+
const Message$1 = 3;
|
|
462
|
+
const create$5$1 = async ({
|
|
463
|
+
messagePort,
|
|
464
|
+
isMessagePortOpen
|
|
465
|
+
}) => {
|
|
466
|
+
if (!isMessagePort(messagePort)) {
|
|
467
|
+
throw new IpcError('port must be of type MessagePort');
|
|
468
|
+
}
|
|
469
|
+
if (isMessagePortOpen) {
|
|
470
|
+
return messagePort;
|
|
471
|
+
}
|
|
472
|
+
const eventPromise = getFirstEvent(messagePort, {
|
|
473
|
+
message: Message$1
|
|
474
|
+
});
|
|
475
|
+
messagePort.start();
|
|
476
|
+
const {
|
|
477
|
+
type,
|
|
478
|
+
event
|
|
479
|
+
} = await eventPromise;
|
|
480
|
+
if (type !== Message$1) {
|
|
481
|
+
throw new IpcError('Failed to wait for ipc message');
|
|
482
|
+
}
|
|
483
|
+
if (event.data !== readyMessage) {
|
|
484
|
+
throw new IpcError('unexpected first message');
|
|
485
|
+
}
|
|
486
|
+
return messagePort;
|
|
487
|
+
};
|
|
488
|
+
const signal$1 = messagePort => {
|
|
489
|
+
messagePort.start();
|
|
490
|
+
};
|
|
491
|
+
class IpcParentWithMessagePort extends Ipc {
|
|
492
|
+
getData = getData$2;
|
|
493
|
+
send(message) {
|
|
494
|
+
this._rawIpc.postMessage(message);
|
|
495
|
+
}
|
|
496
|
+
sendAndTransfer(message) {
|
|
497
|
+
const transfer = getTransferrables(message);
|
|
498
|
+
this._rawIpc.postMessage(message, transfer);
|
|
499
|
+
}
|
|
500
|
+
dispose() {
|
|
501
|
+
this._rawIpc.close();
|
|
502
|
+
}
|
|
503
|
+
onMessage(callback) {
|
|
504
|
+
this._rawIpc.addEventListener('message', callback);
|
|
505
|
+
}
|
|
506
|
+
onClose(callback) {}
|
|
507
|
+
}
|
|
508
|
+
const wrap$5 = messagePort => {
|
|
509
|
+
return new IpcParentWithMessagePort(messagePort);
|
|
510
|
+
};
|
|
511
|
+
const IpcParentWithMessagePort$1 = {
|
|
512
|
+
__proto__: null,
|
|
513
|
+
create: create$5$1,
|
|
514
|
+
signal: signal$1,
|
|
515
|
+
wrap: wrap$5
|
|
516
|
+
};
|
|
423
517
|
|
|
424
518
|
const Two = '2.0';
|
|
425
519
|
const create$4 = (method, params) => {
|
|
@@ -774,7 +868,7 @@ const register = commandMap => {
|
|
|
774
868
|
const getCommand = key => {
|
|
775
869
|
return commands[key];
|
|
776
870
|
};
|
|
777
|
-
const execute$
|
|
871
|
+
const execute$2 = (command, ...args) => {
|
|
778
872
|
const fn = getCommand(command);
|
|
779
873
|
if (!fn) {
|
|
780
874
|
throw new Error(`command not found ${command}`);
|
|
@@ -801,19 +895,19 @@ const createRpc = ipc => {
|
|
|
801
895
|
};
|
|
802
896
|
return rpc;
|
|
803
897
|
};
|
|
804
|
-
const requiresSocket
|
|
898
|
+
const requiresSocket = () => {
|
|
805
899
|
return false;
|
|
806
900
|
};
|
|
807
|
-
const preparePrettyError
|
|
901
|
+
const preparePrettyError = error => {
|
|
808
902
|
return error;
|
|
809
903
|
};
|
|
810
|
-
const logError
|
|
904
|
+
const logError = () => {
|
|
811
905
|
// handled by renderer worker
|
|
812
906
|
};
|
|
813
907
|
const handleMessage = event => {
|
|
814
|
-
const actualRequiresSocket = event?.target?.requiresSocket || requiresSocket
|
|
815
|
-
const actualExecute = event?.target?.execute || execute$
|
|
816
|
-
return handleJsonRpcMessage(event.target, event.data, actualExecute, resolve, preparePrettyError
|
|
908
|
+
const actualRequiresSocket = event?.target?.requiresSocket || requiresSocket;
|
|
909
|
+
const actualExecute = event?.target?.execute || execute$2;
|
|
910
|
+
return handleJsonRpcMessage(event.target, event.data, actualExecute, resolve, preparePrettyError, logError, actualRequiresSocket);
|
|
817
911
|
};
|
|
818
912
|
const handleIpc = ipc => {
|
|
819
913
|
if ('addEventListener' in ipc) {
|
|
@@ -831,6 +925,26 @@ const listen$1 = async (module, options) => {
|
|
|
831
925
|
const ipc = module.wrap(rawIpc);
|
|
832
926
|
return ipc;
|
|
833
927
|
};
|
|
928
|
+
const create$6 = async ({
|
|
929
|
+
commandMap,
|
|
930
|
+
messagePort,
|
|
931
|
+
isMessagePortOpen
|
|
932
|
+
}) => {
|
|
933
|
+
// TODO create a commandMap per rpc instance
|
|
934
|
+
register(commandMap);
|
|
935
|
+
const rawIpc = await IpcParentWithMessagePort$1.create({
|
|
936
|
+
messagePort,
|
|
937
|
+
isMessagePortOpen
|
|
938
|
+
});
|
|
939
|
+
const ipc = IpcParentWithMessagePort$1.wrap(rawIpc);
|
|
940
|
+
handleIpc(ipc);
|
|
941
|
+
const rpc = createRpc(ipc);
|
|
942
|
+
return rpc;
|
|
943
|
+
};
|
|
944
|
+
const MessagePortRpcParent = {
|
|
945
|
+
__proto__: null,
|
|
946
|
+
create: create$6
|
|
947
|
+
};
|
|
834
948
|
const create$1 = async ({
|
|
835
949
|
commandMap
|
|
836
950
|
}) => {
|
|
@@ -974,8 +1088,6 @@ const getLocatorRpc = locator => {
|
|
|
974
1088
|
return Rpc;
|
|
975
1089
|
};
|
|
976
1090
|
|
|
977
|
-
// @ts-nocheck
|
|
978
|
-
|
|
979
1091
|
const Assert = {
|
|
980
1092
|
string(value, message) {
|
|
981
1093
|
if (typeof value !== 'string') {
|
|
@@ -994,7 +1106,6 @@ const expect$1 = locator => {
|
|
|
994
1106
|
} = getLocatorRpc(locator);
|
|
995
1107
|
return {
|
|
996
1108
|
async checkSingleElementCondition(fnName, options) {
|
|
997
|
-
Assert.string(fnName);
|
|
998
1109
|
// TODO add rpcId property to locator instead
|
|
999
1110
|
return invoke('TestFrameWork.checkSingleElementCondition', locator, fnName, options);
|
|
1000
1111
|
},
|
|
@@ -1055,7 +1166,7 @@ const expect$1 = locator => {
|
|
|
1055
1166
|
});
|
|
1056
1167
|
},
|
|
1057
1168
|
async toHaveCount(count) {
|
|
1058
|
-
Assert.number(count, 'count must be of type
|
|
1169
|
+
Assert.number(count, 'count must be of type number');
|
|
1059
1170
|
return this.checkMultiElementCondition('toHaveCount', {
|
|
1060
1171
|
count
|
|
1061
1172
|
});
|
|
@@ -1321,13 +1432,13 @@ const TestFrameWorkComponentBaseUrl = {
|
|
|
1321
1432
|
getBaseUrl
|
|
1322
1433
|
};
|
|
1323
1434
|
|
|
1324
|
-
const execute$
|
|
1435
|
+
const execute$1 = async (id, ...args) => {
|
|
1325
1436
|
return invoke(id, ...args);
|
|
1326
1437
|
};
|
|
1327
1438
|
|
|
1328
1439
|
const TestFrameWorkComponentCommand = {
|
|
1329
1440
|
__proto__: null,
|
|
1330
|
-
execute: execute$
|
|
1441
|
+
execute: execute$1
|
|
1331
1442
|
};
|
|
1332
1443
|
|
|
1333
1444
|
const selectItem$1 = async text => {
|
|
@@ -1562,7 +1673,7 @@ const TestFrameWorkComponentEditor = {
|
|
|
1562
1673
|
type
|
|
1563
1674
|
};
|
|
1564
1675
|
|
|
1565
|
-
const selectIndex$
|
|
1676
|
+
const selectIndex$2 = async index => {
|
|
1566
1677
|
await invoke('EditorCompletion.selectIndex', index);
|
|
1567
1678
|
};
|
|
1568
1679
|
const selectCurrentIndex = async () => {
|
|
@@ -1572,7 +1683,7 @@ const selectCurrentIndex = async () => {
|
|
|
1572
1683
|
const TestFrameWorkComponentEditorCompletion = {
|
|
1573
1684
|
__proto__: null,
|
|
1574
1685
|
selectCurrentIndex,
|
|
1575
|
-
selectIndex: selectIndex$
|
|
1686
|
+
selectIndex: selectIndex$2
|
|
1576
1687
|
};
|
|
1577
1688
|
|
|
1578
1689
|
const openContextMenu = async index => {
|
|
@@ -2000,6 +2111,9 @@ const focusPrevious$2 = async () => {
|
|
|
2000
2111
|
const selectItem = async label => {
|
|
2001
2112
|
await invoke('QuickPick.selectItem', label);
|
|
2002
2113
|
};
|
|
2114
|
+
const selectIndex$1 = async index => {
|
|
2115
|
+
await invoke('QuickPick.selectIndex', index);
|
|
2116
|
+
};
|
|
2003
2117
|
const executeCommand = async label => {
|
|
2004
2118
|
await invoke('QuickPick.showCommands');
|
|
2005
2119
|
await invoke('QuickPick.handleInput', label, 0);
|
|
@@ -2013,6 +2127,7 @@ const TestFrameWorkComponentQuickPick = {
|
|
|
2013
2127
|
focusNext: focusNext$2,
|
|
2014
2128
|
focusPrevious: focusPrevious$2,
|
|
2015
2129
|
open: open$1,
|
|
2130
|
+
selectIndex: selectIndex$1,
|
|
2016
2131
|
selectItem,
|
|
2017
2132
|
setValue: setValue$1
|
|
2018
2133
|
};
|
|
@@ -2247,16 +2362,6 @@ const waitForFirstEventEvent = async port => {
|
|
|
2247
2362
|
return firstEvent;
|
|
2248
2363
|
};
|
|
2249
2364
|
|
|
2250
|
-
const preparePrettyError = error => {
|
|
2251
|
-
return error;
|
|
2252
|
-
};
|
|
2253
|
-
const logError = () => {
|
|
2254
|
-
// ignore
|
|
2255
|
-
};
|
|
2256
|
-
const execute$1 = () => {};
|
|
2257
|
-
const requiresSocket = () => {
|
|
2258
|
-
return false;
|
|
2259
|
-
};
|
|
2260
2365
|
const createPortIpc = async webViewId => {
|
|
2261
2366
|
const {
|
|
2262
2367
|
port1,
|
|
@@ -2274,27 +2379,17 @@ const createPortIpc = async webViewId => {
|
|
|
2274
2379
|
if (firstEvent.data !== 'ready') {
|
|
2275
2380
|
throw new Error('unexpected first message');
|
|
2276
2381
|
}
|
|
2277
|
-
const
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
send(message) {
|
|
2284
|
-
port1.postMessage(message);
|
|
2285
|
-
}
|
|
2286
|
-
};
|
|
2287
|
-
return ipc;
|
|
2382
|
+
const rpc = await MessagePortRpcParent.create({
|
|
2383
|
+
messagePort: port1,
|
|
2384
|
+
commandMap: {},
|
|
2385
|
+
isMessagePortOpen: true
|
|
2386
|
+
});
|
|
2387
|
+
return rpc;
|
|
2288
2388
|
};
|
|
2289
2389
|
|
|
2290
2390
|
const fromId = async webViewId => {
|
|
2291
|
-
const
|
|
2292
|
-
|
|
2293
|
-
invoke(method, ...params) {
|
|
2294
|
-
return invoke$1(ipc, method, ...params);
|
|
2295
|
-
}
|
|
2296
|
-
};
|
|
2297
|
-
set(webViewId, webViewRpc);
|
|
2391
|
+
const rpc = await createPortIpc(webViewId);
|
|
2392
|
+
set(webViewId, rpc);
|
|
2298
2393
|
return {
|
|
2299
2394
|
locator(selector, options) {
|
|
2300
2395
|
const baseLocator = create(selector, options);
|