import * as dntShim from "../../_dnt.shims.js"; /** * Upper bound on any cacheNamespaceSegment result: a three-character prefix * plus the longest inline encoding. Cached SSR module paths nest two of these * segments, so this is the budget callers must leave room for when they append * a base cache directory, a version segment, and a relative module path. */ export declare const MAX_CACHE_NAMESPACE_SEGMENT_LENGTH: number; /** Compute the lowercase hex SHA-256 digest of a UTF-8 string. */ export declare function computeHash(content: string): Promise; /** Compute the lowercase hex SHA-256 digest of raw bytes. */ export declare function computeHashBytes(bytes: dntShim.BufferSource): Promise; /** Source bundle content used for hash computation. */ export interface BundleCode { code: string; css?: string; sourceMap?: string; } /** Compute a bundle hash from fixed-field raw UTF-16 code-unit framing. */ export declare function computeCodeHash(code: BundleCode): Promise; /** Create simple hash. */ export declare function simpleHash(str: string): number; /** Hash string to hex (base 16) - used for module filenames */ export declare function hashCodeHex(str: string): string; /** Create short hash. */ export declare function shortHash(content: string): Promise; /** * Filesystem-safe cache namespace segment for an identifier. * * These segments partition on-disk SSR caches by project and content source, so * a shared segment lets one content source serve another source's transformed * modules for the same file path. * * Path-safe ASCII identifiers up to 36 bytes are kept verbatim under "id-"; * other identifiers up to 18 WTF-8 bytes use lowercase hex under "hx-". Both * encodings are injective, so distinct identifiers inside those bounds * provably never share a segment, including on case-insensitive filesystems, * where a case-sensitive encoding would fold distinct segments back together. * Hex of the WTF-8 bytes is used rather than UTF-8 encoding because * `TextEncoder` folds an unpaired surrogate to U+FFFD, which would merge two * namespaces. * * Longer identifiers cannot stay inline without unbounded path segments, so * they collapse under a third disjoint prefix, "h-", to their WTF-8 byte length * plus two domain-separated 64-bit FNV-1a digests. That is 128 bits of a * non-cryptographic hash, further restricted to identifiers of equal byte * length: collisions there are impractical rather than impossible, so the * "never share a segment" guarantee is scoped to the inline forms. Callers that * derive segments from untrusted identifiers must bound their length upstream * to stay on the lossless path. */ export declare function cacheNamespaceSegment(id: string): string; /** FNV-1a hash for strings - returns hex string */ export declare function fnv1aHash(input: string): string; //# sourceMappingURL=hash-utils.d.ts.map