@lvce-editor/extension-host-worker 5.28.0 → 5.29.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/extensionHostWorkerMain.js +1227 -1205
- package/package.json +1 -1
|
@@ -764,16 +764,16 @@ const setConfigurations = preferences => {
|
|
|
764
764
|
state$b.configuration = preferences;
|
|
765
765
|
};
|
|
766
766
|
|
|
767
|
+
const DebugWorker$1 = 55;
|
|
768
|
+
|
|
767
769
|
const rpcs$2 = Object.create(null);
|
|
768
|
-
const set$
|
|
770
|
+
const set$c = (id, rpc) => {
|
|
769
771
|
rpcs$2[id] = rpc;
|
|
770
772
|
};
|
|
771
773
|
const get$b = id => {
|
|
772
774
|
return rpcs$2[id];
|
|
773
775
|
};
|
|
774
776
|
|
|
775
|
-
/* eslint-disable @typescript-eslint/explicit-function-return-type */
|
|
776
|
-
|
|
777
777
|
const create$a = rpcId => {
|
|
778
778
|
return {
|
|
779
779
|
// @ts-ignore
|
|
@@ -789,7 +789,7 @@ const create$a = rpcId => {
|
|
|
789
789
|
return rpc.invokeAndTransfer(method, ...params);
|
|
790
790
|
},
|
|
791
791
|
set(rpc) {
|
|
792
|
-
set$
|
|
792
|
+
set$c(rpcId, rpc);
|
|
793
793
|
},
|
|
794
794
|
async dispose() {
|
|
795
795
|
const rpc = get$b(rpcId);
|
|
@@ -797,808 +797,391 @@ const create$a = rpcId => {
|
|
|
797
797
|
}
|
|
798
798
|
};
|
|
799
799
|
};
|
|
800
|
-
const DebugWorker$1 = 55;
|
|
801
|
-
const {
|
|
802
|
-
invoke: invoke$d} = create$a(DebugWorker$1);
|
|
803
|
-
const DebugWorker = {
|
|
804
|
-
__proto__: null,
|
|
805
|
-
invoke: invoke$d};
|
|
806
800
|
|
|
807
801
|
const {
|
|
808
|
-
invoke: invoke$
|
|
809
|
-
|
|
802
|
+
invoke: invoke$4,
|
|
803
|
+
invokeAndTransfer: invokeAndTransfer$3,
|
|
804
|
+
set: set$b,
|
|
805
|
+
dispose
|
|
806
|
+
} = create$a(DebugWorker$1);
|
|
810
807
|
|
|
811
|
-
const
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
// @ts-ignore
|
|
818
|
-
throw new VError(`no debug provider "${id}" found`);
|
|
819
|
-
}
|
|
820
|
-
return provider;
|
|
808
|
+
const DebugWorker = {
|
|
809
|
+
__proto__: null,
|
|
810
|
+
dispose,
|
|
811
|
+
invoke: invoke$4,
|
|
812
|
+
invokeAndTransfer: invokeAndTransfer$3,
|
|
813
|
+
set: set$b
|
|
821
814
|
};
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
}
|
|
826
|
-
state$a.debugProviderMap[debugProvider.id] = debugProvider;
|
|
815
|
+
|
|
816
|
+
const isMessagePort = value => {
|
|
817
|
+
return value && value instanceof MessagePort;
|
|
827
818
|
};
|
|
828
|
-
const
|
|
829
|
-
|
|
830
|
-
await invoke$3('Debug.paused', params);
|
|
819
|
+
const isMessagePortMain = value => {
|
|
820
|
+
return value && value.constructor && value.constructor.name === 'MessagePortMain';
|
|
831
821
|
};
|
|
832
|
-
const
|
|
833
|
-
|
|
834
|
-
await invoke$3('Debug.resumed');
|
|
822
|
+
const isOffscreenCanvas = value => {
|
|
823
|
+
return typeof OffscreenCanvas !== 'undefined' && value instanceof OffscreenCanvas;
|
|
835
824
|
};
|
|
836
|
-
const
|
|
837
|
-
|
|
838
|
-
await invoke$3('Debug.scriptParsed', parsedScript);
|
|
825
|
+
const isInstanceOf = (value, constructorName) => {
|
|
826
|
+
return value?.constructor?.name === constructorName;
|
|
839
827
|
};
|
|
840
|
-
const
|
|
841
|
-
|
|
842
|
-
// @ts-ignore
|
|
843
|
-
await invoke$3('Debug.handleChange', params);
|
|
828
|
+
const isSocket = value => {
|
|
829
|
+
return isInstanceOf(value, 'Socket');
|
|
844
830
|
};
|
|
845
|
-
const
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
handleScriptParsed,
|
|
852
|
-
handleChange
|
|
853
|
-
};
|
|
854
|
-
await provider.start(emitter, path);
|
|
855
|
-
} catch (error) {
|
|
856
|
-
throw new VError(error, 'Failed to execute debug provider');
|
|
831
|
+
const transferrables = [isMessagePort, isMessagePortMain, isOffscreenCanvas, isSocket];
|
|
832
|
+
const isTransferrable = value => {
|
|
833
|
+
for (const fn of transferrables) {
|
|
834
|
+
if (fn(value)) {
|
|
835
|
+
return true;
|
|
836
|
+
}
|
|
857
837
|
}
|
|
838
|
+
return false;
|
|
858
839
|
};
|
|
859
|
-
const
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
const processes = await provider.listProcesses(path);
|
|
863
|
-
array(processes);
|
|
864
|
-
return processes;
|
|
865
|
-
} catch (error) {
|
|
866
|
-
throw new VError(error, 'Failed to execute debug provider');
|
|
840
|
+
const walkValue = (value, transferrables, isTransferrable) => {
|
|
841
|
+
if (!value) {
|
|
842
|
+
return;
|
|
867
843
|
}
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
const provider = getDebugProvider(protocol);
|
|
872
|
-
return await provider.resume();
|
|
873
|
-
} catch (error) {
|
|
874
|
-
throw new VError(error, 'Failed to execute debug provider');
|
|
844
|
+
if (isTransferrable(value)) {
|
|
845
|
+
transferrables.push(value);
|
|
846
|
+
return;
|
|
875
847
|
}
|
|
876
|
-
|
|
877
|
-
const
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
return
|
|
881
|
-
} catch (error) {
|
|
882
|
-
throw new VError(error, 'Failed to execute debug provider');
|
|
848
|
+
if (Array.isArray(value)) {
|
|
849
|
+
for (const item of value) {
|
|
850
|
+
walkValue(item, transferrables, isTransferrable);
|
|
851
|
+
}
|
|
852
|
+
return;
|
|
883
853
|
}
|
|
884
|
-
|
|
885
|
-
const
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
return
|
|
889
|
-
} catch (error) {
|
|
890
|
-
throw new VError(error, 'Failed to execute debug provider');
|
|
854
|
+
if (typeof value === 'object') {
|
|
855
|
+
for (const property of Object.values(value)) {
|
|
856
|
+
walkValue(property, transferrables, isTransferrable);
|
|
857
|
+
}
|
|
858
|
+
return;
|
|
891
859
|
}
|
|
892
860
|
};
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
try {
|
|
898
|
-
const provider = getDebugProvider(protocol);
|
|
899
|
-
return await provider.getStatus();
|
|
900
|
-
} catch (error) {
|
|
901
|
-
throw new VError(error, 'Failed to execute debug provider');
|
|
902
|
-
}
|
|
861
|
+
const getTransferrables = value => {
|
|
862
|
+
const transferrables = [];
|
|
863
|
+
walkValue(value, transferrables, isTransferrable);
|
|
864
|
+
return transferrables;
|
|
903
865
|
};
|
|
904
|
-
const
|
|
905
|
-
|
|
906
|
-
const
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
}
|
|
866
|
+
const attachEvents = that => {
|
|
867
|
+
const handleMessage = (...args) => {
|
|
868
|
+
const data = that.getData(...args);
|
|
869
|
+
that.dispatchEvent(new MessageEvent('message', {
|
|
870
|
+
data
|
|
871
|
+
}));
|
|
872
|
+
};
|
|
873
|
+
that.onMessage(handleMessage);
|
|
874
|
+
const handleClose = event => {
|
|
875
|
+
that.dispatchEvent(new Event('close'));
|
|
876
|
+
};
|
|
877
|
+
that.onClose(handleClose);
|
|
911
878
|
};
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
throw new VError(error, 'Failed to execute debug provider');
|
|
879
|
+
class Ipc extends EventTarget {
|
|
880
|
+
constructor(rawIpc) {
|
|
881
|
+
super();
|
|
882
|
+
this._rawIpc = rawIpc;
|
|
883
|
+
attachEvents(this);
|
|
918
884
|
}
|
|
885
|
+
}
|
|
886
|
+
const E_INCOMPATIBLE_NATIVE_MODULE = 'E_INCOMPATIBLE_NATIVE_MODULE';
|
|
887
|
+
const E_MODULES_NOT_SUPPORTED_IN_ELECTRON = 'E_MODULES_NOT_SUPPORTED_IN_ELECTRON';
|
|
888
|
+
const ERR_MODULE_NOT_FOUND = 'ERR_MODULE_NOT_FOUND';
|
|
889
|
+
const NewLine$2 = '\n';
|
|
890
|
+
const joinLines$1 = lines => {
|
|
891
|
+
return lines.join(NewLine$2);
|
|
919
892
|
};
|
|
920
|
-
const
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
} catch (error) {
|
|
925
|
-
throw new VError(error, 'Failed to execute debug provider');
|
|
926
|
-
}
|
|
893
|
+
const RE_AT = /^\s+at/;
|
|
894
|
+
const RE_AT_PROMISE_INDEX = /^\s*at async Promise.all \(index \d+\)$/;
|
|
895
|
+
const isNormalStackLine = line => {
|
|
896
|
+
return RE_AT.test(line) && !RE_AT_PROMISE_INDEX.test(line);
|
|
927
897
|
};
|
|
928
|
-
const
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
return
|
|
932
|
-
|
|
933
|
-
|
|
898
|
+
const getDetails = lines => {
|
|
899
|
+
const index = lines.findIndex(isNormalStackLine);
|
|
900
|
+
if (index === -1) {
|
|
901
|
+
return {
|
|
902
|
+
actualMessage: joinLines$1(lines),
|
|
903
|
+
rest: []
|
|
904
|
+
};
|
|
934
905
|
}
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
} catch (error) {
|
|
941
|
-
throw new VError(error, 'Failed to execute debug provider');
|
|
906
|
+
let lastIndex = index - 1;
|
|
907
|
+
while (++lastIndex < lines.length) {
|
|
908
|
+
if (!isNormalStackLine(lines[lastIndex])) {
|
|
909
|
+
break;
|
|
910
|
+
}
|
|
942
911
|
}
|
|
912
|
+
return {
|
|
913
|
+
actualMessage: lines[index - 1],
|
|
914
|
+
rest: lines.slice(index, lastIndex)
|
|
915
|
+
};
|
|
943
916
|
};
|
|
944
|
-
const
|
|
945
|
-
|
|
946
|
-
const provider = getDebugProvider(protocol);
|
|
947
|
-
return await provider.stepOut();
|
|
948
|
-
} catch (error) {
|
|
949
|
-
throw new VError(error, 'Failed to execute debug provider');
|
|
950
|
-
}
|
|
917
|
+
const splitLines$2 = lines => {
|
|
918
|
+
return lines.split(NewLine$2);
|
|
951
919
|
};
|
|
952
|
-
const
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
} catch (error) {
|
|
957
|
-
throw new VError(error, 'Failed to execute debug provider');
|
|
958
|
-
}
|
|
920
|
+
const RE_MESSAGE_CODE_BLOCK_START = /^Error: The module '.*'$/;
|
|
921
|
+
const RE_MESSAGE_CODE_BLOCK_END = /^\s* at/;
|
|
922
|
+
const isMessageCodeBlockStartIndex = line => {
|
|
923
|
+
return RE_MESSAGE_CODE_BLOCK_START.test(line);
|
|
959
924
|
};
|
|
960
|
-
const
|
|
961
|
-
|
|
962
|
-
const provider = getDebugProvider(protocol);
|
|
963
|
-
return await provider.setPauseOnExceptions(value);
|
|
964
|
-
} catch (error) {
|
|
965
|
-
throw new VError(error, 'Failed to execute debug provider');
|
|
966
|
-
}
|
|
925
|
+
const isMessageCodeBlockEndIndex = line => {
|
|
926
|
+
return RE_MESSAGE_CODE_BLOCK_END.test(line);
|
|
967
927
|
};
|
|
968
|
-
const
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
928
|
+
const getMessageCodeBlock = stderr => {
|
|
929
|
+
const lines = splitLines$2(stderr);
|
|
930
|
+
const startIndex = lines.findIndex(isMessageCodeBlockStartIndex);
|
|
931
|
+
const endIndex = startIndex + lines.slice(startIndex).findIndex(isMessageCodeBlockEndIndex, startIndex);
|
|
932
|
+
const relevantLines = lines.slice(startIndex, endIndex);
|
|
933
|
+
const relevantMessage = relevantLines.join(' ').slice('Error: '.length);
|
|
934
|
+
return relevantMessage;
|
|
975
935
|
};
|
|
976
|
-
const
|
|
977
|
-
|
|
978
|
-
const provider = getDebugProvider(protocol);
|
|
979
|
-
return await provider.evaluate(expression, callFrameId);
|
|
980
|
-
} catch (error) {
|
|
981
|
-
throw new VError(error, 'Failed to execute debug provider');
|
|
982
|
-
}
|
|
936
|
+
const isModuleNotFoundMessage = line => {
|
|
937
|
+
return line.includes('[ERR_MODULE_NOT_FOUND]');
|
|
983
938
|
};
|
|
984
|
-
const
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
939
|
+
const getModuleNotFoundError = stderr => {
|
|
940
|
+
const lines = splitLines$2(stderr);
|
|
941
|
+
const messageIndex = lines.findIndex(isModuleNotFoundMessage);
|
|
942
|
+
const message = lines[messageIndex];
|
|
943
|
+
return {
|
|
944
|
+
message,
|
|
945
|
+
code: ERR_MODULE_NOT_FOUND
|
|
946
|
+
};
|
|
991
947
|
};
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
executeDefinitionProvider} = create$b({
|
|
996
|
-
name: 'Definition',
|
|
997
|
-
resultShape: {
|
|
998
|
-
allowUndefined: true,
|
|
999
|
-
type: Object$1,
|
|
1000
|
-
properties: {
|
|
1001
|
-
uri: {
|
|
1002
|
-
type: String$1
|
|
1003
|
-
},
|
|
1004
|
-
startOffset: {
|
|
1005
|
-
type: Number
|
|
1006
|
-
},
|
|
1007
|
-
endOffset: {
|
|
1008
|
-
type: Number
|
|
1009
|
-
}
|
|
1010
|
-
}
|
|
1011
|
-
}
|
|
1012
|
-
});
|
|
1013
|
-
|
|
1014
|
-
const {
|
|
1015
|
-
registerDiagnosticProvider,
|
|
1016
|
-
executeDiagnosticProvider
|
|
1017
|
-
} = create$b({
|
|
1018
|
-
name: 'Diagnostic',
|
|
1019
|
-
resultShape: {
|
|
1020
|
-
type: Array$1,
|
|
1021
|
-
items: {
|
|
1022
|
-
type: Object$1
|
|
1023
|
-
}
|
|
948
|
+
const isModuleNotFoundError = stderr => {
|
|
949
|
+
if (!stderr) {
|
|
950
|
+
return false;
|
|
1024
951
|
}
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
const RendererWorker = 1;
|
|
1028
|
-
|
|
1029
|
-
const invoke$2 = (method, ...params) => {
|
|
1030
|
-
const rpc = get$b(RendererWorker);
|
|
1031
|
-
return rpc.invoke(method, ...params);
|
|
952
|
+
return stderr.includes('ERR_MODULE_NOT_FOUND');
|
|
1032
953
|
};
|
|
1033
|
-
const
|
|
1034
|
-
|
|
1035
|
-
|
|
954
|
+
const isModulesSyntaxError = stderr => {
|
|
955
|
+
if (!stderr) {
|
|
956
|
+
return false;
|
|
957
|
+
}
|
|
958
|
+
return stderr.includes('SyntaxError: Cannot use import statement outside a module');
|
|
1036
959
|
};
|
|
1037
|
-
|
|
1038
|
-
const
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
return result;
|
|
960
|
+
const RE_NATIVE_MODULE_ERROR = /^innerError Error: Cannot find module '.*.node'/;
|
|
961
|
+
const RE_NATIVE_MODULE_ERROR_2 = /was compiled against a different Node.js version/;
|
|
962
|
+
const isUnhelpfulNativeModuleError = stderr => {
|
|
963
|
+
return RE_NATIVE_MODULE_ERROR.test(stderr) && RE_NATIVE_MODULE_ERROR_2.test(stderr);
|
|
1042
964
|
};
|
|
1043
|
-
|
|
1044
|
-
const
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
965
|
+
const getNativeModuleErrorMessage = stderr => {
|
|
966
|
+
const message = getMessageCodeBlock(stderr);
|
|
967
|
+
return {
|
|
968
|
+
message: `Incompatible native node module: ${message}`,
|
|
969
|
+
code: E_INCOMPATIBLE_NATIVE_MODULE
|
|
970
|
+
};
|
|
1048
971
|
};
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
// @ts-ignore
|
|
1055
|
-
throw new VError(`no file system provider for protocol "${protocol}" found`);
|
|
1056
|
-
}
|
|
1057
|
-
return provider;
|
|
972
|
+
const getModuleSyntaxError = () => {
|
|
973
|
+
return {
|
|
974
|
+
message: `ES Modules are not supported in electron`,
|
|
975
|
+
code: E_MODULES_NOT_SUPPORTED_IN_ELECTRON
|
|
976
|
+
};
|
|
1058
977
|
};
|
|
1059
|
-
const
|
|
1060
|
-
if (
|
|
1061
|
-
|
|
978
|
+
const getHelpfulChildProcessError = (stdout, stderr) => {
|
|
979
|
+
if (isUnhelpfulNativeModuleError(stderr)) {
|
|
980
|
+
return getNativeModuleErrorMessage(stderr);
|
|
1062
981
|
}
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
const registerFileSystemProvider = fileSystemProvider => {
|
|
1067
|
-
if (!fileSystemProvider.id) {
|
|
1068
|
-
throw new Error('Failed to register file system provider: missing id');
|
|
982
|
+
if (isModulesSyntaxError(stderr)) {
|
|
983
|
+
return getModuleSyntaxError();
|
|
1069
984
|
}
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
const readDirWithFileTypes$2 = async (protocol, path) => {
|
|
1073
|
-
try {
|
|
1074
|
-
const provider = get$a(protocol);
|
|
1075
|
-
return await provider.readDirWithFileTypes(path);
|
|
1076
|
-
} catch (error) {
|
|
1077
|
-
throw new VError(error, 'Failed to execute file system provider');
|
|
985
|
+
if (isModuleNotFoundError(stderr)) {
|
|
986
|
+
return getModuleNotFoundError(stderr);
|
|
1078
987
|
}
|
|
988
|
+
const lines = splitLines$2(stderr);
|
|
989
|
+
const {
|
|
990
|
+
actualMessage,
|
|
991
|
+
rest
|
|
992
|
+
} = getDetails(lines);
|
|
993
|
+
return {
|
|
994
|
+
message: actualMessage,
|
|
995
|
+
code: '',
|
|
996
|
+
stack: rest
|
|
997
|
+
};
|
|
1079
998
|
};
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
999
|
+
class IpcError extends VError {
|
|
1000
|
+
// @ts-ignore
|
|
1001
|
+
constructor(betterMessage, stdout = '', stderr = '') {
|
|
1002
|
+
if (stdout || stderr) {
|
|
1003
|
+
// @ts-ignore
|
|
1004
|
+
const {
|
|
1005
|
+
message,
|
|
1006
|
+
code,
|
|
1007
|
+
stack
|
|
1008
|
+
} = getHelpfulChildProcessError(stdout, stderr);
|
|
1009
|
+
const cause = new Error(message);
|
|
1010
|
+
// @ts-ignore
|
|
1011
|
+
cause.code = code;
|
|
1012
|
+
cause.stack = stack;
|
|
1013
|
+
super(cause, betterMessage);
|
|
1014
|
+
} else {
|
|
1015
|
+
super(betterMessage);
|
|
1016
|
+
}
|
|
1017
|
+
// @ts-ignore
|
|
1018
|
+
this.name = 'IpcError';
|
|
1019
|
+
// @ts-ignore
|
|
1020
|
+
this.stdout = stdout;
|
|
1021
|
+
// @ts-ignore
|
|
1022
|
+
this.stderr = stderr;
|
|
1086
1023
|
}
|
|
1024
|
+
}
|
|
1025
|
+
const readyMessage = 'ready';
|
|
1026
|
+
const getData$2 = event => {
|
|
1027
|
+
return event.data;
|
|
1087
1028
|
};
|
|
1088
|
-
const
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
// this avoid parsing the potentially large message
|
|
1093
|
-
// and improve performance by not blocking the renderer worker
|
|
1094
|
-
// when reading / writing large files
|
|
1095
|
-
const content = await invoke$2('FileSystem.readFile', path);
|
|
1096
|
-
return content;
|
|
1097
|
-
};
|
|
1098
|
-
const existsExternal = async uri => {
|
|
1099
|
-
return await invoke$2('FileSystem.exists', uri);
|
|
1029
|
+
const listen$8 = ({
|
|
1030
|
+
port
|
|
1031
|
+
}) => {
|
|
1032
|
+
return port;
|
|
1100
1033
|
};
|
|
1101
|
-
const
|
|
1102
|
-
|
|
1103
|
-
// don't ask renderer worker
|
|
1104
|
-
// instead read file directly from shared process
|
|
1105
|
-
// this avoid parsing the potentially large message
|
|
1106
|
-
// and improve performance by not blocking the renderer worker
|
|
1107
|
-
// when reading / writing large files
|
|
1108
|
-
const content = await invoke$2('FileSystem.readDirWithFileTypes', path);
|
|
1109
|
-
return content;
|
|
1034
|
+
const signal$9 = port => {
|
|
1035
|
+
port.postMessage(readyMessage);
|
|
1110
1036
|
};
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
return await provider.remove(path);
|
|
1115
|
-
} catch (error) {
|
|
1116
|
-
throw new VError(error, 'Failed to execute file system provider');
|
|
1037
|
+
class IpcChildWithMessagePort extends Ipc {
|
|
1038
|
+
getData(event) {
|
|
1039
|
+
return getData$2(event);
|
|
1117
1040
|
}
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
try {
|
|
1121
|
-
const provider = get$a(protocol);
|
|
1122
|
-
return await provider.rename(oldUri, newUri);
|
|
1123
|
-
} catch (error) {
|
|
1124
|
-
throw new VError(error, 'Failed to execute file system provider');
|
|
1041
|
+
send(message) {
|
|
1042
|
+
this._rawIpc.postMessage(message);
|
|
1125
1043
|
}
|
|
1126
|
-
|
|
1127
|
-
const
|
|
1128
|
-
|
|
1129
|
-
const provider = get$a(protocol);
|
|
1130
|
-
return await provider.writeFile(uri, content);
|
|
1131
|
-
} catch (error) {
|
|
1132
|
-
throw new VError(error, 'Failed to execute file system provider');
|
|
1044
|
+
sendAndTransfer(message) {
|
|
1045
|
+
const transfer = getTransferrables(message);
|
|
1046
|
+
this._rawIpc.postMessage(message, transfer);
|
|
1133
1047
|
}
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
try {
|
|
1137
|
-
const provider = get$a(protocol);
|
|
1138
|
-
return provider.pathSeparator;
|
|
1139
|
-
} catch (error) {
|
|
1140
|
-
throw new VError(error, 'Failed to execute file system provider');
|
|
1048
|
+
dispose() {
|
|
1049
|
+
// ignore
|
|
1141
1050
|
}
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
const {
|
|
1145
|
-
registerFormattingProvider,
|
|
1146
|
-
executeFormattingProvider} = create$b({
|
|
1147
|
-
name: 'Formatting',
|
|
1148
|
-
executeKey: 'format',
|
|
1149
|
-
resultShape: {
|
|
1150
|
-
allowUndefined: true,
|
|
1151
|
-
type: Array$1,
|
|
1152
|
-
items: {
|
|
1153
|
-
type: Object$1,
|
|
1154
|
-
properties: {
|
|
1155
|
-
startOffset: {
|
|
1156
|
-
type: Number
|
|
1157
|
-
},
|
|
1158
|
-
endOffset: {
|
|
1159
|
-
type: Number
|
|
1160
|
-
},
|
|
1161
|
-
inserted: {
|
|
1162
|
-
type: String$1
|
|
1163
|
-
}
|
|
1164
|
-
}
|
|
1165
|
-
}
|
|
1051
|
+
onClose(callback) {
|
|
1052
|
+
// ignore
|
|
1166
1053
|
}
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
let offset = 0;
|
|
1171
|
-
let rowIndex = 0;
|
|
1172
|
-
while (rowIndex++ < position.rowIndex) {
|
|
1173
|
-
const newLineIndex = textDocument.text.indexOf('\n', offset);
|
|
1174
|
-
offset = newLineIndex + 1;
|
|
1054
|
+
onMessage(callback) {
|
|
1055
|
+
this._rawIpc.addEventListener('message', callback);
|
|
1056
|
+
this._rawIpc.start();
|
|
1175
1057
|
}
|
|
1176
|
-
|
|
1177
|
-
|
|
1058
|
+
}
|
|
1059
|
+
const wrap$g = port => {
|
|
1060
|
+
return new IpcChildWithMessagePort(port);
|
|
1178
1061
|
};
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
const {
|
|
1185
|
-
text
|
|
1186
|
-
} = textDocument;
|
|
1187
|
-
while (index < offset) {
|
|
1188
|
-
newLineIndex = text.indexOf('\n', index);
|
|
1189
|
-
if (newLineIndex === -1) {
|
|
1190
|
-
break;
|
|
1191
|
-
}
|
|
1192
|
-
const newIndex = newLineIndex + 1;
|
|
1193
|
-
if (newIndex > offset) {
|
|
1194
|
-
break;
|
|
1195
|
-
}
|
|
1196
|
-
index = newIndex;
|
|
1197
|
-
rowIndex++;
|
|
1198
|
-
}
|
|
1199
|
-
const columnIndex = offset - index;
|
|
1200
|
-
return {
|
|
1201
|
-
rowIndex,
|
|
1202
|
-
columnIndex
|
|
1203
|
-
};
|
|
1062
|
+
const IpcChildWithMessagePort$1 = {
|
|
1063
|
+
__proto__: null,
|
|
1064
|
+
listen: listen$8,
|
|
1065
|
+
signal: signal$9,
|
|
1066
|
+
wrap: wrap$g
|
|
1204
1067
|
};
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
name: 'Hover',
|
|
1210
|
-
resultShape: {
|
|
1211
|
-
allowUndefined: true,
|
|
1212
|
-
type: Object$1,
|
|
1213
|
-
properties: {}
|
|
1214
|
-
}
|
|
1215
|
-
});
|
|
1216
|
-
|
|
1217
|
-
const {
|
|
1218
|
-
registerImplementationProvider,
|
|
1219
|
-
executeImplementationProvider} = create$b({
|
|
1220
|
-
name: 'Implementation',
|
|
1221
|
-
resultShape: {
|
|
1222
|
-
type: Array$1,
|
|
1223
|
-
items: {
|
|
1224
|
-
type: Object$1
|
|
1225
|
-
}
|
|
1068
|
+
const listen$7 = () => {
|
|
1069
|
+
// @ts-ignore
|
|
1070
|
+
if (typeof WorkerGlobalScope === 'undefined') {
|
|
1071
|
+
throw new TypeError('module is not in web worker scope');
|
|
1226
1072
|
}
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
const WebSocket$1 = 5;
|
|
1230
|
-
const ElectronMessagePort = 6;
|
|
1231
|
-
const ModuleWorkerAndWorkaroundForChromeDevtoolsBug$1 = 7;
|
|
1232
|
-
|
|
1233
|
-
const isMessagePort = value => {
|
|
1234
|
-
return value && value instanceof MessagePort;
|
|
1235
|
-
};
|
|
1236
|
-
const isMessagePortMain = value => {
|
|
1237
|
-
return value && value.constructor && value.constructor.name === 'MessagePortMain';
|
|
1238
|
-
};
|
|
1239
|
-
const isOffscreenCanvas = value => {
|
|
1240
|
-
return typeof OffscreenCanvas !== 'undefined' && value instanceof OffscreenCanvas;
|
|
1241
|
-
};
|
|
1242
|
-
const isInstanceOf = (value, constructorName) => {
|
|
1243
|
-
return value?.constructor?.name === constructorName;
|
|
1073
|
+
return globalThis;
|
|
1244
1074
|
};
|
|
1245
|
-
const
|
|
1246
|
-
|
|
1075
|
+
const signal$8 = global => {
|
|
1076
|
+
global.postMessage(readyMessage);
|
|
1247
1077
|
};
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
if (fn(value)) {
|
|
1252
|
-
return true;
|
|
1253
|
-
}
|
|
1078
|
+
class IpcChildWithModuleWorker extends Ipc {
|
|
1079
|
+
getData(event) {
|
|
1080
|
+
return getData$2(event);
|
|
1254
1081
|
}
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
if (!value) {
|
|
1259
|
-
return;
|
|
1082
|
+
send(message) {
|
|
1083
|
+
// @ts-ignore
|
|
1084
|
+
this._rawIpc.postMessage(message);
|
|
1260
1085
|
}
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1086
|
+
sendAndTransfer(message) {
|
|
1087
|
+
const transfer = getTransferrables(message);
|
|
1088
|
+
// @ts-ignore
|
|
1089
|
+
this._rawIpc.postMessage(message, transfer);
|
|
1264
1090
|
}
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
walkValue(item, transferrables, isTransferrable);
|
|
1268
|
-
}
|
|
1269
|
-
return;
|
|
1091
|
+
dispose() {
|
|
1092
|
+
// ignore
|
|
1270
1093
|
}
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
walkValue(property, transferrables, isTransferrable);
|
|
1274
|
-
}
|
|
1275
|
-
return;
|
|
1094
|
+
onClose(callback) {
|
|
1095
|
+
// ignore
|
|
1276
1096
|
}
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
const transferrables = [];
|
|
1280
|
-
walkValue(value, transferrables, isTransferrable);
|
|
1281
|
-
return transferrables;
|
|
1282
|
-
};
|
|
1283
|
-
const attachEvents = that => {
|
|
1284
|
-
const handleMessage = (...args) => {
|
|
1285
|
-
const data = that.getData(...args);
|
|
1286
|
-
that.dispatchEvent(new MessageEvent('message', {
|
|
1287
|
-
data
|
|
1288
|
-
}));
|
|
1289
|
-
};
|
|
1290
|
-
that.onMessage(handleMessage);
|
|
1291
|
-
const handleClose = event => {
|
|
1292
|
-
that.dispatchEvent(new Event('close'));
|
|
1293
|
-
};
|
|
1294
|
-
that.onClose(handleClose);
|
|
1295
|
-
};
|
|
1296
|
-
class Ipc extends EventTarget {
|
|
1297
|
-
constructor(rawIpc) {
|
|
1298
|
-
super();
|
|
1299
|
-
this._rawIpc = rawIpc;
|
|
1300
|
-
attachEvents(this);
|
|
1097
|
+
onMessage(callback) {
|
|
1098
|
+
this._rawIpc.addEventListener('message', callback);
|
|
1301
1099
|
}
|
|
1302
1100
|
}
|
|
1303
|
-
const
|
|
1304
|
-
|
|
1305
|
-
const ERR_MODULE_NOT_FOUND = 'ERR_MODULE_NOT_FOUND';
|
|
1306
|
-
const NewLine$2 = '\n';
|
|
1307
|
-
const joinLines$1 = lines => {
|
|
1308
|
-
return lines.join(NewLine$2);
|
|
1101
|
+
const wrap$f = global => {
|
|
1102
|
+
return new IpcChildWithModuleWorker(global);
|
|
1309
1103
|
};
|
|
1310
|
-
const
|
|
1311
|
-
const
|
|
1312
|
-
|
|
1313
|
-
|
|
1104
|
+
const waitForFirstMessage = async port => {
|
|
1105
|
+
const {
|
|
1106
|
+
resolve,
|
|
1107
|
+
promise
|
|
1108
|
+
} = Promise.withResolvers();
|
|
1109
|
+
port.addEventListener('message', resolve, {
|
|
1110
|
+
once: true
|
|
1111
|
+
});
|
|
1112
|
+
const event = await promise;
|
|
1113
|
+
// @ts-ignore
|
|
1114
|
+
return event.data;
|
|
1314
1115
|
};
|
|
1315
|
-
const
|
|
1316
|
-
const
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1116
|
+
const listen$6 = async () => {
|
|
1117
|
+
const parentIpcRaw = listen$7();
|
|
1118
|
+
signal$8(parentIpcRaw);
|
|
1119
|
+
const parentIpc = wrap$f(parentIpcRaw);
|
|
1120
|
+
const firstMessage = await waitForFirstMessage(parentIpc);
|
|
1121
|
+
if (firstMessage.method !== 'initialize') {
|
|
1122
|
+
throw new IpcError('unexpected first message');
|
|
1322
1123
|
}
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1124
|
+
const type = firstMessage.params[0];
|
|
1125
|
+
if (type === 'message-port') {
|
|
1126
|
+
parentIpc.send({
|
|
1127
|
+
jsonrpc: '2.0',
|
|
1128
|
+
id: firstMessage.id,
|
|
1129
|
+
result: null
|
|
1130
|
+
});
|
|
1131
|
+
parentIpc.dispose();
|
|
1132
|
+
const port = firstMessage.params[1];
|
|
1133
|
+
return port;
|
|
1328
1134
|
}
|
|
1329
|
-
return
|
|
1330
|
-
actualMessage: lines[index - 1],
|
|
1331
|
-
rest: lines.slice(index, lastIndex)
|
|
1332
|
-
};
|
|
1135
|
+
return globalThis;
|
|
1333
1136
|
};
|
|
1334
|
-
|
|
1335
|
-
|
|
1137
|
+
class IpcChildWithModuleWorkerAndMessagePort extends Ipc {
|
|
1138
|
+
getData(event) {
|
|
1139
|
+
return getData$2(event);
|
|
1140
|
+
}
|
|
1141
|
+
send(message) {
|
|
1142
|
+
this._rawIpc.postMessage(message);
|
|
1143
|
+
}
|
|
1144
|
+
sendAndTransfer(message) {
|
|
1145
|
+
const transfer = getTransferrables(message);
|
|
1146
|
+
this._rawIpc.postMessage(message, transfer);
|
|
1147
|
+
}
|
|
1148
|
+
dispose() {
|
|
1149
|
+
if (this._rawIpc.close) {
|
|
1150
|
+
this._rawIpc.close();
|
|
1151
|
+
}
|
|
1152
|
+
}
|
|
1153
|
+
onClose(callback) {
|
|
1154
|
+
// ignore
|
|
1155
|
+
}
|
|
1156
|
+
onMessage(callback) {
|
|
1157
|
+
this._rawIpc.addEventListener('message', callback);
|
|
1158
|
+
this._rawIpc.start();
|
|
1159
|
+
}
|
|
1160
|
+
}
|
|
1161
|
+
const wrap$e = port => {
|
|
1162
|
+
return new IpcChildWithModuleWorkerAndMessagePort(port);
|
|
1336
1163
|
};
|
|
1337
|
-
const
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1164
|
+
const IpcChildWithModuleWorkerAndMessagePort$1 = {
|
|
1165
|
+
__proto__: null,
|
|
1166
|
+
listen: listen$6,
|
|
1167
|
+
wrap: wrap$e
|
|
1341
1168
|
};
|
|
1342
|
-
const
|
|
1343
|
-
|
|
1169
|
+
const Error$3 = 1;
|
|
1170
|
+
const Open = 2;
|
|
1171
|
+
const Close = 3;
|
|
1172
|
+
const addListener = (emitter, type, callback) => {
|
|
1173
|
+
if ('addEventListener' in emitter) {
|
|
1174
|
+
emitter.addEventListener(type, callback);
|
|
1175
|
+
} else {
|
|
1176
|
+
emitter.on(type, callback);
|
|
1177
|
+
}
|
|
1344
1178
|
};
|
|
1345
|
-
const
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
return relevantMessage;
|
|
1352
|
-
};
|
|
1353
|
-
const isModuleNotFoundMessage = line => {
|
|
1354
|
-
return line.includes('[ERR_MODULE_NOT_FOUND]');
|
|
1355
|
-
};
|
|
1356
|
-
const getModuleNotFoundError = stderr => {
|
|
1357
|
-
const lines = splitLines$2(stderr);
|
|
1358
|
-
const messageIndex = lines.findIndex(isModuleNotFoundMessage);
|
|
1359
|
-
const message = lines[messageIndex];
|
|
1360
|
-
return {
|
|
1361
|
-
message,
|
|
1362
|
-
code: ERR_MODULE_NOT_FOUND
|
|
1363
|
-
};
|
|
1364
|
-
};
|
|
1365
|
-
const isModuleNotFoundError = stderr => {
|
|
1366
|
-
if (!stderr) {
|
|
1367
|
-
return false;
|
|
1368
|
-
}
|
|
1369
|
-
return stderr.includes('ERR_MODULE_NOT_FOUND');
|
|
1370
|
-
};
|
|
1371
|
-
const isModulesSyntaxError = stderr => {
|
|
1372
|
-
if (!stderr) {
|
|
1373
|
-
return false;
|
|
1374
|
-
}
|
|
1375
|
-
return stderr.includes('SyntaxError: Cannot use import statement outside a module');
|
|
1376
|
-
};
|
|
1377
|
-
const RE_NATIVE_MODULE_ERROR = /^innerError Error: Cannot find module '.*.node'/;
|
|
1378
|
-
const RE_NATIVE_MODULE_ERROR_2 = /was compiled against a different Node.js version/;
|
|
1379
|
-
const isUnhelpfulNativeModuleError = stderr => {
|
|
1380
|
-
return RE_NATIVE_MODULE_ERROR.test(stderr) && RE_NATIVE_MODULE_ERROR_2.test(stderr);
|
|
1381
|
-
};
|
|
1382
|
-
const getNativeModuleErrorMessage = stderr => {
|
|
1383
|
-
const message = getMessageCodeBlock(stderr);
|
|
1384
|
-
return {
|
|
1385
|
-
message: `Incompatible native node module: ${message}`,
|
|
1386
|
-
code: E_INCOMPATIBLE_NATIVE_MODULE
|
|
1387
|
-
};
|
|
1388
|
-
};
|
|
1389
|
-
const getModuleSyntaxError = () => {
|
|
1390
|
-
return {
|
|
1391
|
-
message: `ES Modules are not supported in electron`,
|
|
1392
|
-
code: E_MODULES_NOT_SUPPORTED_IN_ELECTRON
|
|
1393
|
-
};
|
|
1394
|
-
};
|
|
1395
|
-
const getHelpfulChildProcessError = (stdout, stderr) => {
|
|
1396
|
-
if (isUnhelpfulNativeModuleError(stderr)) {
|
|
1397
|
-
return getNativeModuleErrorMessage(stderr);
|
|
1398
|
-
}
|
|
1399
|
-
if (isModulesSyntaxError(stderr)) {
|
|
1400
|
-
return getModuleSyntaxError();
|
|
1401
|
-
}
|
|
1402
|
-
if (isModuleNotFoundError(stderr)) {
|
|
1403
|
-
return getModuleNotFoundError(stderr);
|
|
1404
|
-
}
|
|
1405
|
-
const lines = splitLines$2(stderr);
|
|
1406
|
-
const {
|
|
1407
|
-
actualMessage,
|
|
1408
|
-
rest
|
|
1409
|
-
} = getDetails(lines);
|
|
1410
|
-
return {
|
|
1411
|
-
message: actualMessage,
|
|
1412
|
-
code: '',
|
|
1413
|
-
stack: rest
|
|
1414
|
-
};
|
|
1415
|
-
};
|
|
1416
|
-
class IpcError extends VError {
|
|
1417
|
-
// @ts-ignore
|
|
1418
|
-
constructor(betterMessage, stdout = '', stderr = '') {
|
|
1419
|
-
if (stdout || stderr) {
|
|
1420
|
-
// @ts-ignore
|
|
1421
|
-
const {
|
|
1422
|
-
message,
|
|
1423
|
-
code,
|
|
1424
|
-
stack
|
|
1425
|
-
} = getHelpfulChildProcessError(stdout, stderr);
|
|
1426
|
-
const cause = new Error(message);
|
|
1427
|
-
// @ts-ignore
|
|
1428
|
-
cause.code = code;
|
|
1429
|
-
cause.stack = stack;
|
|
1430
|
-
super(cause, betterMessage);
|
|
1431
|
-
} else {
|
|
1432
|
-
super(betterMessage);
|
|
1433
|
-
}
|
|
1434
|
-
// @ts-ignore
|
|
1435
|
-
this.name = 'IpcError';
|
|
1436
|
-
// @ts-ignore
|
|
1437
|
-
this.stdout = stdout;
|
|
1438
|
-
// @ts-ignore
|
|
1439
|
-
this.stderr = stderr;
|
|
1440
|
-
}
|
|
1441
|
-
}
|
|
1442
|
-
const readyMessage = 'ready';
|
|
1443
|
-
const getData$2 = event => {
|
|
1444
|
-
return event.data;
|
|
1445
|
-
};
|
|
1446
|
-
const listen$8 = ({
|
|
1447
|
-
port
|
|
1448
|
-
}) => {
|
|
1449
|
-
return port;
|
|
1450
|
-
};
|
|
1451
|
-
const signal$9 = port => {
|
|
1452
|
-
port.postMessage(readyMessage);
|
|
1453
|
-
};
|
|
1454
|
-
class IpcChildWithMessagePort extends Ipc {
|
|
1455
|
-
getData(event) {
|
|
1456
|
-
return getData$2(event);
|
|
1457
|
-
}
|
|
1458
|
-
send(message) {
|
|
1459
|
-
this._rawIpc.postMessage(message);
|
|
1460
|
-
}
|
|
1461
|
-
sendAndTransfer(message) {
|
|
1462
|
-
const transfer = getTransferrables(message);
|
|
1463
|
-
this._rawIpc.postMessage(message, transfer);
|
|
1464
|
-
}
|
|
1465
|
-
dispose() {
|
|
1466
|
-
// ignore
|
|
1467
|
-
}
|
|
1468
|
-
onClose(callback) {
|
|
1469
|
-
// ignore
|
|
1470
|
-
}
|
|
1471
|
-
onMessage(callback) {
|
|
1472
|
-
this._rawIpc.addEventListener('message', callback);
|
|
1473
|
-
this._rawIpc.start();
|
|
1474
|
-
}
|
|
1475
|
-
}
|
|
1476
|
-
const wrap$g = port => {
|
|
1477
|
-
return new IpcChildWithMessagePort(port);
|
|
1478
|
-
};
|
|
1479
|
-
const IpcChildWithMessagePort$1 = {
|
|
1480
|
-
__proto__: null,
|
|
1481
|
-
listen: listen$8,
|
|
1482
|
-
signal: signal$9,
|
|
1483
|
-
wrap: wrap$g
|
|
1484
|
-
};
|
|
1485
|
-
const listen$7 = () => {
|
|
1486
|
-
// @ts-ignore
|
|
1487
|
-
if (typeof WorkerGlobalScope === 'undefined') {
|
|
1488
|
-
throw new TypeError('module is not in web worker scope');
|
|
1489
|
-
}
|
|
1490
|
-
return globalThis;
|
|
1491
|
-
};
|
|
1492
|
-
const signal$8 = global => {
|
|
1493
|
-
global.postMessage(readyMessage);
|
|
1494
|
-
};
|
|
1495
|
-
class IpcChildWithModuleWorker extends Ipc {
|
|
1496
|
-
getData(event) {
|
|
1497
|
-
return getData$2(event);
|
|
1498
|
-
}
|
|
1499
|
-
send(message) {
|
|
1500
|
-
// @ts-ignore
|
|
1501
|
-
this._rawIpc.postMessage(message);
|
|
1502
|
-
}
|
|
1503
|
-
sendAndTransfer(message) {
|
|
1504
|
-
const transfer = getTransferrables(message);
|
|
1505
|
-
// @ts-ignore
|
|
1506
|
-
this._rawIpc.postMessage(message, transfer);
|
|
1507
|
-
}
|
|
1508
|
-
dispose() {
|
|
1509
|
-
// ignore
|
|
1510
|
-
}
|
|
1511
|
-
onClose(callback) {
|
|
1512
|
-
// ignore
|
|
1513
|
-
}
|
|
1514
|
-
onMessage(callback) {
|
|
1515
|
-
this._rawIpc.addEventListener('message', callback);
|
|
1516
|
-
}
|
|
1517
|
-
}
|
|
1518
|
-
const wrap$f = global => {
|
|
1519
|
-
return new IpcChildWithModuleWorker(global);
|
|
1520
|
-
};
|
|
1521
|
-
const waitForFirstMessage = async port => {
|
|
1522
|
-
const {
|
|
1523
|
-
resolve,
|
|
1524
|
-
promise
|
|
1525
|
-
} = Promise.withResolvers();
|
|
1526
|
-
port.addEventListener('message', resolve, {
|
|
1527
|
-
once: true
|
|
1528
|
-
});
|
|
1529
|
-
const event = await promise;
|
|
1530
|
-
// @ts-ignore
|
|
1531
|
-
return event.data;
|
|
1532
|
-
};
|
|
1533
|
-
const listen$6 = async () => {
|
|
1534
|
-
const parentIpcRaw = listen$7();
|
|
1535
|
-
signal$8(parentIpcRaw);
|
|
1536
|
-
const parentIpc = wrap$f(parentIpcRaw);
|
|
1537
|
-
const firstMessage = await waitForFirstMessage(parentIpc);
|
|
1538
|
-
if (firstMessage.method !== 'initialize') {
|
|
1539
|
-
throw new IpcError('unexpected first message');
|
|
1540
|
-
}
|
|
1541
|
-
const type = firstMessage.params[0];
|
|
1542
|
-
if (type === 'message-port') {
|
|
1543
|
-
parentIpc.send({
|
|
1544
|
-
jsonrpc: '2.0',
|
|
1545
|
-
id: firstMessage.id,
|
|
1546
|
-
result: null
|
|
1547
|
-
});
|
|
1548
|
-
parentIpc.dispose();
|
|
1549
|
-
const port = firstMessage.params[1];
|
|
1550
|
-
return port;
|
|
1551
|
-
}
|
|
1552
|
-
return globalThis;
|
|
1553
|
-
};
|
|
1554
|
-
class IpcChildWithModuleWorkerAndMessagePort extends Ipc {
|
|
1555
|
-
getData(event) {
|
|
1556
|
-
return getData$2(event);
|
|
1557
|
-
}
|
|
1558
|
-
send(message) {
|
|
1559
|
-
this._rawIpc.postMessage(message);
|
|
1560
|
-
}
|
|
1561
|
-
sendAndTransfer(message) {
|
|
1562
|
-
const transfer = getTransferrables(message);
|
|
1563
|
-
this._rawIpc.postMessage(message, transfer);
|
|
1564
|
-
}
|
|
1565
|
-
dispose() {
|
|
1566
|
-
if (this._rawIpc.close) {
|
|
1567
|
-
this._rawIpc.close();
|
|
1568
|
-
}
|
|
1569
|
-
}
|
|
1570
|
-
onClose(callback) {
|
|
1571
|
-
// ignore
|
|
1572
|
-
}
|
|
1573
|
-
onMessage(callback) {
|
|
1574
|
-
this._rawIpc.addEventListener('message', callback);
|
|
1575
|
-
this._rawIpc.start();
|
|
1576
|
-
}
|
|
1577
|
-
}
|
|
1578
|
-
const wrap$e = port => {
|
|
1579
|
-
return new IpcChildWithModuleWorkerAndMessagePort(port);
|
|
1580
|
-
};
|
|
1581
|
-
const IpcChildWithModuleWorkerAndMessagePort$1 = {
|
|
1582
|
-
__proto__: null,
|
|
1583
|
-
listen: listen$6,
|
|
1584
|
-
wrap: wrap$e
|
|
1585
|
-
};
|
|
1586
|
-
const Error$3 = 1;
|
|
1587
|
-
const Open = 2;
|
|
1588
|
-
const Close = 3;
|
|
1589
|
-
const addListener = (emitter, type, callback) => {
|
|
1590
|
-
if ('addEventListener' in emitter) {
|
|
1591
|
-
emitter.addEventListener(type, callback);
|
|
1592
|
-
} else {
|
|
1593
|
-
emitter.on(type, callback);
|
|
1594
|
-
}
|
|
1595
|
-
};
|
|
1596
|
-
const removeListener = (emitter, type, callback) => {
|
|
1597
|
-
if ('removeEventListener' in emitter) {
|
|
1598
|
-
emitter.removeEventListener(type, callback);
|
|
1599
|
-
} else {
|
|
1600
|
-
emitter.off(type, callback);
|
|
1601
|
-
}
|
|
1179
|
+
const removeListener = (emitter, type, callback) => {
|
|
1180
|
+
if ('removeEventListener' in emitter) {
|
|
1181
|
+
emitter.removeEventListener(type, callback);
|
|
1182
|
+
} else {
|
|
1183
|
+
emitter.off(type, callback);
|
|
1184
|
+
}
|
|
1602
1185
|
};
|
|
1603
1186
|
const getFirstEvent = (eventEmitter, eventMap) => {
|
|
1604
1187
|
const {
|
|
@@ -1750,13 +1333,13 @@ const create$4$2 = (method, params) => {
|
|
|
1750
1333
|
};
|
|
1751
1334
|
};
|
|
1752
1335
|
const callbacks = Object.create(null);
|
|
1753
|
-
const set$
|
|
1336
|
+
const set$a = (id, fn) => {
|
|
1754
1337
|
callbacks[id] = fn;
|
|
1755
1338
|
};
|
|
1756
|
-
const get$
|
|
1339
|
+
const get$a = id => {
|
|
1757
1340
|
return callbacks[id];
|
|
1758
1341
|
};
|
|
1759
|
-
const remove$
|
|
1342
|
+
const remove$4 = id => {
|
|
1760
1343
|
delete callbacks[id];
|
|
1761
1344
|
};
|
|
1762
1345
|
let id$1 = 0;
|
|
@@ -1769,7 +1352,7 @@ const registerPromise = () => {
|
|
|
1769
1352
|
resolve,
|
|
1770
1353
|
promise
|
|
1771
1354
|
} = Promise.withResolvers();
|
|
1772
|
-
set$
|
|
1355
|
+
set$a(id, resolve);
|
|
1773
1356
|
return {
|
|
1774
1357
|
id,
|
|
1775
1358
|
promise
|
|
@@ -1934,383 +1517,809 @@ const warn$1 = (...args) => {
|
|
|
1934
1517
|
console.warn(...args);
|
|
1935
1518
|
};
|
|
1936
1519
|
const resolve = (id, response) => {
|
|
1937
|
-
const fn = get$
|
|
1520
|
+
const fn = get$a(id);
|
|
1938
1521
|
if (!fn) {
|
|
1939
1522
|
console.log(response);
|
|
1940
1523
|
warn$1(`callback ${id} may already be disposed`);
|
|
1941
1524
|
return;
|
|
1942
1525
|
}
|
|
1943
1526
|
fn(response);
|
|
1944
|
-
remove$
|
|
1527
|
+
remove$4(id);
|
|
1945
1528
|
};
|
|
1946
1529
|
const E_COMMAND_NOT_FOUND = 'E_COMMAND_NOT_FOUND';
|
|
1947
1530
|
const getErrorType = prettyError => {
|
|
1948
1531
|
if (prettyError && prettyError.type) {
|
|
1949
1532
|
return prettyError.type;
|
|
1950
1533
|
}
|
|
1951
|
-
if (prettyError && prettyError.constructor && prettyError.constructor.name) {
|
|
1952
|
-
return prettyError.constructor.name;
|
|
1534
|
+
if (prettyError && prettyError.constructor && prettyError.constructor.name) {
|
|
1535
|
+
return prettyError.constructor.name;
|
|
1536
|
+
}
|
|
1537
|
+
return undefined;
|
|
1538
|
+
};
|
|
1539
|
+
const isAlreadyStack = line => {
|
|
1540
|
+
return line.trim().startsWith('at ');
|
|
1541
|
+
};
|
|
1542
|
+
const getStack = prettyError => {
|
|
1543
|
+
const stackString = prettyError.stack || '';
|
|
1544
|
+
const newLineIndex = stackString.indexOf('\n');
|
|
1545
|
+
if (newLineIndex !== -1 && !isAlreadyStack(stackString.slice(0, newLineIndex))) {
|
|
1546
|
+
return stackString.slice(newLineIndex + 1);
|
|
1547
|
+
}
|
|
1548
|
+
return stackString;
|
|
1549
|
+
};
|
|
1550
|
+
const getErrorProperty = (error, prettyError) => {
|
|
1551
|
+
if (error && error.code === E_COMMAND_NOT_FOUND) {
|
|
1552
|
+
return {
|
|
1553
|
+
code: MethodNotFound,
|
|
1554
|
+
message: error.message,
|
|
1555
|
+
data: error.stack
|
|
1556
|
+
};
|
|
1557
|
+
}
|
|
1558
|
+
return {
|
|
1559
|
+
code: Custom,
|
|
1560
|
+
message: prettyError.message,
|
|
1561
|
+
data: {
|
|
1562
|
+
stack: getStack(prettyError),
|
|
1563
|
+
codeFrame: prettyError.codeFrame,
|
|
1564
|
+
type: getErrorType(prettyError),
|
|
1565
|
+
code: prettyError.code,
|
|
1566
|
+
name: prettyError.name
|
|
1567
|
+
}
|
|
1568
|
+
};
|
|
1569
|
+
};
|
|
1570
|
+
const create$1$1 = (id, error) => {
|
|
1571
|
+
return {
|
|
1572
|
+
jsonrpc: Two,
|
|
1573
|
+
id,
|
|
1574
|
+
error
|
|
1575
|
+
};
|
|
1576
|
+
};
|
|
1577
|
+
const getErrorResponse = (id, error, preparePrettyError, logError) => {
|
|
1578
|
+
const prettyError = preparePrettyError(error);
|
|
1579
|
+
logError(error, prettyError);
|
|
1580
|
+
const errorProperty = getErrorProperty(error, prettyError);
|
|
1581
|
+
return create$1$1(id, errorProperty);
|
|
1582
|
+
};
|
|
1583
|
+
const create$8 = (message, result) => {
|
|
1584
|
+
return {
|
|
1585
|
+
jsonrpc: Two,
|
|
1586
|
+
id: message.id,
|
|
1587
|
+
result: result ?? null
|
|
1588
|
+
};
|
|
1589
|
+
};
|
|
1590
|
+
const getSuccessResponse = (message, result) => {
|
|
1591
|
+
const resultProperty = result ?? null;
|
|
1592
|
+
return create$8(message, resultProperty);
|
|
1593
|
+
};
|
|
1594
|
+
const getErrorResponseSimple = (id, error) => {
|
|
1595
|
+
return {
|
|
1596
|
+
jsonrpc: Two,
|
|
1597
|
+
id,
|
|
1598
|
+
error: {
|
|
1599
|
+
code: Custom,
|
|
1600
|
+
// @ts-ignore
|
|
1601
|
+
message: error.message,
|
|
1602
|
+
data: error
|
|
1603
|
+
}
|
|
1604
|
+
};
|
|
1605
|
+
};
|
|
1606
|
+
const getResponse = async (message, ipc, execute, preparePrettyError, logError, requiresSocket) => {
|
|
1607
|
+
try {
|
|
1608
|
+
const result = requiresSocket(message.method) ? await execute(message.method, ipc, ...message.params) : await execute(message.method, ...message.params);
|
|
1609
|
+
return getSuccessResponse(message, result);
|
|
1610
|
+
} catch (error) {
|
|
1611
|
+
if (ipc.canUseSimpleErrorResponse) {
|
|
1612
|
+
return getErrorResponseSimple(message.id, error);
|
|
1613
|
+
}
|
|
1614
|
+
return getErrorResponse(message.id, error, preparePrettyError, logError);
|
|
1615
|
+
}
|
|
1616
|
+
};
|
|
1617
|
+
const defaultPreparePrettyError = error => {
|
|
1618
|
+
return error;
|
|
1619
|
+
};
|
|
1620
|
+
const defaultLogError = () => {
|
|
1621
|
+
// ignore
|
|
1622
|
+
};
|
|
1623
|
+
const defaultRequiresSocket = () => {
|
|
1624
|
+
return false;
|
|
1625
|
+
};
|
|
1626
|
+
const defaultResolve = resolve;
|
|
1627
|
+
|
|
1628
|
+
// TODO maybe remove this in v6 or v7, only accept options object to simplify the code
|
|
1629
|
+
const normalizeParams = args => {
|
|
1630
|
+
if (args.length === 1) {
|
|
1631
|
+
const options = args[0];
|
|
1632
|
+
return {
|
|
1633
|
+
ipc: options.ipc,
|
|
1634
|
+
message: options.message,
|
|
1635
|
+
execute: options.execute,
|
|
1636
|
+
resolve: options.resolve || defaultResolve,
|
|
1637
|
+
preparePrettyError: options.preparePrettyError || defaultPreparePrettyError,
|
|
1638
|
+
logError: options.logError || defaultLogError,
|
|
1639
|
+
requiresSocket: options.requiresSocket || defaultRequiresSocket
|
|
1640
|
+
};
|
|
1641
|
+
}
|
|
1642
|
+
return {
|
|
1643
|
+
ipc: args[0],
|
|
1644
|
+
message: args[1],
|
|
1645
|
+
execute: args[2],
|
|
1646
|
+
resolve: args[3],
|
|
1647
|
+
preparePrettyError: args[4],
|
|
1648
|
+
logError: args[5],
|
|
1649
|
+
requiresSocket: args[6]
|
|
1650
|
+
};
|
|
1651
|
+
};
|
|
1652
|
+
const handleJsonRpcMessage = async (...args) => {
|
|
1653
|
+
const options = normalizeParams(args);
|
|
1654
|
+
const {
|
|
1655
|
+
message,
|
|
1656
|
+
ipc,
|
|
1657
|
+
execute,
|
|
1658
|
+
resolve,
|
|
1659
|
+
preparePrettyError,
|
|
1660
|
+
logError,
|
|
1661
|
+
requiresSocket
|
|
1662
|
+
} = options;
|
|
1663
|
+
if ('id' in message) {
|
|
1664
|
+
if ('method' in message) {
|
|
1665
|
+
const response = await getResponse(message, ipc, execute, preparePrettyError, logError, requiresSocket);
|
|
1666
|
+
try {
|
|
1667
|
+
ipc.send(response);
|
|
1668
|
+
} catch (error) {
|
|
1669
|
+
const errorResponse = getErrorResponse(message.id, error, preparePrettyError, logError);
|
|
1670
|
+
ipc.send(errorResponse);
|
|
1671
|
+
}
|
|
1672
|
+
return;
|
|
1673
|
+
}
|
|
1674
|
+
resolve(message.id, message);
|
|
1675
|
+
return;
|
|
1676
|
+
}
|
|
1677
|
+
if ('method' in message) {
|
|
1678
|
+
await getResponse(message, ipc, execute, preparePrettyError, logError, requiresSocket);
|
|
1679
|
+
return;
|
|
1680
|
+
}
|
|
1681
|
+
throw new JsonRpcError('unexpected message');
|
|
1682
|
+
};
|
|
1683
|
+
const invokeHelper = async (ipc, method, params, useSendAndTransfer) => {
|
|
1684
|
+
const {
|
|
1685
|
+
message,
|
|
1686
|
+
promise
|
|
1687
|
+
} = create$2$2(method, params);
|
|
1688
|
+
if (useSendAndTransfer && ipc.sendAndTransfer) {
|
|
1689
|
+
ipc.sendAndTransfer(message);
|
|
1690
|
+
} else {
|
|
1691
|
+
ipc.send(message);
|
|
1692
|
+
}
|
|
1693
|
+
const responseMessage = await promise;
|
|
1694
|
+
return unwrapJsonRpcResult(responseMessage);
|
|
1695
|
+
};
|
|
1696
|
+
const send$1 = (transport, method, ...params) => {
|
|
1697
|
+
const message = create$4$2(method, params);
|
|
1698
|
+
transport.send(message);
|
|
1699
|
+
};
|
|
1700
|
+
const invoke$3 = (ipc, method, ...params) => {
|
|
1701
|
+
return invokeHelper(ipc, method, params, false);
|
|
1702
|
+
};
|
|
1703
|
+
const invokeAndTransfer$2 = (ipc, method, ...params) => {
|
|
1704
|
+
return invokeHelper(ipc, method, params, true);
|
|
1705
|
+
};
|
|
1706
|
+
|
|
1707
|
+
class CommandNotFoundError extends Error {
|
|
1708
|
+
constructor(command) {
|
|
1709
|
+
super(`Command not found ${command}`);
|
|
1710
|
+
this.name = 'CommandNotFoundError';
|
|
1711
|
+
}
|
|
1712
|
+
}
|
|
1713
|
+
const commands = Object.create(null);
|
|
1714
|
+
const register$1 = commandMap => {
|
|
1715
|
+
Object.assign(commands, commandMap);
|
|
1716
|
+
};
|
|
1717
|
+
const getCommand = key => {
|
|
1718
|
+
return commands[key];
|
|
1719
|
+
};
|
|
1720
|
+
const execute = (command, ...args) => {
|
|
1721
|
+
const fn = getCommand(command);
|
|
1722
|
+
if (!fn) {
|
|
1723
|
+
throw new CommandNotFoundError(command);
|
|
1724
|
+
}
|
|
1725
|
+
return fn(...args);
|
|
1726
|
+
};
|
|
1727
|
+
|
|
1728
|
+
const createRpc$1 = ipc => {
|
|
1729
|
+
const rpc = {
|
|
1730
|
+
// @ts-ignore
|
|
1731
|
+
ipc,
|
|
1732
|
+
/**
|
|
1733
|
+
* @deprecated
|
|
1734
|
+
*/
|
|
1735
|
+
send(method, ...params) {
|
|
1736
|
+
send$1(ipc, method, ...params);
|
|
1737
|
+
},
|
|
1738
|
+
invoke(method, ...params) {
|
|
1739
|
+
return invoke$3(ipc, method, ...params);
|
|
1740
|
+
},
|
|
1741
|
+
invokeAndTransfer(method, ...params) {
|
|
1742
|
+
return invokeAndTransfer$2(ipc, method, ...params);
|
|
1743
|
+
},
|
|
1744
|
+
async dispose() {
|
|
1745
|
+
await ipc?.dispose();
|
|
1746
|
+
}
|
|
1747
|
+
};
|
|
1748
|
+
return rpc;
|
|
1749
|
+
};
|
|
1750
|
+
const requiresSocket = () => {
|
|
1751
|
+
return false;
|
|
1752
|
+
};
|
|
1753
|
+
const preparePrettyError = error => {
|
|
1754
|
+
return error;
|
|
1755
|
+
};
|
|
1756
|
+
const logError = () => {
|
|
1757
|
+
// handled by renderer worker
|
|
1758
|
+
};
|
|
1759
|
+
const handleMessage = event => {
|
|
1760
|
+
const actualRequiresSocket = event?.target?.requiresSocket || requiresSocket;
|
|
1761
|
+
const actualExecute = event?.target?.execute || execute;
|
|
1762
|
+
return handleJsonRpcMessage(event.target, event.data, actualExecute, resolve, preparePrettyError, logError, actualRequiresSocket);
|
|
1763
|
+
};
|
|
1764
|
+
const handleIpc = ipc => {
|
|
1765
|
+
if ('addEventListener' in ipc) {
|
|
1766
|
+
ipc.addEventListener('message', handleMessage);
|
|
1767
|
+
} else if ('on' in ipc) {
|
|
1768
|
+
// deprecated
|
|
1769
|
+
ipc.on('message', handleMessage);
|
|
1770
|
+
}
|
|
1771
|
+
};
|
|
1772
|
+
const listen$1 = async (module, options) => {
|
|
1773
|
+
const rawIpc = await module.listen(options);
|
|
1774
|
+
if (module.signal) {
|
|
1775
|
+
module.signal(rawIpc);
|
|
1776
|
+
}
|
|
1777
|
+
const ipc = module.wrap(rawIpc);
|
|
1778
|
+
return ipc;
|
|
1779
|
+
};
|
|
1780
|
+
const create$f = async ({
|
|
1781
|
+
commandMap,
|
|
1782
|
+
messagePort
|
|
1783
|
+
}) => {
|
|
1784
|
+
// TODO create a commandMap per rpc instance
|
|
1785
|
+
register$1(commandMap);
|
|
1786
|
+
const ipc = await listen$1(IpcChildWithMessagePort$1, {
|
|
1787
|
+
port: messagePort
|
|
1788
|
+
});
|
|
1789
|
+
handleIpc(ipc);
|
|
1790
|
+
const rpc = createRpc$1(ipc);
|
|
1791
|
+
return rpc;
|
|
1792
|
+
};
|
|
1793
|
+
const MessagePortRpcClient = {
|
|
1794
|
+
__proto__: null,
|
|
1795
|
+
create: create$f
|
|
1796
|
+
};
|
|
1797
|
+
const create$e = async ({
|
|
1798
|
+
commandMap,
|
|
1799
|
+
messagePort,
|
|
1800
|
+
isMessagePortOpen
|
|
1801
|
+
}) => {
|
|
1802
|
+
// TODO create a commandMap per rpc instance
|
|
1803
|
+
register$1(commandMap);
|
|
1804
|
+
const rawIpc = await IpcParentWithMessagePort$1.create({
|
|
1805
|
+
messagePort,
|
|
1806
|
+
isMessagePortOpen
|
|
1807
|
+
});
|
|
1808
|
+
const ipc = IpcParentWithMessagePort$1.wrap(rawIpc);
|
|
1809
|
+
handleIpc(ipc);
|
|
1810
|
+
const rpc = createRpc$1(ipc);
|
|
1811
|
+
return rpc;
|
|
1812
|
+
};
|
|
1813
|
+
const MessagePortRpcParent = {
|
|
1814
|
+
__proto__: null,
|
|
1815
|
+
create: create$e
|
|
1816
|
+
};
|
|
1817
|
+
const create$5$1 = async ({
|
|
1818
|
+
commandMap,
|
|
1819
|
+
messagePort
|
|
1820
|
+
}) => {
|
|
1821
|
+
// TODO create a commandMap per rpc instance
|
|
1822
|
+
register$1(commandMap);
|
|
1823
|
+
const rawIpc = await IpcParentWithMessagePort$1.create({
|
|
1824
|
+
messagePort,
|
|
1825
|
+
isMessagePortOpen: true
|
|
1826
|
+
});
|
|
1827
|
+
const ipc = IpcParentWithMessagePort$1.wrap(rawIpc);
|
|
1828
|
+
handleIpc(ipc);
|
|
1829
|
+
const rpc = createRpc$1(ipc);
|
|
1830
|
+
messagePort.start();
|
|
1831
|
+
return rpc;
|
|
1832
|
+
};
|
|
1833
|
+
const create$4$1 = async ({
|
|
1834
|
+
commandMap,
|
|
1835
|
+
messagePort
|
|
1836
|
+
}) => {
|
|
1837
|
+
return create$5$1({
|
|
1838
|
+
commandMap,
|
|
1839
|
+
messagePort
|
|
1840
|
+
});
|
|
1841
|
+
};
|
|
1842
|
+
const PlainMessagePortRpcParent = {
|
|
1843
|
+
__proto__: null,
|
|
1844
|
+
create: create$4$1
|
|
1845
|
+
};
|
|
1846
|
+
const create$3$1 = async ({
|
|
1847
|
+
commandMap,
|
|
1848
|
+
send
|
|
1849
|
+
}) => {
|
|
1850
|
+
const {
|
|
1851
|
+
port1,
|
|
1852
|
+
port2
|
|
1853
|
+
} = new MessageChannel();
|
|
1854
|
+
await send(port1);
|
|
1855
|
+
return create$5$1({
|
|
1856
|
+
commandMap,
|
|
1857
|
+
messagePort: port2
|
|
1858
|
+
});
|
|
1859
|
+
};
|
|
1860
|
+
const TransferMessagePortRpcParent = {
|
|
1861
|
+
__proto__: null,
|
|
1862
|
+
create: create$3$1
|
|
1863
|
+
};
|
|
1864
|
+
const create$2$1 = async ({
|
|
1865
|
+
commandMap,
|
|
1866
|
+
webSocket
|
|
1867
|
+
}) => {
|
|
1868
|
+
// TODO create a commandMap per rpc instance
|
|
1869
|
+
register$1(commandMap);
|
|
1870
|
+
const rawIpc = await IpcParentWithWebSocket$1$1.create({
|
|
1871
|
+
webSocket
|
|
1872
|
+
});
|
|
1873
|
+
const ipc = IpcParentWithWebSocket$1$1.wrap(rawIpc);
|
|
1874
|
+
handleIpc(ipc);
|
|
1875
|
+
const rpc = createRpc$1(ipc);
|
|
1876
|
+
return rpc;
|
|
1877
|
+
};
|
|
1878
|
+
const WebSocketRpcParent = {
|
|
1879
|
+
__proto__: null,
|
|
1880
|
+
create: create$2$1
|
|
1881
|
+
};
|
|
1882
|
+
const create$7 = async ({
|
|
1883
|
+
commandMap
|
|
1884
|
+
}) => {
|
|
1885
|
+
// TODO create a commandMap per rpc instance
|
|
1886
|
+
register$1(commandMap);
|
|
1887
|
+
const ipc = await listen$1(IpcChildWithModuleWorkerAndMessagePort$1);
|
|
1888
|
+
handleIpc(ipc);
|
|
1889
|
+
const rpc = createRpc$1(ipc);
|
|
1890
|
+
return rpc;
|
|
1891
|
+
};
|
|
1892
|
+
const WebWorkerRpcClient = {
|
|
1893
|
+
__proto__: null,
|
|
1894
|
+
create: create$7
|
|
1895
|
+
};
|
|
1896
|
+
|
|
1897
|
+
const {
|
|
1898
|
+
invoke: invoke$2
|
|
1899
|
+
} = DebugWorker;
|
|
1900
|
+
|
|
1901
|
+
const state$a = {
|
|
1902
|
+
debugProviderMap: Object.create(null)
|
|
1903
|
+
};
|
|
1904
|
+
const getDebugProvider = id => {
|
|
1905
|
+
const provider = state$a.debugProviderMap[id];
|
|
1906
|
+
if (!provider) {
|
|
1907
|
+
// @ts-ignore
|
|
1908
|
+
throw new VError(`no debug provider "${id}" found`);
|
|
1909
|
+
}
|
|
1910
|
+
return provider;
|
|
1911
|
+
};
|
|
1912
|
+
const registerDebugProvider = debugProvider => {
|
|
1913
|
+
if (!debugProvider.id) {
|
|
1914
|
+
throw new Error('Failed to register debug system provider: missing id');
|
|
1915
|
+
}
|
|
1916
|
+
state$a.debugProviderMap[debugProvider.id] = debugProvider;
|
|
1917
|
+
};
|
|
1918
|
+
const handlePaused = async params => {
|
|
1919
|
+
// @ts-ignore
|
|
1920
|
+
await invoke$2('Debug.paused', params);
|
|
1921
|
+
};
|
|
1922
|
+
const handleResumed = async () => {
|
|
1923
|
+
// @ts-ignore
|
|
1924
|
+
await invoke$2('Debug.resumed');
|
|
1925
|
+
};
|
|
1926
|
+
const handleScriptParsed = async parsedScript => {
|
|
1927
|
+
// @ts-ignore
|
|
1928
|
+
await invoke$2('Debug.scriptParsed', parsedScript);
|
|
1929
|
+
};
|
|
1930
|
+
const handleChange = async params => {
|
|
1931
|
+
object(params);
|
|
1932
|
+
// @ts-ignore
|
|
1933
|
+
await invoke$2('Debug.handleChange', params);
|
|
1934
|
+
};
|
|
1935
|
+
const start = async (protocol, path) => {
|
|
1936
|
+
try {
|
|
1937
|
+
const provider = getDebugProvider(protocol);
|
|
1938
|
+
const emitter = {
|
|
1939
|
+
handlePaused,
|
|
1940
|
+
handleResumed,
|
|
1941
|
+
handleScriptParsed,
|
|
1942
|
+
handleChange
|
|
1943
|
+
};
|
|
1944
|
+
await provider.start(emitter, path);
|
|
1945
|
+
} catch (error) {
|
|
1946
|
+
throw new VError(error, 'Failed to execute debug provider');
|
|
1947
|
+
}
|
|
1948
|
+
};
|
|
1949
|
+
const listProcesses = async (protocol, path) => {
|
|
1950
|
+
try {
|
|
1951
|
+
const provider = getDebugProvider(protocol);
|
|
1952
|
+
const processes = await provider.listProcesses(path);
|
|
1953
|
+
array(processes);
|
|
1954
|
+
return processes;
|
|
1955
|
+
} catch (error) {
|
|
1956
|
+
throw new VError(error, 'Failed to execute debug provider');
|
|
1957
|
+
}
|
|
1958
|
+
};
|
|
1959
|
+
const resume = async protocol => {
|
|
1960
|
+
try {
|
|
1961
|
+
const provider = getDebugProvider(protocol);
|
|
1962
|
+
return await provider.resume();
|
|
1963
|
+
} catch (error) {
|
|
1964
|
+
throw new VError(error, 'Failed to execute debug provider');
|
|
1965
|
+
}
|
|
1966
|
+
};
|
|
1967
|
+
const pause = async protocol => {
|
|
1968
|
+
try {
|
|
1969
|
+
const provider = getDebugProvider(protocol);
|
|
1970
|
+
return await provider.pause();
|
|
1971
|
+
} catch (error) {
|
|
1972
|
+
throw new VError(error, 'Failed to execute debug provider');
|
|
1953
1973
|
}
|
|
1954
|
-
return undefined;
|
|
1955
1974
|
};
|
|
1956
|
-
const
|
|
1957
|
-
|
|
1975
|
+
const getScriptSource = async (protocol, scriptId) => {
|
|
1976
|
+
try {
|
|
1977
|
+
const provider = getDebugProvider(protocol);
|
|
1978
|
+
return await provider.getScriptSource(scriptId);
|
|
1979
|
+
} catch (error) {
|
|
1980
|
+
throw new VError(error, 'Failed to execute debug provider');
|
|
1981
|
+
}
|
|
1958
1982
|
};
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1983
|
+
|
|
1984
|
+
// TODO create direct connection from debug worker to extension, not needing extension host worker apis
|
|
1985
|
+
|
|
1986
|
+
const getStatus = async protocol => {
|
|
1987
|
+
try {
|
|
1988
|
+
const provider = getDebugProvider(protocol);
|
|
1989
|
+
return await provider.getStatus();
|
|
1990
|
+
} catch (error) {
|
|
1991
|
+
throw new VError(error, 'Failed to execute debug provider');
|
|
1964
1992
|
}
|
|
1965
|
-
return stackString;
|
|
1966
1993
|
};
|
|
1967
|
-
const
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
};
|
|
1994
|
+
const getCallStack = async protocol => {
|
|
1995
|
+
try {
|
|
1996
|
+
const provider = getDebugProvider(protocol);
|
|
1997
|
+
return await provider.getCallStack();
|
|
1998
|
+
} catch (error) {
|
|
1999
|
+
throw new VError(error, 'Failed to execute debug provider');
|
|
1974
2000
|
}
|
|
1975
|
-
return {
|
|
1976
|
-
code: Custom,
|
|
1977
|
-
message: prettyError.message,
|
|
1978
|
-
data: {
|
|
1979
|
-
stack: getStack(prettyError),
|
|
1980
|
-
codeFrame: prettyError.codeFrame,
|
|
1981
|
-
type: getErrorType(prettyError),
|
|
1982
|
-
code: prettyError.code,
|
|
1983
|
-
name: prettyError.name
|
|
1984
|
-
}
|
|
1985
|
-
};
|
|
1986
2001
|
};
|
|
1987
|
-
const
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
2002
|
+
const getScopeChain = async protocol => {
|
|
2003
|
+
try {
|
|
2004
|
+
const provider = getDebugProvider(protocol);
|
|
2005
|
+
return await provider.getScopeChain();
|
|
2006
|
+
} catch (error) {
|
|
2007
|
+
throw new VError(error, 'Failed to execute debug provider');
|
|
2008
|
+
}
|
|
1993
2009
|
};
|
|
1994
|
-
const
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
2010
|
+
const getScripts = async protocol => {
|
|
2011
|
+
try {
|
|
2012
|
+
const provider = getDebugProvider(protocol);
|
|
2013
|
+
return await provider.getScripts();
|
|
2014
|
+
} catch (error) {
|
|
2015
|
+
throw new VError(error, 'Failed to execute debug provider');
|
|
2016
|
+
}
|
|
1999
2017
|
};
|
|
2000
|
-
const
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2018
|
+
const getPausedStatus = async protocol => {
|
|
2019
|
+
try {
|
|
2020
|
+
const provider = getDebugProvider(protocol);
|
|
2021
|
+
return await provider.getStatus();
|
|
2022
|
+
} catch (error) {
|
|
2023
|
+
throw new VError(error, 'Failed to execute debug provider');
|
|
2024
|
+
}
|
|
2006
2025
|
};
|
|
2007
|
-
const
|
|
2008
|
-
|
|
2009
|
-
|
|
2026
|
+
const stepInto = async protocol => {
|
|
2027
|
+
try {
|
|
2028
|
+
const provider = getDebugProvider(protocol);
|
|
2029
|
+
return await provider.stepInto();
|
|
2030
|
+
} catch (error) {
|
|
2031
|
+
throw new VError(error, 'Failed to execute debug provider');
|
|
2032
|
+
}
|
|
2010
2033
|
};
|
|
2011
|
-
const
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
message: error.message,
|
|
2019
|
-
data: error
|
|
2020
|
-
}
|
|
2021
|
-
};
|
|
2034
|
+
const stepOut = async protocol => {
|
|
2035
|
+
try {
|
|
2036
|
+
const provider = getDebugProvider(protocol);
|
|
2037
|
+
return await provider.stepOut();
|
|
2038
|
+
} catch (error) {
|
|
2039
|
+
throw new VError(error, 'Failed to execute debug provider');
|
|
2040
|
+
}
|
|
2022
2041
|
};
|
|
2023
|
-
const
|
|
2042
|
+
const stepOver = async protocol => {
|
|
2024
2043
|
try {
|
|
2025
|
-
const
|
|
2026
|
-
return
|
|
2044
|
+
const provider = getDebugProvider(protocol);
|
|
2045
|
+
return await provider.stepOver();
|
|
2027
2046
|
} catch (error) {
|
|
2028
|
-
|
|
2029
|
-
return getErrorResponseSimple(message.id, error);
|
|
2030
|
-
}
|
|
2031
|
-
return getErrorResponse(message.id, error, preparePrettyError, logError);
|
|
2047
|
+
throw new VError(error, 'Failed to execute debug provider');
|
|
2032
2048
|
}
|
|
2033
2049
|
};
|
|
2034
|
-
const
|
|
2035
|
-
|
|
2050
|
+
const setPauseOnException = async (protocol, value) => {
|
|
2051
|
+
try {
|
|
2052
|
+
const provider = getDebugProvider(protocol);
|
|
2053
|
+
return await provider.setPauseOnExceptions(value);
|
|
2054
|
+
} catch (error) {
|
|
2055
|
+
throw new VError(error, 'Failed to execute debug provider');
|
|
2056
|
+
}
|
|
2036
2057
|
};
|
|
2037
|
-
const
|
|
2038
|
-
|
|
2058
|
+
const getProperties = async (protocol, objectId) => {
|
|
2059
|
+
try {
|
|
2060
|
+
const provider = getDebugProvider(protocol);
|
|
2061
|
+
return await provider.getProperties(objectId);
|
|
2062
|
+
} catch (error) {
|
|
2063
|
+
throw new VError(error, 'Failed to execute debug provider');
|
|
2064
|
+
}
|
|
2039
2065
|
};
|
|
2040
|
-
const
|
|
2041
|
-
|
|
2066
|
+
const evaluate = async (protocol, expression, callFrameId) => {
|
|
2067
|
+
try {
|
|
2068
|
+
const provider = getDebugProvider(protocol);
|
|
2069
|
+
return await provider.evaluate(expression, callFrameId);
|
|
2070
|
+
} catch (error) {
|
|
2071
|
+
throw new VError(error, 'Failed to execute debug provider');
|
|
2072
|
+
}
|
|
2042
2073
|
};
|
|
2043
|
-
const
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
return {
|
|
2050
|
-
ipc: options.ipc,
|
|
2051
|
-
message: options.message,
|
|
2052
|
-
execute: options.execute,
|
|
2053
|
-
resolve: options.resolve || defaultResolve,
|
|
2054
|
-
preparePrettyError: options.preparePrettyError || defaultPreparePrettyError,
|
|
2055
|
-
logError: options.logError || defaultLogError,
|
|
2056
|
-
requiresSocket: options.requiresSocket || defaultRequiresSocket
|
|
2057
|
-
};
|
|
2074
|
+
const setPauseOnExceptions = async (protocol, value) => {
|
|
2075
|
+
try {
|
|
2076
|
+
const provider = getDebugProvider(protocol);
|
|
2077
|
+
return await provider.setPauseOnExceptions(value);
|
|
2078
|
+
} catch (error) {
|
|
2079
|
+
throw new VError(error, 'Failed to execute setPauseOnExceptions');
|
|
2058
2080
|
}
|
|
2059
|
-
return {
|
|
2060
|
-
ipc: args[0],
|
|
2061
|
-
message: args[1],
|
|
2062
|
-
execute: args[2],
|
|
2063
|
-
resolve: args[3],
|
|
2064
|
-
preparePrettyError: args[4],
|
|
2065
|
-
logError: args[5],
|
|
2066
|
-
requiresSocket: args[6]
|
|
2067
|
-
};
|
|
2068
2081
|
};
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
const errorResponse = getErrorResponse(message.id, error, preparePrettyError, logError);
|
|
2087
|
-
ipc.send(errorResponse);
|
|
2082
|
+
|
|
2083
|
+
const {
|
|
2084
|
+
registerDefinitionProvider,
|
|
2085
|
+
executeDefinitionProvider} = create$b({
|
|
2086
|
+
name: 'Definition',
|
|
2087
|
+
resultShape: {
|
|
2088
|
+
allowUndefined: true,
|
|
2089
|
+
type: Object$1,
|
|
2090
|
+
properties: {
|
|
2091
|
+
uri: {
|
|
2092
|
+
type: String$1
|
|
2093
|
+
},
|
|
2094
|
+
startOffset: {
|
|
2095
|
+
type: Number
|
|
2096
|
+
},
|
|
2097
|
+
endOffset: {
|
|
2098
|
+
type: Number
|
|
2088
2099
|
}
|
|
2089
|
-
return;
|
|
2090
2100
|
}
|
|
2091
|
-
resolve(message.id, message);
|
|
2092
|
-
return;
|
|
2093
|
-
}
|
|
2094
|
-
if ('method' in message) {
|
|
2095
|
-
await getResponse(message, ipc, execute, preparePrettyError, logError, requiresSocket);
|
|
2096
|
-
return;
|
|
2097
2101
|
}
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
const
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2102
|
+
});
|
|
2103
|
+
|
|
2104
|
+
const {
|
|
2105
|
+
registerDiagnosticProvider,
|
|
2106
|
+
executeDiagnosticProvider
|
|
2107
|
+
} = create$b({
|
|
2108
|
+
name: 'Diagnostic',
|
|
2109
|
+
resultShape: {
|
|
2110
|
+
type: Array$1,
|
|
2111
|
+
items: {
|
|
2112
|
+
type: Object$1
|
|
2113
|
+
}
|
|
2109
2114
|
}
|
|
2110
|
-
|
|
2111
|
-
|
|
2115
|
+
});
|
|
2116
|
+
|
|
2117
|
+
const RendererWorker = 1;
|
|
2118
|
+
|
|
2119
|
+
const invoke$1 = (method, ...params) => {
|
|
2120
|
+
const rpc = get$b(RendererWorker);
|
|
2121
|
+
return rpc.invoke(method, ...params);
|
|
2112
2122
|
};
|
|
2113
|
-
const
|
|
2114
|
-
const
|
|
2115
|
-
|
|
2123
|
+
const invokeAndTransfer$1 = (method, ...params) => {
|
|
2124
|
+
const rpc = get$b(RendererWorker);
|
|
2125
|
+
return rpc.invokeAndTransfer(method, ...params);
|
|
2116
2126
|
};
|
|
2117
|
-
|
|
2118
|
-
|
|
2127
|
+
|
|
2128
|
+
const showInformationMessage = message => {
|
|
2129
|
+
string(message);
|
|
2130
|
+
const result = invoke$1('ExtensionHostDialog.showInformationMessage', message);
|
|
2131
|
+
return result;
|
|
2119
2132
|
};
|
|
2120
|
-
|
|
2121
|
-
|
|
2133
|
+
|
|
2134
|
+
const env = {};
|
|
2135
|
+
|
|
2136
|
+
const exec = async (command, args, options) => {
|
|
2137
|
+
throw new DepecratedError(`vscode.exec is deprecated, use createNodeRpc instead`);
|
|
2122
2138
|
};
|
|
2123
2139
|
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2140
|
+
const fileSystemProviderMap = Object.create(null);
|
|
2141
|
+
const get$9 = protocol => {
|
|
2142
|
+
const provider = fileSystemProviderMap[protocol];
|
|
2143
|
+
if (!provider) {
|
|
2144
|
+
// @ts-ignore
|
|
2145
|
+
throw new VError(`no file system provider for protocol "${protocol}" found`);
|
|
2128
2146
|
}
|
|
2129
|
-
|
|
2130
|
-
const commands = Object.create(null);
|
|
2131
|
-
const register$1 = commandMap => {
|
|
2132
|
-
Object.assign(commands, commandMap);
|
|
2133
|
-
};
|
|
2134
|
-
const getCommand = key => {
|
|
2135
|
-
return commands[key];
|
|
2147
|
+
return provider;
|
|
2136
2148
|
};
|
|
2137
|
-
const
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
throw new CommandNotFoundError(command);
|
|
2149
|
+
const set$9 = (id, provider) => {
|
|
2150
|
+
if (!id) {
|
|
2151
|
+
throw new Error('Failed to register file system provider: missing id');
|
|
2141
2152
|
}
|
|
2142
|
-
|
|
2153
|
+
fileSystemProviderMap[id] = provider;
|
|
2143
2154
|
};
|
|
2144
2155
|
|
|
2145
|
-
const
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
ipc,
|
|
2149
|
-
/**
|
|
2150
|
-
* @deprecated
|
|
2151
|
-
*/
|
|
2152
|
-
send(method, ...params) {
|
|
2153
|
-
send$1(ipc, method, ...params);
|
|
2154
|
-
},
|
|
2155
|
-
invoke(method, ...params) {
|
|
2156
|
-
return invoke$1(ipc, method, ...params);
|
|
2157
|
-
},
|
|
2158
|
-
invokeAndTransfer(method, ...params) {
|
|
2159
|
-
return invokeAndTransfer$1(ipc, method, ...params);
|
|
2160
|
-
},
|
|
2161
|
-
async dispose() {
|
|
2162
|
-
await ipc?.dispose();
|
|
2163
|
-
}
|
|
2164
|
-
};
|
|
2165
|
-
return rpc;
|
|
2166
|
-
};
|
|
2167
|
-
const requiresSocket = () => {
|
|
2168
|
-
return false;
|
|
2169
|
-
};
|
|
2170
|
-
const preparePrettyError = error => {
|
|
2171
|
-
return error;
|
|
2172
|
-
};
|
|
2173
|
-
const logError = () => {
|
|
2174
|
-
// handled by renderer worker
|
|
2175
|
-
};
|
|
2176
|
-
const handleMessage = event => {
|
|
2177
|
-
const actualRequiresSocket = event?.target?.requiresSocket || requiresSocket;
|
|
2178
|
-
const actualExecute = event?.target?.execute || execute;
|
|
2179
|
-
return handleJsonRpcMessage(event.target, event.data, actualExecute, resolve, preparePrettyError, logError, actualRequiresSocket);
|
|
2180
|
-
};
|
|
2181
|
-
const handleIpc = ipc => {
|
|
2182
|
-
if ('addEventListener' in ipc) {
|
|
2183
|
-
ipc.addEventListener('message', handleMessage);
|
|
2184
|
-
} else if ('on' in ipc) {
|
|
2185
|
-
// deprecated
|
|
2186
|
-
ipc.on('message', handleMessage);
|
|
2156
|
+
const registerFileSystemProvider = fileSystemProvider => {
|
|
2157
|
+
if (!fileSystemProvider.id) {
|
|
2158
|
+
throw new Error('Failed to register file system provider: missing id');
|
|
2187
2159
|
}
|
|
2160
|
+
set$9(fileSystemProvider.id, fileSystemProvider);
|
|
2188
2161
|
};
|
|
2189
|
-
const
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2162
|
+
const readDirWithFileTypes$2 = async (protocol, path) => {
|
|
2163
|
+
try {
|
|
2164
|
+
const provider = get$9(protocol);
|
|
2165
|
+
return await provider.readDirWithFileTypes(path);
|
|
2166
|
+
} catch (error) {
|
|
2167
|
+
throw new VError(error, 'Failed to execute file system provider');
|
|
2193
2168
|
}
|
|
2194
|
-
const ipc = module.wrap(rawIpc);
|
|
2195
|
-
return ipc;
|
|
2196
|
-
};
|
|
2197
|
-
const create$f = async ({
|
|
2198
|
-
commandMap,
|
|
2199
|
-
messagePort
|
|
2200
|
-
}) => {
|
|
2201
|
-
// TODO create a commandMap per rpc instance
|
|
2202
|
-
register$1(commandMap);
|
|
2203
|
-
const ipc = await listen$1(IpcChildWithMessagePort$1, {
|
|
2204
|
-
port: messagePort
|
|
2205
|
-
});
|
|
2206
|
-
handleIpc(ipc);
|
|
2207
|
-
const rpc = createRpc$1(ipc);
|
|
2208
|
-
return rpc;
|
|
2209
|
-
};
|
|
2210
|
-
const MessagePortRpcClient = {
|
|
2211
|
-
__proto__: null,
|
|
2212
|
-
create: create$f
|
|
2213
|
-
};
|
|
2214
|
-
const create$e = async ({
|
|
2215
|
-
commandMap,
|
|
2216
|
-
messagePort,
|
|
2217
|
-
isMessagePortOpen
|
|
2218
|
-
}) => {
|
|
2219
|
-
// TODO create a commandMap per rpc instance
|
|
2220
|
-
register$1(commandMap);
|
|
2221
|
-
const rawIpc = await IpcParentWithMessagePort$1.create({
|
|
2222
|
-
messagePort,
|
|
2223
|
-
isMessagePortOpen
|
|
2224
|
-
});
|
|
2225
|
-
const ipc = IpcParentWithMessagePort$1.wrap(rawIpc);
|
|
2226
|
-
handleIpc(ipc);
|
|
2227
|
-
const rpc = createRpc$1(ipc);
|
|
2228
|
-
return rpc;
|
|
2229
|
-
};
|
|
2230
|
-
const MessagePortRpcParent = {
|
|
2231
|
-
__proto__: null,
|
|
2232
|
-
create: create$e
|
|
2233
2169
|
};
|
|
2234
|
-
const
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
messagePort,
|
|
2242
|
-
isMessagePortOpen: true
|
|
2243
|
-
});
|
|
2244
|
-
const ipc = IpcParentWithMessagePort$1.wrap(rawIpc);
|
|
2245
|
-
handleIpc(ipc);
|
|
2246
|
-
const rpc = createRpc$1(ipc);
|
|
2247
|
-
messagePort.start();
|
|
2248
|
-
return rpc;
|
|
2170
|
+
const readFile$2 = async (protocol, path) => {
|
|
2171
|
+
try {
|
|
2172
|
+
const provider = get$9(protocol);
|
|
2173
|
+
return await provider.readFile(path);
|
|
2174
|
+
} catch (error) {
|
|
2175
|
+
throw new VError(error, 'Failed to execute file system provider');
|
|
2176
|
+
}
|
|
2249
2177
|
};
|
|
2250
|
-
const
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2178
|
+
const readFileExternal = async path => {
|
|
2179
|
+
// TODO when file is local,
|
|
2180
|
+
// don't ask renderer worker
|
|
2181
|
+
// instead read file directly from shared process
|
|
2182
|
+
// this avoid parsing the potentially large message
|
|
2183
|
+
// and improve performance by not blocking the renderer worker
|
|
2184
|
+
// when reading / writing large files
|
|
2185
|
+
const content = await invoke$1('FileSystem.readFile', path);
|
|
2186
|
+
return content;
|
|
2258
2187
|
};
|
|
2259
|
-
const
|
|
2260
|
-
|
|
2261
|
-
create: create$4$1
|
|
2188
|
+
const existsExternal = async uri => {
|
|
2189
|
+
return await invoke$1('FileSystem.exists', uri);
|
|
2262
2190
|
};
|
|
2263
|
-
const
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
return create$5$1({
|
|
2273
|
-
commandMap,
|
|
2274
|
-
messagePort: port2
|
|
2275
|
-
});
|
|
2191
|
+
const readDirWithFileTypesExternal = async path => {
|
|
2192
|
+
// TODO when file is local,
|
|
2193
|
+
// don't ask renderer worker
|
|
2194
|
+
// instead read file directly from shared process
|
|
2195
|
+
// this avoid parsing the potentially large message
|
|
2196
|
+
// and improve performance by not blocking the renderer worker
|
|
2197
|
+
// when reading / writing large files
|
|
2198
|
+
const content = await invoke$1('FileSystem.readDirWithFileTypes', path);
|
|
2199
|
+
return content;
|
|
2276
2200
|
};
|
|
2277
|
-
const
|
|
2278
|
-
|
|
2279
|
-
|
|
2201
|
+
const remove$3 = async (protocol, path) => {
|
|
2202
|
+
try {
|
|
2203
|
+
const provider = get$9(protocol);
|
|
2204
|
+
return await provider.remove(path);
|
|
2205
|
+
} catch (error) {
|
|
2206
|
+
throw new VError(error, 'Failed to execute file system provider');
|
|
2207
|
+
}
|
|
2280
2208
|
};
|
|
2281
|
-
const
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
webSocket
|
|
2289
|
-
});
|
|
2290
|
-
const ipc = IpcParentWithWebSocket$1$1.wrap(rawIpc);
|
|
2291
|
-
handleIpc(ipc);
|
|
2292
|
-
const rpc = createRpc$1(ipc);
|
|
2293
|
-
return rpc;
|
|
2209
|
+
const rename$1 = async (protocol, oldUri, newUri) => {
|
|
2210
|
+
try {
|
|
2211
|
+
const provider = get$9(protocol);
|
|
2212
|
+
return await provider.rename(oldUri, newUri);
|
|
2213
|
+
} catch (error) {
|
|
2214
|
+
throw new VError(error, 'Failed to execute file system provider');
|
|
2215
|
+
}
|
|
2294
2216
|
};
|
|
2295
|
-
const
|
|
2296
|
-
|
|
2297
|
-
|
|
2217
|
+
const writeFile$3 = async (protocol, uri, content) => {
|
|
2218
|
+
try {
|
|
2219
|
+
const provider = get$9(protocol);
|
|
2220
|
+
return await provider.writeFile(uri, content);
|
|
2221
|
+
} catch (error) {
|
|
2222
|
+
throw new VError(error, 'Failed to execute file system provider');
|
|
2223
|
+
}
|
|
2298
2224
|
};
|
|
2299
|
-
const
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
const rpc = createRpc$1(ipc);
|
|
2307
|
-
return rpc;
|
|
2225
|
+
const getPathSeparator = protocol => {
|
|
2226
|
+
try {
|
|
2227
|
+
const provider = get$9(protocol);
|
|
2228
|
+
return provider.pathSeparator;
|
|
2229
|
+
} catch (error) {
|
|
2230
|
+
throw new VError(error, 'Failed to execute file system provider');
|
|
2231
|
+
}
|
|
2308
2232
|
};
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2233
|
+
|
|
2234
|
+
const {
|
|
2235
|
+
registerFormattingProvider,
|
|
2236
|
+
executeFormattingProvider} = create$b({
|
|
2237
|
+
name: 'Formatting',
|
|
2238
|
+
executeKey: 'format',
|
|
2239
|
+
resultShape: {
|
|
2240
|
+
allowUndefined: true,
|
|
2241
|
+
type: Array$1,
|
|
2242
|
+
items: {
|
|
2243
|
+
type: Object$1,
|
|
2244
|
+
properties: {
|
|
2245
|
+
startOffset: {
|
|
2246
|
+
type: Number
|
|
2247
|
+
},
|
|
2248
|
+
endOffset: {
|
|
2249
|
+
type: Number
|
|
2250
|
+
},
|
|
2251
|
+
inserted: {
|
|
2252
|
+
type: String$1
|
|
2253
|
+
}
|
|
2254
|
+
}
|
|
2255
|
+
}
|
|
2256
|
+
}
|
|
2257
|
+
});
|
|
2258
|
+
|
|
2259
|
+
const getOffset = (textDocument, position) => {
|
|
2260
|
+
let offset = 0;
|
|
2261
|
+
let rowIndex = 0;
|
|
2262
|
+
while (rowIndex++ < position.rowIndex) {
|
|
2263
|
+
const newLineIndex = textDocument.text.indexOf('\n', offset);
|
|
2264
|
+
offset = newLineIndex + 1;
|
|
2265
|
+
}
|
|
2266
|
+
offset += position.columnIndex;
|
|
2267
|
+
return offset;
|
|
2268
|
+
};
|
|
2269
|
+
|
|
2270
|
+
const getPosition = (textDocument, offset) => {
|
|
2271
|
+
let index = 0;
|
|
2272
|
+
let rowIndex = 0;
|
|
2273
|
+
let newLineIndex = 0;
|
|
2274
|
+
const {
|
|
2275
|
+
text
|
|
2276
|
+
} = textDocument;
|
|
2277
|
+
while (index < offset) {
|
|
2278
|
+
newLineIndex = text.indexOf('\n', index);
|
|
2279
|
+
if (newLineIndex === -1) {
|
|
2280
|
+
break;
|
|
2281
|
+
}
|
|
2282
|
+
const newIndex = newLineIndex + 1;
|
|
2283
|
+
if (newIndex > offset) {
|
|
2284
|
+
break;
|
|
2285
|
+
}
|
|
2286
|
+
index = newIndex;
|
|
2287
|
+
rowIndex++;
|
|
2288
|
+
}
|
|
2289
|
+
const columnIndex = offset - index;
|
|
2290
|
+
return {
|
|
2291
|
+
rowIndex,
|
|
2292
|
+
columnIndex
|
|
2293
|
+
};
|
|
2312
2294
|
};
|
|
2313
2295
|
|
|
2296
|
+
const {
|
|
2297
|
+
registerHoverProvider,
|
|
2298
|
+
executeHoverProvider} = create$b({
|
|
2299
|
+
name: 'Hover',
|
|
2300
|
+
resultShape: {
|
|
2301
|
+
allowUndefined: true,
|
|
2302
|
+
type: Object$1,
|
|
2303
|
+
properties: {}
|
|
2304
|
+
}
|
|
2305
|
+
});
|
|
2306
|
+
|
|
2307
|
+
const {
|
|
2308
|
+
registerImplementationProvider,
|
|
2309
|
+
executeImplementationProvider} = create$b({
|
|
2310
|
+
name: 'Implementation',
|
|
2311
|
+
resultShape: {
|
|
2312
|
+
type: Array$1,
|
|
2313
|
+
items: {
|
|
2314
|
+
type: Object$1
|
|
2315
|
+
}
|
|
2316
|
+
}
|
|
2317
|
+
});
|
|
2318
|
+
|
|
2319
|
+
const WebSocket$1 = 5;
|
|
2320
|
+
const ElectronMessagePort = 6;
|
|
2321
|
+
const ModuleWorkerAndWorkaroundForChromeDevtoolsBug$1 = 7;
|
|
2322
|
+
|
|
2314
2323
|
const getPortTuple = () => {
|
|
2315
2324
|
const {
|
|
2316
2325
|
port1,
|
|
@@ -2329,7 +2338,7 @@ const sendPort = async ({
|
|
|
2329
2338
|
name,
|
|
2330
2339
|
port
|
|
2331
2340
|
}) => {
|
|
2332
|
-
await invokeAndTransfer$
|
|
2341
|
+
await invokeAndTransfer$1('IpcParent.create', {
|
|
2333
2342
|
method: ModuleWorkerAndWorkaroundForChromeDevtoolsBug,
|
|
2334
2343
|
url,
|
|
2335
2344
|
name,
|
|
@@ -2370,7 +2379,7 @@ const IpcParentWithModuleWorkerAndWorkaroundForChromeDevtoolsBug = {
|
|
|
2370
2379
|
};
|
|
2371
2380
|
|
|
2372
2381
|
const sendMessagePortToElectron = async (port, initialCommand) => {
|
|
2373
|
-
await invokeAndTransfer$
|
|
2382
|
+
await invokeAndTransfer$1('SendMessagePortToElectron.sendMessagePortToElectron', port, initialCommand);
|
|
2374
2383
|
};
|
|
2375
2384
|
|
|
2376
2385
|
const getPort = async type => {
|
|
@@ -2530,7 +2539,7 @@ const createNodeRpc = async ({
|
|
|
2530
2539
|
|
|
2531
2540
|
const send = async port => {
|
|
2532
2541
|
const initialCommand = 'FileSystem.handleMessagePort';
|
|
2533
|
-
await invokeAndTransfer$
|
|
2542
|
+
await invokeAndTransfer$1('SendMessagePortToExtensionHostWorker.sendMessagePortToFileSystemWorker', port, initialCommand);
|
|
2534
2543
|
};
|
|
2535
2544
|
const launchFileSystemProcess = async () => {
|
|
2536
2545
|
const rpc = await TransferMessagePortRpcParent.create({
|
|
@@ -2611,7 +2620,7 @@ const getEnabledProviders = () => {
|
|
|
2611
2620
|
|
|
2612
2621
|
const confirm = message => {
|
|
2613
2622
|
string(message);
|
|
2614
|
-
const result = invoke$
|
|
2623
|
+
const result = invoke$1('ConfirmPrompt.prompt', message);
|
|
2615
2624
|
return result;
|
|
2616
2625
|
};
|
|
2617
2626
|
|
|
@@ -2623,7 +2632,7 @@ const showQuickPick = async ({
|
|
|
2623
2632
|
}) => {
|
|
2624
2633
|
const rawPicks = await getPicks();
|
|
2625
2634
|
const picks = rawPicks.map(toPick);
|
|
2626
|
-
return invoke$
|
|
2635
|
+
return invoke$1(ExtensionHostQuickPickShow, picks);
|
|
2627
2636
|
};
|
|
2628
2637
|
|
|
2629
2638
|
const {
|
|
@@ -2689,7 +2698,7 @@ const extensionHostSubWorkerUrl = getExtensionHostSubWorkerUrl();
|
|
|
2689
2698
|
|
|
2690
2699
|
const set$8 = async (url, contentSecurityPolicy) => {
|
|
2691
2700
|
const pathName = new URL(url).pathname;
|
|
2692
|
-
await invoke$
|
|
2701
|
+
await invoke$1('ExtensionHostWorkerContentSecurityPolicy.set', pathName, contentSecurityPolicy);
|
|
2693
2702
|
};
|
|
2694
2703
|
|
|
2695
2704
|
/**
|
|
@@ -2836,16 +2845,96 @@ const {
|
|
|
2836
2845
|
});
|
|
2837
2846
|
|
|
2838
2847
|
const state$9 = {
|
|
2848
|
+
webExtensions: []
|
|
2849
|
+
};
|
|
2850
|
+
|
|
2851
|
+
const getJson = async url => {
|
|
2852
|
+
try {
|
|
2853
|
+
const response = await fetch(url);
|
|
2854
|
+
if (!response.ok) {
|
|
2855
|
+
throw new Error(response.statusText);
|
|
2856
|
+
}
|
|
2857
|
+
const json = await response.json();
|
|
2858
|
+
return json;
|
|
2859
|
+
} catch (error) {
|
|
2860
|
+
throw new VError(error, `Failed to get json`);
|
|
2861
|
+
}
|
|
2862
|
+
};
|
|
2863
|
+
|
|
2864
|
+
const getAssetDir = () => {
|
|
2865
|
+
// @ts-ignore
|
|
2866
|
+
if (typeof ASSET_DIR !== 'undefined') {
|
|
2867
|
+
// @ts-ignore
|
|
2868
|
+
return ASSET_DIR;
|
|
2869
|
+
}
|
|
2870
|
+
if (platform === Electron) {
|
|
2871
|
+
return '../../../../..';
|
|
2872
|
+
}
|
|
2873
|
+
return '';
|
|
2874
|
+
};
|
|
2875
|
+
const assetDir = getAssetDir();
|
|
2876
|
+
|
|
2877
|
+
const extensionsUrl = `${assetDir}/config/extensions.json`;
|
|
2878
|
+
|
|
2879
|
+
const getWebExtensions = async () => {
|
|
2880
|
+
return getJson(extensionsUrl);
|
|
2881
|
+
};
|
|
2882
|
+
|
|
2883
|
+
const getSharedProcessExtensions = () => {
|
|
2884
|
+
return invoke$1(/* ExtensionManagement.getExtensions */'ExtensionManagement.getExtensions');
|
|
2885
|
+
};
|
|
2886
|
+
const doGetExtensions = async () => {
|
|
2887
|
+
const meta = state$9.webExtensions;
|
|
2888
|
+
if (platform === Web) {
|
|
2889
|
+
const webExtensions = await getWebExtensions();
|
|
2890
|
+
return [...webExtensions, ...meta];
|
|
2891
|
+
}
|
|
2892
|
+
if (platform === Remote) {
|
|
2893
|
+
const sharedProcessExtensions = await getSharedProcessExtensions();
|
|
2894
|
+
return [...sharedProcessExtensions, ...meta];
|
|
2895
|
+
}
|
|
2896
|
+
const extensions = await getSharedProcessExtensions();
|
|
2897
|
+
return extensions;
|
|
2898
|
+
};
|
|
2899
|
+
|
|
2900
|
+
const getExtensions$1 = async () => {
|
|
2901
|
+
return doGetExtensions();
|
|
2902
|
+
};
|
|
2903
|
+
|
|
2904
|
+
const cache = Object.create(null);
|
|
2905
|
+
const id = 1;
|
|
2906
|
+
const get$6 = () => {
|
|
2907
|
+
return cache[id];
|
|
2908
|
+
};
|
|
2909
|
+
const has = () => {
|
|
2910
|
+
return id in cache;
|
|
2911
|
+
};
|
|
2912
|
+
const set$6 = value => {
|
|
2913
|
+
cache[id] = value;
|
|
2914
|
+
};
|
|
2915
|
+
const clear = () => {
|
|
2916
|
+
delete cache[id];
|
|
2917
|
+
};
|
|
2918
|
+
|
|
2919
|
+
// TODO getExtensions is still called 6 times on startup instead of 1
|
|
2920
|
+
const getExtensions = () => {
|
|
2921
|
+
if (!has()) {
|
|
2922
|
+
set$6(getExtensions$1());
|
|
2923
|
+
}
|
|
2924
|
+
return get$6();
|
|
2925
|
+
};
|
|
2926
|
+
|
|
2927
|
+
const state$8 = {
|
|
2839
2928
|
providers: Object.create(null)
|
|
2840
2929
|
};
|
|
2841
2930
|
const registerSourceControlProvider = provider => {
|
|
2842
|
-
state$
|
|
2931
|
+
state$8.providers[provider.id] = provider;
|
|
2843
2932
|
};
|
|
2844
2933
|
const getFilesFromProvider = provider => {
|
|
2845
2934
|
return provider.getChangedFiles();
|
|
2846
2935
|
};
|
|
2847
2936
|
const getChangedFiles = async providerId => {
|
|
2848
|
-
const provider = state$
|
|
2937
|
+
const provider = state$8.providers[providerId];
|
|
2849
2938
|
if (!provider) {
|
|
2850
2939
|
throw new Error('no source control provider found');
|
|
2851
2940
|
}
|
|
@@ -2856,7 +2945,7 @@ const getChangedFiles = async providerId => {
|
|
|
2856
2945
|
const getFileBefore = async (providerId, uri) => {
|
|
2857
2946
|
string(providerId);
|
|
2858
2947
|
string(uri);
|
|
2859
|
-
const provider = state$
|
|
2948
|
+
const provider = state$8.providers[providerId];
|
|
2860
2949
|
if (!provider) {
|
|
2861
2950
|
throw new Error('no source control provider found');
|
|
2862
2951
|
}
|
|
@@ -2878,7 +2967,7 @@ const getGroupsFromProvider = async (provider, cwd) => {
|
|
|
2878
2967
|
throw new Error('source control provider is missing required function getGroups');
|
|
2879
2968
|
};
|
|
2880
2969
|
const getGroups = async (providerId, cwd) => {
|
|
2881
|
-
const provider = state$
|
|
2970
|
+
const provider = state$8.providers[providerId];
|
|
2882
2971
|
if (!provider) {
|
|
2883
2972
|
throw new Error('no source control provider found');
|
|
2884
2973
|
}
|
|
@@ -2886,14 +2975,14 @@ const getGroups = async (providerId, cwd) => {
|
|
|
2886
2975
|
return groups;
|
|
2887
2976
|
};
|
|
2888
2977
|
const acceptInput = async (providerId, value) => {
|
|
2889
|
-
const provider = state$
|
|
2978
|
+
const provider = state$8.providers[providerId];
|
|
2890
2979
|
if (!provider) {
|
|
2891
2980
|
throw new Error('no source control provider found');
|
|
2892
2981
|
}
|
|
2893
2982
|
await provider.acceptInput(value);
|
|
2894
2983
|
};
|
|
2895
2984
|
const add = async path => {
|
|
2896
|
-
const provider = Object.values(state$
|
|
2985
|
+
const provider = Object.values(state$8.providers)[0];
|
|
2897
2986
|
if (!provider) {
|
|
2898
2987
|
return;
|
|
2899
2988
|
}
|
|
@@ -2901,7 +2990,7 @@ const add = async path => {
|
|
|
2901
2990
|
await provider.add(path);
|
|
2902
2991
|
};
|
|
2903
2992
|
const discard = async path => {
|
|
2904
|
-
const provider = Object.values(state$
|
|
2993
|
+
const provider = Object.values(state$8.providers)[0];
|
|
2905
2994
|
if (!provider) {
|
|
2906
2995
|
return;
|
|
2907
2996
|
}
|
|
@@ -2911,7 +3000,7 @@ const discard = async path => {
|
|
|
2911
3000
|
const getEnabledProviderIds = async (scheme, root) => {
|
|
2912
3001
|
string(scheme);
|
|
2913
3002
|
string(root);
|
|
2914
|
-
const providers = Object.values(state$
|
|
3003
|
+
const providers = Object.values(state$8.providers);
|
|
2915
3004
|
const enabledIds = [];
|
|
2916
3005
|
for (const provider of providers) {
|
|
2917
3006
|
// @ts-ignore
|
|
@@ -2927,6 +3016,18 @@ const getEnabledProviderIds = async (scheme, root) => {
|
|
|
2927
3016
|
}
|
|
2928
3017
|
return enabledIds;
|
|
2929
3018
|
};
|
|
3019
|
+
const getIconDefinitions = async providerId => {
|
|
3020
|
+
const extensions = await getExtensions();
|
|
3021
|
+
for (const extension of extensions) {
|
|
3022
|
+
const id = extension.id.split('.');
|
|
3023
|
+
const shortId = id[1];
|
|
3024
|
+
if (shortId === providerId && extension['source-control-icons'] && Array.isArray(extension['source-control-icons'])) {
|
|
3025
|
+
return extension['source-control-icons'];
|
|
3026
|
+
}
|
|
3027
|
+
}
|
|
3028
|
+
// TODO return warning that no icons were found?
|
|
3029
|
+
return [];
|
|
3030
|
+
};
|
|
2930
3031
|
|
|
2931
3032
|
const {
|
|
2932
3033
|
registerTabCompletionProvider,
|
|
@@ -2938,7 +3039,7 @@ const {
|
|
|
2938
3039
|
}
|
|
2939
3040
|
});
|
|
2940
3041
|
|
|
2941
|
-
const state$
|
|
3042
|
+
const state$7 = {
|
|
2942
3043
|
textSearchProviders: Object.create(null)
|
|
2943
3044
|
};
|
|
2944
3045
|
const registerTextSearchProvider = textSearchProvider => {
|
|
@@ -2949,14 +3050,14 @@ const registerTextSearchProvider = textSearchProvider => {
|
|
|
2949
3050
|
if (!textSearchProvider.scheme) {
|
|
2950
3051
|
throw new Error('textSearchProvider is missing scheme');
|
|
2951
3052
|
}
|
|
2952
|
-
state$
|
|
3053
|
+
state$7.textSearchProviders[textSearchProvider.scheme] = textSearchProvider;
|
|
2953
3054
|
} catch (error) {
|
|
2954
3055
|
throw new VError(error, 'Failed to register text search provider');
|
|
2955
3056
|
}
|
|
2956
3057
|
};
|
|
2957
3058
|
const executeTextSearchProvider = async (scheme, query) => {
|
|
2958
3059
|
try {
|
|
2959
|
-
const textSearchProvider = state$
|
|
3060
|
+
const textSearchProvider = state$7.textSearchProviders[scheme];
|
|
2960
3061
|
if (!textSearchProvider) {
|
|
2961
3062
|
throw new Error(`No text search provider for ${scheme} found`);
|
|
2962
3063
|
}
|
|
@@ -3012,7 +3113,7 @@ const createWebViewIpc = async webView => {
|
|
|
3012
3113
|
commandMap: {}
|
|
3013
3114
|
});
|
|
3014
3115
|
const portType = 'test';
|
|
3015
|
-
await invokeAndTransfer$
|
|
3116
|
+
await invokeAndTransfer$1('WebView.setPort', uid, port1, origin, portType);
|
|
3016
3117
|
// TODO maybe don't send a message port only to get object url?
|
|
3017
3118
|
// TODO dispose rpc to avoid memory leak
|
|
3018
3119
|
const rpc = await rpcPromise;
|
|
@@ -3050,7 +3151,7 @@ const getRemoteUrlForWebView = async (uri, options = {}) => {
|
|
|
3050
3151
|
if (!webView) {
|
|
3051
3152
|
throw new Error(`webview ${options.webViewId} not found`);
|
|
3052
3153
|
}
|
|
3053
|
-
const [rpc, blob] = await Promise.all([createWebViewIpc(webView), invoke$
|
|
3154
|
+
const [rpc, blob] = await Promise.all([createWebViewIpc(webView), invoke$1('FileSystem.getBlob', uri)]);
|
|
3054
3155
|
const objectUrl = await rpc.invoke('createObjectUrl', blob);
|
|
3055
3156
|
return objectUrl;
|
|
3056
3157
|
};
|
|
@@ -3075,7 +3176,7 @@ const getRemoteUrl$1 = async (uri, options = {}) => {
|
|
|
3075
3176
|
return getRemoteUrlForWebView(uri, options);
|
|
3076
3177
|
}
|
|
3077
3178
|
if (uri.startsWith('html://')) {
|
|
3078
|
-
const url = await invoke$
|
|
3179
|
+
const url = await invoke$1('Blob.getSrc', uri);
|
|
3079
3180
|
return url;
|
|
3080
3181
|
}
|
|
3081
3182
|
throw new Error(`unsupported platform for remote url`);
|
|
@@ -3156,14 +3257,14 @@ const createWorker = async ({
|
|
|
3156
3257
|
return rpc;
|
|
3157
3258
|
};
|
|
3158
3259
|
|
|
3159
|
-
const state$
|
|
3260
|
+
const state$6 = {
|
|
3160
3261
|
workspacePath: ''
|
|
3161
3262
|
};
|
|
3162
3263
|
const setWorkspacePath = path => {
|
|
3163
|
-
state$
|
|
3264
|
+
state$6.workspacePath = path;
|
|
3164
3265
|
};
|
|
3165
3266
|
const getWorkspaceFolder = path => {
|
|
3166
|
-
return state$
|
|
3267
|
+
return state$6.workspacePath;
|
|
3167
3268
|
};
|
|
3168
3269
|
|
|
3169
3270
|
class FormattingError extends Error {
|
|
@@ -3319,17 +3420,17 @@ const handleUnhandledRejection = event => {
|
|
|
3319
3420
|
console.error(output);
|
|
3320
3421
|
};
|
|
3321
3422
|
|
|
3322
|
-
const state$
|
|
3423
|
+
const state$5 = {
|
|
3323
3424
|
errors: []
|
|
3324
3425
|
};
|
|
3325
3426
|
const addError = error => {
|
|
3326
|
-
state$
|
|
3427
|
+
state$5.errors = [...state$5.errors, error];
|
|
3327
3428
|
};
|
|
3328
3429
|
const hasRecentErrors = () => {
|
|
3329
|
-
return state$
|
|
3430
|
+
return state$5.errors.length > 0;
|
|
3330
3431
|
};
|
|
3331
3432
|
const getRecentError = () => {
|
|
3332
|
-
state$
|
|
3433
|
+
state$5.errors.at(-1);
|
|
3333
3434
|
};
|
|
3334
3435
|
|
|
3335
3436
|
const handleContentSecurityPolicyViolation = event => {
|
|
@@ -3380,7 +3481,7 @@ const isCanceled = token => {
|
|
|
3380
3481
|
};
|
|
3381
3482
|
|
|
3382
3483
|
const modules = Object.create(null);
|
|
3383
|
-
const set$
|
|
3484
|
+
const set$5 = (extensionId, module) => {
|
|
3384
3485
|
modules[extensionId] = module;
|
|
3385
3486
|
};
|
|
3386
3487
|
const acquire = extensionId => {
|
|
@@ -3420,10 +3521,10 @@ const isImportError = error => {
|
|
|
3420
3521
|
};
|
|
3421
3522
|
|
|
3422
3523
|
const states = Object.create(null);
|
|
3423
|
-
const set$
|
|
3524
|
+
const set$4 = status => {
|
|
3424
3525
|
states[status.id] = status;
|
|
3425
3526
|
};
|
|
3426
|
-
const get$
|
|
3527
|
+
const get$5 = extensionId => {
|
|
3427
3528
|
return states[extensionId];
|
|
3428
3529
|
};
|
|
3429
3530
|
const update = (id, update) => {
|
|
@@ -3474,19 +3575,6 @@ class BabelParseError extends SyntaxError {
|
|
|
3474
3575
|
}
|
|
3475
3576
|
}
|
|
3476
3577
|
|
|
3477
|
-
const getAssetDir = () => {
|
|
3478
|
-
// @ts-ignore
|
|
3479
|
-
if (typeof ASSET_DIR !== 'undefined') {
|
|
3480
|
-
// @ts-ignore
|
|
3481
|
-
return ASSET_DIR;
|
|
3482
|
-
}
|
|
3483
|
-
if (platform === Electron) {
|
|
3484
|
-
return '../../../../..';
|
|
3485
|
-
}
|
|
3486
|
-
return '';
|
|
3487
|
-
};
|
|
3488
|
-
const assetDir = getAssetDir();
|
|
3489
|
-
|
|
3490
3578
|
const loadBabelParser = () => {
|
|
3491
3579
|
const url = `${assetDir}/js/babel-parser.js`;
|
|
3492
3580
|
return import(url);
|
|
@@ -3888,7 +3976,7 @@ const activateExtension = async (extension, absolutePath, activationEvent) => {
|
|
|
3888
3976
|
string(extension.browser);
|
|
3889
3977
|
string(absolutePath);
|
|
3890
3978
|
const startTime = performance.now();
|
|
3891
|
-
set$
|
|
3979
|
+
set$4({
|
|
3892
3980
|
activationEndTime: 0,
|
|
3893
3981
|
activationEvent: activationEvent,
|
|
3894
3982
|
activationStartTime: startTime,
|
|
@@ -3932,38 +4020,6 @@ const activateExtension = async (extension, absolutePath, activationEvent) => {
|
|
|
3932
4020
|
// console.info('activated', path)
|
|
3933
4021
|
};
|
|
3934
4022
|
|
|
3935
|
-
const state$5 = {
|
|
3936
|
-
webExtensions: []
|
|
3937
|
-
};
|
|
3938
|
-
|
|
3939
|
-
const cache = Object.create(null);
|
|
3940
|
-
const id = 1;
|
|
3941
|
-
const get$5 = () => {
|
|
3942
|
-
return cache[id];
|
|
3943
|
-
};
|
|
3944
|
-
const has = () => {
|
|
3945
|
-
return id in cache;
|
|
3946
|
-
};
|
|
3947
|
-
const set$4 = value => {
|
|
3948
|
-
cache[id] = value;
|
|
3949
|
-
};
|
|
3950
|
-
const clear = () => {
|
|
3951
|
-
delete cache[id];
|
|
3952
|
-
};
|
|
3953
|
-
|
|
3954
|
-
const getJson = async url => {
|
|
3955
|
-
try {
|
|
3956
|
-
const response = await fetch(url);
|
|
3957
|
-
if (!response.ok) {
|
|
3958
|
-
throw new Error(response.statusText);
|
|
3959
|
-
}
|
|
3960
|
-
const json = await response.json();
|
|
3961
|
-
return json;
|
|
3962
|
-
} catch (error) {
|
|
3963
|
-
throw new VError(error, `Failed to get json`);
|
|
3964
|
-
}
|
|
3965
|
-
};
|
|
3966
|
-
|
|
3967
4023
|
const NewLine = '\n';
|
|
3968
4024
|
const Slash$1 = '/';
|
|
3969
4025
|
|
|
@@ -3995,7 +4051,7 @@ const addWebExtension = async path => {
|
|
|
3995
4051
|
const manifestPath = getWebManifestPath(path);
|
|
3996
4052
|
const manifest = await getWebExtensionManifest(path, manifestPath);
|
|
3997
4053
|
// TODO avoid mutation if possible
|
|
3998
|
-
state$
|
|
4054
|
+
state$9.webExtensions.push(manifest);
|
|
3999
4055
|
clear();
|
|
4000
4056
|
return manifest;
|
|
4001
4057
|
};
|
|
@@ -4011,7 +4067,7 @@ const applyBulkReplacement = async (files, ranges, replacement) => {
|
|
|
4011
4067
|
};
|
|
4012
4068
|
|
|
4013
4069
|
const addCssStyleSheet = (id, css) => {
|
|
4014
|
-
return invoke$
|
|
4070
|
+
return invoke$1('Css.addCssStyleSheet', id, css);
|
|
4015
4071
|
};
|
|
4016
4072
|
|
|
4017
4073
|
const warn = (...args) => {
|
|
@@ -4446,10 +4502,10 @@ const GetColorThemeCssCachedIndexedDb = {
|
|
|
4446
4502
|
};
|
|
4447
4503
|
|
|
4448
4504
|
const getText$1 = key => {
|
|
4449
|
-
return invoke$
|
|
4505
|
+
return invoke$1('LocalStorage.getText', key);
|
|
4450
4506
|
};
|
|
4451
4507
|
const setText = (key, value) => {
|
|
4452
|
-
return invoke$
|
|
4508
|
+
return invoke$1('LocalStorage.setText', key, value);
|
|
4453
4509
|
};
|
|
4454
4510
|
|
|
4455
4511
|
const getCacheKey = colorThemeId => {
|
|
@@ -4484,7 +4540,7 @@ const GetColorThemeCssCachedNoop = {
|
|
|
4484
4540
|
};
|
|
4485
4541
|
|
|
4486
4542
|
const get = key => {
|
|
4487
|
-
return invoke$
|
|
4543
|
+
return invoke$1('Preferences.get', key);
|
|
4488
4544
|
};
|
|
4489
4545
|
|
|
4490
4546
|
const getCacheFn = config => {
|
|
@@ -4510,7 +4566,7 @@ const getColorThemeCssCached = async (colorThemeId, getData) => {
|
|
|
4510
4566
|
};
|
|
4511
4567
|
|
|
4512
4568
|
const readJson = url => {
|
|
4513
|
-
return invoke$
|
|
4569
|
+
return invoke$1('FileSystem.readJson', url);
|
|
4514
4570
|
};
|
|
4515
4571
|
|
|
4516
4572
|
const dirname = (pathSeparator, path) => {
|
|
@@ -4547,41 +4603,6 @@ const getColorThemeUri = (extensions, colorThemeId) => {
|
|
|
4547
4603
|
return '';
|
|
4548
4604
|
};
|
|
4549
4605
|
|
|
4550
|
-
const extensionsUrl = `${assetDir}/config/extensions.json`;
|
|
4551
|
-
|
|
4552
|
-
const getWebExtensions = async () => {
|
|
4553
|
-
return getJson(extensionsUrl);
|
|
4554
|
-
};
|
|
4555
|
-
|
|
4556
|
-
const getSharedProcessExtensions = () => {
|
|
4557
|
-
return invoke$2(/* ExtensionManagement.getExtensions */'ExtensionManagement.getExtensions');
|
|
4558
|
-
};
|
|
4559
|
-
const doGetExtensions = async () => {
|
|
4560
|
-
const meta = state$5.webExtensions;
|
|
4561
|
-
if (platform === Web) {
|
|
4562
|
-
const webExtensions = await getWebExtensions();
|
|
4563
|
-
return [...webExtensions, ...meta];
|
|
4564
|
-
}
|
|
4565
|
-
if (platform === Remote) {
|
|
4566
|
-
const sharedProcessExtensions = await getSharedProcessExtensions();
|
|
4567
|
-
return [...sharedProcessExtensions, ...meta];
|
|
4568
|
-
}
|
|
4569
|
-
const extensions = await getSharedProcessExtensions();
|
|
4570
|
-
return extensions;
|
|
4571
|
-
};
|
|
4572
|
-
|
|
4573
|
-
const getExtensions$1 = async () => {
|
|
4574
|
-
return doGetExtensions();
|
|
4575
|
-
};
|
|
4576
|
-
|
|
4577
|
-
// TODO getExtensions is still called 6 times on startup instead of 1
|
|
4578
|
-
const getExtensions = () => {
|
|
4579
|
-
if (!has()) {
|
|
4580
|
-
set$4(getExtensions$1());
|
|
4581
|
-
}
|
|
4582
|
-
return get$5();
|
|
4583
|
-
};
|
|
4584
|
-
|
|
4585
4606
|
const getColorThemeJson$2 = async colorThemeId => {
|
|
4586
4607
|
const extensions = await getExtensions();
|
|
4587
4608
|
const colorThemeUri = getColorThemeUri(extensions, colorThemeId);
|
|
@@ -4624,7 +4645,7 @@ const getMetaThemeColor = colorThemeJson => {
|
|
|
4624
4645
|
};
|
|
4625
4646
|
|
|
4626
4647
|
const setThemeColor = async themeColor => {
|
|
4627
|
-
await invoke$
|
|
4648
|
+
await invoke$1(/* Meta.setThemeColor */'Meta.setThemeColor', /* color */themeColor);
|
|
4628
4649
|
};
|
|
4629
4650
|
|
|
4630
4651
|
// TODO by default color theme should come from local storage, session storage, cache storage, indexeddb or blob url -> fast initial load
|
|
@@ -4660,7 +4681,7 @@ const watch = async id => {
|
|
|
4660
4681
|
return;
|
|
4661
4682
|
}
|
|
4662
4683
|
state$2.watchedTheme = id;
|
|
4663
|
-
await invoke$
|
|
4684
|
+
await invoke$1('ExtensionHost.watchColorTheme', id);
|
|
4664
4685
|
};
|
|
4665
4686
|
const getPreferredColorTheme = () => {
|
|
4666
4687
|
const preferredColorTheme = get('workbench.colorTheme');
|
|
@@ -4702,20 +4723,20 @@ const create = () => {
|
|
|
4702
4723
|
};
|
|
4703
4724
|
|
|
4704
4725
|
const iframeWorkerCommandMap = {
|
|
4705
|
-
'WebView.compatExtensionHostWorkerInvoke': (...args) => invoke$
|
|
4706
|
-
'WebView.compatExtensionHostWorkerInvokeAndTransfer': (...args) => invokeAndTransfer$
|
|
4707
|
-
'WebView.compatRendererProcessInvoke': (...args) => invoke$
|
|
4708
|
-
'WebView.compatRendererProcessInvokeAndTransfer': (...args) => invokeAndTransfer$
|
|
4726
|
+
'WebView.compatExtensionHostWorkerInvoke': (...args) => invoke$1('WebView.compatExtensionHostWorkerInvoke', ...args),
|
|
4727
|
+
'WebView.compatExtensionHostWorkerInvokeAndTransfer': (...args) => invokeAndTransfer$1('WebView.compatExtensionHostWorkerInvokeAndTransfer', ...args),
|
|
4728
|
+
'WebView.compatRendererProcessInvoke': (...args) => invoke$1('WebView.compatRendererProcessInvoke', ...args),
|
|
4729
|
+
'WebView.compatRendererProcessInvokeAndTransfer': (...args) => invokeAndTransfer$1('WebView.compatRendererProcessInvokeAndTransfer', ...args),
|
|
4709
4730
|
// @ts-ignore
|
|
4710
|
-
'WebView.compatRendererWorkerInvokeAndTransfer': (...args) => invokeAndTransfer$
|
|
4731
|
+
'WebView.compatRendererWorkerInvokeAndTransfer': (...args) => invokeAndTransfer$1(...args),
|
|
4711
4732
|
// @ts-ignore
|
|
4712
|
-
'WebView.compatRendererWorkerInvoke': (...args) => invoke$
|
|
4713
|
-
'WebView.compatSharedProcessInvoke': (...args) => invoke$
|
|
4714
|
-
'WebView.getSavedState': (...args) => invoke$
|
|
4715
|
-
'WebView.getWebViewInfo': (...args) => invoke$
|
|
4716
|
-
'WebView.getWebViews': (...args) => invoke$
|
|
4717
|
-
'WebView.setPort': (...args) => invoke$
|
|
4718
|
-
'ExtensionHostManagement.activateByEvent': (...args) => invoke$
|
|
4733
|
+
'WebView.compatRendererWorkerInvoke': (...args) => invoke$1(...args),
|
|
4734
|
+
'WebView.compatSharedProcessInvoke': (...args) => invoke$1('WebView.compatSharedProcessInvoke', ...args),
|
|
4735
|
+
'WebView.getSavedState': (...args) => invoke$1('WebView.getSavedState', ...args),
|
|
4736
|
+
'WebView.getWebViewInfo': (...args) => invoke$1('WebView.getWebViewInfo', ...args),
|
|
4737
|
+
'WebView.getWebViews': (...args) => invoke$1('WebView.getWebViews', ...args),
|
|
4738
|
+
'WebView.setPort': (...args) => invoke$1('WebView.setPort', ...args),
|
|
4739
|
+
'ExtensionHostManagement.activateByEvent': (...args) => invoke$1('ExtensionHostManagement.activateByEvent', ...args),
|
|
4719
4740
|
'WebView.getRemoteUrl': options => getRemoteUrlForWebView(options.uri, options)
|
|
4720
4741
|
};
|
|
4721
4742
|
|
|
@@ -4781,7 +4802,7 @@ const createWebViewWorkerRpc2 = async (rpcInfo, port) => {
|
|
|
4781
4802
|
|
|
4782
4803
|
// TODO have a way so that the worker already includes the webview api and the extension
|
|
4783
4804
|
// host subworker doesn't need to import the other file
|
|
4784
|
-
await invokeAndTransfer$
|
|
4805
|
+
await invokeAndTransfer$1('IpcParent.create', {
|
|
4785
4806
|
method: ModuleWorkerAndWorkaroundForChromeDevtoolsBug,
|
|
4786
4807
|
url: rpcInfo.url,
|
|
4787
4808
|
name: rpcInfo.name,
|
|
@@ -4802,7 +4823,7 @@ const createWebViewWorkerRpc = async (rpcInfo, port) => {
|
|
|
4802
4823
|
|
|
4803
4824
|
// TODO have a way so that the worker already includes the webview api and the extension
|
|
4804
4825
|
// host subworker doesn't need to import the other file
|
|
4805
|
-
await invokeAndTransfer$
|
|
4826
|
+
await invokeAndTransfer$1('IpcParent.create', {
|
|
4806
4827
|
method: ModuleWorkerAndWorkaroundForChromeDevtoolsBug,
|
|
4807
4828
|
url: extensionHostSubWorkerUrl,
|
|
4808
4829
|
name: rpcInfo.name,
|
|
@@ -4812,7 +4833,7 @@ const createWebViewWorkerRpc = async (rpcInfo, port) => {
|
|
|
4812
4833
|
};
|
|
4813
4834
|
|
|
4814
4835
|
const executeExternalCommand = (method, ...params) => {
|
|
4815
|
-
return invoke$
|
|
4836
|
+
return invoke$1(method, ...params);
|
|
4816
4837
|
};
|
|
4817
4838
|
|
|
4818
4839
|
const BraceCompletionExecuteBraceCompletionProvider = 'ExtensionHostBraceCompletion.executeBraceCompletionProvider';
|
|
@@ -4874,7 +4895,7 @@ const mockExec = () => {
|
|
|
4874
4895
|
try {
|
|
4875
4896
|
// @ts-ignore
|
|
4876
4897
|
api.exec = async (command, args, options) => {
|
|
4877
|
-
const result = await invoke$
|
|
4898
|
+
const result = await invoke$1('Test.executeMockExecFunction', command, args, options);
|
|
4878
4899
|
const {
|
|
4879
4900
|
stdout,
|
|
4880
4901
|
stderr,
|
|
@@ -4900,7 +4921,7 @@ const mockRpc = () => {
|
|
|
4900
4921
|
try {
|
|
4901
4922
|
return {
|
|
4902
4923
|
async invoke(method, ...params) {
|
|
4903
|
-
const result = await invoke$
|
|
4924
|
+
const result = await invoke$1('Test.executeMockRpcFunction', options.name, method, ...params);
|
|
4904
4925
|
return result;
|
|
4905
4926
|
}
|
|
4906
4927
|
};
|
|
@@ -4911,7 +4932,7 @@ const mockRpc = () => {
|
|
|
4911
4932
|
};
|
|
4912
4933
|
|
|
4913
4934
|
const getStatusBarItems = async () => {
|
|
4914
|
-
const providers = Object.values(state$
|
|
4935
|
+
const providers = Object.values(state$8.providers);
|
|
4915
4936
|
const statusBarItems = [];
|
|
4916
4937
|
for (const provider of providers) {
|
|
4917
4938
|
// @ts-ignore
|
|
@@ -5297,7 +5318,7 @@ const getIconThemeJson$1 = async iconThemeId => {
|
|
|
5297
5318
|
extensionPath: `${assetDir}/extensions/builtin.${iconThemeId}`
|
|
5298
5319
|
};
|
|
5299
5320
|
}
|
|
5300
|
-
for (const webExtension of state$
|
|
5321
|
+
for (const webExtension of state$9.webExtensions) {
|
|
5301
5322
|
if (webExtension.iconThemes) {
|
|
5302
5323
|
for (const iconTheme of webExtension.iconThemes) {
|
|
5303
5324
|
// TODO handle error when icon theme path is not of type string
|
|
@@ -5347,7 +5368,7 @@ const emptyStatus = {
|
|
|
5347
5368
|
importTime: 0
|
|
5348
5369
|
};
|
|
5349
5370
|
const getRuntimeStatus = extensionId => {
|
|
5350
|
-
return get$
|
|
5371
|
+
return get$5(extensionId) || emptyStatus;
|
|
5351
5372
|
};
|
|
5352
5373
|
|
|
5353
5374
|
const getWebViewInfo2 = providerId => {
|
|
@@ -5401,7 +5422,7 @@ const handleMessagePort2 = async (port, rpcId) => {
|
|
|
5401
5422
|
commandMap: {}
|
|
5402
5423
|
});
|
|
5403
5424
|
if (rpcId) {
|
|
5404
|
-
set$
|
|
5425
|
+
set$c(rpcId, rpc);
|
|
5405
5426
|
}
|
|
5406
5427
|
};
|
|
5407
5428
|
|
|
@@ -5411,12 +5432,12 @@ const handleMessagePort = async (port, rpcId) => {
|
|
|
5411
5432
|
commandMap: {}
|
|
5412
5433
|
});
|
|
5413
5434
|
if (rpcId) {
|
|
5414
|
-
set$
|
|
5435
|
+
set$c(rpcId, rpc);
|
|
5415
5436
|
}
|
|
5416
5437
|
};
|
|
5417
5438
|
|
|
5418
5439
|
const handleIconThemeChange = async () => {
|
|
5419
|
-
await invoke$
|
|
5440
|
+
await invoke$1('IconTheme.handleIconThemeChange');
|
|
5420
5441
|
};
|
|
5421
5442
|
|
|
5422
5443
|
const initialIconTheme = undefined;
|
|
@@ -5460,7 +5481,7 @@ const importExtension = async (extensionId, absolutePath, activationEvent) => {
|
|
|
5460
5481
|
try {
|
|
5461
5482
|
string(absolutePath);
|
|
5462
5483
|
const startTime = performance.now();
|
|
5463
|
-
set$
|
|
5484
|
+
set$4({
|
|
5464
5485
|
activationEvent: activationEvent,
|
|
5465
5486
|
id: extensionId,
|
|
5466
5487
|
activationStartTime: performance.now(),
|
|
@@ -5475,7 +5496,7 @@ const importExtension = async (extensionId, absolutePath, activationEvent) => {
|
|
|
5475
5496
|
const module = await importScript(absolutePath);
|
|
5476
5497
|
const endTime = performance.now();
|
|
5477
5498
|
const time = endTime - startTime;
|
|
5478
|
-
set$
|
|
5499
|
+
set$5(extensionId, module);
|
|
5479
5500
|
update(extensionId, {
|
|
5480
5501
|
importEndTime: endTime,
|
|
5481
5502
|
importTime: time
|
|
@@ -6010,7 +6031,7 @@ const textSearch2 = async (scheme, root, query, options, assetDir) => {
|
|
|
6010
6031
|
}
|
|
6011
6032
|
}
|
|
6012
6033
|
return {
|
|
6013
|
-
results: allResults,
|
|
6034
|
+
results: options.limit ? allResults.slice(0, options.limit) : allResults,
|
|
6014
6035
|
limitHit: allResults.length > options.limit
|
|
6015
6036
|
};
|
|
6016
6037
|
};
|
|
@@ -6023,7 +6044,6 @@ const unregisterInterceptor = async id => {
|
|
|
6023
6044
|
};
|
|
6024
6045
|
|
|
6025
6046
|
const commandMap = {
|
|
6026
|
-
'Extensions.invalidateExtensionsCache': invalidateExtensionsCache,
|
|
6027
6047
|
'BulkReplacement.applyBulkReplacement': applyBulkReplacement,
|
|
6028
6048
|
'ColorTheme.getColorThemeCssFromJson': getColorThemeCssFromJson,
|
|
6029
6049
|
'ColorTheme.getColorThemeJson': getColorThemeJson,
|
|
@@ -6053,6 +6073,7 @@ const commandMap = {
|
|
|
6053
6073
|
'ExtensionHostDebug.stepOver': stepOver,
|
|
6054
6074
|
'ExtensionHostRename.executeprepareRenameProvider': executeprepareRenameProvider,
|
|
6055
6075
|
'ExtensionHostRename.executeRenameProvider': executeRenameProvider,
|
|
6076
|
+
'ExtensionHostSourceControl.getIconDefinitions': getIconDefinitions,
|
|
6056
6077
|
'ExtensionHostWebView.create': createWebView,
|
|
6057
6078
|
'ExtensionHostWebView.dispose': disposeWebView,
|
|
6058
6079
|
'ExtensionHostWebView.getWebViewInfo': getWebViewInfo,
|
|
@@ -6061,6 +6082,7 @@ const commandMap = {
|
|
|
6061
6082
|
'Extensions.addWebExtension': addWebExtension,
|
|
6062
6083
|
'Extensions.getExtension': getExtension,
|
|
6063
6084
|
'Extensions.getExtensions': getExtensions,
|
|
6085
|
+
'Extensions.invalidateExtensionsCache': invalidateExtensionsCache,
|
|
6064
6086
|
'FileSystemFetch.chmod': chmod$1,
|
|
6065
6087
|
'FileSystemFetch.getBlob': getBlob$1,
|
|
6066
6088
|
'FileSystemFetch.mkdir': mkdir$1,
|
|
@@ -6069,8 +6091,8 @@ const commandMap = {
|
|
|
6069
6091
|
'FileSystemFetch.remove': remove$2,
|
|
6070
6092
|
'FileSystemFetch.writeFile': writeFile$1,
|
|
6071
6093
|
'FileSystemMemory.chmod': chmod,
|
|
6072
|
-
'FileSystemMemory.exists': exists,
|
|
6073
6094
|
'FileSystemMemory.copy': copy,
|
|
6095
|
+
'FileSystemMemory.exists': exists,
|
|
6074
6096
|
'FileSystemMemory.getBlob': getBlob,
|
|
6075
6097
|
'FileSystemMemory.getBlobUrl': getBlobUrl,
|
|
6076
6098
|
'FileSystemMemory.getFiles': getFiles,
|
|
@@ -6125,7 +6147,7 @@ const commandMap = {
|
|
|
6125
6147
|
[FileSystemReadFile]: readFile$2,
|
|
6126
6148
|
[FileSystemRename]: rename$1,
|
|
6127
6149
|
[FileSystemWriteFile]: writeFile$3,
|
|
6128
|
-
[FileSystemRemove]: remove$
|
|
6150
|
+
[FileSystemRemove]: remove$3,
|
|
6129
6151
|
[FormattingExecuteFormmattingProvider]: executeFormattingProvider,
|
|
6130
6152
|
[HoverExecute]: executeHoverProvider,
|
|
6131
6153
|
[ImplementationExecuteImplementationProvider]: executeImplementationProvider,
|
|
@@ -6158,7 +6180,7 @@ const listen = async () => {
|
|
|
6158
6180
|
const rpc = await WebWorkerRpcClient.create({
|
|
6159
6181
|
commandMap: commandMap
|
|
6160
6182
|
});
|
|
6161
|
-
set$
|
|
6183
|
+
set$c(RendererWorker, rpc);
|
|
6162
6184
|
};
|
|
6163
6185
|
|
|
6164
6186
|
const main = async () => {
|