/** * Static File Service * * Business logic for static file serving, extracted from StaticHandler. * Handles manifest resolution, file candidate determination, and cache strategy. * * Supports optional FileSystemRepository injection for testing and advanced use cases. * * @module server/services/static/static-file-service */ import type { RuntimeAdapter } from "../../../platform/adapters/base.js"; import type { CacheStrategy } from "../../../security/index.js"; import type { FileSystemRepository } from "../../../repositories/types.js"; /** * Result of resolving a static file */ export interface StaticFileResult { /** Absolute path to the file */ path: string; /** File content as bytes */ data: Uint8Array; /** ETag for caching */ etag: string; /** Content type based on extension */ contentType: string; /** Cache strategy to use */ cacheStrategy: CacheStrategy; /** Source directory (manifest, dist, public) */ source: "manifest" | "dist" | "public"; } /** * Options for resolving static files */ export interface StaticFileOptions { /** Project directory root */ projectDir: string; /** Runtime adapter for file system access */ adapter: RuntimeAdapter; /** Whether in preview mode (affects caching) */ isPreviewMode: boolean; /** Whether this is a local filesystem project */ isLocalProject: boolean; /** Configured production build output directory */ buildOutDir?: string; } /** * Manifest index for fast asset lookup */ interface ManifestIndex { assets: Map; mtime: number | null; } /** * Injection interface for testing StaticFileService dependencies */ interface StaticFileServiceDeps { manifestCache?: Map; manifestLoading?: Map>; } /** * Inject dependencies for testing. Pass null to reset to defaults. */ export declare function __injectDepsForTests(deps: StaticFileServiceDeps | null): void; export declare class StaticFileService { private static manifestCache; private static manifestLoading; private readonly fsRepo?; constructor(fsRepo?: FileSystemRepository); private getManifestCache; private getManifestLoading; private resolveBuildOutputRoot; private getFileSystems; resolveFile(requestPath: string, options: StaticFileOptions): Promise; private buildCandidates; private tryResolveCandidate; private determineCacheStrategy; private resolveManifestAsset; private loadManifestIndex; private extractManifestAssets; isAssetRequest(pathname: string): boolean; private shouldProbeIndexPage; private isDeniedDotfile; static clearCache(): void; } export {}; //# sourceMappingURL=static-file.service.d.ts.map