@lvce-editor/file-search-worker 8.1.0 → 8.3.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/fileSearchWorkerMain.js +20 -20
- package/package.json +1 -1
|
@@ -1006,6 +1006,26 @@ const create$1 = async ({
|
|
|
1006
1006
|
return rpc;
|
|
1007
1007
|
};
|
|
1008
1008
|
|
|
1009
|
+
const createMockRpc = ({
|
|
1010
|
+
commandMap
|
|
1011
|
+
}) => {
|
|
1012
|
+
const invocations = [];
|
|
1013
|
+
const invoke = (method, ...params) => {
|
|
1014
|
+
invocations.push([method, ...params]);
|
|
1015
|
+
const command = commandMap[method];
|
|
1016
|
+
if (!command) {
|
|
1017
|
+
throw new Error(`command ${method} not found`);
|
|
1018
|
+
}
|
|
1019
|
+
return command(...params);
|
|
1020
|
+
};
|
|
1021
|
+
const mockRpc = {
|
|
1022
|
+
invocations,
|
|
1023
|
+
invoke,
|
|
1024
|
+
invokeAndTransfer: invoke
|
|
1025
|
+
};
|
|
1026
|
+
return mockRpc;
|
|
1027
|
+
};
|
|
1028
|
+
|
|
1009
1029
|
const commandMapRef = {};
|
|
1010
1030
|
|
|
1011
1031
|
const handleMessagePort = async port => {
|
|
@@ -1049,26 +1069,6 @@ const commandMap = {
|
|
|
1049
1069
|
'SearchFile.searchFile': searchFile$4
|
|
1050
1070
|
};
|
|
1051
1071
|
|
|
1052
|
-
const createMockRpc = ({
|
|
1053
|
-
commandMap
|
|
1054
|
-
}) => {
|
|
1055
|
-
const invocations = [];
|
|
1056
|
-
const invoke = (method, ...params) => {
|
|
1057
|
-
invocations.push([method, ...params]);
|
|
1058
|
-
const command = commandMap[method];
|
|
1059
|
-
if (!command) {
|
|
1060
|
-
throw new Error(`command ${method} not found`);
|
|
1061
|
-
}
|
|
1062
|
-
return command(...params);
|
|
1063
|
-
};
|
|
1064
|
-
const mockRpc = {
|
|
1065
|
-
invocations,
|
|
1066
|
-
invoke,
|
|
1067
|
-
invokeAndTransfer: invoke
|
|
1068
|
-
};
|
|
1069
|
-
return mockRpc;
|
|
1070
|
-
};
|
|
1071
|
-
|
|
1072
1072
|
const rpcs = Object.create(null);
|
|
1073
1073
|
const set$2 = (id, rpc) => {
|
|
1074
1074
|
rpcs[id] = rpc;
|