//#region src/file-system.d.ts
interface FileSystem {
  /**
   * Reads a file from the file system.
   * @param path The path to the file.
   * @returns The contents of the file, or `null` if the file does not exist.
   */
  read(path: string): string | null;
  /**
   * Writes a file to the file system.
   * @param path The path to the file.
   * @param content The contents of the file.
   */
  write(path: string, content: string): void;
  /**
   * Deletes a file from the file system.
   * @param path The path to the file.
   */
  delete(path: string): void;
  /**
   * Returns the logical paths of all files in the filesystem, optionally
   * filtered to those whose path starts with `prefix`.
   * @param prefix Optional path prefix to filter results.
   */
  list(prefix?: string): string[];
  /**
   * Depending on the implementation of the filesystem writes may be buffered
   * in-memory to avoid (comparatively) expensive I/O operations. This method
   * gives users of the filesystem a way to ensure that all writes are flushed
   * to disk.
   */
  flush(): Promise<void>;
}
/**
 * A simple in-memory filesystem backed by a `Map`. Intended for use in tests
 * and build pipelines where persistence is not required.
 */
declare class InMemoryFileSystem implements FileSystem {
  private files;
  /**
   * @param files Optional initial file contents. Accepts either a plain object
   * (keys are paths, values are file contents) or a `Map`. Defaults to an
   * empty filesystem.
   */
  constructor(files?: Record<string, string> | Map<string, string>);
  read(path: string): string | null;
  write(path: string, content: string): void;
  delete(path: string): void;
  list(prefix?: string): string[];
  flush(): Promise<void>;
}
/**
 * A filesystem backed directly by Durable Object KV storage. Every write is
 * committed to KV synchronously with no in-memory buffering, and `flush()` is
 * a no-op.
 *
 * Use this when you want immediate, per-write durability and the overhead of
 * individual KV writes is acceptable — for example, when seeding a small number
 * of files. For bulk write workloads, prefer `DurableObjectKVFileSystem`, which
 * batches all writes into a single flush.
 */
declare class DurableObjectRawFileSystem implements FileSystem {
  private readonly storage;
  private readonly prefix;
  /**
   * @param storage The Durable Object storage instance to persist files to.
   * @param prefix  An optional path prefix prepended to every key stored in KV.
   *                Defaults to `"bundle/"`, which namespaces bundle files away
   *                from any other keys the Durable Object may store.
   */
  constructor(storage: DurableObjectStorage, prefix?: string);
  read(path: string): string | null;
  write(path: string, content: string): void;
  delete(path: string): void;
  list(prefix?: string): string[];
  flush(): Promise<void>;
  private formatPath;
}
/**
 * A filesystem backed by Durable Object KV storage with a write-overlay.
 * Writes are buffered in memory and only persisted to KV when `flush()` is
 * called, avoiding the cost of a KV write on every individual file operation.
 * Reads are served from the overlay when possible, falling back to KV, so
 * callers always observe their own writes immediately.
 *
 * Implemented as an `OverlayFileSystem` wrapping a `DurableObjectRawFileSystem`.
 * Use `DurableObjectRawFileSystem` directly if you want immediate per-write KV
 * durability without buffering.
 */
declare class DurableObjectKVFileSystem implements FileSystem {
  private readonly fs;
  /**
   * @param storage The Durable Object storage instance to persist files to.
   * @param prefix  An optional path prefix prepended to every key stored in KV.
   *                Defaults to `"bundle/"`, which namespaces bundle files away
   *                from any other keys the Durable Object may store.
   */
  constructor(storage: DurableObjectStorage, prefix?: string);
  read(path: string): string | null;
  write(path: string, content: string): void;
  delete(path: string): void;
  list(prefix?: string): string[];
  flush(): Promise<void>;
}
/**
 * Creates an `InMemoryFileSystem` from an async source of file entries.
 *
 * This is the bridge between async storage backends (e.g. a Durable Object
 * `Workspace` backed by SQLite/R2) and the synchronous `FileSystem` interface
 * required by the bundler and TypeScript language service.
 *
 * @example
 * ```ts
 * // Snapshot a Workspace into a bundler-compatible FileSystem
 * async function* workspaceFiles(workspace) {
 *   for (const entry of workspace.glob("**\/*.{ts,tsx,json}")) {
 *     const content = await workspace.readFile(entry.path);
 *     if (content !== null) yield [entry.path, content];
 *   }
 * }
 *
 * const fs = await createFileSystemSnapshot(workspaceFiles(workspace));
 * const { languageService } = await createTypescriptLanguageService({ fileSystem: fs });
 * ```
 */
declare function createFileSystemSnapshot(
  entries:
    | AsyncIterable<readonly [string, string]>
    | Iterable<readonly [string, string]>
): Promise<InMemoryFileSystem>;
//#endregion
export {
  createFileSystemSnapshot as a,
  InMemoryFileSystem as i,
  DurableObjectRawFileSystem as n,
  FileSystem as r,
  DurableObjectKVFileSystem as t
};
//# sourceMappingURL=file-system-PsI0bi2L.d.ts.map
