/** * Canonical URL builders for import rewriting. * * Single source of truth for all URL generation. * Ensures consistent URLs across SSR and browser for hydration parity. */ import { isEsmShUrl, type ParsedEsmShUrl, parseEsmShUrl } from "../shared/esm-sh-specifier.js"; export { isEsmShUrl, type ParsedEsmShUrl, parseEsmShUrl }; /** * Default React version - used when not specified. * * MUST match the React version the build bundles (see `react/deno.json`), * because veryfront's framework React re-export is generated against that * version and references its named exports. A drift guard in * `src/utils/constants/cdn.test.ts` enforces this. */ export declare const DEFAULT_REACT_VERSION = "19.2.4"; /** Tailwind CSS version */ export declare const TAILWIND_VERSION = "4.1.8"; /** csstype version - must match deno.json for type consistency */ export declare const CSSTYPE_VERSION = "3.2.3"; type EsmShOptions = { external?: string[]; target?: string; deps?: Record; }; /** * Build esm.sh URL with proper configuration. * * @param pkg - Package name (e.g., "react", "lodash") * @param version - Package version (optional) * @param subpath - Subpath (e.g., "/jsx-runtime") * @param options - URL options */ export declare function buildEsmShUrl(pkg: string, version?: string, subpath?: string, options?: EsmShOptions): string; /** * Build React esm.sh URL. * Uses deps=csstype for type consistency. */ export declare function buildReactUrl(pkg: "react" | "react-dom", version: string, subpath?: string, external?: boolean): string; /** * Get complete React import map for a specific version. */ export declare function getReactImportMap(version: string): Record; /** * Build module server URL for a path. */ export declare function buildModuleServerUrl(baseUrl: string, path: string): string; /** * Bind an internal module URL to the immutable dependency snapshot that * produced it. Flag-off keys intentionally preserve the historical URL shape. */ export declare function appendDependencyPinningKey(url: string, dependencyPinningCacheKey?: string): string; /** * Bind an import-map prefix target to a dependency snapshot without adding a * query string. Import-map prefix targets must end in `/`; placing the token in * a reserved path segment keeps that invariant when the browser appends the * concrete module suffix. */ export declare function appendDependencyPinningPathKey(url: string, dependencyPinningCacheKey?: string): string; /** * Bind a same-origin module-server URL to a dependency snapshot and canonicalize * it to a root-relative URL. Foreign origins are preserved byte-for-byte. */ export declare function appendSameOriginDependencyPinningPathKey(url: string, dependencyPinningCacheKey?: string, moduleServerOrigin?: string): string; /** * Bind a same-origin absolute module URL to an SSR dependency snapshot. * Foreign origins and flag-off requests are preserved byte-for-byte. */ export declare function appendSameOriginSSRDependencyPinningKey(url: string, dependencyPinningCacheKey?: string, moduleServerOrigin?: string): string; /** * Bind a same-origin absolute module URL to an SSR dependency snapshot using * the module-server path transport. Use this only when the consumer resolves * `/_vf_modules/` paths through the module server instead of generic fetch. */ export declare function appendSameOriginSSRDependencyPinningPathKey(url: string, dependencyPinningCacheKey?: string, moduleServerOrigin?: string): string; export interface ExtractedDependencyPinningPath { pathname: string; cacheKey?: string; found: boolean; malformed: boolean; } /** * Remove a dependency snapshot path segment before module classification and * source lookup. The decoded key is validated by the request handler alongside * query-based tokens. */ export declare function extractDependencyPinningPathKey(pathname: string): ExtractedDependencyPinningPath; /** * Build cross-project import URL. */ export declare function buildCrossProjectUrl(projectSlug: string, version: string | null, path: string): string; /** * Build veryfront framework module URL. */ export declare function buildVeryfrontModuleUrl(path: string): string; /** * Normalize file extension for JavaScript output. */ export declare function normalizeExtension(path: string, options?: { removeExtension?: boolean; }): string; /** Rebuild an esm.sh URL with an exact version, preserving every other part. */ export declare function buildPinnedEsmShUrl(parsed: ParsedEsmShUrl, version: string): string; /** * Add deps query param to esm.sh URL if not already present. */ export declare function addEsmShDeps(url: string, reactVersion: string): string; //# sourceMappingURL=url-builder.d.ts.map