@lvce-editor/running-extensions-view 1.7.0 → 1.9.1
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/runningExtensionsViewMain.js +283 -62
- package/package.json +1 -1
|
@@ -63,7 +63,7 @@ class AssertionError extends Error {
|
|
|
63
63
|
const Object$1 = 1;
|
|
64
64
|
const Number$1 = 2;
|
|
65
65
|
const Array$1 = 3;
|
|
66
|
-
const String = 4;
|
|
66
|
+
const String$1 = 4;
|
|
67
67
|
const Boolean$1 = 5;
|
|
68
68
|
const Function = 6;
|
|
69
69
|
const Null = 7;
|
|
@@ -75,7 +75,7 @@ const getType = value => {
|
|
|
75
75
|
case 'function':
|
|
76
76
|
return Function;
|
|
77
77
|
case 'string':
|
|
78
|
-
return String;
|
|
78
|
+
return String$1;
|
|
79
79
|
case 'object':
|
|
80
80
|
if (value === null) {
|
|
81
81
|
return Null;
|
|
@@ -586,7 +586,10 @@ const constructError = (message, type, name) => {
|
|
|
586
586
|
if (ErrorConstructor === Error) {
|
|
587
587
|
const error = new Error(message);
|
|
588
588
|
if (name && name !== 'VError') {
|
|
589
|
-
error
|
|
589
|
+
Object.defineProperty(error, 'name', {
|
|
590
|
+
configurable: true,
|
|
591
|
+
value: name
|
|
592
|
+
});
|
|
590
593
|
}
|
|
591
594
|
return error;
|
|
592
595
|
}
|
|
@@ -617,31 +620,45 @@ const getParentStack = error => {
|
|
|
617
620
|
};
|
|
618
621
|
const MethodNotFound = -32601;
|
|
619
622
|
const Custom = -32001;
|
|
623
|
+
const setStack = (error, stack) => {
|
|
624
|
+
const descriptor = Object.getOwnPropertyDescriptor(error, 'stack');
|
|
625
|
+
if (descriptor) {
|
|
626
|
+
if (!descriptor.configurable && !descriptor.writable) {
|
|
627
|
+
return;
|
|
628
|
+
}
|
|
629
|
+
if (!descriptor.configurable && descriptor.writable) {
|
|
630
|
+
error.stack = stack;
|
|
631
|
+
return;
|
|
632
|
+
}
|
|
633
|
+
}
|
|
634
|
+
Object.defineProperty(error, 'stack', {
|
|
635
|
+
configurable: true,
|
|
636
|
+
value: stack,
|
|
637
|
+
writable: true
|
|
638
|
+
});
|
|
639
|
+
};
|
|
620
640
|
const restoreExistingError = (error, currentStack) => {
|
|
621
641
|
if (typeof error.stack === 'string') {
|
|
622
|
-
error
|
|
642
|
+
setStack(error, `${error.stack}${NewLine}${currentStack}`);
|
|
623
643
|
}
|
|
624
644
|
return error;
|
|
625
645
|
};
|
|
626
646
|
const restoreMethodNotFoundError = (error, currentStack) => {
|
|
627
647
|
const restoredError = new JsonRpcError(error.message);
|
|
628
648
|
const parentStack = getParentStack(error);
|
|
629
|
-
restoredError
|
|
649
|
+
setStack(restoredError, `${parentStack}${NewLine}${currentStack}`);
|
|
630
650
|
return restoredError;
|
|
631
651
|
};
|
|
632
652
|
const restoreStackFromData = (restoredError, error, currentStack) => {
|
|
633
653
|
if (error.data.stack && error.data.type && error.message) {
|
|
634
|
-
restoredError
|
|
654
|
+
setStack(restoredError, `${error.data.type}: ${error.message}${NewLine}${error.data.stack}${NewLine}${currentStack}`);
|
|
635
655
|
return;
|
|
636
656
|
}
|
|
637
657
|
if (error.data.stack) {
|
|
638
|
-
restoredError
|
|
658
|
+
setStack(restoredError, error.data.stack);
|
|
639
659
|
}
|
|
640
660
|
};
|
|
641
661
|
const applyDataProperties = (restoredError, error) => {
|
|
642
|
-
if (!error.data) {
|
|
643
|
-
return;
|
|
644
|
-
}
|
|
645
662
|
restoreStackFromData(restoredError, error, getCurrentStack());
|
|
646
663
|
if (error.data.codeFrame) {
|
|
647
664
|
// @ts-ignore
|
|
@@ -662,7 +679,7 @@ const applyDirectProperties = (restoredError, error) => {
|
|
|
662
679
|
const indexNewLine = getNewLineIndex(lowerStack);
|
|
663
680
|
const parentStack = getParentStack(error);
|
|
664
681
|
// @ts-ignore
|
|
665
|
-
restoredError
|
|
682
|
+
setStack(restoredError, `${parentStack}${lowerStack.slice(indexNewLine)}`);
|
|
666
683
|
}
|
|
667
684
|
if (error.codeFrame) {
|
|
668
685
|
// @ts-ignore
|
|
@@ -1371,8 +1388,14 @@ const sendMessagePortToExtensionManagementWorker = async (port, rpcId) => {
|
|
|
1371
1388
|
const getWindowId = async () => {
|
|
1372
1389
|
return invoke('GetWindowId.getWindowId');
|
|
1373
1390
|
};
|
|
1391
|
+
const openExternal = async uri => {
|
|
1392
|
+
await invoke('Open.openExternal', uri);
|
|
1393
|
+
};
|
|
1394
|
+
const openUrl = async uri => {
|
|
1395
|
+
await invoke('Open.openUrl', uri);
|
|
1396
|
+
};
|
|
1374
1397
|
|
|
1375
|
-
const copyId = async (state, index) => {
|
|
1398
|
+
const copyId$1 = async (state, index) => {
|
|
1376
1399
|
const {
|
|
1377
1400
|
extensions
|
|
1378
1401
|
} = state;
|
|
@@ -1643,8 +1666,10 @@ const create = (uid, uri, x, y, width, height, platform, assetDir) => {
|
|
|
1643
1666
|
extensions: [],
|
|
1644
1667
|
focusedIndex: -1,
|
|
1645
1668
|
height,
|
|
1669
|
+
itemHeight: 72,
|
|
1646
1670
|
loaded: false,
|
|
1647
1671
|
platform,
|
|
1672
|
+
selectedIndex: -1,
|
|
1648
1673
|
uid,
|
|
1649
1674
|
width,
|
|
1650
1675
|
x,
|
|
@@ -1654,7 +1679,7 @@ const create = (uid, uri, x, y, width, height, platform, assetDir) => {
|
|
|
1654
1679
|
};
|
|
1655
1680
|
|
|
1656
1681
|
const isDomEqual = (oldState, newState) => {
|
|
1657
|
-
return oldState.extensions === newState.extensions && oldState.loaded === newState.loaded;
|
|
1682
|
+
return oldState.extensions === newState.extensions && oldState.focusedIndex === newState.focusedIndex && oldState.loaded === newState.loaded && oldState.selectedIndex === newState.selectedIndex;
|
|
1658
1683
|
};
|
|
1659
1684
|
const isCssEqual = (oldState, newState) => {
|
|
1660
1685
|
return oldState.width === newState.width && oldState.height === newState.height;
|
|
@@ -1667,7 +1692,7 @@ const diff2 = uid => {
|
|
|
1667
1692
|
return diff(uid, [isDomEqual, isCssEqual], [RenderDom, RenderCss]);
|
|
1668
1693
|
};
|
|
1669
1694
|
|
|
1670
|
-
const disable = async (state, index) => {
|
|
1695
|
+
const disable$1 = async (state, index) => {
|
|
1671
1696
|
const {
|
|
1672
1697
|
extensions,
|
|
1673
1698
|
platform
|
|
@@ -1679,7 +1704,7 @@ const disable = async (state, index) => {
|
|
|
1679
1704
|
return state;
|
|
1680
1705
|
};
|
|
1681
1706
|
|
|
1682
|
-
const disableWorkspace = async (state, index) => {
|
|
1707
|
+
const disableWorkspace$1 = async (state, index) => {
|
|
1683
1708
|
const {
|
|
1684
1709
|
extensions
|
|
1685
1710
|
} = state;
|
|
@@ -1690,6 +1715,86 @@ const disableWorkspace = async (state, index) => {
|
|
|
1690
1715
|
return state;
|
|
1691
1716
|
};
|
|
1692
1717
|
|
|
1718
|
+
const emptyObject = {};
|
|
1719
|
+
const i18nString = (key, placeholders = emptyObject) => {
|
|
1720
|
+
if (placeholders === emptyObject) {
|
|
1721
|
+
return key;
|
|
1722
|
+
}
|
|
1723
|
+
let result = key;
|
|
1724
|
+
for (const [placeholder, replacement] of Object.entries(placeholders)) {
|
|
1725
|
+
result = result.split(`{${placeholder}}`).join(String(replacement));
|
|
1726
|
+
}
|
|
1727
|
+
return result;
|
|
1728
|
+
};
|
|
1729
|
+
|
|
1730
|
+
const ActivationReason = 'Activation reason: {PH1}';
|
|
1731
|
+
const ActivationTime = 'Activation: {PH1}ms';
|
|
1732
|
+
const CopyId = 'Copy id ({PH1})';
|
|
1733
|
+
const Disable = 'Disable';
|
|
1734
|
+
const DisableWorkspace = 'Disable (Workspace)';
|
|
1735
|
+
const ExtensionApiElectron = 'Extension API (Electron): {PH1}';
|
|
1736
|
+
const ExtensionHostProfilingNotAvailable = 'Extension host profiling is not available yet.';
|
|
1737
|
+
const LoadingRunningExtensions = 'Loading running extensions…';
|
|
1738
|
+
const NoRunningExtensions = 'No running extensions';
|
|
1739
|
+
const ReportIssue = 'Report Issue';
|
|
1740
|
+
const ReportingIssuesNotSupported = 'Reporting issues is not supported for this extension.';
|
|
1741
|
+
const Ssh = 'SSH: {PH1}';
|
|
1742
|
+
const StartExtensionHostProfile = 'Start Extension Host Profile';
|
|
1743
|
+
const TakeHeapSnapshot = 'Take Heap Snapshot';
|
|
1744
|
+
|
|
1745
|
+
const activationReason = reason => {
|
|
1746
|
+
return i18nString(ActivationReason, {
|
|
1747
|
+
PH1: reason
|
|
1748
|
+
});
|
|
1749
|
+
};
|
|
1750
|
+
const activationTime = milliseconds => {
|
|
1751
|
+
return i18nString(ActivationTime, {
|
|
1752
|
+
PH1: milliseconds
|
|
1753
|
+
});
|
|
1754
|
+
};
|
|
1755
|
+
const copyId = id => {
|
|
1756
|
+
return i18nString(CopyId, {
|
|
1757
|
+
PH1: id
|
|
1758
|
+
});
|
|
1759
|
+
};
|
|
1760
|
+
const disable = () => {
|
|
1761
|
+
return i18nString(Disable);
|
|
1762
|
+
};
|
|
1763
|
+
const disableWorkspace = () => {
|
|
1764
|
+
return i18nString(DisableWorkspace);
|
|
1765
|
+
};
|
|
1766
|
+
const extensionApiElectron = id => {
|
|
1767
|
+
return i18nString(ExtensionApiElectron, {
|
|
1768
|
+
PH1: id
|
|
1769
|
+
});
|
|
1770
|
+
};
|
|
1771
|
+
const extensionHostProfilingNotAvailable = () => {
|
|
1772
|
+
return i18nString(ExtensionHostProfilingNotAvailable);
|
|
1773
|
+
};
|
|
1774
|
+
const loadingRunningExtensions = () => {
|
|
1775
|
+
return i18nString(LoadingRunningExtensions);
|
|
1776
|
+
};
|
|
1777
|
+
const noRunningExtensions = () => {
|
|
1778
|
+
return i18nString(NoRunningExtensions);
|
|
1779
|
+
};
|
|
1780
|
+
const reportIssue$1 = () => {
|
|
1781
|
+
return i18nString(ReportIssue);
|
|
1782
|
+
};
|
|
1783
|
+
const reportingIssuesNotSupported = () => {
|
|
1784
|
+
return i18nString(ReportingIssuesNotSupported);
|
|
1785
|
+
};
|
|
1786
|
+
const ssh = host => {
|
|
1787
|
+
return i18nString(Ssh, {
|
|
1788
|
+
PH1: host
|
|
1789
|
+
});
|
|
1790
|
+
};
|
|
1791
|
+
const startExtensionHostProfile = () => {
|
|
1792
|
+
return i18nString(StartExtensionHostProfile);
|
|
1793
|
+
};
|
|
1794
|
+
const takeHeapSnapshot$1 = () => {
|
|
1795
|
+
return i18nString(TakeHeapSnapshot);
|
|
1796
|
+
};
|
|
1797
|
+
|
|
1693
1798
|
const getMenuEntries = state => {
|
|
1694
1799
|
const {
|
|
1695
1800
|
extensions,
|
|
@@ -1706,13 +1811,13 @@ const getMenuEntries = state => {
|
|
|
1706
1811
|
command: 'RunningExtensions.copyId',
|
|
1707
1812
|
flags: None$1,
|
|
1708
1813
|
id: 'copyId',
|
|
1709
|
-
label:
|
|
1814
|
+
label: copyId(extension.id)
|
|
1710
1815
|
}, {
|
|
1711
1816
|
args,
|
|
1712
1817
|
command: 'RunningExtensions.reportIssue',
|
|
1713
1818
|
flags: None$1,
|
|
1714
1819
|
id: 'reportIssue',
|
|
1715
|
-
label:
|
|
1820
|
+
label: reportIssue$1()
|
|
1716
1821
|
}, {
|
|
1717
1822
|
command: '',
|
|
1718
1823
|
flags: Separator,
|
|
@@ -1723,13 +1828,13 @@ const getMenuEntries = state => {
|
|
|
1723
1828
|
command: 'RunningExtensions.disableWorkspace',
|
|
1724
1829
|
flags: None$1,
|
|
1725
1830
|
id: 'disableWorkspace',
|
|
1726
|
-
label:
|
|
1831
|
+
label: disableWorkspace()
|
|
1727
1832
|
}, {
|
|
1728
1833
|
args,
|
|
1729
1834
|
command: 'RunningExtensions.disable',
|
|
1730
1835
|
flags: None$1,
|
|
1731
1836
|
id: 'disable',
|
|
1732
|
-
label:
|
|
1837
|
+
label: disable()
|
|
1733
1838
|
}, {
|
|
1734
1839
|
command: '',
|
|
1735
1840
|
flags: Separator,
|
|
@@ -1739,7 +1844,7 @@ const getMenuEntries = state => {
|
|
|
1739
1844
|
command: 'RunningExtensions.startProfile',
|
|
1740
1845
|
flags: None$1,
|
|
1741
1846
|
id: 'startProfile',
|
|
1742
|
-
label:
|
|
1847
|
+
label: startExtensionHostProfile()
|
|
1743
1848
|
}];
|
|
1744
1849
|
if (platform === Electron && extension.isolated) {
|
|
1745
1850
|
menuEntries.push({
|
|
@@ -1747,16 +1852,29 @@ const getMenuEntries = state => {
|
|
|
1747
1852
|
command: 'RunningExtensions.takeHeapSnapshot',
|
|
1748
1853
|
flags: None$1,
|
|
1749
1854
|
id: 'takeHeapSnapshot',
|
|
1750
|
-
label:
|
|
1855
|
+
label: takeHeapSnapshot$1()
|
|
1751
1856
|
});
|
|
1752
1857
|
}
|
|
1753
1858
|
return menuEntries;
|
|
1754
1859
|
};
|
|
1755
1860
|
|
|
1756
|
-
const RunningExtensions = 32;
|
|
1861
|
+
const RunningExtensions$1 = 32;
|
|
1757
1862
|
|
|
1758
1863
|
const getMenuEntryIds = () => {
|
|
1759
|
-
return [RunningExtensions];
|
|
1864
|
+
return [RunningExtensions$1];
|
|
1865
|
+
};
|
|
1866
|
+
|
|
1867
|
+
const handleClickAt = (state, eventY) => {
|
|
1868
|
+
const {
|
|
1869
|
+
extensions,
|
|
1870
|
+
itemHeight,
|
|
1871
|
+
y
|
|
1872
|
+
} = state;
|
|
1873
|
+
const index = Math.floor((eventY - y) / itemHeight);
|
|
1874
|
+
return {
|
|
1875
|
+
...state,
|
|
1876
|
+
selectedIndex: extensions[index] ? index : -1
|
|
1877
|
+
};
|
|
1760
1878
|
};
|
|
1761
1879
|
|
|
1762
1880
|
const show = async (uid, menuId, x, y, args) => {
|
|
@@ -1777,8 +1895,8 @@ const handleContextMenu = async (state, index, x = 0, y = 0) => {
|
|
|
1777
1895
|
focusedIndex
|
|
1778
1896
|
};
|
|
1779
1897
|
set(uid, state, newState);
|
|
1780
|
-
await show(uid, RunningExtensions, x, y, {
|
|
1781
|
-
menuId: RunningExtensions
|
|
1898
|
+
await show(uid, RunningExtensions$1, x, y, {
|
|
1899
|
+
menuId: RunningExtensions$1
|
|
1782
1900
|
});
|
|
1783
1901
|
return newState;
|
|
1784
1902
|
};
|
|
@@ -1801,12 +1919,17 @@ const loadContent = async state => {
|
|
|
1801
1919
|
};
|
|
1802
1920
|
|
|
1803
1921
|
const getCss = (width, height) => {
|
|
1804
|
-
return `width: ${width}px; height: ${height}px;`;
|
|
1922
|
+
return `width: ${width}px; height: ${height}px; flex: 1;`;
|
|
1805
1923
|
};
|
|
1806
1924
|
|
|
1807
1925
|
const renderCss = (oldState, newState) => {
|
|
1808
|
-
const
|
|
1809
|
-
|
|
1926
|
+
const {
|
|
1927
|
+
height,
|
|
1928
|
+
uid,
|
|
1929
|
+
width
|
|
1930
|
+
} = newState;
|
|
1931
|
+
const css = getCss(width, height);
|
|
1932
|
+
return [SetCss, uid, css];
|
|
1810
1933
|
};
|
|
1811
1934
|
|
|
1812
1935
|
const mergeClassNames = (...classNames) => {
|
|
@@ -1827,13 +1950,34 @@ const List = 'list';
|
|
|
1827
1950
|
const ListItem = 'listitem';
|
|
1828
1951
|
const None = 'none';
|
|
1829
1952
|
|
|
1953
|
+
const FocusOutline = 'FocusOutline';
|
|
1954
|
+
const Grow = 'Grow';
|
|
1955
|
+
const MaskIcon = 'MaskIcon';
|
|
1956
|
+
const MaskIconExtensions = 'MaskIconExtensions';
|
|
1957
|
+
const ExtensionActive = 'ExtensionActive';
|
|
1958
|
+
const RunningExtension = 'RunningExtension';
|
|
1959
|
+
const RunningExtensionActivationDetails = 'RunningExtensionActivationDetails';
|
|
1960
|
+
const RunningExtensionActivationReason = 'RunningExtensionActivationReason';
|
|
1961
|
+
const RunningExtensionActivationTime = 'RunningExtensionActivationTime';
|
|
1962
|
+
const RunningExtensionDefaultIcon = 'RunningExtensionDefaultIcon';
|
|
1963
|
+
const RunningExtensionDetails = 'RunningExtensionDetails';
|
|
1964
|
+
const RunningExtensionIcon = 'RunningExtensionIcon';
|
|
1965
|
+
const RunningExtensionId = 'RunningExtensionId';
|
|
1966
|
+
const RunningExtensionName = 'RunningExtensionName';
|
|
1967
|
+
const RunningExtensionRemoteAuthority = 'RunningExtensionRemoteAuthority';
|
|
1968
|
+
const RunningExtensions = 'RunningExtensions';
|
|
1969
|
+
const RunningExtensionsEmpty = 'RunningExtensionsEmpty';
|
|
1970
|
+
const RunningExtensionTitle = 'RunningExtensionTitle';
|
|
1971
|
+
const RunningExtensionVersion = 'RunningExtensionVersion';
|
|
1972
|
+
|
|
1830
1973
|
const HandleContextMenu = 3;
|
|
1974
|
+
const HandleClick = 4;
|
|
1831
1975
|
|
|
1832
1976
|
const getIconVirtualDom = (extension, index) => {
|
|
1833
1977
|
if (extension.icon) {
|
|
1834
1978
|
return [{
|
|
1835
1979
|
childCount: 0,
|
|
1836
|
-
className:
|
|
1980
|
+
className: RunningExtensionIcon,
|
|
1837
1981
|
'data-index': index,
|
|
1838
1982
|
src: extension.icon,
|
|
1839
1983
|
type: Img
|
|
@@ -1841,7 +1985,7 @@ const getIconVirtualDom = (extension, index) => {
|
|
|
1841
1985
|
}
|
|
1842
1986
|
return [{
|
|
1843
1987
|
childCount: 0,
|
|
1844
|
-
className: mergeClassNames(
|
|
1988
|
+
className: mergeClassNames(RunningExtensionIcon, RunningExtensionDefaultIcon, MaskIcon, MaskIconExtensions),
|
|
1845
1989
|
'data-index': index,
|
|
1846
1990
|
role: None,
|
|
1847
1991
|
type: Div
|
|
@@ -1849,6 +1993,17 @@ const getIconVirtualDom = (extension, index) => {
|
|
|
1849
1993
|
};
|
|
1850
1994
|
|
|
1851
1995
|
const sshRemotePrefix = 'ssh-remote+';
|
|
1996
|
+
const getActivationReasonVirtualDom = (activationEvent, index) => {
|
|
1997
|
+
if (!activationEvent) {
|
|
1998
|
+
return [];
|
|
1999
|
+
}
|
|
2000
|
+
return [{
|
|
2001
|
+
childCount: 1,
|
|
2002
|
+
className: RunningExtensionActivationReason,
|
|
2003
|
+
'data-index': index,
|
|
2004
|
+
type: Div
|
|
2005
|
+
}, text(activationReason(activationEvent))];
|
|
2006
|
+
};
|
|
1852
2007
|
const getRemoteAuthorityVirtualDom = (remoteAuthority, index) => {
|
|
1853
2008
|
if (!remoteAuthority) {
|
|
1854
2009
|
return [];
|
|
@@ -1856,75 +2011,92 @@ const getRemoteAuthorityVirtualDom = (remoteAuthority, index) => {
|
|
|
1856
2011
|
const host = remoteAuthority.startsWith(sshRemotePrefix) ? remoteAuthority.slice(sshRemotePrefix.length) : remoteAuthority;
|
|
1857
2012
|
return [{
|
|
1858
2013
|
childCount: 1,
|
|
1859
|
-
className: mergeClassNames(
|
|
2014
|
+
className: mergeClassNames(RunningExtensionId, RunningExtensionRemoteAuthority),
|
|
1860
2015
|
'data-index': index,
|
|
1861
2016
|
type: Div
|
|
1862
|
-
}, text(
|
|
2017
|
+
}, text(ssh(host))];
|
|
1863
2018
|
};
|
|
1864
|
-
const getExtensionVirtualDom = (extension, index) => {
|
|
2019
|
+
const getExtensionVirtualDom = (extension, index, focused = false, selected = false) => {
|
|
1865
2020
|
const displayName = extension.name || extension.id;
|
|
2021
|
+
const activationReasonDom = getActivationReasonVirtualDom(extension.activationEvent, index);
|
|
1866
2022
|
const remoteAuthorityDom = getRemoteAuthorityVirtualDom(extension.remoteAuthority, index);
|
|
2023
|
+
let className = RunningExtension;
|
|
2024
|
+
if (focused) {
|
|
2025
|
+
className = mergeClassNames(className, FocusOutline);
|
|
2026
|
+
}
|
|
2027
|
+
if (selected) {
|
|
2028
|
+
className = mergeClassNames(className, ExtensionActive);
|
|
2029
|
+
}
|
|
1867
2030
|
return [{
|
|
1868
2031
|
childCount: 3,
|
|
1869
|
-
className
|
|
2032
|
+
className,
|
|
1870
2033
|
'data-index': index,
|
|
1871
2034
|
role: ListItem,
|
|
1872
2035
|
type: Div
|
|
1873
2036
|
}, ...getIconVirtualDom(extension, index), {
|
|
1874
2037
|
childCount: remoteAuthorityDom.length > 0 ? 3 : 2,
|
|
1875
|
-
className:
|
|
2038
|
+
className: RunningExtensionDetails,
|
|
1876
2039
|
'data-index': index,
|
|
1877
2040
|
type: Div
|
|
1878
2041
|
}, {
|
|
1879
2042
|
childCount: 2,
|
|
1880
|
-
className:
|
|
2043
|
+
className: RunningExtensionTitle,
|
|
1881
2044
|
'data-index': index,
|
|
1882
2045
|
type: Div
|
|
1883
2046
|
}, {
|
|
1884
2047
|
childCount: 1,
|
|
1885
|
-
className:
|
|
2048
|
+
className: RunningExtensionName,
|
|
1886
2049
|
'data-index': index,
|
|
1887
2050
|
type: Strong
|
|
1888
2051
|
}, text(displayName), {
|
|
1889
2052
|
childCount: 1,
|
|
1890
|
-
className:
|
|
2053
|
+
className: RunningExtensionVersion,
|
|
1891
2054
|
'data-index': index,
|
|
1892
2055
|
type: Span
|
|
1893
2056
|
}, text(extension.version), ...remoteAuthorityDom, {
|
|
1894
2057
|
childCount: 1,
|
|
1895
|
-
className:
|
|
2058
|
+
className: RunningExtensionId,
|
|
1896
2059
|
'data-index': index,
|
|
1897
2060
|
type: Div
|
|
1898
2061
|
}, text(extension.id), {
|
|
2062
|
+
childCount: activationReasonDom.length > 0 ? 2 : 1,
|
|
2063
|
+
className: RunningExtensionActivationDetails,
|
|
2064
|
+
'data-index': index,
|
|
2065
|
+
type: Div
|
|
2066
|
+
}, {
|
|
1899
2067
|
childCount: 1,
|
|
1900
|
-
className:
|
|
2068
|
+
className: RunningExtensionActivationTime,
|
|
1901
2069
|
'data-index': index,
|
|
1902
2070
|
type: Div
|
|
1903
|
-
}, text(
|
|
2071
|
+
}, text(activationTime(Math.round(extension.activationTime))), ...activationReasonDom];
|
|
1904
2072
|
};
|
|
1905
2073
|
|
|
2074
|
+
const emptyNode = {
|
|
2075
|
+
childCount: 1,
|
|
2076
|
+
className: RunningExtensionsEmpty,
|
|
2077
|
+
type: Div
|
|
2078
|
+
};
|
|
1906
2079
|
const getRunningExtensionsEmptyDom = loaded => {
|
|
1907
|
-
const message = loaded ?
|
|
2080
|
+
const message = loaded ? noRunningExtensions() : loadingRunningExtensions();
|
|
1908
2081
|
return [{
|
|
1909
2082
|
childCount: 1,
|
|
1910
|
-
className:
|
|
2083
|
+
className: mergeClassNames(RunningExtensions, Grow),
|
|
2084
|
+
onClick: HandleClick,
|
|
1911
2085
|
onContextMenu: HandleContextMenu,
|
|
1912
2086
|
role: List,
|
|
1913
2087
|
type: Div
|
|
1914
|
-
},
|
|
1915
|
-
childCount: 1,
|
|
1916
|
-
className: 'RunningExtensionsEmpty',
|
|
1917
|
-
type: Div
|
|
1918
|
-
}, text(message)];
|
|
2088
|
+
}, emptyNode, text(message)];
|
|
1919
2089
|
};
|
|
1920
|
-
|
|
2090
|
+
|
|
2091
|
+
const getRunningExtensionsVirtualDom = (extensions, loaded, focusedIndex = -1, selectedIndex = -1) => {
|
|
1921
2092
|
if (extensions.length === 0) {
|
|
1922
2093
|
return getRunningExtensionsEmptyDom(loaded);
|
|
1923
2094
|
}
|
|
1924
|
-
const children = extensions.flatMap(getExtensionVirtualDom);
|
|
2095
|
+
const children = extensions.flatMap((extension, index) => getExtensionVirtualDom(extension, index, index === focusedIndex, index === selectedIndex));
|
|
1925
2096
|
return [{
|
|
1926
2097
|
childCount: extensions.length,
|
|
1927
|
-
className:
|
|
2098
|
+
className: mergeClassNames(RunningExtensions, Grow),
|
|
2099
|
+
onClick: HandleClick,
|
|
1928
2100
|
onContextMenu: HandleContextMenu,
|
|
1929
2101
|
role: List,
|
|
1930
2102
|
type: Div
|
|
@@ -1932,7 +2104,7 @@ const getRunningExtensionsVirtualDom = (extensions, loaded) => {
|
|
|
1932
2104
|
};
|
|
1933
2105
|
|
|
1934
2106
|
const renderDom = (oldState, newState) => {
|
|
1935
|
-
return [SetDom2, newState.uid, getRunningExtensionsVirtualDom(newState.extensions, newState.loaded)];
|
|
2107
|
+
return [SetDom2, newState.uid, getRunningExtensionsVirtualDom(newState.extensions, newState.loaded, newState.focusedIndex, newState.selectedIndex)];
|
|
1936
2108
|
};
|
|
1937
2109
|
|
|
1938
2110
|
const getRenderer = diffType => {
|
|
@@ -1959,11 +2131,53 @@ const renderEventListeners = () => {
|
|
|
1959
2131
|
name: HandleContextMenu,
|
|
1960
2132
|
params: ['handleContextMenu', 'event.target.dataset.index', ClientX, ClientY],
|
|
1961
2133
|
preventDefault: true
|
|
2134
|
+
}, {
|
|
2135
|
+
name: HandleClick,
|
|
2136
|
+
params: ['handleClickAt', ClientY],
|
|
2137
|
+
preventDefault: true
|
|
1962
2138
|
}];
|
|
1963
2139
|
};
|
|
1964
2140
|
|
|
1965
|
-
const
|
|
1966
|
-
|
|
2141
|
+
const gitSuffixRegex = /\.git$/;
|
|
2142
|
+
const getIssuesUrl = repository => {
|
|
2143
|
+
if (typeof repository !== 'string') {
|
|
2144
|
+
return '';
|
|
2145
|
+
}
|
|
2146
|
+
let url;
|
|
2147
|
+
try {
|
|
2148
|
+
url = new URL(repository);
|
|
2149
|
+
} catch {
|
|
2150
|
+
return '';
|
|
2151
|
+
}
|
|
2152
|
+
if (url.protocol !== 'https:' || url.hostname !== 'github.com') {
|
|
2153
|
+
return '';
|
|
2154
|
+
}
|
|
2155
|
+
const [owner, repositoryWithSuffix] = url.pathname.split('/').filter(Boolean);
|
|
2156
|
+
if (!owner || !repositoryWithSuffix) {
|
|
2157
|
+
return '';
|
|
2158
|
+
}
|
|
2159
|
+
const repositoryName = repositoryWithSuffix.replace(gitSuffixRegex, '');
|
|
2160
|
+
if (!repositoryName) {
|
|
2161
|
+
return '';
|
|
2162
|
+
}
|
|
2163
|
+
return `https://github.com/${owner}/${repositoryName}/issues`;
|
|
2164
|
+
};
|
|
2165
|
+
|
|
2166
|
+
const reportIssue = async (state, index) => {
|
|
2167
|
+
const {
|
|
2168
|
+
extensions,
|
|
2169
|
+
platform
|
|
2170
|
+
} = state;
|
|
2171
|
+
const issuesUrl = getIssuesUrl(extensions[index]?.repository);
|
|
2172
|
+
if (!issuesUrl) {
|
|
2173
|
+
await confirm(reportingIssuesNotSupported());
|
|
2174
|
+
return state;
|
|
2175
|
+
}
|
|
2176
|
+
if (platform === Electron) {
|
|
2177
|
+
await openExternal(issuesUrl);
|
|
2178
|
+
} else {
|
|
2179
|
+
await openUrl(issuesUrl);
|
|
2180
|
+
}
|
|
1967
2181
|
return state;
|
|
1968
2182
|
};
|
|
1969
2183
|
|
|
@@ -1982,34 +2196,41 @@ const setExtensions = (state, extensions) => {
|
|
|
1982
2196
|
};
|
|
1983
2197
|
|
|
1984
2198
|
const startProfile = async state => {
|
|
1985
|
-
await confirm(
|
|
2199
|
+
await confirm(extensionHostProfilingNotAvailable());
|
|
1986
2200
|
return state;
|
|
1987
2201
|
};
|
|
1988
2202
|
|
|
1989
2203
|
const takeHeapSnapshot = async (state, index) => {
|
|
1990
2204
|
const {
|
|
1991
|
-
extensions
|
|
2205
|
+
extensions,
|
|
2206
|
+
platform
|
|
1992
2207
|
} = state;
|
|
1993
2208
|
const extension = extensions[index];
|
|
1994
|
-
if (!extension) {
|
|
2209
|
+
if (!extension || platform !== Electron || !extension.isolated) {
|
|
1995
2210
|
return state;
|
|
1996
2211
|
}
|
|
1997
2212
|
const windowId = await getWindowId();
|
|
1998
|
-
const workerName = extension.workerName ||
|
|
1999
|
-
await invoke('Developer.takeWorkerHeapSnapshot', windowId, workerName);
|
|
2213
|
+
const workerName = extension.workerName || extensionApiElectron(extension.id);
|
|
2214
|
+
const result = await invoke('Developer.takeWorkerHeapSnapshot', windowId, workerName);
|
|
2215
|
+
if (!result.ok) {
|
|
2216
|
+
await confirm(result.error);
|
|
2217
|
+
return state;
|
|
2218
|
+
}
|
|
2219
|
+
await invoke('Main.openUri', result.uri);
|
|
2000
2220
|
return state;
|
|
2001
2221
|
};
|
|
2002
2222
|
|
|
2003
2223
|
const commandMap = {
|
|
2004
|
-
'RunningExtensions.copyId': wrapCommand(copyId),
|
|
2224
|
+
'RunningExtensions.copyId': wrapCommand(copyId$1),
|
|
2005
2225
|
'RunningExtensions.create': create,
|
|
2006
2226
|
'RunningExtensions.diff2': diff2,
|
|
2007
|
-
'RunningExtensions.disable': wrapCommand(disable),
|
|
2008
|
-
'RunningExtensions.disableWorkspace': wrapCommand(disableWorkspace),
|
|
2227
|
+
'RunningExtensions.disable': wrapCommand(disable$1),
|
|
2228
|
+
'RunningExtensions.disableWorkspace': wrapCommand(disableWorkspace$1),
|
|
2009
2229
|
'RunningExtensions.dispose': dispose,
|
|
2010
2230
|
'RunningExtensions.getCommandIds': getCommandIds,
|
|
2011
2231
|
'RunningExtensions.getMenuEntries': wrapGetter(getMenuEntries),
|
|
2012
2232
|
'RunningExtensions.getMenuEntryIds': getMenuEntryIds,
|
|
2233
|
+
'RunningExtensions.handleClickAt': wrapCommand(handleClickAt),
|
|
2013
2234
|
'RunningExtensions.handleContextMenu': wrapCommand(handleContextMenu),
|
|
2014
2235
|
'RunningExtensions.loadContent': wrapCommand(loadContent),
|
|
2015
2236
|
'RunningExtensions.render2': render2,
|