import { CBFileSystem } from '../node/file-system'; import { AllowedModule, Manifest } from '../types/common'; /** * DependencyManager handles isolated npm installations for user projects * Public implementation for managing dependencies in development environment */ export declare class DependencyManager { private installed; private fileSystem; constructor(fileSystem: CBFileSystem); /** * Ensures dependencies are installed for a user project * @param {string} projectPath - Path to the user project directory * @param {Manifest} manifest - The project manifest containing dependencies * @returns {Promise} */ ensureDependencies(projectPath: string, manifest: Manifest): Promise; /** * Creates a safe require function that uses isolated node_modules * @param {string} projectPath - Path to the user project * @param {AllowedModule[]} allowedModules - List of allowed modules * @returns {Function} Safe require function */ createIsolatedRequire(projectPath: string, allowedModules: AllowedModule[]): (moduleName: string) => any; /** * Creates or updates package.json for the project * @param {string} packageJsonPath - Path to package.json * @param {Record} dependencies - Dependencies from manifest */ protected createPackageJson(packageJsonPath: string, dependencies: Record): Promise; /** * Installs dependencies using npm * @param {string} handlerPath - Path to the handler directory */ protected installDependencies(handlerPath: string): Promise; /** * Tries to load a CommonJS alternative for an ES module. This is a fallback for when the common JS is not the default export. * @param moduleName - Name of the module to require * @param resolvedModulePath - Path to the resolved module * @returns */ protected tryLoadCommonJSAlternative(moduleName: string, resolvedModulePath: string): any; /** * Gets the relative path require. * @param moduleName - Name of the module to require * @param handlerPath - Path to the handler directory * @returns */ protected getRelativePathRequire(moduleName: string, handlerPath: string): any; /** * Gets the generic dependency require. Unless there are special cases like ES modules, this should work for all dependencies. * @param moduleName - Name of the module to require * @param allowedModules - List of allowed modules * @param nodeModulesPath - Path to the node_modules directory * @returns */ protected getGenericDependencyRequire(moduleName: string, allowedModules: AllowedModule[], nodeModulesPath: string): any; /** * Validates and gets the resolved path to the module. * @param allowedModules - List of allowed modules * @param nodeModulesPath - Path to the node_modules directory * @param moduleName - Name of the module to validate * @returns Path to the module */ protected validateAndGetModulePath(allowedModules: AllowedModule[], nodeModulesPath: string, moduleName: string): string; }