From 26b9d52101d75aa0349d9d7ce9fb481cd682c8ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=A4der?= Date: Wed, 25 Aug 2021 08:43:00 +0000 Subject: [PATCH] Move sidecar fs init out of che API init MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Thomas Mäder --- .../src/plugin/che-api.ts | 4 ---- .../webpack.config.js | 15 ++++----------- .../src/node/plugin-remote-init.ts | 12 ++++++++++++ 3 files changed, 16 insertions(+), 15 deletions(-) diff --git a/extensions/eclipse-che-theia-plugin-ext/src/plugin/che-api.ts b/extensions/eclipse-che-theia-plugin-ext/src/plugin/che-api.ts index 1eb2598e4..ca84345e0 100644 --- a/extensions/eclipse-che-theia-plugin-ext/src/plugin/che-api.ts +++ b/extensions/eclipse-che-theia-plugin-ext/src/plugin/che-api.ts @@ -21,8 +21,6 @@ import { CheK8SImpl } from './che-k8s'; import { CheOauthImpl } from './che-oauth'; import { CheOpenshiftImpl } from './che-openshift'; import { CheProductImpl } from './che-product'; -import { CheSideCarContentReaderImpl } from './che-sidecar-content-reader'; -import { CheSideCarFileSystemImpl } from './che-sidecar-file-system'; import { CheSshImpl } from './che-ssh'; import { CheTelemetryImpl } from './che-telemetry'; import { CheUserImpl } from './che-user'; @@ -53,8 +51,6 @@ export function createAPIFactory(rpc: RPCProtocol): CheApiFactory { const cheK8SImpl = rpc.set(PLUGIN_RPC_CONTEXT.CHE_K8S, new CheK8SImpl(rpc)); const cheUserImpl = rpc.set(PLUGIN_RPC_CONTEXT.CHE_USER, new CheUserImpl(rpc)); const cheHttpImpl = rpc.set(PLUGIN_RPC_CONTEXT.CHE_HTTP, new CheHttpImpl(rpc)); - rpc.set(PLUGIN_RPC_CONTEXT.CHE_SIDERCAR_CONTENT_READER, new CheSideCarContentReaderImpl(rpc)); - rpc.set(PLUGIN_RPC_CONTEXT.CHE_SIDECAR_FILE_SYSTEM, new CheSideCarFileSystemImpl(rpc)); const cheProductImpl = rpc.set(PLUGIN_RPC_CONTEXT.CHE_PRODUCT, new CheProductImpl(rpc)); const cheTelemetryImpl = rpc.set(PLUGIN_RPC_CONTEXT.CHE_TELEMETRY, new CheTelemetryImpl(rpc)); diff --git a/extensions/eclipse-che-theia-plugin-ext/webpack.config.js b/extensions/eclipse-che-theia-plugin-ext/webpack.config.js index 2aeceedb1..a08e80af7 100644 --- a/extensions/eclipse-che-theia-plugin-ext/webpack.config.js +++ b/extensions/eclipse-che-theia-plugin-ext/webpack.config.js @@ -37,24 +37,17 @@ module.exports = { ], resolve: { fallback: { - 'child_process': false, - 'crypto': false, 'net': false, - 'fs': false, + 'crypto': false, 'os': false, - 'path': false, - 'constants': false, - 'stream': false, - 'assert': false, - 'util': false - + 'path': false }, extensions: ['.ts', '.js'] }, output: { filename: 'che-api-worker-provider.js', - libraryTarget: "var", - library: "che_api_provider", + libraryTarget: 'var', + library: 'che_api_provider', path: path.resolve(__dirname, 'lib/webworker') } }; diff --git a/extensions/eclipse-che-theia-plugin-remote/src/node/plugin-remote-init.ts b/extensions/eclipse-che-theia-plugin-remote/src/node/plugin-remote-init.ts index af49faaab..f4fb9ff6c 100644 --- a/extensions/eclipse-che-theia-plugin-remote/src/node/plugin-remote-init.ts +++ b/extensions/eclipse-che-theia-plugin-remote/src/node/plugin-remote-init.ts @@ -31,7 +31,10 @@ import { LogCallback, RemoteHostTraceLogger } from './remote-trace-logger'; import { MAIN_RPC_CONTEXT, PluginDependencies, PluginDeployer, PluginDeployerEntry } from '@theia/plugin-ext'; import { OutputChannelRegistryExt, PluginDeployerHandler } from '@theia/plugin-ext/lib/common'; +import { PLUGIN_RPC_CONTEXT as CHE_PLUGIN_RPC_CONTEXT } from '@eclipse-che/theia-plugin-ext/lib/common/che-protocol'; import { CheEnvVariablesServerImpl } from '@eclipse-che/theia-plugin-ext/lib/node/che-env-variables-server'; +import { CheSideCarContentReaderImpl } from '@eclipse-che/theia-plugin-ext/lib/plugin/che-sidecar-content-reader'; +import { CheSideCarFileSystemImpl } from '@eclipse-che/theia-plugin-ext/lib/plugin/che-sidecar-file-system'; import { Deferred } from '@theia/core/lib/common/promise-util'; import { DocumentContainerAware } from './document-container-aware'; import { Emitter } from '@theia/core/lib/common/event'; @@ -263,6 +266,15 @@ to pick-up automatically a free port`) const pluginRemoteNodeImplt = new PluginRemoteNodeImpl(pluginRemoteBrowser); webSocketClient.rpc.set(MAIN_REMOTE_RPC_CONTEXT.PLUGIN_REMOTE_NODE, pluginRemoteNodeImplt); + webSocketClient.rpc.set( + CHE_PLUGIN_RPC_CONTEXT.CHE_SIDERCAR_CONTENT_READER, + new CheSideCarContentReaderImpl(webSocketClient.rpc) + ); + webSocketClient.rpc.set( + CHE_PLUGIN_RPC_CONTEXT.CHE_SIDECAR_FILE_SYSTEM, + new CheSideCarFileSystemImpl(webSocketClient.rpc) + ); + const pluginHostRPC = new PluginHostRPC(webSocketClient.rpc); pluginHostRPC.initialize(); // eslint-disable-next-line @typescript-eslint/no-explicit-any