@lvce-editor/extension-management-worker 1.14.0 → 1.16.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,10 @@ 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
+
1384
1387
  const getUrlPrefix = (platform, extensionPath) => {
1385
1388
  if (extensionPath.startsWith('http://') || extensionPath.startsWith('https://')) {
1386
1389
  return extensionPath;
@@ -1461,6 +1464,10 @@ const activateExtension3 = async (extension, absolutePath, activationEvent, plat
1461
1464
  await activateExtension2(extensionId, extension, absolutePath);
1462
1465
  };
1463
1466
 
1467
+ const state$1 = {
1468
+ webExtensions: []
1469
+ };
1470
+
1464
1471
  const cache = Object.create(null);
1465
1472
  const id = 1;
1466
1473
  const clear = () => {
@@ -1510,6 +1517,8 @@ const getWebManifestPath = path => {
1510
1517
  const addWebExtension = async path => {
1511
1518
  const manifestPath = getWebManifestPath(path);
1512
1519
  const manifest = await getWebExtensionManifest(path, manifestPath);
1520
+ // TODO avoid mutation if possible
1521
+ state$1.webExtensions.push(manifest);
1513
1522
  clear();
1514
1523
  return manifest;
1515
1524
  };
@@ -1547,10 +1556,14 @@ const getExtensionHostSubWorkerUrl = () => {
1547
1556
  };
1548
1557
  const extensionHostSubWorkerUrl = getExtensionHostSubWorkerUrl();
1549
1558
 
1559
+ // TODO
1560
+
1550
1561
  /**
1551
1562
  * @deprecated use createWebViewWorkerRpc2 which passes the worker url as a parameter
1552
1563
  */
1553
1564
  const createWebViewWorkerRpc = async (rpcInfo, port) => {
1565
+ object(rpcInfo);
1566
+ object(port);
1554
1567
  // TODO this function is called from the iframe worker to create a direct
1555
1568
  // connection between a webview/iframe and it's webworker. For this to work
1556
1569
  // the iframe worker creates a messagechannel and sends one messageport to the webview
@@ -1559,7 +1572,7 @@ const createWebViewWorkerRpc = async (rpcInfo, port) => {
1559
1572
 
1560
1573
  // TODO have a way so that the worker already includes the webview api and the extension
1561
1574
  // host subworker doesn't need to import the other file
1562
- await invokeAndTransfer('IpcParent.create', {
1575
+ await invokeAndTransfer$1('IpcParent.create', {
1563
1576
  method: ModuleWorkerAndWorkaroundForChromeDevtoolsBug,
1564
1577
  name: rpcInfo.name,
1565
1578
  port,
@@ -1872,6 +1885,10 @@ const getColorThemeNames = async () => {
1872
1885
  return colorThemeNames;
1873
1886
  };
1874
1887
 
1888
+ const getDynamicWebExtensions = async assetDir => {
1889
+ return state$1.webExtensions;
1890
+ };
1891
+
1875
1892
  const getExtension = async id => {
1876
1893
  const allExtensions = await getAllExtensions();
1877
1894
  for (const extension of allExtensions) {
@@ -2096,6 +2113,7 @@ const commandMap = {
2096
2113
  'Extensions.getColorThemeCssFromJson': getColorThemeCssFromJson,
2097
2114
  'Extensions.getColorThemeJson': getColorThemeJson,
2098
2115
  'Extensions.getColorThemeNames': getColorThemeNames,
2116
+ 'Extensions.getDynamicWebExtensions': getDynamicWebExtensions,
2099
2117
  'Extensions.getExtension': getExtension,
2100
2118
  'Extensions.getLanguages': getLanguages,
2101
2119
  'Extensions.getRemoteUrlForWebView': getRemoteUrlForWebView,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/extension-management-worker",
3
- "version": "1.14.0",
3
+ "version": "1.16.0",
4
4
  "description": "Webworker for the Extension Management functionality in Lvce Editor.",
5
5
  "keywords": [
6
6
  "web-worker"