@lvce-editor/extension-detail-view 3.63.0 → 3.64.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/extensionDetailViewWorkerMain.js +1842 -1763
- package/package.json +1 -1
|
@@ -668,1990 +668,2032 @@ const create$7 = rpcId => {
|
|
|
668
668
|
};
|
|
669
669
|
};
|
|
670
670
|
|
|
671
|
-
const {
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
return invoke$5('ExtensionHostReference.executeReferenceProvider', id, offset);
|
|
671
|
+
const normalizeLine = line => {
|
|
672
|
+
if (line.startsWith('Error: ')) {
|
|
673
|
+
return line.slice('Error: '.length);
|
|
674
|
+
}
|
|
675
|
+
if (line.startsWith('VError: ')) {
|
|
676
|
+
return line.slice('VError: '.length);
|
|
677
|
+
}
|
|
678
|
+
return line;
|
|
680
679
|
};
|
|
681
|
-
const
|
|
682
|
-
|
|
683
|
-
|
|
680
|
+
const getCombinedMessage = (error, message) => {
|
|
681
|
+
const stringifiedError = normalizeLine(`${error}`);
|
|
682
|
+
if (message) {
|
|
683
|
+
return `${message}: ${stringifiedError}`;
|
|
684
|
+
}
|
|
685
|
+
return stringifiedError;
|
|
684
686
|
};
|
|
685
|
-
const
|
|
686
|
-
|
|
687
|
-
return
|
|
687
|
+
const NewLine$2 = '\n';
|
|
688
|
+
const getNewLineIndex$1 = (string, startIndex = undefined) => {
|
|
689
|
+
return string.indexOf(NewLine$2, startIndex);
|
|
688
690
|
};
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
691
|
+
const mergeStacks = (parent, child) => {
|
|
692
|
+
if (!child) {
|
|
693
|
+
return parent;
|
|
694
|
+
}
|
|
695
|
+
const parentNewLineIndex = getNewLineIndex$1(parent);
|
|
696
|
+
const childNewLineIndex = getNewLineIndex$1(child);
|
|
697
|
+
if (childNewLineIndex === -1) {
|
|
698
|
+
return parent;
|
|
699
|
+
}
|
|
700
|
+
const parentFirstLine = parent.slice(0, parentNewLineIndex);
|
|
701
|
+
const childRest = child.slice(childNewLineIndex);
|
|
702
|
+
const childFirstLine = normalizeLine(child.slice(0, childNewLineIndex));
|
|
703
|
+
if (parentFirstLine.includes(childFirstLine)) {
|
|
704
|
+
return parentFirstLine + childRest;
|
|
705
|
+
}
|
|
706
|
+
return child;
|
|
699
707
|
};
|
|
708
|
+
class VError extends Error {
|
|
709
|
+
constructor(error, message) {
|
|
710
|
+
const combinedMessage = getCombinedMessage(error, message);
|
|
711
|
+
super(combinedMessage);
|
|
712
|
+
this.name = 'VError';
|
|
713
|
+
if (error instanceof Error) {
|
|
714
|
+
this.stack = mergeStacks(this.stack, error.stack);
|
|
715
|
+
}
|
|
716
|
+
if (error.codeFrame) {
|
|
717
|
+
// @ts-ignore
|
|
718
|
+
this.codeFrame = error.codeFrame;
|
|
719
|
+
}
|
|
720
|
+
if (error.code) {
|
|
721
|
+
// @ts-ignore
|
|
722
|
+
this.code = error.code;
|
|
723
|
+
}
|
|
724
|
+
}
|
|
725
|
+
}
|
|
700
726
|
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
}
|
|
707
|
-
const
|
|
708
|
-
|
|
727
|
+
class AssertionError extends Error {
|
|
728
|
+
constructor(message) {
|
|
729
|
+
super(message);
|
|
730
|
+
this.name = 'AssertionError';
|
|
731
|
+
}
|
|
732
|
+
}
|
|
733
|
+
const Object$1 = 1;
|
|
734
|
+
const Number$1 = 2;
|
|
735
|
+
const Array$1 = 3;
|
|
736
|
+
const String = 4;
|
|
737
|
+
const Boolean$1 = 5;
|
|
738
|
+
const Function = 6;
|
|
739
|
+
const Null = 7;
|
|
740
|
+
const Unknown = 8;
|
|
741
|
+
const getType = value => {
|
|
742
|
+
switch (typeof value) {
|
|
743
|
+
case 'number':
|
|
744
|
+
return Number$1;
|
|
745
|
+
case 'function':
|
|
746
|
+
return Function;
|
|
747
|
+
case 'string':
|
|
748
|
+
return String;
|
|
749
|
+
case 'object':
|
|
750
|
+
if (value === null) {
|
|
751
|
+
return Null;
|
|
752
|
+
}
|
|
753
|
+
if (Array.isArray(value)) {
|
|
754
|
+
return Array$1;
|
|
755
|
+
}
|
|
756
|
+
return Object$1;
|
|
757
|
+
case 'boolean':
|
|
758
|
+
return Boolean$1;
|
|
759
|
+
default:
|
|
760
|
+
return Unknown;
|
|
761
|
+
}
|
|
709
762
|
};
|
|
710
|
-
const
|
|
711
|
-
|
|
763
|
+
const string = value => {
|
|
764
|
+
const type = getType(value);
|
|
765
|
+
if (type !== String) {
|
|
766
|
+
throw new AssertionError('expected value to be of type string');
|
|
767
|
+
}
|
|
712
768
|
};
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
return
|
|
769
|
+
|
|
770
|
+
const isMessagePort = value => {
|
|
771
|
+
return value && value instanceof MessagePort;
|
|
716
772
|
};
|
|
717
|
-
const
|
|
718
|
-
return
|
|
773
|
+
const isMessagePortMain = value => {
|
|
774
|
+
return value && value.constructor && value.constructor.name === 'MessagePortMain';
|
|
719
775
|
};
|
|
720
|
-
const
|
|
721
|
-
return
|
|
776
|
+
const isOffscreenCanvas = value => {
|
|
777
|
+
return typeof OffscreenCanvas !== 'undefined' && value instanceof OffscreenCanvas;
|
|
722
778
|
};
|
|
723
|
-
const
|
|
724
|
-
return
|
|
779
|
+
const isInstanceOf = (value, constructorName) => {
|
|
780
|
+
return value?.constructor?.name === constructorName;
|
|
725
781
|
};
|
|
726
|
-
const
|
|
727
|
-
return
|
|
782
|
+
const isSocket = value => {
|
|
783
|
+
return isInstanceOf(value, 'Socket');
|
|
728
784
|
};
|
|
729
|
-
const
|
|
730
|
-
|
|
785
|
+
const transferrables = [isMessagePort, isMessagePortMain, isOffscreenCanvas, isSocket];
|
|
786
|
+
const isTransferrable = value => {
|
|
787
|
+
for (const fn of transferrables) {
|
|
788
|
+
if (fn(value)) {
|
|
789
|
+
return true;
|
|
790
|
+
}
|
|
791
|
+
}
|
|
792
|
+
return false;
|
|
731
793
|
};
|
|
732
|
-
const
|
|
733
|
-
|
|
794
|
+
const walkValue = (value, transferrables, isTransferrable) => {
|
|
795
|
+
if (!value) {
|
|
796
|
+
return;
|
|
797
|
+
}
|
|
798
|
+
if (isTransferrable(value)) {
|
|
799
|
+
transferrables.push(value);
|
|
800
|
+
return;
|
|
801
|
+
}
|
|
802
|
+
if (Array.isArray(value)) {
|
|
803
|
+
for (const item of value) {
|
|
804
|
+
walkValue(item, transferrables, isTransferrable);
|
|
805
|
+
}
|
|
806
|
+
return;
|
|
807
|
+
}
|
|
808
|
+
if (typeof value === 'object') {
|
|
809
|
+
for (const property of Object.values(value)) {
|
|
810
|
+
walkValue(property, transferrables, isTransferrable);
|
|
811
|
+
}
|
|
812
|
+
return;
|
|
813
|
+
}
|
|
734
814
|
};
|
|
735
|
-
const
|
|
736
|
-
|
|
815
|
+
const getTransferrables = value => {
|
|
816
|
+
const transferrables = [];
|
|
817
|
+
walkValue(value, transferrables, isTransferrable);
|
|
818
|
+
return transferrables;
|
|
737
819
|
};
|
|
738
|
-
const
|
|
739
|
-
|
|
820
|
+
const attachEvents = that => {
|
|
821
|
+
const handleMessage = (...args) => {
|
|
822
|
+
const data = that.getData(...args);
|
|
823
|
+
that.dispatchEvent(new MessageEvent('message', {
|
|
824
|
+
data
|
|
825
|
+
}));
|
|
826
|
+
};
|
|
827
|
+
that.onMessage(handleMessage);
|
|
828
|
+
const handleClose = event => {
|
|
829
|
+
that.dispatchEvent(new Event('close'));
|
|
830
|
+
};
|
|
831
|
+
that.onClose(handleClose);
|
|
740
832
|
};
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
833
|
+
class Ipc extends EventTarget {
|
|
834
|
+
constructor(rawIpc) {
|
|
835
|
+
super();
|
|
836
|
+
this._rawIpc = rawIpc;
|
|
837
|
+
attachEvents(this);
|
|
838
|
+
}
|
|
839
|
+
}
|
|
840
|
+
const E_INCOMPATIBLE_NATIVE_MODULE = 'E_INCOMPATIBLE_NATIVE_MODULE';
|
|
841
|
+
const E_MODULES_NOT_SUPPORTED_IN_ELECTRON = 'E_MODULES_NOT_SUPPORTED_IN_ELECTRON';
|
|
842
|
+
const ERR_MODULE_NOT_FOUND = 'ERR_MODULE_NOT_FOUND';
|
|
843
|
+
const NewLine$1 = '\n';
|
|
844
|
+
const joinLines$1 = lines => {
|
|
845
|
+
return lines.join(NewLine$1);
|
|
744
846
|
};
|
|
745
|
-
const
|
|
746
|
-
|
|
747
|
-
|
|
847
|
+
const RE_AT = /^\s+at/;
|
|
848
|
+
const RE_AT_PROMISE_INDEX = /^\s*at async Promise.all \(index \d+\)$/;
|
|
849
|
+
const isNormalStackLine = line => {
|
|
850
|
+
return RE_AT.test(line) && !RE_AT_PROMISE_INDEX.test(line);
|
|
748
851
|
};
|
|
749
|
-
const
|
|
750
|
-
|
|
751
|
-
|
|
852
|
+
const getDetails = lines => {
|
|
853
|
+
const index = lines.findIndex(isNormalStackLine);
|
|
854
|
+
if (index === -1) {
|
|
855
|
+
return {
|
|
856
|
+
actualMessage: joinLines$1(lines),
|
|
857
|
+
rest: []
|
|
858
|
+
};
|
|
859
|
+
}
|
|
860
|
+
let lastIndex = index - 1;
|
|
861
|
+
while (++lastIndex < lines.length) {
|
|
862
|
+
if (!isNormalStackLine(lines[lastIndex])) {
|
|
863
|
+
break;
|
|
864
|
+
}
|
|
865
|
+
}
|
|
866
|
+
return {
|
|
867
|
+
actualMessage: lines[index - 1],
|
|
868
|
+
rest: lines.slice(index, lastIndex)
|
|
869
|
+
};
|
|
752
870
|
};
|
|
753
|
-
const
|
|
754
|
-
|
|
755
|
-
return invoke$4('FileSystem.appendFile', uri, text);
|
|
871
|
+
const splitLines$1 = lines => {
|
|
872
|
+
return lines.split(NewLine$1);
|
|
756
873
|
};
|
|
757
|
-
|
|
758
|
-
const
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
copy,
|
|
762
|
-
createFile,
|
|
763
|
-
dispose: dispose$4,
|
|
764
|
-
exists: exists$1,
|
|
765
|
-
getFolderSize: getFolderSize$2,
|
|
766
|
-
getPathSeparator,
|
|
767
|
-
getRealPath,
|
|
768
|
-
invoke: invoke$4,
|
|
769
|
-
invokeAndTransfer: invokeAndTransfer$3,
|
|
770
|
-
mkdir,
|
|
771
|
-
readDirWithFileTypes,
|
|
772
|
-
readFile: readFile$3,
|
|
773
|
-
readFileAsBlob: readFileAsBlob$1,
|
|
774
|
-
remove: remove$1,
|
|
775
|
-
rename,
|
|
776
|
-
set: set$8,
|
|
777
|
-
stat,
|
|
778
|
-
writeFile
|
|
874
|
+
const RE_MESSAGE_CODE_BLOCK_START = /^Error: The module '.*'$/;
|
|
875
|
+
const RE_MESSAGE_CODE_BLOCK_END = /^\s* at/;
|
|
876
|
+
const isMessageCodeBlockStartIndex = line => {
|
|
877
|
+
return RE_MESSAGE_CODE_BLOCK_START.test(line);
|
|
779
878
|
};
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
invoke: invoke$3,
|
|
783
|
-
invokeAndTransfer: invokeAndTransfer$2,
|
|
784
|
-
set: set$7,
|
|
785
|
-
dispose: dispose$3
|
|
786
|
-
} = create$7(MarkdownWorker$1);
|
|
787
|
-
const getVirtualDom$1 = async html => {
|
|
788
|
-
// @ts-ignore
|
|
789
|
-
return invoke$3('Markdown.getVirtualDom', html);
|
|
790
|
-
};
|
|
791
|
-
const render$1 = async (markdown, options) => {
|
|
792
|
-
// @ts-ignore
|
|
793
|
-
return invoke$3('Markdown.render', markdown, options);
|
|
794
|
-
};
|
|
795
|
-
|
|
796
|
-
const MarkdownWorker = {
|
|
797
|
-
__proto__: null,
|
|
798
|
-
dispose: dispose$3,
|
|
799
|
-
getVirtualDom: getVirtualDom$1,
|
|
800
|
-
invoke: invoke$3,
|
|
801
|
-
invokeAndTransfer: invokeAndTransfer$2,
|
|
802
|
-
render: render$1,
|
|
803
|
-
set: set$7
|
|
804
|
-
};
|
|
805
|
-
|
|
806
|
-
const {
|
|
807
|
-
invoke: invoke$2,
|
|
808
|
-
invokeAndTransfer: invokeAndTransfer$1,
|
|
809
|
-
set: set$6,
|
|
810
|
-
dispose: dispose$2
|
|
811
|
-
} = create$7(RendererWorker$1);
|
|
812
|
-
const searchFileHtml = async uri => {
|
|
813
|
-
return invoke$2('ExtensionHost.searchFileWithHtml', uri);
|
|
814
|
-
};
|
|
815
|
-
const getFilePathElectron = async file => {
|
|
816
|
-
return invoke$2('FileSystemHandle.getFilePathElectron', file);
|
|
817
|
-
};
|
|
818
|
-
const showContextMenu$1 = async (x, y, id, ...args) => {
|
|
819
|
-
return invoke$2('ContextMenu.show', x, y, id, ...args);
|
|
820
|
-
};
|
|
821
|
-
const getElectronVersion = async () => {
|
|
822
|
-
return invoke$2('Process.getElectronVersion');
|
|
823
|
-
};
|
|
824
|
-
const applyBulkReplacement = async bulkEdits => {
|
|
825
|
-
await invoke$2('BulkReplacement.applyBulkReplacement', bulkEdits);
|
|
879
|
+
const isMessageCodeBlockEndIndex = line => {
|
|
880
|
+
return RE_MESSAGE_CODE_BLOCK_END.test(line);
|
|
826
881
|
};
|
|
827
|
-
const
|
|
828
|
-
|
|
829
|
-
|
|
882
|
+
const getMessageCodeBlock = stderr => {
|
|
883
|
+
const lines = splitLines$1(stderr);
|
|
884
|
+
const startIndex = lines.findIndex(isMessageCodeBlockStartIndex);
|
|
885
|
+
const endIndex = startIndex + lines.slice(startIndex).findIndex(isMessageCodeBlockEndIndex, startIndex);
|
|
886
|
+
const relevantLines = lines.slice(startIndex, endIndex);
|
|
887
|
+
const relevantMessage = relevantLines.join(' ').slice('Error: '.length);
|
|
888
|
+
return relevantMessage;
|
|
830
889
|
};
|
|
831
|
-
const
|
|
832
|
-
return
|
|
890
|
+
const isModuleNotFoundMessage = line => {
|
|
891
|
+
return line.includes('[ERR_MODULE_NOT_FOUND]');
|
|
833
892
|
};
|
|
834
|
-
const
|
|
835
|
-
|
|
893
|
+
const getModuleNotFoundError = stderr => {
|
|
894
|
+
const lines = splitLines$1(stderr);
|
|
895
|
+
const messageIndex = lines.findIndex(isModuleNotFoundMessage);
|
|
896
|
+
const message = lines[messageIndex];
|
|
897
|
+
return {
|
|
898
|
+
message,
|
|
899
|
+
code: ERR_MODULE_NOT_FOUND
|
|
900
|
+
};
|
|
836
901
|
};
|
|
837
|
-
const
|
|
838
|
-
|
|
902
|
+
const isModuleNotFoundError = stderr => {
|
|
903
|
+
if (!stderr) {
|
|
904
|
+
return false;
|
|
905
|
+
}
|
|
906
|
+
return stderr.includes('ERR_MODULE_NOT_FOUND');
|
|
839
907
|
};
|
|
840
|
-
const
|
|
841
|
-
|
|
842
|
-
|
|
908
|
+
const isModulesSyntaxError = stderr => {
|
|
909
|
+
if (!stderr) {
|
|
910
|
+
return false;
|
|
911
|
+
}
|
|
912
|
+
return stderr.includes('SyntaxError: Cannot use import statement outside a module');
|
|
843
913
|
};
|
|
844
|
-
const
|
|
845
|
-
|
|
914
|
+
const RE_NATIVE_MODULE_ERROR = /^innerError Error: Cannot find module '.*.node'/;
|
|
915
|
+
const RE_NATIVE_MODULE_ERROR_2 = /was compiled against a different Node.js version/;
|
|
916
|
+
const isUnhelpfulNativeModuleError = stderr => {
|
|
917
|
+
return RE_NATIVE_MODULE_ERROR.test(stderr) && RE_NATIVE_MODULE_ERROR_2.test(stderr);
|
|
846
918
|
};
|
|
847
|
-
const
|
|
848
|
-
|
|
919
|
+
const getNativeModuleErrorMessage = stderr => {
|
|
920
|
+
const message = getMessageCodeBlock(stderr);
|
|
921
|
+
return {
|
|
922
|
+
message: `Incompatible native node module: ${message}`,
|
|
923
|
+
code: E_INCOMPATIBLE_NATIVE_MODULE
|
|
924
|
+
};
|
|
849
925
|
};
|
|
850
|
-
const
|
|
851
|
-
|
|
926
|
+
const getModuleSyntaxError = () => {
|
|
927
|
+
return {
|
|
928
|
+
message: `ES Modules are not supported in electron`,
|
|
929
|
+
code: E_MODULES_NOT_SUPPORTED_IN_ELECTRON
|
|
930
|
+
};
|
|
852
931
|
};
|
|
853
|
-
const
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
932
|
+
const getHelpfulChildProcessError = (stdout, stderr) => {
|
|
933
|
+
if (isUnhelpfulNativeModuleError(stderr)) {
|
|
934
|
+
return getNativeModuleErrorMessage(stderr);
|
|
935
|
+
}
|
|
936
|
+
if (isModulesSyntaxError(stderr)) {
|
|
937
|
+
return getModuleSyntaxError();
|
|
938
|
+
}
|
|
939
|
+
if (isModuleNotFoundError(stderr)) {
|
|
940
|
+
return getModuleNotFoundError(stderr);
|
|
941
|
+
}
|
|
942
|
+
const lines = splitLines$1(stderr);
|
|
943
|
+
const {
|
|
944
|
+
actualMessage,
|
|
945
|
+
rest
|
|
946
|
+
} = getDetails(lines);
|
|
947
|
+
return {
|
|
948
|
+
message: actualMessage,
|
|
949
|
+
code: '',
|
|
950
|
+
stack: rest
|
|
951
|
+
};
|
|
857
952
|
};
|
|
858
|
-
|
|
859
|
-
const command = 'Errors.handleMessagePort';
|
|
953
|
+
class IpcError extends VError {
|
|
860
954
|
// @ts-ignore
|
|
861
|
-
|
|
955
|
+
constructor(betterMessage, stdout = '', stderr = '') {
|
|
956
|
+
if (stdout || stderr) {
|
|
957
|
+
// @ts-ignore
|
|
958
|
+
const {
|
|
959
|
+
message,
|
|
960
|
+
code,
|
|
961
|
+
stack
|
|
962
|
+
} = getHelpfulChildProcessError(stdout, stderr);
|
|
963
|
+
const cause = new Error(message);
|
|
964
|
+
// @ts-ignore
|
|
965
|
+
cause.code = code;
|
|
966
|
+
cause.stack = stack;
|
|
967
|
+
super(cause, betterMessage);
|
|
968
|
+
} else {
|
|
969
|
+
super(betterMessage);
|
|
970
|
+
}
|
|
971
|
+
// @ts-ignore
|
|
972
|
+
this.name = 'IpcError';
|
|
973
|
+
// @ts-ignore
|
|
974
|
+
this.stdout = stdout;
|
|
975
|
+
// @ts-ignore
|
|
976
|
+
this.stderr = stderr;
|
|
977
|
+
}
|
|
978
|
+
}
|
|
979
|
+
const readyMessage = 'ready';
|
|
980
|
+
const getData$2 = event => {
|
|
981
|
+
return event.data;
|
|
862
982
|
};
|
|
863
|
-
const
|
|
864
|
-
const command = 'Markdown.handleMessagePort';
|
|
983
|
+
const listen$7 = () => {
|
|
865
984
|
// @ts-ignore
|
|
866
|
-
|
|
985
|
+
if (typeof WorkerGlobalScope === 'undefined') {
|
|
986
|
+
throw new TypeError('module is not in web worker scope');
|
|
987
|
+
}
|
|
988
|
+
return globalThis;
|
|
867
989
|
};
|
|
868
|
-
const
|
|
869
|
-
|
|
870
|
-
// @ts-ignore
|
|
871
|
-
await invokeAndTransfer$1('SendMessagePortToExtensionHostWorker.sendMessagePortToFileSystemWorker', port, command, rpcId);
|
|
990
|
+
const signal$8 = global => {
|
|
991
|
+
global.postMessage(readyMessage);
|
|
872
992
|
};
|
|
873
|
-
|
|
874
|
-
|
|
993
|
+
class IpcChildWithModuleWorker extends Ipc {
|
|
994
|
+
getData(event) {
|
|
995
|
+
return getData$2(event);
|
|
996
|
+
}
|
|
997
|
+
send(message) {
|
|
998
|
+
// @ts-ignore
|
|
999
|
+
this._rawIpc.postMessage(message);
|
|
1000
|
+
}
|
|
1001
|
+
sendAndTransfer(message) {
|
|
1002
|
+
const transfer = getTransferrables(message);
|
|
1003
|
+
// @ts-ignore
|
|
1004
|
+
this._rawIpc.postMessage(message, transfer);
|
|
1005
|
+
}
|
|
1006
|
+
dispose() {
|
|
1007
|
+
// ignore
|
|
1008
|
+
}
|
|
1009
|
+
onClose(callback) {
|
|
1010
|
+
// ignore
|
|
1011
|
+
}
|
|
1012
|
+
onMessage(callback) {
|
|
1013
|
+
this._rawIpc.addEventListener('message', callback);
|
|
1014
|
+
}
|
|
1015
|
+
}
|
|
1016
|
+
const wrap$f = global => {
|
|
1017
|
+
return new IpcChildWithModuleWorker(global);
|
|
875
1018
|
};
|
|
876
|
-
const
|
|
1019
|
+
const waitForFirstMessage = async port => {
|
|
1020
|
+
const {
|
|
1021
|
+
resolve,
|
|
1022
|
+
promise
|
|
1023
|
+
} = Promise.withResolvers();
|
|
1024
|
+
port.addEventListener('message', resolve, {
|
|
1025
|
+
once: true
|
|
1026
|
+
});
|
|
1027
|
+
const event = await promise;
|
|
877
1028
|
// @ts-ignore
|
|
878
|
-
return
|
|
879
|
-
};
|
|
880
|
-
const setWebViewPort = async (uid, port, origin, portType) => {
|
|
881
|
-
return invokeAndTransfer$1('WebView.setPort', uid, port, origin, portType);
|
|
1029
|
+
return event.data;
|
|
882
1030
|
};
|
|
883
|
-
const
|
|
884
|
-
|
|
1031
|
+
const listen$6 = async () => {
|
|
1032
|
+
const parentIpcRaw = listen$7();
|
|
1033
|
+
signal$8(parentIpcRaw);
|
|
1034
|
+
const parentIpc = wrap$f(parentIpcRaw);
|
|
1035
|
+
const firstMessage = await waitForFirstMessage(parentIpc);
|
|
1036
|
+
if (firstMessage.method !== 'initialize') {
|
|
1037
|
+
throw new IpcError('unexpected first message');
|
|
1038
|
+
}
|
|
1039
|
+
const type = firstMessage.params[0];
|
|
1040
|
+
if (type === 'message-port') {
|
|
1041
|
+
parentIpc.send({
|
|
1042
|
+
jsonrpc: '2.0',
|
|
1043
|
+
id: firstMessage.id,
|
|
1044
|
+
result: null
|
|
1045
|
+
});
|
|
1046
|
+
parentIpc.dispose();
|
|
1047
|
+
const port = firstMessage.params[1];
|
|
1048
|
+
return port;
|
|
1049
|
+
}
|
|
1050
|
+
return globalThis;
|
|
885
1051
|
};
|
|
886
|
-
|
|
887
|
-
|
|
1052
|
+
class IpcChildWithModuleWorkerAndMessagePort extends Ipc {
|
|
1053
|
+
getData(event) {
|
|
1054
|
+
return getData$2(event);
|
|
1055
|
+
}
|
|
1056
|
+
send(message) {
|
|
1057
|
+
this._rawIpc.postMessage(message);
|
|
1058
|
+
}
|
|
1059
|
+
sendAndTransfer(message) {
|
|
1060
|
+
const transfer = getTransferrables(message);
|
|
1061
|
+
this._rawIpc.postMessage(message, transfer);
|
|
1062
|
+
}
|
|
1063
|
+
dispose() {
|
|
1064
|
+
if (this._rawIpc.close) {
|
|
1065
|
+
this._rawIpc.close();
|
|
1066
|
+
}
|
|
1067
|
+
}
|
|
1068
|
+
onClose(callback) {
|
|
1069
|
+
// ignore
|
|
1070
|
+
}
|
|
1071
|
+
onMessage(callback) {
|
|
1072
|
+
this._rawIpc.addEventListener('message', callback);
|
|
1073
|
+
this._rawIpc.start();
|
|
1074
|
+
}
|
|
1075
|
+
}
|
|
1076
|
+
const wrap$e = port => {
|
|
1077
|
+
return new IpcChildWithModuleWorkerAndMessagePort(port);
|
|
888
1078
|
};
|
|
889
|
-
const
|
|
890
|
-
|
|
1079
|
+
const IpcChildWithModuleWorkerAndMessagePort$1 = {
|
|
1080
|
+
__proto__: null,
|
|
1081
|
+
listen: listen$6,
|
|
1082
|
+
wrap: wrap$e
|
|
891
1083
|
};
|
|
892
|
-
const
|
|
893
|
-
|
|
1084
|
+
const addListener = (emitter, type, callback) => {
|
|
1085
|
+
if ('addEventListener' in emitter) {
|
|
1086
|
+
emitter.addEventListener(type, callback);
|
|
1087
|
+
} else {
|
|
1088
|
+
emitter.on(type, callback);
|
|
1089
|
+
}
|
|
894
1090
|
};
|
|
895
|
-
const
|
|
896
|
-
|
|
897
|
-
|
|
1091
|
+
const removeListener = (emitter, type, callback) => {
|
|
1092
|
+
if ('removeEventListener' in emitter) {
|
|
1093
|
+
emitter.removeEventListener(type, callback);
|
|
1094
|
+
} else {
|
|
1095
|
+
emitter.off(type, callback);
|
|
1096
|
+
}
|
|
898
1097
|
};
|
|
899
|
-
const
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
const
|
|
907
|
-
|
|
908
|
-
}
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
}
|
|
921
|
-
|
|
922
|
-
return invoke$2(/* RecentlyOpened.getRecentlyOpened */'RecentlyOpened.getRecentlyOpened');
|
|
923
|
-
};
|
|
924
|
-
const getKeyBindings = async () => {
|
|
925
|
-
return invoke$2('KeyBindingsInitial.getKeyBindings');
|
|
926
|
-
};
|
|
927
|
-
const writeClipBoardText$1 = async text => {
|
|
928
|
-
await invoke$2('ClipBoard.writeText', /* text */text);
|
|
929
|
-
};
|
|
930
|
-
const writeClipBoardImage$1 = async blob => {
|
|
931
|
-
// @ts-ignore
|
|
932
|
-
await invoke$2('ClipBoard.writeImage', /* text */blob);
|
|
933
|
-
};
|
|
934
|
-
const searchFileMemory = async uri => {
|
|
935
|
-
// @ts-ignore
|
|
936
|
-
return invoke$2('ExtensionHost.searchFileWithMemory', uri);
|
|
937
|
-
};
|
|
938
|
-
const searchFileFetch = async uri => {
|
|
939
|
-
return invoke$2('ExtensionHost.searchFileWithFetch', uri);
|
|
940
|
-
};
|
|
941
|
-
const showMessageBox = async options => {
|
|
942
|
-
return invoke$2('ElectronDialog.showMessageBox', options);
|
|
943
|
-
};
|
|
944
|
-
const handleDebugResumed = async params => {
|
|
945
|
-
await invoke$2('Run And Debug.handleResumed', params);
|
|
946
|
-
};
|
|
947
|
-
const openWidget = async name => {
|
|
948
|
-
await invoke$2('Viewlet.openWidget', name);
|
|
949
|
-
};
|
|
950
|
-
const getIcons = async requests => {
|
|
951
|
-
const icons = await invoke$2('IconTheme.getIcons', requests);
|
|
952
|
-
return icons;
|
|
953
|
-
};
|
|
954
|
-
const activateByEvent = event => {
|
|
955
|
-
return invoke$2('ExtensionHostManagement.activateByEvent', event);
|
|
956
|
-
};
|
|
957
|
-
const setAdditionalFocus = focusKey => {
|
|
958
|
-
// @ts-ignore
|
|
959
|
-
return invoke$2('Focus.setAdditionalFocus', focusKey);
|
|
1098
|
+
const getFirstEvent = (eventEmitter, eventMap) => {
|
|
1099
|
+
const {
|
|
1100
|
+
resolve,
|
|
1101
|
+
promise
|
|
1102
|
+
} = Promise.withResolvers();
|
|
1103
|
+
const listenerMap = Object.create(null);
|
|
1104
|
+
const cleanup = value => {
|
|
1105
|
+
for (const event of Object.keys(eventMap)) {
|
|
1106
|
+
removeListener(eventEmitter, event, listenerMap[event]);
|
|
1107
|
+
}
|
|
1108
|
+
resolve(value);
|
|
1109
|
+
};
|
|
1110
|
+
for (const [event, type] of Object.entries(eventMap)) {
|
|
1111
|
+
const listener = event => {
|
|
1112
|
+
cleanup({
|
|
1113
|
+
type,
|
|
1114
|
+
event
|
|
1115
|
+
});
|
|
1116
|
+
};
|
|
1117
|
+
addListener(eventEmitter, event, listener);
|
|
1118
|
+
listenerMap[event] = listener;
|
|
1119
|
+
}
|
|
1120
|
+
return promise;
|
|
960
1121
|
};
|
|
961
|
-
const
|
|
962
|
-
|
|
963
|
-
|
|
1122
|
+
const Message$1 = 3;
|
|
1123
|
+
const create$5$1 = async ({
|
|
1124
|
+
messagePort,
|
|
1125
|
+
isMessagePortOpen
|
|
1126
|
+
}) => {
|
|
1127
|
+
if (!isMessagePort(messagePort)) {
|
|
1128
|
+
throw new IpcError('port must be of type MessagePort');
|
|
1129
|
+
}
|
|
1130
|
+
if (isMessagePortOpen) {
|
|
1131
|
+
return messagePort;
|
|
1132
|
+
}
|
|
1133
|
+
const eventPromise = getFirstEvent(messagePort, {
|
|
1134
|
+
message: Message$1
|
|
1135
|
+
});
|
|
1136
|
+
messagePort.start();
|
|
1137
|
+
const {
|
|
1138
|
+
type,
|
|
1139
|
+
event
|
|
1140
|
+
} = await eventPromise;
|
|
1141
|
+
if (type !== Message$1) {
|
|
1142
|
+
throw new IpcError('Failed to wait for ipc message');
|
|
1143
|
+
}
|
|
1144
|
+
if (event.data !== readyMessage) {
|
|
1145
|
+
throw new IpcError('unexpected first message');
|
|
1146
|
+
}
|
|
1147
|
+
return messagePort;
|
|
964
1148
|
};
|
|
965
|
-
const
|
|
966
|
-
|
|
1149
|
+
const signal$1 = messagePort => {
|
|
1150
|
+
messagePort.start();
|
|
967
1151
|
};
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
1152
|
+
class IpcParentWithMessagePort extends Ipc {
|
|
1153
|
+
getData = getData$2;
|
|
1154
|
+
send(message) {
|
|
1155
|
+
this._rawIpc.postMessage(message);
|
|
1156
|
+
}
|
|
1157
|
+
sendAndTransfer(message) {
|
|
1158
|
+
const transfer = getTransferrables(message);
|
|
1159
|
+
this._rawIpc.postMessage(message, transfer);
|
|
1160
|
+
}
|
|
1161
|
+
dispose() {
|
|
1162
|
+
this._rawIpc.close();
|
|
1163
|
+
}
|
|
1164
|
+
onMessage(callback) {
|
|
1165
|
+
this._rawIpc.addEventListener('message', callback);
|
|
1166
|
+
}
|
|
1167
|
+
onClose(callback) {}
|
|
1168
|
+
}
|
|
1169
|
+
const wrap$5 = messagePort => {
|
|
1170
|
+
return new IpcParentWithMessagePort(messagePort);
|
|
972
1171
|
};
|
|
973
|
-
const
|
|
974
|
-
|
|
1172
|
+
const IpcParentWithMessagePort$1 = {
|
|
1173
|
+
__proto__: null,
|
|
1174
|
+
create: create$5$1,
|
|
1175
|
+
signal: signal$1,
|
|
1176
|
+
wrap: wrap$5
|
|
975
1177
|
};
|
|
976
|
-
|
|
977
|
-
|
|
1178
|
+
|
|
1179
|
+
const Two = '2.0';
|
|
1180
|
+
const create$4 = (method, params) => {
|
|
1181
|
+
return {
|
|
1182
|
+
jsonrpc: Two,
|
|
1183
|
+
method,
|
|
1184
|
+
params
|
|
1185
|
+
};
|
|
978
1186
|
};
|
|
979
|
-
const
|
|
980
|
-
|
|
981
|
-
|
|
1187
|
+
const callbacks = Object.create(null);
|
|
1188
|
+
const set$9 = (id, fn) => {
|
|
1189
|
+
callbacks[id] = fn;
|
|
982
1190
|
};
|
|
983
|
-
const
|
|
984
|
-
|
|
1191
|
+
const get$1 = id => {
|
|
1192
|
+
return callbacks[id];
|
|
985
1193
|
};
|
|
986
|
-
const
|
|
987
|
-
|
|
1194
|
+
const remove$1 = id => {
|
|
1195
|
+
delete callbacks[id];
|
|
988
1196
|
};
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
'SendMessagePortToSyntaxHighlightingWorker.sendMessagePortToSyntaxHighlightingWorker', port, 'HandleMessagePort.handleMessagePort2');
|
|
1197
|
+
let id = 0;
|
|
1198
|
+
const create$3$1 = () => {
|
|
1199
|
+
return ++id;
|
|
993
1200
|
};
|
|
994
|
-
const
|
|
995
|
-
|
|
1201
|
+
const registerPromise = () => {
|
|
1202
|
+
const id = create$3$1();
|
|
1203
|
+
const {
|
|
1204
|
+
resolve,
|
|
1205
|
+
promise
|
|
1206
|
+
} = Promise.withResolvers();
|
|
1207
|
+
set$9(id, resolve);
|
|
1208
|
+
return {
|
|
1209
|
+
id,
|
|
1210
|
+
promise
|
|
1211
|
+
};
|
|
996
1212
|
};
|
|
997
|
-
const
|
|
998
|
-
|
|
1213
|
+
const create$2$1 = (method, params) => {
|
|
1214
|
+
const {
|
|
1215
|
+
id,
|
|
1216
|
+
promise
|
|
1217
|
+
} = registerPromise();
|
|
1218
|
+
const message = {
|
|
1219
|
+
jsonrpc: Two,
|
|
1220
|
+
method,
|
|
1221
|
+
params,
|
|
1222
|
+
id
|
|
1223
|
+
};
|
|
1224
|
+
return {
|
|
1225
|
+
message,
|
|
1226
|
+
promise
|
|
1227
|
+
};
|
|
999
1228
|
};
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1229
|
+
class JsonRpcError extends Error {
|
|
1230
|
+
constructor(message) {
|
|
1231
|
+
super(message);
|
|
1232
|
+
this.name = 'JsonRpcError';
|
|
1233
|
+
}
|
|
1234
|
+
}
|
|
1235
|
+
const NewLine = '\n';
|
|
1236
|
+
const DomException = 'DOMException';
|
|
1237
|
+
const ReferenceError$1 = 'ReferenceError';
|
|
1238
|
+
const SyntaxError$1 = 'SyntaxError';
|
|
1239
|
+
const TypeError$1 = 'TypeError';
|
|
1240
|
+
const getErrorConstructor = (message, type) => {
|
|
1241
|
+
if (type) {
|
|
1242
|
+
switch (type) {
|
|
1243
|
+
case DomException:
|
|
1244
|
+
return DOMException;
|
|
1245
|
+
case TypeError$1:
|
|
1246
|
+
return TypeError;
|
|
1247
|
+
case SyntaxError$1:
|
|
1248
|
+
return SyntaxError;
|
|
1249
|
+
case ReferenceError$1:
|
|
1250
|
+
return ReferenceError;
|
|
1251
|
+
default:
|
|
1252
|
+
return Error;
|
|
1253
|
+
}
|
|
1254
|
+
}
|
|
1255
|
+
if (message.startsWith('TypeError: ')) {
|
|
1256
|
+
return TypeError;
|
|
1257
|
+
}
|
|
1258
|
+
if (message.startsWith('SyntaxError: ')) {
|
|
1259
|
+
return SyntaxError;
|
|
1260
|
+
}
|
|
1261
|
+
if (message.startsWith('ReferenceError: ')) {
|
|
1262
|
+
return ReferenceError;
|
|
1263
|
+
}
|
|
1264
|
+
return Error;
|
|
1003
1265
|
};
|
|
1004
|
-
const
|
|
1005
|
-
|
|
1266
|
+
const constructError = (message, type, name) => {
|
|
1267
|
+
const ErrorConstructor = getErrorConstructor(message, type);
|
|
1268
|
+
if (ErrorConstructor === DOMException && name) {
|
|
1269
|
+
return new ErrorConstructor(message, name);
|
|
1270
|
+
}
|
|
1271
|
+
if (ErrorConstructor === Error) {
|
|
1272
|
+
const error = new Error(message);
|
|
1273
|
+
if (name && name !== 'VError') {
|
|
1274
|
+
error.name = name;
|
|
1275
|
+
}
|
|
1276
|
+
return error;
|
|
1277
|
+
}
|
|
1278
|
+
return new ErrorConstructor(message);
|
|
1006
1279
|
};
|
|
1007
|
-
const
|
|
1008
|
-
|
|
1009
|
-
await invoke$2('ErrorHandling.showErrorDialog', errorInfo);
|
|
1280
|
+
const joinLines = lines => {
|
|
1281
|
+
return lines.join(NewLine);
|
|
1010
1282
|
};
|
|
1011
|
-
const
|
|
1012
|
-
|
|
1013
|
-
return await invoke$2('FileSystem.getFolderSize', uri);
|
|
1283
|
+
const splitLines = lines => {
|
|
1284
|
+
return lines.split(NewLine);
|
|
1014
1285
|
};
|
|
1015
|
-
const
|
|
1016
|
-
|
|
1017
|
-
|
|
1286
|
+
const getCurrentStack = () => {
|
|
1287
|
+
const stackLinesToSkip = 3;
|
|
1288
|
+
const currentStack = joinLines(splitLines(new Error().stack || '').slice(stackLinesToSkip));
|
|
1289
|
+
return currentStack;
|
|
1018
1290
|
};
|
|
1019
|
-
const
|
|
1020
|
-
|
|
1021
|
-
return invoke$2('Markdown.getVirtualDom', html);
|
|
1291
|
+
const getNewLineIndex = (string, startIndex = undefined) => {
|
|
1292
|
+
return string.indexOf(NewLine, startIndex);
|
|
1022
1293
|
};
|
|
1023
|
-
const
|
|
1024
|
-
|
|
1025
|
-
|
|
1294
|
+
const getParentStack = error => {
|
|
1295
|
+
let parentStack = error.stack || error.data || error.message || '';
|
|
1296
|
+
if (parentStack.startsWith(' at')) {
|
|
1297
|
+
parentStack = error.message + NewLine + parentStack;
|
|
1298
|
+
}
|
|
1299
|
+
return parentStack;
|
|
1026
1300
|
};
|
|
1027
|
-
const
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1301
|
+
const MethodNotFound = -32601;
|
|
1302
|
+
const Custom = -32001;
|
|
1303
|
+
const restoreJsonRpcError = error => {
|
|
1304
|
+
const currentStack = getCurrentStack();
|
|
1305
|
+
if (error && error instanceof Error) {
|
|
1306
|
+
if (typeof error.stack === 'string') {
|
|
1307
|
+
error.stack = error.stack + NewLine + currentStack;
|
|
1308
|
+
}
|
|
1309
|
+
return error;
|
|
1310
|
+
}
|
|
1311
|
+
if (error && error.code && error.code === MethodNotFound) {
|
|
1312
|
+
const restoredError = new JsonRpcError(error.message);
|
|
1313
|
+
const parentStack = getParentStack(error);
|
|
1314
|
+
restoredError.stack = parentStack + NewLine + currentStack;
|
|
1315
|
+
return restoredError;
|
|
1316
|
+
}
|
|
1317
|
+
if (error && error.message) {
|
|
1318
|
+
const restoredError = constructError(error.message, error.type, error.name);
|
|
1319
|
+
if (error.data) {
|
|
1320
|
+
if (error.data.stack && error.data.type && error.message) {
|
|
1321
|
+
restoredError.stack = error.data.type + ': ' + error.message + NewLine + error.data.stack + NewLine + currentStack;
|
|
1322
|
+
} else if (error.data.stack) {
|
|
1323
|
+
restoredError.stack = error.data.stack;
|
|
1324
|
+
}
|
|
1325
|
+
if (error.data.codeFrame) {
|
|
1326
|
+
// @ts-ignore
|
|
1327
|
+
restoredError.codeFrame = error.data.codeFrame;
|
|
1328
|
+
}
|
|
1329
|
+
if (error.data.code) {
|
|
1330
|
+
// @ts-ignore
|
|
1331
|
+
restoredError.code = error.data.code;
|
|
1332
|
+
}
|
|
1333
|
+
if (error.data.type) {
|
|
1334
|
+
// @ts-ignore
|
|
1335
|
+
restoredError.name = error.data.type;
|
|
1336
|
+
}
|
|
1337
|
+
} else {
|
|
1338
|
+
if (error.stack) {
|
|
1339
|
+
const lowerStack = restoredError.stack || '';
|
|
1340
|
+
// @ts-ignore
|
|
1341
|
+
const indexNewLine = getNewLineIndex(lowerStack);
|
|
1342
|
+
const parentStack = getParentStack(error);
|
|
1343
|
+
// @ts-ignore
|
|
1344
|
+
restoredError.stack = parentStack + lowerStack.slice(indexNewLine);
|
|
1345
|
+
}
|
|
1346
|
+
if (error.codeFrame) {
|
|
1347
|
+
// @ts-ignore
|
|
1348
|
+
restoredError.codeFrame = error.codeFrame;
|
|
1349
|
+
}
|
|
1350
|
+
}
|
|
1351
|
+
return restoredError;
|
|
1352
|
+
}
|
|
1353
|
+
if (typeof error === 'string') {
|
|
1354
|
+
return new Error(`JsonRpc Error: ${error}`);
|
|
1355
|
+
}
|
|
1356
|
+
return new Error(`JsonRpc Error: ${error}`);
|
|
1037
1357
|
};
|
|
1038
|
-
const
|
|
1039
|
-
|
|
1040
|
-
|
|
1358
|
+
const unwrapJsonRpcResult = responseMessage => {
|
|
1359
|
+
if ('error' in responseMessage) {
|
|
1360
|
+
const restoredError = restoreJsonRpcError(responseMessage.error);
|
|
1361
|
+
throw restoredError;
|
|
1362
|
+
}
|
|
1363
|
+
if ('result' in responseMessage) {
|
|
1364
|
+
return responseMessage.result;
|
|
1365
|
+
}
|
|
1366
|
+
throw new JsonRpcError('unexpected response message');
|
|
1041
1367
|
};
|
|
1042
|
-
const
|
|
1043
|
-
|
|
1044
|
-
return invoke$2('Extensions.handleInput', searchValue);
|
|
1368
|
+
const warn = (...args) => {
|
|
1369
|
+
console.warn(...args);
|
|
1045
1370
|
};
|
|
1046
|
-
const
|
|
1047
|
-
|
|
1048
|
-
|
|
1371
|
+
const resolve = (id, response) => {
|
|
1372
|
+
const fn = get$1(id);
|
|
1373
|
+
if (!fn) {
|
|
1374
|
+
console.log(response);
|
|
1375
|
+
warn(`callback ${id} may already be disposed`);
|
|
1376
|
+
return;
|
|
1377
|
+
}
|
|
1378
|
+
fn(response);
|
|
1379
|
+
remove$1(id);
|
|
1049
1380
|
};
|
|
1050
|
-
const
|
|
1051
|
-
|
|
1052
|
-
|
|
1381
|
+
const E_COMMAND_NOT_FOUND = 'E_COMMAND_NOT_FOUND';
|
|
1382
|
+
const getErrorType = prettyError => {
|
|
1383
|
+
if (prettyError && prettyError.type) {
|
|
1384
|
+
return prettyError.type;
|
|
1385
|
+
}
|
|
1386
|
+
if (prettyError && prettyError.constructor && prettyError.constructor.name) {
|
|
1387
|
+
return prettyError.constructor.name;
|
|
1388
|
+
}
|
|
1389
|
+
return undefined;
|
|
1053
1390
|
};
|
|
1054
|
-
const
|
|
1055
|
-
|
|
1056
|
-
return invoke$2('Preferences.getAll');
|
|
1391
|
+
const isAlreadyStack = line => {
|
|
1392
|
+
return line.trim().startsWith('at ');
|
|
1057
1393
|
};
|
|
1058
|
-
const
|
|
1059
|
-
|
|
1060
|
-
|
|
1394
|
+
const getStack = prettyError => {
|
|
1395
|
+
const stackString = prettyError.stack || '';
|
|
1396
|
+
const newLineIndex = stackString.indexOf('\n');
|
|
1397
|
+
if (newLineIndex !== -1 && !isAlreadyStack(stackString.slice(0, newLineIndex))) {
|
|
1398
|
+
return stackString.slice(newLineIndex + 1);
|
|
1399
|
+
}
|
|
1400
|
+
return stackString;
|
|
1061
1401
|
};
|
|
1062
|
-
const
|
|
1063
|
-
|
|
1064
|
-
|
|
1402
|
+
const getErrorProperty = (error, prettyError) => {
|
|
1403
|
+
if (error && error.code === E_COMMAND_NOT_FOUND) {
|
|
1404
|
+
return {
|
|
1405
|
+
code: MethodNotFound,
|
|
1406
|
+
message: error.message,
|
|
1407
|
+
data: error.stack
|
|
1408
|
+
};
|
|
1409
|
+
}
|
|
1410
|
+
return {
|
|
1411
|
+
code: Custom,
|
|
1412
|
+
message: prettyError.message,
|
|
1413
|
+
data: {
|
|
1414
|
+
stack: getStack(prettyError),
|
|
1415
|
+
codeFrame: prettyError.codeFrame,
|
|
1416
|
+
type: getErrorType(prettyError),
|
|
1417
|
+
code: prettyError.code,
|
|
1418
|
+
name: prettyError.name
|
|
1419
|
+
}
|
|
1420
|
+
};
|
|
1065
1421
|
};
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
confirm,
|
|
1073
|
-
disableExtension: disableExtension$2,
|
|
1074
|
-
dispose: dispose$2,
|
|
1075
|
-
enableExtension,
|
|
1076
|
-
getActiveEditorId,
|
|
1077
|
-
getAllExtensions: getAllExtensions$2,
|
|
1078
|
-
getAllPreferences,
|
|
1079
|
-
getBlob,
|
|
1080
|
-
getChromeVersion,
|
|
1081
|
-
getColorThemeNames,
|
|
1082
|
-
getElectronVersion,
|
|
1083
|
-
getExtension: getExtension$3,
|
|
1084
|
-
getExtensionCommands,
|
|
1085
|
-
getFileHandles,
|
|
1086
|
-
getFileIcon,
|
|
1087
|
-
getFilePathElectron,
|
|
1088
|
-
getFolderIcon,
|
|
1089
|
-
getFolderSize: getFolderSize$1,
|
|
1090
|
-
getIcons,
|
|
1091
|
-
getKeyBindings,
|
|
1092
|
-
getLogsDir,
|
|
1093
|
-
getMarkdownDom,
|
|
1094
|
-
getNodeVersion,
|
|
1095
|
-
getPreference,
|
|
1096
|
-
getRecentlyOpened,
|
|
1097
|
-
getV8Version,
|
|
1098
|
-
getWebViewSecret,
|
|
1099
|
-
getWindowId,
|
|
1100
|
-
getWorkspacePath,
|
|
1101
|
-
handleDebugChange,
|
|
1102
|
-
handleDebugPaused,
|
|
1103
|
-
handleDebugResumed,
|
|
1104
|
-
handleDebugScriptParsed,
|
|
1105
|
-
installExtension,
|
|
1106
|
-
invoke: invoke$2,
|
|
1107
|
-
invokeAndTransfer: invokeAndTransfer$1,
|
|
1108
|
-
openExtensionSearch: openExtensionSearch$2,
|
|
1109
|
-
openExternal,
|
|
1110
|
-
openNativeFolder: openNativeFolder$1,
|
|
1111
|
-
openUri,
|
|
1112
|
-
openUrl: openUrl$2,
|
|
1113
|
-
openWidget,
|
|
1114
|
-
readFile: readFile$2,
|
|
1115
|
-
registerWebViewInterceptor,
|
|
1116
|
-
renderMarkdown: renderMarkdown$1,
|
|
1117
|
-
rerenderEditor,
|
|
1118
|
-
searchFileFetch,
|
|
1119
|
-
searchFileHtml,
|
|
1120
|
-
searchFileMemory,
|
|
1121
|
-
sendMessagePortToEditorWorker,
|
|
1122
|
-
sendMessagePortToErrorWorker,
|
|
1123
|
-
sendMessagePortToExtensionHostWorker: sendMessagePortToExtensionHostWorker$2,
|
|
1124
|
-
sendMessagePortToFileSystemWorker: sendMessagePortToFileSystemWorker$2,
|
|
1125
|
-
sendMessagePortToMarkdownWorker: sendMessagePortToMarkdownWorker$2,
|
|
1126
|
-
sendMessagePortToRendererProcess,
|
|
1127
|
-
sendMessagePortToSearchProcess,
|
|
1128
|
-
sendMessagePortToSyntaxHighlightingWorker,
|
|
1129
|
-
set: set$6,
|
|
1130
|
-
setAdditionalFocus,
|
|
1131
|
-
setColorTheme: setColorTheme$2,
|
|
1132
|
-
setExtensionsSearchValue: setExtensionsSearchValue$1,
|
|
1133
|
-
setFocus,
|
|
1134
|
-
setWebViewPort,
|
|
1135
|
-
setWorkspacePath,
|
|
1136
|
-
showContextMenu: showContextMenu$1,
|
|
1137
|
-
showErrorDialog,
|
|
1138
|
-
showMessageBox,
|
|
1139
|
-
showSaveFilePicker,
|
|
1140
|
-
uninstallExtension: uninstallExtension$1,
|
|
1141
|
-
unregisterWebViewInterceptor,
|
|
1142
|
-
writeClipBoardImage: writeClipBoardImage$1,
|
|
1143
|
-
writeClipBoardText: writeClipBoardText$1
|
|
1422
|
+
const create$1$1 = (id, error) => {
|
|
1423
|
+
return {
|
|
1424
|
+
jsonrpc: Two,
|
|
1425
|
+
id,
|
|
1426
|
+
error
|
|
1427
|
+
};
|
|
1144
1428
|
};
|
|
1145
|
-
|
|
1146
|
-
const
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
const getRuntimeStatus = async extensionId => {
|
|
1152
|
-
// @ts-ignore
|
|
1153
|
-
const status = await getRuntimeStatus$1(extensionId);
|
|
1154
|
-
// @ts-ignore
|
|
1155
|
-
return status;
|
|
1429
|
+
const getErrorResponse = (id, error, preparePrettyError, logError) => {
|
|
1430
|
+
const prettyError = preparePrettyError(error);
|
|
1431
|
+
logError(error, prettyError);
|
|
1432
|
+
const errorProperty = getErrorProperty(error, prettyError);
|
|
1433
|
+
return create$1$1(id, errorProperty);
|
|
1156
1434
|
};
|
|
1157
|
-
|
|
1158
|
-
const getRuntimeStatusDetails = async extension => {
|
|
1159
|
-
const {
|
|
1160
|
-
activationEvent,
|
|
1161
|
-
status,
|
|
1162
|
-
activationTime,
|
|
1163
|
-
importTime
|
|
1164
|
-
} = await getRuntimeStatus(extension.id);
|
|
1435
|
+
const create$6 = (message, result) => {
|
|
1165
1436
|
return {
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
importTime
|
|
1437
|
+
jsonrpc: Two,
|
|
1438
|
+
id: message.id,
|
|
1439
|
+
result: result ?? null
|
|
1170
1440
|
};
|
|
1171
1441
|
};
|
|
1172
|
-
|
|
1173
|
-
const
|
|
1174
|
-
|
|
1175
|
-
return false;
|
|
1176
|
-
}
|
|
1177
|
-
if ('main' in extension || 'browser' in extension) {
|
|
1178
|
-
return true;
|
|
1179
|
-
}
|
|
1180
|
-
return false;
|
|
1181
|
-
};
|
|
1182
|
-
|
|
1183
|
-
const formatTime = time => {
|
|
1184
|
-
return time.toFixed(2) + 'ms';
|
|
1442
|
+
const getSuccessResponse = (message, result) => {
|
|
1443
|
+
const resultProperty = result ?? null;
|
|
1444
|
+
return create$6(message, resultProperty);
|
|
1185
1445
|
};
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
}
|
|
1197
|
-
type: Dd,
|
|
1198
|
-
childCount: 1
|
|
1199
|
-
}, text(formattedImportTime), {
|
|
1200
|
-
type: Dt,
|
|
1201
|
-
childCount: 1
|
|
1202
|
-
}, text(activationTime()), {
|
|
1203
|
-
type: Dd,
|
|
1204
|
-
childCount: 1
|
|
1205
|
-
}, text(formattedTime)];
|
|
1446
|
+
const getErrorResponseSimple = (id, error) => {
|
|
1447
|
+
return {
|
|
1448
|
+
jsonrpc: Two,
|
|
1449
|
+
id,
|
|
1450
|
+
error: {
|
|
1451
|
+
code: Custom,
|
|
1452
|
+
// @ts-ignore
|
|
1453
|
+
message: error.message,
|
|
1454
|
+
data: error
|
|
1455
|
+
}
|
|
1456
|
+
};
|
|
1206
1457
|
};
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
const
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
case Activated:
|
|
1217
|
-
return 'activated';
|
|
1218
|
-
case None$1:
|
|
1219
|
-
return 'none';
|
|
1220
|
-
case Activating:
|
|
1221
|
-
return 'Activating';
|
|
1222
|
-
case Error$1:
|
|
1223
|
-
return 'error';
|
|
1224
|
-
case Importing:
|
|
1225
|
-
return 'importing';
|
|
1226
|
-
default:
|
|
1227
|
-
return 'unknown';
|
|
1458
|
+
const getResponse = async (message, ipc, execute, preparePrettyError, logError, requiresSocket) => {
|
|
1459
|
+
try {
|
|
1460
|
+
const result = requiresSocket(message.method) ? await execute(message.method, ipc, ...message.params) : await execute(message.method, ...message.params);
|
|
1461
|
+
return getSuccessResponse(message, result);
|
|
1462
|
+
} catch (error) {
|
|
1463
|
+
if (ipc.canUseSimpleErrorResponse) {
|
|
1464
|
+
return getErrorResponseSimple(message.id, error);
|
|
1465
|
+
}
|
|
1466
|
+
return getErrorResponse(message.id, error, preparePrettyError, logError);
|
|
1228
1467
|
}
|
|
1229
1468
|
};
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
type: Dt,
|
|
1233
|
-
childCount: 1,
|
|
1234
|
-
className: 'RuntimeStatusDefinitionListKey'
|
|
1469
|
+
const defaultPreparePrettyError = error => {
|
|
1470
|
+
return error;
|
|
1235
1471
|
};
|
|
1236
|
-
const
|
|
1237
|
-
|
|
1238
|
-
className: 'RuntimeStatusDefinitionListValue',
|
|
1239
|
-
childCount: 1
|
|
1472
|
+
const defaultLogError = () => {
|
|
1473
|
+
// ignore
|
|
1240
1474
|
};
|
|
1241
|
-
const
|
|
1242
|
-
|
|
1243
|
-
return [key, text(`Status: `),
|
|
1244
|
-
// i18n
|
|
1245
|
-
value, text(`${statusString}`)];
|
|
1475
|
+
const defaultRequiresSocket = () => {
|
|
1476
|
+
return false;
|
|
1246
1477
|
};
|
|
1478
|
+
const defaultResolve = resolve;
|
|
1247
1479
|
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1480
|
+
// TODO maybe remove this in v6 or v7, only accept options object to simplify the code
|
|
1481
|
+
const normalizeParams = args => {
|
|
1482
|
+
if (args.length === 1) {
|
|
1483
|
+
const options = args[0];
|
|
1484
|
+
return {
|
|
1485
|
+
ipc: options.ipc,
|
|
1486
|
+
message: options.message,
|
|
1487
|
+
execute: options.execute,
|
|
1488
|
+
resolve: options.resolve || defaultResolve,
|
|
1489
|
+
preparePrettyError: options.preparePrettyError || defaultPreparePrettyError,
|
|
1490
|
+
logError: options.logError || defaultLogError,
|
|
1491
|
+
requiresSocket: options.requiresSocket || defaultRequiresSocket
|
|
1492
|
+
};
|
|
1253
1493
|
}
|
|
1254
|
-
return childCount;
|
|
1255
|
-
};
|
|
1256
|
-
const getRuntimeStatusVirtualDom = state => {
|
|
1257
|
-
const {
|
|
1258
|
-
status,
|
|
1259
|
-
activationTime,
|
|
1260
|
-
importTime
|
|
1261
|
-
} = state;
|
|
1262
|
-
const heading = runtimeStatus();
|
|
1263
|
-
const childCount = getChildCount$1(status, activationTime, importTime);
|
|
1264
|
-
return [{
|
|
1265
|
-
type: Div,
|
|
1266
|
-
className: FeatureContent,
|
|
1267
|
-
childCount: 2
|
|
1268
|
-
}, ...getFeatureContentHeadingVirtualDom(heading), {
|
|
1269
|
-
type: Dl,
|
|
1270
|
-
className: 'RuntimeStatusDefinitionList',
|
|
1271
|
-
childCount
|
|
1272
|
-
}, ...getStatusVirtualDom(status), ...getActivationTimeVirtualDom(activationTime, importTime)];
|
|
1273
|
-
};
|
|
1274
|
-
|
|
1275
|
-
const getSettingsTableEntry = setting => {
|
|
1276
|
-
const {
|
|
1277
|
-
id,
|
|
1278
|
-
label
|
|
1279
|
-
} = setting;
|
|
1280
|
-
// TODO watch out for null/undefined/number/string/array
|
|
1281
|
-
return [{
|
|
1282
|
-
type: Text,
|
|
1283
|
-
value: id
|
|
1284
|
-
}, {
|
|
1285
|
-
type: Text,
|
|
1286
|
-
value: label
|
|
1287
|
-
}];
|
|
1288
|
-
};
|
|
1289
|
-
|
|
1290
|
-
const getSettingsDetails = async extension => {
|
|
1291
|
-
const settings = extension.settings || [];
|
|
1292
|
-
const rows = settings.map(getSettingsTableEntry);
|
|
1293
1494
|
return {
|
|
1294
|
-
|
|
1495
|
+
ipc: args[0],
|
|
1496
|
+
message: args[1],
|
|
1497
|
+
execute: args[2],
|
|
1498
|
+
resolve: args[3],
|
|
1499
|
+
preparePrettyError: args[4],
|
|
1500
|
+
logError: args[5],
|
|
1501
|
+
requiresSocket: args[6]
|
|
1295
1502
|
};
|
|
1296
1503
|
};
|
|
1297
|
-
|
|
1298
|
-
const
|
|
1299
|
-
|
|
1300
|
-
|
|
1504
|
+
const handleJsonRpcMessage = async (...args) => {
|
|
1505
|
+
const options = normalizeParams(args);
|
|
1506
|
+
const {
|
|
1507
|
+
message,
|
|
1508
|
+
ipc,
|
|
1509
|
+
execute,
|
|
1510
|
+
resolve,
|
|
1511
|
+
preparePrettyError,
|
|
1512
|
+
logError,
|
|
1513
|
+
requiresSocket
|
|
1514
|
+
} = options;
|
|
1515
|
+
if ('id' in message) {
|
|
1516
|
+
if ('method' in message) {
|
|
1517
|
+
const response = await getResponse(message, ipc, execute, preparePrettyError, logError, requiresSocket);
|
|
1518
|
+
try {
|
|
1519
|
+
ipc.send(response);
|
|
1520
|
+
} catch (error) {
|
|
1521
|
+
const errorResponse = getErrorResponse(message.id, error, preparePrettyError, logError);
|
|
1522
|
+
ipc.send(errorResponse);
|
|
1523
|
+
}
|
|
1524
|
+
return;
|
|
1525
|
+
}
|
|
1526
|
+
resolve(message.id, message);
|
|
1527
|
+
return;
|
|
1301
1528
|
}
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
const textLabel = label();
|
|
1308
|
-
return {
|
|
1309
|
-
headings: [textId, textLabel],
|
|
1310
|
-
rows
|
|
1311
|
-
};
|
|
1529
|
+
if ('method' in message) {
|
|
1530
|
+
await getResponse(message, ipc, execute, preparePrettyError, logError, requiresSocket);
|
|
1531
|
+
return;
|
|
1532
|
+
}
|
|
1533
|
+
throw new JsonRpcError('unexpected message');
|
|
1312
1534
|
};
|
|
1313
|
-
|
|
1314
|
-
const
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1535
|
+
const invokeHelper = async (ipc, method, params, useSendAndTransfer) => {
|
|
1536
|
+
const {
|
|
1537
|
+
message,
|
|
1538
|
+
promise
|
|
1539
|
+
} = create$2$1(method, params);
|
|
1540
|
+
if (useSendAndTransfer && ipc.sendAndTransfer) {
|
|
1541
|
+
ipc.sendAndTransfer(message);
|
|
1542
|
+
} else {
|
|
1543
|
+
ipc.send(message);
|
|
1544
|
+
}
|
|
1545
|
+
const responseMessage = await promise;
|
|
1546
|
+
return unwrapJsonRpcResult(responseMessage);
|
|
1322
1547
|
};
|
|
1323
|
-
|
|
1324
|
-
const
|
|
1325
|
-
|
|
1548
|
+
const send = (transport, method, ...params) => {
|
|
1549
|
+
const message = create$4(method, params);
|
|
1550
|
+
transport.send(message);
|
|
1551
|
+
};
|
|
1552
|
+
const invoke$5 = (ipc, method, ...params) => {
|
|
1553
|
+
return invokeHelper(ipc, method, params, false);
|
|
1554
|
+
};
|
|
1555
|
+
const invokeAndTransfer$4 = (ipc, method, ...params) => {
|
|
1556
|
+
return invokeHelper(ipc, method, params, true);
|
|
1326
1557
|
};
|
|
1327
1558
|
|
|
1328
|
-
class
|
|
1329
|
-
constructor(
|
|
1330
|
-
super(
|
|
1331
|
-
this.name = '
|
|
1559
|
+
class CommandNotFoundError extends Error {
|
|
1560
|
+
constructor(command) {
|
|
1561
|
+
super(`Command not found ${command}`);
|
|
1562
|
+
this.name = 'CommandNotFoundError';
|
|
1332
1563
|
}
|
|
1333
1564
|
}
|
|
1334
|
-
const
|
|
1335
|
-
const
|
|
1336
|
-
|
|
1337
|
-
const String = 4;
|
|
1338
|
-
const Boolean$1 = 5;
|
|
1339
|
-
const Function = 6;
|
|
1340
|
-
const Null = 7;
|
|
1341
|
-
const Unknown = 8;
|
|
1342
|
-
const getType = value => {
|
|
1343
|
-
switch (typeof value) {
|
|
1344
|
-
case 'number':
|
|
1345
|
-
return Number$1;
|
|
1346
|
-
case 'function':
|
|
1347
|
-
return Function;
|
|
1348
|
-
case 'string':
|
|
1349
|
-
return String;
|
|
1350
|
-
case 'object':
|
|
1351
|
-
if (value === null) {
|
|
1352
|
-
return Null;
|
|
1353
|
-
}
|
|
1354
|
-
if (Array.isArray(value)) {
|
|
1355
|
-
return Array$1;
|
|
1356
|
-
}
|
|
1357
|
-
return Object$1;
|
|
1358
|
-
case 'boolean':
|
|
1359
|
-
return Boolean$1;
|
|
1360
|
-
default:
|
|
1361
|
-
return Unknown;
|
|
1362
|
-
}
|
|
1565
|
+
const commands = Object.create(null);
|
|
1566
|
+
const register = commandMap => {
|
|
1567
|
+
Object.assign(commands, commandMap);
|
|
1363
1568
|
};
|
|
1364
|
-
const
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1569
|
+
const getCommand = key => {
|
|
1570
|
+
return commands[key];
|
|
1571
|
+
};
|
|
1572
|
+
const execute = (command, ...args) => {
|
|
1573
|
+
const fn = getCommand(command);
|
|
1574
|
+
if (!fn) {
|
|
1575
|
+
throw new CommandNotFoundError(command);
|
|
1368
1576
|
}
|
|
1577
|
+
return fn(...args);
|
|
1369
1578
|
};
|
|
1370
1579
|
|
|
1371
|
-
const
|
|
1372
|
-
const
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
const Features = 'Features';
|
|
1393
|
-
const JsonValidation = 'JsonValidation';
|
|
1394
|
-
const ProgrammingLanguages = 'ProgrammingLanguages';
|
|
1395
|
-
const RuntimeStatus = 'RuntimeStatus';
|
|
1396
|
-
const ScrollToTop = 'scrolltotop';
|
|
1397
|
-
const SetColorTheme = 'SetColorTheme';
|
|
1398
|
-
const Settings = 'Settings';
|
|
1399
|
-
const Theme = 'Theme';
|
|
1400
|
-
const Uninstall = 'Uninstall';
|
|
1401
|
-
const WebViews = 'WebViews';
|
|
1402
|
-
|
|
1403
|
-
const getScrollToTopVirtualDom = scrollToTopButtonEnabled => {
|
|
1404
|
-
return [{
|
|
1405
|
-
type: Button$1,
|
|
1406
|
-
className: ScrollToTopButton,
|
|
1407
|
-
childCount: 1,
|
|
1408
|
-
onClick: HandleClickScrollToTop,
|
|
1409
|
-
ariaLabel: scrollToTop(),
|
|
1410
|
-
name: ScrollToTop
|
|
1411
|
-
}, {
|
|
1412
|
-
type: Div,
|
|
1413
|
-
className: 'MaskIcon MaskIconChevronUp',
|
|
1414
|
-
childCount: 0,
|
|
1415
|
-
role: None$2
|
|
1416
|
-
}];
|
|
1580
|
+
const createRpc = ipc => {
|
|
1581
|
+
const rpc = {
|
|
1582
|
+
// @ts-ignore
|
|
1583
|
+
ipc,
|
|
1584
|
+
/**
|
|
1585
|
+
* @deprecated
|
|
1586
|
+
*/
|
|
1587
|
+
send(method, ...params) {
|
|
1588
|
+
send(ipc, method, ...params);
|
|
1589
|
+
},
|
|
1590
|
+
invoke(method, ...params) {
|
|
1591
|
+
return invoke$5(ipc, method, ...params);
|
|
1592
|
+
},
|
|
1593
|
+
invokeAndTransfer(method, ...params) {
|
|
1594
|
+
return invokeAndTransfer$4(ipc, method, ...params);
|
|
1595
|
+
},
|
|
1596
|
+
async dispose() {
|
|
1597
|
+
await ipc?.dispose();
|
|
1598
|
+
}
|
|
1599
|
+
};
|
|
1600
|
+
return rpc;
|
|
1417
1601
|
};
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
}
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
const
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1602
|
+
const requiresSocket = () => {
|
|
1603
|
+
return false;
|
|
1604
|
+
};
|
|
1605
|
+
const preparePrettyError = error => {
|
|
1606
|
+
return error;
|
|
1607
|
+
};
|
|
1608
|
+
const logError = () => {
|
|
1609
|
+
// handled by renderer worker
|
|
1610
|
+
};
|
|
1611
|
+
const handleMessage = event => {
|
|
1612
|
+
const actualRequiresSocket = event?.target?.requiresSocket || requiresSocket;
|
|
1613
|
+
const actualExecute = event?.target?.execute || execute;
|
|
1614
|
+
return handleJsonRpcMessage(event.target, event.data, actualExecute, resolve, preparePrettyError, logError, actualRequiresSocket);
|
|
1615
|
+
};
|
|
1616
|
+
const handleIpc = ipc => {
|
|
1617
|
+
if ('addEventListener' in ipc) {
|
|
1618
|
+
ipc.addEventListener('message', handleMessage);
|
|
1619
|
+
} else if ('on' in ipc) {
|
|
1620
|
+
// deprecated
|
|
1621
|
+
ipc.on('message', handleMessage);
|
|
1434
1622
|
}
|
|
1435
|
-
return newDom;
|
|
1436
1623
|
};
|
|
1437
|
-
|
|
1438
|
-
const
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
markdown += `### ${heading}`;
|
|
1442
|
-
markdown += '\n\n';
|
|
1443
|
-
for (const item of items) {
|
|
1444
|
-
markdown += `- ${item.label}`;
|
|
1445
|
-
markdown += '\n';
|
|
1446
|
-
}
|
|
1624
|
+
const listen$1 = async (module, options) => {
|
|
1625
|
+
const rawIpc = await module.listen(options);
|
|
1626
|
+
if (module.signal) {
|
|
1627
|
+
module.signal(rawIpc);
|
|
1447
1628
|
}
|
|
1448
|
-
|
|
1629
|
+
const ipc = module.wrap(rawIpc);
|
|
1630
|
+
return ipc;
|
|
1449
1631
|
};
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1632
|
+
const create$5 = async ({
|
|
1633
|
+
commandMap,
|
|
1634
|
+
messagePort
|
|
1635
|
+
}) => {
|
|
1636
|
+
// TODO create a commandMap per rpc instance
|
|
1637
|
+
register(commandMap);
|
|
1638
|
+
const rawIpc = await IpcParentWithMessagePort$1.create({
|
|
1639
|
+
messagePort,
|
|
1640
|
+
isMessagePortOpen: true
|
|
1641
|
+
});
|
|
1642
|
+
const ipc = IpcParentWithMessagePort$1.wrap(rawIpc);
|
|
1643
|
+
handleIpc(ipc);
|
|
1644
|
+
const rpc = createRpc(ipc);
|
|
1645
|
+
messagePort.start();
|
|
1646
|
+
return rpc;
|
|
1454
1647
|
};
|
|
1455
|
-
const
|
|
1456
|
-
|
|
1457
|
-
|
|
1648
|
+
const create$3 = async ({
|
|
1649
|
+
commandMap,
|
|
1650
|
+
send
|
|
1651
|
+
}) => {
|
|
1652
|
+
const {
|
|
1653
|
+
port1,
|
|
1654
|
+
port2
|
|
1655
|
+
} = new MessageChannel();
|
|
1656
|
+
await send(port1);
|
|
1657
|
+
return create$5({
|
|
1658
|
+
commandMap,
|
|
1659
|
+
messagePort: port2
|
|
1660
|
+
});
|
|
1458
1661
|
};
|
|
1459
|
-
const
|
|
1460
|
-
|
|
1461
|
-
|
|
1662
|
+
const TransferMessagePortRpcParent = {
|
|
1663
|
+
__proto__: null,
|
|
1664
|
+
create: create$3
|
|
1462
1665
|
};
|
|
1463
|
-
const
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1666
|
+
const create$2 = async ({
|
|
1667
|
+
commandMap
|
|
1668
|
+
}) => {
|
|
1669
|
+
// TODO create a commandMap per rpc instance
|
|
1670
|
+
register(commandMap);
|
|
1671
|
+
const ipc = await listen$1(IpcChildWithModuleWorkerAndMessagePort$1);
|
|
1672
|
+
handleIpc(ipc);
|
|
1673
|
+
const rpc = createRpc(ipc);
|
|
1674
|
+
return rpc;
|
|
1675
|
+
};
|
|
1676
|
+
const WebWorkerRpcClient = {
|
|
1677
|
+
__proto__: null,
|
|
1678
|
+
create: create$2
|
|
1679
|
+
};
|
|
1680
|
+
const createMockRpc = ({
|
|
1681
|
+
commandMap
|
|
1682
|
+
}) => {
|
|
1683
|
+
const invocations = [];
|
|
1684
|
+
const invoke = (method, ...params) => {
|
|
1685
|
+
invocations.push([method, ...params]);
|
|
1686
|
+
const command = commandMap[method];
|
|
1687
|
+
if (!command) {
|
|
1688
|
+
throw new Error(`command ${method} not found`);
|
|
1689
|
+
}
|
|
1690
|
+
return command(...params);
|
|
1691
|
+
};
|
|
1692
|
+
const mockRpc = {
|
|
1693
|
+
invoke,
|
|
1694
|
+
invokeAndTransfer: invoke,
|
|
1695
|
+
invocations
|
|
1696
|
+
};
|
|
1697
|
+
return mockRpc;
|
|
1698
|
+
};
|
|
1699
|
+
|
|
1700
|
+
const {
|
|
1701
|
+
invoke: invoke$4,
|
|
1702
|
+
invokeAndTransfer: invokeAndTransfer$3,
|
|
1703
|
+
set: set$8,
|
|
1704
|
+
dispose: dispose$5
|
|
1705
|
+
} = create$7(ExtensionHostWorker);
|
|
1706
|
+
const executeReferenceProvider = async (id, offset) => {
|
|
1707
|
+
// @ts-ignore
|
|
1708
|
+
return invoke$4('ExtensionHostReference.executeReferenceProvider', id, offset);
|
|
1469
1709
|
};
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
return html;
|
|
1710
|
+
const executeFileReferenceProvider = async id => {
|
|
1711
|
+
// @ts-ignore
|
|
1712
|
+
return invoke$4('ExtensionHostReference.executeFileReferenceProvider', id);
|
|
1474
1713
|
};
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
const markdown = getThemeMarkdown(colorThemes || [], iconThemes || [], productIconThemes || []);
|
|
1483
|
-
const rendered = await renderMarkdown(markdown, {
|
|
1484
|
-
baseUrl
|
|
1714
|
+
const getRuntimeStatus$2 = async extensionId => {
|
|
1715
|
+
// @ts-ignore
|
|
1716
|
+
return invoke$4('ExtensionHost.getRuntimeStatus', extensionId);
|
|
1717
|
+
};
|
|
1718
|
+
const registerMockRpc$1 = commandMap => {
|
|
1719
|
+
const mockRpc = createMockRpc({
|
|
1720
|
+
commandMap
|
|
1485
1721
|
});
|
|
1486
|
-
|
|
1487
|
-
return
|
|
1488
|
-
themesMarkdownDom
|
|
1489
|
-
};
|
|
1722
|
+
set$8(mockRpc);
|
|
1723
|
+
return mockRpc;
|
|
1490
1724
|
};
|
|
1491
1725
|
|
|
1492
|
-
const
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1726
|
+
const ExtensionHost = {
|
|
1727
|
+
__proto__: null,
|
|
1728
|
+
dispose: dispose$5,
|
|
1729
|
+
executeFileReferenceProvider,
|
|
1730
|
+
executeReferenceProvider,
|
|
1731
|
+
getRuntimeStatus: getRuntimeStatus$2,
|
|
1732
|
+
invoke: invoke$4,
|
|
1733
|
+
invokeAndTransfer: invokeAndTransfer$3,
|
|
1734
|
+
registerMockRpc: registerMockRpc$1,
|
|
1735
|
+
set: set$8
|
|
1497
1736
|
};
|
|
1498
1737
|
|
|
1499
|
-
const
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1738
|
+
const {
|
|
1739
|
+
invoke: invoke$3,
|
|
1740
|
+
invokeAndTransfer: invokeAndTransfer$2,
|
|
1741
|
+
set: set$7,
|
|
1742
|
+
dispose: dispose$4
|
|
1743
|
+
} = create$7(FileSystemWorker$1);
|
|
1744
|
+
const remove = async dirent => {
|
|
1745
|
+
return invoke$3('FileSystem.remove', dirent);
|
|
1504
1746
|
};
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
if (!extension || typeof extension !== 'object' || !('productIconThemes' in extension)) {
|
|
1508
|
-
return false;
|
|
1509
|
-
}
|
|
1510
|
-
return Array.isArray(extension.productIconThemes);
|
|
1747
|
+
const readDirWithFileTypes = async uri => {
|
|
1748
|
+
return invoke$3('FileSystem.readDirWithFileTypes', uri);
|
|
1511
1749
|
};
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
return
|
|
1750
|
+
const getPathSeparator = async root => {
|
|
1751
|
+
// @ts-ignore
|
|
1752
|
+
return invoke$3('FileSystem.getPathSeparator', root);
|
|
1515
1753
|
};
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
const max = dom.length - 1;
|
|
1519
|
-
let stack = [];
|
|
1520
|
-
for (let i = max; i >= 0; i--) {
|
|
1521
|
-
const element = dom[i];
|
|
1522
|
-
if (element.childCount > 0) {
|
|
1523
|
-
stack = stack.slice(element.childCount);
|
|
1524
|
-
}
|
|
1525
|
-
stack.unshift(element);
|
|
1526
|
-
}
|
|
1527
|
-
return stack.length;
|
|
1754
|
+
const getRealPath = async path => {
|
|
1755
|
+
return invoke$3('FileSystem.getRealPath', path);
|
|
1528
1756
|
};
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
const childCount = getVirtualDomChildCount(themesDom);
|
|
1532
|
-
const heading = theme();
|
|
1533
|
-
return [{
|
|
1534
|
-
type: Div,
|
|
1535
|
-
className: FeatureContent,
|
|
1536
|
-
childCount: 2
|
|
1537
|
-
}, ...getFeatureContentHeadingVirtualDom(heading), {
|
|
1538
|
-
type: Div,
|
|
1539
|
-
className: DefaultMarkdown,
|
|
1540
|
-
childCount
|
|
1541
|
-
}, ...themesDom];
|
|
1757
|
+
const stat = async dirent => {
|
|
1758
|
+
return invoke$3('FileSystem.stat', dirent);
|
|
1542
1759
|
};
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
return getFeatureThemesVirtualDom(state.themesMarkdownDom);
|
|
1760
|
+
const createFile = async uri => {
|
|
1761
|
+
return invoke$3('FileSystem.writeFile', uri, '');
|
|
1546
1762
|
};
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
const {
|
|
1550
|
-
id,
|
|
1551
|
-
selector,
|
|
1552
|
-
contentSecurityPolicy,
|
|
1553
|
-
elements
|
|
1554
|
-
} = rawWebView;
|
|
1555
|
-
return {
|
|
1556
|
-
id,
|
|
1557
|
-
selectorString: JSON.stringify(selector),
|
|
1558
|
-
contentSecurityPolicyString: JSON.stringify(contentSecurityPolicy),
|
|
1559
|
-
elementsString: JSON.stringify(elements, null, 2)
|
|
1560
|
-
};
|
|
1763
|
+
const readFile$3 = async uri => {
|
|
1764
|
+
return invoke$3('FileSystem.readFile', uri);
|
|
1561
1765
|
};
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
const rawWebViews = extension.webViews || [];
|
|
1565
|
-
return rawWebViews.map(toWebView);
|
|
1766
|
+
const writeFile = async (uri, content) => {
|
|
1767
|
+
return invoke$3('FileSystem.writeFile', uri, content);
|
|
1566
1768
|
};
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
const webViews = getWebViews(extension);
|
|
1570
|
-
return {
|
|
1571
|
-
webViews
|
|
1572
|
-
};
|
|
1769
|
+
const mkdir = async uri => {
|
|
1770
|
+
return invoke$3('FileSystem.mkdir', uri);
|
|
1573
1771
|
};
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
if (!extension || typeof extension !== 'object' || !('webViews' in extension)) {
|
|
1577
|
-
return false;
|
|
1578
|
-
}
|
|
1579
|
-
return Array.isArray(extension.webViews);
|
|
1772
|
+
const rename = async (oldUri, newUri) => {
|
|
1773
|
+
return invoke$3('FileSystem.rename', oldUri, newUri);
|
|
1580
1774
|
};
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
type: H2,
|
|
1584
|
-
className: DefinitionListItemHeading,
|
|
1585
|
-
childCount: 1
|
|
1775
|
+
const copy = async (oldUri, newUri) => {
|
|
1776
|
+
return invoke$3('FileSystem.copy', oldUri, newUri);
|
|
1586
1777
|
};
|
|
1587
|
-
const
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
childCount: 1
|
|
1778
|
+
const exists$1 = async uri => {
|
|
1779
|
+
// @ts-ignore
|
|
1780
|
+
return invoke$3('FileSystem.exists', uri);
|
|
1591
1781
|
};
|
|
1592
|
-
const
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
childCount: 2
|
|
1782
|
+
const getFolderSize$2 = async uri => {
|
|
1783
|
+
// @ts-ignore
|
|
1784
|
+
return invoke$3('FileSystem.getFolderSize', uri);
|
|
1596
1785
|
};
|
|
1597
|
-
const
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
selectorString,
|
|
1601
|
-
contentSecurityPolicyString,
|
|
1602
|
-
elementsString
|
|
1603
|
-
} = webView;
|
|
1604
|
-
const textId = id$1();
|
|
1605
|
-
const textSelector = selector();
|
|
1606
|
-
const textContentSecurityPolicy = contentSecurityPolicy();
|
|
1607
|
-
const textElements = elements();
|
|
1608
|
-
return [{
|
|
1609
|
-
type: Div,
|
|
1610
|
-
className: FeatureWebView,
|
|
1611
|
-
childCount: 5
|
|
1612
|
-
}, item, heading, text(textId), pre, text(id), item, heading, text(textSelector), pre, text(selectorString), item, heading, text(textContentSecurityPolicy), pre, text(contentSecurityPolicyString), item, heading, text(textElements), pre, text(elementsString)];
|
|
1786
|
+
const readFileAsBlob$1 = async uri => {
|
|
1787
|
+
// @ts-ignore
|
|
1788
|
+
return invoke$3('FileSystem.readFileAsBlob', uri);
|
|
1613
1789
|
};
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
return [{
|
|
1618
|
-
type: Div,
|
|
1619
|
-
className: FeatureContent,
|
|
1620
|
-
childCount: 2
|
|
1621
|
-
}, ...getFeatureContentHeadingVirtualDom(heading), {
|
|
1622
|
-
type: Div,
|
|
1623
|
-
childCount: webViews$1.length
|
|
1624
|
-
}, ...webViews$1.flatMap(getWebViewVirtualDom)];
|
|
1790
|
+
const appendFile = async (uri, text) => {
|
|
1791
|
+
// @ts-ignore
|
|
1792
|
+
return invoke$3('FileSystem.appendFile', uri, text);
|
|
1625
1793
|
};
|
|
1626
1794
|
|
|
1627
|
-
const
|
|
1628
|
-
|
|
1795
|
+
const FileSystemWorker = {
|
|
1796
|
+
__proto__: null,
|
|
1797
|
+
appendFile,
|
|
1798
|
+
copy,
|
|
1799
|
+
createFile,
|
|
1800
|
+
dispose: dispose$4,
|
|
1801
|
+
exists: exists$1,
|
|
1802
|
+
getFolderSize: getFolderSize$2,
|
|
1803
|
+
getPathSeparator,
|
|
1804
|
+
getRealPath,
|
|
1805
|
+
invoke: invoke$3,
|
|
1806
|
+
invokeAndTransfer: invokeAndTransfer$2,
|
|
1807
|
+
mkdir,
|
|
1808
|
+
readDirWithFileTypes,
|
|
1809
|
+
readFile: readFile$3,
|
|
1810
|
+
readFileAsBlob: readFileAsBlob$1,
|
|
1811
|
+
remove,
|
|
1812
|
+
rename,
|
|
1813
|
+
set: set$7,
|
|
1814
|
+
stat,
|
|
1815
|
+
writeFile
|
|
1629
1816
|
};
|
|
1630
1817
|
|
|
1631
|
-
const
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
getVirtualDom: getCommandsVirtualDom
|
|
1645
|
-
});
|
|
1646
|
-
register$1({
|
|
1647
|
-
id: Settings,
|
|
1648
|
-
getLabel: settings,
|
|
1649
|
-
isEnabled: featureSettingsEnabled,
|
|
1650
|
-
getDetails: getSettingsDetails,
|
|
1651
|
-
getVirtualDom: getSettingsVirtualDom
|
|
1652
|
-
});
|
|
1653
|
-
register$1({
|
|
1654
|
-
id: JsonValidation,
|
|
1655
|
-
getLabel: jsonValidation,
|
|
1656
|
-
isEnabled: featureJsonValidationEnabled,
|
|
1657
|
-
getDetails: getJsonValidationDetails,
|
|
1658
|
-
getVirtualDom: getJsonValidationVirtualDom
|
|
1659
|
-
});
|
|
1660
|
-
register$1({
|
|
1661
|
-
id: ProgrammingLanguages,
|
|
1662
|
-
getLabel: programmingLanguages,
|
|
1663
|
-
isEnabled: featureProgrammingLanguagesEnabled,
|
|
1664
|
-
getDetails: getProgrammingLanguagesDetails,
|
|
1665
|
-
getVirtualDom: getProgrammingLanguagesVirtualDom
|
|
1666
|
-
});
|
|
1667
|
-
register$1({
|
|
1668
|
-
id: WebViews,
|
|
1669
|
-
getLabel: webViews,
|
|
1670
|
-
isEnabled: featureWebViewsEnabled,
|
|
1671
|
-
getDetails: getWebViewsDetails,
|
|
1672
|
-
getVirtualDom: getWebViewsVirtualDom
|
|
1673
|
-
});
|
|
1674
|
-
register$1({
|
|
1675
|
-
id: ActivationEvents,
|
|
1676
|
-
getLabel: activationEvents,
|
|
1677
|
-
isEnabled: featureActivationEventsEnabled,
|
|
1678
|
-
getDetails: getActivationEventsDetails,
|
|
1679
|
-
getVirtualDom: getActivationEventsVirtualDom
|
|
1680
|
-
});
|
|
1681
|
-
register$1({
|
|
1682
|
-
id: RuntimeStatus,
|
|
1683
|
-
getLabel: runtimeStatus,
|
|
1684
|
-
isEnabled: featureRuntimeStatusEnabled,
|
|
1685
|
-
getDetails: getRuntimeStatusDetails,
|
|
1686
|
-
getVirtualDom: getRuntimeStatusVirtualDom
|
|
1687
|
-
});
|
|
1818
|
+
const {
|
|
1819
|
+
invoke: invoke$2,
|
|
1820
|
+
invokeAndTransfer: invokeAndTransfer$1,
|
|
1821
|
+
set: set$6,
|
|
1822
|
+
dispose: dispose$3
|
|
1823
|
+
} = create$7(MarkdownWorker$1);
|
|
1824
|
+
const getVirtualDom$1 = async html => {
|
|
1825
|
+
// @ts-ignore
|
|
1826
|
+
return invoke$2('Markdown.getVirtualDom', html);
|
|
1827
|
+
};
|
|
1828
|
+
const render$1 = async (markdown, options) => {
|
|
1829
|
+
// @ts-ignore
|
|
1830
|
+
return invoke$2('Markdown.render', markdown, options);
|
|
1688
1831
|
};
|
|
1689
1832
|
|
|
1690
|
-
const
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1833
|
+
const MarkdownWorker = {
|
|
1834
|
+
__proto__: null,
|
|
1835
|
+
dispose: dispose$3,
|
|
1836
|
+
getVirtualDom: getVirtualDom$1,
|
|
1837
|
+
invoke: invoke$2,
|
|
1838
|
+
invokeAndTransfer: invokeAndTransfer$1,
|
|
1839
|
+
render: render$1,
|
|
1840
|
+
set: set$6
|
|
1698
1841
|
};
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1842
|
+
|
|
1843
|
+
const {
|
|
1844
|
+
invoke: invoke$1,
|
|
1845
|
+
invokeAndTransfer,
|
|
1846
|
+
set: set$5,
|
|
1847
|
+
dispose: dispose$2
|
|
1848
|
+
} = create$7(RendererWorker$1);
|
|
1849
|
+
const searchFileHtml = async uri => {
|
|
1850
|
+
return invoke$1('ExtensionHost.searchFileWithHtml', uri);
|
|
1705
1851
|
};
|
|
1706
|
-
const
|
|
1707
|
-
|
|
1708
|
-
return string.indexOf(NewLine$2, startIndex);
|
|
1852
|
+
const getFilePathElectron = async file => {
|
|
1853
|
+
return invoke$1('FileSystemHandle.getFilePathElectron', file);
|
|
1709
1854
|
};
|
|
1710
|
-
const
|
|
1711
|
-
|
|
1712
|
-
return parent;
|
|
1713
|
-
}
|
|
1714
|
-
const parentNewLineIndex = getNewLineIndex$1(parent);
|
|
1715
|
-
const childNewLineIndex = getNewLineIndex$1(child);
|
|
1716
|
-
if (childNewLineIndex === -1) {
|
|
1717
|
-
return parent;
|
|
1718
|
-
}
|
|
1719
|
-
const parentFirstLine = parent.slice(0, parentNewLineIndex);
|
|
1720
|
-
const childRest = child.slice(childNewLineIndex);
|
|
1721
|
-
const childFirstLine = normalizeLine(child.slice(0, childNewLineIndex));
|
|
1722
|
-
if (parentFirstLine.includes(childFirstLine)) {
|
|
1723
|
-
return parentFirstLine + childRest;
|
|
1724
|
-
}
|
|
1725
|
-
return child;
|
|
1855
|
+
const showContextMenu$1 = async (x, y, id, ...args) => {
|
|
1856
|
+
return invoke$1('ContextMenu.show', x, y, id, ...args);
|
|
1726
1857
|
};
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
const combinedMessage = getCombinedMessage(error, message);
|
|
1730
|
-
super(combinedMessage);
|
|
1731
|
-
this.name = 'VError';
|
|
1732
|
-
if (error instanceof Error) {
|
|
1733
|
-
this.stack = mergeStacks(this.stack, error.stack);
|
|
1734
|
-
}
|
|
1735
|
-
if (error.codeFrame) {
|
|
1736
|
-
// @ts-ignore
|
|
1737
|
-
this.codeFrame = error.codeFrame;
|
|
1738
|
-
}
|
|
1739
|
-
if (error.code) {
|
|
1740
|
-
// @ts-ignore
|
|
1741
|
-
this.code = error.code;
|
|
1742
|
-
}
|
|
1743
|
-
}
|
|
1744
|
-
}
|
|
1745
|
-
|
|
1746
|
-
const isMessagePort = value => {
|
|
1747
|
-
return value && value instanceof MessagePort;
|
|
1858
|
+
const getElectronVersion = async () => {
|
|
1859
|
+
return invoke$1('Process.getElectronVersion');
|
|
1748
1860
|
};
|
|
1749
|
-
const
|
|
1750
|
-
|
|
1861
|
+
const applyBulkReplacement = async bulkEdits => {
|
|
1862
|
+
await invoke$1('BulkReplacement.applyBulkReplacement', bulkEdits);
|
|
1751
1863
|
};
|
|
1752
|
-
const
|
|
1753
|
-
|
|
1864
|
+
const setColorTheme$2 = async id => {
|
|
1865
|
+
// @ts-ignore
|
|
1866
|
+
return invoke$1(/* ColorTheme.setColorTheme */'ColorTheme.setColorTheme', /* colorThemeId */id);
|
|
1754
1867
|
};
|
|
1755
|
-
const
|
|
1756
|
-
return
|
|
1868
|
+
const getNodeVersion = async () => {
|
|
1869
|
+
return invoke$1('Process.getNodeVersion');
|
|
1757
1870
|
};
|
|
1758
|
-
const
|
|
1759
|
-
return
|
|
1871
|
+
const getChromeVersion = async () => {
|
|
1872
|
+
return invoke$1('Process.getChromeVersion');
|
|
1760
1873
|
};
|
|
1761
|
-
const
|
|
1762
|
-
|
|
1763
|
-
for (const fn of transferrables) {
|
|
1764
|
-
if (fn(value)) {
|
|
1765
|
-
return true;
|
|
1766
|
-
}
|
|
1767
|
-
}
|
|
1768
|
-
return false;
|
|
1874
|
+
const getV8Version = async () => {
|
|
1875
|
+
return invoke$1('Process.getV8Version');
|
|
1769
1876
|
};
|
|
1770
|
-
const
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
}
|
|
1774
|
-
if (isTransferrable(value)) {
|
|
1775
|
-
transferrables.push(value);
|
|
1776
|
-
return;
|
|
1777
|
-
}
|
|
1778
|
-
if (Array.isArray(value)) {
|
|
1779
|
-
for (const item of value) {
|
|
1780
|
-
walkValue(item, transferrables, isTransferrable);
|
|
1781
|
-
}
|
|
1782
|
-
return;
|
|
1783
|
-
}
|
|
1784
|
-
if (typeof value === 'object') {
|
|
1785
|
-
for (const property of Object.values(value)) {
|
|
1786
|
-
walkValue(property, transferrables, isTransferrable);
|
|
1787
|
-
}
|
|
1788
|
-
return;
|
|
1789
|
-
}
|
|
1877
|
+
const getFileHandles = async fileIds => {
|
|
1878
|
+
const files = await invoke$1('FileSystemHandle.getFileHandles', fileIds);
|
|
1879
|
+
return files;
|
|
1790
1880
|
};
|
|
1791
|
-
const
|
|
1792
|
-
|
|
1793
|
-
walkValue(value, transferrables, isTransferrable);
|
|
1794
|
-
return transferrables;
|
|
1881
|
+
const setWorkspacePath = async path => {
|
|
1882
|
+
await invoke$1('Workspace.setPath', path);
|
|
1795
1883
|
};
|
|
1796
|
-
const
|
|
1797
|
-
|
|
1798
|
-
const data = that.getData(...args);
|
|
1799
|
-
that.dispatchEvent(new MessageEvent('message', {
|
|
1800
|
-
data
|
|
1801
|
-
}));
|
|
1802
|
-
};
|
|
1803
|
-
that.onMessage(handleMessage);
|
|
1804
|
-
const handleClose = event => {
|
|
1805
|
-
that.dispatchEvent(new Event('close'));
|
|
1806
|
-
};
|
|
1807
|
-
that.onClose(handleClose);
|
|
1884
|
+
const registerWebViewInterceptor = async (id, port) => {
|
|
1885
|
+
await invokeAndTransfer('WebView.registerInterceptor', id, port);
|
|
1808
1886
|
};
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
super();
|
|
1812
|
-
this._rawIpc = rawIpc;
|
|
1813
|
-
attachEvents(this);
|
|
1814
|
-
}
|
|
1815
|
-
}
|
|
1816
|
-
const E_INCOMPATIBLE_NATIVE_MODULE = 'E_INCOMPATIBLE_NATIVE_MODULE';
|
|
1817
|
-
const E_MODULES_NOT_SUPPORTED_IN_ELECTRON = 'E_MODULES_NOT_SUPPORTED_IN_ELECTRON';
|
|
1818
|
-
const ERR_MODULE_NOT_FOUND = 'ERR_MODULE_NOT_FOUND';
|
|
1819
|
-
const NewLine$1 = '\n';
|
|
1820
|
-
const joinLines$1 = lines => {
|
|
1821
|
-
return lines.join(NewLine$1);
|
|
1887
|
+
const unregisterWebViewInterceptor = async id => {
|
|
1888
|
+
await invoke$1('WebView.unregisterInterceptor', id);
|
|
1822
1889
|
};
|
|
1823
|
-
const
|
|
1824
|
-
const
|
|
1825
|
-
|
|
1826
|
-
|
|
1890
|
+
const sendMessagePortToEditorWorker = async (port, rpcId) => {
|
|
1891
|
+
const command = 'HandleMessagePort.handleMessagePort';
|
|
1892
|
+
// @ts-ignore
|
|
1893
|
+
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToEditorWorker', port, command, rpcId);
|
|
1827
1894
|
};
|
|
1828
|
-
const
|
|
1829
|
-
const
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
actualMessage: joinLines$1(lines),
|
|
1833
|
-
rest: []
|
|
1834
|
-
};
|
|
1835
|
-
}
|
|
1836
|
-
let lastIndex = index - 1;
|
|
1837
|
-
while (++lastIndex < lines.length) {
|
|
1838
|
-
if (!isNormalStackLine(lines[lastIndex])) {
|
|
1839
|
-
break;
|
|
1840
|
-
}
|
|
1841
|
-
}
|
|
1842
|
-
return {
|
|
1843
|
-
actualMessage: lines[index - 1],
|
|
1844
|
-
rest: lines.slice(index, lastIndex)
|
|
1845
|
-
};
|
|
1895
|
+
const sendMessagePortToErrorWorker = async (port, rpcId) => {
|
|
1896
|
+
const command = 'Errors.handleMessagePort';
|
|
1897
|
+
// @ts-ignore
|
|
1898
|
+
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToErrorWorker', port, command, rpcId);
|
|
1846
1899
|
};
|
|
1847
|
-
const
|
|
1848
|
-
|
|
1900
|
+
const sendMessagePortToMarkdownWorker$2 = async (port, rpcId) => {
|
|
1901
|
+
const command = 'Markdown.handleMessagePort';
|
|
1902
|
+
// @ts-ignore
|
|
1903
|
+
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToMarkdownWorker', port, command, rpcId);
|
|
1849
1904
|
};
|
|
1850
|
-
const
|
|
1851
|
-
const
|
|
1852
|
-
|
|
1853
|
-
|
|
1905
|
+
const sendMessagePortToIconThemeWorker = async (port, rpcId) => {
|
|
1906
|
+
const command = 'IconTheme.handleMessagePort';
|
|
1907
|
+
// @ts-ignore
|
|
1908
|
+
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToIconThemeWorker', port, command, rpcId);
|
|
1854
1909
|
};
|
|
1855
|
-
const
|
|
1856
|
-
|
|
1910
|
+
const sendMessagePortToFileSystemWorker$2 = async (port, rpcId) => {
|
|
1911
|
+
const command = 'FileSystem.handleMessagePort';
|
|
1912
|
+
// @ts-ignore
|
|
1913
|
+
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToFileSystemWorker', port, command, rpcId);
|
|
1857
1914
|
};
|
|
1858
|
-
const
|
|
1859
|
-
|
|
1860
|
-
const startIndex = lines.findIndex(isMessageCodeBlockStartIndex);
|
|
1861
|
-
const endIndex = startIndex + lines.slice(startIndex).findIndex(isMessageCodeBlockEndIndex, startIndex);
|
|
1862
|
-
const relevantLines = lines.slice(startIndex, endIndex);
|
|
1863
|
-
const relevantMessage = relevantLines.join(' ').slice('Error: '.length);
|
|
1864
|
-
return relevantMessage;
|
|
1915
|
+
const readFile$2 = async uri => {
|
|
1916
|
+
return invoke$1('FileSystem.readFile', uri);
|
|
1865
1917
|
};
|
|
1866
|
-
const
|
|
1867
|
-
|
|
1918
|
+
const getWebViewSecret = async key => {
|
|
1919
|
+
// @ts-ignore
|
|
1920
|
+
return invoke$1('WebView.getSecret', key);
|
|
1868
1921
|
};
|
|
1869
|
-
const
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
return
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1922
|
+
const setWebViewPort = async (uid, port, origin, portType) => {
|
|
1923
|
+
return invokeAndTransfer('WebView.setPort', uid, port, origin, portType);
|
|
1924
|
+
};
|
|
1925
|
+
const setFocus = key => {
|
|
1926
|
+
return invoke$1('Focus.setFocus', key);
|
|
1927
|
+
};
|
|
1928
|
+
const getFileIcon = async options => {
|
|
1929
|
+
return invoke$1('IconTheme.getFileIcon', options);
|
|
1930
|
+
};
|
|
1931
|
+
const getColorThemeNames = async () => {
|
|
1932
|
+
return invoke$1('ColorTheme.getColorThemeNames');
|
|
1933
|
+
};
|
|
1934
|
+
const disableExtension$2 = async id => {
|
|
1935
|
+
// @ts-ignore
|
|
1936
|
+
return invoke$1('ExtensionManagement.disable', id);
|
|
1937
|
+
};
|
|
1938
|
+
const enableExtension$2 = async id => {
|
|
1939
|
+
// @ts-ignore
|
|
1940
|
+
return invoke$1('ExtensionManagement.enable', id);
|
|
1941
|
+
};
|
|
1942
|
+
const handleDebugChange = async params => {
|
|
1943
|
+
// @ts-ignore
|
|
1944
|
+
return invoke$1('Run And Debug.handleChange', params);
|
|
1945
|
+
};
|
|
1946
|
+
const getFolderIcon = async options => {
|
|
1947
|
+
return invoke$1('IconTheme.getFolderIcon', options);
|
|
1948
|
+
};
|
|
1949
|
+
const closeWidget = async widgetId => {
|
|
1950
|
+
return invoke$1('Viewlet.closeWidget', widgetId);
|
|
1951
|
+
};
|
|
1952
|
+
const sendMessagePortToExtensionHostWorker$2 = async (port, rpcId = 0) => {
|
|
1953
|
+
const command = 'HandleMessagePort.handleMessagePort2';
|
|
1954
|
+
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToExtensionHostWorker', port, command, rpcId);
|
|
1955
|
+
};
|
|
1956
|
+
const sendMessagePortToSearchProcess = async port => {
|
|
1957
|
+
await invokeAndTransfer('SendMessagePortToElectron.sendMessagePortToElectron', port, 'HandleMessagePortForSearchProcess.handleMessagePortForSearchProcess');
|
|
1958
|
+
};
|
|
1959
|
+
const confirm = async (message, options) => {
|
|
1960
|
+
// @ts-ignore
|
|
1961
|
+
const result = await invoke$1('ConfirmPrompt.prompt', message, options);
|
|
1962
|
+
return result;
|
|
1963
|
+
};
|
|
1964
|
+
const getRecentlyOpened = async () => {
|
|
1965
|
+
return invoke$1(/* RecentlyOpened.getRecentlyOpened */'RecentlyOpened.getRecentlyOpened');
|
|
1966
|
+
};
|
|
1967
|
+
const getKeyBindings = async () => {
|
|
1968
|
+
return invoke$1('KeyBindingsInitial.getKeyBindings');
|
|
1969
|
+
};
|
|
1970
|
+
const writeClipBoardText$1 = async text => {
|
|
1971
|
+
await invoke$1('ClipBoard.writeText', /* text */text);
|
|
1972
|
+
};
|
|
1973
|
+
const writeClipBoardImage$1 = async blob => {
|
|
1974
|
+
// @ts-ignore
|
|
1975
|
+
await invoke$1('ClipBoard.writeImage', /* text */blob);
|
|
1877
1976
|
};
|
|
1878
|
-
const
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
}
|
|
1882
|
-
return stderr.includes('ERR_MODULE_NOT_FOUND');
|
|
1977
|
+
const searchFileMemory = async uri => {
|
|
1978
|
+
// @ts-ignore
|
|
1979
|
+
return invoke$1('ExtensionHost.searchFileWithMemory', uri);
|
|
1883
1980
|
};
|
|
1884
|
-
const
|
|
1885
|
-
|
|
1886
|
-
return false;
|
|
1887
|
-
}
|
|
1888
|
-
return stderr.includes('SyntaxError: Cannot use import statement outside a module');
|
|
1981
|
+
const searchFileFetch = async uri => {
|
|
1982
|
+
return invoke$1('ExtensionHost.searchFileWithFetch', uri);
|
|
1889
1983
|
};
|
|
1890
|
-
const
|
|
1891
|
-
|
|
1892
|
-
const isUnhelpfulNativeModuleError = stderr => {
|
|
1893
|
-
return RE_NATIVE_MODULE_ERROR.test(stderr) && RE_NATIVE_MODULE_ERROR_2.test(stderr);
|
|
1984
|
+
const showMessageBox = async options => {
|
|
1985
|
+
return invoke$1('ElectronDialog.showMessageBox', options);
|
|
1894
1986
|
};
|
|
1895
|
-
const
|
|
1896
|
-
|
|
1897
|
-
return {
|
|
1898
|
-
message: `Incompatible native node module: ${message}`,
|
|
1899
|
-
code: E_INCOMPATIBLE_NATIVE_MODULE
|
|
1900
|
-
};
|
|
1987
|
+
const handleDebugResumed = async params => {
|
|
1988
|
+
await invoke$1('Run And Debug.handleResumed', params);
|
|
1901
1989
|
};
|
|
1902
|
-
const
|
|
1903
|
-
|
|
1904
|
-
message: `ES Modules are not supported in electron`,
|
|
1905
|
-
code: E_MODULES_NOT_SUPPORTED_IN_ELECTRON
|
|
1906
|
-
};
|
|
1990
|
+
const openWidget = async name => {
|
|
1991
|
+
await invoke$1('Viewlet.openWidget', name);
|
|
1907
1992
|
};
|
|
1908
|
-
const
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
}
|
|
1912
|
-
if (isModulesSyntaxError(stderr)) {
|
|
1913
|
-
return getModuleSyntaxError();
|
|
1914
|
-
}
|
|
1915
|
-
if (isModuleNotFoundError(stderr)) {
|
|
1916
|
-
return getModuleNotFoundError(stderr);
|
|
1917
|
-
}
|
|
1918
|
-
const lines = splitLines$1(stderr);
|
|
1919
|
-
const {
|
|
1920
|
-
actualMessage,
|
|
1921
|
-
rest
|
|
1922
|
-
} = getDetails(lines);
|
|
1923
|
-
return {
|
|
1924
|
-
message: actualMessage,
|
|
1925
|
-
code: '',
|
|
1926
|
-
stack: rest
|
|
1927
|
-
};
|
|
1993
|
+
const getIcons = async requests => {
|
|
1994
|
+
const icons = await invoke$1('IconTheme.getIcons', requests);
|
|
1995
|
+
return icons;
|
|
1928
1996
|
};
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
constructor(betterMessage, stdout = '', stderr = '') {
|
|
1932
|
-
if (stdout || stderr) {
|
|
1933
|
-
// @ts-ignore
|
|
1934
|
-
const {
|
|
1935
|
-
message,
|
|
1936
|
-
code,
|
|
1937
|
-
stack
|
|
1938
|
-
} = getHelpfulChildProcessError(stdout, stderr);
|
|
1939
|
-
const cause = new Error(message);
|
|
1940
|
-
// @ts-ignore
|
|
1941
|
-
cause.code = code;
|
|
1942
|
-
cause.stack = stack;
|
|
1943
|
-
super(cause, betterMessage);
|
|
1944
|
-
} else {
|
|
1945
|
-
super(betterMessage);
|
|
1946
|
-
}
|
|
1947
|
-
// @ts-ignore
|
|
1948
|
-
this.name = 'IpcError';
|
|
1949
|
-
// @ts-ignore
|
|
1950
|
-
this.stdout = stdout;
|
|
1951
|
-
// @ts-ignore
|
|
1952
|
-
this.stderr = stderr;
|
|
1953
|
-
}
|
|
1954
|
-
}
|
|
1955
|
-
const readyMessage = 'ready';
|
|
1956
|
-
const getData$2 = event => {
|
|
1957
|
-
return event.data;
|
|
1997
|
+
const activateByEvent = event => {
|
|
1998
|
+
return invoke$1('ExtensionHostManagement.activateByEvent', event);
|
|
1958
1999
|
};
|
|
1959
|
-
const
|
|
2000
|
+
const setAdditionalFocus = focusKey => {
|
|
1960
2001
|
// @ts-ignore
|
|
1961
|
-
|
|
1962
|
-
throw new TypeError('module is not in web worker scope');
|
|
1963
|
-
}
|
|
1964
|
-
return globalThis;
|
|
2002
|
+
return invoke$1('Focus.setAdditionalFocus', focusKey);
|
|
1965
2003
|
};
|
|
1966
|
-
const
|
|
1967
|
-
|
|
2004
|
+
const getActiveEditorId = () => {
|
|
2005
|
+
// @ts-ignore
|
|
2006
|
+
return invoke$1('GetActiveEditor.getActiveEditorId');
|
|
1968
2007
|
};
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
return getData$2(event);
|
|
1972
|
-
}
|
|
1973
|
-
send(message) {
|
|
1974
|
-
// @ts-ignore
|
|
1975
|
-
this._rawIpc.postMessage(message);
|
|
1976
|
-
}
|
|
1977
|
-
sendAndTransfer(message) {
|
|
1978
|
-
const transfer = getTransferrables(message);
|
|
1979
|
-
// @ts-ignore
|
|
1980
|
-
this._rawIpc.postMessage(message, transfer);
|
|
1981
|
-
}
|
|
1982
|
-
dispose() {
|
|
1983
|
-
// ignore
|
|
1984
|
-
}
|
|
1985
|
-
onClose(callback) {
|
|
1986
|
-
// ignore
|
|
1987
|
-
}
|
|
1988
|
-
onMessage(callback) {
|
|
1989
|
-
this._rawIpc.addEventListener('message', callback);
|
|
1990
|
-
}
|
|
1991
|
-
}
|
|
1992
|
-
const wrap$f = global => {
|
|
1993
|
-
return new IpcChildWithModuleWorker(global);
|
|
2008
|
+
const getWorkspacePath = () => {
|
|
2009
|
+
return invoke$1('Workspace.getPath');
|
|
1994
2010
|
};
|
|
1995
|
-
const
|
|
1996
|
-
const
|
|
1997
|
-
resolve,
|
|
1998
|
-
promise
|
|
1999
|
-
} = Promise.withResolvers();
|
|
2000
|
-
port.addEventListener('message', resolve, {
|
|
2001
|
-
once: true
|
|
2002
|
-
});
|
|
2003
|
-
const event = await promise;
|
|
2011
|
+
const sendMessagePortToRendererProcess = async port => {
|
|
2012
|
+
const command = 'HandleMessagePort.handleMessagePort';
|
|
2004
2013
|
// @ts-ignore
|
|
2005
|
-
|
|
2014
|
+
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToRendererProcess', port, command, DebugWorker);
|
|
2006
2015
|
};
|
|
2007
|
-
const
|
|
2008
|
-
|
|
2009
|
-
signal$8(parentIpcRaw);
|
|
2010
|
-
const parentIpc = wrap$f(parentIpcRaw);
|
|
2011
|
-
const firstMessage = await waitForFirstMessage(parentIpc);
|
|
2012
|
-
if (firstMessage.method !== 'initialize') {
|
|
2013
|
-
throw new IpcError('unexpected first message');
|
|
2014
|
-
}
|
|
2015
|
-
const type = firstMessage.params[0];
|
|
2016
|
-
if (type === 'message-port') {
|
|
2017
|
-
parentIpc.send({
|
|
2018
|
-
jsonrpc: '2.0',
|
|
2019
|
-
id: firstMessage.id,
|
|
2020
|
-
result: null
|
|
2021
|
-
});
|
|
2022
|
-
parentIpc.dispose();
|
|
2023
|
-
const port = firstMessage.params[1];
|
|
2024
|
-
return port;
|
|
2025
|
-
}
|
|
2026
|
-
return globalThis;
|
|
2016
|
+
const getPreference = async key => {
|
|
2017
|
+
return await invoke$1('Preferences.get', key);
|
|
2027
2018
|
};
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
return getData$2(event);
|
|
2031
|
-
}
|
|
2032
|
-
send(message) {
|
|
2033
|
-
this._rawIpc.postMessage(message);
|
|
2034
|
-
}
|
|
2035
|
-
sendAndTransfer(message) {
|
|
2036
|
-
const transfer = getTransferrables(message);
|
|
2037
|
-
this._rawIpc.postMessage(message, transfer);
|
|
2038
|
-
}
|
|
2039
|
-
dispose() {
|
|
2040
|
-
if (this._rawIpc.close) {
|
|
2041
|
-
this._rawIpc.close();
|
|
2042
|
-
}
|
|
2043
|
-
}
|
|
2044
|
-
onClose(callback) {
|
|
2045
|
-
// ignore
|
|
2046
|
-
}
|
|
2047
|
-
onMessage(callback) {
|
|
2048
|
-
this._rawIpc.addEventListener('message', callback);
|
|
2049
|
-
this._rawIpc.start();
|
|
2050
|
-
}
|
|
2051
|
-
}
|
|
2052
|
-
const wrap$e = port => {
|
|
2053
|
-
return new IpcChildWithModuleWorkerAndMessagePort(port);
|
|
2019
|
+
const getAllExtensions$2 = async () => {
|
|
2020
|
+
return invoke$1('ExtensionManagement.getAllExtensions');
|
|
2054
2021
|
};
|
|
2055
|
-
const
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
wrap: wrap$e
|
|
2022
|
+
const rerenderEditor = async key => {
|
|
2023
|
+
// @ts-ignore
|
|
2024
|
+
return invoke$1('Editor.rerender', key);
|
|
2059
2025
|
};
|
|
2060
|
-
const
|
|
2061
|
-
|
|
2062
|
-
emitter.addEventListener(type, callback);
|
|
2063
|
-
} else {
|
|
2064
|
-
emitter.on(type, callback);
|
|
2065
|
-
}
|
|
2026
|
+
const handleDebugPaused = async params => {
|
|
2027
|
+
await invoke$1('Run And Debug.handlePaused', params);
|
|
2066
2028
|
};
|
|
2067
|
-
const
|
|
2068
|
-
|
|
2069
|
-
emitter.removeEventListener(type, callback);
|
|
2070
|
-
} else {
|
|
2071
|
-
emitter.off(type, callback);
|
|
2072
|
-
}
|
|
2029
|
+
const openUri = async (uri, focus, options) => {
|
|
2030
|
+
await invoke$1('Main.openUri', uri, focus, options);
|
|
2073
2031
|
};
|
|
2074
|
-
const
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
} = Promise.withResolvers();
|
|
2079
|
-
const listenerMap = Object.create(null);
|
|
2080
|
-
const cleanup = value => {
|
|
2081
|
-
for (const event of Object.keys(eventMap)) {
|
|
2082
|
-
removeListener(eventEmitter, event, listenerMap[event]);
|
|
2083
|
-
}
|
|
2084
|
-
resolve(value);
|
|
2085
|
-
};
|
|
2086
|
-
for (const [event, type] of Object.entries(eventMap)) {
|
|
2087
|
-
const listener = event => {
|
|
2088
|
-
cleanup({
|
|
2089
|
-
type,
|
|
2090
|
-
event
|
|
2091
|
-
});
|
|
2092
|
-
};
|
|
2093
|
-
addListener(eventEmitter, event, listener);
|
|
2094
|
-
listenerMap[event] = listener;
|
|
2095
|
-
}
|
|
2096
|
-
return promise;
|
|
2032
|
+
const sendMessagePortToSyntaxHighlightingWorker = async port => {
|
|
2033
|
+
await invokeAndTransfer(
|
|
2034
|
+
// @ts-ignore
|
|
2035
|
+
'SendMessagePortToSyntaxHighlightingWorker.sendMessagePortToSyntaxHighlightingWorker', port, 'HandleMessagePort.handleMessagePort2');
|
|
2097
2036
|
};
|
|
2098
|
-
const
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
return messagePort;
|
|
2108
|
-
}
|
|
2109
|
-
const eventPromise = getFirstEvent(messagePort, {
|
|
2110
|
-
message: Message$1
|
|
2111
|
-
});
|
|
2112
|
-
messagePort.start();
|
|
2113
|
-
const {
|
|
2114
|
-
type,
|
|
2115
|
-
event
|
|
2116
|
-
} = await eventPromise;
|
|
2117
|
-
if (type !== Message$1) {
|
|
2118
|
-
throw new IpcError('Failed to wait for ipc message');
|
|
2119
|
-
}
|
|
2120
|
-
if (event.data !== readyMessage) {
|
|
2121
|
-
throw new IpcError('unexpected first message');
|
|
2122
|
-
}
|
|
2123
|
-
return messagePort;
|
|
2037
|
+
const handleDebugScriptParsed = async script => {
|
|
2038
|
+
await invoke$1('Run And Debug.handleScriptParsed', script);
|
|
2039
|
+
};
|
|
2040
|
+
const getWindowId = async () => {
|
|
2041
|
+
return invoke$1('GetWindowId.getWindowId');
|
|
2042
|
+
};
|
|
2043
|
+
const getBlob = async uri => {
|
|
2044
|
+
// @ts-ignore
|
|
2045
|
+
return invoke$1('FileSystem.getBlob', uri);
|
|
2124
2046
|
};
|
|
2125
|
-
const
|
|
2126
|
-
|
|
2047
|
+
const getExtensionCommands = async () => {
|
|
2048
|
+
return invoke$1('ExtensionHost.getCommands');
|
|
2127
2049
|
};
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
this._rawIpc.postMessage(message);
|
|
2132
|
-
}
|
|
2133
|
-
sendAndTransfer(message) {
|
|
2134
|
-
const transfer = getTransferrables(message);
|
|
2135
|
-
this._rawIpc.postMessage(message, transfer);
|
|
2136
|
-
}
|
|
2137
|
-
dispose() {
|
|
2138
|
-
this._rawIpc.close();
|
|
2139
|
-
}
|
|
2140
|
-
onMessage(callback) {
|
|
2141
|
-
this._rawIpc.addEventListener('message', callback);
|
|
2142
|
-
}
|
|
2143
|
-
onClose(callback) {}
|
|
2144
|
-
}
|
|
2145
|
-
const wrap$5 = messagePort => {
|
|
2146
|
-
return new IpcParentWithMessagePort(messagePort);
|
|
2050
|
+
const showErrorDialog = async errorInfo => {
|
|
2051
|
+
// @ts-ignore
|
|
2052
|
+
await invoke$1('ErrorHandling.showErrorDialog', errorInfo);
|
|
2147
2053
|
};
|
|
2148
|
-
const
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
signal: signal$1,
|
|
2152
|
-
wrap: wrap$5
|
|
2054
|
+
const getFolderSize$1 = async uri => {
|
|
2055
|
+
// @ts-ignore
|
|
2056
|
+
return await invoke$1('FileSystem.getFolderSize', uri);
|
|
2153
2057
|
};
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
return {
|
|
2158
|
-
jsonrpc: Two,
|
|
2159
|
-
method,
|
|
2160
|
-
params
|
|
2161
|
-
};
|
|
2058
|
+
const getExtension$3 = async id => {
|
|
2059
|
+
// @ts-ignore
|
|
2060
|
+
return invoke$1('ExtensionManagement.getExtension', id);
|
|
2162
2061
|
};
|
|
2163
|
-
const
|
|
2164
|
-
|
|
2165
|
-
|
|
2062
|
+
const getMarkdownDom = async html => {
|
|
2063
|
+
// @ts-ignore
|
|
2064
|
+
return invoke$1('Markdown.getVirtualDom', html);
|
|
2166
2065
|
};
|
|
2167
|
-
const
|
|
2168
|
-
|
|
2066
|
+
const renderMarkdown$1 = async (markdown, options) => {
|
|
2067
|
+
// @ts-ignore
|
|
2068
|
+
return invoke$1('Markdown.renderMarkdown', markdown, options);
|
|
2169
2069
|
};
|
|
2170
|
-
const
|
|
2171
|
-
|
|
2070
|
+
const openNativeFolder$1 = async uri => {
|
|
2071
|
+
// @ts-ignore
|
|
2072
|
+
await invoke$1('OpenNativeFolder.openNativeFolder', uri);
|
|
2172
2073
|
};
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
return ++id;
|
|
2074
|
+
const uninstallExtension$1 = async id => {
|
|
2075
|
+
return invoke$1('ExtensionManagement.uninstall', id);
|
|
2176
2076
|
};
|
|
2177
|
-
const
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
resolve,
|
|
2181
|
-
promise
|
|
2182
|
-
} = Promise.withResolvers();
|
|
2183
|
-
set$3(id, resolve);
|
|
2184
|
-
return {
|
|
2185
|
-
id,
|
|
2186
|
-
promise
|
|
2187
|
-
};
|
|
2077
|
+
const installExtension = async id => {
|
|
2078
|
+
// @ts-ignore
|
|
2079
|
+
return invoke$1('ExtensionManagement.install', id);
|
|
2188
2080
|
};
|
|
2189
|
-
const
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
promise
|
|
2193
|
-
} = registerPromise();
|
|
2194
|
-
const message = {
|
|
2195
|
-
jsonrpc: Two,
|
|
2196
|
-
method,
|
|
2197
|
-
params,
|
|
2198
|
-
id
|
|
2199
|
-
};
|
|
2200
|
-
return {
|
|
2201
|
-
message,
|
|
2202
|
-
promise
|
|
2203
|
-
};
|
|
2081
|
+
const openExtensionSearch$2 = async () => {
|
|
2082
|
+
// @ts-ignore
|
|
2083
|
+
return invoke$1('SideBar.openViewlet', 'Extensions');
|
|
2204
2084
|
};
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
this.name = 'JsonRpcError';
|
|
2209
|
-
}
|
|
2210
|
-
}
|
|
2211
|
-
const NewLine = '\n';
|
|
2212
|
-
const DomException = 'DOMException';
|
|
2213
|
-
const ReferenceError$1 = 'ReferenceError';
|
|
2214
|
-
const SyntaxError$1 = 'SyntaxError';
|
|
2215
|
-
const TypeError$1 = 'TypeError';
|
|
2216
|
-
const getErrorConstructor = (message, type) => {
|
|
2217
|
-
if (type) {
|
|
2218
|
-
switch (type) {
|
|
2219
|
-
case DomException:
|
|
2220
|
-
return DOMException;
|
|
2221
|
-
case TypeError$1:
|
|
2222
|
-
return TypeError;
|
|
2223
|
-
case SyntaxError$1:
|
|
2224
|
-
return SyntaxError;
|
|
2225
|
-
case ReferenceError$1:
|
|
2226
|
-
return ReferenceError;
|
|
2227
|
-
default:
|
|
2228
|
-
return Error;
|
|
2229
|
-
}
|
|
2230
|
-
}
|
|
2231
|
-
if (message.startsWith('TypeError: ')) {
|
|
2232
|
-
return TypeError;
|
|
2233
|
-
}
|
|
2234
|
-
if (message.startsWith('SyntaxError: ')) {
|
|
2235
|
-
return SyntaxError;
|
|
2236
|
-
}
|
|
2237
|
-
if (message.startsWith('ReferenceError: ')) {
|
|
2238
|
-
return ReferenceError;
|
|
2239
|
-
}
|
|
2240
|
-
return Error;
|
|
2085
|
+
const setExtensionsSearchValue$1 = async searchValue => {
|
|
2086
|
+
// @ts-ignore
|
|
2087
|
+
return invoke$1('Extensions.handleInput', searchValue);
|
|
2241
2088
|
};
|
|
2242
|
-
const
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
return new ErrorConstructor(message, name);
|
|
2246
|
-
}
|
|
2247
|
-
if (ErrorConstructor === Error) {
|
|
2248
|
-
const error = new Error(message);
|
|
2249
|
-
if (name && name !== 'VError') {
|
|
2250
|
-
error.name = name;
|
|
2251
|
-
}
|
|
2252
|
-
return error;
|
|
2253
|
-
}
|
|
2254
|
-
return new ErrorConstructor(message);
|
|
2089
|
+
const openExternal = async uri => {
|
|
2090
|
+
// @ts-ignore
|
|
2091
|
+
await invoke$1('Open.openExternal', uri);
|
|
2255
2092
|
};
|
|
2256
|
-
const
|
|
2257
|
-
|
|
2093
|
+
const openUrl$2 = async uri => {
|
|
2094
|
+
// @ts-ignore
|
|
2095
|
+
await invoke$1('Open.openUrl', uri);
|
|
2258
2096
|
};
|
|
2259
|
-
const
|
|
2260
|
-
|
|
2097
|
+
const getAllPreferences = async () => {
|
|
2098
|
+
// @ts-ignore
|
|
2099
|
+
return invoke$1('Preferences.getAll');
|
|
2261
2100
|
};
|
|
2262
|
-
const
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
return currentStack;
|
|
2101
|
+
const showSaveFilePicker = async () => {
|
|
2102
|
+
// @ts-ignore
|
|
2103
|
+
return invoke$1('FilePicker.showSaveFilePicker');
|
|
2266
2104
|
};
|
|
2267
|
-
const
|
|
2268
|
-
|
|
2105
|
+
const getLogsDir = async () => {
|
|
2106
|
+
// @ts-ignore
|
|
2107
|
+
return invoke$1('PlatformPaths.getLogsDir');
|
|
2269
2108
|
};
|
|
2270
|
-
const
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
return
|
|
2109
|
+
const registerMockRpc = commandMap => {
|
|
2110
|
+
const mockRpc = createMockRpc({
|
|
2111
|
+
commandMap
|
|
2112
|
+
});
|
|
2113
|
+
set$5(mockRpc);
|
|
2114
|
+
return mockRpc;
|
|
2115
|
+
};
|
|
2116
|
+
|
|
2117
|
+
const RendererWorker = {
|
|
2118
|
+
__proto__: null,
|
|
2119
|
+
activateByEvent,
|
|
2120
|
+
applyBulkReplacement,
|
|
2121
|
+
closeWidget,
|
|
2122
|
+
confirm,
|
|
2123
|
+
disableExtension: disableExtension$2,
|
|
2124
|
+
dispose: dispose$2,
|
|
2125
|
+
enableExtension: enableExtension$2,
|
|
2126
|
+
getActiveEditorId,
|
|
2127
|
+
getAllExtensions: getAllExtensions$2,
|
|
2128
|
+
getAllPreferences,
|
|
2129
|
+
getBlob,
|
|
2130
|
+
getChromeVersion,
|
|
2131
|
+
getColorThemeNames,
|
|
2132
|
+
getElectronVersion,
|
|
2133
|
+
getExtension: getExtension$3,
|
|
2134
|
+
getExtensionCommands,
|
|
2135
|
+
getFileHandles,
|
|
2136
|
+
getFileIcon,
|
|
2137
|
+
getFilePathElectron,
|
|
2138
|
+
getFolderIcon,
|
|
2139
|
+
getFolderSize: getFolderSize$1,
|
|
2140
|
+
getIcons,
|
|
2141
|
+
getKeyBindings,
|
|
2142
|
+
getLogsDir,
|
|
2143
|
+
getMarkdownDom,
|
|
2144
|
+
getNodeVersion,
|
|
2145
|
+
getPreference,
|
|
2146
|
+
getRecentlyOpened,
|
|
2147
|
+
getV8Version,
|
|
2148
|
+
getWebViewSecret,
|
|
2149
|
+
getWindowId,
|
|
2150
|
+
getWorkspacePath,
|
|
2151
|
+
handleDebugChange,
|
|
2152
|
+
handleDebugPaused,
|
|
2153
|
+
handleDebugResumed,
|
|
2154
|
+
handleDebugScriptParsed,
|
|
2155
|
+
installExtension,
|
|
2156
|
+
invoke: invoke$1,
|
|
2157
|
+
invokeAndTransfer,
|
|
2158
|
+
openExtensionSearch: openExtensionSearch$2,
|
|
2159
|
+
openExternal,
|
|
2160
|
+
openNativeFolder: openNativeFolder$1,
|
|
2161
|
+
openUri,
|
|
2162
|
+
openUrl: openUrl$2,
|
|
2163
|
+
openWidget,
|
|
2164
|
+
readFile: readFile$2,
|
|
2165
|
+
registerMockRpc,
|
|
2166
|
+
registerWebViewInterceptor,
|
|
2167
|
+
renderMarkdown: renderMarkdown$1,
|
|
2168
|
+
rerenderEditor,
|
|
2169
|
+
searchFileFetch,
|
|
2170
|
+
searchFileHtml,
|
|
2171
|
+
searchFileMemory,
|
|
2172
|
+
sendMessagePortToEditorWorker,
|
|
2173
|
+
sendMessagePortToErrorWorker,
|
|
2174
|
+
sendMessagePortToExtensionHostWorker: sendMessagePortToExtensionHostWorker$2,
|
|
2175
|
+
sendMessagePortToFileSystemWorker: sendMessagePortToFileSystemWorker$2,
|
|
2176
|
+
sendMessagePortToIconThemeWorker,
|
|
2177
|
+
sendMessagePortToMarkdownWorker: sendMessagePortToMarkdownWorker$2,
|
|
2178
|
+
sendMessagePortToRendererProcess,
|
|
2179
|
+
sendMessagePortToSearchProcess,
|
|
2180
|
+
sendMessagePortToSyntaxHighlightingWorker,
|
|
2181
|
+
set: set$5,
|
|
2182
|
+
setAdditionalFocus,
|
|
2183
|
+
setColorTheme: setColorTheme$2,
|
|
2184
|
+
setExtensionsSearchValue: setExtensionsSearchValue$1,
|
|
2185
|
+
setFocus,
|
|
2186
|
+
setWebViewPort,
|
|
2187
|
+
setWorkspacePath,
|
|
2188
|
+
showContextMenu: showContextMenu$1,
|
|
2189
|
+
showErrorDialog,
|
|
2190
|
+
showMessageBox,
|
|
2191
|
+
showSaveFilePicker,
|
|
2192
|
+
uninstallExtension: uninstallExtension$1,
|
|
2193
|
+
unregisterWebViewInterceptor,
|
|
2194
|
+
writeClipBoardImage: writeClipBoardImage$1,
|
|
2195
|
+
writeClipBoardText: writeClipBoardText$1
|
|
2196
|
+
};
|
|
2197
|
+
|
|
2198
|
+
const {
|
|
2199
|
+
set: set$4,
|
|
2200
|
+
getRuntimeStatus: getRuntimeStatus$1
|
|
2201
|
+
} = ExtensionHost;
|
|
2202
|
+
|
|
2203
|
+
const getRuntimeStatus = async extensionId => {
|
|
2204
|
+
// @ts-ignore
|
|
2205
|
+
const status = await getRuntimeStatus$1(extensionId);
|
|
2206
|
+
// @ts-ignore
|
|
2207
|
+
return status;
|
|
2208
|
+
};
|
|
2209
|
+
|
|
2210
|
+
const getRuntimeStatusDetails = async extension => {
|
|
2211
|
+
const {
|
|
2212
|
+
activationEvent,
|
|
2213
|
+
status,
|
|
2214
|
+
activationTime,
|
|
2215
|
+
importTime
|
|
2216
|
+
} = await getRuntimeStatus(extension.id);
|
|
2217
|
+
return {
|
|
2218
|
+
wasActivatedByEvent: activationEvent,
|
|
2219
|
+
activationTime,
|
|
2220
|
+
status,
|
|
2221
|
+
importTime
|
|
2222
|
+
};
|
|
2276
2223
|
};
|
|
2277
|
-
|
|
2278
|
-
const
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
if (error && error instanceof Error) {
|
|
2282
|
-
if (typeof error.stack === 'string') {
|
|
2283
|
-
error.stack = error.stack + NewLine + currentStack;
|
|
2284
|
-
}
|
|
2285
|
-
return error;
|
|
2286
|
-
}
|
|
2287
|
-
if (error && error.code && error.code === MethodNotFound) {
|
|
2288
|
-
const restoredError = new JsonRpcError(error.message);
|
|
2289
|
-
const parentStack = getParentStack(error);
|
|
2290
|
-
restoredError.stack = parentStack + NewLine + currentStack;
|
|
2291
|
-
return restoredError;
|
|
2292
|
-
}
|
|
2293
|
-
if (error && error.message) {
|
|
2294
|
-
const restoredError = constructError(error.message, error.type, error.name);
|
|
2295
|
-
if (error.data) {
|
|
2296
|
-
if (error.data.stack && error.data.type && error.message) {
|
|
2297
|
-
restoredError.stack = error.data.type + ': ' + error.message + NewLine + error.data.stack + NewLine + currentStack;
|
|
2298
|
-
} else if (error.data.stack) {
|
|
2299
|
-
restoredError.stack = error.data.stack;
|
|
2300
|
-
}
|
|
2301
|
-
if (error.data.codeFrame) {
|
|
2302
|
-
// @ts-ignore
|
|
2303
|
-
restoredError.codeFrame = error.data.codeFrame;
|
|
2304
|
-
}
|
|
2305
|
-
if (error.data.code) {
|
|
2306
|
-
// @ts-ignore
|
|
2307
|
-
restoredError.code = error.data.code;
|
|
2308
|
-
}
|
|
2309
|
-
if (error.data.type) {
|
|
2310
|
-
// @ts-ignore
|
|
2311
|
-
restoredError.name = error.data.type;
|
|
2312
|
-
}
|
|
2313
|
-
} else {
|
|
2314
|
-
if (error.stack) {
|
|
2315
|
-
const lowerStack = restoredError.stack || '';
|
|
2316
|
-
// @ts-ignore
|
|
2317
|
-
const indexNewLine = getNewLineIndex(lowerStack);
|
|
2318
|
-
const parentStack = getParentStack(error);
|
|
2319
|
-
// @ts-ignore
|
|
2320
|
-
restoredError.stack = parentStack + lowerStack.slice(indexNewLine);
|
|
2321
|
-
}
|
|
2322
|
-
if (error.codeFrame) {
|
|
2323
|
-
// @ts-ignore
|
|
2324
|
-
restoredError.codeFrame = error.codeFrame;
|
|
2325
|
-
}
|
|
2326
|
-
}
|
|
2327
|
-
return restoredError;
|
|
2224
|
+
|
|
2225
|
+
const featureRuntimeStatusEnabled = extension => {
|
|
2226
|
+
if (!extension || typeof extension !== 'object') {
|
|
2227
|
+
return false;
|
|
2328
2228
|
}
|
|
2329
|
-
if (
|
|
2330
|
-
return
|
|
2229
|
+
if ('main' in extension || 'browser' in extension) {
|
|
2230
|
+
return true;
|
|
2331
2231
|
}
|
|
2332
|
-
return
|
|
2232
|
+
return false;
|
|
2333
2233
|
};
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
|
|
2234
|
+
|
|
2235
|
+
const formatTime = time => {
|
|
2236
|
+
return time.toFixed(2) + 'ms';
|
|
2237
|
+
};
|
|
2238
|
+
|
|
2239
|
+
const getActivationTimeVirtualDom = (importTime$1, activationTime$1) => {
|
|
2240
|
+
if (!activationTime$1 && !importTime$1) {
|
|
2241
|
+
return [];
|
|
2338
2242
|
}
|
|
2339
|
-
|
|
2340
|
-
|
|
2243
|
+
const formattedImportTime = formatTime(importTime$1);
|
|
2244
|
+
const formattedTime = formatTime(activationTime$1);
|
|
2245
|
+
return [{
|
|
2246
|
+
type: Dt,
|
|
2247
|
+
childCount: 1
|
|
2248
|
+
}, text(importTime()), {
|
|
2249
|
+
type: Dd,
|
|
2250
|
+
childCount: 1
|
|
2251
|
+
}, text(formattedImportTime), {
|
|
2252
|
+
type: Dt,
|
|
2253
|
+
childCount: 1
|
|
2254
|
+
}, text(activationTime()), {
|
|
2255
|
+
type: Dd,
|
|
2256
|
+
childCount: 1
|
|
2257
|
+
}, text(formattedTime)];
|
|
2258
|
+
};
|
|
2259
|
+
|
|
2260
|
+
const None$1 = 0;
|
|
2261
|
+
const Importing = 1;
|
|
2262
|
+
const Activating = 2;
|
|
2263
|
+
const Activated = 3;
|
|
2264
|
+
const Error$1 = 4;
|
|
2265
|
+
|
|
2266
|
+
const getStatusMessage = statusType => {
|
|
2267
|
+
switch (statusType) {
|
|
2268
|
+
case Activated:
|
|
2269
|
+
return 'activated';
|
|
2270
|
+
case None$1:
|
|
2271
|
+
return 'none';
|
|
2272
|
+
case Activating:
|
|
2273
|
+
return 'Activating';
|
|
2274
|
+
case Error$1:
|
|
2275
|
+
return 'error';
|
|
2276
|
+
case Importing:
|
|
2277
|
+
return 'importing';
|
|
2278
|
+
default:
|
|
2279
|
+
return 'unknown';
|
|
2341
2280
|
}
|
|
2342
|
-
throw new JsonRpcError('unexpected response message');
|
|
2343
2281
|
};
|
|
2344
|
-
|
|
2345
|
-
|
|
2282
|
+
|
|
2283
|
+
const key = {
|
|
2284
|
+
type: Dt,
|
|
2285
|
+
childCount: 1,
|
|
2286
|
+
className: 'RuntimeStatusDefinitionListKey'
|
|
2346
2287
|
};
|
|
2347
|
-
const
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
warn(`callback ${id} may already be disposed`);
|
|
2352
|
-
return;
|
|
2353
|
-
}
|
|
2354
|
-
fn(response);
|
|
2355
|
-
remove(id);
|
|
2288
|
+
const value = {
|
|
2289
|
+
type: Dd,
|
|
2290
|
+
className: 'RuntimeStatusDefinitionListValue',
|
|
2291
|
+
childCount: 1
|
|
2356
2292
|
};
|
|
2357
|
-
const
|
|
2358
|
-
const
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
}
|
|
2362
|
-
|
|
2363
|
-
|
|
2293
|
+
const getStatusVirtualDom = status => {
|
|
2294
|
+
const statusString = getStatusMessage(status);
|
|
2295
|
+
return [key, text(`Status: `),
|
|
2296
|
+
// i18n
|
|
2297
|
+
value, text(`${statusString}`)];
|
|
2298
|
+
};
|
|
2299
|
+
|
|
2300
|
+
const getChildCount$1 = (status, activationTime, importTime) => {
|
|
2301
|
+
let childCount = 0;
|
|
2302
|
+
childCount += 2; // status
|
|
2303
|
+
if (importTime || activationTime) {
|
|
2304
|
+
childCount += 4;
|
|
2364
2305
|
}
|
|
2365
|
-
return
|
|
2306
|
+
return childCount;
|
|
2366
2307
|
};
|
|
2367
|
-
const
|
|
2368
|
-
|
|
2308
|
+
const getRuntimeStatusVirtualDom = state => {
|
|
2309
|
+
const {
|
|
2310
|
+
status,
|
|
2311
|
+
activationTime,
|
|
2312
|
+
importTime
|
|
2313
|
+
} = state;
|
|
2314
|
+
const heading = runtimeStatus();
|
|
2315
|
+
const childCount = getChildCount$1(status, activationTime, importTime);
|
|
2316
|
+
return [{
|
|
2317
|
+
type: Div,
|
|
2318
|
+
className: FeatureContent,
|
|
2319
|
+
childCount: 2
|
|
2320
|
+
}, ...getFeatureContentHeadingVirtualDom(heading), {
|
|
2321
|
+
type: Dl,
|
|
2322
|
+
className: 'RuntimeStatusDefinitionList',
|
|
2323
|
+
childCount
|
|
2324
|
+
}, ...getStatusVirtualDom(status), ...getActivationTimeVirtualDom(activationTime, importTime)];
|
|
2369
2325
|
};
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
const
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
}
|
|
2376
|
-
|
|
2326
|
+
|
|
2327
|
+
const getSettingsTableEntry = setting => {
|
|
2328
|
+
const {
|
|
2329
|
+
id,
|
|
2330
|
+
label
|
|
2331
|
+
} = setting;
|
|
2332
|
+
// TODO watch out for null/undefined/number/string/array
|
|
2333
|
+
return [{
|
|
2334
|
+
type: Text,
|
|
2335
|
+
value: id
|
|
2336
|
+
}, {
|
|
2337
|
+
type: Text,
|
|
2338
|
+
value: label
|
|
2339
|
+
}];
|
|
2377
2340
|
};
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
message: error.message,
|
|
2383
|
-
data: error.stack
|
|
2384
|
-
};
|
|
2385
|
-
}
|
|
2341
|
+
|
|
2342
|
+
const getSettingsDetails = async extension => {
|
|
2343
|
+
const settings = extension.settings || [];
|
|
2344
|
+
const rows = settings.map(getSettingsTableEntry);
|
|
2386
2345
|
return {
|
|
2387
|
-
|
|
2388
|
-
message: prettyError.message,
|
|
2389
|
-
data: {
|
|
2390
|
-
stack: getStack(prettyError),
|
|
2391
|
-
codeFrame: prettyError.codeFrame,
|
|
2392
|
-
type: getErrorType(prettyError),
|
|
2393
|
-
code: prettyError.code,
|
|
2394
|
-
name: prettyError.name
|
|
2395
|
-
}
|
|
2346
|
+
settings: rows
|
|
2396
2347
|
};
|
|
2397
2348
|
};
|
|
2398
|
-
|
|
2349
|
+
|
|
2350
|
+
const featureSettingsEnabled = extension => {
|
|
2351
|
+
if (!extension || typeof extension !== 'object' || !('settings' in extension)) {
|
|
2352
|
+
return false;
|
|
2353
|
+
}
|
|
2354
|
+
return Array.isArray(extension.settings);
|
|
2355
|
+
};
|
|
2356
|
+
|
|
2357
|
+
const getSettingsTableEntries = rows => {
|
|
2358
|
+
const textId = id$1();
|
|
2359
|
+
const textLabel = label();
|
|
2399
2360
|
return {
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
error
|
|
2361
|
+
headings: [textId, textLabel],
|
|
2362
|
+
rows
|
|
2403
2363
|
};
|
|
2404
2364
|
};
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
const
|
|
2409
|
-
return
|
|
2365
|
+
|
|
2366
|
+
const getFeatureSettingsVirtualDom = rows => {
|
|
2367
|
+
const heading = settings();
|
|
2368
|
+
const tableInfo = getSettingsTableEntries(rows);
|
|
2369
|
+
return [{
|
|
2370
|
+
type: Div,
|
|
2371
|
+
className: FeatureContent,
|
|
2372
|
+
childCount: 2
|
|
2373
|
+
}, ...getFeatureContentHeadingVirtualDom(heading), ...getTableVirtualDom(tableInfo)];
|
|
2410
2374
|
};
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
id: message.id,
|
|
2415
|
-
result: result ?? null
|
|
2416
|
-
};
|
|
2375
|
+
|
|
2376
|
+
const getSettingsVirtualDom = state => {
|
|
2377
|
+
return getFeatureSettingsVirtualDom(state.settings);
|
|
2417
2378
|
};
|
|
2418
|
-
|
|
2419
|
-
|
|
2420
|
-
|
|
2379
|
+
|
|
2380
|
+
const HandleClickCategory = 'handleClickCategory';
|
|
2381
|
+
const HandleClickDisable = 'handleClickDisable';
|
|
2382
|
+
const HandleClickEnable = 'handleClickEnable';
|
|
2383
|
+
const HandleClickScrollToTop = 'handleClickScrollToTop';
|
|
2384
|
+
const HandleClickSetColorTheme = 'handleClickSetColorTheme';
|
|
2385
|
+
const HandleClickSettings = 'handleClickSettings';
|
|
2386
|
+
const HandleClickSize = 'handleClickSize';
|
|
2387
|
+
const HandleClickUninstall = 'handleClickUninstall';
|
|
2388
|
+
const HandleFeaturesClick = 'handleFeaturesClick';
|
|
2389
|
+
const HandleIconError = 'handleIconError';
|
|
2390
|
+
const HandleImageContextMenu = 'handleImageContextMenu';
|
|
2391
|
+
const HandleReadmeContextMenu = 'handleReadmeContextMenu';
|
|
2392
|
+
const HandleReadmeScroll = 'handleReadmeScroll';
|
|
2393
|
+
const HandleTabsClick = 'handleTabsClick';
|
|
2394
|
+
|
|
2395
|
+
const ActivationEvents = 'ActivationEvents';
|
|
2396
|
+
const Changelog = 'Changelog';
|
|
2397
|
+
const Commands = 'Commands';
|
|
2398
|
+
const Details = 'Details';
|
|
2399
|
+
const Enable = 'Enable';
|
|
2400
|
+
const Disable = 'Disable';
|
|
2401
|
+
const Features = 'Features';
|
|
2402
|
+
const JsonValidation = 'JsonValidation';
|
|
2403
|
+
const ProgrammingLanguages = 'ProgrammingLanguages';
|
|
2404
|
+
const RuntimeStatus = 'RuntimeStatus';
|
|
2405
|
+
const ScrollToTop = 'scrolltotop';
|
|
2406
|
+
const SetColorTheme = 'SetColorTheme';
|
|
2407
|
+
const Settings = 'Settings';
|
|
2408
|
+
const Theme = 'Theme';
|
|
2409
|
+
const Uninstall = 'Uninstall';
|
|
2410
|
+
const WebViews = 'WebViews';
|
|
2411
|
+
|
|
2412
|
+
const getScrollToTopVirtualDom = scrollToTopButtonEnabled => {
|
|
2413
|
+
return [{
|
|
2414
|
+
type: Button$1,
|
|
2415
|
+
className: ScrollToTopButton,
|
|
2416
|
+
childCount: 1,
|
|
2417
|
+
onClick: HandleClickScrollToTop,
|
|
2418
|
+
ariaLabel: scrollToTop(),
|
|
2419
|
+
name: ScrollToTop
|
|
2420
|
+
}, {
|
|
2421
|
+
type: Div,
|
|
2422
|
+
className: 'MaskIcon MaskIconChevronUp',
|
|
2423
|
+
childCount: 0,
|
|
2424
|
+
role: None$2
|
|
2425
|
+
}];
|
|
2421
2426
|
};
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2427
|
+
|
|
2428
|
+
const {
|
|
2429
|
+
set: set$3,
|
|
2430
|
+
getVirtualDom,
|
|
2431
|
+
render
|
|
2432
|
+
} = MarkdownWorker;
|
|
2433
|
+
|
|
2434
|
+
const getMarkdownVirtualDom = async (html, options) => {
|
|
2435
|
+
string(html);
|
|
2436
|
+
const dom = await getVirtualDom(html);
|
|
2437
|
+
const newDom = [...dom];
|
|
2438
|
+
if (options?.scrollToTopEnabled) {
|
|
2439
|
+
newDom[0].onScroll = HandleReadmeScroll;
|
|
2440
|
+
newDom[0].childCount++;
|
|
2441
|
+
const extraDom = getScrollToTopVirtualDom();
|
|
2442
|
+
newDom.splice(1, 0, ...extraDom);
|
|
2443
|
+
}
|
|
2444
|
+
return newDom;
|
|
2433
2445
|
};
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2446
|
+
|
|
2447
|
+
const getThemeItemMarkdown = (heading, items) => {
|
|
2448
|
+
let markdown = '';
|
|
2449
|
+
if (items.length > 0) {
|
|
2450
|
+
markdown += `### ${heading}`;
|
|
2451
|
+
markdown += '\n\n';
|
|
2452
|
+
for (const item of items) {
|
|
2453
|
+
markdown += `- ${item.label}`;
|
|
2454
|
+
markdown += '\n';
|
|
2441
2455
|
}
|
|
2442
|
-
return getErrorResponse(message.id, error, preparePrettyError, logError);
|
|
2443
2456
|
}
|
|
2457
|
+
return markdown;
|
|
2444
2458
|
};
|
|
2445
|
-
|
|
2446
|
-
|
|
2459
|
+
|
|
2460
|
+
const getColorThemeMarkdown = themes => {
|
|
2461
|
+
const heading = 'Color Themes';
|
|
2462
|
+
return getThemeItemMarkdown(heading, themes);
|
|
2447
2463
|
};
|
|
2448
|
-
const
|
|
2449
|
-
|
|
2464
|
+
const getIconThemeMarkdown = iconThemes => {
|
|
2465
|
+
const heading = 'File Icon Themes';
|
|
2466
|
+
return getThemeItemMarkdown(heading, iconThemes);
|
|
2450
2467
|
};
|
|
2451
|
-
const
|
|
2452
|
-
|
|
2468
|
+
const getProductIconThemeMarkdown = iconThemes => {
|
|
2469
|
+
const heading = 'Product Icon Themes';
|
|
2470
|
+
return getThemeItemMarkdown(heading, iconThemes);
|
|
2471
|
+
};
|
|
2472
|
+
const getThemeMarkdown = (themes, iconThemes, productIconThemes) => {
|
|
2473
|
+
let markdown = '';
|
|
2474
|
+
markdown += getColorThemeMarkdown(themes);
|
|
2475
|
+
markdown += getIconThemeMarkdown(iconThemes);
|
|
2476
|
+
markdown += getProductIconThemeMarkdown(productIconThemes);
|
|
2477
|
+
return markdown;
|
|
2453
2478
|
};
|
|
2454
|
-
const defaultResolve = resolve;
|
|
2455
2479
|
|
|
2456
|
-
|
|
2457
|
-
const
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2480
|
+
const renderMarkdown = async (markdown, options = {}) => {
|
|
2481
|
+
const html = await render(markdown, options);
|
|
2482
|
+
return html;
|
|
2483
|
+
};
|
|
2484
|
+
|
|
2485
|
+
const getThemeDetails = async (extension, baseUrl) => {
|
|
2486
|
+
const {
|
|
2487
|
+
colorThemes,
|
|
2488
|
+
iconThemes,
|
|
2489
|
+
productIconThemes
|
|
2490
|
+
} = extension;
|
|
2491
|
+
const markdown = getThemeMarkdown(colorThemes || [], iconThemes || [], productIconThemes || []);
|
|
2492
|
+
const rendered = await renderMarkdown(markdown, {
|
|
2493
|
+
baseUrl
|
|
2494
|
+
});
|
|
2495
|
+
const themesMarkdownDom = await getMarkdownVirtualDom(rendered);
|
|
2470
2496
|
return {
|
|
2471
|
-
|
|
2472
|
-
message: args[1],
|
|
2473
|
-
execute: args[2],
|
|
2474
|
-
resolve: args[3],
|
|
2475
|
-
preparePrettyError: args[4],
|
|
2476
|
-
logError: args[5],
|
|
2477
|
-
requiresSocket: args[6]
|
|
2497
|
+
themesMarkdownDom
|
|
2478
2498
|
};
|
|
2479
2499
|
};
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
ipc,
|
|
2485
|
-
execute,
|
|
2486
|
-
resolve,
|
|
2487
|
-
preparePrettyError,
|
|
2488
|
-
logError,
|
|
2489
|
-
requiresSocket
|
|
2490
|
-
} = options;
|
|
2491
|
-
if ('id' in message) {
|
|
2492
|
-
if ('method' in message) {
|
|
2493
|
-
const response = await getResponse(message, ipc, execute, preparePrettyError, logError, requiresSocket);
|
|
2494
|
-
try {
|
|
2495
|
-
ipc.send(response);
|
|
2496
|
-
} catch (error) {
|
|
2497
|
-
const errorResponse = getErrorResponse(message.id, error, preparePrettyError, logError);
|
|
2498
|
-
ipc.send(errorResponse);
|
|
2499
|
-
}
|
|
2500
|
-
return;
|
|
2501
|
-
}
|
|
2502
|
-
resolve(message.id, message);
|
|
2503
|
-
return;
|
|
2504
|
-
}
|
|
2505
|
-
if ('method' in message) {
|
|
2506
|
-
await getResponse(message, ipc, execute, preparePrettyError, logError, requiresSocket);
|
|
2507
|
-
return;
|
|
2500
|
+
|
|
2501
|
+
const featureColorThemeEnabled = extension => {
|
|
2502
|
+
if (!extension || typeof extension !== 'object' || !('colorThemes' in extension)) {
|
|
2503
|
+
return false;
|
|
2508
2504
|
}
|
|
2509
|
-
|
|
2505
|
+
return Array.isArray(extension.colorThemes);
|
|
2510
2506
|
};
|
|
2511
|
-
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
} = create$2$1(method, params);
|
|
2516
|
-
if (useSendAndTransfer && ipc.sendAndTransfer) {
|
|
2517
|
-
ipc.sendAndTransfer(message);
|
|
2518
|
-
} else {
|
|
2519
|
-
ipc.send(message);
|
|
2507
|
+
|
|
2508
|
+
const featureIconThemeEnabled = extension => {
|
|
2509
|
+
if (!extension || typeof extension !== 'object' || !('iconThemes' in extension)) {
|
|
2510
|
+
return false;
|
|
2520
2511
|
}
|
|
2521
|
-
|
|
2522
|
-
return unwrapJsonRpcResult(responseMessage);
|
|
2523
|
-
};
|
|
2524
|
-
const send = (transport, method, ...params) => {
|
|
2525
|
-
const message = create$4(method, params);
|
|
2526
|
-
transport.send(message);
|
|
2527
|
-
};
|
|
2528
|
-
const invoke$1 = (ipc, method, ...params) => {
|
|
2529
|
-
return invokeHelper(ipc, method, params, false);
|
|
2530
|
-
};
|
|
2531
|
-
const invokeAndTransfer = (ipc, method, ...params) => {
|
|
2532
|
-
return invokeHelper(ipc, method, params, true);
|
|
2512
|
+
return Array.isArray(extension.iconThemes);
|
|
2533
2513
|
};
|
|
2534
2514
|
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
this.name = 'CommandNotFoundError';
|
|
2515
|
+
const featureProductIconThemeEnabled = extension => {
|
|
2516
|
+
if (!extension || typeof extension !== 'object' || !('productIconThemes' in extension)) {
|
|
2517
|
+
return false;
|
|
2539
2518
|
}
|
|
2540
|
-
|
|
2541
|
-
const commands = Object.create(null);
|
|
2542
|
-
const register = commandMap => {
|
|
2543
|
-
Object.assign(commands, commandMap);
|
|
2519
|
+
return Array.isArray(extension.productIconThemes);
|
|
2544
2520
|
};
|
|
2545
|
-
|
|
2546
|
-
|
|
2521
|
+
|
|
2522
|
+
const featureThemeEnabled = extension => {
|
|
2523
|
+
return featureColorThemeEnabled(extension) || featureIconThemeEnabled(extension) || featureProductIconThemeEnabled(extension);
|
|
2547
2524
|
};
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
|
|
2551
|
-
|
|
2525
|
+
|
|
2526
|
+
const getVirtualDomChildCount = dom => {
|
|
2527
|
+
const max = dom.length - 1;
|
|
2528
|
+
let stack = [];
|
|
2529
|
+
for (let i = max; i >= 0; i--) {
|
|
2530
|
+
const element = dom[i];
|
|
2531
|
+
if (element.childCount > 0) {
|
|
2532
|
+
stack = stack.slice(element.childCount);
|
|
2533
|
+
}
|
|
2534
|
+
stack.unshift(element);
|
|
2552
2535
|
}
|
|
2553
|
-
return
|
|
2536
|
+
return stack.length;
|
|
2554
2537
|
};
|
|
2555
2538
|
|
|
2556
|
-
const
|
|
2557
|
-
const
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
},
|
|
2569
|
-
invokeAndTransfer(method, ...params) {
|
|
2570
|
-
return invokeAndTransfer(ipc, method, ...params);
|
|
2571
|
-
},
|
|
2572
|
-
async dispose() {
|
|
2573
|
-
await ipc?.dispose();
|
|
2574
|
-
}
|
|
2575
|
-
};
|
|
2576
|
-
return rpc;
|
|
2539
|
+
const getFeatureThemesVirtualDom = themesDom => {
|
|
2540
|
+
const childCount = getVirtualDomChildCount(themesDom);
|
|
2541
|
+
const heading = theme();
|
|
2542
|
+
return [{
|
|
2543
|
+
type: Div,
|
|
2544
|
+
className: FeatureContent,
|
|
2545
|
+
childCount: 2
|
|
2546
|
+
}, ...getFeatureContentHeadingVirtualDom(heading), {
|
|
2547
|
+
type: Div,
|
|
2548
|
+
className: DefaultMarkdown,
|
|
2549
|
+
childCount
|
|
2550
|
+
}, ...themesDom];
|
|
2577
2551
|
};
|
|
2578
|
-
|
|
2579
|
-
|
|
2552
|
+
|
|
2553
|
+
const getThemeVirtualDom = state => {
|
|
2554
|
+
return getFeatureThemesVirtualDom(state.themesMarkdownDom);
|
|
2580
2555
|
};
|
|
2581
|
-
|
|
2582
|
-
|
|
2556
|
+
|
|
2557
|
+
const toWebView = rawWebView => {
|
|
2558
|
+
const {
|
|
2559
|
+
id,
|
|
2560
|
+
selector,
|
|
2561
|
+
contentSecurityPolicy,
|
|
2562
|
+
elements
|
|
2563
|
+
} = rawWebView;
|
|
2564
|
+
return {
|
|
2565
|
+
id,
|
|
2566
|
+
selectorString: JSON.stringify(selector),
|
|
2567
|
+
contentSecurityPolicyString: JSON.stringify(contentSecurityPolicy),
|
|
2568
|
+
elementsString: JSON.stringify(elements, null, 2)
|
|
2569
|
+
};
|
|
2583
2570
|
};
|
|
2584
|
-
|
|
2585
|
-
|
|
2571
|
+
|
|
2572
|
+
const getWebViews = extension => {
|
|
2573
|
+
const rawWebViews = extension.webViews || [];
|
|
2574
|
+
return rawWebViews.map(toWebView);
|
|
2586
2575
|
};
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
const
|
|
2590
|
-
return
|
|
2576
|
+
|
|
2577
|
+
const getWebViewsDetails = async extension => {
|
|
2578
|
+
const webViews = getWebViews(extension);
|
|
2579
|
+
return {
|
|
2580
|
+
webViews
|
|
2581
|
+
};
|
|
2591
2582
|
};
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
|
|
2596
|
-
// deprecated
|
|
2597
|
-
ipc.on('message', handleMessage);
|
|
2583
|
+
|
|
2584
|
+
const featureWebViewsEnabled = extension => {
|
|
2585
|
+
if (!extension || typeof extension !== 'object' || !('webViews' in extension)) {
|
|
2586
|
+
return false;
|
|
2598
2587
|
}
|
|
2588
|
+
return Array.isArray(extension.webViews);
|
|
2599
2589
|
};
|
|
2600
|
-
|
|
2601
|
-
|
|
2602
|
-
|
|
2603
|
-
|
|
2604
|
-
|
|
2605
|
-
const ipc = module.wrap(rawIpc);
|
|
2606
|
-
return ipc;
|
|
2590
|
+
|
|
2591
|
+
const heading = {
|
|
2592
|
+
type: H2,
|
|
2593
|
+
className: DefinitionListItemHeading,
|
|
2594
|
+
childCount: 1
|
|
2607
2595
|
};
|
|
2608
|
-
const
|
|
2609
|
-
|
|
2610
|
-
|
|
2611
|
-
|
|
2612
|
-
// TODO create a commandMap per rpc instance
|
|
2613
|
-
register(commandMap);
|
|
2614
|
-
const rawIpc = await IpcParentWithMessagePort$1.create({
|
|
2615
|
-
messagePort,
|
|
2616
|
-
isMessagePortOpen: true
|
|
2617
|
-
});
|
|
2618
|
-
const ipc = IpcParentWithMessagePort$1.wrap(rawIpc);
|
|
2619
|
-
handleIpc(ipc);
|
|
2620
|
-
const rpc = createRpc(ipc);
|
|
2621
|
-
messagePort.start();
|
|
2622
|
-
return rpc;
|
|
2596
|
+
const pre = {
|
|
2597
|
+
type: Pre,
|
|
2598
|
+
className: DefinitionListItemValue,
|
|
2599
|
+
childCount: 1
|
|
2623
2600
|
};
|
|
2624
|
-
const
|
|
2625
|
-
|
|
2626
|
-
|
|
2627
|
-
|
|
2601
|
+
const item = {
|
|
2602
|
+
type: Div,
|
|
2603
|
+
className: DefinitionListItem,
|
|
2604
|
+
childCount: 2
|
|
2605
|
+
};
|
|
2606
|
+
const getWebViewVirtualDom = webView => {
|
|
2628
2607
|
const {
|
|
2629
|
-
|
|
2630
|
-
|
|
2631
|
-
|
|
2632
|
-
|
|
2633
|
-
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
|
|
2608
|
+
id,
|
|
2609
|
+
selectorString,
|
|
2610
|
+
contentSecurityPolicyString,
|
|
2611
|
+
elementsString
|
|
2612
|
+
} = webView;
|
|
2613
|
+
const textId = id$1();
|
|
2614
|
+
const textSelector = selector();
|
|
2615
|
+
const textContentSecurityPolicy = contentSecurityPolicy();
|
|
2616
|
+
const textElements = elements();
|
|
2617
|
+
return [{
|
|
2618
|
+
type: Div,
|
|
2619
|
+
className: FeatureWebView,
|
|
2620
|
+
childCount: 5
|
|
2621
|
+
}, item, heading, text(textId), pre, text(id), item, heading, text(textSelector), pre, text(selectorString), item, heading, text(textContentSecurityPolicy), pre, text(contentSecurityPolicyString), item, heading, text(textElements), pre, text(elementsString)];
|
|
2637
2622
|
};
|
|
2638
|
-
|
|
2639
|
-
|
|
2640
|
-
|
|
2623
|
+
|
|
2624
|
+
const getFeatureWebViewsVirtualDom = webViews$1 => {
|
|
2625
|
+
const heading = webViews();
|
|
2626
|
+
return [{
|
|
2627
|
+
type: Div,
|
|
2628
|
+
className: FeatureContent,
|
|
2629
|
+
childCount: 2
|
|
2630
|
+
}, ...getFeatureContentHeadingVirtualDom(heading), {
|
|
2631
|
+
type: Div,
|
|
2632
|
+
childCount: webViews$1.length
|
|
2633
|
+
}, ...webViews$1.flatMap(getWebViewVirtualDom)];
|
|
2641
2634
|
};
|
|
2642
|
-
|
|
2643
|
-
|
|
2644
|
-
|
|
2645
|
-
// TODO create a commandMap per rpc instance
|
|
2646
|
-
register(commandMap);
|
|
2647
|
-
const ipc = await listen$1(IpcChildWithModuleWorkerAndMessagePort$1);
|
|
2648
|
-
handleIpc(ipc);
|
|
2649
|
-
const rpc = createRpc(ipc);
|
|
2650
|
-
return rpc;
|
|
2635
|
+
|
|
2636
|
+
const getWebViewsVirtualDom = state => {
|
|
2637
|
+
return getFeatureWebViewsVirtualDom(state.webViews);
|
|
2651
2638
|
};
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
|
|
2639
|
+
|
|
2640
|
+
const registerAllFeatures = () => {
|
|
2641
|
+
register$1({
|
|
2642
|
+
id: Theme,
|
|
2643
|
+
getLabel: theme,
|
|
2644
|
+
isEnabled: featureThemeEnabled,
|
|
2645
|
+
getDetails: getThemeDetails,
|
|
2646
|
+
getVirtualDom: getThemeVirtualDom
|
|
2647
|
+
});
|
|
2648
|
+
register$1({
|
|
2649
|
+
id: Commands,
|
|
2650
|
+
getLabel: commands$1,
|
|
2651
|
+
isEnabled: featureCommandsEnabled,
|
|
2652
|
+
getDetails: getCommandsDetails,
|
|
2653
|
+
getVirtualDom: getCommandsVirtualDom
|
|
2654
|
+
});
|
|
2655
|
+
register$1({
|
|
2656
|
+
id: Settings,
|
|
2657
|
+
getLabel: settings,
|
|
2658
|
+
isEnabled: featureSettingsEnabled,
|
|
2659
|
+
getDetails: getSettingsDetails,
|
|
2660
|
+
getVirtualDom: getSettingsVirtualDom
|
|
2661
|
+
});
|
|
2662
|
+
register$1({
|
|
2663
|
+
id: JsonValidation,
|
|
2664
|
+
getLabel: jsonValidation,
|
|
2665
|
+
isEnabled: featureJsonValidationEnabled,
|
|
2666
|
+
getDetails: getJsonValidationDetails,
|
|
2667
|
+
getVirtualDom: getJsonValidationVirtualDom
|
|
2668
|
+
});
|
|
2669
|
+
register$1({
|
|
2670
|
+
id: ProgrammingLanguages,
|
|
2671
|
+
getLabel: programmingLanguages,
|
|
2672
|
+
isEnabled: featureProgrammingLanguagesEnabled,
|
|
2673
|
+
getDetails: getProgrammingLanguagesDetails,
|
|
2674
|
+
getVirtualDom: getProgrammingLanguagesVirtualDom
|
|
2675
|
+
});
|
|
2676
|
+
register$1({
|
|
2677
|
+
id: WebViews,
|
|
2678
|
+
getLabel: webViews,
|
|
2679
|
+
isEnabled: featureWebViewsEnabled,
|
|
2680
|
+
getDetails: getWebViewsDetails,
|
|
2681
|
+
getVirtualDom: getWebViewsVirtualDom
|
|
2682
|
+
});
|
|
2683
|
+
register$1({
|
|
2684
|
+
id: ActivationEvents,
|
|
2685
|
+
getLabel: activationEvents,
|
|
2686
|
+
isEnabled: featureActivationEventsEnabled,
|
|
2687
|
+
getDetails: getActivationEventsDetails,
|
|
2688
|
+
getVirtualDom: getActivationEventsVirtualDom
|
|
2689
|
+
});
|
|
2690
|
+
register$1({
|
|
2691
|
+
id: RuntimeStatus,
|
|
2692
|
+
getLabel: runtimeStatus,
|
|
2693
|
+
isEnabled: featureRuntimeStatusEnabled,
|
|
2694
|
+
getDetails: getRuntimeStatusDetails,
|
|
2695
|
+
getVirtualDom: getRuntimeStatusVirtualDom
|
|
2696
|
+
});
|
|
2655
2697
|
};
|
|
2656
2698
|
|
|
2657
2699
|
const toCommandId = key => {
|
|
@@ -2740,6 +2782,7 @@ const terminate = () => {
|
|
|
2740
2782
|
|
|
2741
2783
|
const {
|
|
2742
2784
|
disableExtension: disableExtension$1,
|
|
2785
|
+
enableExtension: enableExtension$1,
|
|
2743
2786
|
getAllExtensions: getAllExtensions$1,
|
|
2744
2787
|
getExtension: getExtension$2,
|
|
2745
2788
|
openExtensionSearch: openExtensionSearch$1,
|
|
@@ -3095,6 +3138,14 @@ const handleClickDisable = async state => {
|
|
|
3095
3138
|
return updateExtensionStatus(state, disableExtension);
|
|
3096
3139
|
};
|
|
3097
3140
|
|
|
3141
|
+
const enableExtension = id => {
|
|
3142
|
+
return enableExtension$1(id);
|
|
3143
|
+
};
|
|
3144
|
+
|
|
3145
|
+
const handleClickEnable = async state => {
|
|
3146
|
+
return updateExtensionStatus(state, enableExtension);
|
|
3147
|
+
};
|
|
3148
|
+
|
|
3098
3149
|
const selectFeature = async (state, name) => {
|
|
3099
3150
|
if (!name) {
|
|
3100
3151
|
return state;
|
|
@@ -3413,7 +3464,7 @@ const createExtensionHostWorkerRpc = async () => {
|
|
|
3413
3464
|
|
|
3414
3465
|
const initializeExtensionHostWorker = async () => {
|
|
3415
3466
|
const rpc = await createExtensionHostWorkerRpc();
|
|
3416
|
-
set$
|
|
3467
|
+
set$4(rpc);
|
|
3417
3468
|
};
|
|
3418
3469
|
|
|
3419
3470
|
const sendMessagePortToFileSystemWorker = async port => {
|
|
@@ -3455,7 +3506,7 @@ const createMarkdownWorkerRpc = async () => {
|
|
|
3455
3506
|
|
|
3456
3507
|
const initializeMarkdownWorker = async () => {
|
|
3457
3508
|
const rpc = await createMarkdownWorkerRpc();
|
|
3458
|
-
set$
|
|
3509
|
+
set$3(rpc);
|
|
3459
3510
|
};
|
|
3460
3511
|
|
|
3461
3512
|
const initialize = async () => {
|
|
@@ -3711,7 +3762,7 @@ const log10 = numberOrBigInt => {
|
|
|
3711
3762
|
return Math.log10(numberOrBigInt);
|
|
3712
3763
|
}
|
|
3713
3764
|
const string = numberOrBigInt.toString(10);
|
|
3714
|
-
return string.length + Math.log10(
|
|
3765
|
+
return string.length + Math.log10(`0.${string.slice(0, 15)}`);
|
|
3715
3766
|
};
|
|
3716
3767
|
const log = numberOrBigInt => {
|
|
3717
3768
|
if (typeof numberOrBigInt === 'number') {
|
|
@@ -3727,6 +3778,36 @@ const divide = (numberOrBigInt, divisor) => {
|
|
|
3727
3778
|
const remainder = numberOrBigInt % BigInt(divisor);
|
|
3728
3779
|
return Number(integerPart) + Number(remainder) / divisor;
|
|
3729
3780
|
};
|
|
3781
|
+
const applyFixedWidth = (result, fixedWidth) => {
|
|
3782
|
+
if (fixedWidth === undefined) {
|
|
3783
|
+
return result;
|
|
3784
|
+
}
|
|
3785
|
+
if (typeof fixedWidth !== 'number' || !Number.isSafeInteger(fixedWidth) || fixedWidth < 0) {
|
|
3786
|
+
throw new TypeError(`Expected fixedWidth to be a non-negative integer, got ${typeof fixedWidth}: ${fixedWidth}`);
|
|
3787
|
+
}
|
|
3788
|
+
if (fixedWidth === 0) {
|
|
3789
|
+
return result;
|
|
3790
|
+
}
|
|
3791
|
+
return result.length < fixedWidth ? result.padStart(fixedWidth, ' ') : result;
|
|
3792
|
+
};
|
|
3793
|
+
const buildLocaleOptions = options => {
|
|
3794
|
+
const {
|
|
3795
|
+
minimumFractionDigits,
|
|
3796
|
+
maximumFractionDigits
|
|
3797
|
+
} = options;
|
|
3798
|
+
if (minimumFractionDigits === undefined && maximumFractionDigits === undefined) {
|
|
3799
|
+
return undefined;
|
|
3800
|
+
}
|
|
3801
|
+
return {
|
|
3802
|
+
...(minimumFractionDigits !== undefined && {
|
|
3803
|
+
minimumFractionDigits
|
|
3804
|
+
}),
|
|
3805
|
+
...(maximumFractionDigits !== undefined && {
|
|
3806
|
+
maximumFractionDigits
|
|
3807
|
+
}),
|
|
3808
|
+
roundingMode: 'trunc'
|
|
3809
|
+
};
|
|
3810
|
+
};
|
|
3730
3811
|
function prettyBytes(number, options) {
|
|
3731
3812
|
if (typeof number !== 'bigint' && !Number.isFinite(number)) {
|
|
3732
3813
|
throw new TypeError(`Expected a finite number, got ${typeof number}: ${number}`);
|
|
@@ -3735,43 +3816,40 @@ function prettyBytes(number, options) {
|
|
|
3735
3816
|
bits: false,
|
|
3736
3817
|
binary: false,
|
|
3737
3818
|
space: true,
|
|
3819
|
+
nonBreakingSpace: false,
|
|
3738
3820
|
...options
|
|
3739
3821
|
};
|
|
3740
3822
|
const UNITS = options.bits ? options.binary ? BIBIT_UNITS : BIT_UNITS : options.binary ? BIBYTE_UNITS : BYTE_UNITS;
|
|
3741
|
-
const separator = options.space ? ' ' : '';
|
|
3742
|
-
|
|
3743
|
-
|
|
3823
|
+
const separator = options.space ? options.nonBreakingSpace ? '\u00A0' : ' ' : '';
|
|
3824
|
+
|
|
3825
|
+
// Handle signed zero case
|
|
3826
|
+
const isZero = typeof number === 'number' ? number === 0 : number === 0n;
|
|
3827
|
+
if (options.signed && isZero) {
|
|
3828
|
+
const result = ` 0${separator}${UNITS[0]}`;
|
|
3829
|
+
return applyFixedWidth(result, options.fixedWidth);
|
|
3744
3830
|
}
|
|
3745
3831
|
const isNegative = number < 0;
|
|
3746
3832
|
const prefix = isNegative ? '-' : options.signed ? '+' : '';
|
|
3747
3833
|
if (isNegative) {
|
|
3748
3834
|
number = -number;
|
|
3749
3835
|
}
|
|
3750
|
-
|
|
3751
|
-
|
|
3752
|
-
localeOptions = {
|
|
3753
|
-
minimumFractionDigits: options.minimumFractionDigits
|
|
3754
|
-
};
|
|
3755
|
-
}
|
|
3756
|
-
if (options.maximumFractionDigits !== undefined) {
|
|
3757
|
-
localeOptions = {
|
|
3758
|
-
maximumFractionDigits: options.maximumFractionDigits,
|
|
3759
|
-
...localeOptions
|
|
3760
|
-
};
|
|
3761
|
-
}
|
|
3836
|
+
const localeOptions = buildLocaleOptions(options);
|
|
3837
|
+
let result;
|
|
3762
3838
|
if (number < 1) {
|
|
3763
3839
|
const numberString = toLocaleString(number, options.locale, localeOptions);
|
|
3764
|
-
|
|
3765
|
-
}
|
|
3766
|
-
|
|
3767
|
-
|
|
3768
|
-
|
|
3769
|
-
|
|
3770
|
-
|
|
3840
|
+
result = prefix + numberString + separator + UNITS[0];
|
|
3841
|
+
} else {
|
|
3842
|
+
const exponent = Math.min(Math.floor(options.binary ? log(number) / Math.log(1024) : log10(number) / 3), UNITS.length - 1);
|
|
3843
|
+
number = divide(number, (options.binary ? 1024 : 1000) ** exponent);
|
|
3844
|
+
if (!localeOptions) {
|
|
3845
|
+
const minPrecision = Math.max(3, Math.floor(number).toString().length);
|
|
3846
|
+
number = number.toPrecision(minPrecision);
|
|
3847
|
+
}
|
|
3848
|
+
const numberString = toLocaleString(Number(number), options.locale, localeOptions);
|
|
3849
|
+
const unit = UNITS[exponent];
|
|
3850
|
+
result = prefix + numberString + separator + unit;
|
|
3771
3851
|
}
|
|
3772
|
-
|
|
3773
|
-
const unit = UNITS[exponent];
|
|
3774
|
-
return prefix + numberString + separator + unit;
|
|
3852
|
+
return applyFixedWidth(result, options.fixedWidth);
|
|
3775
3853
|
}
|
|
3776
3854
|
|
|
3777
3855
|
const getDisplaySize = size => {
|
|
@@ -4645,6 +4723,7 @@ const commandMap = {
|
|
|
4645
4723
|
'ExtensionDetail.getMenus': getMenus,
|
|
4646
4724
|
'ExtensionDetail.handleClickCategory': wrapCommand(handleClickCategory),
|
|
4647
4725
|
'ExtensionDetail.handleClickDisable': wrapCommand(handleClickDisable),
|
|
4726
|
+
'ExtensionDetail.handleClickEnable': wrapCommand(handleClickEnable),
|
|
4648
4727
|
'ExtensionDetail.handleClickScrollToTop': wrapCommand(handleClickScrollToTop),
|
|
4649
4728
|
'ExtensionDetail.handleClickSetColorTheme': wrapCommand(handleClickSetColorTheme),
|
|
4650
4729
|
'ExtensionDetail.handleClickSettings': wrapCommand(handleClickSettings),
|