@lvce-editor/extension-host-worker 8.63.0 → 8.65.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.
- package/dist/extension-api/index.js +277 -115
- package/dist/extension-api/parts/Debug/Debug.js +114 -0
- package/dist/extension-api/parts/ExtensionApiCommandMap/ExtensionApiCommandMap.js +25 -1
- package/dist/extension-api/parts/Rpc/Rpc.js +4 -4
- package/dist/extensionHostWorkerMain.js +2293 -2252
- package/extension-api/dist/index.d.ts +2 -0
- package/extension-api/dist/index.js +1 -0
- package/extension-api/dist/parts/CommandMap/CommandMap.d.ts +11 -0
- package/extension-api/dist/parts/Debug/Debug.d.ts +34 -0
- package/extension-api/dist/parts/Debug/Debug.js +98 -0
- package/extension-api/dist/parts/ExtensionApiCommandMap/ExtensionApiCommandMap.d.ts +11 -0
- package/extension-api/dist/parts/ExtensionApiCommandMap/ExtensionApiCommandMap.js +12 -0
- package/extension-api/dist/parts/ExtensionApiWorkerCommandMap/ExtensionApiWorkerCommandMap.d.ts +11 -0
- package/extension-api/dist/parts/Rpc/Rpc.d.ts +2 -1
- package/extension-api/dist/parts/Rpc/Rpc.js +4 -4
- package/extension-api/package.json +1 -1
- package/extension-api/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -5,6 +5,7 @@ export { executeCommand } from './parts/ExecuteCommand/ExecuteCommand.ts';
|
|
|
5
5
|
export { showQuickPick } from './parts/QuickPick/QuickPick.ts';
|
|
6
6
|
export { getPreference, setPreference } from './parts/Preferences/Preferences.ts';
|
|
7
7
|
export { registerCommand } from './parts/CommandRegistry/CommandRegistry.ts';
|
|
8
|
+
export { registerDebugProvider, resetDebugProviderRegistry } from './parts/Debug/Debug.ts';
|
|
8
9
|
export { executeCompletionProvider, executeResolveCompletionItemProvider, getCompletionProviderRegistrySnapshot, registerCompletionProvider, resetCompletionProviderRegistry, } from './parts/Completion/Completion.ts';
|
|
9
10
|
export { executeDiagnosticProvider, getDiagnosticProviderRegistrySnapshot, registerDiagnosticProvider, resetDiagnosticProviderRegistry, } from './parts/Diagnostic/Diagnostic.ts';
|
|
10
11
|
export { executeFormattingProvider, getFormattingProviderRegistrySnapshot, registerFormattingProvider, resetFormattingProviderRegistry, } from './parts/Formatting/Formatting.ts';
|
|
@@ -28,6 +29,7 @@ export type { CommandCallback } from './parts/CommandCallback/CommandCallback.ts
|
|
|
28
29
|
export type { CommandRegistrySnapshot } from './parts/CommandRegistrySnapshot/CommandRegistrySnapshot.ts';
|
|
29
30
|
export type { CompletionItem, CompletionProvider, CompletionProviderRegistrySnapshot, RegisteredCompletionProvider, } from './parts/Completion/Completion.ts';
|
|
30
31
|
export type { Diagnostic, DiagnosticProvider, DiagnosticProviderRegistrySnapshot, RegisteredDiagnosticProvider, } from './parts/Diagnostic/Diagnostic.ts';
|
|
32
|
+
export type { DebugEmitter, DebugProvider } from './parts/Debug/Debug.ts';
|
|
31
33
|
export type { Disposable } from './parts/Disposable/Disposable.ts';
|
|
32
34
|
export type { CreateElectronWebContentsViewOptions, ElectronWebContentsView, ElectronWebContentsViewStats, } from './parts/ElectronWebContentsView/ElectronWebContentsView.ts';
|
|
33
35
|
export type { FormattingEdit, FormattingProvider, FormattingProviderRegistrySnapshot, RegisteredFormattingProvider, } from './parts/Formatting/Formatting.ts';
|
|
@@ -5,6 +5,7 @@ export { executeCommand } from "./parts/ExecuteCommand/ExecuteCommand.js";
|
|
|
5
5
|
export { showQuickPick } from "./parts/QuickPick/QuickPick.js";
|
|
6
6
|
export { getPreference, setPreference } from "./parts/Preferences/Preferences.js";
|
|
7
7
|
export { registerCommand } from "./parts/CommandRegistry/CommandRegistry.js";
|
|
8
|
+
export { registerDebugProvider, resetDebugProviderRegistry } from "./parts/Debug/Debug.js";
|
|
8
9
|
export { executeCompletionProvider, executeResolveCompletionItemProvider, getCompletionProviderRegistrySnapshot, registerCompletionProvider, resetCompletionProviderRegistry, } from "./parts/Completion/Completion.js";
|
|
9
10
|
export { executeDiagnosticProvider, getDiagnosticProviderRegistrySnapshot, registerDiagnosticProvider, resetDiagnosticProviderRegistry, } from "./parts/Diagnostic/Diagnostic.js";
|
|
10
11
|
export { executeFormattingProvider, getFormattingProviderRegistrySnapshot, registerFormattingProvider, resetFormattingProviderRegistry, } from "./parts/Formatting/Formatting.js";
|
|
@@ -48,4 +48,15 @@ export declare const commandMap: {
|
|
|
48
48
|
'ExtensionApi.getViewRegistrySnapshot': () => import("../View/View.ts").ViewRegistrySnapshot;
|
|
49
49
|
'ExtensionApi.renderViewInstance': (uid: number) => Promise<import("../View/View.ts").ViewRenderResult>;
|
|
50
50
|
'ExtensionApi.saveViewInstanceState': (uid: number) => Promise<unknown>;
|
|
51
|
+
'ExtensionHostDebug.evaluate': (id: string, expression: string, callFrameId: string) => Promise<unknown>;
|
|
52
|
+
'ExtensionHostDebug.getProperties': (id: string, objectId: string) => Promise<unknown>;
|
|
53
|
+
'ExtensionHostDebug.listProcesses': (id: string, path?: string) => Promise<unknown>;
|
|
54
|
+
'ExtensionHostDebug.pause': (id: string) => Promise<unknown>;
|
|
55
|
+
'ExtensionHostDebug.resume': (id: string) => Promise<unknown>;
|
|
56
|
+
'ExtensionHostDebug.setPauseOnExceptions': (id: string, value: number) => Promise<unknown>;
|
|
57
|
+
'ExtensionHostDebug.start': (id: string, path?: string) => Promise<unknown>;
|
|
58
|
+
'ExtensionHostDebug.step': (id: string) => Promise<unknown>;
|
|
59
|
+
'ExtensionHostDebug.stepInto': (id: string) => Promise<unknown>;
|
|
60
|
+
'ExtensionHostDebug.stepOut': (id: string) => Promise<unknown>;
|
|
61
|
+
'ExtensionHostDebug.stepOver': (id: string) => Promise<unknown>;
|
|
51
62
|
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { Disposable } from '../Disposable/Disposable.ts';
|
|
2
|
+
export interface DebugEmitter {
|
|
3
|
+
readonly handleChange: (params: unknown) => Promise<void>;
|
|
4
|
+
readonly handlePaused: (params: unknown) => Promise<void>;
|
|
5
|
+
readonly handleResumed: () => Promise<void>;
|
|
6
|
+
readonly handleScriptParsed: (script: unknown) => Promise<void>;
|
|
7
|
+
}
|
|
8
|
+
export interface DebugProvider {
|
|
9
|
+
readonly evaluate: (expression: string, callFrameId: string) => unknown;
|
|
10
|
+
readonly getProperties: (objectId: string) => unknown;
|
|
11
|
+
readonly id: string;
|
|
12
|
+
readonly listProcesses: (path?: string) => unknown;
|
|
13
|
+
readonly pause: () => unknown;
|
|
14
|
+
readonly resume: () => unknown;
|
|
15
|
+
readonly setPauseOnExceptions: (value: number) => unknown;
|
|
16
|
+
readonly start: (emitter: DebugEmitter, path?: string) => unknown;
|
|
17
|
+
readonly step: () => unknown;
|
|
18
|
+
readonly stepInto: () => unknown;
|
|
19
|
+
readonly stepOut: () => unknown;
|
|
20
|
+
readonly stepOver: () => unknown;
|
|
21
|
+
}
|
|
22
|
+
export declare const registerDebugProvider: (provider: DebugProvider) => Disposable;
|
|
23
|
+
export declare const executeDebugStart: (id: string, path?: string) => Promise<unknown>;
|
|
24
|
+
export declare const executeDebugListProcesses: (id: string, path?: string) => Promise<unknown>;
|
|
25
|
+
export declare const executeDebugResume: (id: string) => Promise<unknown>;
|
|
26
|
+
export declare const executeDebugPause: (id: string) => Promise<unknown>;
|
|
27
|
+
export declare const executeDebugStepOver: (id: string) => Promise<unknown>;
|
|
28
|
+
export declare const executeDebugStepInto: (id: string) => Promise<unknown>;
|
|
29
|
+
export declare const executeDebugStepOut: (id: string) => Promise<unknown>;
|
|
30
|
+
export declare const executeDebugStep: (id: string) => Promise<unknown>;
|
|
31
|
+
export declare const executeDebugSetPauseOnExceptions: (id: string, value: number) => Promise<unknown>;
|
|
32
|
+
export declare const executeDebugGetProperties: (id: string, objectId: string) => Promise<unknown>;
|
|
33
|
+
export declare const executeDebugEvaluate: (id: string, expression: string, callFrameId: string) => Promise<unknown>;
|
|
34
|
+
export declare const resetDebugProviderRegistry: () => void;
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { executeCommand } from "../ExecuteCommand/ExecuteCommand.js";
|
|
2
|
+
import { ExtensionApiError } from "../ExtensionApiError/ExtensionApiError.js";
|
|
3
|
+
const providers = Object.create(null);
|
|
4
|
+
const requiredMethods = [
|
|
5
|
+
'evaluate',
|
|
6
|
+
'getProperties',
|
|
7
|
+
'listProcesses',
|
|
8
|
+
'pause',
|
|
9
|
+
'resume',
|
|
10
|
+
'setPauseOnExceptions',
|
|
11
|
+
'start',
|
|
12
|
+
'step',
|
|
13
|
+
'stepInto',
|
|
14
|
+
'stepOut',
|
|
15
|
+
'stepOver',
|
|
16
|
+
];
|
|
17
|
+
const assertDebugProvider = (provider) => {
|
|
18
|
+
if (!provider) {
|
|
19
|
+
throw new ExtensionApiError('debug provider is not defined');
|
|
20
|
+
}
|
|
21
|
+
if (typeof provider.id !== 'string' || provider.id.length === 0) {
|
|
22
|
+
throw new ExtensionApiError('debug provider is missing id');
|
|
23
|
+
}
|
|
24
|
+
for (const methodName of requiredMethods) {
|
|
25
|
+
if (typeof provider[methodName] !== 'function') {
|
|
26
|
+
throw new ExtensionApiError(`debug provider ${provider.id} is missing ${methodName} function`);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
if (provider.id in providers) {
|
|
30
|
+
throw new ExtensionApiError(`debug provider ${provider.id} is already registered`);
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
const getProvider = (id) => {
|
|
34
|
+
const provider = providers[id];
|
|
35
|
+
if (!provider) {
|
|
36
|
+
throw new ExtensionApiError(`debug provider ${id} not found`);
|
|
37
|
+
}
|
|
38
|
+
return provider;
|
|
39
|
+
};
|
|
40
|
+
const emitter = {
|
|
41
|
+
async handleChange() { },
|
|
42
|
+
async handlePaused(params) {
|
|
43
|
+
await executeCommand('Debug.paused', params);
|
|
44
|
+
},
|
|
45
|
+
async handleResumed() {
|
|
46
|
+
await executeCommand('Debug.resumed');
|
|
47
|
+
},
|
|
48
|
+
async handleScriptParsed(script) {
|
|
49
|
+
await executeCommand('Debug.scriptParsed', script);
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
export const registerDebugProvider = (provider) => {
|
|
53
|
+
assertDebugProvider(provider);
|
|
54
|
+
providers[provider.id] = provider;
|
|
55
|
+
return {
|
|
56
|
+
dispose() {
|
|
57
|
+
delete providers[provider.id];
|
|
58
|
+
},
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
export const executeDebugStart = async (id, path) => {
|
|
62
|
+
return getProvider(id).start(emitter, path);
|
|
63
|
+
};
|
|
64
|
+
export const executeDebugListProcesses = async (id, path) => {
|
|
65
|
+
return getProvider(id).listProcesses(path);
|
|
66
|
+
};
|
|
67
|
+
export const executeDebugResume = async (id) => {
|
|
68
|
+
return getProvider(id).resume();
|
|
69
|
+
};
|
|
70
|
+
export const executeDebugPause = async (id) => {
|
|
71
|
+
return getProvider(id).pause();
|
|
72
|
+
};
|
|
73
|
+
export const executeDebugStepOver = async (id) => {
|
|
74
|
+
return getProvider(id).stepOver();
|
|
75
|
+
};
|
|
76
|
+
export const executeDebugStepInto = async (id) => {
|
|
77
|
+
return getProvider(id).stepInto();
|
|
78
|
+
};
|
|
79
|
+
export const executeDebugStepOut = async (id) => {
|
|
80
|
+
return getProvider(id).stepOut();
|
|
81
|
+
};
|
|
82
|
+
export const executeDebugStep = async (id) => {
|
|
83
|
+
return getProvider(id).step();
|
|
84
|
+
};
|
|
85
|
+
export const executeDebugSetPauseOnExceptions = async (id, value) => {
|
|
86
|
+
return getProvider(id).setPauseOnExceptions(value);
|
|
87
|
+
};
|
|
88
|
+
export const executeDebugGetProperties = async (id, objectId) => {
|
|
89
|
+
return getProvider(id).getProperties(objectId);
|
|
90
|
+
};
|
|
91
|
+
export const executeDebugEvaluate = async (id, expression, callFrameId) => {
|
|
92
|
+
return getProvider(id).evaluate(expression, callFrameId);
|
|
93
|
+
};
|
|
94
|
+
export const resetDebugProviderRegistry = () => {
|
|
95
|
+
for (const id of Object.keys(providers)) {
|
|
96
|
+
delete providers[id];
|
|
97
|
+
}
|
|
98
|
+
};
|
|
@@ -47,4 +47,15 @@ export declare const commandMap: {
|
|
|
47
47
|
'ExtensionApi.getViewRegistrySnapshot': () => import("../View/View.ts").ViewRegistrySnapshot;
|
|
48
48
|
'ExtensionApi.renderViewInstance': (uid: number) => Promise<import("../View/View.ts").ViewRenderResult>;
|
|
49
49
|
'ExtensionApi.saveViewInstanceState': (uid: number) => Promise<unknown>;
|
|
50
|
+
'ExtensionHostDebug.evaluate': (id: string, expression: string, callFrameId: string) => Promise<unknown>;
|
|
51
|
+
'ExtensionHostDebug.getProperties': (id: string, objectId: string) => Promise<unknown>;
|
|
52
|
+
'ExtensionHostDebug.listProcesses': (id: string, path?: string) => Promise<unknown>;
|
|
53
|
+
'ExtensionHostDebug.pause': (id: string) => Promise<unknown>;
|
|
54
|
+
'ExtensionHostDebug.resume': (id: string) => Promise<unknown>;
|
|
55
|
+
'ExtensionHostDebug.setPauseOnExceptions': (id: string, value: number) => Promise<unknown>;
|
|
56
|
+
'ExtensionHostDebug.start': (id: string, path?: string) => Promise<unknown>;
|
|
57
|
+
'ExtensionHostDebug.step': (id: string) => Promise<unknown>;
|
|
58
|
+
'ExtensionHostDebug.stepInto': (id: string) => Promise<unknown>;
|
|
59
|
+
'ExtensionHostDebug.stepOut': (id: string) => Promise<unknown>;
|
|
60
|
+
'ExtensionHostDebug.stepOver': (id: string) => Promise<unknown>;
|
|
50
61
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { executeCommand, getCommandRegistrySnapshot } from "../CommandRegistry/CommandRegistry.js";
|
|
2
2
|
import { executeCompletionProvider, executeResolveCompletionItemProvider, getCompletionProviderRegistrySnapshot } from "../Completion/Completion.js";
|
|
3
|
+
import { executeDebugEvaluate, executeDebugGetProperties, executeDebugListProcesses, executeDebugPause, executeDebugResume, executeDebugSetPauseOnExceptions, executeDebugStart, executeDebugStep, executeDebugStepInto, executeDebugStepOut, executeDebugStepOver, } from "../Debug/Debug.js";
|
|
3
4
|
import { executeDiagnosticProvider, getDiagnosticProviderRegistrySnapshot } from "../Diagnostic/Diagnostic.js";
|
|
4
5
|
import { executeFileSystemProviderGetPathSeparator, executeFileSystemProviderIsReadonly, executeFileSystemProviderReadDirWithFileTypes, executeFileSystemProviderReadFile, getFileSystemProviderRegistrySnapshot, } from "../FileSystemProviderRegistry/FileSystemProviderRegistry.js";
|
|
5
6
|
import { executeFormattingProvider, getFormattingProviderRegistrySnapshot } from "../Formatting/Formatting.js";
|
|
@@ -55,4 +56,15 @@ export const commandMap = {
|
|
|
55
56
|
'ExtensionApi.getViewRegistrySnapshot': getViewRegistrySnapshot,
|
|
56
57
|
'ExtensionApi.renderViewInstance': renderViewInstance,
|
|
57
58
|
'ExtensionApi.saveViewInstanceState': saveViewInstanceState,
|
|
59
|
+
'ExtensionHostDebug.evaluate': executeDebugEvaluate,
|
|
60
|
+
'ExtensionHostDebug.getProperties': executeDebugGetProperties,
|
|
61
|
+
'ExtensionHostDebug.listProcesses': executeDebugListProcesses,
|
|
62
|
+
'ExtensionHostDebug.pause': executeDebugPause,
|
|
63
|
+
'ExtensionHostDebug.resume': executeDebugResume,
|
|
64
|
+
'ExtensionHostDebug.setPauseOnExceptions': executeDebugSetPauseOnExceptions,
|
|
65
|
+
'ExtensionHostDebug.start': executeDebugStart,
|
|
66
|
+
'ExtensionHostDebug.step': executeDebugStep,
|
|
67
|
+
'ExtensionHostDebug.stepInto': executeDebugStepInto,
|
|
68
|
+
'ExtensionHostDebug.stepOut': executeDebugStepOut,
|
|
69
|
+
'ExtensionHostDebug.stepOver': executeDebugStepOver,
|
|
58
70
|
};
|
package/extension-api/dist/parts/ExtensionApiWorkerCommandMap/ExtensionApiWorkerCommandMap.d.ts
CHANGED
|
@@ -49,4 +49,15 @@ export declare const commandMap: {
|
|
|
49
49
|
'ExtensionApi.getViewRegistrySnapshot': () => import("../View/View.ts").ViewRegistrySnapshot;
|
|
50
50
|
'ExtensionApi.renderViewInstance': (uid: number) => Promise<import("../View/View.ts").ViewRenderResult>;
|
|
51
51
|
'ExtensionApi.saveViewInstanceState': (uid: number) => Promise<unknown>;
|
|
52
|
+
'ExtensionHostDebug.evaluate': (id: string, expression: string, callFrameId: string) => Promise<unknown>;
|
|
53
|
+
'ExtensionHostDebug.getProperties': (id: string, objectId: string) => Promise<unknown>;
|
|
54
|
+
'ExtensionHostDebug.listProcesses': (id: string, path?: string) => Promise<unknown>;
|
|
55
|
+
'ExtensionHostDebug.pause': (id: string) => Promise<unknown>;
|
|
56
|
+
'ExtensionHostDebug.resume': (id: string) => Promise<unknown>;
|
|
57
|
+
'ExtensionHostDebug.setPauseOnExceptions': (id: string, value: number) => Promise<unknown>;
|
|
58
|
+
'ExtensionHostDebug.start': (id: string, path?: string) => Promise<unknown>;
|
|
59
|
+
'ExtensionHostDebug.step': (id: string) => Promise<unknown>;
|
|
60
|
+
'ExtensionHostDebug.stepInto': (id: string) => Promise<unknown>;
|
|
61
|
+
'ExtensionHostDebug.stepOut': (id: string) => Promise<unknown>;
|
|
62
|
+
'ExtensionHostDebug.stepOver': (id: string) => Promise<unknown>;
|
|
52
63
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type Rpc } from '@lvce-editor/rpc';
|
|
2
2
|
export interface CreateRpcOptions {
|
|
3
3
|
readonly commandMap?: Record<string, unknown>;
|
|
4
|
+
readonly contentSecurityPolicy?: string;
|
|
4
5
|
readonly name?: string;
|
|
5
6
|
readonly url: string;
|
|
6
7
|
}
|
|
@@ -9,5 +10,5 @@ export interface CreateNodeRpcOptions {
|
|
|
9
10
|
readonly name?: string;
|
|
10
11
|
readonly path?: string;
|
|
11
12
|
}
|
|
12
|
-
export declare const createRpc: ({ commandMap, name, url }: CreateRpcOptions) => Promise<Rpc>;
|
|
13
|
+
export declare const createRpc: ({ commandMap, contentSecurityPolicy, name, url }: CreateRpcOptions) => Promise<Rpc>;
|
|
13
14
|
export declare const createNodeRpc: (options: CreateNodeRpcOptions) => Promise<Rpc>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { MessagePortRpcParent } from '@lvce-editor/rpc';
|
|
2
2
|
import { ExtensionManagementWorker } from '@lvce-editor/rpc-registry';
|
|
3
|
-
const sendMessagePortToWebWorker = async (port, name, url) => {
|
|
4
|
-
await ExtensionManagementWorker.invokeAndTransfer('Extensions.createWebViewWorkerRpc2', { name, url }, port);
|
|
3
|
+
const sendMessagePortToWebWorker = async (port, contentSecurityPolicy, name, url) => {
|
|
4
|
+
await ExtensionManagementWorker.invokeAndTransfer('Extensions.createWebViewWorkerRpc2', { contentSecurityPolicy, name, url }, port);
|
|
5
5
|
};
|
|
6
6
|
const createMessagePortRpc = async (commandMap, send) => {
|
|
7
7
|
const { port1, port2 } = new MessageChannel();
|
|
@@ -14,8 +14,8 @@ const createMessagePortRpc = async (commandMap, send) => {
|
|
|
14
14
|
await send(port1);
|
|
15
15
|
return rpcPromise;
|
|
16
16
|
};
|
|
17
|
-
export const createRpc = async ({ commandMap = {}, name = '', url }) => {
|
|
18
|
-
return createMessagePortRpc(commandMap, (port) => sendMessagePortToWebWorker(port, name, url));
|
|
17
|
+
export const createRpc = async ({ commandMap = {}, contentSecurityPolicy = '', name = '', url }) => {
|
|
18
|
+
return createMessagePortRpc(commandMap, (port) => sendMessagePortToWebWorker(port, contentSecurityPolicy, name, url));
|
|
19
19
|
};
|
|
20
20
|
const resolveNodeRpcOptions = async ({ id, name = '', path }) => {
|
|
21
21
|
if (id) {
|