diff options
Diffstat (limited to 'packages/exec-backend/src/extension.ts')
| -rw-r--r-- | packages/exec-backend/src/extension.ts | 66 |
1 files changed, 33 insertions, 33 deletions
diff --git a/packages/exec-backend/src/extension.ts b/packages/exec-backend/src/extension.ts index 9d6840a..5697842 100644 --- a/packages/exec-backend/src/extension.ts +++ b/packages/exec-backend/src/extension.ts @@ -2,19 +2,19 @@ import type { Extension, HostAPI, Manifest } from "@dispatch/kernel"; import type { ExecBackend } from "./backend.js"; import { localExecBackend } from "./local.js"; import { - type ExecBackendResolver, - execBackendHandle, - remoteExecBackendFactoryHandle, + type ExecBackendResolver, + execBackendHandle, + remoteExecBackendFactoryHandle, } from "./service.js"; export const manifest: Manifest = { - id: "exec-backend", - name: "Exec Backend", - version: "0.0.0", - apiVersion: "^0.1.0", - trust: "bundled", - activation: "eager", - contributes: { services: ["exec-backend/resolver"] }, + id: "exec-backend", + name: "Exec Backend", + version: "0.0.0", + apiVersion: "^0.1.0", + trust: "bundled", + activation: "eager", + contributes: { services: ["exec-backend/resolver"] }, }; /** @@ -36,22 +36,22 @@ export const manifest: Manifest = { * inside the first backend method call, not at resolve time. */ function createResolver(host: HostAPI): ExecBackendResolver { - return (computerId?: string): ExecBackend => { - if (computerId === undefined) return localExecBackend; - // computerId set → remote. Look up the factory the `ssh` extension provides. - // `host.getService` throws when nothing provided the handle (ssh not loaded); - // convert that into a clear "not configured" error rather than a crash. - let factory: (computerId: string) => ExecBackend; - try { - factory = host.getService(remoteExecBackendFactoryHandle); - } catch { - throw new Error( - `SSH remote execution is not configured: the ssh extension is not loaded ` + - `(requested computerId="${computerId}"). Load the ssh package to enable remote execution.`, - ); - } - return factory(computerId); - }; + return (computerId?: string): ExecBackend => { + if (computerId === undefined) return localExecBackend; + // computerId set → remote. Look up the factory the `ssh` extension provides. + // `host.getService` throws when nothing provided the handle (ssh not loaded); + // convert that into a clear "not configured" error rather than a crash. + let factory: (computerId: string) => ExecBackend; + try { + factory = host.getService(remoteExecBackendFactoryHandle); + } catch { + throw new Error( + `SSH remote execution is not configured: the ssh extension is not loaded ` + + `(requested computerId="${computerId}"). Load the ssh package to enable remote execution.`, + ); + } + return factory(computerId); + }; } /** @@ -63,11 +63,11 @@ function createResolver(host: HostAPI): ExecBackendResolver { * until `ssh` is loaded, a remote request fails with a clear error. */ export function createExecBackendExtension(): Extension { - return { - manifest, - activate(host) { - const resolver: ExecBackendResolver = createResolver(host); - host.provideService(execBackendHandle, resolver); - }, - }; + return { + manifest, + activate(host) { + const resolver: ExecBackendResolver = createResolver(host); + host.provideService(execBackendHandle, resolver); + }, + }; } |
