@lvce-editor/activity-bar-worker 7.20.0 → 7.22.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.
@@ -2748,12 +2748,24 @@ const set = rpc => {
2748
2748
  state.connected = true;
2749
2749
  };
2750
2750
 
2751
- const handleMessagePort = async port => {
2751
+ const handleMessagePort = async (port, viewletCommandMap, setAsRendererProcess = true) => {
2752
+ const executeViewletCommand = async (uid, command, ...args) => {
2753
+ const fn = viewletCommandMap[`ActivityBar.${command}`];
2754
+ if (typeof fn !== 'function') {
2755
+ throw new TypeError(`Viewlet command not found: ${command}`);
2756
+ }
2757
+ await fn(uid, ...args);
2758
+ await invoke$1('Viewlet.requestRender', uid);
2759
+ };
2752
2760
  const rpc = await create$4({
2753
- commandMap: {},
2761
+ commandMap: {
2762
+ 'Viewlet.executeViewletCommand': executeViewletCommand
2763
+ },
2754
2764
  messagePort: port
2755
2765
  });
2756
- set(rpc);
2766
+ if (setAsRendererProcess) {
2767
+ set(rpc);
2768
+ }
2757
2769
  };
2758
2770
 
2759
2771
  const handleResize = (state, dimensions) => {
@@ -3806,6 +3818,7 @@ const wakeUp = sleepState => {
3806
3818
  set$5(sleepState.uid, sleepState, sleepState);
3807
3819
  };
3808
3820
 
3821
+ const handleDirectMessagePort = (port, setAsRendererProcess) => handleMessagePort(port, commandMap, setAsRendererProcess);
3809
3822
  const commandMap = {
3810
3823
  'ActivityBar.create': create$9,
3811
3824
  'ActivityBar.diff2': diff2,
@@ -3835,7 +3848,7 @@ const commandMap = {
3835
3848
  'ActivityBar.handleExtensionManagementMessagePort': handleExtensionManagementMessagePort,
3836
3849
  'ActivityBar.handleExtensionsChanged': wrapCommand(handleExtensionsChanged),
3837
3850
  'ActivityBar.handleFocus': wrapCommand(handleFocus),
3838
- 'ActivityBar.handleMessagePort': handleMessagePort,
3851
+ 'ActivityBar.handleMessagePort': handleDirectMessagePort,
3839
3852
  'ActivityBar.handleSettingsChanged': wrapCommand(handleSettingsChanged),
3840
3853
  'ActivityBar.handleSideBarStateChange': wrapCommand(handleSideBarStateChange),
3841
3854
  'ActivityBar.handleUpdateStateChange': wrapCommand(handleUpdateStateChange),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/activity-bar-worker",
3
- "version": "7.20.0",
3
+ "version": "7.22.0",
4
4
  "description": "Explorer Worker",
5
5
  "repository": {
6
6
  "type": "git",