@lvce-editor/extension-management-worker 1.15.0 → 1.17.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.
|
@@ -1149,10 +1149,6 @@ const WebWorkerRpcClient = {
|
|
|
1149
1149
|
create: create$4
|
|
1150
1150
|
};
|
|
1151
1151
|
|
|
1152
|
-
const Web = 1;
|
|
1153
|
-
const Electron = 2;
|
|
1154
|
-
const Remote = 3;
|
|
1155
|
-
|
|
1156
1152
|
const ExtensionHostWorker = 44;
|
|
1157
1153
|
const FileSystemWorker = 209;
|
|
1158
1154
|
const RendererWorker = 1;
|
|
@@ -1160,6 +1156,9 @@ const SharedProcess = 1;
|
|
|
1160
1156
|
|
|
1161
1157
|
const rpcs$1 = Object.create(null);
|
|
1162
1158
|
const set$7 = (id, rpc) => {
|
|
1159
|
+
if (rpcs$1[id]) {
|
|
1160
|
+
throw new Error(`rpc with id ${id} is already registered`);
|
|
1161
|
+
}
|
|
1163
1162
|
rpcs$1[id] = rpc;
|
|
1164
1163
|
};
|
|
1165
1164
|
const get$4 = id => {
|
|
@@ -1381,6 +1380,11 @@ const get$2 = id => {
|
|
|
1381
1380
|
return rpcs[id];
|
|
1382
1381
|
};
|
|
1383
1382
|
|
|
1383
|
+
const Web = 1;
|
|
1384
|
+
const Electron = 2;
|
|
1385
|
+
const Remote = 3;
|
|
1386
|
+
const Test = 4;
|
|
1387
|
+
|
|
1384
1388
|
const getUrlPrefix = (platform, extensionPath) => {
|
|
1385
1389
|
if (extensionPath.startsWith('http://') || extensionPath.startsWith('https://')) {
|
|
1386
1390
|
return extensionPath;
|
|
@@ -1461,6 +1465,10 @@ const activateExtension3 = async (extension, absolutePath, activationEvent, plat
|
|
|
1461
1465
|
await activateExtension2(extensionId, extension, absolutePath);
|
|
1462
1466
|
};
|
|
1463
1467
|
|
|
1468
|
+
const state$1 = {
|
|
1469
|
+
webExtensions: []
|
|
1470
|
+
};
|
|
1471
|
+
|
|
1464
1472
|
const cache = Object.create(null);
|
|
1465
1473
|
const id = 1;
|
|
1466
1474
|
const clear = () => {
|
|
@@ -1510,6 +1518,8 @@ const getWebManifestPath = path => {
|
|
|
1510
1518
|
const addWebExtension = async path => {
|
|
1511
1519
|
const manifestPath = getWebManifestPath(path);
|
|
1512
1520
|
const manifest = await getWebExtensionManifest(path, manifestPath);
|
|
1521
|
+
// TODO avoid mutation if possible
|
|
1522
|
+
state$1.webExtensions.push(manifest);
|
|
1513
1523
|
clear();
|
|
1514
1524
|
return manifest;
|
|
1515
1525
|
};
|
|
@@ -1594,7 +1604,8 @@ const get$1 = () => {
|
|
|
1594
1604
|
return state;
|
|
1595
1605
|
};
|
|
1596
1606
|
|
|
1597
|
-
const
|
|
1607
|
+
const disableExtension2 = async (id, platform) => {
|
|
1608
|
+
const isTest = platform === Test;
|
|
1598
1609
|
const oldState = get$1();
|
|
1599
1610
|
try {
|
|
1600
1611
|
if (isTest) {
|
|
@@ -1613,11 +1624,14 @@ const disableExtension = async (id, isTest) => {
|
|
|
1613
1624
|
}
|
|
1614
1625
|
};
|
|
1615
1626
|
|
|
1616
|
-
const
|
|
1627
|
+
const disableExtension = async (id, isTest) => {
|
|
1628
|
+
const oldState = get$1();
|
|
1629
|
+
return disableExtension2(id, oldState.platform);
|
|
1630
|
+
};
|
|
1631
|
+
|
|
1632
|
+
const enableExtension2 = async (id, platform) => {
|
|
1633
|
+
const isTest = platform === Test;
|
|
1617
1634
|
const oldState = get$1();
|
|
1618
|
-
const {
|
|
1619
|
-
platform
|
|
1620
|
-
} = oldState;
|
|
1621
1635
|
if (platform === Remote || platform === Electron) {
|
|
1622
1636
|
const disabledExtensionsJsonPath = await invoke$2('PlatformPaths.getBuiltinExtensionsJsonPath');
|
|
1623
1637
|
const exists$1 = await exists(disabledExtensionsJsonPath);
|
|
@@ -1644,6 +1658,11 @@ const enableExtension = async (id, isTest) => {
|
|
|
1644
1658
|
return undefined;
|
|
1645
1659
|
};
|
|
1646
1660
|
|
|
1661
|
+
const enableExtension = async (id, isTest) => {
|
|
1662
|
+
const oldState = get$1();
|
|
1663
|
+
return enableExtension2(id, oldState.platform);
|
|
1664
|
+
};
|
|
1665
|
+
|
|
1647
1666
|
/* eslint-disable @typescript-eslint/prefer-readonly-parameter-types */
|
|
1648
1667
|
const warn = (...args) => {
|
|
1649
1668
|
console.warn(...args);
|
|
@@ -1808,12 +1827,18 @@ const getColorThemeUri = (extensions, colorThemeId) => {
|
|
|
1808
1827
|
return '';
|
|
1809
1828
|
};
|
|
1810
1829
|
|
|
1830
|
+
const getDynamicWebExtensions = () => {
|
|
1831
|
+
return state$1.webExtensions;
|
|
1832
|
+
};
|
|
1833
|
+
|
|
1811
1834
|
const getAllExtensions = async () => {
|
|
1812
1835
|
const state = get$1();
|
|
1836
|
+
const meta = getDynamicWebExtensions();
|
|
1813
1837
|
if (state.platform === Web) {
|
|
1814
|
-
return [];
|
|
1838
|
+
return [...meta];
|
|
1815
1839
|
}
|
|
1816
|
-
|
|
1840
|
+
const local = await invoke$1('ExtensionManagement.getAllExtensions');
|
|
1841
|
+
return [...local, ...meta];
|
|
1817
1842
|
};
|
|
1818
1843
|
|
|
1819
1844
|
const getColorThemeJson$2 = async colorThemeId => {
|
|
@@ -2094,12 +2119,15 @@ const commandMap = {
|
|
|
2094
2119
|
'Extensions.createWebViewWorkerRpc': createWebViewWorkerRpc,
|
|
2095
2120
|
'Extensions.createWebViewWorkerRpc2': createWebViewWorkerRpc2,
|
|
2096
2121
|
'Extensions.disable': disableExtension,
|
|
2122
|
+
'Extensions.disable2': disableExtension2,
|
|
2097
2123
|
'Extensions.enable': enableExtension,
|
|
2124
|
+
'Extensions.enable2': enableExtension2,
|
|
2098
2125
|
'Extensions.getAllExtensions': getAllExtensions,
|
|
2099
2126
|
'Extensions.getColorThemeCss': getColorThemeCss,
|
|
2100
2127
|
'Extensions.getColorThemeCssFromJson': getColorThemeCssFromJson,
|
|
2101
2128
|
'Extensions.getColorThemeJson': getColorThemeJson,
|
|
2102
2129
|
'Extensions.getColorThemeNames': getColorThemeNames,
|
|
2130
|
+
'Extensions.getDynamicWebExtensions': getDynamicWebExtensions,
|
|
2103
2131
|
'Extensions.getExtension': getExtension,
|
|
2104
2132
|
'Extensions.getLanguages': getLanguages,
|
|
2105
2133
|
'Extensions.getRemoteUrlForWebView': getRemoteUrlForWebView,
|