/** * NpmInstaller — wraps `bun add` to install peer dependencies for connectors. * * Accepts an injectable `spawn` function so tests can verify calls without * running a real subprocess. */ /** * Result returned by the injectable `SpawnFn`. * @docLink packages/connectors/api-reference#spawn-result */ export interface SpawnResult { /** Process exit code. Zero means success. */ exitCode: number; /** Combined stdout + stderr output from the subprocess. */ output: string; } /** * Injectable subprocess spawn function used by `installNpmPackages` and test doubles. * @docLink packages/connectors/api-reference#spawn-fn */ export type SpawnFn = (cmd: string[], opts: { cwd: string; }) => Promise; /** * Options for `installNpmPackages`. Pass a custom `spawn` to test without running real subprocesses. * @docLink packages/connectors/api-reference#install-options */ export interface InstallOptions { /** Injectable spawn function. Defaults to the runtime-portable spawn wrapper. */ spawn?: SpawnFn; } /** * Result returned by `installNpmPackages`. * @docLink packages/connectors/api-reference#install-result */ export interface InstallResult { /** `true` when the subprocess exited with code 0. */ success: boolean; /** Combined stdout + stderr from the `bun add` invocation. */ output: string; } /** Default spawn implementation using the runtime-portable subprocess helper. */ export declare function defaultSpawn(cmd: string[], opts: { cwd: string; }): Promise; /** * Install npm packages as optional peer deps using `bun add --optional`. * * @param packages Package names to install (e.g. ["pg", "@types/pg"]). * @param projectDir Absolute path to the project root (where bun.lock lives). * @param opts Injectable options for testing. */ export declare function installNpmPackages(packages: string[], projectDir: string, opts?: InstallOptions): Promise; /** * Check whether an npm package can be resolved from `projectDir`'s module * graph. Returns true when `require.resolve` finds the package, false on any * resolution failure (missing, broken, etc.). Does not load the module — only * verifies it can be located. * * Use this to decide whether `installNpmPackages` needs to run before a * connector adapter or mount driver tries to `import` its peer dep. */ export declare function isPackageResolvable(pkg: string, projectDir: string): boolean; /** * Filter a list of npm packages down to those that cannot be resolved from * `projectDir`. Convenience for "install only what's missing" call sites. */ export declare function findMissingPackages(packages: string[], projectDir: string): string[]; //# sourceMappingURL=npm-installer.d.ts.map