@lvce-editor/extension-host-worker 3.4.0 → 3.5.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.
@@ -3167,6 +3167,24 @@ const createWebView3 = async ({
3167
3167
  });
3168
3168
  };
3169
3169
 
3170
+ const createWebViewWorkerRpc = async (rpcInfo, port) => {
3171
+ // TODO this function is called from the iframe worker to create a direct
3172
+ // connection between a webview/iframe and it's webworker. For this to work
3173
+ // the iframe worker creates a messagechannel and sends one messageport to the webview
3174
+ // and the other messageport to the webworker. This enables direct communication via
3175
+ // the two message ports
3176
+
3177
+ // TODO have a way so that the worker already includes the webview api and the extension
3178
+ // host subworker doesn't need to import the other file
3179
+ await invokeAndTransfer$1('IpcParent.create', {
3180
+ method: ModuleWorkerAndWorkaroundForChromeDevtoolsBug,
3181
+ url: extensionHostSubWorkerUrl,
3182
+ name: rpcInfo.name,
3183
+ raw: true,
3184
+ port
3185
+ });
3186
+ };
3187
+
3170
3188
  const BraceCompletionExecuteBraceCompletionProvider = 'ExtensionHostBraceCompletion.executeBraceCompletionProvider';
3171
3189
  const ClosingTagExecuteClosingTagProvider = 'ExtensionHostClosingTag.executeClosingTagProvider';
3172
3190
  const CommandExecute = 'ExtensionHostCommand.executeCommand';
@@ -3706,6 +3724,14 @@ const registerChangeListener = () => {
3706
3724
  // TODO
3707
3725
  };
3708
3726
 
3727
+ const getRpcInfo = rpcId => {
3728
+ const info = get$3(rpcId);
3729
+ if (!info) {
3730
+ throw new Error(`Rpc not found ${rpcId}`);
3731
+ }
3732
+ return info;
3733
+ };
3734
+
3709
3735
  const handleBeforeUnload = () => {
3710
3736
  // TODO save all webviews in localstorage
3711
3737
  // cannot use indexeddb during unload
@@ -4427,7 +4453,6 @@ const textSearch = async (scheme, root, query) => {
4427
4453
  };
4428
4454
 
4429
4455
  const commandMap = {
4430
- 'WebView.create3': createWebView3,
4431
4456
  'ExtensionHost.launchIframeWorker': launchIframeWorker,
4432
4457
  'ExtensionHostRename.executeprepareRenameProvider': executeprepareRenameProvider,
4433
4458
  'ExtensionHostRename.executeRenameProvider': executeRenameProvider,
@@ -4442,6 +4467,9 @@ const commandMap = {
4442
4467
  'SearchFileWithHtml.searchFileWithHtml': searchFile,
4443
4468
  'TextSearchFetch.textSearch': textSearch$1,
4444
4469
  'TextSearchHtml.textSearch': textSearch,
4470
+ 'WebView.create3': createWebView3,
4471
+ 'WebView.createWebViewWorkerRpc': createWebViewWorkerRpc,
4472
+ 'WebView.getRpcInfo': getRpcInfo,
4445
4473
  ['ExtensionHostDebug.evaluate']: evaluate,
4446
4474
  ['ExtensionHostDebug.getProperties']: getProperties,
4447
4475
  ['ExtensionHostDebug.listProcesses']: listProcesses,
@@ -4455,8 +4483,8 @@ const commandMap = {
4455
4483
  ['ExtensionHostDebug.stepOver']: stepOver,
4456
4484
  ['ExtensionHostWebView.create']: createWebView,
4457
4485
  ['ExtensionHostWebView.dispose']: disposeWebView,
4458
- ['ExtensionHostWebView.load']: loadWebView,
4459
4486
  ['ExtensionHostWebView.getWebViewInfo']: getWebViewInfo,
4487
+ ['ExtensionHostWebView.load']: loadWebView,
4460
4488
  ['HandleBeforeUnload.handleBeforeUnload']: handleBeforeUnload,
4461
4489
  ['HandleMessagePort.handleMessagePort']: handleMessagePort,
4462
4490
  ['SaveState.saveState']: saveState,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/extension-host-worker",
3
- "version": "3.4.0",
3
+ "version": "3.5.0",
4
4
  "description": "Webworker for the extension host functionality in Lvce Editor.",
5
5
  "main": "dist/extensionHostWorkerMain.js",
6
6
  "type": "module",