@koishijs/plugin-market
Version:
Manage your bots and plugins with console
73 lines (72 loc) • 2.18 kB
TypeScript
import { Context, Dict, HTTP, Schema, Service } from 'koishi';
import { DependencyMetaKey, PackageJson, RemotePackage } from '@koishijs/registry';
export interface Dependency {
/**
* requested semver range
* @example `^1.2.3` -> `1.2.3`
*/
request: string;
/**
* installed package version
* @example `1.2.5`
*/
resolved?: string;
/** whether it is a workspace package */
workspace?: boolean;
/** valid (unsupported) syntax */
invalid?: boolean;
/** latest version */
latest?: string;
}
export interface YarnLog {
type: 'warning' | 'info' | 'error' | string;
name: number | null;
displayName: string;
indent?: string;
data: string;
}
export interface LocalPackage extends PackageJson {
private?: boolean;
$workspace?: boolean;
}
export declare function loadManifest(name: string): LocalPackage;
declare class Installer extends Service {
ctx: Context;
config: Installer.Config;
http: HTTP;
endpoint: string;
fullCache: Dict<Dict<Pick<RemotePackage, DependencyMetaKey>>>;
tempCache: Dict<Dict<Pick<RemotePackage, DependencyMetaKey>>>;
private pkgTasks;
private agent;
private manifest;
private depTask;
private flushData;
constructor(ctx: Context, config: Installer.Config);
get cwd(): string;
start(): Promise<void>;
resolveName(name: string): string[];
findVersion(names: string[]): Promise<{
[x: string]: string;
}>;
private _getPackage;
setPackage(name: string, versions: RemotePackage[]): void;
getPackage(name: string): Promise<Dict<Pick<RemotePackage, DependencyMetaKey>>>;
private _getDeps;
getDeps(): Promise<Dict<Dependency>>;
refreshData(): void;
refresh(refresh?: boolean): void;
exec(args: string[]): Promise<number>;
override(deps: Dict<string>): Promise<void>;
private _install;
private _getLocalDeps;
install(deps: Dict<string>, forced?: boolean): Promise<number>;
}
declare namespace Installer {
interface Config {
endpoint?: string;
timeout?: number;
}
const Config: Schema<Config>;
}
export default Installer;