import { IUnpackJSAPI } from '@emscripten-forge/untarjs'; import { IBootstrapData, IEmpackEnvMeta, IEmpackEnvMetaMountPoint, IInstalledData, ILock, ILogger, ISolvedPackage, ISolvedPackages, ISolvedPipPackage, ISolvedPipPackages, TSharedLibsMap } from './types'; export * from './types'; export * from './helper'; export * from './parser'; export declare const MAMBAJS_LOCK_VERSION = "1.0.3"; /** * Given a lock file, get the Python version * @param lock representation * @returns The Python version as a list of numbers if it is there */ export declare function getPythonVersion(lock?: Pick): number[] | undefined; /** * Given conda packages, get the Python version * @param packages the packages * @returns The Python version as a list of numbers if it is there */ export declare function getPythonVersionFromPackages(packages: ILock['packages']): number[] | undefined; export interface IBootstrapEmpackPackedEnvironmentOptions { /** * The empack lock file */ empackEnvMeta: IEmpackEnvMeta; /** * The mambajs lock file */ lock?: ILock; /** * The URL (CDN or similar) from which to download packages */ pkgRootUrl: string; /** * The Emscripten Module */ Module: any; /** * The Python version (will be inferred from the lock file if not provided) */ pythonVersion?: number[]; /** * Whether to install conda-meta for packages, default to False */ generateCondaMeta?: boolean; /** * The untarjs API. If not provided, one will be initialized. */ untarjs?: IUnpackJSAPI; /** * The logger to use during the bootstrap. */ logger?: ILogger; } /** * Bootstrap a filesystem from an empack lock file. And return the installed shared libs. * * @param options * @returns The installed shared libraries as a TSharedLibs */ export declare function bootstrapEmpackPackedEnvironment(options: IBootstrapEmpackPackedEnvironmentOptions): Promise; export interface IEmpackLockToMambajsLockOptions { /** * The empack lock file */ empackEnvMeta: IEmpackEnvMeta; /** * The URL (CDN or similar) from which to download packages */ pkgRootUrl: string; } /** * Turn an empack lock into a mambajs-compatible lock. * * @param options * @returns The generated lock */ export declare function empackLockToMambajsLock(options: IEmpackLockToMambajsLockOptions): ILock; export interface IInstallFilesToEnvOptions { /** * The URL (CDN or similar) from which to download packages */ pkgRootUrl?: string; /** * The Emscripten Module */ Module: any; /** * The Python version (will be inferred from the lock file if not provided) */ pythonVersion?: number[]; /** * Whether to install conda-meta for packages, default to False */ generateCondaMeta?: boolean; /** * The untarjs API. If not provided, one will be initialized. */ untarjs?: IUnpackJSAPI; /** * The logger to use during the bootstrap. */ logger?: ILogger; } export interface IInstallPackagesToEnvOptions extends IInstallFilesToEnvOptions { /** * The lock file containing packages to install */ packages: { packages: ISolvedPackages; pipPackages: ISolvedPipPackages; }; /** * The channel from where to install the package */ channels: ILock['channelInfo']; } export interface IInstallMountPointsToEnvOptions extends IInstallFilesToEnvOptions { /** * The mount points to install */ mountPoints: IEmpackEnvMetaMountPoint[]; } /** * Install packages into an emscripten FS. * * @param options * @returns The installed shared libraries as a TSharedLibs */ export declare function installPackagesToEmscriptenFS(options: IInstallPackagesToEnvOptions): Promise; /** * Install mount points to an Emscripten FS * @param options */ export declare function installMountPointToEmscriptenFS(options: IInstallMountPointsToEnvOptions): Promise; export interface IRemovePackagesFromEnvOptions { /** * The packages which should be removed */ removedPackages: { packages: ISolvedPackages; pipPackages: ISolvedPipPackages; }; /** * The Emscripten Module */ Module: any; /** * Paths where previous installed package files have been saved */ paths: { [key: string]: string; }; /** * The logger to use during the bootstrap. */ logger?: ILogger; } /** * Removing previously installed files * * @param options * @returns void */ export declare function removePackagesFromEmscriptenFS(options: IRemovePackagesFromEnvOptions): Promise<{ [key: string]: string; }>; export interface IUpdatePackagesOptions extends IInstallFilesToEnvOptions { /** * The old lock */ oldLock: ILock; /** * The new lock */ newLock: ILock; /** * The Emscripten Module */ Module: any; /** * Paths where previous installed package files have been saved */ paths: { [key: string]: string; }; } /** * Update packages in an Emscripten FS, given the old and new locks * * @param options * @returns void */ export declare function updatePackagesInEmscriptenFS(options: IUpdatePackagesOptions): Promise<{ paths: { [key: string]: string; }; sharedLibs: TSharedLibsMap; }>; export declare function computePipPackagesDiff(options: { oldLock: ILock; newLock: ILock; }): { removedPackages: ISolvedPipPackages; newPackages: ISolvedPipPackages; }; export declare function computeCondaPackagesDiff(options: { oldLock: ILock; newLock: ILock; }): { removedPackages: ISolvedPackages; newPackages: ISolvedPackages; }; export interface IBootstrapPythonOptions { /** * The Python version as a list e.g. [3, 11] */ pythonVersion: number[]; /** * The environment prefix */ prefix: string; /** * The Emscripten Module */ Module: any; /** * Whether to build in verbose mode, default to silent */ verbose?: boolean; } /** * Bootstrap Python runtime * * @param options */ export declare function bootstrapPython(options: IBootstrapPythonOptions): Promise; export interface ILoadSharedLibsOptions { /** * Shared libs to load */ sharedLibs: TSharedLibsMap; /** * The environment prefix */ prefix: string; /** * The Emscripten Module */ Module: any; /** * The logger to use. */ logger?: ILogger; } /** * @deprecated Use loadSharedLibs instead */ export declare const loadShareLibs: typeof loadSharedLibs; export declare function loadSharedLibs(options: ILoadSharedLibsOptions): Promise; export declare function waitRunDependencies(Module: any): Promise; export declare function showPipPackagesList(installedPackages: ISolvedPipPackages, logger: ILogger | undefined): void; export declare function showPackagesList(installedPackages: { packages: ISolvedPackages; pipPackages: ISolvedPipPackages; }, logger: ILogger | undefined): void; export declare function showEnvironmentDiff(installedPackages: { packages: ISolvedPackages; pipPackages: ISolvedPipPackages; }, newPackages: { packages: ISolvedPackages; pipPackages: ISolvedPipPackages; }, logger: ILogger | undefined): void; export declare function sort(installed: { [key: string]: ISolvedPackage | ISolvedPipPackage; }): Map; export declare function packageNameFromSpec(spec: string): string | null;