@lvce-editor/file-search-worker 5.13.0 → 5.15.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 +98 -55
- package/package.json +1 -1
|
@@ -356,22 +356,11 @@ class IpcChildWithModuleWorker extends Ipc {
|
|
|
356
356
|
const wrap$f = global => {
|
|
357
357
|
return new IpcChildWithModuleWorker(global);
|
|
358
358
|
};
|
|
359
|
-
const withResolvers = () => {
|
|
360
|
-
let _resolve;
|
|
361
|
-
const promise = new Promise(resolve => {
|
|
362
|
-
_resolve = resolve;
|
|
363
|
-
});
|
|
364
|
-
return {
|
|
365
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
366
|
-
resolve: _resolve,
|
|
367
|
-
promise
|
|
368
|
-
};
|
|
369
|
-
};
|
|
370
359
|
const waitForFirstMessage = async port => {
|
|
371
360
|
const {
|
|
372
361
|
resolve,
|
|
373
362
|
promise
|
|
374
|
-
} = withResolvers();
|
|
363
|
+
} = Promise.withResolvers();
|
|
375
364
|
port.addEventListener('message', resolve, {
|
|
376
365
|
once: true
|
|
377
366
|
});
|
|
@@ -434,7 +423,7 @@ const IpcChildWithModuleWorkerAndMessagePort$1 = {
|
|
|
434
423
|
};
|
|
435
424
|
|
|
436
425
|
const Two = '2.0';
|
|
437
|
-
const create$4 = (method, params) => {
|
|
426
|
+
const create$4$1 = (method, params) => {
|
|
438
427
|
return {
|
|
439
428
|
jsonrpc: Two,
|
|
440
429
|
method,
|
|
@@ -442,13 +431,13 @@ const create$4 = (method, params) => {
|
|
|
442
431
|
};
|
|
443
432
|
};
|
|
444
433
|
const callbacks = Object.create(null);
|
|
445
|
-
const set$
|
|
434
|
+
const set$3 = (id, fn) => {
|
|
446
435
|
callbacks[id] = fn;
|
|
447
436
|
};
|
|
448
437
|
const get$2 = id => {
|
|
449
438
|
return callbacks[id];
|
|
450
439
|
};
|
|
451
|
-
const remove
|
|
440
|
+
const remove = id => {
|
|
452
441
|
delete callbacks[id];
|
|
453
442
|
};
|
|
454
443
|
let id = 0;
|
|
@@ -461,7 +450,7 @@ const registerPromise = () => {
|
|
|
461
450
|
resolve,
|
|
462
451
|
promise
|
|
463
452
|
} = Promise.withResolvers();
|
|
464
|
-
set$
|
|
453
|
+
set$3(id, resolve);
|
|
465
454
|
return {
|
|
466
455
|
id,
|
|
467
456
|
promise
|
|
@@ -625,7 +614,7 @@ const resolve = (id, response) => {
|
|
|
625
614
|
return;
|
|
626
615
|
}
|
|
627
616
|
fn(response);
|
|
628
|
-
remove
|
|
617
|
+
remove(id);
|
|
629
618
|
};
|
|
630
619
|
const E_COMMAND_NOT_FOUND = 'E_COMMAND_NOT_FOUND';
|
|
631
620
|
const getErrorType = prettyError => {
|
|
@@ -769,10 +758,10 @@ const invokeHelper = async (ipc, method, params, useSendAndTransfer) => {
|
|
|
769
758
|
return unwrapJsonRpcResult(responseMessage);
|
|
770
759
|
};
|
|
771
760
|
const send = (transport, method, ...params) => {
|
|
772
|
-
const message = create$4(method, params);
|
|
761
|
+
const message = create$4$1(method, params);
|
|
773
762
|
transport.send(message);
|
|
774
763
|
};
|
|
775
|
-
const invoke$
|
|
764
|
+
const invoke$3 = (ipc, method, ...params) => {
|
|
776
765
|
return invokeHelper(ipc, method, params, false);
|
|
777
766
|
};
|
|
778
767
|
const invokeAndTransfer = (ipc, method, ...params) => {
|
|
@@ -805,7 +794,7 @@ const createRpc = ipc => {
|
|
|
805
794
|
send(ipc, method, ...params);
|
|
806
795
|
},
|
|
807
796
|
invoke(method, ...params) {
|
|
808
|
-
return invoke$
|
|
797
|
+
return invoke$3(ipc, method, ...params);
|
|
809
798
|
},
|
|
810
799
|
invokeAndTransfer(method, ...params) {
|
|
811
800
|
return invokeAndTransfer(ipc, method, ...params);
|
|
@@ -846,7 +835,7 @@ const listen$1 = async (module, options) => {
|
|
|
846
835
|
const ipc = module.wrap(rawIpc);
|
|
847
836
|
return ipc;
|
|
848
837
|
};
|
|
849
|
-
const create$
|
|
838
|
+
const create$4 = async ({
|
|
850
839
|
commandMap
|
|
851
840
|
}) => {
|
|
852
841
|
// TODO create a commandMap per rpc instance
|
|
@@ -858,25 +847,53 @@ const create$3 = async ({
|
|
|
858
847
|
};
|
|
859
848
|
const WebWorkerRpcClient = {
|
|
860
849
|
__proto__: null,
|
|
861
|
-
create: create$
|
|
850
|
+
create: create$4
|
|
862
851
|
};
|
|
863
852
|
|
|
864
|
-
const RendererWorker = 1;
|
|
865
|
-
|
|
866
853
|
const rpcs = Object.create(null);
|
|
867
|
-
const set$
|
|
854
|
+
const set$7 = (id, rpc) => {
|
|
868
855
|
rpcs[id] = rpc;
|
|
869
856
|
};
|
|
870
857
|
const get$1 = id => {
|
|
871
858
|
return rpcs[id];
|
|
872
859
|
};
|
|
873
860
|
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
return
|
|
861
|
+
/* eslint-disable @typescript-eslint/explicit-function-return-type */
|
|
862
|
+
|
|
863
|
+
const create$3 = rpcId => {
|
|
864
|
+
return {
|
|
865
|
+
// @ts-ignore
|
|
866
|
+
invoke(method, ...params) {
|
|
867
|
+
const rpc = get$1(rpcId);
|
|
868
|
+
// @ts-ignore
|
|
869
|
+
return rpc.invoke(method, ...params);
|
|
870
|
+
},
|
|
871
|
+
// @ts-ignore
|
|
872
|
+
invokeAndTransfer(method, ...params) {
|
|
873
|
+
const rpc = get$1(rpcId);
|
|
874
|
+
// @ts-ignore
|
|
875
|
+
return rpc.invokeAndTransfer(method, ...params);
|
|
876
|
+
},
|
|
877
|
+
set(rpc) {
|
|
878
|
+
set$7(rpcId, rpc);
|
|
879
|
+
}
|
|
880
|
+
};
|
|
881
|
+
};
|
|
882
|
+
const RendererWorker$1 = 1;
|
|
883
|
+
const {
|
|
884
|
+
invoke: invoke$2,
|
|
885
|
+
set: set$2
|
|
886
|
+
} = create$3(RendererWorker$1);
|
|
887
|
+
const RendererWorker = {
|
|
888
|
+
__proto__: null,
|
|
889
|
+
invoke: invoke$2,
|
|
890
|
+
set: set$2
|
|
878
891
|
};
|
|
879
892
|
|
|
893
|
+
const {
|
|
894
|
+
invoke: invoke$1,
|
|
895
|
+
set: set$1} = RendererWorker;
|
|
896
|
+
|
|
880
897
|
const closeWidget = async id => {
|
|
881
898
|
await invoke$1('Viewlet.closeWidget', id);
|
|
882
899
|
};
|
|
@@ -906,8 +923,49 @@ const create$2 = () => {
|
|
|
906
923
|
newState
|
|
907
924
|
};
|
|
908
925
|
},
|
|
909
|
-
|
|
926
|
+
dispose(uid) {
|
|
910
927
|
delete states[uid];
|
|
928
|
+
},
|
|
929
|
+
getKeys() {
|
|
930
|
+
return Object.keys(states).map(key => {
|
|
931
|
+
return Number.parseInt(key);
|
|
932
|
+
});
|
|
933
|
+
},
|
|
934
|
+
clear() {
|
|
935
|
+
for (const key of Object.keys(states)) {
|
|
936
|
+
delete states[key];
|
|
937
|
+
}
|
|
938
|
+
},
|
|
939
|
+
wrapCommand(fn) {
|
|
940
|
+
const wrapped = async (uid, ...args) => {
|
|
941
|
+
const {
|
|
942
|
+
newState
|
|
943
|
+
} = states[uid];
|
|
944
|
+
const newerState = await fn(newState, ...args);
|
|
945
|
+
if (newState === newerState) {
|
|
946
|
+
return;
|
|
947
|
+
}
|
|
948
|
+
const latest = states[uid];
|
|
949
|
+
states[uid] = {
|
|
950
|
+
oldState: latest.oldState,
|
|
951
|
+
newState: newerState
|
|
952
|
+
};
|
|
953
|
+
};
|
|
954
|
+
return wrapped;
|
|
955
|
+
},
|
|
956
|
+
diff(uid, modules, numbers) {
|
|
957
|
+
const {
|
|
958
|
+
oldState,
|
|
959
|
+
newState
|
|
960
|
+
} = states[uid];
|
|
961
|
+
const diffResult = [];
|
|
962
|
+
for (let i = 0; i < modules.length; i++) {
|
|
963
|
+
const fn = modules[i];
|
|
964
|
+
if (!fn(oldState, newState)) {
|
|
965
|
+
diffResult.push(numbers[i]);
|
|
966
|
+
}
|
|
967
|
+
}
|
|
968
|
+
return diffResult;
|
|
911
969
|
}
|
|
912
970
|
};
|
|
913
971
|
};
|
|
@@ -915,7 +973,8 @@ const create$2 = () => {
|
|
|
915
973
|
const {
|
|
916
974
|
get,
|
|
917
975
|
set,
|
|
918
|
-
|
|
976
|
+
dispose: dispose$1,
|
|
977
|
+
wrapCommand
|
|
919
978
|
} = create$2();
|
|
920
979
|
|
|
921
980
|
const create$1 = ({
|
|
@@ -1071,7 +1130,7 @@ const diff2 = uid => {
|
|
|
1071
1130
|
};
|
|
1072
1131
|
|
|
1073
1132
|
const dispose = uid => {
|
|
1074
|
-
|
|
1133
|
+
dispose$1(uid);
|
|
1075
1134
|
};
|
|
1076
1135
|
|
|
1077
1136
|
const setColorTheme = id => {
|
|
@@ -2773,6 +2832,12 @@ const text = data => {
|
|
|
2773
2832
|
childCount: 0
|
|
2774
2833
|
};
|
|
2775
2834
|
};
|
|
2835
|
+
const px = value => {
|
|
2836
|
+
return `${value}px`;
|
|
2837
|
+
};
|
|
2838
|
+
const position = (x, y) => {
|
|
2839
|
+
return `${x}px ${y}px`;
|
|
2840
|
+
};
|
|
2776
2841
|
|
|
2777
2842
|
const quickPickHighlight = {
|
|
2778
2843
|
type: Span,
|
|
@@ -2874,13 +2939,6 @@ const getQuickPickItemsVirtualDom = visibleItems => {
|
|
|
2874
2939
|
return dom;
|
|
2875
2940
|
};
|
|
2876
2941
|
|
|
2877
|
-
const px = value => {
|
|
2878
|
-
return `${value}px`;
|
|
2879
|
-
};
|
|
2880
|
-
const position = (x, y) => {
|
|
2881
|
-
return `${x}px ${y}px`;
|
|
2882
|
-
};
|
|
2883
|
-
|
|
2884
2942
|
const getScrollBarVirtualDom = (scrollBarHeight, scrollBarTop) => {
|
|
2885
2943
|
const shouldShowScrollbar = scrollBarHeight > 0;
|
|
2886
2944
|
if (!shouldShowScrollbar) {
|
|
@@ -3029,21 +3087,6 @@ const selectItem = async (state, label) => {
|
|
|
3029
3087
|
return selectIndex(state, index);
|
|
3030
3088
|
};
|
|
3031
3089
|
|
|
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
3090
|
const commandMap = {
|
|
3048
3091
|
'QuickPick.addMenuEntries': add,
|
|
3049
3092
|
'QuickPick.close': close,
|
|
@@ -3137,7 +3180,7 @@ const listen = async () => {
|
|
|
3137
3180
|
const rpc = await WebWorkerRpcClient.create({
|
|
3138
3181
|
commandMap: commandMap
|
|
3139
3182
|
});
|
|
3140
|
-
set$1(
|
|
3183
|
+
set$1(rpc);
|
|
3141
3184
|
};
|
|
3142
3185
|
|
|
3143
3186
|
const main = async () => {
|