@lvce-editor/extension-management-worker 1.20.0 → 2.1.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.
|
@@ -96,6 +96,12 @@ const object = value => {
|
|
|
96
96
|
throw new AssertionError('expected value to be of type object');
|
|
97
97
|
}
|
|
98
98
|
};
|
|
99
|
+
const number = value => {
|
|
100
|
+
const type = getType(value);
|
|
101
|
+
if (type !== Number) {
|
|
102
|
+
throw new AssertionError('expected value to be of type number');
|
|
103
|
+
}
|
|
104
|
+
};
|
|
99
105
|
const string = value => {
|
|
100
106
|
const type = getType(value);
|
|
101
107
|
if (type !== String) {
|
|
@@ -1840,10 +1846,11 @@ const getWebExtensions = async assetDir => {
|
|
|
1840
1846
|
}
|
|
1841
1847
|
};
|
|
1842
1848
|
|
|
1843
|
-
const getAllExtensions = async assetDir => {
|
|
1844
|
-
|
|
1849
|
+
const getAllExtensions = async (assetDir, platform) => {
|
|
1850
|
+
string(assetDir);
|
|
1851
|
+
number(platform);
|
|
1845
1852
|
const meta = getDynamicWebExtensions();
|
|
1846
|
-
if (
|
|
1853
|
+
if (platform === Web) {
|
|
1847
1854
|
const webExtensions = await getWebExtensions(assetDir);
|
|
1848
1855
|
return [...webExtensions, ...meta];
|
|
1849
1856
|
}
|
|
@@ -1851,8 +1858,8 @@ const getAllExtensions = async assetDir => {
|
|
|
1851
1858
|
return [...local, ...meta];
|
|
1852
1859
|
};
|
|
1853
1860
|
|
|
1854
|
-
const getColorThemeJson$2 = async (colorThemeId, assetDir) => {
|
|
1855
|
-
const extensions = await getAllExtensions(assetDir);
|
|
1861
|
+
const getColorThemeJson$2 = async (colorThemeId, assetDir, platform) => {
|
|
1862
|
+
const extensions = await getAllExtensions(assetDir, platform);
|
|
1856
1863
|
const colorThemeUri = getColorThemeUri(extensions, colorThemeId);
|
|
1857
1864
|
if (!colorThemeUri) {
|
|
1858
1865
|
return {};
|
|
@@ -1874,7 +1881,7 @@ const getColorThemeJson = (colorThemeId, platform, assetDir) => {
|
|
|
1874
1881
|
if (platform === Web) {
|
|
1875
1882
|
return getColorThemeJson$1(colorThemeId, assetDir);
|
|
1876
1883
|
}
|
|
1877
|
-
return getColorThemeJson$2(colorThemeId, assetDir);
|
|
1884
|
+
return getColorThemeJson$2(colorThemeId, assetDir, platform);
|
|
1878
1885
|
};
|
|
1879
1886
|
|
|
1880
1887
|
const getColorThemeCssFromJson = async (colorThemeId, colorThemeJson) => {
|
|
@@ -1905,14 +1912,14 @@ const getColorThemeNamesFromExtensions = async extensions => {
|
|
|
1905
1912
|
return colorThemeNames;
|
|
1906
1913
|
};
|
|
1907
1914
|
|
|
1908
|
-
const getColorThemeNames = async assetDir => {
|
|
1909
|
-
const extensions = await getAllExtensions(assetDir);
|
|
1915
|
+
const getColorThemeNames = async (assetDir, platform) => {
|
|
1916
|
+
const extensions = await getAllExtensions(assetDir, platform);
|
|
1910
1917
|
const colorThemeNames = getColorThemeNamesFromExtensions(extensions);
|
|
1911
1918
|
return colorThemeNames;
|
|
1912
1919
|
};
|
|
1913
1920
|
|
|
1914
|
-
const getExtension = async (id, assetDir) => {
|
|
1915
|
-
const allExtensions = await getAllExtensions(assetDir);
|
|
1921
|
+
const getExtension = async (id, assetDir, platform) => {
|
|
1922
|
+
const allExtensions = await getAllExtensions(assetDir, platform);
|
|
1916
1923
|
for (const extension of allExtensions) {
|
|
1917
1924
|
if (extension.id === id) {
|
|
1918
1925
|
return extension;
|
|
@@ -2110,7 +2117,9 @@ const getLanguagesFromExtension = (extension, platform) => {
|
|
|
2110
2117
|
|
|
2111
2118
|
const getLanguages = async (platform, assetDir) => {
|
|
2112
2119
|
try {
|
|
2113
|
-
|
|
2120
|
+
number(platform);
|
|
2121
|
+
string(assetDir);
|
|
2122
|
+
const extensions = await getAllExtensions(assetDir, platform);
|
|
2114
2123
|
const languages = extensions.flatMap(extension => getLanguagesFromExtension(extension, platform));
|
|
2115
2124
|
return languages;
|
|
2116
2125
|
} catch (error) {
|