/** * Cache Path Portability Utilities * * Centralizes logic for replacing absolute filesystem paths with portable tokens * (e.g., __VF_CACHE_DIR__) before storing code in distributed caches (Redis/API). * This ensures that cached code can be shared across different environments * (e.g., Build Server -> Production Pod) without "cache path mismatch" errors. * * @module core/cache/paths */ import { CACHE_INVARIANT_VIOLATION } from "../errors/index.js"; /** Portable cache directory token */ export declare const CACHE_DIR_TOKEN = "__VF_CACHE_DIR__"; /** * Check if code contains hardcoded cache paths that should be tokenized. */ export declare function hasHardcodedCachePaths(code: string): boolean; /** * Replace local cache directory with portable token. */ export declare function tokenizeCachePaths(code: string, localCacheDir: string): string; /** * Aggressively tokenize ALL veryfront cache paths from ANY environment. * This handles code that may contain paths from different machines (e.g., build server vs prod). * * Strategy: * 1. First tokenize the current machine's cache dir (fast path) * 2. Then use regex to replace any remaining veryfront cache paths * * This is more expensive than tokenizeCachePaths but guarantees portability. */ export declare function tokenizeAllVeryFrontPaths(code: string): string; /** * Replace portable token with local cache directory. */ export declare function detokenizeCachePaths(code: string, localCacheDir: string): string; /** * Tokenize all cache paths in code using the system's base cache directory. * Preferred function for tokenizing paths before storing in distributed cache. */ export declare function tokenizeAllCachePaths(code: string): string; /** * Detokenize all cache paths in code using the system's base cache directory. * Preferred function for detokenizing paths after loading from distributed cache. */ export declare function detokenizeAllCachePaths(code: string): string; export { CACHE_INVARIANT_VIOLATION }; /** * Assert that code is safe to store in distributed cache (portable). * @throws VeryfrontError (cache-invariant-violation) if code contains hardcoded paths */ export declare function assertPortableCode(code: string): void; //# sourceMappingURL=paths.d.ts.map