@theia/plugin-ext 1.45.0 → 1.46.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/lib/common/plugin-api-rpc.d.ts +9 -4
- package/lib/common/plugin-api-rpc.d.ts.map +1 -1
- package/lib/common/plugin-api-rpc.js +3 -1
- package/lib/common/plugin-api-rpc.js.map +1 -1
- package/lib/common/plugin-ext-api-contribution.d.ts +35 -5
- package/lib/common/plugin-ext-api-contribution.d.ts.map +1 -1
- package/lib/common/plugin-ext-api-contribution.js.map +1 -1
- package/lib/common/plugin-protocol.d.ts +5 -2
- package/lib/common/plugin-protocol.d.ts.map +1 -1
- package/lib/common/plugin-protocol.js +1 -0
- package/lib/common/plugin-protocol.js.map +1 -1
- package/lib/common/proxy-handler.d.ts +7 -0
- package/lib/common/proxy-handler.d.ts.map +1 -1
- package/lib/common/proxy-handler.js +5 -1
- package/lib/common/proxy-handler.js.map +1 -1
- package/lib/common/rpc-protocol.d.ts +10 -0
- package/lib/common/rpc-protocol.d.ts.map +1 -1
- package/lib/common/rpc-protocol.js +32 -3
- package/lib/common/rpc-protocol.js.map +1 -1
- package/lib/hosted/browser/hosted-plugin.d.ts +16 -74
- package/lib/hosted/browser/hosted-plugin.d.ts.map +1 -1
- package/lib/hosted/browser/hosted-plugin.js +41 -314
- package/lib/hosted/browser/hosted-plugin.js.map +1 -1
- package/lib/hosted/browser/worker/debug-stub.d.ts +2 -2
- package/lib/hosted/browser/worker/debug-stub.d.ts.map +1 -1
- package/lib/hosted/browser/worker/debug-stub.js +3 -3
- package/lib/hosted/browser/worker/debug-stub.js.map +1 -1
- package/lib/hosted/browser/worker/worker-env-ext.d.ts +1 -2
- package/lib/hosted/browser/worker/worker-env-ext.d.ts.map +1 -1
- package/lib/hosted/browser/worker/worker-env-ext.js +18 -4
- package/lib/hosted/browser/worker/worker-env-ext.js.map +1 -1
- package/lib/hosted/browser/worker/worker-main.js +20 -32
- package/lib/hosted/browser/worker/worker-main.js.map +1 -1
- package/lib/hosted/browser/worker/worker-plugin-module.d.ts +5 -0
- package/lib/hosted/browser/worker/worker-plugin-module.d.ts.map +1 -0
- package/lib/hosted/browser/worker/worker-plugin-module.js +71 -0
- package/lib/hosted/browser/worker/worker-plugin-module.js.map +1 -0
- package/lib/hosted/common/hosted-plugin.d.ts +97 -0
- package/lib/hosted/common/hosted-plugin.d.ts.map +1 -0
- package/lib/hosted/common/hosted-plugin.js +408 -0
- package/lib/hosted/common/hosted-plugin.js.map +1 -0
- package/lib/hosted/node/hosted-plugin-process.d.ts +1 -1
- package/lib/hosted/node/hosted-plugin-process.d.ts.map +1 -1
- package/lib/hosted/node/hosted-plugin-process.js +2 -2
- package/lib/hosted/node/hosted-plugin-process.js.map +1 -1
- package/lib/hosted/node/plugin-ext-hosted-backend-module.d.ts.map +1 -1
- package/lib/hosted/node/plugin-ext-hosted-backend-module.js +2 -0
- package/lib/hosted/node/plugin-ext-hosted-backend-module.js.map +1 -1
- package/lib/hosted/node/plugin-host-module.d.ts +5 -0
- package/lib/hosted/node/plugin-host-module.d.ts.map +1 -0
- package/lib/hosted/node/plugin-host-module.js +68 -0
- package/lib/hosted/node/plugin-host-module.js.map +1 -0
- package/lib/hosted/node/plugin-host-rpc.d.ts +93 -7
- package/lib/hosted/node/plugin-host-rpc.d.ts.map +1 -1
- package/lib/hosted/node/plugin-host-rpc.js +202 -53
- package/lib/hosted/node/plugin-host-rpc.js.map +1 -1
- package/lib/hosted/node/plugin-host.js +6 -5
- package/lib/hosted/node/plugin-host.js.map +1 -1
- package/lib/hosted/node/plugin-reader.d.ts.map +1 -1
- package/lib/hosted/node/plugin-reader.js +3 -0
- package/lib/hosted/node/plugin-reader.js.map +1 -1
- package/lib/hosted/node/plugin-service.d.ts +8 -0
- package/lib/hosted/node/plugin-service.d.ts.map +1 -1
- package/lib/hosted/node/plugin-service.js +14 -4
- package/lib/hosted/node/plugin-service.js.map +1 -1
- package/lib/hosted/node/scanners/file-plugin-uri-factory.js +1 -1
- package/lib/hosted/node/scanners/file-plugin-uri-factory.js.map +1 -1
- package/lib/hosted/node/scanners/scanner-theia.d.ts +17 -3
- package/lib/hosted/node/scanners/scanner-theia.d.ts.map +1 -1
- package/lib/hosted/node/scanners/scanner-theia.js +48 -19
- package/lib/hosted/node/scanners/scanner-theia.js.map +1 -1
- package/lib/main/browser/authentication-main.d.ts.map +1 -1
- package/lib/main/browser/authentication-main.js +3 -1
- package/lib/main/browser/authentication-main.js.map +1 -1
- package/lib/main/browser/env-main.d.ts +1 -10
- package/lib/main/browser/env-main.d.ts.map +1 -1
- package/lib/main/browser/env-main.js +2 -21
- package/lib/main/browser/env-main.js.map +1 -1
- package/lib/main/browser/menus/menus-contribution-handler.d.ts.map +1 -1
- package/lib/main/browser/menus/menus-contribution-handler.js +6 -3
- package/lib/main/browser/menus/menus-contribution-handler.js.map +1 -1
- package/lib/main/browser/menus/plugin-menu-command-adapter.js +1 -1
- package/lib/main/browser/menus/plugin-menu-command-adapter.js.map +1 -1
- package/lib/main/browser/message-registry-main.d.ts +6 -4
- package/lib/main/browser/message-registry-main.d.ts.map +1 -1
- package/lib/main/browser/message-registry-main.js +7 -19
- package/lib/main/browser/message-registry-main.js.map +1 -1
- package/lib/main/browser/notebooks/renderers/cell-output-webview.d.ts +1 -0
- package/lib/main/browser/notebooks/renderers/cell-output-webview.d.ts.map +1 -1
- package/lib/main/browser/notebooks/renderers/cell-output-webview.js +23 -22
- package/lib/main/browser/notebooks/renderers/cell-output-webview.js.map +1 -1
- package/lib/main/browser/notebooks/renderers/output-webview-internal.d.ts.map +1 -1
- package/lib/main/browser/notebooks/renderers/output-webview-internal.js +22 -14
- package/lib/main/browser/notebooks/renderers/output-webview-internal.js.map +1 -1
- package/lib/main/browser/notebooks/renderers/webview-communication.d.ts +2 -1
- package/lib/main/browser/notebooks/renderers/webview-communication.d.ts.map +1 -1
- package/lib/main/browser/notification-main.d.ts +2 -14
- package/lib/main/browser/notification-main.d.ts.map +1 -1
- package/lib/main/browser/notification-main.js +3 -52
- package/lib/main/browser/notification-main.js.map +1 -1
- package/lib/main/browser/terminal-main.d.ts +1 -1
- package/lib/main/browser/terminal-main.d.ts.map +1 -1
- package/lib/main/browser/terminal-main.js +2 -2
- package/lib/main/browser/terminal-main.js.map +1 -1
- package/lib/main/browser/view/plugin-view-registry.d.ts.map +1 -1
- package/lib/main/browser/view/plugin-view-registry.js +5 -2
- package/lib/main/browser/view/plugin-view-registry.js.map +1 -1
- package/lib/main/browser/webview/webview-context-keys.d.ts +5 -1
- package/lib/main/browser/webview/webview-context-keys.d.ts.map +1 -1
- package/lib/main/browser/webview/webview-context-keys.js +13 -4
- package/lib/main/browser/webview/webview-context-keys.js.map +1 -1
- package/lib/main/browser/webview/webview-widget-factory.d.ts.map +1 -1
- package/lib/main/browser/webview/webview-widget-factory.js +2 -1
- package/lib/main/browser/webview/webview-widget-factory.js.map +1 -1
- package/lib/main/browser/webview/webview.d.ts +1 -0
- package/lib/main/browser/webview/webview.d.ts.map +1 -1
- package/lib/main/browser/webview/webview.js +1 -0
- package/lib/main/browser/webview/webview.js.map +1 -1
- package/lib/main/browser/webviews-main.d.ts.map +1 -1
- package/lib/main/browser/webviews-main.js +7 -2
- package/lib/main/browser/webviews-main.js.map +1 -1
- package/lib/main/common/basic-message-registry-main.d.ts +14 -0
- package/lib/main/common/basic-message-registry-main.d.ts.map +1 -0
- package/lib/main/common/basic-message-registry-main.js +50 -0
- package/lib/main/common/basic-message-registry-main.js.map +1 -0
- package/lib/main/common/basic-notification-main.d.ts +19 -0
- package/lib/main/common/basic-notification-main.d.ts.map +1 -0
- package/lib/main/common/basic-notification-main.js +75 -0
- package/lib/main/common/basic-notification-main.js.map +1 -0
- package/lib/main/common/env-main.d.ts +11 -0
- package/lib/main/common/env-main.d.ts.map +1 -0
- package/lib/main/common/env-main.js +40 -0
- package/lib/main/common/env-main.js.map +1 -0
- package/lib/main/node/handlers/plugin-theia-directory-handler.d.ts +8 -3
- package/lib/main/node/handlers/plugin-theia-directory-handler.d.ts.map +1 -1
- package/lib/main/node/handlers/plugin-theia-directory-handler.js +38 -20
- package/lib/main/node/handlers/plugin-theia-directory-handler.js.map +1 -1
- package/lib/main/node/handlers/plugin-theia-file-handler.js +1 -1
- package/lib/main/node/handlers/plugin-theia-file-handler.js.map +1 -1
- package/lib/main/node/plugin-deployer-impl.d.ts.map +1 -1
- package/lib/main/node/plugin-deployer-impl.js +5 -1
- package/lib/main/node/plugin-deployer-impl.js.map +1 -1
- package/lib/main/node/plugins-key-value-storage.js +1 -1
- package/lib/main/node/plugins-key-value-storage.js.map +1 -1
- package/lib/plugin/clipboard-ext.d.ts +3 -2
- package/lib/plugin/clipboard-ext.d.ts.map +1 -1
- package/lib/plugin/clipboard-ext.js +28 -4
- package/lib/plugin/clipboard-ext.js.map +1 -1
- package/lib/plugin/debug/debug-ext.d.ts +3 -1
- package/lib/plugin/debug/debug-ext.d.ts.map +1 -1
- package/lib/plugin/debug/debug-ext.js +31 -4
- package/lib/plugin/debug/debug-ext.js.map +1 -1
- package/lib/plugin/documents.js +2 -2
- package/lib/plugin/documents.js.map +1 -1
- package/lib/plugin/editors-and-documents.d.ts +1 -2
- package/lib/plugin/editors-and-documents.d.ts.map +1 -1
- package/lib/plugin/editors-and-documents.js +21 -4
- package/lib/plugin/editors-and-documents.js.map +1 -1
- package/lib/plugin/env.d.ts +6 -2
- package/lib/plugin/env.d.ts.map +1 -1
- package/lib/plugin/env.js +37 -4
- package/lib/plugin/env.js.map +1 -1
- package/lib/plugin/localization-ext.d.ts +3 -2
- package/lib/plugin/localization-ext.d.ts.map +1 -1
- package/lib/plugin/localization-ext.js +30 -4
- package/lib/plugin/localization-ext.js.map +1 -1
- package/lib/plugin/message-registry.d.ts +2 -1
- package/lib/plugin/message-registry.d.ts.map +1 -1
- package/lib/plugin/message-registry.js +28 -4
- package/lib/plugin/message-registry.js.map +1 -1
- package/lib/plugin/node/debug/debug.spec.js +21 -1
- package/lib/plugin/node/debug/debug.spec.js.map +1 -1
- package/lib/plugin/node/env-node-ext.d.ts +1 -6
- package/lib/plugin/node/env-node-ext.d.ts.map +1 -1
- package/lib/plugin/node/env-node-ext.js +18 -10
- package/lib/plugin/node/env-node-ext.js.map +1 -1
- package/lib/plugin/node/plugin-container-module.d.ts +75 -0
- package/lib/plugin/node/plugin-container-module.d.ts.map +1 -0
- package/lib/plugin/node/plugin-container-module.js +115 -0
- package/lib/plugin/node/plugin-container-module.js.map +1 -0
- package/lib/plugin/notebook/notebook-kernels.d.ts.map +1 -1
- package/lib/plugin/notebook/notebook-kernels.js +0 -1
- package/lib/plugin/notebook/notebook-kernels.js.map +1 -1
- package/lib/plugin/plugin-context.d.ts.map +1 -1
- package/lib/plugin/plugin-context.js +9 -1
- package/lib/plugin/plugin-context.js.map +1 -1
- package/lib/plugin/plugin-manager.d.ts +26 -17
- package/lib/plugin/plugin-manager.d.ts.map +1 -1
- package/lib/plugin/plugin-manager.js +107 -37
- package/lib/plugin/plugin-manager.js.map +1 -1
- package/lib/plugin/plugin-storage.d.ts +11 -3
- package/lib/plugin/plugin-storage.d.ts.map +1 -1
- package/lib/plugin/plugin-storage.js +25 -5
- package/lib/plugin/plugin-storage.js.map +1 -1
- package/lib/plugin/preference-registry.d.ts +3 -2
- package/lib/plugin/preference-registry.d.ts.map +1 -1
- package/lib/plugin/preference-registry.js +35 -5
- package/lib/plugin/preference-registry.js.map +1 -1
- package/lib/plugin/preference-registry.spec.js +8 -1
- package/lib/plugin/preference-registry.spec.js.map +1 -1
- package/lib/plugin/quick-open.js +3 -3
- package/lib/plugin/quick-open.js.map +1 -1
- package/lib/plugin/secrets-ext.d.ts +16 -7
- package/lib/plugin/secrets-ext.d.ts.map +1 -1
- package/lib/plugin/secrets-ext.js +23 -3
- package/lib/plugin/secrets-ext.js.map +1 -1
- package/lib/plugin/terminal-ext.d.ts +1 -1
- package/lib/plugin/terminal-ext.d.ts.map +1 -1
- package/lib/plugin/terminal-ext.js +26 -6
- package/lib/plugin/terminal-ext.js.map +1 -1
- package/lib/plugin/types-impl.d.ts +22 -2
- package/lib/plugin/types-impl.d.ts.map +1 -1
- package/lib/plugin/types-impl.js +22 -6
- package/lib/plugin/types-impl.js.map +1 -1
- package/lib/plugin/webview-views.d.ts.map +1 -1
- package/lib/plugin/webview-views.js +2 -1
- package/lib/plugin/webview-views.js.map +1 -1
- package/lib/plugin/webviews.d.ts +7 -5
- package/lib/plugin/webviews.d.ts.map +1 -1
- package/lib/plugin/webviews.js +46 -12
- package/lib/plugin/webviews.js.map +1 -1
- package/lib/plugin/workspace.d.ts +4 -3
- package/lib/plugin/workspace.d.ts.map +1 -1
- package/lib/plugin/workspace.js +40 -6
- package/lib/plugin/workspace.js.map +1 -1
- package/package.json +29 -29
- package/src/common/plugin-api-rpc.ts +10 -6
- package/src/common/plugin-ext-api-contribution.ts +38 -5
- package/src/common/plugin-protocol.ts +7 -2
- package/src/common/proxy-handler.ts +14 -1
- package/src/common/rpc-protocol.ts +41 -3
- package/src/hosted/browser/hosted-plugin.ts +47 -337
- package/src/hosted/browser/worker/debug-stub.ts +4 -3
- package/src/hosted/browser/worker/worker-env-ext.ts +5 -4
- package/src/hosted/browser/worker/worker-main.ts +103 -115
- package/src/hosted/browser/worker/worker-plugin-module.ts +73 -0
- package/src/hosted/common/hosted-plugin.ts +456 -0
- package/src/hosted/node/hosted-plugin-process.ts +4 -4
- package/src/hosted/node/plugin-ext-hosted-backend-module.ts +3 -1
- package/src/hosted/node/plugin-host-module.ts +69 -0
- package/src/hosted/node/plugin-host-rpc.ts +232 -73
- package/src/hosted/node/plugin-host.ts +9 -7
- package/src/hosted/node/plugin-reader.ts +3 -0
- package/src/hosted/node/plugin-service.ts +21 -4
- package/src/hosted/node/scanners/file-plugin-uri-factory.ts +1 -1
- package/src/hosted/node/scanners/scanner-theia.ts +46 -12
- package/src/main/browser/authentication-main.ts +3 -1
- package/src/main/browser/env-main.ts +1 -28
- package/src/main/browser/menus/menus-contribution-handler.ts +8 -3
- package/src/main/browser/menus/plugin-menu-command-adapter.ts +1 -1
- package/src/main/browser/message-registry-main.ts +10 -23
- package/src/main/browser/notebooks/renderers/cell-output-webview.tsx +26 -24
- package/src/main/browser/notebooks/renderers/output-webview-internal.ts +22 -13
- package/src/main/browser/notebooks/renderers/webview-communication.ts +2 -1
- package/src/main/browser/notification-main.ts +4 -64
- package/src/main/browser/terminal-main.ts +2 -2
- package/src/main/browser/view/plugin-view-registry.ts +6 -3
- package/src/main/browser/webview/webview-context-keys.ts +17 -4
- package/src/main/browser/webview/webview-widget-factory.ts +2 -1
- package/src/main/browser/webview/webview.ts +2 -0
- package/src/main/browser/webviews-main.ts +7 -2
- package/src/main/common/basic-message-registry-main.ts +53 -0
- package/src/main/common/basic-notification-main.ts +86 -0
- package/src/main/common/env-main.ts +44 -0
- package/src/main/node/handlers/plugin-theia-directory-handler.ts +38 -16
- package/src/main/node/handlers/plugin-theia-file-handler.ts +1 -1
- package/src/main/node/plugin-deployer-impl.ts +5 -1
- package/src/main/node/plugins-key-value-storage.ts +1 -1
- package/src/plugin/clipboard-ext.ts +9 -3
- package/src/plugin/debug/debug-ext.ts +11 -2
- package/src/plugin/documents.ts +2 -2
- package/src/plugin/editors-and-documents.ts +5 -3
- package/src/plugin/env.ts +19 -3
- package/src/plugin/localization-ext.ts +8 -3
- package/src/plugin/message-registry.ts +7 -2
- package/src/plugin/node/debug/debug.spec.ts +5 -1
- package/src/plugin/node/env-node-ext.ts +5 -10
- package/src/plugin/node/plugin-container-module.ts +165 -0
- package/src/plugin/notebook/notebook-kernels.ts +0 -1
- package/src/plugin/plugin-context.ts +11 -2
- package/src/plugin/plugin-manager.ts +99 -45
- package/src/plugin/plugin-storage.ts +22 -4
- package/src/plugin/preference-registry.spec.ts +6 -1
- package/src/plugin/preference-registry.ts +11 -5
- package/src/plugin/quick-open.ts +3 -3
- package/src/plugin/secrets-ext.ts +25 -5
- package/src/plugin/terminal-ext.ts +5 -3
- package/src/plugin/types-impl.ts +30 -2
- package/src/plugin/webview-views.ts +2 -1
- package/src/plugin/webviews.ts +22 -13
- package/src/plugin/workspace.ts +14 -4
|
@@ -15,13 +15,12 @@
|
|
|
15
15
|
// *****************************************************************************
|
|
16
16
|
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
17
17
|
import 'reflect-metadata';
|
|
18
|
-
import {
|
|
19
|
-
import { Uint8ArrayReadBuffer, Uint8ArrayWriteBuffer } from '@theia/core/lib/common/message-rpc/uint8-array-message-buffer';
|
|
18
|
+
import { Container } from '@theia/core/shared/inversify';
|
|
20
19
|
import * as theia from '@theia/plugin';
|
|
21
|
-
import { emptyPlugin, MAIN_RPC_CONTEXT, Plugin
|
|
20
|
+
import { emptyPlugin, MAIN_RPC_CONTEXT, Plugin } from '../../../common/plugin-api-rpc';
|
|
22
21
|
import { ExtPluginApi } from '../../../common/plugin-ext-api-contribution';
|
|
23
22
|
import { getPluginId, PluginMetadata } from '../../../common/plugin-protocol';
|
|
24
|
-
import { RPCProtocolImpl } from '../../../common/rpc-protocol';
|
|
23
|
+
import { RPCProtocol, RPCProtocolImpl } from '../../../common/rpc-protocol';
|
|
25
24
|
import { ClipboardExt } from '../../../plugin/clipboard-ext';
|
|
26
25
|
import { EditorsAndDocumentsExtImpl } from '../../../plugin/editors-and-documents';
|
|
27
26
|
import { MessageRegistryExt } from '../../../plugin/message-registry';
|
|
@@ -29,14 +28,13 @@ import { createAPIFactory } from '../../../plugin/plugin-context';
|
|
|
29
28
|
import { PluginManagerExtImpl } from '../../../plugin/plugin-manager';
|
|
30
29
|
import { KeyValueStorageProxy } from '../../../plugin/plugin-storage';
|
|
31
30
|
import { PreferenceRegistryExtImpl } from '../../../plugin/preference-registry';
|
|
32
|
-
import { SecretsExtImpl } from '../../../plugin/secrets-ext';
|
|
33
|
-
import { TerminalServiceExtImpl } from '../../../plugin/terminal-ext';
|
|
34
31
|
import { WebviewsExtImpl } from '../../../plugin/webviews';
|
|
35
32
|
import { WorkspaceExtImpl } from '../../../plugin/workspace';
|
|
36
|
-
import { createDebugExtStub } from './debug-stub';
|
|
37
33
|
import { loadManifest } from './plugin-manifest-loader';
|
|
38
|
-
import {
|
|
34
|
+
import { EnvExtImpl } from '../../../plugin/env';
|
|
35
|
+
import { DebugExtImpl } from '../../../plugin/debug/debug-ext';
|
|
39
36
|
import { LocalizationExtImpl } from '../../../plugin/localization-ext';
|
|
37
|
+
import pluginHostModule from './worker-plugin-module';
|
|
40
38
|
|
|
41
39
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
42
40
|
const ctx = self as any;
|
|
@@ -44,20 +42,6 @@ const ctx = self as any;
|
|
|
44
42
|
const pluginsApiImpl = new Map<string, typeof theia>();
|
|
45
43
|
const pluginsModulesNames = new Map<string, Plugin>();
|
|
46
44
|
|
|
47
|
-
const channel = new BasicChannel(() => {
|
|
48
|
-
const writeBuffer = new Uint8ArrayWriteBuffer();
|
|
49
|
-
writeBuffer.onCommit(buffer => {
|
|
50
|
-
ctx.postMessage(buffer);
|
|
51
|
-
});
|
|
52
|
-
return writeBuffer;
|
|
53
|
-
});
|
|
54
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
55
|
-
addEventListener('message', (message: any) => {
|
|
56
|
-
channel.onMessageEmitter.fire(() => new Uint8ArrayReadBuffer(message.data));
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
const rpc = new RPCProtocolImpl(channel);
|
|
60
|
-
|
|
61
45
|
const scripts = new Set<string>();
|
|
62
46
|
|
|
63
47
|
function initialize(contextPath: string, pluginMetadata: PluginMetadata): void {
|
|
@@ -68,112 +52,116 @@ function initialize(contextPath: string, pluginMetadata: PluginMetadata): void {
|
|
|
68
52
|
scripts.add(path);
|
|
69
53
|
}
|
|
70
54
|
}
|
|
71
|
-
const envExt = new WorkerEnvExtImpl(rpc);
|
|
72
|
-
const storageProxy = new KeyValueStorageProxy(rpc);
|
|
73
|
-
const editorsAndDocuments = new EditorsAndDocumentsExtImpl(rpc);
|
|
74
|
-
const messageRegistryExt = new MessageRegistryExt(rpc);
|
|
75
|
-
const workspaceExt = new WorkspaceExtImpl(rpc, editorsAndDocuments, messageRegistryExt);
|
|
76
|
-
const preferenceRegistryExt = new PreferenceRegistryExtImpl(rpc, workspaceExt);
|
|
77
|
-
const debugExt = createDebugExtStub(rpc);
|
|
78
|
-
const clipboardExt = new ClipboardExt(rpc);
|
|
79
|
-
const webviewExt = new WebviewsExtImpl(rpc, workspaceExt);
|
|
80
|
-
const secretsExt = new SecretsExtImpl(rpc);
|
|
81
|
-
const localizationExt = new LocalizationExtImpl(rpc);
|
|
82
|
-
const terminalService: TerminalServiceExt = new TerminalServiceExtImpl(rpc);
|
|
83
|
-
|
|
84
|
-
const pluginManager = new PluginManagerExtImpl({
|
|
85
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
86
|
-
loadPlugin(plugin: Plugin): any {
|
|
87
|
-
if (plugin.pluginPath) {
|
|
88
|
-
if (isElectron()) {
|
|
89
|
-
ctx.importScripts(plugin.pluginPath);
|
|
90
|
-
} else {
|
|
91
|
-
if (plugin.lifecycle.frontendModuleName) {
|
|
92
|
-
// Set current module name being imported
|
|
93
|
-
ctx.frontendModuleName = plugin.lifecycle.frontendModuleName;
|
|
94
|
-
}
|
|
95
55
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
56
|
+
const container = new Container();
|
|
57
|
+
container.load(pluginHostModule);
|
|
58
|
+
|
|
59
|
+
const rpc: RPCProtocol = container.get(RPCProtocolImpl);
|
|
60
|
+
const pluginManager = container.get(PluginManagerExtImpl);
|
|
61
|
+
pluginManager.setPluginHost({
|
|
62
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
63
|
+
loadPlugin(plugin: Plugin): any {
|
|
64
|
+
if (plugin.pluginPath) {
|
|
65
|
+
if (isElectron()) {
|
|
66
|
+
ctx.importScripts(plugin.pluginPath);
|
|
67
|
+
} else {
|
|
68
|
+
if (plugin.lifecycle.frontendModuleName) {
|
|
69
|
+
// Set current module name being imported
|
|
70
|
+
ctx.frontendModuleName = plugin.lifecycle.frontendModuleName;
|
|
71
|
+
}
|
|
99
72
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
console.error(`WebWorker: Cannot start plugin "${plugin.model.name}". Frontend plugin not found: "${plugin.lifecycle.frontendModuleName}"`);
|
|
103
|
-
return;
|
|
73
|
+
ctx.importScripts('/hostedPlugin/' + getPluginId(plugin.model) + '/' + plugin.pluginPath);
|
|
74
|
+
}
|
|
104
75
|
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
const foreign: Plugin[] = [];
|
|
111
|
-
// Process the plugins concurrently, making sure to keep the order.
|
|
112
|
-
const plugins = await Promise.all<{
|
|
113
|
-
/** Where to push the plugin: `result` or `foreign` */
|
|
114
|
-
target: Plugin[],
|
|
115
|
-
plugin: Plugin
|
|
116
|
-
}>(rawPluginData.map(async plg => {
|
|
117
|
-
const pluginModel = plg.model;
|
|
118
|
-
const pluginLifecycle = plg.lifecycle;
|
|
119
|
-
if (pluginModel.entryPoint!.frontend) {
|
|
120
|
-
let frontendInitPath = pluginLifecycle.frontendInitPath;
|
|
121
|
-
if (frontendInitPath) {
|
|
122
|
-
initialize(frontendInitPath, plg);
|
|
123
|
-
} else {
|
|
124
|
-
frontendInitPath = '';
|
|
76
|
+
|
|
77
|
+
if (plugin.lifecycle.frontendModuleName) {
|
|
78
|
+
if (!ctx[plugin.lifecycle.frontendModuleName]) {
|
|
79
|
+
console.error(`WebWorker: Cannot start plugin "${plugin.model.name}". Frontend plugin not found: "${plugin.lifecycle.frontendModuleName}"`);
|
|
80
|
+
return;
|
|
125
81
|
}
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
82
|
+
return ctx[plugin.lifecycle.frontendModuleName];
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
async init(rawPluginData: PluginMetadata[]): Promise<[Plugin[], Plugin[]]> {
|
|
86
|
+
const result: Plugin[] = [];
|
|
87
|
+
const foreign: Plugin[] = [];
|
|
88
|
+
// Process the plugins concurrently, making sure to keep the order.
|
|
89
|
+
const plugins = await Promise.all<{
|
|
90
|
+
/** Where to push the plugin: `result` or `foreign` */
|
|
91
|
+
target: Plugin[],
|
|
92
|
+
plugin: Plugin
|
|
93
|
+
}>(rawPluginData.map(async plg => {
|
|
94
|
+
const pluginModel = plg.model;
|
|
95
|
+
const pluginLifecycle = plg.lifecycle;
|
|
96
|
+
if (pluginModel.entryPoint!.frontend) {
|
|
97
|
+
let frontendInitPath = pluginLifecycle.frontendInitPath;
|
|
98
|
+
if (frontendInitPath) {
|
|
99
|
+
initialize(frontendInitPath, plg);
|
|
100
|
+
} else {
|
|
101
|
+
frontendInitPath = '';
|
|
102
|
+
}
|
|
103
|
+
const rawModel = await loadManifest(pluginModel);
|
|
104
|
+
const plugin: Plugin = {
|
|
105
|
+
pluginPath: pluginModel.entryPoint.frontend!,
|
|
145
106
|
pluginFolder: pluginModel.packagePath,
|
|
146
107
|
pluginUri: pluginModel.packageUri,
|
|
147
108
|
model: pluginModel,
|
|
148
109
|
lifecycle: pluginLifecycle,
|
|
149
|
-
|
|
150
|
-
throw new Error('not supported');
|
|
151
|
-
},
|
|
110
|
+
rawModel,
|
|
152
111
|
isUnderDevelopment: !!plg.isUnderDevelopment
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
112
|
+
};
|
|
113
|
+
const apiImpl = apiFactory(plugin);
|
|
114
|
+
pluginsApiImpl.set(plugin.model.id, apiImpl);
|
|
115
|
+
pluginsModulesNames.set(plugin.lifecycle.frontendModuleName!, plugin);
|
|
116
|
+
return { target: result, plugin };
|
|
117
|
+
} else {
|
|
118
|
+
return {
|
|
119
|
+
target: foreign,
|
|
120
|
+
plugin: {
|
|
121
|
+
pluginPath: pluginModel.entryPoint.backend,
|
|
122
|
+
pluginFolder: pluginModel.packagePath,
|
|
123
|
+
pluginUri: pluginModel.packageUri,
|
|
124
|
+
model: pluginModel,
|
|
125
|
+
lifecycle: pluginLifecycle,
|
|
126
|
+
get rawModel(): never {
|
|
127
|
+
throw new Error('not supported');
|
|
128
|
+
},
|
|
129
|
+
isUnderDevelopment: !!plg.isUnderDevelopment
|
|
130
|
+
}
|
|
131
|
+
};
|
|
169
132
|
}
|
|
133
|
+
}));
|
|
134
|
+
// Collect the ordered plugins and insert them in the target array:
|
|
135
|
+
for (const { target, plugin } of plugins) {
|
|
136
|
+
target.push(plugin);
|
|
137
|
+
}
|
|
138
|
+
return [result, foreign];
|
|
139
|
+
},
|
|
140
|
+
initExtApi(extApi: ExtPluginApi[]): void {
|
|
141
|
+
for (const api of extApi) {
|
|
142
|
+
try {
|
|
143
|
+
if (api.frontendExtApi) {
|
|
144
|
+
ctx.importScripts(api.frontendExtApi.initPath);
|
|
145
|
+
ctx[api.frontendExtApi.initVariable][api.frontendExtApi.initFunction](rpc, pluginsModulesNames);
|
|
146
|
+
}
|
|
170
147
|
|
|
171
|
-
|
|
172
|
-
|
|
148
|
+
} catch (e) {
|
|
149
|
+
console.error(e);
|
|
150
|
+
}
|
|
173
151
|
}
|
|
174
152
|
}
|
|
175
|
-
}
|
|
176
|
-
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
const envExt = container.get(EnvExtImpl);
|
|
156
|
+
const debugExt = container.get(DebugExtImpl);
|
|
157
|
+
const preferenceRegistryExt = container.get(PreferenceRegistryExtImpl);
|
|
158
|
+
const editorsAndDocuments = container.get(EditorsAndDocumentsExtImpl);
|
|
159
|
+
const workspaceExt = container.get(WorkspaceExtImpl);
|
|
160
|
+
const messageRegistryExt = container.get(MessageRegistryExt);
|
|
161
|
+
const clipboardExt = container.get(ClipboardExt);
|
|
162
|
+
const webviewExt = container.get(WebviewsExtImpl);
|
|
163
|
+
const localizationExt = container.get(LocalizationExtImpl);
|
|
164
|
+
const storageProxy = container.get(KeyValueStorageProxy);
|
|
177
165
|
|
|
178
166
|
const apiFactory = createAPIFactory(
|
|
179
167
|
rpc,
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2024 EclipseSource and others.
|
|
3
|
+
//
|
|
4
|
+
// This program and the accompanying materials are made available under the
|
|
5
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
+
//
|
|
8
|
+
// This Source Code may also be made available under the following Secondary
|
|
9
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
+
// with the GNU Classpath Exception which is available at
|
|
12
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
13
|
+
//
|
|
14
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
|
+
// *****************************************************************************
|
|
16
|
+
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
17
|
+
import 'reflect-metadata';
|
|
18
|
+
import { ContainerModule } from '@theia/core/shared/inversify';
|
|
19
|
+
import { BasicChannel } from '@theia/core/lib/common/message-rpc/channel';
|
|
20
|
+
import { Uint8ArrayReadBuffer, Uint8ArrayWriteBuffer } from '@theia/core/lib/common/message-rpc/uint8-array-message-buffer';
|
|
21
|
+
import { LocalizationExt } from '../../../common/plugin-api-rpc';
|
|
22
|
+
import { RPCProtocol, RPCProtocolImpl } from '../../../common/rpc-protocol';
|
|
23
|
+
import { ClipboardExt } from '../../../plugin/clipboard-ext';
|
|
24
|
+
import { EditorsAndDocumentsExtImpl } from '../../../plugin/editors-and-documents';
|
|
25
|
+
import { MessageRegistryExt } from '../../../plugin/message-registry';
|
|
26
|
+
import { PluginManagerExtImpl } from '../../../plugin/plugin-manager';
|
|
27
|
+
import { KeyValueStorageProxy } from '../../../plugin/plugin-storage';
|
|
28
|
+
import { PreferenceRegistryExtImpl } from '../../../plugin/preference-registry';
|
|
29
|
+
import { SecretsExtImpl } from '../../../plugin/secrets-ext';
|
|
30
|
+
import { TerminalServiceExtImpl } from '../../../plugin/terminal-ext';
|
|
31
|
+
import { WebviewsExtImpl } from '../../../plugin/webviews';
|
|
32
|
+
import { WorkspaceExtImpl } from '../../../plugin/workspace';
|
|
33
|
+
import { createDebugExtStub } from './debug-stub';
|
|
34
|
+
import { EnvExtImpl } from '../../../plugin/env';
|
|
35
|
+
import { WorkerEnvExtImpl } from './worker-env-ext';
|
|
36
|
+
import { DebugExtImpl } from '../../../plugin/debug/debug-ext';
|
|
37
|
+
import { LocalizationExtImpl } from '../../../plugin/localization-ext';
|
|
38
|
+
|
|
39
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
40
|
+
const ctx = self as any;
|
|
41
|
+
|
|
42
|
+
export default new ContainerModule(bind => {
|
|
43
|
+
const channel = new BasicChannel(() => {
|
|
44
|
+
const writeBuffer = new Uint8ArrayWriteBuffer();
|
|
45
|
+
writeBuffer.onCommit(buffer => {
|
|
46
|
+
ctx.postMessage(buffer);
|
|
47
|
+
});
|
|
48
|
+
return writeBuffer;
|
|
49
|
+
});
|
|
50
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
51
|
+
addEventListener('message', (message: any) => {
|
|
52
|
+
channel.onMessageEmitter.fire(() => new Uint8ArrayReadBuffer(message.data));
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
const rpc = new RPCProtocolImpl(channel);
|
|
56
|
+
|
|
57
|
+
bind(RPCProtocol).toConstantValue(rpc);
|
|
58
|
+
|
|
59
|
+
bind(PluginManagerExtImpl).toSelf().inSingletonScope();
|
|
60
|
+
bind(EnvExtImpl).to(WorkerEnvExtImpl).inSingletonScope();
|
|
61
|
+
bind(LocalizationExt).to(LocalizationExtImpl).inSingletonScope();
|
|
62
|
+
bind(KeyValueStorageProxy).toSelf().inSingletonScope();
|
|
63
|
+
bind(SecretsExtImpl).toSelf().inSingletonScope();
|
|
64
|
+
bind(PreferenceRegistryExtImpl).toSelf().inSingletonScope();
|
|
65
|
+
bind(DebugExtImpl).toDynamicValue(({ container }) => createDebugExtStub(container))
|
|
66
|
+
.inSingletonScope();
|
|
67
|
+
bind(EditorsAndDocumentsExtImpl).toSelf().inSingletonScope();
|
|
68
|
+
bind(WorkspaceExtImpl).toSelf().inSingletonScope();
|
|
69
|
+
bind(MessageRegistryExt).toSelf().inSingletonScope();
|
|
70
|
+
bind(ClipboardExt).toSelf().inSingletonScope();
|
|
71
|
+
bind(WebviewsExtImpl).toSelf().inSingletonScope();
|
|
72
|
+
bind(TerminalServiceExtImpl).toSelf().inSingletonScope();
|
|
73
|
+
});
|