@lvce-editor/extension-host-worker 4.17.0 → 5.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.
@@ -755,8 +755,6 @@ const setConfigurations = preferences => {
755
755
  state$b.configuration = preferences;
756
756
  };
757
757
 
758
- const RendererWorker = 1;
759
-
760
758
  const rpcs$2 = Object.create(null);
761
759
  const set$9 = (id, rpc) => {
762
760
  rpcs$2[id] = rpc;
@@ -765,17 +763,13 @@ const get$a = id => {
765
763
  return rpcs$2[id];
766
764
  };
767
765
 
768
- const invoke$2 = (method, ...params) => {
769
- const rpc = get$a(RendererWorker);
770
- return rpc.invoke(method, ...params);
771
- };
772
- const send$1 = (method, ...params) => {
773
- const rpc = get$a(RendererWorker);
774
- return rpc.send(method, ...params);
775
- };
776
- const invokeAndTransfer$2 = (method, ...params) => {
777
- const rpc = get$a(RendererWorker);
778
- return rpc.invokeAndTransfer(method, ...params);
766
+ const RendererWorker = 1;
767
+ const DebugWorker = 55;
768
+
769
+ // TODO use invoke
770
+ const send$1 = async (method, ...params) => {
771
+ const rpc = get$a(DebugWorker);
772
+ rpc.send(method, ...params);
779
773
  };
780
774
 
781
775
  const state$a = {
@@ -798,7 +792,6 @@ const registerDebugProvider = debugProvider => {
798
792
  const start = async (protocol, path) => {
799
793
  try {
800
794
  const handlePaused = params => {
801
- console.log('send paused', params);
802
795
  send$1('Debug.paused', params);
803
796
  };
804
797
  const handleResumed = () => {
@@ -934,6 +927,15 @@ const {
934
927
  }
935
928
  });
936
929
 
930
+ const invoke$2 = (method, ...params) => {
931
+ const rpc = get$a(RendererWorker);
932
+ return rpc.invoke(method, ...params);
933
+ };
934
+ const invokeAndTransfer$2 = (method, ...params) => {
935
+ const rpc = get$a(RendererWorker);
936
+ return rpc.invokeAndTransfer(method, ...params);
937
+ };
938
+
937
939
  const showInformationMessage = message => {
938
940
  string(message);
939
941
  const result = invoke$2('ExtensionHostDialog.showInformationMessage', message);
@@ -2045,7 +2047,7 @@ const listen$1 = async (module, options) => {
2045
2047
  const ipc = module.wrap(rawIpc);
2046
2048
  return ipc;
2047
2049
  };
2048
- const create$8 = async ({
2050
+ const create$9 = async ({
2049
2051
  commandMap,
2050
2052
  messagePort
2051
2053
  }) => {
@@ -2060,9 +2062,9 @@ const create$8 = async ({
2060
2062
  };
2061
2063
  const MessagePortRpcClient = {
2062
2064
  __proto__: null,
2063
- create: create$8
2065
+ create: create$9
2064
2066
  };
2065
- const create$7 = async ({
2067
+ const create$8 = async ({
2066
2068
  commandMap,
2067
2069
  messagePort,
2068
2070
  isMessagePortOpen
@@ -2080,7 +2082,7 @@ const create$7 = async ({
2080
2082
  };
2081
2083
  const MessagePortRpcParent = {
2082
2084
  __proto__: null,
2083
- create: create$7
2085
+ create: create$8
2084
2086
  };
2085
2087
  const create$1$1 = async ({
2086
2088
  commandMap,
@@ -2100,7 +2102,7 @@ const WebSocketRpcParent = {
2100
2102
  __proto__: null,
2101
2103
  create: create$1$1
2102
2104
  };
2103
- const create$9 = async ({
2105
+ const create$7 = async ({
2104
2106
  commandMap
2105
2107
  }) => {
2106
2108
  // TODO create a commandMap per rpc instance
@@ -2112,7 +2114,7 @@ const create$9 = async ({
2112
2114
  };
2113
2115
  const WebWorkerRpcClient = {
2114
2116
  __proto__: null,
2115
- create: create$9
2117
+ create: create$7
2116
2118
  };
2117
2119
 
2118
2120
  const getPortTuple = () => {
@@ -2508,6 +2510,7 @@ const createRpc = ({
2508
2510
  }) => {
2509
2511
  try {
2510
2512
  if (execute && !commandMap) {
2513
+ // eslint-disable-next-line no-console
2511
2514
  console.info(`[extension-host-worker] The rpc execute function is deprecated. Use the commandMap property instead.`);
2512
2515
  }
2513
2516
  commandMap ||= {};
@@ -3142,6 +3145,7 @@ const addWebExtension = async path => {
3142
3145
  };
3143
3146
 
3144
3147
  const applyBulkReplacement = async (files, ranges, replacement) => {
3148
+ // eslint-disable-next-line no-console
3145
3149
  console.log({
3146
3150
  files,
3147
3151
  ranges,
@@ -4924,14 +4928,17 @@ const getWebViews = async () => {
4924
4928
  const handleBeforeUnload = () => {
4925
4929
  // TODO save all webviews in localstorage
4926
4930
  // cannot use indexeddb during unload
4927
- console.log('before unload');
4931
+ // console.log('before unload')
4928
4932
  };
4929
4933
 
4930
- const handleMessagePort = async port => {
4931
- await MessagePortRpcClient.create({
4934
+ const handleMessagePort = async (port, rpcId) => {
4935
+ const rpc = await MessagePortRpcClient.create({
4932
4936
  messagePort: port,
4933
4937
  commandMap: {}
4934
4938
  });
4939
+ if (rpcId) {
4940
+ set$9(rpcId, rpc);
4941
+ }
4935
4942
  };
4936
4943
 
4937
4944
  const handleIconThemeChange = async () => {
@@ -5041,9 +5048,6 @@ const getValues = async storeId => {
5041
5048
  const db = await getDbMemoized();
5042
5049
  const tx = db.transaction(storeId, 'readwrite');
5043
5050
  const [objects] = await Promise.all([tx.store.getAll(), tx.done]);
5044
- console.log({
5045
- objects
5046
- });
5047
5051
  return objects;
5048
5052
  } catch (error) {
5049
5053
  throw new VError(error, 'Failed to get values from indexed db');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/extension-host-worker",
3
- "version": "4.17.0",
3
+ "version": "5.1.0",
4
4
  "description": "Webworker for the extension host functionality in Lvce Editor.",
5
5
  "keywords": [
6
6
  "web-worker"