@lvce-editor/file-search-worker 5.13.0 → 5.14.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 +74 -38
- package/package.json +1 -1
|
@@ -442,13 +442,13 @@ const create$4 = (method, params) => {
|
|
|
442
442
|
};
|
|
443
443
|
};
|
|
444
444
|
const callbacks = Object.create(null);
|
|
445
|
-
const set$
|
|
445
|
+
const set$4 = (id, fn) => {
|
|
446
446
|
callbacks[id] = fn;
|
|
447
447
|
};
|
|
448
448
|
const get$2 = id => {
|
|
449
449
|
return callbacks[id];
|
|
450
450
|
};
|
|
451
|
-
const remove
|
|
451
|
+
const remove = id => {
|
|
452
452
|
delete callbacks[id];
|
|
453
453
|
};
|
|
454
454
|
let id = 0;
|
|
@@ -461,7 +461,7 @@ const registerPromise = () => {
|
|
|
461
461
|
resolve,
|
|
462
462
|
promise
|
|
463
463
|
} = Promise.withResolvers();
|
|
464
|
-
set$
|
|
464
|
+
set$4(id, resolve);
|
|
465
465
|
return {
|
|
466
466
|
id,
|
|
467
467
|
promise
|
|
@@ -625,7 +625,7 @@ const resolve = (id, response) => {
|
|
|
625
625
|
return;
|
|
626
626
|
}
|
|
627
627
|
fn(response);
|
|
628
|
-
remove
|
|
628
|
+
remove(id);
|
|
629
629
|
};
|
|
630
630
|
const E_COMMAND_NOT_FOUND = 'E_COMMAND_NOT_FOUND';
|
|
631
631
|
const getErrorType = prettyError => {
|
|
@@ -772,7 +772,7 @@ const send = (transport, method, ...params) => {
|
|
|
772
772
|
const message = create$4(method, params);
|
|
773
773
|
transport.send(message);
|
|
774
774
|
};
|
|
775
|
-
const invoke$
|
|
775
|
+
const invoke$3 = (ipc, method, ...params) => {
|
|
776
776
|
return invokeHelper(ipc, method, params, false);
|
|
777
777
|
};
|
|
778
778
|
const invokeAndTransfer = (ipc, method, ...params) => {
|
|
@@ -805,7 +805,7 @@ const createRpc = ipc => {
|
|
|
805
805
|
send(ipc, method, ...params);
|
|
806
806
|
},
|
|
807
807
|
invoke(method, ...params) {
|
|
808
|
-
return invoke$
|
|
808
|
+
return invoke$3(ipc, method, ...params);
|
|
809
809
|
},
|
|
810
810
|
invokeAndTransfer(method, ...params) {
|
|
811
811
|
return invokeAndTransfer(ipc, method, ...params);
|
|
@@ -861,21 +861,31 @@ const WebWorkerRpcClient = {
|
|
|
861
861
|
create: create$3
|
|
862
862
|
};
|
|
863
863
|
|
|
864
|
-
const RendererWorker = 1;
|
|
865
|
-
|
|
866
864
|
const rpcs = Object.create(null);
|
|
867
|
-
const set$
|
|
865
|
+
const set$3 = (id, rpc) => {
|
|
868
866
|
rpcs[id] = rpc;
|
|
869
867
|
};
|
|
870
868
|
const get$1 = id => {
|
|
871
869
|
return rpcs[id];
|
|
872
870
|
};
|
|
873
|
-
|
|
874
|
-
const invoke$
|
|
875
|
-
const rpc = get$1(RendererWorker);
|
|
871
|
+
const RendererWorker$1 = 1;
|
|
872
|
+
const invoke$2 = (method, ...params) => {
|
|
873
|
+
const rpc = get$1(RendererWorker$1);
|
|
876
874
|
// @ts-ignore
|
|
877
875
|
return rpc.invoke(method, ...params);
|
|
878
876
|
};
|
|
877
|
+
const set$2 = rpc => {
|
|
878
|
+
set$3(RendererWorker$1, rpc);
|
|
879
|
+
};
|
|
880
|
+
const RendererWorker = {
|
|
881
|
+
__proto__: null,
|
|
882
|
+
invoke: invoke$2,
|
|
883
|
+
set: set$2
|
|
884
|
+
};
|
|
885
|
+
|
|
886
|
+
const {
|
|
887
|
+
invoke: invoke$1,
|
|
888
|
+
set: set$1} = RendererWorker;
|
|
879
889
|
|
|
880
890
|
const closeWidget = async id => {
|
|
881
891
|
await invoke$1('Viewlet.closeWidget', id);
|
|
@@ -906,8 +916,49 @@ const create$2 = () => {
|
|
|
906
916
|
newState
|
|
907
917
|
};
|
|
908
918
|
},
|
|
909
|
-
|
|
919
|
+
dispose(uid) {
|
|
910
920
|
delete states[uid];
|
|
921
|
+
},
|
|
922
|
+
getKeys() {
|
|
923
|
+
return Object.keys(states).map(key => {
|
|
924
|
+
return Number.parseInt(key);
|
|
925
|
+
});
|
|
926
|
+
},
|
|
927
|
+
clear() {
|
|
928
|
+
for (const key of Object.keys(states)) {
|
|
929
|
+
delete states[key];
|
|
930
|
+
}
|
|
931
|
+
},
|
|
932
|
+
wrapCommand(fn) {
|
|
933
|
+
const wrapped = async (uid, ...args) => {
|
|
934
|
+
const {
|
|
935
|
+
newState
|
|
936
|
+
} = states[uid];
|
|
937
|
+
const newerState = await fn(newState, ...args);
|
|
938
|
+
if (newState === newerState) {
|
|
939
|
+
return;
|
|
940
|
+
}
|
|
941
|
+
const latest = states[uid];
|
|
942
|
+
states[uid] = {
|
|
943
|
+
oldState: latest.oldState,
|
|
944
|
+
newState: newerState
|
|
945
|
+
};
|
|
946
|
+
};
|
|
947
|
+
return wrapped;
|
|
948
|
+
},
|
|
949
|
+
diff(uid, modules, numbers) {
|
|
950
|
+
const {
|
|
951
|
+
oldState,
|
|
952
|
+
newState
|
|
953
|
+
} = states[uid];
|
|
954
|
+
const diffResult = [];
|
|
955
|
+
for (let i = 0; i < modules.length; i++) {
|
|
956
|
+
const fn = modules[i];
|
|
957
|
+
if (!fn(oldState, newState)) {
|
|
958
|
+
diffResult.push(numbers[i]);
|
|
959
|
+
}
|
|
960
|
+
}
|
|
961
|
+
return diffResult;
|
|
911
962
|
}
|
|
912
963
|
};
|
|
913
964
|
};
|
|
@@ -915,7 +966,8 @@ const create$2 = () => {
|
|
|
915
966
|
const {
|
|
916
967
|
get,
|
|
917
968
|
set,
|
|
918
|
-
|
|
969
|
+
dispose: dispose$1,
|
|
970
|
+
wrapCommand
|
|
919
971
|
} = create$2();
|
|
920
972
|
|
|
921
973
|
const create$1 = ({
|
|
@@ -1071,7 +1123,7 @@ const diff2 = uid => {
|
|
|
1071
1123
|
};
|
|
1072
1124
|
|
|
1073
1125
|
const dispose = uid => {
|
|
1074
|
-
|
|
1126
|
+
dispose$1(uid);
|
|
1075
1127
|
};
|
|
1076
1128
|
|
|
1077
1129
|
const setColorTheme = id => {
|
|
@@ -2773,6 +2825,12 @@ const text = data => {
|
|
|
2773
2825
|
childCount: 0
|
|
2774
2826
|
};
|
|
2775
2827
|
};
|
|
2828
|
+
const px = value => {
|
|
2829
|
+
return `${value}px`;
|
|
2830
|
+
};
|
|
2831
|
+
const position = (x, y) => {
|
|
2832
|
+
return `${x}px ${y}px`;
|
|
2833
|
+
};
|
|
2776
2834
|
|
|
2777
2835
|
const quickPickHighlight = {
|
|
2778
2836
|
type: Span,
|
|
@@ -2874,13 +2932,6 @@ const getQuickPickItemsVirtualDom = visibleItems => {
|
|
|
2874
2932
|
return dom;
|
|
2875
2933
|
};
|
|
2876
2934
|
|
|
2877
|
-
const px = value => {
|
|
2878
|
-
return `${value}px`;
|
|
2879
|
-
};
|
|
2880
|
-
const position = (x, y) => {
|
|
2881
|
-
return `${x}px ${y}px`;
|
|
2882
|
-
};
|
|
2883
|
-
|
|
2884
2935
|
const getScrollBarVirtualDom = (scrollBarHeight, scrollBarTop) => {
|
|
2885
2936
|
const shouldShowScrollbar = scrollBarHeight > 0;
|
|
2886
2937
|
if (!shouldShowScrollbar) {
|
|
@@ -3029,21 +3080,6 @@ const selectItem = async (state, label) => {
|
|
|
3029
3080
|
return selectIndex(state, index);
|
|
3030
3081
|
};
|
|
3031
3082
|
|
|
3032
|
-
const wrapCommand = fn => {
|
|
3033
|
-
const wrapped = async (uid, ...args) => {
|
|
3034
|
-
const {
|
|
3035
|
-
newState
|
|
3036
|
-
} = get(uid);
|
|
3037
|
-
const newerState = await fn(newState, ...args);
|
|
3038
|
-
if (newState === newerState) {
|
|
3039
|
-
return;
|
|
3040
|
-
}
|
|
3041
|
-
const latest = get(uid);
|
|
3042
|
-
set(uid, latest.oldState, newerState);
|
|
3043
|
-
};
|
|
3044
|
-
return wrapped;
|
|
3045
|
-
};
|
|
3046
|
-
|
|
3047
3083
|
const commandMap = {
|
|
3048
3084
|
'QuickPick.addMenuEntries': add,
|
|
3049
3085
|
'QuickPick.close': close,
|
|
@@ -3137,7 +3173,7 @@ const listen = async () => {
|
|
|
3137
3173
|
const rpc = await WebWorkerRpcClient.create({
|
|
3138
3174
|
commandMap: commandMap
|
|
3139
3175
|
});
|
|
3140
|
-
set$1(
|
|
3176
|
+
set$1(rpc);
|
|
3141
3177
|
};
|
|
3142
3178
|
|
|
3143
3179
|
const main = async () => {
|