@lvce-editor/test-worker 4.26.0 → 4.28.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 +13 -3
- package/dist/testWorkerMain.js +63 -18
- package/package.json +1 -1
package/dist/api.d.ts
CHANGED
|
@@ -114,6 +114,7 @@ declare const updateEditingValue: (value: string) => Promise<void>;
|
|
|
114
114
|
declare const expandAll: () => Promise<void>;
|
|
115
115
|
declare const handleDragOver: (x: number, y: number) => Promise<void>;
|
|
116
116
|
declare const handleCut: () => Promise<void>;
|
|
117
|
+
declare const handleCopy: () => Promise<void>;
|
|
117
118
|
declare const handlePaste: () => Promise<void>;
|
|
118
119
|
declare const selectIndices: (indices: readonly number[]) => Promise<void>;
|
|
119
120
|
declare const addWebExtension: (relativePath: string) => Promise<void>;
|
|
@@ -195,7 +196,9 @@ declare const addWatchExpression: (expression: string) => Promise<void>;
|
|
|
195
196
|
declare const handleWatchValueChange: () => Promise<void>;
|
|
196
197
|
declare const acceptWatchExpressionEdit: () => Promise<void>;
|
|
197
198
|
declare const selectIndex$3: (index: number) => Promise<void>;
|
|
199
|
+
declare const setPauseOnExceptions: (value: number) => Promise<void>;
|
|
198
200
|
declare const handleRename: () => Promise<void>;
|
|
201
|
+
declare const handleSpace: () => Promise<void>;
|
|
199
202
|
declare const setValue$2: (value: string) => Promise<void>;
|
|
200
203
|
declare const setReplaceValue: (value: string) => Promise<void>;
|
|
201
204
|
declare const setExcludeValue: (value: string) => Promise<void>;
|
|
@@ -244,11 +247,14 @@ declare const handleKeySpace: () => Promise<void>;
|
|
|
244
247
|
declare const handleKeyEscape: () => Promise<void>;
|
|
245
248
|
declare const toggleIndex: (index: number) => Promise<void>;
|
|
246
249
|
declare const toggleMenu: () => Promise<void>;
|
|
250
|
+
declare const setUrl: (newUrl: string) => void;
|
|
251
|
+
declare const resolve: (relativePath: string) => string;
|
|
247
252
|
declare const fromId: (webViewId: string) => Promise<any>;
|
|
248
253
|
declare const setPath: (path: string) => Promise<void>;
|
|
254
|
+
declare const openTmpDir: () => Promise<string>;
|
|
249
255
|
|
|
250
256
|
declare namespace Workspace {
|
|
251
|
-
export { setPath };
|
|
257
|
+
export { openTmpDir, setPath };
|
|
252
258
|
}
|
|
253
259
|
declare namespace About {
|
|
254
260
|
export { focusNext, focusPrevious, handleClickClose, handleClickCopy, handleClickOk, show };
|
|
@@ -278,7 +284,7 @@ declare namespace EditorCompletion {
|
|
|
278
284
|
export { selectCurrentIndex, selectIndex };
|
|
279
285
|
}
|
|
280
286
|
declare namespace Explorer {
|
|
281
|
-
export { acceptEdit, cancelEdit, clickCurrent, expandAll, expandRecursively, focus$1 as focus, focusFirst$1 as focusFirst, focusIndex, focusLast$1 as focusLast, focusNext$2 as focusNext, handleArrowLeft, handleBlur, handleClick$1 as handleClick, handleClickAt, handleCut, handleDragLeave, handleDragOver, handleDrop, handleInputBlur, handlePaste, newFile, newFolder, openContextMenu$1 as openContextMenu, refresh, removeDirent, rename$1 as rename, renameDirent, selectAll$1 as selectAll, selectDown, selectIndices, selectUp, updateEditingValue };
|
|
287
|
+
export { acceptEdit, cancelEdit, clickCurrent, expandAll, expandRecursively, focus$1 as focus, focusFirst$1 as focusFirst, focusIndex, focusLast$1 as focusLast, focusNext$2 as focusNext, handleArrowLeft, handleBlur, handleClick$1 as handleClick, handleClickAt, handleCopy, handleCut, handleDragLeave, handleDragOver, handleDrop, handleInputBlur, handlePaste, newFile, newFolder, openContextMenu$1 as openContextMenu, refresh, removeDirent, rename$1 as rename, renameDirent, selectAll$1 as selectAll, selectDown, selectIndices, selectUp, updateEditingValue };
|
|
282
288
|
}
|
|
283
289
|
declare namespace Extension {
|
|
284
290
|
export { addNodeExtension, addWebExtension };
|
|
@@ -320,7 +326,7 @@ declare namespace QuickPick {
|
|
|
320
326
|
export { executeCommand, focusFirst$5 as focusFirst, focusIndex$1 as focusIndex, focusLast$5 as focusLast, focusNext$7 as focusNext, focusPrevious$5 as focusPrevious, handleClickAt$1 as handleClickAt, handleInput$1 as handleInput, open$3 as open, selectCurrentIndex$1 as selectCurrentIndex, selectIndex$2 as selectIndex, selectItem$1 as selectItem, setValue$1 as setValue };
|
|
321
327
|
}
|
|
322
328
|
declare namespace RunAndDebug {
|
|
323
|
-
export { acceptWatchExpressionEdit, addWatchExpression, handleClickSectionWatch, handleRename, handleWatchValueChange, selectIndex$3 as selectIndex };
|
|
329
|
+
export { acceptWatchExpressionEdit, addWatchExpression, handleClickSectionWatch, handleRename, handleSpace, handleWatchValueChange, selectIndex$3 as selectIndex, setPauseOnExceptions };
|
|
324
330
|
}
|
|
325
331
|
declare namespace Search {
|
|
326
332
|
export { clearSearchResults, collapseDetails, dismissItem, focusFirst$6 as focusFirst, focusIndex$2 as focusIndex, focusNext$8 as focusNext, focusNextPage, focusPrevious$6 as focusPrevious, focusPreviousPage, handleWheel$1 as handleWheel, openDetails, replaceAll, selectIndex$4 as selectIndex, setExcludeValue, setIncludeValue, setReplaceValue, setValue$2 as setValue, toggleMatchCase, toggleMatchWholeWord, togglePreserveCase, toggleReplace, toggleSearchDetails, toggleUseRegularExpression };
|
|
@@ -340,6 +346,9 @@ declare namespace StatusBar {
|
|
|
340
346
|
declare namespace TitleBarMenuBar {
|
|
341
347
|
export { closeMenu, focus$2 as focus, focusFirst$7 as focusFirst, focusIndex$3 as focusIndex, focusLast$6 as focusLast, focusNext$9 as focusNext, focusPrevious$7 as focusPrevious, handleKeyArrowDown, handleKeyArrowLeft, handleKeyArrowRight, handleKeyArrowUp, handleKeyEnd, handleKeyEscape, handleKeyHome, handleKeySpace, toggleIndex, toggleMenu };
|
|
342
348
|
}
|
|
349
|
+
declare namespace Url {
|
|
350
|
+
export { resolve, setUrl };
|
|
351
|
+
}
|
|
343
352
|
declare namespace WebView {
|
|
344
353
|
export { fromId };
|
|
345
354
|
}
|
|
@@ -375,6 +384,7 @@ export interface TestApi {
|
|
|
375
384
|
readonly SourceControl: typeof SourceControl,
|
|
376
385
|
readonly StatusBar: typeof StatusBar,
|
|
377
386
|
readonly TitleBarMenuBar: typeof TitleBarMenuBar,
|
|
387
|
+
readonly Url: typeof Url,
|
|
378
388
|
readonly WebView: typeof WebView,
|
|
379
389
|
readonly Workspace: typeof Workspace,
|
|
380
390
|
readonly expect: any
|
package/dist/testWorkerMain.js
CHANGED
|
@@ -60,37 +60,45 @@ let AssertionError$1 = class AssertionError extends Error {
|
|
|
60
60
|
this.name = 'AssertionError';
|
|
61
61
|
}
|
|
62
62
|
};
|
|
63
|
+
const Object$1 = 1;
|
|
64
|
+
const Number$1 = 2;
|
|
65
|
+
const Array$1 = 3;
|
|
66
|
+
const String = 4;
|
|
67
|
+
const Boolean = 5;
|
|
68
|
+
const Function = 6;
|
|
69
|
+
const Null = 7;
|
|
70
|
+
const Unknown = 8;
|
|
63
71
|
const getType = value => {
|
|
64
72
|
switch (typeof value) {
|
|
65
73
|
case 'number':
|
|
66
|
-
return
|
|
74
|
+
return Number$1;
|
|
67
75
|
case 'function':
|
|
68
|
-
return
|
|
76
|
+
return Function;
|
|
69
77
|
case 'string':
|
|
70
|
-
return
|
|
78
|
+
return String;
|
|
71
79
|
case 'object':
|
|
72
80
|
if (value === null) {
|
|
73
|
-
return
|
|
81
|
+
return Null;
|
|
74
82
|
}
|
|
75
83
|
if (Array.isArray(value)) {
|
|
76
|
-
return
|
|
84
|
+
return Array$1;
|
|
77
85
|
}
|
|
78
|
-
return
|
|
86
|
+
return Object$1;
|
|
79
87
|
case 'boolean':
|
|
80
|
-
return
|
|
88
|
+
return Boolean;
|
|
81
89
|
default:
|
|
82
|
-
return
|
|
90
|
+
return Unknown;
|
|
83
91
|
}
|
|
84
92
|
};
|
|
85
93
|
const object = value => {
|
|
86
94
|
const type = getType(value);
|
|
87
|
-
if (type !==
|
|
95
|
+
if (type !== Object$1) {
|
|
88
96
|
throw new AssertionError$1('expected value to be of type object');
|
|
89
97
|
}
|
|
90
98
|
};
|
|
91
99
|
const string$1 = value => {
|
|
92
100
|
const type = getType(value);
|
|
93
|
-
if (type !==
|
|
101
|
+
if (type !== String) {
|
|
94
102
|
throw new AssertionError$1('expected value to be of type string');
|
|
95
103
|
}
|
|
96
104
|
};
|
|
@@ -695,7 +703,7 @@ const unwrapJsonRpcResult = responseMessage => {
|
|
|
695
703
|
const warn = (...args) => {
|
|
696
704
|
console.warn(...args);
|
|
697
705
|
};
|
|
698
|
-
const resolve = (id, response) => {
|
|
706
|
+
const resolve$1 = (id, response) => {
|
|
699
707
|
const fn = get$2(id);
|
|
700
708
|
if (!fn) {
|
|
701
709
|
console.log(response);
|
|
@@ -802,7 +810,7 @@ const defaultLogError = () => {
|
|
|
802
810
|
const defaultRequiresSocket = () => {
|
|
803
811
|
return false;
|
|
804
812
|
};
|
|
805
|
-
const defaultResolve = resolve;
|
|
813
|
+
const defaultResolve = resolve$1;
|
|
806
814
|
|
|
807
815
|
// TODO maybe remove this in v6 or v7, only accept options object to simplify the code
|
|
808
816
|
const normalizeParams = args => {
|
|
@@ -932,7 +940,7 @@ const logError = () => {
|
|
|
932
940
|
const handleMessage = event => {
|
|
933
941
|
const actualRequiresSocket = event?.target?.requiresSocket || requiresSocket;
|
|
934
942
|
const actualExecute = event?.target?.execute || execute$2;
|
|
935
|
-
return handleJsonRpcMessage(event.target, event.data, actualExecute, resolve, preparePrettyError, logError, actualRequiresSocket);
|
|
943
|
+
return handleJsonRpcMessage(event.target, event.data, actualExecute, resolve$1, preparePrettyError, logError, actualRequiresSocket);
|
|
936
944
|
};
|
|
937
945
|
const handleIpc = ipc => {
|
|
938
946
|
if ('addEventListener' in ipc) {
|
|
@@ -950,7 +958,7 @@ const listen$1 = async (module, options) => {
|
|
|
950
958
|
const ipc = module.wrap(rawIpc);
|
|
951
959
|
return ipc;
|
|
952
960
|
};
|
|
953
|
-
const create$
|
|
961
|
+
const create$a = async ({
|
|
954
962
|
commandMap,
|
|
955
963
|
messagePort,
|
|
956
964
|
isMessagePortOpen
|
|
@@ -968,7 +976,7 @@ const create$9 = async ({
|
|
|
968
976
|
};
|
|
969
977
|
const MessagePortRpcParent = {
|
|
970
978
|
__proto__: null,
|
|
971
|
-
create: create$
|
|
979
|
+
create: create$a
|
|
972
980
|
};
|
|
973
981
|
const create$2 = async ({
|
|
974
982
|
commandMap
|
|
@@ -1037,12 +1045,12 @@ const create$1 = rpcId => {
|
|
|
1037
1045
|
};
|
|
1038
1046
|
const RendererWorker$1 = 1;
|
|
1039
1047
|
const {
|
|
1040
|
-
invoke: invoke$
|
|
1048
|
+
invoke: invoke$4,
|
|
1041
1049
|
invokeAndTransfer: invokeAndTransfer$3,
|
|
1042
1050
|
set: set$3} = create$1(RendererWorker$1);
|
|
1043
1051
|
const RendererWorker = {
|
|
1044
1052
|
__proto__: null,
|
|
1045
|
-
invoke: invoke$
|
|
1053
|
+
invoke: invoke$4,
|
|
1046
1054
|
invokeAndTransfer: invokeAndTransfer$3,
|
|
1047
1055
|
set: set$3
|
|
1048
1056
|
};
|
|
@@ -2084,6 +2092,10 @@ const handleCut = async () => {
|
|
|
2084
2092
|
// @ts-ignore
|
|
2085
2093
|
await invoke('Explorer.handleCut');
|
|
2086
2094
|
};
|
|
2095
|
+
const handleCopy = async () => {
|
|
2096
|
+
// @ts-ignore
|
|
2097
|
+
await invoke('Explorer.handleCopy');
|
|
2098
|
+
};
|
|
2087
2099
|
const handlePaste = async () => {
|
|
2088
2100
|
// @ts-ignore
|
|
2089
2101
|
await invoke('Explorer.handlePaste');
|
|
@@ -2108,6 +2120,7 @@ const TestFrameWorkComponentExplorer = {
|
|
|
2108
2120
|
handleBlur,
|
|
2109
2121
|
handleClick: handleClick$1,
|
|
2110
2122
|
handleClickAt: handleClickAt$1,
|
|
2123
|
+
handleCopy,
|
|
2111
2124
|
handleCut,
|
|
2112
2125
|
handleDragLeave,
|
|
2113
2126
|
handleDragOver,
|
|
@@ -2633,10 +2646,18 @@ const selectIndex$2 = async index => {
|
|
|
2633
2646
|
// @ts-ignore
|
|
2634
2647
|
await invoke('Run And Debug.selectIndex', index);
|
|
2635
2648
|
};
|
|
2649
|
+
const setPauseOnExceptions = async value => {
|
|
2650
|
+
// @ts-ignore
|
|
2651
|
+
await invoke('Run And Debug.setPauseOnExceptions', value);
|
|
2652
|
+
};
|
|
2636
2653
|
const handleRename = async () => {
|
|
2637
2654
|
// @ts-ignore
|
|
2638
2655
|
await invoke('Run And Debug.handleRename');
|
|
2639
2656
|
};
|
|
2657
|
+
const handleSpace = async () => {
|
|
2658
|
+
// @ts-ignore
|
|
2659
|
+
await invoke('Run And Debug.handleSpace');
|
|
2660
|
+
};
|
|
2640
2661
|
|
|
2641
2662
|
const TestFrameWorkComponentRunAndDebug = {
|
|
2642
2663
|
__proto__: null,
|
|
@@ -2644,8 +2665,10 @@ const TestFrameWorkComponentRunAndDebug = {
|
|
|
2644
2665
|
addWatchExpression,
|
|
2645
2666
|
handleClickSectionWatch,
|
|
2646
2667
|
handleRename,
|
|
2668
|
+
handleSpace,
|
|
2647
2669
|
handleWatchValueChange,
|
|
2648
|
-
selectIndex: selectIndex$2
|
|
2670
|
+
selectIndex: selectIndex$2,
|
|
2671
|
+
setPauseOnExceptions
|
|
2649
2672
|
};
|
|
2650
2673
|
|
|
2651
2674
|
const Script = 2;
|
|
@@ -2880,6 +2903,20 @@ const TestFrameWorkComponentTitleBarMenuBar = {
|
|
|
2880
2903
|
toggleMenu
|
|
2881
2904
|
};
|
|
2882
2905
|
|
|
2906
|
+
let url = '';
|
|
2907
|
+
const setUrl = newUrl => {
|
|
2908
|
+
url = newUrl;
|
|
2909
|
+
};
|
|
2910
|
+
const resolve = relativePath => {
|
|
2911
|
+
return new URL(relativePath, url).toString();
|
|
2912
|
+
};
|
|
2913
|
+
|
|
2914
|
+
const TestFrameWorkComponentUrl = {
|
|
2915
|
+
__proto__: null,
|
|
2916
|
+
resolve,
|
|
2917
|
+
setUrl
|
|
2918
|
+
};
|
|
2919
|
+
|
|
2883
2920
|
const getPortTuple = () => {
|
|
2884
2921
|
const {
|
|
2885
2922
|
port1,
|
|
@@ -2954,9 +2991,15 @@ const TestFrameWorkComponentWebView = {
|
|
|
2954
2991
|
const setPath = async path => {
|
|
2955
2992
|
await invoke('Workspace.setPath', path);
|
|
2956
2993
|
};
|
|
2994
|
+
const openTmpDir = async () => {
|
|
2995
|
+
const tmpDir = await getTmpDir();
|
|
2996
|
+
await setPath(tmpDir);
|
|
2997
|
+
return tmpDir;
|
|
2998
|
+
};
|
|
2957
2999
|
|
|
2958
3000
|
const TestFrameWorkComponentWorkspace = {
|
|
2959
3001
|
__proto__: null,
|
|
3002
|
+
openTmpDir,
|
|
2960
3003
|
setPath
|
|
2961
3004
|
};
|
|
2962
3005
|
|
|
@@ -2992,6 +3035,7 @@ const TestFrameWorkComponent = {
|
|
|
2992
3035
|
SourceControl: TestFrameWorkComponentSourceControl,
|
|
2993
3036
|
StatusBar: TestFrameWorkComponentStatusBar,
|
|
2994
3037
|
TitleBarMenuBar: TestFrameWorkComponentTitleBarMenuBar,
|
|
3038
|
+
Url: TestFrameWorkComponentUrl,
|
|
2995
3039
|
WebView: TestFrameWorkComponentWebView,
|
|
2996
3040
|
Workspace: TestFrameWorkComponentWorkspace
|
|
2997
3041
|
};
|
|
@@ -3005,6 +3049,7 @@ const execute = async href => {
|
|
|
3005
3049
|
// 0. wait for page to be ready
|
|
3006
3050
|
// 1. get script to import from renderer process (url or from html)
|
|
3007
3051
|
const scriptUrl = href;
|
|
3052
|
+
setUrl(scriptUrl);
|
|
3008
3053
|
// 2. import that script
|
|
3009
3054
|
const module = await importTest(scriptUrl);
|
|
3010
3055
|
if (module.mockRpc) {
|