@lvce-editor/extension-host-worker 4.4.0 → 4.6.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.
@@ -89,7 +89,7 @@ const fn = value => {
89
89
  }
90
90
  };
91
91
 
92
- const state$f = {
92
+ const state$e = {
93
93
  /** @type{any[]} */
94
94
  onDidOpenEditorListeners: [],
95
95
  /** @type{any[]} */
@@ -101,19 +101,19 @@ const state$f = {
101
101
  textDocuments: Object.create(null)
102
102
  };
103
103
  const setDocument = (textDocumentId, textDocument) => {
104
- state$f.textDocuments[textDocumentId] = textDocument;
104
+ state$e.textDocuments[textDocumentId] = textDocument;
105
105
  };
106
106
  const getDidOpenListeners = () => {
107
- return state$f.onDidSaveTextDocumentListeners;
107
+ return state$e.onDidSaveTextDocumentListeners;
108
108
  };
109
109
  const getWillChangeListeners = () => {
110
- return state$f.onWillChangeEditorListeners;
110
+ return state$e.onWillChangeEditorListeners;
111
111
  };
112
112
  const getDidChangeListeners = () => {
113
- return state$f.onDidChangeTextDocumentListeners;
113
+ return state$e.onDidChangeTextDocumentListeners;
114
114
  };
115
115
  const getDocument = textDocumentId => {
116
- return state$f.textDocuments[textDocumentId];
116
+ return state$e.textDocuments[textDocumentId];
117
117
  };
118
118
 
119
119
  const getOffset$1 = (textDocument, position) => {
@@ -303,7 +303,7 @@ const syncIncremental = (textDocumentId, changes) => {
303
303
  textDocument.text = before + syntheticChange.inserted + after;
304
304
  runListenersSafe(getDidChangeListeners(), textDocument, syntheticChanges);
305
305
  };
306
- const get$a = textDocumentId => {
306
+ const get$b = textDocumentId => {
307
307
  const textDocument = getDocument(textDocumentId);
308
308
  return textDocument;
309
309
  };
@@ -535,7 +535,7 @@ const registerMethod = ({
535
535
  }) => {
536
536
  context[`execute${name}Provider`] = async function (textDocumentId, ...params) {
537
537
  try {
538
- const textDocument = get$a(textDocumentId);
538
+ const textDocument = get$b(textDocumentId);
539
539
  if (!textDocument) {
540
540
  throw new Error(`textDocument with id ${textDocumentId} not found`);
541
541
  }
@@ -670,12 +670,12 @@ const executeOrganizeImports = async uid => {
670
670
  if (!organizeImportsAction) {
671
671
  return [];
672
672
  }
673
- const textDocument = get$a(uid);
673
+ const textDocument = get$b(uid);
674
674
  const edits = await organizeImportsAction.execute(textDocument);
675
675
  return edits;
676
676
  };
677
677
 
678
- const state$e = {
678
+ const state$d = {
679
679
  commands: Object.create(null)
680
680
  };
681
681
  const getCommandDisplay = command => {
@@ -698,10 +698,10 @@ const registerCommand = command => {
698
698
  if (!command.execute) {
699
699
  throw new Error('command is missing execute function');
700
700
  }
701
- if (command.id in state$e.commands) {
701
+ if (command.id in state$d.commands) {
702
702
  throw new Error(`command cannot be registered multiple times`);
703
703
  }
704
- state$e.commands[command.id] = command;
704
+ state$d.commands[command.id] = command;
705
705
  } catch (error) {
706
706
  const commandDisplayId = getCommandDisplay(command);
707
707
  throw new VError(error, `Failed to register command${commandDisplayId}`);
@@ -709,7 +709,7 @@ const registerCommand = command => {
709
709
  };
710
710
  const executeCommand = async (id, ...args) => {
711
711
  try {
712
- const command = state$e.commands[id];
712
+ const command = state$d.commands[id];
713
713
  if (!command) {
714
714
  throw new Error(`command ${id} not found`);
715
715
  }
@@ -748,34 +748,38 @@ const {
748
748
  }]
749
749
  });
750
750
 
751
- const state$d = {
751
+ const state$c = {
752
752
  configuration: Object.create(null)
753
753
  };
754
754
  const getConfiguration = key => {
755
- return state$d.configuration[key] ?? '';
755
+ return state$c.configuration[key] ?? '';
756
756
  };
757
757
  const setConfigurations = preferences => {
758
- state$d.configuration = preferences;
758
+ state$c.configuration = preferences;
759
759
  };
760
760
 
761
- const state$c = {
762
- rpc: undefined
761
+ const RendererWorker = 1;
762
+
763
+ const rpcs$2 = Object.create(null);
764
+ const set$9 = (id, rpc) => {
765
+ rpcs$2[id] = rpc;
766
+ };
767
+ const get$a = id => {
768
+ return rpcs$2[id];
763
769
  };
770
+
764
771
  const invoke$2 = (method, ...params) => {
765
- const rpc = state$c.rpc;
772
+ const rpc = get$a(RendererWorker);
766
773
  return rpc.invoke(method, ...params);
767
774
  };
768
775
  const send$1 = (method, ...params) => {
769
- const rpc = state$c.rpc;
776
+ const rpc = get$a(RendererWorker);
770
777
  return rpc.send(method, ...params);
771
778
  };
772
779
  const invokeAndTransfer$1 = (method, ...params) => {
773
- const rpc = state$c.rpc;
780
+ const rpc = get$a(RendererWorker);
774
781
  return rpc.invokeAndTransfer(method, ...params);
775
782
  };
776
- const setRpc = rpc => {
777
- state$c.rpc = rpc;
778
- };
779
783
 
780
784
  const state$b = {
781
785
  debugProviderMap: Object.create(null)
@@ -5007,10 +5011,12 @@ const getLanguagesFromExtension = extension => {
5007
5011
  tokenize: ''
5008
5012
  };
5009
5013
  }
5014
+ const relativePath = `${extensionPath}/${language.tokenize}`;
5015
+ const absolutePath = platform === Web ? relativePath : getRemoteUrl(relativePath);
5010
5016
  return {
5011
5017
  ...language,
5012
5018
  extensionPath,
5013
- tokenize: getRemoteUrl(`${extensionPath}/${language.tokenize}`)
5019
+ tokenize: absolutePath
5014
5020
  };
5015
5021
  }
5016
5022
  return language;
@@ -5496,7 +5502,7 @@ const listen = async () => {
5496
5502
  const rpc = await WebWorkerRpcClient.create({
5497
5503
  commandMap: commandMap
5498
5504
  });
5499
- setRpc(rpc);
5505
+ set$9(RendererWorker, rpc);
5500
5506
  };
5501
5507
 
5502
5508
  const main = async () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/extension-host-worker",
3
- "version": "4.4.0",
3
+ "version": "4.6.0",
4
4
  "description": "Webworker for the extension host functionality in Lvce Editor.",
5
5
  "main": "dist/extensionHostWorkerMain.js",
6
6
  "type": "module",