@lvce-editor/extension-management-worker 4.0.0 → 4.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.
@@ -1558,21 +1558,13 @@ const activateExtension2 = async (extensionId, extension, absolutePath, extensio
1558
1558
 
1559
1559
  const commandMapRef = {};
1560
1560
 
1561
- const getPortTuple = () => {
1562
- const {
1563
- port1,
1564
- port2
1565
- } = new MessageChannel();
1566
- return {
1567
- port1,
1568
- port2
1569
- };
1570
- };
1571
-
1572
1561
  const rpcs$1 = Object.create(null);
1573
1562
  const get$2 = extensionId => {
1574
1563
  return rpcs$1[extensionId];
1575
1564
  };
1565
+ const getAll = () => {
1566
+ return Object.values(rpcs$1);
1567
+ };
1576
1568
  const set$1 = (extensionId, rpc) => {
1577
1569
  rpcs$1[extensionId] = rpc;
1578
1570
  };
@@ -1590,18 +1582,12 @@ const getOrCreateIsolatedExtensionHostWorker = async extensionId => {
1590
1582
  if (existingRpc) {
1591
1583
  return existingRpc;
1592
1584
  }
1593
- const {
1594
- port1,
1595
- port2
1596
- } = getPortTuple();
1597
- const rpcPromise = create$3({
1585
+ const rpc = await create$7({
1598
1586
  commandMap: commandMapRef,
1599
- isMessagePortOpen: true,
1600
- messagePort: port2
1587
+ send(port) {
1588
+ return invokeAndTransfer('LaunchIsolatedExtensionHostWorker.launchIsolatedExtensionHostWorker', port, extensionId);
1589
+ }
1601
1590
  });
1602
- port2.start();
1603
- await invokeAndTransfer('LaunchIsolatedExtensionHostWorker.launchIsolatedExtensionHostWorker', port1, extensionId);
1604
- const rpc = await rpcPromise;
1605
1591
  set$1(extensionId, rpc);
1606
1592
  return rpc;
1607
1593
  };
@@ -2201,6 +2187,17 @@ const getExtension = async (id, assetDir, platform) => {
2201
2187
  return undefined;
2202
2188
  };
2203
2189
 
2190
+ const getPortTuple = () => {
2191
+ const {
2192
+ port1,
2193
+ port2
2194
+ } = new MessageChannel();
2195
+ return {
2196
+ port1,
2197
+ port2
2198
+ };
2199
+ };
2200
+
2204
2201
  const createWebViewIpc = async webView => {
2205
2202
  const {
2206
2203
  origin,
@@ -2269,6 +2266,15 @@ const getRuntimeStatus = extensionId => {
2269
2266
  return getRuntimeStatus$1(extensionId) || emptyStatus;
2270
2267
  };
2271
2268
 
2269
+ const getItems = async rpc => {
2270
+ return rpc.invoke('ExtensionApi.getStatusBarItems');
2271
+ };
2272
+ const getStatusBarItems = async () => {
2273
+ const rpcs = getAll();
2274
+ const results = await Promise.all(rpcs.map(getItems));
2275
+ return results.flat();
2276
+ };
2277
+
2272
2278
  const handleMessagePort = async port => {
2273
2279
  await create$8({
2274
2280
  commandMap: commandMapRef,
@@ -2397,6 +2403,7 @@ const commandMap = {
2397
2403
  'Extensions.getRemoteUrlForWebView': getRemoteUrlForWebView,
2398
2404
  'Extensions.getRpcInfo': getRpcInfo,
2399
2405
  'Extensions.getRuntimeStatus': getRuntimeStatus,
2406
+ 'Extensions.getStatusBarItems': getStatusBarItems,
2400
2407
  'Extensions.handleMessagePort': handleMessagePort,
2401
2408
  'Extensions.importExtension': importExtension,
2402
2409
  'Extensions.initialize': initialize,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/extension-management-worker",
3
- "version": "4.0.0",
3
+ "version": "4.1.0",
4
4
  "description": "Webworker for the Extension Management functionality in Lvce Editor.",
5
5
  "keywords": [
6
6
  "web-worker"