import { LoaderContext } from "./utils/loader-context"; import { ChunkTimestamp } from './utils/chunk'; import { ResolutionDetailMap } from "./resolution-detail-map"; interface Options { } export declare class ResourceNotFoundError extends Error { constructor(id: string); } export declare class QuickPackLoader { constructor(context: LoaderContext, options?: Options); get importMapURL(): string; get resolutionDetailMapURL(): string; lock(maxRetryTime?: number): Promise<() => Promise>; unlock(): Promise; loadAny(url: string): Promise<{ type: 'json'; json: unknown; } | { type: 'chunk'; chunk: ChunkInfo; }>; /** * Loads the import map. * @returns The import map object. */ loadImportMap(): Promise; /** * Loads the resolution detail map. * @returns The resolution detail map object. */ loadResolutionDetailMap(): Promise; /** * Load specific chunk. * @param url The URL of the chunk, if relative, would be resolved from `this.baseURL`. * @returns The chunk info. */ loadChunk(url: string): Promise; /** * Gets the opacity, unique ID of the chunk, to query timestamp or load the chunk. * @param url URL of the chunk. * @returns The chunk ID. */ getChunkId(url: string): string; /** * Load specific chunk. * @param id The chunk ID. * @returns The chunk ID. */ loadChunkFromId(id: ChunkId): Promise<{ readonly type: "file"; readonly path: string; }>; /** * 获取指定资源的 mtime 时间戳。若不存在则返回负值。 */ queryTimestamp(resource: ChunkId): ChunkTimestamp; /** * 获取指定所有资源的 mtime 时间戳。不存在的资源将返回负值。 */ queryTimestamps(resources: ChunkId[]): ChunkTimestamp[]; reload(): Promise; private _middleware; private _chunkReader; private _timestampsCache; } export { LoaderContext as QuickPackLoaderContext }; export type ChunkId = string; export type { ChunkTimestamp }; export interface ChunkInfo { type: 'file'; path: string; } export interface ImportMap { imports?: Record; scopes?: Record>; }