@lvce-editor/extension-management-worker 1.10.0 → 1.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.
|
@@ -1704,20 +1704,18 @@ const getColorThemeJson$2 = async colorThemeId => {
|
|
|
1704
1704
|
return json;
|
|
1705
1705
|
};
|
|
1706
1706
|
|
|
1707
|
-
const
|
|
1708
|
-
|
|
1709
|
-
const getColorThemeUrlWeb = colorThemeId => {
|
|
1707
|
+
const getColorThemeUrlWeb = (assetDir, colorThemeId) => {
|
|
1710
1708
|
return `${assetDir}/extensions/builtin.theme-${colorThemeId}/color-theme.json`;
|
|
1711
1709
|
};
|
|
1712
|
-
const getColorThemeJson$1 = colorThemeId => {
|
|
1713
|
-
const url = getColorThemeUrlWeb(colorThemeId);
|
|
1710
|
+
const getColorThemeJson$1 = (colorThemeId, assetDir) => {
|
|
1711
|
+
const url = getColorThemeUrlWeb(assetDir, colorThemeId);
|
|
1714
1712
|
// TODO handle error ?
|
|
1715
1713
|
return getJson(url);
|
|
1716
1714
|
};
|
|
1717
1715
|
|
|
1718
|
-
const getColorThemeJson = (colorThemeId, platform) => {
|
|
1716
|
+
const getColorThemeJson = (colorThemeId, platform, assetDir) => {
|
|
1719
1717
|
if (platform === Web) {
|
|
1720
|
-
return getColorThemeJson$1(colorThemeId);
|
|
1718
|
+
return getColorThemeJson$1(colorThemeId, assetDir);
|
|
1721
1719
|
}
|
|
1722
1720
|
return getColorThemeJson$2(colorThemeId);
|
|
1723
1721
|
};
|
|
@@ -1727,8 +1725,8 @@ const getColorThemeCssFromJson = async (colorThemeId, colorThemeJson) => {
|
|
|
1727
1725
|
return colorThemeCss;
|
|
1728
1726
|
// TODO generate color theme from jsonc
|
|
1729
1727
|
};
|
|
1730
|
-
const getColorThemeCssNew = async (colorThemeId, platform) => {
|
|
1731
|
-
const colorThemeJson = await getColorThemeJson(colorThemeId, platform);
|
|
1728
|
+
const getColorThemeCssNew = async (colorThemeId, platform, assetDir) => {
|
|
1729
|
+
const colorThemeJson = await getColorThemeJson(colorThemeId, platform, assetDir);
|
|
1732
1730
|
const colorThemeCss = await getColorThemeCssFromJson(colorThemeId, colorThemeJson);
|
|
1733
1731
|
return colorThemeCss;
|
|
1734
1732
|
};
|
|
@@ -1848,7 +1846,14 @@ const installExtension = async () => {
|
|
|
1848
1846
|
// TODO
|
|
1849
1847
|
};
|
|
1850
1848
|
|
|
1851
|
-
const
|
|
1849
|
+
const getRemoteUrl = uri => {
|
|
1850
|
+
if (uri.startsWith('/')) {
|
|
1851
|
+
return `/remote${uri}`;
|
|
1852
|
+
}
|
|
1853
|
+
return `/remote/${uri}`;
|
|
1854
|
+
};
|
|
1855
|
+
|
|
1856
|
+
const getLanguagesFromExtension = (extension, platform) => {
|
|
1852
1857
|
// TODO what if extension is null? should not crash process, handle error gracefully
|
|
1853
1858
|
// TODO what if extension languages is not of type array?
|
|
1854
1859
|
// TODO what if language is null?
|
|
@@ -1870,7 +1875,7 @@ const getLanguagesFromExtension = extension => {
|
|
|
1870
1875
|
};
|
|
1871
1876
|
}
|
|
1872
1877
|
const relativePath = `${extensionPath}/${language.tokenize}`;
|
|
1873
|
-
const absolutePath = relativePath ;
|
|
1878
|
+
const absolutePath = platform === Web ? relativePath : getRemoteUrl(relativePath);
|
|
1874
1879
|
return {
|
|
1875
1880
|
...language,
|
|
1876
1881
|
extensionPath,
|
|
@@ -1882,10 +1887,10 @@ const getLanguagesFromExtension = extension => {
|
|
|
1882
1887
|
return extension.languages.map(getLanguageFromExtension);
|
|
1883
1888
|
};
|
|
1884
1889
|
|
|
1885
|
-
const getLanguages = async
|
|
1890
|
+
const getLanguages = async platform => {
|
|
1886
1891
|
try {
|
|
1887
1892
|
const extensions = await getAllExtensions();
|
|
1888
|
-
const languages = extensions.flatMap(getLanguagesFromExtension);
|
|
1893
|
+
const languages = extensions.flatMap(extension => getLanguagesFromExtension(extension, platform));
|
|
1889
1894
|
return languages;
|
|
1890
1895
|
} catch (error) {
|
|
1891
1896
|
throw new VError(error, 'Failed to load languages');
|