import type { BundleAction, ChecksumOutput, FileInfo, LogStatus } from './squared'; import type { IFileManager, IModule, 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 = 0, COMMIT = 1, END = 2, RESTART = 3, QUEUED = 4, RESTARTED = 5, ABORTED = 6 } 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 { limit: number; expires: number; readonly host: IFileManager; has(uri: string | URL): boolean; add(uri: string | URL, etag: string, target: string | Buffer, options?: U): void; within(value: T | 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 extends IHttpDiskCache { toDisk: TupleOf; purge(percent?: number, limit?: number): void; withinDisk(value: T | number): boolean; clear(uri?: string | URL): void; } export interface HttpDiskCacheAddOptions { buffer?: Null; contentLength?: number; } export interface HttpMemoryCacheAddOptions extends Omit { toDisk?: string; encoding?: BufferEncoding; } 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; } export interface FindAssetOptions { instance?: IModule; assets?: T[]; replaced?: boolean; } export interface ChecksumOptions extends ReadHashOptions, Pick { dot?: boolean; sortBy?: number; verbose?: boolean; ignore?: string[]; joinRoot?: boolean; outPath?: string; throwsEmpty?: boolean; } export type FetchType = FETCH_TYPE[keyof FETCH_TYPE]; export type PostFinalizeCallback = (files: FileInfo[] | string[], errors: string[], status?: LogStatus[]) => void;