import type { BundleAction, ChecksumOutput, EncodingAction, FileInfo, LogStatus } from './squared'; import type { IFileManager, IImage, IModule, ImageConstructor, ModuleConstructor } from './index'; import type { ExternalAsset } from './asset'; import type { HostInitLog as IHostInitLog } from './core'; import type { ReadHashOptions } from './module'; import type { RequestData as IRequestData } from './node'; import type { RequestInit } from './request'; import type { FETCH_TYPE } from '../index.d'; export const enum FINALIZE_STATE { READY, COMMIT, END, RESTART, QUEUED, RESTARTED, ABORTED } export const enum INCREMENTAL { NONE = 'none', STAGING = 'staging', ETAG = 'etag', EXISTS = 'exists' } export interface RequestData extends IRequestData, RequestInit { timeout?: ObjectMap; } export interface InstallData { instance: T; constructor: U; params: unknown[]; } export interface IHttpDiskCache, U extends ExternalAsset = ExternalAsset> { limit: number; expires: number; readonly host: T; has(uri: string | URL): boolean; add(uri: string | URL, etag: string, target: Bufferable, options?: V): void; within(value: U | number): boolean; clear(value?: unknown): void; set enabled(value); get enabled(): boolean; set exclude(value); get exclude(): string[]; set include(value); get include(): string[]; } export interface IHttpMemoryCache, U extends ExternalAsset = ExternalAsset> extends IHttpDiskCache { toDisk: [number, number]; purge(percent?: number, limit?: number): void; withinDisk(value: U | number): boolean; clear(uri?: string | URL): void; } export interface HttpDiskCacheAddOptions { buffer?: Bufferable | null; maxAge?: number; contentLength?: number; } export interface HttpMemoryCacheAddOptions extends Omit, EncodingAction { toDisk?: string; } export interface ReplaceOptions { mimeType?: string; rewritePath?: boolean; ignoreExt?: boolean; } export interface AssetContentOptions extends BundleAction { localUri: string; } export interface FileOutput { pathname: string; localUri: string; } export interface FinalizeResult { files: FileInfo[]; errors: string[]; status?: LogStatus[]; aborted?: boolean; } export interface DeleteFileAddendum { id?: number; all?: boolean; } export interface HostInitLog extends IHostInitLog { useNumeric: boolean; showSize?: boolean; showDiff?: string[]; } export interface FindAssetOptions { instance?: IModule; assets?: T[]; replaced?: boolean; } export interface ChecksumOptions extends ReadHashOptions, Pick { dot?: boolean; matchBase?: boolean; sortBy?: number; verbose?: boolean; ignore?: string[]; ignoreRoot?: string[]; joinRoot?: boolean; outPath?: string; throwsEmpty?: boolean; } export interface CheckHashOptions { data?: Bufferable | null; uri?: string | URL; output?: boolean; } export type ImageMimeMap = Map>; export type FetchType = FETCH_TYPE[keyof FETCH_TYPE]; export type PostFinalizeCallback = (files: FileInfo[] | string[], errors: string[], status?: LogStatus[]) => void;