@lvce-editor/rpc-registry 9.17.0 → 9.19.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.
@@ -0,0 +1,6 @@
1
+ export declare const dispose: () => Promise<void>, invoke: (method: string, ...params: readonly unknown[]) => Promise<any>, invokeAndTransfer: (method: string, ...params: readonly unknown[]) => Promise<any>, registerMockRpc: (commandMap: Record<string, any>) => import("../DisposableMockRpc/DisposableMockRpc.ts").DisposableMockRpc, set: (rpc: import("@lvce-editor/rpc").Rpc) => void;
2
+ export declare const base64StringToBlob: (base64String: string, type: string) => Promise<Blob>;
3
+ export declare const binaryStringToBlob: (binaryString: string, type: string) => Promise<Blob>;
4
+ export declare const blobToBinaryString: (blob: Blob) => Promise<string>;
5
+ export declare const handleMessagePort: (port: MessagePort) => Promise<void>;
6
+ export declare const terminate: () => Promise<void>;
@@ -0,0 +1,17 @@
1
+ import * as RpcFactory from "../RpcFactory/RpcFactory.js";
2
+ export const { dispose, invoke, invokeAndTransfer, registerMockRpc, set } = RpcFactory.create(19_000);
3
+ export const base64StringToBlob = async (base64String, type) => {
4
+ return invoke('Blob.base64StringToBlob', base64String, type);
5
+ };
6
+ export const binaryStringToBlob = async (binaryString, type) => {
7
+ return invoke('Blob.binaryStringToBlob', binaryString, type);
8
+ };
9
+ export const blobToBinaryString = async (blob) => {
10
+ return invoke('Blob.blobToBinaryString', blob);
11
+ };
12
+ export const handleMessagePort = async (port) => {
13
+ return invokeAndTransfer('Blob.handleMessagePort', port);
14
+ };
15
+ export const terminate = async () => {
16
+ return invoke('Blob.terminate');
17
+ };
@@ -1,4 +1,4 @@
1
- import type { MockRpc } from '@lvce-editor/rpc';
1
+ import type { MockRpc } from '../MockRpc/MockRpc.ts';
2
2
  export interface DisposableMockRpc extends MockRpc {
3
3
  [Symbol.dispose]: () => void;
4
4
  }
@@ -1,5 +1,6 @@
1
- export type { Rpc, MockRpc } from '@lvce-editor/rpc';
1
+ export type { Rpc } from '@lvce-editor/rpc';
2
2
  export * as AuthWorker from '../AuthWorker/AuthWorker.ts';
3
+ export * as BlobWorker from '../BlobWorker/BlobWorker.ts';
3
4
  export * as ChatCoordinatorWorker from '../ChatCoordinatorWorker/ChatCoordinatorWorker.ts';
4
5
  export * as ChatDebugWorker from '../ChatDebugWorker/ChatDebugWorker.ts';
5
6
  export * as ChatMathWorker from '../ChatMathWorker/ChatMathWorker.ts';
@@ -41,6 +42,7 @@ export * from '../CreateLazyRpc/CreateLazyRpc.ts';
41
42
  export * from '../GetIpcType/GetIpcType.ts';
42
43
  export * from '../RegisterMockRpc/RegisterMockRpc.ts';
43
44
  export * from '../RpcRegistry/RpcRegistry.ts';
45
+ export type * from '../MockRpc/MockRpc.ts';
44
46
  export type * from '../SearchResult/SearchResult.ts';
45
47
  export type * from '../Change/Change.ts';
46
48
  export type * from '../TextEdit/TextEdit.ts';
@@ -1,4 +1,5 @@
1
1
  export * as AuthWorker from "../AuthWorker/AuthWorker.js";
2
+ export * as BlobWorker from "../BlobWorker/BlobWorker.js";
2
3
  export * as ChatCoordinatorWorker from "../ChatCoordinatorWorker/ChatCoordinatorWorker.js";
3
4
  export * as ChatDebugWorker from "../ChatDebugWorker/ChatDebugWorker.js";
4
5
  export * as ChatMathWorker from "../ChatMathWorker/ChatMathWorker.js";
@@ -0,0 +1,2 @@
1
+ import type { createMockRpc } from '@lvce-editor/rpc';
2
+ export type MockRpc = ReturnType<typeof createMockRpc>;
@@ -0,0 +1 @@
1
+ export {};
@@ -1,2 +1,2 @@
1
- import type { MockRpc } from '@lvce-editor/rpc';
1
+ import type { MockRpc } from '../MockRpc/MockRpc.ts';
2
2
  export declare const registerMockRpc: (rpcId: number, commandMap: Record<string, any>) => MockRpc;
@@ -51,6 +51,7 @@ export declare const getViewletModuleId: (uri: string) => Promise<string>;
51
51
  export declare const showPanel: () => Promise<void>;
52
52
  export declare const showPreview: () => Promise<void>;
53
53
  export declare const saveEditor: () => Promise<void>;
54
+ export declare const sendMessagePortToFileSearchWorker2: (port: MessagePort, rpcId?: number) => Promise<void>;
54
55
  export declare const togglePanelView: (id: string) => Promise<void>;
55
56
  export declare const resizeViewlet: (uid: number, dimensions: any) => Promise<readonly any[]>;
56
57
  export declare const sendMessagePortToFileSearchWorker: (port: MessagePort, rpcId?: number) => Promise<void>;
@@ -91,6 +92,8 @@ export declare const rerenderEditor: (key: string) => Promise<void>;
91
92
  export declare const handleDebugPaused: (params: any) => Promise<void>;
92
93
  export declare const openUri: (uri: string, focus?: boolean, options?: any) => Promise<void>;
93
94
  export declare const sendMessagePortToSyntaxHighlightingWorker: (port: MessagePort) => Promise<void>;
95
+ export declare const sendMessagePortToBlobWorker: (port: MessagePort, rpcId?: number) => Promise<void>;
96
+ export declare const sendMessagePortToDiffWorker: (port: MessagePort, rpcId?: number) => Promise<void>;
94
97
  export declare const handleDebugScriptParsed: (script: any) => Promise<void>;
95
98
  export declare const getWindowId: () => Promise<number>;
96
99
  export declare const getBlob: (uri: string) => Promise<Blob>;
@@ -117,3 +120,5 @@ export declare const showSaveFilePicker: () => Promise<string>;
117
120
  export declare const getLogsDir: () => Promise<string>;
118
121
  export declare const measureTextBlockHeight: (actualInput: string, fontFamily: string, fontSize: number, lineHeightPx: number | string, width: number) => Promise<number>;
119
122
  export declare const refreshOutput: () => Promise<void>;
123
+ export declare const initializeOpenerWorker: () => Promise<void>;
124
+ export declare const initializeEditorWorker: () => Promise<void>;
@@ -1,5 +1,8 @@
1
1
  import * as Assert from '@lvce-editor/assert';
2
2
  import { InputSource, RpcId } from '@lvce-editor/constants';
3
+ import { LazyTransferMessagePortRpcParent } from '@lvce-editor/rpc';
4
+ import * as EditorWorker from "../EditorWorker/EditorWorker.js";
5
+ import * as OpenerWorker from "../OpenerWorker/OpenerWorker.js";
3
6
  import * as RpcFactory from "../RpcFactory/RpcFactory.js";
4
7
  export const { dispose, invoke, invokeAndTransfer, registerMockRpc, set } = RpcFactory.create(RpcId.RendererWorker);
5
8
  export const searchFileHtml = async (uri) => {
@@ -172,6 +175,10 @@ export const showPreview = async () => {
172
175
  export const saveEditor = async () => {
173
176
  return invoke('Editor.save');
174
177
  };
178
+ export const sendMessagePortToFileSearchWorker2 = async (port, rpcId = 0) => {
179
+ const command = 'FileSearch.handleMessagePort';
180
+ await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToFileSearchWorker', port, command, rpcId);
181
+ };
175
182
  export const togglePanelView = async (id) => {
176
183
  return invoke('Panel.toggleView', id);
177
184
  };
@@ -303,6 +310,14 @@ export const openUri = async (uri, focus, options) => {
303
310
  export const sendMessagePortToSyntaxHighlightingWorker = async (port) => {
304
311
  await invokeAndTransfer('SendMessagePortToSyntaxHighlightingWorker.sendMessagePortToSyntaxHighlightingWorker', port, 'HandleMessagePort.handleMessagePort2');
305
312
  };
313
+ export const sendMessagePortToBlobWorker = async (port, rpcId = 0) => {
314
+ const command = 'Blob.handleMessagePort';
315
+ await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToBlobWorker', port, command, rpcId);
316
+ };
317
+ export const sendMessagePortToDiffWorker = async (port, rpcId = 0) => {
318
+ const command = 'Diff.handleMessagePort';
319
+ await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToDiffWorker', port, command, rpcId);
320
+ };
306
321
  export const handleDebugScriptParsed = async (script) => {
307
322
  await invoke('Run And Debug.handleScriptParsed', script);
308
323
  };
@@ -381,3 +396,23 @@ export const measureTextBlockHeight = async (actualInput, fontFamily, fontSize,
381
396
  export const refreshOutput = async () => {
382
397
  await invoke('Output.refresh');
383
398
  };
399
+ const send = async (port, sourceId = 0) => {
400
+ await sendMessagePortToOpenerWorker(port, sourceId);
401
+ };
402
+ export const initializeOpenerWorker = async () => {
403
+ const rpc = await LazyTransferMessagePortRpcParent.create({
404
+ commandMap: {},
405
+ send,
406
+ });
407
+ OpenerWorker.set(rpc);
408
+ };
409
+ const send2 = async (port) => {
410
+ await sendMessagePortToEditorWorker(port, RpcId.TestWorker);
411
+ };
412
+ export const initializeEditorWorker = async () => {
413
+ const rpc = await LazyTransferMessagePortRpcParent.create({
414
+ commandMap: {},
415
+ send: send2,
416
+ });
417
+ EditorWorker.set(rpc);
418
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/rpc-registry",
3
- "version": "9.17.0",
3
+ "version": "9.19.0",
4
4
  "description": "Rpc Registry",
5
5
  "repository": {
6
6
  "type": "git",
@@ -13,8 +13,8 @@
13
13
  "main": "dist/index.js",
14
14
  "dependencies": {
15
15
  "@lvce-editor/assert": "^1.5.1",
16
- "@lvce-editor/constants": "^5.7.0",
17
- "@lvce-editor/rpc": "^5.5.0"
16
+ "@lvce-editor/constants": "^5.9.0",
17
+ "@lvce-editor/rpc": "^6.4.0"
18
18
  },
19
19
  "exports": "./dist/index.js",
20
20
  "types": "dist/index.d.ts"