import { type JavaScriptLikeExtension } from '../utils/is-javascript-like-extension.ts'; import type { TypeFilter } from '../utils/resolve-type.ts'; import type { ResolvedFileExportsResult } from '../utils/resolve-file-exports.ts'; import { InMemoryFileSystem } from './InMemoryFileSystem.ts'; import type { Cache } from './Cache.ts'; import type { AsyncFileSystem, WritableFileSystem } from './FileSystem.ts'; import type { DirectoryEntry, ExportHistoryOptions, ExportHistoryGenerator, GitFileMetadata, GitModuleMetadata, GitPathMetadata, GitExportMetadata, GitMetadata } from './types.ts'; type GitHost = 'github' | 'gitlab' | 'bitbucket'; type MetadataForPath = string extends Path ? GitPathMetadata : Path extends `${string}.${JavaScriptLikeExtension}` ? GitModuleMetadata : GitFileMetadata; interface GitVirtualFileSystemOptions { /** Repository in the format "owner/repo". */ repository: string; /** Branch, tag, or commit reference. Defaults to 'main'. */ ref?: string; /** Git host */ host?: GitHost; /** Custom API base URL for self-hosted GitLab instances (https://host[:port]). */ baseUrl?: string; /** Personal access / OAuth token for private repositories or higher rate limits. */ token?: string; /** Request timeout in milliseconds. Defaults to 30 seconds. */ timeoutMs?: number; /** Optional extraction/resource limits overrides. */ limits?: { /** Max total archive bytes processed during extraction (default 100 MiB). */ maxArchiveBytes?: number; /** Max raw bytes read from the tar stream (default 150 MiB). */ maxTarStreamBytes?: number; /** Max number of files stored (default 50,000). */ maxFileCount?: number; /** Max bytes per single file; larger files are skipped (default 8 MiB). */ maxFileBytes?: number; }; include?: string[]; exclude?: string[]; /** Optional cache provider for this filesystem's internal caches. */ cache?: Cache; } export declare class GitVirtualFileSystem extends InMemoryFileSystem implements AsyncFileSystem, WritableFileSystem { #private; constructor(options: GitVirtualFileSystemOptions); usesPersistentCacheByDefault(): boolean; usesDirectoryMtimeSnapshotDependencies(): boolean; validatesPersistedFileDependenciesByDefault(): boolean; clearCache(): void; getCacheIdentity(): { host: GitHost; apiBaseUrl: string; repository: string; ref: string; }; isPersistentCacheDeterministic(): boolean; getGitFileMetadata(path: string): Promise; getGitExportMetadata(path: string, startLine: number, endLine: number): Promise; /** Get metadata for a file or module. */ getMetadata( /** The path to the file or module. */ filePath: Path): Promise>; getFileExports(filePath: string): Promise; resolveFileExportsWithDependencies(filePath: string, filter?: TypeFilter): Promise; /** Get metadata for a file. */ getFileMetadata(filePath: string): Promise; /** Get metadata for a JavaScript module file (exports at current ref only). */ getModuleMetadata(filePath: string): Promise; readDirectory(path?: string): Promise; readDirectorySync(): DirectoryEntry[]; readFile(path: string): Promise; readFileBinary(path: string): Promise; readFileSync(): string; /** Get the export history of a repository based on a set of entry files. */ getExportHistory(options?: ExportHistoryOptions): ExportHistoryGenerator; isFilePathGitIgnored(): boolean; isFilePathExcludedFromTsConfig(): boolean; } export {};