import { type FileSystem } from "../platform/compat/fs.js"; declare function getReactNodeModulesDir(reactEntry: string): string | undefined; declare function describeCacheRoot(cacheBase: string): string; declare function redactCachePathDetails(reason: string, cacheBase: string): string; /** Reset memoized link state (test seam). */ declare function resetNodeModulesLinkState(): void; /** Internal test seam for platform-specific resolved module paths. */ export declare const __cacheDirInternals: { createIgnoreMarker: typeof createIgnoreMarker; describeCacheRoot: typeof describeCacheRoot; getReactNodeModulesDir: typeof getReactNodeModulesDir; redactCachePathDetails: typeof redactCachePathDetails; resetNodeModulesLinkState: typeof resetNodeModulesLinkState; }; export declare function runWithCacheDir(cacheDir: string, fn: () => T): T; export declare function getCacheDirFromContext(): string | undefined; /** * The framework cache root for a project directory. * * Outside production every generated bundle, compiled module, and cache entry * lives here, so `veryfront dev` and `veryfront clean --cache` must agree on * one location for a given project. */ export declare function getProjectCacheDir(projectDir: string): string; export declare function getCacheBaseDir(): string; export declare function getMdxEsmCacheDir(): string; export declare function getHttpBundleCacheDir(): string; /** * Write the ignore marker without clobbering a file that already exists. * * Adapters that expose an exclusive create use it, so a `.gitignore` another * process writes between the caller's `exists()` check and this write survives. * Adapters without that capability fall back to a plain write. */ declare function createIgnoreMarker(fs: FileSystem, ignorePath: string): Promise; /** * Mark the cache base directory as ignored by version control. * * Outside production the cache root is `/.cache`, so every dev server * run drops generated `.mjs` bundles into the user's project. `veryfront init` * scaffolds a `.gitignore` with a `.cache/` entry, but a project that adopted * Veryfront into an existing tree keeps its own `.gitignore` and never gets * one, so the bundles show up as untracked files and `git add -A` commits * them. A `.gitignore` written *inside* the cache root ignores its contents * (and itself) no matter what the project's own `.gitignore` says. * * Best-effort: an unwritable cache root must not fail server startup, and an * existing `.gitignore` is never overwritten. */ export declare function ensureCacheDirIgnored(): Promise; /** * Ensure cached ESM modules can resolve bare specifiers (e.g. `import 'react'`) * when running on Node.js. * * Cached .mjs files live under getCacheBaseDir(). Node.js * resolves bare specifiers by walking up from the importing file looking for * node_modules/. Because the cache directory has no node_modules ancestor, * packages like `react` cannot be found. * * This function creates a symlink: * {cacheBaseDir}/node_modules → {framework's node_modules} * * so Node.js module resolution finds the same packages the framework itself uses, * guaranteeing a single React instance (no "Invalid hook call" errors). * * Returns `true` when a usable framework dependency root is in place for the * cache dir (link created, correct link already present, or an equivalent * real directory), and `false` when it could not be ensured — so callers can * distinguish total link failure from success. Failures are logged once per * cache dir and are retried on later calls (self-healing); only verified * roots retain their expected framework dependency root for a cheaper * revalidation on later calls. */ export declare function ensureCacheNodeModules(): Promise; export {}; //# sourceMappingURL=cache-dir.d.ts.map