import BaseMarketplacePluginManager from "./BaseMarketplacePluginManager.ts"; import type NpmjsPluginRepository from "./plugin_repository/NpmjsPluginRepository.ts"; import type NpmPluginRepository from "./plugin_repository/NpmPluginRepository.ts"; import type PluginManager from "../api/plugin_manager/PluginManager.ts"; import type VersionedPluginDescriptor from "../api/plugin_repository/VersionedPluginDescriptor.ts"; import type SpawnCapable from "../api/spawn/SpawnCapable.ts"; import type SpawnInterface from "../api/spawn/SpawnInterface.ts"; /** * On Windows, batch-file shims (e.g. `npm.cmd`, `bun.cmd`) cannot be launched directly via * `CreateProcess` - they must be run through `cmd.exe /c`. Resolve the command through the shell * in that case; leave it untouched on other platforms. */ export declare function resolveForPlatform(args: string[]): string[]; /** * Default timeout applied to an install/uninstall command spawn. * * Resolving and downloading a dependency tree can legitimately take a while on a slow * connection, so this is generous compared to the registry pre-check timeout used by * `checkAvailable()` (10s, see `defaultFetch.ts`'s `DEFAULT_FETCH_TIMEOUT_MS`) - but it must * still be bounded so a stalled network connection during the package manager's own registry * access fails with a clear error instead of hanging the calling process indefinitely. */ export declare const DEFAULT_INSTALL_TIMEOUT_MS = 120000; /** * {@link BaseMarketplacePluginManager} for the npm ecosystem. * * Combines one or more {@link NpmjsPluginRepository} remotes with a local * {@link NpmPluginRepository} (backed by `node_modules`). Plugins are installed and * removed by shelling out to bun/npm, or via an injected {@link SpawnInterface} if * {@link setSpawn} has been called. */ export default class NpmPluginManager extends BaseMarketplacePluginManager implements SpawnCapable { private readonly installCommand; private readonly installTimeoutMs; private spawn; /** * @param remotes marketplace repositories used for search and as install sources. * @param local repository used to load installed plugins, backed by `node_modules`. * @param options.installCommand optional install command (e.g. `"npm install"`). If not * specified, `"bun add"` is used if `bun` is on `PATH`, falling back to `"npm install"` if * `npm` is on `PATH` instead. Throws if neither is found and no explicit command is given. * @param options.pluginManager optional {@link PluginManager} to delegate to; see * {@link BaseMarketplacePluginManager}. * @param options.installTimeoutMs optional timeout applied to each install/uninstall command * spawn; defaults to {@link DEFAULT_INSTALL_TIMEOUT_MS}. */ constructor(remotes: NpmjsPluginRepository[], local: NpmPluginRepository, { installCommand, pluginManager, installTimeoutMs, }?: { installCommand?: string; pluginManager?: PluginManager; installTimeoutMs?: number; }); private static resolveDefaultInstallCommand; setSpawn(spawn: SpawnInterface): void; /** * Ensures `cwd` has its own `package.json` before an install/uninstall command is run there. * * Without one, `bun add`/`bun remove` (and npm, under workspace configs) walk UP the * directory tree looking for an ancestor `package.json` and, if found, treat that * ancestor as the install root - silently installing into the ancestor's `node_modules` * instead of `cwd`, while still exiting 0. Seeding an empty `package.json` in `cwd` first * makes `cwd` itself the install root, regardless of what exists further up the tree. */ private ensurePackageJson; private runCommand; install(descriptor: Readonly, options?: { includeDependencies?: boolean; }): Promise; private installOne; private validatePluginBundled; uninstall(pluginId: string): Promise; } //# sourceMappingURL=NpmPluginManager.d.ts.map