import type { BuildResult } from '../../build/build-adapter.js'; /** * Content hashes for every trackable source file in one route module's import graph. * * @remarks * Keys are normalized absolute filesystem paths. Values are opaque content hashes * produced by the active {@link FileSystem} implementation. Only app-owned source * files are tracked; `node:` builtins and `node_modules` paths are excluded * because they are covered by the core package {@link getCorePackageVersion | invalidation version}. */ export type RouteModuleDependencyHashes = Record; type HashFileFn = (filePath: string) => string; type ExistsFn = (filePath: string) => boolean; /** * Lazily hashes route-module dependency files while memoizing results for one build run. * * @remarks * Multiple route modules often share layouts or utilities. Memoizing per path avoids * re-reading the same dependency file while validating or recording many cache entries * during one production build. */ export declare class RouteModuleDependencyHasher { private readonly memo; private readonly hashFile; private readonly exists; constructor(dependencies?: { hashFile?: HashFileFn; exists?: ExistsFn; }); /** * Returns a memoized content hash for one trackable dependency path. * * @param filePath - Absolute or project-relative source path. * @returns The content hash, or `undefined` when the path is not trackable or missing. */ hashDependency(filePath: string): string | undefined; /** * Builds the dependency-hash map for one route entrypoint graph. * * @param modulePaths - Raw module ids from the bundler dependency graph. * @returns Hashes for every trackable, existing source file in the graph. */ createDependencyHashes(modulePaths: readonly string[]): RouteModuleDependencyHashes; /** * Returns whether every stored dependency hash still matches the current file contents. * * @param storedHashes - Dependency hashes previously persisted for one route module. * @param entrypointPath - Route entry file whose hash is validated separately. * @param entrypointSourceHash - Already-validated content hash for {@link entrypointPath}. * @returns `true` when all stored hashes are present and still valid. */ matchesStoredHashes(storedHashes: RouteModuleDependencyHashes | undefined, entrypointPath?: string, entrypointSourceHash?: string): boolean; /** Clears the per-build memo so subsequent reads reflect current file contents. */ clearMemo(): void; } /** * Returns whether a bundler module id should participate in route-module cache invalidation. * * @remarks * Builtins and installed packages are excluded. Their changes are expected to be * reflected through framework-level invalidation instead of per-route file hashing. */ export declare function isTrackableRouteModuleDependency(modulePath: string): boolean; /** * Filters a bundler module list down to trackable app-owned source files. */ export declare function filterTrackableRouteModuleDependencies(modulePaths: readonly string[]): string[]; /** * Resolves the dependency module list for one route entrypoint from a build result. * * @param buildResult - Completed route-module build output. * @param entrypointPath - Absolute or root-relative route source path used as the build entry. * @param rootDir - Project root used to normalize relative module ids. * @returns Normalized module paths, falling back to the entrypoint when no graph is available. */ export declare function resolveRouteModuleDependencyPaths(buildResult: Pick, entrypointPath: string, rootDir: string): string[]; /** * Convenience helper that combines graph extraction and dependency hashing. */ export declare function createRouteModuleDependencyHashes(hasher: RouteModuleDependencyHasher, buildResult: Pick, entrypointPath: string, rootDir: string): RouteModuleDependencyHashes; export {};