@lvce-editor/source-control-worker 3.10.2 → 3.11.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/sourceControlWorkerMain.js +44 -15
- package/package.json +1 -1
|
@@ -1340,6 +1340,8 @@ const SourceControl$1 = 22;
|
|
|
1340
1340
|
const None = 0;
|
|
1341
1341
|
|
|
1342
1342
|
const Web = 1;
|
|
1343
|
+
const Electron = 2;
|
|
1344
|
+
const Remote = 3;
|
|
1343
1345
|
|
|
1344
1346
|
const SetCss = 'Viewlet.setCss';
|
|
1345
1347
|
const SetDom2 = 'Viewlet.setDom2';
|
|
@@ -1622,12 +1624,17 @@ const getEnabledProviderIds$1 = (scheme, root, assetDir, platform) => {
|
|
|
1622
1624
|
// noProviderFoundMessage: 'No source control provider found',
|
|
1623
1625
|
});
|
|
1624
1626
|
};
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1627
|
+
|
|
1628
|
+
const isCompatible = (extension, platform) => {
|
|
1629
|
+
return platform !== Web || extension?.compatibility?.web !== false;
|
|
1630
|
+
};
|
|
1631
|
+
const getExtensions = async (assetDir, platform) => {
|
|
1632
|
+
const extensions = await invoke$1('Extensions.getAllExtensions', assetDir, platform);
|
|
1633
|
+
return extensions.filter(extension => isCompatible(extension, platform));
|
|
1629
1634
|
};
|
|
1630
1635
|
|
|
1636
|
+
const EmptyString = '';
|
|
1637
|
+
|
|
1631
1638
|
const Disk = 'file';
|
|
1632
1639
|
|
|
1633
1640
|
const RE_PROTOCOL = /^([a-z-]+):\/\//;
|
|
@@ -1641,6 +1648,19 @@ const getProtocol = uri => {
|
|
|
1641
1648
|
}
|
|
1642
1649
|
return Disk;
|
|
1643
1650
|
};
|
|
1651
|
+
const PROTOCOL_POST_FIX_LENGTH = 3;
|
|
1652
|
+
const getPath = (protocol, uri) => {
|
|
1653
|
+
if (!uri) {
|
|
1654
|
+
return '';
|
|
1655
|
+
}
|
|
1656
|
+
if (protocol === Disk && !uri.startsWith('file://')) {
|
|
1657
|
+
return uri;
|
|
1658
|
+
}
|
|
1659
|
+
if (protocol === EmptyString) {
|
|
1660
|
+
return uri;
|
|
1661
|
+
}
|
|
1662
|
+
return uri.slice(protocol.length + PROTOCOL_POST_FIX_LENGTH);
|
|
1663
|
+
};
|
|
1644
1664
|
|
|
1645
1665
|
const acceptInput$1 = (providerId, text, assetDir, platform) => {
|
|
1646
1666
|
string(providerId);
|
|
@@ -1704,12 +1724,29 @@ const getEnabledProviderIds = (scheme, root, assetDir, platform) => {
|
|
|
1704
1724
|
const getGroups$1 = (providerId, root, assetDir, platform) => {
|
|
1705
1725
|
return getGroups$2(providerId, root, assetDir, platform);
|
|
1706
1726
|
};
|
|
1707
|
-
const getIconDefinitions = async providerIds => {
|
|
1727
|
+
const getIconDefinitions = async (providerIds, assetDir, platform) => {
|
|
1708
1728
|
try {
|
|
1709
1729
|
if (providerIds.length === 0) {
|
|
1710
1730
|
return [];
|
|
1711
1731
|
}
|
|
1712
|
-
|
|
1732
|
+
const extensions = await getExtensions(assetDir, platform);
|
|
1733
|
+
const extension = extensions.find(extension => {
|
|
1734
|
+
const idParts = typeof extension?.id === 'string' ? extension.id.split('.') : [];
|
|
1735
|
+
return idParts[1] === providerIds[0];
|
|
1736
|
+
});
|
|
1737
|
+
if (!Array.isArray(extension?.['source-control-icons']) || typeof extension.uri !== 'string') {
|
|
1738
|
+
return [];
|
|
1739
|
+
}
|
|
1740
|
+
const icons = extension['source-control-icons'].filter(icon => typeof icon === 'string');
|
|
1741
|
+
return icons.map(icon => {
|
|
1742
|
+
const uri = `${extension.uri}/${icon}`;
|
|
1743
|
+
if (platform === Electron || platform === Remote) {
|
|
1744
|
+
const protocol = getProtocol(uri);
|
|
1745
|
+
const path = getPath(protocol, uri);
|
|
1746
|
+
return `/remote${path.startsWith('/') ? '' : '/'}${path}`;
|
|
1747
|
+
}
|
|
1748
|
+
return uri;
|
|
1749
|
+
});
|
|
1713
1750
|
} catch {
|
|
1714
1751
|
return [];
|
|
1715
1752
|
}
|
|
@@ -1924,14 +1961,6 @@ const get$1 = key => {
|
|
|
1924
1961
|
return getPreference(key);
|
|
1925
1962
|
};
|
|
1926
1963
|
|
|
1927
|
-
const isCompatible = (extension, platform) => {
|
|
1928
|
-
return platform !== Web || extension?.compatibility?.web !== false;
|
|
1929
|
-
};
|
|
1930
|
-
const getExtensions = async (assetDir, platform) => {
|
|
1931
|
-
const extensions = await invoke$1('Extensions.getAllExtensions', assetDir, platform);
|
|
1932
|
-
return extensions.filter(extension => isCompatible(extension, platform));
|
|
1933
|
-
};
|
|
1934
|
-
|
|
1935
1964
|
const requestSourceActions = async (assetDir = '', platform = 0) => {
|
|
1936
1965
|
const extensions = await getExtensions(assetDir, platform);
|
|
1937
1966
|
const newCache = Object.create(null);
|
|
@@ -2045,7 +2074,7 @@ const loadContentActual = async (state, savedState) => {
|
|
|
2045
2074
|
const enabledProviderIds = await getEnabledProviderIds(scheme, root, assetDir, platform);
|
|
2046
2075
|
const providerUnavailableMessage = enabledProviderIds.length === 0 ? await getSourceControlUnavailableMessage(assetDir, platform) : '';
|
|
2047
2076
|
const showGenerateCommitMessageButton = enabledProviderIds.length === 0 ? false : await getShowGenerateCommitMessageButton(enabledProviderIds[0], assetDir, platform);
|
|
2048
|
-
const iconDefinitions = await getIconDefinitions(enabledProviderIds);
|
|
2077
|
+
const iconDefinitions = await getIconDefinitions(enabledProviderIds, assetDir, platform);
|
|
2049
2078
|
const {
|
|
2050
2079
|
allGroups,
|
|
2051
2080
|
gitRoot
|