@lvce-editor/extension-host-worker 5.28.0 → 5.30.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 +1083 -1047
- 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,14 +1517,14 @@ 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 => {
|
|
@@ -2114,10 +1697,10 @@ const send$1 = (transport, method, ...params) => {
|
|
|
2114
1697
|
const message = create$4$2(method, params);
|
|
2115
1698
|
transport.send(message);
|
|
2116
1699
|
};
|
|
2117
|
-
const invoke$
|
|
1700
|
+
const invoke$3 = (ipc, method, ...params) => {
|
|
2118
1701
|
return invokeHelper(ipc, method, params, false);
|
|
2119
1702
|
};
|
|
2120
|
-
const invokeAndTransfer$
|
|
1703
|
+
const invokeAndTransfer$2 = (ipc, method, ...params) => {
|
|
2121
1704
|
return invokeHelper(ipc, method, params, true);
|
|
2122
1705
|
};
|
|
2123
1706
|
|
|
@@ -2153,10 +1736,10 @@ const createRpc$1 = ipc => {
|
|
|
2153
1736
|
send$1(ipc, method, ...params);
|
|
2154
1737
|
},
|
|
2155
1738
|
invoke(method, ...params) {
|
|
2156
|
-
return invoke$
|
|
1739
|
+
return invoke$3(ipc, method, ...params);
|
|
2157
1740
|
},
|
|
2158
1741
|
invokeAndTransfer(method, ...params) {
|
|
2159
|
-
return invokeAndTransfer$
|
|
1742
|
+
return invokeAndTransfer$2(ipc, method, ...params);
|
|
2160
1743
|
},
|
|
2161
1744
|
async dispose() {
|
|
2162
1745
|
await ipc?.dispose();
|
|
@@ -2306,11 +1889,437 @@ const create$7 = async ({
|
|
|
2306
1889
|
const rpc = createRpc$1(ipc);
|
|
2307
1890
|
return rpc;
|
|
2308
1891
|
};
|
|
2309
|
-
const WebWorkerRpcClient = {
|
|
2310
|
-
__proto__: null,
|
|
2311
|
-
create: create$7
|
|
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');
|
|
1973
|
+
}
|
|
1974
|
+
};
|
|
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
|
+
}
|
|
1982
|
+
};
|
|
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');
|
|
1992
|
+
}
|
|
1993
|
+
};
|
|
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');
|
|
2000
|
+
}
|
|
2001
|
+
};
|
|
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
|
+
}
|
|
2009
|
+
};
|
|
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
|
+
}
|
|
2017
|
+
};
|
|
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
|
+
}
|
|
2025
|
+
};
|
|
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
|
+
}
|
|
2033
|
+
};
|
|
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
|
+
}
|
|
2041
|
+
};
|
|
2042
|
+
const stepOver = async protocol => {
|
|
2043
|
+
try {
|
|
2044
|
+
const provider = getDebugProvider(protocol);
|
|
2045
|
+
return await provider.stepOver();
|
|
2046
|
+
} catch (error) {
|
|
2047
|
+
throw new VError(error, 'Failed to execute debug provider');
|
|
2048
|
+
}
|
|
2049
|
+
};
|
|
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
|
+
}
|
|
2057
|
+
};
|
|
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
|
+
}
|
|
2065
|
+
};
|
|
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
|
+
}
|
|
2073
|
+
};
|
|
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');
|
|
2080
|
+
}
|
|
2081
|
+
};
|
|
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
|
|
2099
|
+
}
|
|
2100
|
+
}
|
|
2101
|
+
}
|
|
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
|
+
}
|
|
2114
|
+
}
|
|
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);
|
|
2122
|
+
};
|
|
2123
|
+
const invokeAndTransfer$1 = (method, ...params) => {
|
|
2124
|
+
const rpc = get$b(RendererWorker);
|
|
2125
|
+
return rpc.invokeAndTransfer(method, ...params);
|
|
2126
|
+
};
|
|
2127
|
+
|
|
2128
|
+
const showInformationMessage = message => {
|
|
2129
|
+
string(message);
|
|
2130
|
+
const result = invoke$1('ExtensionHostDialog.showInformationMessage', message);
|
|
2131
|
+
return result;
|
|
2132
|
+
};
|
|
2133
|
+
|
|
2134
|
+
const env = {};
|
|
2135
|
+
|
|
2136
|
+
const exec = async (command, args, options) => {
|
|
2137
|
+
throw new DepecratedError(`vscode.exec is deprecated, use createNodeRpc instead`);
|
|
2138
|
+
};
|
|
2139
|
+
|
|
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`);
|
|
2146
|
+
}
|
|
2147
|
+
return provider;
|
|
2148
|
+
};
|
|
2149
|
+
const set$9 = (id, provider) => {
|
|
2150
|
+
if (!id) {
|
|
2151
|
+
throw new Error('Failed to register file system provider: missing id');
|
|
2152
|
+
}
|
|
2153
|
+
fileSystemProviderMap[id] = provider;
|
|
2154
|
+
};
|
|
2155
|
+
|
|
2156
|
+
const registerFileSystemProvider = fileSystemProvider => {
|
|
2157
|
+
if (!fileSystemProvider.id) {
|
|
2158
|
+
throw new Error('Failed to register file system provider: missing id');
|
|
2159
|
+
}
|
|
2160
|
+
set$9(fileSystemProvider.id, fileSystemProvider);
|
|
2161
|
+
};
|
|
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');
|
|
2168
|
+
}
|
|
2169
|
+
};
|
|
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
|
+
}
|
|
2177
|
+
};
|
|
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;
|
|
2187
|
+
};
|
|
2188
|
+
const existsExternal = async uri => {
|
|
2189
|
+
return await invoke$1('FileSystem.exists', uri);
|
|
2190
|
+
};
|
|
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;
|
|
2200
|
+
};
|
|
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
|
+
}
|
|
2208
|
+
};
|
|
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
|
+
}
|
|
2216
|
+
};
|
|
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
|
+
}
|
|
2224
|
+
};
|
|
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
|
+
}
|
|
2232
|
+
};
|
|
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
|
/**
|
|
@@ -2770,82 +2779,266 @@ const getOrCreateRpc = async (id, commandMap, execute) => {
|
|
|
2770
2779
|
if (!rpc) {
|
|
2771
2780
|
set$7(id, createRpcWithId$1(id, commandMap, execute));
|
|
2772
2781
|
}
|
|
2773
|
-
return get$7(id);
|
|
2782
|
+
return get$7(id);
|
|
2783
|
+
};
|
|
2784
|
+
const createRpcWithId = ({
|
|
2785
|
+
id,
|
|
2786
|
+
commandMap,
|
|
2787
|
+
execute
|
|
2788
|
+
}) => {
|
|
2789
|
+
string(id);
|
|
2790
|
+
register(id, commandMap);
|
|
2791
|
+
const lazyRpc = {
|
|
2792
|
+
async invoke(method, ...params) {
|
|
2793
|
+
const rpc = await getOrCreateRpc(id, commandMap, execute);
|
|
2794
|
+
return rpc.invoke(method, ...params);
|
|
2795
|
+
}
|
|
2796
|
+
};
|
|
2797
|
+
return lazyRpc;
|
|
2798
|
+
};
|
|
2799
|
+
|
|
2800
|
+
const createRpc = ({
|
|
2801
|
+
id,
|
|
2802
|
+
url,
|
|
2803
|
+
name,
|
|
2804
|
+
commandMap,
|
|
2805
|
+
contentSecurityPolicy,
|
|
2806
|
+
execute
|
|
2807
|
+
}) => {
|
|
2808
|
+
try {
|
|
2809
|
+
if (execute && !commandMap) {
|
|
2810
|
+
// eslint-disable-next-line no-console
|
|
2811
|
+
console.info(`[extension-host-worker] The rpc execute function is deprecated. Use the commandMap property instead.`);
|
|
2812
|
+
}
|
|
2813
|
+
commandMap ||= {};
|
|
2814
|
+
if (id) {
|
|
2815
|
+
string(id);
|
|
2816
|
+
return createRpcWithId({
|
|
2817
|
+
id,
|
|
2818
|
+
execute,
|
|
2819
|
+
commandMap
|
|
2820
|
+
});
|
|
2821
|
+
}
|
|
2822
|
+
return createLegacyRpc({
|
|
2823
|
+
url,
|
|
2824
|
+
name,
|
|
2825
|
+
execute,
|
|
2826
|
+
commandMap,
|
|
2827
|
+
contentSecurityPolicy
|
|
2828
|
+
});
|
|
2829
|
+
} catch (error) {
|
|
2830
|
+
throw new VError(error, `Failed to create webworker rpc`);
|
|
2831
|
+
}
|
|
2832
|
+
};
|
|
2833
|
+
|
|
2834
|
+
const {
|
|
2835
|
+
registerSelectionProvider,
|
|
2836
|
+
executeSelectionProvider} = create$b({
|
|
2837
|
+
name: 'Selection',
|
|
2838
|
+
resultShape: {
|
|
2839
|
+
allowUndefined: true,
|
|
2840
|
+
type: Array$1,
|
|
2841
|
+
items: {
|
|
2842
|
+
type: 'number'
|
|
2843
|
+
}
|
|
2844
|
+
}
|
|
2845
|
+
});
|
|
2846
|
+
|
|
2847
|
+
const RE_PROTOCOL = /^([a-z-]+):\/\//;
|
|
2848
|
+
const getProtocol = uri => {
|
|
2849
|
+
const protocolMatch = uri.match(RE_PROTOCOL);
|
|
2850
|
+
if (protocolMatch) {
|
|
2851
|
+
return protocolMatch[1];
|
|
2852
|
+
}
|
|
2853
|
+
return '';
|
|
2854
|
+
};
|
|
2855
|
+
|
|
2856
|
+
const createWebViewIpc = async webView => {
|
|
2857
|
+
const {
|
|
2858
|
+
uid,
|
|
2859
|
+
origin
|
|
2860
|
+
} = webView;
|
|
2861
|
+
const {
|
|
2862
|
+
port1,
|
|
2863
|
+
port2
|
|
2864
|
+
} = getPortTuple();
|
|
2865
|
+
const rpcPromise = MessagePortRpcParent.create({
|
|
2866
|
+
messagePort: port2,
|
|
2867
|
+
isMessagePortOpen: false,
|
|
2868
|
+
commandMap: {}
|
|
2869
|
+
});
|
|
2870
|
+
const portType = 'test';
|
|
2871
|
+
await invokeAndTransfer$1('WebView.setPort', uid, port1, origin, portType);
|
|
2872
|
+
// TODO maybe don't send a message port only to get object url?
|
|
2873
|
+
// TODO dispose rpc to avoid memory leak
|
|
2874
|
+
const rpc = await rpcPromise;
|
|
2875
|
+
return rpc;
|
|
2876
|
+
};
|
|
2877
|
+
|
|
2878
|
+
const webViews = Object.create(null);
|
|
2879
|
+
const webViewProviders = Object.create(null);
|
|
2880
|
+
const getProvider = providerId => {
|
|
2881
|
+
return webViewProviders[providerId];
|
|
2882
|
+
};
|
|
2883
|
+
const setProvider = (providerId, provider) => {
|
|
2884
|
+
webViewProviders[providerId] = provider;
|
|
2885
|
+
};
|
|
2886
|
+
const getWebView = id => {
|
|
2887
|
+
return webViews[id];
|
|
2888
|
+
};
|
|
2889
|
+
const setWebView = (id, webView) => {
|
|
2890
|
+
webViews[id] = webView;
|
|
2891
|
+
};
|
|
2892
|
+
const getWebViews$1 = () => {
|
|
2893
|
+
return webViews;
|
|
2894
|
+
};
|
|
2895
|
+
|
|
2896
|
+
// TODO if webViewId is provided,
|
|
2897
|
+
// 1. read file as blob
|
|
2898
|
+
// 2. send blob to webview
|
|
2899
|
+
// 3. create objecturl in webview
|
|
2900
|
+
// 4. send back objecturl to extension host worker
|
|
2901
|
+
// 5. provide objectUrl to extension
|
|
2902
|
+
|
|
2903
|
+
const getRemoteUrlForWebView = async (uri, options = {}) => {
|
|
2904
|
+
// TODO webviews should be stored in iframe worker
|
|
2905
|
+
const webView = getWebView(options.webViewId);
|
|
2906
|
+
if (!webView) {
|
|
2907
|
+
throw new Error(`webview ${options.webViewId} not found`);
|
|
2908
|
+
}
|
|
2909
|
+
const [rpc, blob] = await Promise.all([createWebViewIpc(webView), invoke$1('FileSystem.getBlob', uri)]);
|
|
2910
|
+
const objectUrl = await rpc.invoke('createObjectUrl', blob);
|
|
2911
|
+
return objectUrl;
|
|
2912
|
+
};
|
|
2913
|
+
|
|
2914
|
+
const isFileProtocol = protocol => {
|
|
2915
|
+
return !protocol || protocol === 'file';
|
|
2916
|
+
};
|
|
2917
|
+
const getRemoteUrlSync = uri => {
|
|
2918
|
+
const protocol = getProtocol(uri);
|
|
2919
|
+
const withoutPrefix = uri.startsWith('file://') ? uri.slice('file://'.length) : uri;
|
|
2920
|
+
if (platform === Remote && isFileProtocol(protocol)) {
|
|
2921
|
+
if (uri.startsWith('/')) {
|
|
2922
|
+
return `/remote${withoutPrefix}`;
|
|
2923
|
+
}
|
|
2924
|
+
return `/remote/${withoutPrefix}`;
|
|
2925
|
+
}
|
|
2926
|
+
if (platform === Electron && isFileProtocol(protocol)) {
|
|
2927
|
+
if (uri.startsWith('/')) {
|
|
2928
|
+
return `/remote${withoutPrefix}`;
|
|
2929
|
+
}
|
|
2930
|
+
return `/remote/${withoutPrefix}`;
|
|
2931
|
+
}
|
|
2932
|
+
return '';
|
|
2933
|
+
};
|
|
2934
|
+
const getRemoteUrl$1 = async (uri, options = {}) => {
|
|
2935
|
+
// TODO uri should always have protocol
|
|
2936
|
+
// then ask file system provider for remote url, for example disk file system provider or html file system provider
|
|
2937
|
+
const syncUrl = getRemoteUrlSync(uri);
|
|
2938
|
+
if (syncUrl) {
|
|
2939
|
+
return syncUrl;
|
|
2940
|
+
}
|
|
2941
|
+
if (options.webViewId) {
|
|
2942
|
+
return getRemoteUrlForWebView(uri, options);
|
|
2943
|
+
}
|
|
2944
|
+
if (uri.startsWith('html://')) {
|
|
2945
|
+
const url = await invoke$1('Blob.getSrc', uri);
|
|
2946
|
+
return url;
|
|
2947
|
+
}
|
|
2948
|
+
throw new Error(`unsupported platform for remote url`);
|
|
2949
|
+
};
|
|
2950
|
+
|
|
2951
|
+
const state$9 = {
|
|
2952
|
+
webExtensions: []
|
|
2953
|
+
};
|
|
2954
|
+
|
|
2955
|
+
const getJson = async url => {
|
|
2956
|
+
try {
|
|
2957
|
+
const response = await fetch(url);
|
|
2958
|
+
if (!response.ok) {
|
|
2959
|
+
throw new Error(response.statusText);
|
|
2960
|
+
}
|
|
2961
|
+
const json = await response.json();
|
|
2962
|
+
return json;
|
|
2963
|
+
} catch (error) {
|
|
2964
|
+
throw new VError(error, `Failed to get json`);
|
|
2965
|
+
}
|
|
2966
|
+
};
|
|
2967
|
+
|
|
2968
|
+
const getAssetDir = () => {
|
|
2969
|
+
// @ts-ignore
|
|
2970
|
+
if (typeof ASSET_DIR !== 'undefined') {
|
|
2971
|
+
// @ts-ignore
|
|
2972
|
+
return ASSET_DIR;
|
|
2973
|
+
}
|
|
2974
|
+
if (platform === Electron) {
|
|
2975
|
+
return '../../../../..';
|
|
2976
|
+
}
|
|
2977
|
+
return '';
|
|
2978
|
+
};
|
|
2979
|
+
const assetDir = getAssetDir();
|
|
2980
|
+
|
|
2981
|
+
const extensionsUrl = `${assetDir}/config/extensions.json`;
|
|
2982
|
+
|
|
2983
|
+
const getWebExtensions = async () => {
|
|
2984
|
+
return getJson(extensionsUrl);
|
|
2985
|
+
};
|
|
2986
|
+
|
|
2987
|
+
const getSharedProcessExtensions = () => {
|
|
2988
|
+
return invoke$1(/* ExtensionManagement.getExtensions */'ExtensionManagement.getExtensions');
|
|
2989
|
+
};
|
|
2990
|
+
const doGetExtensions = async () => {
|
|
2991
|
+
const meta = state$9.webExtensions;
|
|
2992
|
+
if (platform === Web) {
|
|
2993
|
+
const webExtensions = await getWebExtensions();
|
|
2994
|
+
return [...webExtensions, ...meta];
|
|
2995
|
+
}
|
|
2996
|
+
if (platform === Remote) {
|
|
2997
|
+
const sharedProcessExtensions = await getSharedProcessExtensions();
|
|
2998
|
+
return [...sharedProcessExtensions, ...meta];
|
|
2999
|
+
}
|
|
3000
|
+
const extensions = await getSharedProcessExtensions();
|
|
3001
|
+
return extensions;
|
|
2774
3002
|
};
|
|
2775
|
-
|
|
2776
|
-
|
|
2777
|
-
|
|
2778
|
-
execute
|
|
2779
|
-
}) => {
|
|
2780
|
-
string(id);
|
|
2781
|
-
register(id, commandMap);
|
|
2782
|
-
const lazyRpc = {
|
|
2783
|
-
async invoke(method, ...params) {
|
|
2784
|
-
const rpc = await getOrCreateRpc(id, commandMap, execute);
|
|
2785
|
-
return rpc.invoke(method, ...params);
|
|
2786
|
-
}
|
|
2787
|
-
};
|
|
2788
|
-
return lazyRpc;
|
|
3003
|
+
|
|
3004
|
+
const getExtensions$1 = async () => {
|
|
3005
|
+
return doGetExtensions();
|
|
2789
3006
|
};
|
|
2790
3007
|
|
|
2791
|
-
const
|
|
2792
|
-
|
|
2793
|
-
|
|
2794
|
-
|
|
2795
|
-
|
|
2796
|
-
|
|
2797
|
-
|
|
2798
|
-
}
|
|
2799
|
-
|
|
2800
|
-
|
|
2801
|
-
|
|
2802
|
-
|
|
2803
|
-
|
|
2804
|
-
commandMap ||= {};
|
|
2805
|
-
if (id) {
|
|
2806
|
-
string(id);
|
|
2807
|
-
return createRpcWithId({
|
|
2808
|
-
id,
|
|
2809
|
-
execute,
|
|
2810
|
-
commandMap
|
|
2811
|
-
});
|
|
2812
|
-
}
|
|
2813
|
-
return createLegacyRpc({
|
|
2814
|
-
url,
|
|
2815
|
-
name,
|
|
2816
|
-
execute,
|
|
2817
|
-
commandMap,
|
|
2818
|
-
contentSecurityPolicy
|
|
2819
|
-
});
|
|
2820
|
-
} catch (error) {
|
|
2821
|
-
throw new VError(error, `Failed to create webworker rpc`);
|
|
2822
|
-
}
|
|
3008
|
+
const cache = Object.create(null);
|
|
3009
|
+
const id = 1;
|
|
3010
|
+
const get$6 = () => {
|
|
3011
|
+
return cache[id];
|
|
3012
|
+
};
|
|
3013
|
+
const has = () => {
|
|
3014
|
+
return id in cache;
|
|
3015
|
+
};
|
|
3016
|
+
const set$6 = value => {
|
|
3017
|
+
cache[id] = value;
|
|
3018
|
+
};
|
|
3019
|
+
const clear = () => {
|
|
3020
|
+
delete cache[id];
|
|
2823
3021
|
};
|
|
2824
3022
|
|
|
2825
|
-
|
|
2826
|
-
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
resultShape: {
|
|
2830
|
-
allowUndefined: true,
|
|
2831
|
-
type: Array$1,
|
|
2832
|
-
items: {
|
|
2833
|
-
type: 'number'
|
|
2834
|
-
}
|
|
3023
|
+
// TODO getExtensions is still called 6 times on startup instead of 1
|
|
3024
|
+
const getExtensions = () => {
|
|
3025
|
+
if (!has()) {
|
|
3026
|
+
set$6(getExtensions$1());
|
|
2835
3027
|
}
|
|
2836
|
-
|
|
3028
|
+
return get$6();
|
|
3029
|
+
};
|
|
2837
3030
|
|
|
2838
|
-
const state$
|
|
3031
|
+
const state$8 = {
|
|
2839
3032
|
providers: Object.create(null)
|
|
2840
3033
|
};
|
|
2841
3034
|
const registerSourceControlProvider = provider => {
|
|
2842
|
-
state$
|
|
3035
|
+
state$8.providers[provider.id] = provider;
|
|
2843
3036
|
};
|
|
2844
3037
|
const getFilesFromProvider = provider => {
|
|
2845
3038
|
return provider.getChangedFiles();
|
|
2846
3039
|
};
|
|
2847
3040
|
const getChangedFiles = async providerId => {
|
|
2848
|
-
const provider = state$
|
|
3041
|
+
const provider = state$8.providers[providerId];
|
|
2849
3042
|
if (!provider) {
|
|
2850
3043
|
throw new Error('no source control provider found');
|
|
2851
3044
|
}
|
|
@@ -2856,7 +3049,7 @@ const getChangedFiles = async providerId => {
|
|
|
2856
3049
|
const getFileBefore = async (providerId, uri) => {
|
|
2857
3050
|
string(providerId);
|
|
2858
3051
|
string(uri);
|
|
2859
|
-
const provider = state$
|
|
3052
|
+
const provider = state$8.providers[providerId];
|
|
2860
3053
|
if (!provider) {
|
|
2861
3054
|
throw new Error('no source control provider found');
|
|
2862
3055
|
}
|
|
@@ -2878,7 +3071,7 @@ const getGroupsFromProvider = async (provider, cwd) => {
|
|
|
2878
3071
|
throw new Error('source control provider is missing required function getGroups');
|
|
2879
3072
|
};
|
|
2880
3073
|
const getGroups = async (providerId, cwd) => {
|
|
2881
|
-
const provider = state$
|
|
3074
|
+
const provider = state$8.providers[providerId];
|
|
2882
3075
|
if (!provider) {
|
|
2883
3076
|
throw new Error('no source control provider found');
|
|
2884
3077
|
}
|
|
@@ -2886,14 +3079,14 @@ const getGroups = async (providerId, cwd) => {
|
|
|
2886
3079
|
return groups;
|
|
2887
3080
|
};
|
|
2888
3081
|
const acceptInput = async (providerId, value) => {
|
|
2889
|
-
const provider = state$
|
|
3082
|
+
const provider = state$8.providers[providerId];
|
|
2890
3083
|
if (!provider) {
|
|
2891
3084
|
throw new Error('no source control provider found');
|
|
2892
3085
|
}
|
|
2893
3086
|
await provider.acceptInput(value);
|
|
2894
3087
|
};
|
|
2895
3088
|
const add = async path => {
|
|
2896
|
-
const provider = Object.values(state$
|
|
3089
|
+
const provider = Object.values(state$8.providers)[0];
|
|
2897
3090
|
if (!provider) {
|
|
2898
3091
|
return;
|
|
2899
3092
|
}
|
|
@@ -2901,7 +3094,7 @@ const add = async path => {
|
|
|
2901
3094
|
await provider.add(path);
|
|
2902
3095
|
};
|
|
2903
3096
|
const discard = async path => {
|
|
2904
|
-
const provider = Object.values(state$
|
|
3097
|
+
const provider = Object.values(state$8.providers)[0];
|
|
2905
3098
|
if (!provider) {
|
|
2906
3099
|
return;
|
|
2907
3100
|
}
|
|
@@ -2911,7 +3104,7 @@ const discard = async path => {
|
|
|
2911
3104
|
const getEnabledProviderIds = async (scheme, root) => {
|
|
2912
3105
|
string(scheme);
|
|
2913
3106
|
string(root);
|
|
2914
|
-
const providers = Object.values(state$
|
|
3107
|
+
const providers = Object.values(state$8.providers);
|
|
2915
3108
|
const enabledIds = [];
|
|
2916
3109
|
for (const provider of providers) {
|
|
2917
3110
|
// @ts-ignore
|
|
@@ -2927,6 +3120,21 @@ const getEnabledProviderIds = async (scheme, root) => {
|
|
|
2927
3120
|
}
|
|
2928
3121
|
return enabledIds;
|
|
2929
3122
|
};
|
|
3123
|
+
const getIconDefinitions = async providerId => {
|
|
3124
|
+
const extensions = await getExtensions();
|
|
3125
|
+
for (const extension of extensions) {
|
|
3126
|
+
const id = extension.id.split('.');
|
|
3127
|
+
const shortId = id[1];
|
|
3128
|
+
if (shortId === providerId && extension['source-control-icons'] && Array.isArray(extension['source-control-icons'])) {
|
|
3129
|
+
const baseIcons = extension['source-control-icons'];
|
|
3130
|
+
const absoluteUris = baseIcons.map(icon => `${extension.uri}/${icon}`);
|
|
3131
|
+
const remoteUris = absoluteUris.map(icon => getRemoteUrlSync(icon));
|
|
3132
|
+
return remoteUris;
|
|
3133
|
+
}
|
|
3134
|
+
}
|
|
3135
|
+
// TODO return warning that no icons were found?
|
|
3136
|
+
return [];
|
|
3137
|
+
};
|
|
2930
3138
|
|
|
2931
3139
|
const {
|
|
2932
3140
|
registerTabCompletionProvider,
|
|
@@ -2938,7 +3146,7 @@ const {
|
|
|
2938
3146
|
}
|
|
2939
3147
|
});
|
|
2940
3148
|
|
|
2941
|
-
const state$
|
|
3149
|
+
const state$7 = {
|
|
2942
3150
|
textSearchProviders: Object.create(null)
|
|
2943
3151
|
};
|
|
2944
3152
|
const registerTextSearchProvider = textSearchProvider => {
|
|
@@ -2949,14 +3157,14 @@ const registerTextSearchProvider = textSearchProvider => {
|
|
|
2949
3157
|
if (!textSearchProvider.scheme) {
|
|
2950
3158
|
throw new Error('textSearchProvider is missing scheme');
|
|
2951
3159
|
}
|
|
2952
|
-
state$
|
|
3160
|
+
state$7.textSearchProviders[textSearchProvider.scheme] = textSearchProvider;
|
|
2953
3161
|
} catch (error) {
|
|
2954
3162
|
throw new VError(error, 'Failed to register text search provider');
|
|
2955
3163
|
}
|
|
2956
3164
|
};
|
|
2957
3165
|
const executeTextSearchProvider = async (scheme, query) => {
|
|
2958
3166
|
try {
|
|
2959
|
-
const textSearchProvider = state$
|
|
3167
|
+
const textSearchProvider = state$7.textSearchProviders[scheme];
|
|
2960
3168
|
if (!textSearchProvider) {
|
|
2961
3169
|
throw new Error(`No text search provider for ${scheme} found`);
|
|
2962
3170
|
}
|
|
@@ -2988,99 +3196,6 @@ const {
|
|
|
2988
3196
|
}
|
|
2989
3197
|
});
|
|
2990
3198
|
|
|
2991
|
-
const RE_PROTOCOL = /^([a-z-]+):\/\//;
|
|
2992
|
-
const getProtocol = uri => {
|
|
2993
|
-
const protocolMatch = uri.match(RE_PROTOCOL);
|
|
2994
|
-
if (protocolMatch) {
|
|
2995
|
-
return protocolMatch[1];
|
|
2996
|
-
}
|
|
2997
|
-
return '';
|
|
2998
|
-
};
|
|
2999
|
-
|
|
3000
|
-
const createWebViewIpc = async webView => {
|
|
3001
|
-
const {
|
|
3002
|
-
uid,
|
|
3003
|
-
origin
|
|
3004
|
-
} = webView;
|
|
3005
|
-
const {
|
|
3006
|
-
port1,
|
|
3007
|
-
port2
|
|
3008
|
-
} = getPortTuple();
|
|
3009
|
-
const rpcPromise = MessagePortRpcParent.create({
|
|
3010
|
-
messagePort: port2,
|
|
3011
|
-
isMessagePortOpen: false,
|
|
3012
|
-
commandMap: {}
|
|
3013
|
-
});
|
|
3014
|
-
const portType = 'test';
|
|
3015
|
-
await invokeAndTransfer$2('WebView.setPort', uid, port1, origin, portType);
|
|
3016
|
-
// TODO maybe don't send a message port only to get object url?
|
|
3017
|
-
// TODO dispose rpc to avoid memory leak
|
|
3018
|
-
const rpc = await rpcPromise;
|
|
3019
|
-
return rpc;
|
|
3020
|
-
};
|
|
3021
|
-
|
|
3022
|
-
const webViews = Object.create(null);
|
|
3023
|
-
const webViewProviders = Object.create(null);
|
|
3024
|
-
const getProvider = providerId => {
|
|
3025
|
-
return webViewProviders[providerId];
|
|
3026
|
-
};
|
|
3027
|
-
const setProvider = (providerId, provider) => {
|
|
3028
|
-
webViewProviders[providerId] = provider;
|
|
3029
|
-
};
|
|
3030
|
-
const getWebView = id => {
|
|
3031
|
-
return webViews[id];
|
|
3032
|
-
};
|
|
3033
|
-
const setWebView = (id, webView) => {
|
|
3034
|
-
webViews[id] = webView;
|
|
3035
|
-
};
|
|
3036
|
-
const getWebViews$1 = () => {
|
|
3037
|
-
return webViews;
|
|
3038
|
-
};
|
|
3039
|
-
|
|
3040
|
-
// TODO if webViewId is provided,
|
|
3041
|
-
// 1. read file as blob
|
|
3042
|
-
// 2. send blob to webview
|
|
3043
|
-
// 3. create objecturl in webview
|
|
3044
|
-
// 4. send back objecturl to extension host worker
|
|
3045
|
-
// 5. provide objectUrl to extension
|
|
3046
|
-
|
|
3047
|
-
const getRemoteUrlForWebView = async (uri, options = {}) => {
|
|
3048
|
-
// TODO webviews should be stored in iframe worker
|
|
3049
|
-
const webView = getWebView(options.webViewId);
|
|
3050
|
-
if (!webView) {
|
|
3051
|
-
throw new Error(`webview ${options.webViewId} not found`);
|
|
3052
|
-
}
|
|
3053
|
-
const [rpc, blob] = await Promise.all([createWebViewIpc(webView), invoke$2('FileSystem.getBlob', uri)]);
|
|
3054
|
-
const objectUrl = await rpc.invoke('createObjectUrl', blob);
|
|
3055
|
-
return objectUrl;
|
|
3056
|
-
};
|
|
3057
|
-
|
|
3058
|
-
const getRemoteUrl$1 = async (uri, options = {}) => {
|
|
3059
|
-
// TODO uri should always have protocol
|
|
3060
|
-
// then ask file system provider for remote url, for example disk file system provider or html file system provider
|
|
3061
|
-
const protocol = getProtocol(uri);
|
|
3062
|
-
if (platform === Remote && !protocol) {
|
|
3063
|
-
if (uri.startsWith('/')) {
|
|
3064
|
-
return `/remote${uri}`;
|
|
3065
|
-
}
|
|
3066
|
-
return `/remote/${uri}`;
|
|
3067
|
-
}
|
|
3068
|
-
if (platform === Electron && !protocol) {
|
|
3069
|
-
if (uri.startsWith('/')) {
|
|
3070
|
-
return `/remote${uri}`;
|
|
3071
|
-
}
|
|
3072
|
-
return `/remote/${uri}`;
|
|
3073
|
-
}
|
|
3074
|
-
if (options.webViewId) {
|
|
3075
|
-
return getRemoteUrlForWebView(uri, options);
|
|
3076
|
-
}
|
|
3077
|
-
if (uri.startsWith('html://')) {
|
|
3078
|
-
const url = await invoke$2('Blob.getSrc', uri);
|
|
3079
|
-
return url;
|
|
3080
|
-
}
|
|
3081
|
-
throw new Error(`unsupported platform for remote url`);
|
|
3082
|
-
};
|
|
3083
|
-
|
|
3084
3199
|
// TODO pass uuid to allow having multiple webviews open at the same time
|
|
3085
3200
|
|
|
3086
3201
|
/**
|
|
@@ -3156,14 +3271,14 @@ const createWorker = async ({
|
|
|
3156
3271
|
return rpc;
|
|
3157
3272
|
};
|
|
3158
3273
|
|
|
3159
|
-
const state$
|
|
3274
|
+
const state$6 = {
|
|
3160
3275
|
workspacePath: ''
|
|
3161
3276
|
};
|
|
3162
3277
|
const setWorkspacePath = path => {
|
|
3163
|
-
state$
|
|
3278
|
+
state$6.workspacePath = path;
|
|
3164
3279
|
};
|
|
3165
3280
|
const getWorkspaceFolder = path => {
|
|
3166
|
-
return state$
|
|
3281
|
+
return state$6.workspacePath;
|
|
3167
3282
|
};
|
|
3168
3283
|
|
|
3169
3284
|
class FormattingError extends Error {
|
|
@@ -3319,17 +3434,17 @@ const handleUnhandledRejection = event => {
|
|
|
3319
3434
|
console.error(output);
|
|
3320
3435
|
};
|
|
3321
3436
|
|
|
3322
|
-
const state$
|
|
3437
|
+
const state$5 = {
|
|
3323
3438
|
errors: []
|
|
3324
3439
|
};
|
|
3325
3440
|
const addError = error => {
|
|
3326
|
-
state$
|
|
3441
|
+
state$5.errors = [...state$5.errors, error];
|
|
3327
3442
|
};
|
|
3328
3443
|
const hasRecentErrors = () => {
|
|
3329
|
-
return state$
|
|
3444
|
+
return state$5.errors.length > 0;
|
|
3330
3445
|
};
|
|
3331
3446
|
const getRecentError = () => {
|
|
3332
|
-
state$
|
|
3447
|
+
state$5.errors.at(-1);
|
|
3333
3448
|
};
|
|
3334
3449
|
|
|
3335
3450
|
const handleContentSecurityPolicyViolation = event => {
|
|
@@ -3380,7 +3495,7 @@ const isCanceled = token => {
|
|
|
3380
3495
|
};
|
|
3381
3496
|
|
|
3382
3497
|
const modules = Object.create(null);
|
|
3383
|
-
const set$
|
|
3498
|
+
const set$5 = (extensionId, module) => {
|
|
3384
3499
|
modules[extensionId] = module;
|
|
3385
3500
|
};
|
|
3386
3501
|
const acquire = extensionId => {
|
|
@@ -3420,10 +3535,10 @@ const isImportError = error => {
|
|
|
3420
3535
|
};
|
|
3421
3536
|
|
|
3422
3537
|
const states = Object.create(null);
|
|
3423
|
-
const set$
|
|
3538
|
+
const set$4 = status => {
|
|
3424
3539
|
states[status.id] = status;
|
|
3425
3540
|
};
|
|
3426
|
-
const get$
|
|
3541
|
+
const get$5 = extensionId => {
|
|
3427
3542
|
return states[extensionId];
|
|
3428
3543
|
};
|
|
3429
3544
|
const update = (id, update) => {
|
|
@@ -3474,19 +3589,6 @@ class BabelParseError extends SyntaxError {
|
|
|
3474
3589
|
}
|
|
3475
3590
|
}
|
|
3476
3591
|
|
|
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
3592
|
const loadBabelParser = () => {
|
|
3491
3593
|
const url = `${assetDir}/js/babel-parser.js`;
|
|
3492
3594
|
return import(url);
|
|
@@ -3888,7 +3990,7 @@ const activateExtension = async (extension, absolutePath, activationEvent) => {
|
|
|
3888
3990
|
string(extension.browser);
|
|
3889
3991
|
string(absolutePath);
|
|
3890
3992
|
const startTime = performance.now();
|
|
3891
|
-
set$
|
|
3993
|
+
set$4({
|
|
3892
3994
|
activationEndTime: 0,
|
|
3893
3995
|
activationEvent: activationEvent,
|
|
3894
3996
|
activationStartTime: startTime,
|
|
@@ -3932,38 +4034,6 @@ const activateExtension = async (extension, absolutePath, activationEvent) => {
|
|
|
3932
4034
|
// console.info('activated', path)
|
|
3933
4035
|
};
|
|
3934
4036
|
|
|
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
4037
|
const NewLine = '\n';
|
|
3968
4038
|
const Slash$1 = '/';
|
|
3969
4039
|
|
|
@@ -3995,7 +4065,7 @@ const addWebExtension = async path => {
|
|
|
3995
4065
|
const manifestPath = getWebManifestPath(path);
|
|
3996
4066
|
const manifest = await getWebExtensionManifest(path, manifestPath);
|
|
3997
4067
|
// TODO avoid mutation if possible
|
|
3998
|
-
state$
|
|
4068
|
+
state$9.webExtensions.push(manifest);
|
|
3999
4069
|
clear();
|
|
4000
4070
|
return manifest;
|
|
4001
4071
|
};
|
|
@@ -4011,7 +4081,7 @@ const applyBulkReplacement = async (files, ranges, replacement) => {
|
|
|
4011
4081
|
};
|
|
4012
4082
|
|
|
4013
4083
|
const addCssStyleSheet = (id, css) => {
|
|
4014
|
-
return invoke$
|
|
4084
|
+
return invoke$1('Css.addCssStyleSheet', id, css);
|
|
4015
4085
|
};
|
|
4016
4086
|
|
|
4017
4087
|
const warn = (...args) => {
|
|
@@ -4446,10 +4516,10 @@ const GetColorThemeCssCachedIndexedDb = {
|
|
|
4446
4516
|
};
|
|
4447
4517
|
|
|
4448
4518
|
const getText$1 = key => {
|
|
4449
|
-
return invoke$
|
|
4519
|
+
return invoke$1('LocalStorage.getText', key);
|
|
4450
4520
|
};
|
|
4451
4521
|
const setText = (key, value) => {
|
|
4452
|
-
return invoke$
|
|
4522
|
+
return invoke$1('LocalStorage.setText', key, value);
|
|
4453
4523
|
};
|
|
4454
4524
|
|
|
4455
4525
|
const getCacheKey = colorThemeId => {
|
|
@@ -4484,7 +4554,7 @@ const GetColorThemeCssCachedNoop = {
|
|
|
4484
4554
|
};
|
|
4485
4555
|
|
|
4486
4556
|
const get = key => {
|
|
4487
|
-
return invoke$
|
|
4557
|
+
return invoke$1('Preferences.get', key);
|
|
4488
4558
|
};
|
|
4489
4559
|
|
|
4490
4560
|
const getCacheFn = config => {
|
|
@@ -4510,7 +4580,7 @@ const getColorThemeCssCached = async (colorThemeId, getData) => {
|
|
|
4510
4580
|
};
|
|
4511
4581
|
|
|
4512
4582
|
const readJson = url => {
|
|
4513
|
-
return invoke$
|
|
4583
|
+
return invoke$1('FileSystem.readJson', url);
|
|
4514
4584
|
};
|
|
4515
4585
|
|
|
4516
4586
|
const dirname = (pathSeparator, path) => {
|
|
@@ -4547,41 +4617,6 @@ const getColorThemeUri = (extensions, colorThemeId) => {
|
|
|
4547
4617
|
return '';
|
|
4548
4618
|
};
|
|
4549
4619
|
|
|
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
4620
|
const getColorThemeJson$2 = async colorThemeId => {
|
|
4586
4621
|
const extensions = await getExtensions();
|
|
4587
4622
|
const colorThemeUri = getColorThemeUri(extensions, colorThemeId);
|
|
@@ -4624,7 +4659,7 @@ const getMetaThemeColor = colorThemeJson => {
|
|
|
4624
4659
|
};
|
|
4625
4660
|
|
|
4626
4661
|
const setThemeColor = async themeColor => {
|
|
4627
|
-
await invoke$
|
|
4662
|
+
await invoke$1(/* Meta.setThemeColor */'Meta.setThemeColor', /* color */themeColor);
|
|
4628
4663
|
};
|
|
4629
4664
|
|
|
4630
4665
|
// TODO by default color theme should come from local storage, session storage, cache storage, indexeddb or blob url -> fast initial load
|
|
@@ -4660,7 +4695,7 @@ const watch = async id => {
|
|
|
4660
4695
|
return;
|
|
4661
4696
|
}
|
|
4662
4697
|
state$2.watchedTheme = id;
|
|
4663
|
-
await invoke$
|
|
4698
|
+
await invoke$1('ExtensionHost.watchColorTheme', id);
|
|
4664
4699
|
};
|
|
4665
4700
|
const getPreferredColorTheme = () => {
|
|
4666
4701
|
const preferredColorTheme = get('workbench.colorTheme');
|
|
@@ -4702,20 +4737,20 @@ const create = () => {
|
|
|
4702
4737
|
};
|
|
4703
4738
|
|
|
4704
4739
|
const iframeWorkerCommandMap = {
|
|
4705
|
-
'WebView.compatExtensionHostWorkerInvoke': (...args) => invoke$
|
|
4706
|
-
'WebView.compatExtensionHostWorkerInvokeAndTransfer': (...args) => invokeAndTransfer$
|
|
4707
|
-
'WebView.compatRendererProcessInvoke': (...args) => invoke$
|
|
4708
|
-
'WebView.compatRendererProcessInvokeAndTransfer': (...args) => invokeAndTransfer$
|
|
4740
|
+
'WebView.compatExtensionHostWorkerInvoke': (...args) => invoke$1('WebView.compatExtensionHostWorkerInvoke', ...args),
|
|
4741
|
+
'WebView.compatExtensionHostWorkerInvokeAndTransfer': (...args) => invokeAndTransfer$1('WebView.compatExtensionHostWorkerInvokeAndTransfer', ...args),
|
|
4742
|
+
'WebView.compatRendererProcessInvoke': (...args) => invoke$1('WebView.compatRendererProcessInvoke', ...args),
|
|
4743
|
+
'WebView.compatRendererProcessInvokeAndTransfer': (...args) => invokeAndTransfer$1('WebView.compatRendererProcessInvokeAndTransfer', ...args),
|
|
4709
4744
|
// @ts-ignore
|
|
4710
|
-
'WebView.compatRendererWorkerInvokeAndTransfer': (...args) => invokeAndTransfer$
|
|
4745
|
+
'WebView.compatRendererWorkerInvokeAndTransfer': (...args) => invokeAndTransfer$1(...args),
|
|
4711
4746
|
// @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$
|
|
4747
|
+
'WebView.compatRendererWorkerInvoke': (...args) => invoke$1(...args),
|
|
4748
|
+
'WebView.compatSharedProcessInvoke': (...args) => invoke$1('WebView.compatSharedProcessInvoke', ...args),
|
|
4749
|
+
'WebView.getSavedState': (...args) => invoke$1('WebView.getSavedState', ...args),
|
|
4750
|
+
'WebView.getWebViewInfo': (...args) => invoke$1('WebView.getWebViewInfo', ...args),
|
|
4751
|
+
'WebView.getWebViews': (...args) => invoke$1('WebView.getWebViews', ...args),
|
|
4752
|
+
'WebView.setPort': (...args) => invoke$1('WebView.setPort', ...args),
|
|
4753
|
+
'ExtensionHostManagement.activateByEvent': (...args) => invoke$1('ExtensionHostManagement.activateByEvent', ...args),
|
|
4719
4754
|
'WebView.getRemoteUrl': options => getRemoteUrlForWebView(options.uri, options)
|
|
4720
4755
|
};
|
|
4721
4756
|
|
|
@@ -4781,7 +4816,7 @@ const createWebViewWorkerRpc2 = async (rpcInfo, port) => {
|
|
|
4781
4816
|
|
|
4782
4817
|
// TODO have a way so that the worker already includes the webview api and the extension
|
|
4783
4818
|
// host subworker doesn't need to import the other file
|
|
4784
|
-
await invokeAndTransfer$
|
|
4819
|
+
await invokeAndTransfer$1('IpcParent.create', {
|
|
4785
4820
|
method: ModuleWorkerAndWorkaroundForChromeDevtoolsBug,
|
|
4786
4821
|
url: rpcInfo.url,
|
|
4787
4822
|
name: rpcInfo.name,
|
|
@@ -4802,7 +4837,7 @@ const createWebViewWorkerRpc = async (rpcInfo, port) => {
|
|
|
4802
4837
|
|
|
4803
4838
|
// TODO have a way so that the worker already includes the webview api and the extension
|
|
4804
4839
|
// host subworker doesn't need to import the other file
|
|
4805
|
-
await invokeAndTransfer$
|
|
4840
|
+
await invokeAndTransfer$1('IpcParent.create', {
|
|
4806
4841
|
method: ModuleWorkerAndWorkaroundForChromeDevtoolsBug,
|
|
4807
4842
|
url: extensionHostSubWorkerUrl,
|
|
4808
4843
|
name: rpcInfo.name,
|
|
@@ -4812,7 +4847,7 @@ const createWebViewWorkerRpc = async (rpcInfo, port) => {
|
|
|
4812
4847
|
};
|
|
4813
4848
|
|
|
4814
4849
|
const executeExternalCommand = (method, ...params) => {
|
|
4815
|
-
return invoke$
|
|
4850
|
+
return invoke$1(method, ...params);
|
|
4816
4851
|
};
|
|
4817
4852
|
|
|
4818
4853
|
const BraceCompletionExecuteBraceCompletionProvider = 'ExtensionHostBraceCompletion.executeBraceCompletionProvider';
|
|
@@ -4874,7 +4909,7 @@ const mockExec = () => {
|
|
|
4874
4909
|
try {
|
|
4875
4910
|
// @ts-ignore
|
|
4876
4911
|
api.exec = async (command, args, options) => {
|
|
4877
|
-
const result = await invoke$
|
|
4912
|
+
const result = await invoke$1('Test.executeMockExecFunction', command, args, options);
|
|
4878
4913
|
const {
|
|
4879
4914
|
stdout,
|
|
4880
4915
|
stderr,
|
|
@@ -4900,7 +4935,7 @@ const mockRpc = () => {
|
|
|
4900
4935
|
try {
|
|
4901
4936
|
return {
|
|
4902
4937
|
async invoke(method, ...params) {
|
|
4903
|
-
const result = await invoke$
|
|
4938
|
+
const result = await invoke$1('Test.executeMockRpcFunction', options.name, method, ...params);
|
|
4904
4939
|
return result;
|
|
4905
4940
|
}
|
|
4906
4941
|
};
|
|
@@ -4911,7 +4946,7 @@ const mockRpc = () => {
|
|
|
4911
4946
|
};
|
|
4912
4947
|
|
|
4913
4948
|
const getStatusBarItems = async () => {
|
|
4914
|
-
const providers = Object.values(state$
|
|
4949
|
+
const providers = Object.values(state$8.providers);
|
|
4915
4950
|
const statusBarItems = [];
|
|
4916
4951
|
for (const provider of providers) {
|
|
4917
4952
|
// @ts-ignore
|
|
@@ -5297,7 +5332,7 @@ const getIconThemeJson$1 = async iconThemeId => {
|
|
|
5297
5332
|
extensionPath: `${assetDir}/extensions/builtin.${iconThemeId}`
|
|
5298
5333
|
};
|
|
5299
5334
|
}
|
|
5300
|
-
for (const webExtension of state$
|
|
5335
|
+
for (const webExtension of state$9.webExtensions) {
|
|
5301
5336
|
if (webExtension.iconThemes) {
|
|
5302
5337
|
for (const iconTheme of webExtension.iconThemes) {
|
|
5303
5338
|
// TODO handle error when icon theme path is not of type string
|
|
@@ -5347,7 +5382,7 @@ const emptyStatus = {
|
|
|
5347
5382
|
importTime: 0
|
|
5348
5383
|
};
|
|
5349
5384
|
const getRuntimeStatus = extensionId => {
|
|
5350
|
-
return get$
|
|
5385
|
+
return get$5(extensionId) || emptyStatus;
|
|
5351
5386
|
};
|
|
5352
5387
|
|
|
5353
5388
|
const getWebViewInfo2 = providerId => {
|
|
@@ -5401,7 +5436,7 @@ const handleMessagePort2 = async (port, rpcId) => {
|
|
|
5401
5436
|
commandMap: {}
|
|
5402
5437
|
});
|
|
5403
5438
|
if (rpcId) {
|
|
5404
|
-
set$
|
|
5439
|
+
set$c(rpcId, rpc);
|
|
5405
5440
|
}
|
|
5406
5441
|
};
|
|
5407
5442
|
|
|
@@ -5411,12 +5446,12 @@ const handleMessagePort = async (port, rpcId) => {
|
|
|
5411
5446
|
commandMap: {}
|
|
5412
5447
|
});
|
|
5413
5448
|
if (rpcId) {
|
|
5414
|
-
set$
|
|
5449
|
+
set$c(rpcId, rpc);
|
|
5415
5450
|
}
|
|
5416
5451
|
};
|
|
5417
5452
|
|
|
5418
5453
|
const handleIconThemeChange = async () => {
|
|
5419
|
-
await invoke$
|
|
5454
|
+
await invoke$1('IconTheme.handleIconThemeChange');
|
|
5420
5455
|
};
|
|
5421
5456
|
|
|
5422
5457
|
const initialIconTheme = undefined;
|
|
@@ -5460,7 +5495,7 @@ const importExtension = async (extensionId, absolutePath, activationEvent) => {
|
|
|
5460
5495
|
try {
|
|
5461
5496
|
string(absolutePath);
|
|
5462
5497
|
const startTime = performance.now();
|
|
5463
|
-
set$
|
|
5498
|
+
set$4({
|
|
5464
5499
|
activationEvent: activationEvent,
|
|
5465
5500
|
id: extensionId,
|
|
5466
5501
|
activationStartTime: performance.now(),
|
|
@@ -5475,7 +5510,7 @@ const importExtension = async (extensionId, absolutePath, activationEvent) => {
|
|
|
5475
5510
|
const module = await importScript(absolutePath);
|
|
5476
5511
|
const endTime = performance.now();
|
|
5477
5512
|
const time = endTime - startTime;
|
|
5478
|
-
set$
|
|
5513
|
+
set$5(extensionId, module);
|
|
5479
5514
|
update(extensionId, {
|
|
5480
5515
|
importEndTime: endTime,
|
|
5481
5516
|
importTime: time
|
|
@@ -6010,7 +6045,7 @@ const textSearch2 = async (scheme, root, query, options, assetDir) => {
|
|
|
6010
6045
|
}
|
|
6011
6046
|
}
|
|
6012
6047
|
return {
|
|
6013
|
-
results: allResults,
|
|
6048
|
+
results: options.limit ? allResults.slice(0, options.limit) : allResults,
|
|
6014
6049
|
limitHit: allResults.length > options.limit
|
|
6015
6050
|
};
|
|
6016
6051
|
};
|
|
@@ -6023,7 +6058,6 @@ const unregisterInterceptor = async id => {
|
|
|
6023
6058
|
};
|
|
6024
6059
|
|
|
6025
6060
|
const commandMap = {
|
|
6026
|
-
'Extensions.invalidateExtensionsCache': invalidateExtensionsCache,
|
|
6027
6061
|
'BulkReplacement.applyBulkReplacement': applyBulkReplacement,
|
|
6028
6062
|
'ColorTheme.getColorThemeCssFromJson': getColorThemeCssFromJson,
|
|
6029
6063
|
'ColorTheme.getColorThemeJson': getColorThemeJson,
|
|
@@ -6053,6 +6087,7 @@ const commandMap = {
|
|
|
6053
6087
|
'ExtensionHostDebug.stepOver': stepOver,
|
|
6054
6088
|
'ExtensionHostRename.executeprepareRenameProvider': executeprepareRenameProvider,
|
|
6055
6089
|
'ExtensionHostRename.executeRenameProvider': executeRenameProvider,
|
|
6090
|
+
'ExtensionHostSourceControl.getIconDefinitions': getIconDefinitions,
|
|
6056
6091
|
'ExtensionHostWebView.create': createWebView,
|
|
6057
6092
|
'ExtensionHostWebView.dispose': disposeWebView,
|
|
6058
6093
|
'ExtensionHostWebView.getWebViewInfo': getWebViewInfo,
|
|
@@ -6061,6 +6096,7 @@ const commandMap = {
|
|
|
6061
6096
|
'Extensions.addWebExtension': addWebExtension,
|
|
6062
6097
|
'Extensions.getExtension': getExtension,
|
|
6063
6098
|
'Extensions.getExtensions': getExtensions,
|
|
6099
|
+
'Extensions.invalidateExtensionsCache': invalidateExtensionsCache,
|
|
6064
6100
|
'FileSystemFetch.chmod': chmod$1,
|
|
6065
6101
|
'FileSystemFetch.getBlob': getBlob$1,
|
|
6066
6102
|
'FileSystemFetch.mkdir': mkdir$1,
|
|
@@ -6069,8 +6105,8 @@ const commandMap = {
|
|
|
6069
6105
|
'FileSystemFetch.remove': remove$2,
|
|
6070
6106
|
'FileSystemFetch.writeFile': writeFile$1,
|
|
6071
6107
|
'FileSystemMemory.chmod': chmod,
|
|
6072
|
-
'FileSystemMemory.exists': exists,
|
|
6073
6108
|
'FileSystemMemory.copy': copy,
|
|
6109
|
+
'FileSystemMemory.exists': exists,
|
|
6074
6110
|
'FileSystemMemory.getBlob': getBlob,
|
|
6075
6111
|
'FileSystemMemory.getBlobUrl': getBlobUrl,
|
|
6076
6112
|
'FileSystemMemory.getFiles': getFiles,
|
|
@@ -6125,7 +6161,7 @@ const commandMap = {
|
|
|
6125
6161
|
[FileSystemReadFile]: readFile$2,
|
|
6126
6162
|
[FileSystemRename]: rename$1,
|
|
6127
6163
|
[FileSystemWriteFile]: writeFile$3,
|
|
6128
|
-
[FileSystemRemove]: remove$
|
|
6164
|
+
[FileSystemRemove]: remove$3,
|
|
6129
6165
|
[FormattingExecuteFormmattingProvider]: executeFormattingProvider,
|
|
6130
6166
|
[HoverExecute]: executeHoverProvider,
|
|
6131
6167
|
[ImplementationExecuteImplementationProvider]: executeImplementationProvider,
|
|
@@ -6158,7 +6194,7 @@ const listen = async () => {
|
|
|
6158
6194
|
const rpc = await WebWorkerRpcClient.create({
|
|
6159
6195
|
commandMap: commandMap
|
|
6160
6196
|
});
|
|
6161
|
-
set$
|
|
6197
|
+
set$c(RendererWorker, rpc);
|
|
6162
6198
|
};
|
|
6163
6199
|
|
|
6164
6200
|
const main = async () => {
|