veryfront 0.0.42 → 0.0.43

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/data.js.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/core/utils/cache/stores/memory/lru-list-manager.ts", "../../src/core/utils/cache/eviction/eviction-manager.ts", "../../src/core/utils/cache/stores/memory/lru-node.ts", "../../src/core/utils/cache/stores/memory/entry-manager.ts", "../../src/core/utils/cache/stores/memory/lru-cache-adapter.ts", "../../src/core/utils/runtime-guards.ts", "../../src/core/utils/logger/env.ts", "../../src/core/utils/logger/logger.ts", "../../src/core/utils/constants/cache.ts", "../../deno.json", "../../src/platform/compat/runtime.ts", "../../src/platform/compat/process.ts", "../../src/core/utils/version.ts", "../../src/core/utils/constants/http.ts", "../../src/core/utils/constants/hmr.ts", "../../src/core/utils/constants/network.ts", "../../src/core/utils/constants/server.ts", "../../src/core/utils/paths.ts", "../../src/core/utils/bundle-manifest.ts", "../../src/core/utils/lru-wrapper.ts", "../../src/data/data-fetching-cache.ts", "../../src/data/server-data-fetcher.ts", "../../src/data/static-data-fetcher.ts", "../../src/data/static-paths-fetcher.ts", "../../src/data/data-fetcher.ts", "../../src/data/helpers.ts"],
4
- "sourcesContent": ["import type { LRUNode } from \"./lru-node.ts\";\n\nexport class LRUListManager<T> {\n private head: LRUNode<T> | null = null;\n private tail: LRUNode<T> | null = null;\n\n getHead(): LRUNode<T> | null {\n return this.head;\n }\n\n getTail(): LRUNode<T> | null {\n return this.tail;\n }\n\n moveToFront(node: LRUNode<T>): void {\n if (node === this.head) {\n node.entry.lastAccessed = Date.now();\n return;\n }\n\n this.removeNode(node);\n\n this.addToFront(node);\n }\n\n addToFront(node: LRUNode<T>): void {\n node.next = this.head;\n node.prev = null;\n if (this.head) {\n this.head.prev = node;\n }\n this.head = node;\n if (!this.tail) {\n this.tail = node;\n }\n node.entry.lastAccessed = Date.now();\n }\n\n removeNode(node: LRUNode<T>): void {\n if (node.prev) {\n node.prev.next = node.next;\n }\n if (node.next) {\n node.next.prev = node.prev;\n }\n if (node === this.head) {\n this.head = node.next;\n }\n if (node === this.tail) {\n this.tail = node.prev;\n }\n }\n\n clear(): void {\n this.head = null;\n this.tail = null;\n }\n}\n", "export interface EvictableEntry {\n size: number;\n timestamp?: number;\n expiry?: number;\n value?: unknown;\n tags?: string[];\n}\n\nexport interface LRUTrackerInterface {\n getLRU(): string | undefined;\n remove(key: string): void;\n}\n\nexport interface LRUNodeInterface<T> {\n key: string;\n entry: T;\n prev: LRUNodeInterface<T> | null;\n next: LRUNodeInterface<T> | null;\n}\n\nexport interface LRUListManagerInterface<T> {\n getTail(): LRUNodeInterface<T> | null;\n removeNode(node: LRUNodeInterface<T>): void;\n}\n\nexport interface EvictionManagerOptions {\n onEvict?: (key: string, value: unknown) => void;\n loggerContext?: string;\n}\n\nexport class EvictionManager<TEntry extends EvictableEntry> {\n private readonly onEvict?: (key: string, value: unknown) => void;\n\n constructor(options: EvictionManagerOptions = {}) {\n this.onEvict = options.onEvict;\n }\n\n evictIfNeeded(\n cache: Map<string, TEntry>,\n lruTracker: LRUTrackerInterface,\n newEntrySize: number,\n maxSize: number,\n maxMemory: number,\n ): void {\n while (cache.size >= maxSize) {\n this.evictLRU(cache, lruTracker);\n }\n\n let memoryUsed = Array.from(cache.values()).reduce((sum, entry) => sum + entry.size, 0);\n\n while (memoryUsed + newEntrySize > maxMemory && cache.size > 0) {\n const evictedSize = this.evictLRU(cache, lruTracker);\n memoryUsed -= evictedSize;\n }\n }\n\n evictLRU(cache: Map<string, TEntry>, lruTracker: LRUTrackerInterface): number {\n const keyToEvict = lruTracker.getLRU();\n\n if (!keyToEvict) {\n return 0;\n }\n\n const entry = cache.get(keyToEvict);\n const size = entry?.size || 0;\n const value = entry?.value;\n\n cache.delete(keyToEvict);\n lruTracker.remove(keyToEvict);\n\n if (this.onEvict && entry) {\n this.onEvict(keyToEvict, value);\n }\n\n return size;\n }\n\n evictLRUFromList<T extends TEntry>(\n listManager: LRUListManagerInterface<T>,\n store: Map<string, LRUNodeInterface<T>>,\n tagIndex: Map<string, Set<string>>,\n currentSize: number,\n ): number {\n const tail = listManager.getTail();\n if (!tail) return currentSize;\n\n const node = tail;\n listManager.removeNode(node);\n store.delete(node.key);\n const newSize = currentSize - node.entry.size;\n\n if (node.entry.tags) {\n this.cleanupTags(node.entry.tags, node.key, tagIndex);\n }\n\n if (this.onEvict) {\n this.onEvict(node.key, node.entry.value);\n }\n\n return newSize;\n }\n\n enforceMemoryLimits<T extends TEntry>(\n listManager: LRUListManagerInterface<T>,\n store: Map<string, LRUNodeInterface<T>>,\n tagIndex: Map<string, Set<string>>,\n currentSize: number,\n maxEntries: number,\n maxSizeBytes: number,\n ): number {\n let size = currentSize;\n while ((store.size > maxEntries || size > maxSizeBytes) && listManager.getTail()) {\n size = this.evictLRUFromList(listManager, store, tagIndex, size);\n }\n return size;\n }\n\n private cleanupTags(tags: string[], key: string, tagIndex: Map<string, Set<string>>): void {\n for (const tag of tags) {\n const set = tagIndex.get(tag);\n if (set) {\n set.delete(key);\n if (set.size === 0) {\n tagIndex.delete(tag);\n }\n }\n }\n }\n\n evictExpired(cache: Map<string, TEntry>, lruTracker: LRUTrackerInterface, ttl: number): number {\n const now = Date.now();\n let evicted = 0;\n\n for (const [key, entry] of cache.entries()) {\n if (this.isExpired(entry, ttl, now)) {\n cache.delete(key);\n lruTracker.remove(key);\n evicted++;\n }\n }\n\n return evicted;\n }\n\n isExpired(entry: TEntry, ttl?: number, now: number = Date.now()): boolean {\n if (typeof entry.expiry === \"number\") {\n return now > entry.expiry;\n }\n\n if (typeof entry.timestamp === \"number\" && typeof ttl === \"number\") {\n const age = now - entry.timestamp;\n return age > ttl;\n }\n\n return false;\n }\n}\n", "import type { LRUEntry } from \"./types.ts\";\n\nexport class LRUNode<T> {\n constructor(\n public key: string,\n public entry: LRUEntry<T>,\n public prev: LRUNode<T> | null = null,\n public next: LRUNode<T> | null = null,\n ) {}\n}\n", "import type { LRUEntry } from \"./types.ts\";\nimport { LRUNode } from \"./lru-node.ts\";\nimport type { LRUListManager } from \"./lru-list-manager.ts\";\n\nexport class EntryManager {\n constructor(\n private readonly estimateSizeOf: (value: unknown) => number,\n ) {}\n\n updateExistingEntry<T>(\n node: LRUNode<unknown>,\n value: T,\n ttlMs: number | undefined,\n tags: string[] | undefined,\n defaultTtlMs: number | undefined,\n listManager: LRUListManager<unknown>,\n tagIndex: Map<string, Set<string>>,\n key: string,\n ): number {\n const oldSize = node.entry.size;\n const newSize = this.estimateSizeOf(value);\n const expiry = this.calculateExpiry(ttlMs, defaultTtlMs);\n\n if (node.entry.tags) {\n this.cleanupTags(node.entry.tags, key, tagIndex);\n }\n\n node.entry = {\n value,\n size: newSize,\n expiry,\n tags,\n lastAccessed: Date.now(),\n };\n\n listManager.moveToFront(node);\n\n return newSize - oldSize;\n }\n\n createNewEntry<T>(\n key: string,\n value: T,\n ttlMs: number | undefined,\n tags: string[] | undefined,\n defaultTtlMs: number | undefined,\n listManager: LRUListManager<unknown>,\n store: Map<string, LRUNode<unknown>>,\n ): [LRUNode<unknown>, number] {\n const size = this.estimateSizeOf(value);\n const expiry = this.calculateExpiry(ttlMs, defaultTtlMs);\n\n const entry: LRUEntry<unknown> = {\n value,\n size,\n expiry,\n tags,\n lastAccessed: Date.now(),\n };\n\n const node = new LRUNode(key, entry);\n store.set(key, node);\n listManager.addToFront(node);\n\n return [node, size];\n }\n\n updateTagIndex(\n tags: string[],\n key: string,\n tagIndex: Map<string, Set<string>>,\n ): void {\n for (const tag of tags) {\n if (!tagIndex.has(tag)) {\n tagIndex.set(tag, new Set());\n }\n tagIndex.get(tag)?.add(key);\n }\n }\n\n cleanupTags(\n tags: string[],\n key: string,\n tagIndex: Map<string, Set<string>>,\n ): void {\n for (const tag of tags) {\n const set = tagIndex.get(tag);\n if (set) {\n set.delete(key);\n if (set.size === 0) {\n tagIndex.delete(tag);\n }\n }\n }\n }\n\n private calculateExpiry(\n ttlMs: number | undefined,\n defaultTtlMs: number | undefined,\n ): number | undefined {\n if (typeof ttlMs === \"number\") {\n return Date.now() + ttlMs;\n }\n if (defaultTtlMs) {\n return Date.now() + defaultTtlMs;\n }\n return undefined;\n }\n}\n", "import type { CacheAdapter, LRUCacheOptions, LRUCacheStats, LRUEntry } from \"./types.ts\";\nimport { LRUNode } from \"./lru-node.ts\";\nimport { LRUListManager } from \"./lru-list-manager.ts\";\nimport { EvictionManager } from \"../../eviction/eviction-manager.ts\";\nimport { EntryManager } from \"./entry-manager.ts\";\n\nfunction defaultSizeEstimator(value: unknown): number {\n if (value === null || value === undefined) return 0;\n if (typeof value === \"string\") return value.length * 2;\n if (typeof value === \"number\" || typeof value === \"bigint\") return 8;\n if (typeof value === \"boolean\") return 4;\n if (value instanceof Uint8Array || ArrayBuffer.isView(value)) return value.byteLength;\n if (value instanceof ArrayBuffer) return value.byteLength;\n if (typeof Blob !== \"undefined\" && value instanceof Blob) return value.size;\n\n try {\n return JSON.stringify(value).length * 2;\n } catch {\n return 0;\n }\n}\n\nexport class LRUCacheAdapter implements CacheAdapter {\n private readonly store = new Map<string, LRUNode<unknown>>();\n private readonly tagIndex = new Map<string, Set<string>>();\n private readonly listManager = new LRUListManager<unknown>();\n private readonly evictionManager: EvictionManager<LRUEntry<unknown>>;\n private readonly entryManager: EntryManager;\n private currentSize = 0;\n private readonly maxEntries: number;\n private readonly maxSizeBytes: number;\n private readonly defaultTtlMs?: number;\n private readonly onEvict?: (key: string, value: unknown) => void;\n\n constructor(options: LRUCacheOptions = {}) {\n this.maxEntries = options.maxEntries || 1000;\n this.maxSizeBytes = options.maxSizeBytes || 50 * 1024 * 1024; // 50MB default\n this.defaultTtlMs = options.ttlMs;\n this.onEvict = options.onEvict;\n\n const estimateSizeOf = options.estimateSizeOf || defaultSizeEstimator;\n\n this.evictionManager = new EvictionManager({\n onEvict: this.onEvict,\n loggerContext: \"MemoryCache\",\n });\n this.entryManager = new EntryManager(estimateSizeOf);\n }\n\n get<T>(key: string): T | undefined {\n const node = this.store.get(key);\n if (!node) return undefined;\n\n if (this.evictionManager.isExpired(node.entry)) {\n this.delete(key);\n return undefined;\n }\n\n this.listManager.moveToFront(node);\n return node.entry.value as T;\n }\n\n set<T>(key: string, value: T, ttlMs?: number, tags?: string[]): void {\n const existingNode = this.store.get(key);\n\n if (existingNode) {\n const sizeDelta = this.entryManager.updateExistingEntry(\n existingNode,\n value,\n ttlMs,\n tags,\n this.defaultTtlMs,\n this.listManager,\n this.tagIndex,\n key,\n );\n this.currentSize += sizeDelta;\n } else {\n const [_node, size] = this.entryManager.createNewEntry(\n key,\n value,\n ttlMs,\n tags,\n this.defaultTtlMs,\n this.listManager,\n this.store,\n );\n this.currentSize += size;\n }\n\n if (tags && tags.length > 0) {\n this.entryManager.updateTagIndex(tags, key, this.tagIndex);\n }\n\n this.currentSize = this.evictionManager.enforceMemoryLimits(\n this.listManager,\n this.store,\n this.tagIndex,\n this.currentSize,\n this.maxEntries,\n this.maxSizeBytes,\n );\n }\n\n delete(key: string): void {\n const node = this.store.get(key);\n if (!node) return;\n\n this.listManager.removeNode(node);\n this.store.delete(key);\n this.currentSize -= node.entry.size;\n\n if (node.entry.tags) {\n this.entryManager.cleanupTags(node.entry.tags, key, this.tagIndex);\n }\n\n if (this.onEvict) {\n this.onEvict(key, node.entry.value);\n }\n }\n\n invalidateTag(tag: string): number {\n const set = this.tagIndex.get(tag);\n if (!set) return 0;\n\n let count = 0;\n for (const key of set) {\n this.delete(key);\n count++;\n }\n this.tagIndex.delete(tag);\n return count;\n }\n\n clear(): void {\n if (this.onEvict) {\n for (const [key, node] of this.store) {\n this.onEvict(key, node.entry.value);\n }\n }\n\n this.store.clear();\n this.tagIndex.clear();\n this.listManager.clear();\n this.currentSize = 0;\n }\n\n getStats(): LRUCacheStats {\n return {\n entries: this.store.size,\n sizeBytes: this.currentSize,\n maxEntries: this.maxEntries,\n maxSizeBytes: this.maxSizeBytes,\n tags: this.tagIndex.size,\n };\n }\n\n cleanupExpired(): number {\n const now = Date.now();\n let cleaned = 0;\n\n for (const [key, node] of this.store) {\n if (typeof node.entry.expiry === \"number\" && now > node.entry.expiry) {\n this.delete(key);\n cleaned++;\n }\n }\n\n return cleaned;\n }\n\n keys(): IterableIterator<string> {\n return this.store.keys();\n }\n\n has(key: string): boolean {\n return this.get(key) !== undefined;\n }\n}\n", "export interface GlobalWithDeno {\n Deno?: {\n env: {\n get(key: string): string | undefined;\n };\n };\n}\n\nexport interface GlobalWithProcess {\n process?: {\n env: Record<string, string | undefined>;\n version?: string;\n versions?: Record<string, string>;\n };\n}\n\nexport interface GlobalWithBun {\n Bun?: {\n version: string;\n };\n}\n\nexport function hasDenoRuntime(global: unknown): global is GlobalWithDeno {\n return (\n typeof global === \"object\" &&\n global !== null &&\n \"Deno\" in global &&\n typeof (global as GlobalWithDeno).Deno?.env?.get === \"function\"\n );\n}\n\nexport function hasNodeProcess(global: unknown): global is GlobalWithProcess {\n return (\n typeof global === \"object\" &&\n global !== null &&\n \"process\" in global &&\n typeof (global as GlobalWithProcess).process?.env === \"object\"\n );\n}\n\nexport function hasBunRuntime(global: unknown): global is GlobalWithBun {\n return (\n typeof global === \"object\" &&\n global !== null &&\n \"Bun\" in global &&\n typeof (global as GlobalWithBun).Bun !== \"undefined\"\n );\n}\n", "import type { GlobalWithDeno, GlobalWithProcess } from \"../runtime-guards.ts\";\nimport { hasDenoRuntime, hasNodeProcess } from \"../runtime-guards.ts\";\n\nexport function getEnvironmentVariable(name: string): string | undefined {\n try {\n if (typeof Deno !== \"undefined\" && hasDenoRuntime(globalThis)) {\n const value = (globalThis as GlobalWithDeno).Deno?.env.get(name);\n return value === \"\" ? undefined : value;\n }\n if (hasNodeProcess(globalThis)) {\n const value = (globalThis as GlobalWithProcess).process?.env[name];\n return value === \"\" ? undefined : value;\n }\n } catch {\n return undefined;\n }\n return undefined;\n}\n\nexport function isTestEnvironment(): boolean {\n return getEnvironmentVariable(\"NODE_ENV\") === \"test\";\n}\n\nexport function isProductionEnvironment(): boolean {\n return getEnvironmentVariable(\"NODE_ENV\") === \"production\";\n}\n\nexport function isDevelopmentEnvironment(): boolean {\n const env = getEnvironmentVariable(\"NODE_ENV\");\n return env === \"development\" || env === undefined;\n}\n", "import { getEnvironmentVariable } from \"./env.ts\";\n\nexport enum LogLevel {\n DEBUG = 0,\n INFO = 1,\n WARN = 2,\n ERROR = 3,\n}\n\nexport interface Logger {\n debug(message: string, ...args: unknown[]): void;\n info(message: string, ...args: unknown[]): void;\n warn(message: string, ...args: unknown[]): void;\n error(message: string, ...args: unknown[]): void;\n time<T>(label: string, fn: () => Promise<T>): Promise<T>;\n}\n\nconst originalConsole = {\n debug: console.debug,\n log: console.log,\n warn: console.warn,\n error: console.error,\n};\n\nlet cachedLogLevel: LogLevel | undefined;\n\nfunction resolveLogLevel(force = false): LogLevel {\n if (force || cachedLogLevel === undefined) {\n cachedLogLevel = getDefaultLevel();\n }\n return cachedLogLevel;\n}\n\nclass ConsoleLogger implements Logger {\n constructor(\n private prefix: string,\n private level: LogLevel = resolveLogLevel(),\n ) {}\n\n setLevel(level: LogLevel): void {\n this.level = level;\n }\n\n getLevel(): LogLevel {\n return this.level;\n }\n\n debug(message: string, ...args: unknown[]): void {\n if (this.level <= LogLevel.DEBUG) {\n console.debug(`[${this.prefix}] DEBUG: ${message}`, ...args);\n }\n }\n\n info(message: string, ...args: unknown[]): void {\n if (this.level <= LogLevel.INFO) {\n console.log(`[${this.prefix}] ${message}`, ...args);\n }\n }\n\n warn(message: string, ...args: unknown[]): void {\n if (this.level <= LogLevel.WARN) {\n console.warn(`[${this.prefix}] WARN: ${message}`, ...args);\n }\n }\n\n error(message: string, ...args: unknown[]): void {\n if (this.level <= LogLevel.ERROR) {\n console.error(`[${this.prefix}] ERROR: ${message}`, ...args);\n }\n }\n\n async time<T>(label: string, fn: () => Promise<T>): Promise<T> {\n const start = performance.now();\n try {\n const result = await fn();\n const end = performance.now();\n this.debug(`${label} completed in ${(end - start).toFixed(2)}ms`);\n return result;\n } catch (error) {\n const end = performance.now();\n this.error(`${label} failed after ${(end - start).toFixed(2)}ms`, error);\n throw error;\n }\n }\n}\n\nfunction parseLogLevel(levelString: string | undefined): LogLevel | undefined {\n if (!levelString) return undefined;\n const upper = levelString.toUpperCase();\n switch (upper) {\n case \"DEBUG\":\n return LogLevel.DEBUG;\n case \"WARN\":\n return LogLevel.WARN;\n case \"ERROR\":\n return LogLevel.ERROR;\n case \"INFO\":\n return LogLevel.INFO;\n default:\n return undefined;\n }\n}\n\nconst getDefaultLevel = (): LogLevel => {\n const envLevel = getEnvironmentVariable(\"LOG_LEVEL\");\n const parsedLevel = parseLogLevel(envLevel);\n if (parsedLevel !== undefined) return parsedLevel;\n\n const debugFlag = getEnvironmentVariable(\"VERYFRONT_DEBUG\");\n if (debugFlag === \"1\" || debugFlag === \"true\") return LogLevel.DEBUG;\n\n return LogLevel.INFO;\n};\n\nconst trackedLoggers = new Set<ConsoleLogger>();\n\nfunction createLogger(prefix: string): ConsoleLogger {\n const logger = new ConsoleLogger(prefix);\n trackedLoggers.add(logger);\n return logger;\n}\n\nexport const cliLogger = createLogger(\"CLI\");\nexport const serverLogger = createLogger(\"SERVER\");\nexport const rendererLogger = createLogger(\"RENDERER\");\nexport const bundlerLogger = createLogger(\"BUNDLER\");\nexport const agentLogger = createLogger(\"AGENT\");\n\nexport const logger = createLogger(\"VERYFRONT\");\n\ntype LoggerResetOptions = {\n restoreConsole?: boolean;\n};\n\nexport function __loggerResetForTests(options: LoggerResetOptions = {}): void {\n const updatedLevel = resolveLogLevel(true);\n for (const instance of trackedLoggers) {\n instance.setLevel(updatedLevel);\n }\n\n if (options.restoreConsole) {\n console.debug = originalConsole.debug;\n console.log = originalConsole.log;\n console.warn = originalConsole.warn;\n console.error = originalConsole.error;\n }\n}\n", "export const SECONDS_PER_MINUTE = 60;\n\nexport const MINUTES_PER_HOUR = 60;\n\nexport const HOURS_PER_DAY = 24;\n\nexport const MS_PER_SECOND = 1000;\n\nexport const DEFAULT_LRU_MAX_ENTRIES = 100;\n\nexport const COMPONENT_LOADER_MAX_ENTRIES = 100;\nexport const COMPONENT_LOADER_TTL_MS = 10 * SECONDS_PER_MINUTE * MS_PER_SECOND;\n\nexport const MDX_RENDERER_MAX_ENTRIES = 200;\nexport const MDX_RENDERER_TTL_MS = 10 * SECONDS_PER_MINUTE * MS_PER_SECOND;\n\nexport const RENDERER_CORE_MAX_ENTRIES = 100;\nexport const RENDERER_CORE_TTL_MS = 5 * SECONDS_PER_MINUTE * MS_PER_SECOND;\n\nexport const TSX_LAYOUT_MAX_ENTRIES = 50;\nexport const TSX_LAYOUT_TTL_MS = 10 * SECONDS_PER_MINUTE * MS_PER_SECOND;\n\nexport const DATA_FETCHING_MAX_ENTRIES = 200;\nexport const DATA_FETCHING_TTL_MS = 10 * SECONDS_PER_MINUTE * MS_PER_SECOND;\n\nexport const MDX_CACHE_TTL_PRODUCTION_MS = HOURS_PER_DAY * MINUTES_PER_HOUR * SECONDS_PER_MINUTE *\n MS_PER_SECOND;\nexport const MDX_CACHE_TTL_DEVELOPMENT_MS = 5 * SECONDS_PER_MINUTE * MS_PER_SECOND;\n\nexport const BUNDLE_CACHE_TTL_PRODUCTION_MS = HOURS_PER_DAY * MINUTES_PER_HOUR *\n SECONDS_PER_MINUTE * MS_PER_SECOND;\nexport const BUNDLE_CACHE_TTL_DEVELOPMENT_MS = 5 * SECONDS_PER_MINUTE * MS_PER_SECOND;\n\nexport const BUNDLE_MANIFEST_PROD_TTL_MS = 7 * HOURS_PER_DAY * MINUTES_PER_HOUR *\n SECONDS_PER_MINUTE * MS_PER_SECOND;\nexport const BUNDLE_MANIFEST_DEV_TTL_MS = MINUTES_PER_HOUR * SECONDS_PER_MINUTE * MS_PER_SECOND;\n\nexport const RSC_MANIFEST_CACHE_TTL_MS = 5000;\n\nexport const SERVER_ACTION_DEFAULT_TTL_SEC = MINUTES_PER_HOUR * SECONDS_PER_MINUTE;\n\nexport const DENO_KV_SAFE_SIZE_LIMIT_BYTES = 64_000;\n\nexport const HTTP_CACHE_SHORT_MAX_AGE_SEC = 60;\nexport const HTTP_CACHE_MEDIUM_MAX_AGE_SEC = 3600;\nexport const HTTP_CACHE_LONG_MAX_AGE_SEC = 31536000;\n\nexport const ONE_DAY_MS = HOURS_PER_DAY * MINUTES_PER_HOUR * SECONDS_PER_MINUTE * MS_PER_SECOND;\n\nexport const CACHE_CLEANUP_INTERVAL_MS = 60000;\n\nexport const LRU_DEFAULT_MAX_ENTRIES = 1000;\n\nexport const LRU_DEFAULT_MAX_SIZE_BYTES = 50 * 1024 * 1024;\n\nexport const CLEANUP_INTERVAL_MULTIPLIER = 2;\n", "{\n \"name\": \"veryfront\",\n \"version\": \"0.0.42\",\n \"exclude\": [\n \"npm/\",\n \"dist/\",\n \"coverage/\",\n \"scripts/\",\n \"examples/\",\n \"tests/\",\n \"src/cli/templates/files/\"\n ],\n \"exports\": {\n \".\": \"./src/index.ts\",\n \"./cli\": \"./src/cli/main.ts\",\n \"./server\": \"./src/server/index.ts\",\n \"./middleware\": \"./src/middleware/index.ts\",\n \"./components\": \"./src/react/components/index.ts\",\n \"./data\": \"./src/data/index.ts\",\n \"./config\": \"./src/core/config/index.ts\",\n \"./platform\": \"./src/platform/index.ts\",\n \"./ai\": \"./src/ai/index.ts\",\n \"./ai/client\": \"./src/ai/client.ts\",\n \"./ai/react\": \"./src/ai/react/index.ts\",\n \"./ai/primitives\": \"./src/ai/react/primitives/index.ts\",\n \"./ai/components\": \"./src/ai/react/components/index.ts\",\n \"./ai/production\": \"./src/ai/production/index.ts\",\n \"./ai/dev\": \"./src/ai/dev/index.ts\",\n \"./ai/workflow\": \"./src/ai/workflow/index.ts\",\n \"./ai/workflow/react\": \"./src/ai/workflow/react/index.ts\"\n },\n \"imports\": {\n \"@veryfront\": \"./src/index.ts\",\n \"@veryfront/\": \"./src/\",\n \"@veryfront/ai\": \"./src/ai/index.ts\",\n \"@veryfront/ai/\": \"./src/ai/\",\n \"@veryfront/platform\": \"./src/platform/index.ts\",\n \"@veryfront/platform/\": \"./src/platform/\",\n \"@veryfront/types\": \"./src/core/types/index.ts\",\n \"@veryfront/types/\": \"./src/core/types/\",\n \"@veryfront/utils\": \"./src/core/utils/index.ts\",\n \"@veryfront/utils/\": \"./src/core/utils/\",\n \"@veryfront/middleware\": \"./src/middleware/index.ts\",\n \"@veryfront/middleware/\": \"./src/middleware/\",\n \"@veryfront/errors\": \"./src/core/errors/index.ts\",\n \"@veryfront/errors/\": \"./src/core/errors/\",\n \"@veryfront/config\": \"./src/core/config/index.ts\",\n \"@veryfront/config/\": \"./src/core/config/\",\n \"@veryfront/observability\": \"./src/observability/index.ts\",\n \"@veryfront/observability/\": \"./src/observability/\",\n \"@veryfront/routing\": \"./src/routing/index.ts\",\n \"@veryfront/routing/\": \"./src/routing/\",\n \"@veryfront/transforms\": \"./src/build/transforms/index.ts\",\n \"@veryfront/transforms/\": \"./src/build/transforms/\",\n \"@veryfront/data\": \"./src/data/index.ts\",\n \"@veryfront/data/\": \"./src/data/\",\n \"@veryfront/security\": \"./src/security/index.ts\",\n \"@veryfront/security/\": \"./src/security/\",\n \"@veryfront/components\": \"./src/react/components/index.ts\",\n \"@veryfront/react\": \"./src/react/index.ts\",\n \"@veryfront/react/\": \"./src/react/\",\n \"@veryfront/html\": \"./src/html/index.ts\",\n \"@veryfront/html/\": \"./src/html/\",\n \"@veryfront/rendering\": \"./src/rendering/index.ts\",\n \"@veryfront/rendering/\": \"./src/rendering/\",\n \"@veryfront/build\": \"./src/build/index.ts\",\n \"@veryfront/build/\": \"./src/build/\",\n \"@veryfront/server\": \"./src/server/index.ts\",\n \"@veryfront/server/\": \"./src/server/\",\n \"@veryfront/modules\": \"./src/module-system/index.ts\",\n \"@veryfront/modules/\": \"./src/module-system/\",\n \"@veryfront/compat/console\": \"./src/platform/compat/console/index.ts\",\n \"@veryfront/compat/\": \"./src/platform/compat/\",\n \"std/\": \"https://deno.land/std@0.220.0/\",\n \"@std/path\": \"https://deno.land/std@0.220.0/path/mod.ts\",\n \"@std/testing/bdd.ts\": \"https://deno.land/std@0.220.0/testing/bdd.ts\",\n \"@std/expect\": \"https://deno.land/std@0.220.0/expect/mod.ts\",\n \"csstype\": \"https://esm.sh/csstype@3.2.3\",\n \"@types/react\": \"https://esm.sh/@types/react@18.3.27?deps=csstype@3.2.3\",\n \"@types/react-dom\": \"https://esm.sh/@types/react-dom@18.3.7?deps=csstype@3.2.3\",\n \"react\": \"https://esm.sh/react@18.3.1\",\n \"react-dom\": \"https://esm.sh/react-dom@18.3.1\",\n \"react-dom/server\": \"https://esm.sh/react-dom@18.3.1/server\",\n \"react-dom/client\": \"https://esm.sh/react-dom@18.3.1/client\",\n \"react/jsx-runtime\": \"https://esm.sh/react@18.3.1/jsx-runtime\",\n \"react/jsx-dev-runtime\": \"https://esm.sh/react@18.3.1/jsx-dev-runtime\",\n \"@mdx-js/mdx\": \"https://esm.sh/@mdx-js/mdx@3.0.0?deps=react@18.3.1,react-dom@18.3.1\",\n \"@mdx-js/react\": \"https://esm.sh/@mdx-js/react@3.0.0?deps=react@18.3.1,react-dom@18.3.1\",\n \"unist-util-visit\": \"https://esm.sh/unist-util-visit@5.0.0\",\n \"mdast-util-to-string\": \"https://esm.sh/mdast-util-to-string@4.0.0\",\n \"github-slugger\": \"https://esm.sh/github-slugger@2.0.0\",\n \"remark-gfm\": \"https://esm.sh/remark-gfm@4.0.1\",\n \"remark-frontmatter\": \"https://esm.sh/remark-frontmatter@5.0.0\",\n \"rehype-highlight\": \"https://esm.sh/rehype-highlight@7.0.2\",\n \"rehype-slug\": \"https://esm.sh/rehype-slug@6.0.0\",\n \"esbuild\": \"https://deno.land/x/esbuild@v0.20.1/wasm.js\",\n \"esbuild/mod.js\": \"https://deno.land/x/esbuild@v0.20.1/mod.js\",\n \"es-module-lexer\": \"https://esm.sh/es-module-lexer@1.5.0\",\n \"zod\": \"https://esm.sh/zod@3.22.0\",\n \"mime-types\": \"https://esm.sh/mime-types@2.1.35\",\n \"mdast\": \"https://esm.sh/@types/mdast@4.0.3\",\n \"hast\": \"https://esm.sh/@types/hast@3.0.3\",\n \"unist\": \"https://esm.sh/@types/unist@3.0.2\",\n \"unified\": \"https://esm.sh/unified@11.0.5?dts\",\n \"ai\": \"https://esm.sh/ai@5.0.76?deps=react@18.3.1,react-dom@18.3.1\",\n \"ai/react\": \"https://esm.sh/@ai-sdk/react@2.0.59?deps=react@18.3.1,react-dom@18.3.1\",\n \"@ai-sdk/react\": \"https://esm.sh/@ai-sdk/react@2.0.59?deps=react@18.3.1,react-dom@18.3.1\",\n \"@ai-sdk/openai\": \"https://esm.sh/@ai-sdk/openai@2.0.1\",\n \"@ai-sdk/anthropic\": \"https://esm.sh/@ai-sdk/anthropic@2.0.4\",\n \"unocss\": \"https://esm.sh/unocss@0.59.0\",\n \"@unocss/core\": \"https://esm.sh/@unocss/core@0.59.0\",\n \"@unocss/preset-wind\": \"https://esm.sh/@unocss/preset-wind@0.59.0\",\n \"redis\": \"npm:redis\"\n },\n \"compilerOptions\": {\n \"jsx\": \"react-jsx\",\n \"jsxImportSource\": \"react\",\n \"strict\": true,\n \"noImplicitAny\": true,\n \"noUncheckedIndexedAccess\": true,\n \"types\": [],\n \"lib\": [\n \"deno.window\",\n \"dom\",\n \"dom.iterable\",\n \"dom.asynciterable\",\n \"deno.ns\"\n ]\n },\n \"tasks\": {\n \"setup\": \"deno run --allow-all scripts/setup.ts\",\n \"dev\": \"deno run --allow-all --no-lock --unstable-net --unstable-worker-options src/cli/main.ts dev\",\n \"build\": \"deno compile --allow-all --output ../../bin/veryfront src/cli/main.ts\",\n \"build:npm\": \"deno run -A scripts/build-npm.ts\",\n \"release\": \"deno run -A scripts/release.ts\",\n \"test\": \"DENO_JOBS=1 deno test --parallel --fail-fast --allow-all --unstable-worker-options --unstable-net\",\n \"test:unit\": \"DENO_JOBS=1 deno test --parallel --allow-all --v8-flags=--max-old-space-size=8192 --ignore=tests --unstable-worker-options --unstable-net\",\n \"test:integration\": \"DENO_JOBS=1 deno test --parallel --fail-fast --allow-all tests --unstable-worker-options --unstable-net\",\n \"test:coverage\": \"rm -rf coverage && DENO_JOBS=1 deno test --parallel --fail-fast --allow-all --coverage=coverage --unstable-worker-options --unstable-net || exit 1\",\n \"test:coverage:unit\": \"rm -rf coverage && DENO_JOBS=1 deno test --parallel --fail-fast --allow-all --coverage=coverage --ignore=tests --unstable-worker-options --unstable-net || exit 1\",\n \"test:coverage:integration\": \"rm -rf coverage && DENO_JOBS=1 deno test --parallel --fail-fast --allow-all --coverage=coverage tests --unstable-worker-options --unstable-net || exit 1\",\n \"coverage:report\": \"deno coverage coverage --include=src/ --exclude=tests --exclude=src/**/*_test.ts --exclude=src/**/*_test.tsx --exclude=src/**/*.test.ts --exclude=src/**/*.test.tsx --lcov > coverage/lcov.info && deno run --allow-read scripts/check-coverage.ts 80\",\n \"coverage:html\": \"deno coverage coverage --include=src/ --exclude=tests --exclude=src/**/*_test.ts --exclude=src/**/*_test.tsx --exclude=src/**/*.test.ts --exclude=src/**/*.test.tsx --html\",\n \"lint\": \"DENO_NO_PACKAGE_JSON=1 deno lint src/\",\n \"fmt\": \"deno fmt src/\",\n \"typecheck\": \"deno check src/index.ts src/cli/main.ts src/server/index.ts src/routing/api/index.ts src/rendering/index.ts src/platform/index.ts src/platform/adapters/index.ts src/build/index.ts src/build/production-build/index.ts src/build/transforms/index.ts src/core/config/index.ts src/core/utils/index.ts src/data/index.ts src/security/index.ts src/middleware/index.ts src/server/handlers/dev/index.ts src/server/handlers/request/api/index.ts src/rendering/cache/index.ts src/rendering/cache/stores/index.ts src/rendering/rsc/actions/index.ts src/html/index.ts src/module-system/index.ts\",\n \"docs:check-links\": \"deno run -A scripts/check-doc-links.ts\",\n \"lint:ban-console\": \"deno run --allow-read scripts/ban-console.ts\",\n \"lint:ban-deep-imports\": \"deno run --allow-read scripts/ban-deep-imports.ts\",\n \"lint:ban-internal-root-imports\": \"deno run --allow-read scripts/ban-internal-root-imports.ts\",\n \"lint:check-awaits\": \"deno run --allow-read scripts/check-unawaited-promises.ts\",\n \"lint:platform\": \"deno run --allow-read scripts/lint-platform-agnostic.ts\",\n \"check:circular\": \"deno run -A jsr:@cunarist/deno-circular-deps src/index.ts\"\n },\n \"lint\": {\n \"include\": [\n \"src/**/*.ts\",\n \"src/**/*.tsx\"\n ],\n \"exclude\": [\n \"dist/\",\n \"coverage/\"\n ],\n \"rules\": {\n \"tags\": [\n \"recommended\"\n ],\n \"include\": [\n \"ban-untagged-todo\"\n ],\n \"exclude\": [\n \"no-explicit-any\",\n \"no-process-global\",\n \"no-console\"\n ]\n }\n },\n \"fmt\": {\n \"include\": [\n \"src/**/*.ts\",\n \"src/**/*.tsx\"\n ],\n \"exclude\": [\n \"dist/\",\n \"coverage/\"\n ],\n \"options\": {\n \"useTabs\": false,\n \"lineWidth\": 100,\n \"indentWidth\": 2,\n \"semiColons\": true,\n \"singleQuote\": false,\n \"proseWrap\": \"preserve\"\n }\n }\n}\n", "export const isDeno = typeof Deno !== \"undefined\";\nexport const isNode =\n typeof (globalThis as { process?: { versions?: { node?: string } } }).process !== \"undefined\" &&\n (globalThis as { process?: { versions?: { node?: string } } }).process?.versions?.node !==\n undefined;\nexport const isBun = typeof (globalThis as { Bun?: unknown }).Bun !== \"undefined\";\nexport const isCloudflare = typeof globalThis !== \"undefined\" && \"caches\" in globalThis &&\n \"WebSocketPair\" in globalThis;\n\n/**\n * Detect if running in Node.js (vs Deno)\n * Use this function instead of the constant when runtime detection needs to happen\n * at call time (e.g., when bundled with esbuild's __esm lazy initialization pattern)\n */\nexport function isNodeRuntime(): boolean {\n // deno-lint-ignore no-explicit-any\n const _global = globalThis as any;\n return typeof Deno === \"undefined\" && typeof _global.process !== \"undefined\" &&\n !!_global.process?.versions?.node;\n}\n", "import { isDeno as IS_DENO } from \"./runtime.ts\";\n\nconst nodeProcess = (globalThis as { process?: typeof import(\"node:process\") }).process;\nconst hasNodeProcess = !!nodeProcess?.versions?.node;\n\nexport function getArgs(): string[] {\n if (IS_DENO) {\n return Deno.args;\n }\n if (hasNodeProcess) {\n return nodeProcess!.argv.slice(2);\n }\n return [];\n}\n\nexport function exit(code?: number): never {\n if (IS_DENO) {\n Deno.exit(code);\n }\n if (hasNodeProcess) {\n nodeProcess!.exit(code);\n }\n throw new Error(\"exit() is not supported in this runtime\");\n}\n\nexport function cwd(): string {\n if (IS_DENO) {\n return Deno.cwd();\n }\n if (hasNodeProcess) {\n return nodeProcess!.cwd();\n }\n throw new Error(\"cwd() is not supported in this runtime\");\n}\n\nexport function chdir(directory: string): void {\n if (IS_DENO) {\n Deno.chdir(directory);\n } else {\n if (hasNodeProcess) {\n nodeProcess!.chdir(directory);\n return;\n }\n throw new Error(\"chdir() is not supported in this runtime\");\n }\n}\n\nexport function env(): Record<string, string> {\n if (IS_DENO) {\n return Deno.env.toObject();\n }\n if (hasNodeProcess) {\n return nodeProcess!.env as Record<string, string>;\n }\n return {};\n}\n\nexport function getEnv(key: string): string | undefined {\n if (IS_DENO) {\n return Deno.env.get(key);\n }\n if (hasNodeProcess) {\n return nodeProcess!.env[key];\n }\n return undefined;\n}\n\n/**\n * Get an environment variable or throw if not set\n * @throws Error if the environment variable is not set\n */\nexport function requireEnv(key: string): string {\n const value = getEnv(key);\n if (value === undefined) {\n throw new Error(`Required environment variable \"${key}\" is not set`);\n }\n return value;\n}\n\nexport function setEnv(key: string, value: string): void {\n if (IS_DENO) {\n Deno.env.set(key, value);\n } else {\n if (hasNodeProcess) {\n nodeProcess!.env[key] = value;\n return;\n }\n throw new Error(\"setEnv() is not supported in this runtime\");\n }\n}\n\nexport function deleteEnv(key: string): void {\n if (IS_DENO) {\n Deno.env.delete(key);\n } else {\n if (hasNodeProcess) {\n delete nodeProcess!.env[key];\n return;\n }\n throw new Error(\"deleteEnv() is not supported in this runtime\");\n }\n}\n\nexport function pid(): number {\n if (IS_DENO) {\n return Deno.pid;\n }\n if (hasNodeProcess) {\n return nodeProcess!.pid;\n }\n return 0;\n}\n\nexport function ppid(): number {\n if (IS_DENO && \"ppid\" in Deno) {\n return Deno.ppid || 0;\n }\n if (hasNodeProcess) {\n return nodeProcess!.ppid || 0;\n }\n return 0;\n}\n\nexport function memoryUsage(): {\n rss: number;\n heapTotal: number;\n heapUsed: number;\n external: number;\n} {\n if (IS_DENO) {\n const usage = Deno.memoryUsage();\n return {\n rss: usage.rss,\n heapTotal: usage.heapTotal,\n heapUsed: usage.heapUsed,\n external: usage.external,\n };\n }\n\n if (!hasNodeProcess) {\n throw new Error(\"memoryUsage() is not supported in this runtime\");\n }\n\n const usage = nodeProcess!.memoryUsage();\n return {\n rss: usage.rss,\n heapTotal: usage.heapTotal,\n heapUsed: usage.heapUsed,\n external: usage.external || 0,\n };\n}\n\n/**\n * Check if stdin is a TTY (terminal)\n */\nexport function isInteractive(): boolean {\n if (IS_DENO) {\n return Deno.stdin.isTerminal();\n }\n if (hasNodeProcess) {\n return nodeProcess!.stdin.isTTY ?? false;\n }\n return false;\n}\n\n/**\n * Get network interfaces\n */\nexport async function getNetworkInterfaces(): Promise<\n Array<{ name: string; address: string; family: \"IPv4\" | \"IPv6\" }>\n> {\n if (IS_DENO) {\n const interfaces = Deno.networkInterfaces();\n return interfaces.map((iface) => ({\n name: iface.name,\n address: iface.address,\n family: iface.family as \"IPv4\" | \"IPv6\",\n }));\n }\n\n if (!hasNodeProcess) {\n throw new Error(\"networkInterfaces() is not supported in this runtime\");\n }\n\n const os = await import(\"node:os\");\n const interfaces = os.networkInterfaces();\n const result: Array<{ name: string; address: string; family: \"IPv4\" | \"IPv6\" }> = [];\n\n for (const [name, addrs] of Object.entries(interfaces)) {\n if (!addrs) continue;\n for (const addr of addrs) {\n result.push({\n name,\n address: addr.address,\n family: addr.family as \"IPv4\" | \"IPv6\",\n });\n }\n }\n\n return result;\n}\n\n/**\n * Get runtime version string\n */\nexport function getRuntimeVersion(): string {\n if (IS_DENO) {\n return `Deno ${Deno.version.deno}`;\n }\n if (\"Bun\" in globalThis) {\n return `Bun ${(globalThis as unknown as { Bun: { version: string } }).Bun.version}`;\n }\n if (hasNodeProcess) {\n return `Node.js ${nodeProcess!.version}`;\n }\n return \"unknown\";\n}\n\n/**\n * Register a signal handler (SIGINT, SIGTERM) for graceful shutdown\n */\nexport function onSignal(signal: \"SIGINT\" | \"SIGTERM\", handler: () => void): void {\n if (IS_DENO) {\n Deno.addSignalListener(signal, handler);\n } else if (hasNodeProcess) {\n nodeProcess!.on(signal, handler);\n }\n}\n\n/**\n * Unreference a timer to prevent it from keeping the process alive\n */\nexport function unrefTimer(timerId: ReturnType<typeof setInterval>): void {\n if (IS_DENO) {\n Deno.unrefTimer(timerId as number);\n } else if (timerId && typeof timerId === \"object\" && \"unref\" in timerId) {\n (timerId as { unref: () => void }).unref();\n }\n}\n\n/**\n * Get the executable path of the current runtime\n */\nexport function execPath(): string {\n if (IS_DENO) {\n return Deno.execPath();\n }\n if (hasNodeProcess) {\n return nodeProcess!.execPath;\n }\n return \"\";\n}\n\n/**\n * Get process uptime in seconds\n * Returns OS uptime on Deno, process uptime on Node.js\n */\nexport function uptime(): number {\n if (IS_DENO) {\n // Deno.osUptime() returns system uptime in seconds\n return Deno.osUptime?.() ?? 0;\n }\n if (hasNodeProcess) {\n // process.uptime() returns process uptime in seconds\n return nodeProcess!.uptime?.() ?? 0;\n }\n return 0;\n}\n\n/**\n * Get stdout stream for writing\n * Returns null if not available (e.g., in browser/workers)\n */\nexport function getStdout(): { write: (data: string) => void } | null {\n if (IS_DENO) {\n const encoder = new TextEncoder();\n return {\n write: (data: string) => {\n Deno.stdout.writeSync(encoder.encode(data));\n },\n };\n }\n if (hasNodeProcess && nodeProcess!.stdout) {\n return {\n write: (data: string) => {\n nodeProcess!.stdout.write(data);\n },\n };\n }\n return null;\n}\n\n// Cached Node.js modules for synchronous prompt\nlet cachedNodeFs: typeof import(\"node:fs\") | null = null;\n\n/**\n * Synchronous prompt function that works across Deno and Node.js\n * Displays a message and reads user input from stdin\n */\nexport function promptSync(message?: string): string | null {\n if (IS_DENO) {\n // Deno has a built-in prompt() function\n return prompt(message);\n }\n\n if (hasNodeProcess) {\n // Print the message\n if (message) {\n nodeProcess!.stdout.write(message + \" \");\n }\n\n // Lazy load fs module\n if (!cachedNodeFs) {\n // Dynamic import converted to sync require for bundling\n // @ts-ignore - dynamic require for Node.js\n cachedNodeFs = globalThis.require?.(\"node:fs\") || null;\n if (!cachedNodeFs) {\n // Try alternative approach\n try {\n // @ts-ignore: __require is injected by bundlers for Node.js require\n cachedNodeFs = __require(\"node:fs\");\n } catch {\n return null;\n }\n }\n }\n\n if (!cachedNodeFs) {\n return null;\n }\n\n // Read synchronously using fs\n // This works by reading from file descriptor 0 (stdin)\n // Use Uint8Array for cross-platform compatibility\n const bufferSize = 1024;\n const uint8Array = new Uint8Array(bufferSize);\n let input = \"\";\n\n try {\n // Read from stdin (fd 0) synchronously\n const bytesRead = cachedNodeFs.readSync(0, uint8Array, 0, bufferSize, null);\n if (bytesRead > 0) {\n const decoder = new TextDecoder(\"utf-8\");\n input = decoder.decode(uint8Array.subarray(0, bytesRead)).trim();\n }\n } catch {\n // If stdin is not available or EOF, return null\n return null;\n }\n\n return input || null;\n }\n\n return null;\n}\n", "import denoConfig from \"../../../deno.json\" with { type: \"json\" };\nimport { getEnv } from \"../../platform/compat/process.ts\";\n\nexport const VERSION: string = getEnv(\"VERYFRONT_VERSION\") ||\n (typeof denoConfig.version === \"string\" ? denoConfig.version : \"0.0.0\");\n", "export const KB_IN_BYTES = 1024;\n\nexport const HTTP_MODULE_FETCH_TIMEOUT_MS = 2500;\n\nexport const HMR_RECONNECT_DELAY_MS = 1000;\n\nexport const HMR_RELOAD_DELAY_MS = 1000;\n\nexport const HMR_FILE_WATCHER_DEBOUNCE_MS = 100;\n\nexport const HMR_KEEP_ALIVE_INTERVAL_MS = 30000;\n\nexport const DASHBOARD_RECONNECT_DELAY_MS = 3000;\n\nexport const SERVER_FUNCTION_DEFAULT_TIMEOUT_MS = 30000;\n\nexport const PREFETCH_MAX_SIZE_BYTES = 200 * KB_IN_BYTES;\n\nexport const PREFETCH_DEFAULT_TIMEOUT_MS = 10000;\n\nexport const PREFETCH_DEFAULT_DELAY_MS = 200;\n\nexport const HTTP_OK = 200;\n\nexport const HTTP_NO_CONTENT = 204;\n\nexport const HTTP_CREATED = 201;\n\nexport const HTTP_REDIRECT_FOUND = 302;\n\nexport const HTTP_NOT_MODIFIED = 304;\n\nexport const HTTP_BAD_REQUEST = 400;\n\nexport const HTTP_UNAUTHORIZED = 401;\n\nexport const HTTP_FORBIDDEN = 403;\n\nexport const HTTP_NOT_FOUND = 404;\n\nexport const HTTP_METHOD_NOT_ALLOWED = 405;\n\nexport const HTTP_GONE = 410;\n\nexport const HTTP_PAYLOAD_TOO_LARGE = 413;\n\nexport const HTTP_URI_TOO_LONG = 414;\n\nexport const HTTP_TOO_MANY_REQUESTS = 429;\n\nexport const HTTP_REQUEST_HEADER_FIELDS_TOO_LARGE = 431;\n\nexport const HTTP_SERVER_ERROR = 500;\n\nexport const HTTP_INTERNAL_SERVER_ERROR = 500;\n\nexport const HTTP_BAD_GATEWAY = 502;\n\nexport const HTTP_NOT_IMPLEMENTED = 501;\n\nexport const HTTP_UNAVAILABLE = 503;\n\nexport const HTTP_NETWORK_CONNECT_TIMEOUT = 599;\n\nexport const HTTP_STATUS_SUCCESS_MIN = 200;\n\nexport const HTTP_STATUS_REDIRECT_MIN = 300;\n\nexport const HTTP_STATUS_CLIENT_ERROR_MIN = 400;\n\nexport const HTTP_STATUS_SERVER_ERROR_MIN = 500;\n\nexport const HTTP_CONTENT_TYPES = {\n JS: \"application/javascript; charset=utf-8\",\n JSON: \"application/json; charset=utf-8\",\n HTML: \"text/html; charset=utf-8\",\n CSS: \"text/css; charset=utf-8\",\n TEXT: \"text/plain; charset=utf-8\",\n} as const;\n\nimport { MS_PER_SECOND, SECONDS_PER_MINUTE } from \"./cache.ts\";\n\nexport const MS_PER_MINUTE = 60000;\n\nexport { MS_PER_SECOND, SECONDS_PER_MINUTE };\n\nexport const HTTP_CONTENT_TYPE_IMAGE_PNG = \"image/png\";\n\nexport const HTTP_CONTENT_TYPE_IMAGE_JPEG = \"image/jpeg\";\n\nexport const HTTP_CONTENT_TYPE_IMAGE_WEBP = \"image/webp\";\n\nexport const HTTP_CONTENT_TYPE_IMAGE_AVIF = \"image/avif\";\n\nexport const HTTP_CONTENT_TYPE_IMAGE_SVG = \"image/svg+xml\";\n\nexport const HTTP_CONTENT_TYPE_IMAGE_GIF = \"image/gif\";\n\nexport const HTTP_CONTENT_TYPE_IMAGE_ICO = \"image/x-icon\";\n", "import { KB_IN_BYTES } from \"./http.ts\";\n\nexport const HMR_MAX_MESSAGE_SIZE_BYTES = 1024 * KB_IN_BYTES;\n\nexport const HMR_MAX_MESSAGES_PER_MINUTE = 100;\n\nexport const HMR_CLIENT_RELOAD_DELAY_MS = 3000;\n\nexport const HMR_PORT_OFFSET = 1;\n\nexport const HMR_RATE_LIMIT_WINDOW_MS = 60000;\n\nexport const HMR_CLOSE_NORMAL = 1000;\n\nexport const HMR_CLOSE_RATE_LIMIT = 1008;\n\nexport const HMR_CLOSE_MESSAGE_TOO_LARGE = 1009;\n\nexport const HMR_MESSAGE_TYPES = {\n CONNECTED: \"connected\",\n UPDATE: \"update\",\n RELOAD: \"reload\",\n PING: \"ping\",\n PONG: \"pong\",\n} as const;\n\nexport function isValidHMRMessageType(type: string): type is keyof typeof HMR_MESSAGE_TYPES {\n return Object.values(HMR_MESSAGE_TYPES).includes(\n type as typeof HMR_MESSAGE_TYPES[keyof typeof HMR_MESSAGE_TYPES],\n );\n}\n", "export const DEFAULT_DEV_SERVER_PORT = 3000;\nexport const DEFAULT_REDIS_PORT = 6379;\nexport const DEFAULT_API_SERVER_PORT = 8080;\nexport const DEFAULT_PREVIEW_SERVER_PORT = 5000;\nexport const DEFAULT_METRICS_PORT = 9000;\n\nexport const BYTES_PER_KB = 1024;\nexport const BYTES_PER_MB = 1024 * 1024;\n\nexport const DEFAULT_IMAGE_THUMBNAIL_SIZE = 256;\nexport const DEFAULT_IMAGE_SMALL_SIZE = 512;\nexport const DEFAULT_IMAGE_LARGE_SIZE = 2048;\n\nexport const RESPONSIVE_IMAGE_WIDTH_XS = 320;\nexport const RESPONSIVE_IMAGE_WIDTH_SM = 640;\nexport const RESPONSIVE_IMAGE_WIDTH_MD = 1024;\nexport const RESPONSIVE_IMAGE_WIDTH_LG = 1920;\n\nexport const RESPONSIVE_IMAGE_WIDTHS = [\n RESPONSIVE_IMAGE_WIDTH_XS,\n RESPONSIVE_IMAGE_WIDTH_SM,\n RESPONSIVE_IMAGE_WIDTH_MD,\n RESPONSIVE_IMAGE_WIDTH_LG,\n] as const;\n\nexport const MAX_CHUNK_SIZE_KB = 4096;\n\nexport const MIN_PORT = 1;\n\nexport const MAX_PORT = 65535;\n\nexport const DEFAULT_SERVER_PORT = 8000;\n", "/**\n * Centralized server endpoints and paths registry\n *\n * All internal veryfront URLs should be defined here as the single source of truth.\n * This prevents hardcoding URLs across the codebase and makes refactoring easier.\n */\n\n/** Default port for development dashboard */\nexport const DEFAULT_DASHBOARD_PORT = 3002;\n\n/** Default port for veryfront server */\nexport const DEFAULT_PORT = 3000;\n\n/** Internal URL prefix for all veryfront endpoints */\nexport const INTERNAL_PREFIX = \"/_veryfront\" as const;\n\n/**\n * All internal veryfront URL path prefixes (directories)\n */\nexport const INTERNAL_PATH_PREFIXES = {\n /** React Server Components endpoints */\n RSC: `${INTERNAL_PREFIX}/rsc/`,\n /** File system access endpoints (base64 encoded paths) */\n FS: `${INTERNAL_PREFIX}/fs/`,\n /** Virtual module system */\n MODULES: `${INTERNAL_PREFIX}/modules/`,\n /** Generated page modules */\n PAGES: `${INTERNAL_PREFIX}/pages/`,\n /** Data JSON endpoints */\n DATA: `${INTERNAL_PREFIX}/data/`,\n /** Library modules (AI SDK, etc.) */\n LIB: `${INTERNAL_PREFIX}/lib/`,\n /** Chunk assets */\n CHUNKS: `${INTERNAL_PREFIX}/chunks/`,\n /** Client component modules */\n CLIENT: `${INTERNAL_PREFIX}/client/`,\n} as const;\n\n/**\n * Specific internal endpoint URLs\n */\nexport const INTERNAL_ENDPOINTS = {\n // Development endpoints\n HMR_RUNTIME: `${INTERNAL_PREFIX}/hmr-runtime.js`,\n HMR: `${INTERNAL_PREFIX}/hmr.js`,\n HYDRATE: `${INTERNAL_PREFIX}/hydrate.js`,\n ERROR_OVERLAY: `${INTERNAL_PREFIX}/error-overlay.js`,\n DEV_LOADER: `${INTERNAL_PREFIX}/dev-loader.js`,\n CLIENT_LOG: `${INTERNAL_PREFIX}/log`,\n\n // Production endpoints\n CLIENT_JS: `${INTERNAL_PREFIX}/client.js`,\n ROUTER_JS: `${INTERNAL_PREFIX}/router.js`,\n PREFETCH_JS: `${INTERNAL_PREFIX}/prefetch.js`,\n MANIFEST_JSON: `${INTERNAL_PREFIX}/manifest.json`,\n APP_JS: `${INTERNAL_PREFIX}/app.js`,\n\n // RSC endpoints\n RSC_CLIENT: `${INTERNAL_PREFIX}/rsc/client.js`,\n RSC_MANIFEST: `${INTERNAL_PREFIX}/rsc/manifest`,\n RSC_STREAM: `${INTERNAL_PREFIX}/rsc/stream`,\n RSC_PAYLOAD: `${INTERNAL_PREFIX}/rsc/payload`,\n RSC_RENDER: `${INTERNAL_PREFIX}/rsc/render`,\n RSC_PAGE: `${INTERNAL_PREFIX}/rsc/page`,\n RSC_MODULE: `${INTERNAL_PREFIX}/rsc/module`,\n RSC_DOM: `${INTERNAL_PREFIX}/rsc/dom.js`,\n RSC_HYDRATOR: `${INTERNAL_PREFIX}/rsc/hydrator.js`,\n RSC_HYDRATE_CLIENT: `${INTERNAL_PREFIX}/rsc/hydrate-client.js`,\n\n // Library module endpoints\n LIB_AI_REACT: `${INTERNAL_PREFIX}/lib/ai/react.js`,\n LIB_AI_COMPONENTS: `${INTERNAL_PREFIX}/lib/ai/components.js`,\n LIB_AI_PRIMITIVES: `${INTERNAL_PREFIX}/lib/ai/primitives.js`,\n} as const;\n\n/**\n * Build output directory paths (relative)\n */\nexport const BUILD_DIRS = {\n /** Main build output directory */\n ROOT: \"_veryfront\",\n /** Chunks directory */\n CHUNKS: \"_veryfront/chunks\",\n /** Data directory */\n DATA: \"_veryfront/data\",\n /** Assets directory */\n ASSETS: \"_veryfront/assets\",\n} as const;\n\n/**\n * Local project directory paths (relative to project root)\n * These are .gitignore'd directories for caching and temporary files\n */\nexport const PROJECT_DIRS = {\n /** Base veryfront internal directory */\n ROOT: \".veryfront\",\n /** Cache directory for build artifacts, transforms, etc. */\n CACHE: \".veryfront/cache\",\n /** KV store directory */\n KV: \".veryfront/kv\",\n /** Log files directory */\n LOGS: \".veryfront/logs\",\n /** Temporary files directory */\n TMP: \".veryfront/tmp\",\n} as const;\n\n/** Default cache directory path */\nexport const DEFAULT_CACHE_DIR = PROJECT_DIRS.CACHE;\n\n/**\n * Helper to check if a pathname is an internal veryfront endpoint\n */\nexport function isInternalEndpoint(pathname: string): boolean {\n return pathname.startsWith(INTERNAL_PREFIX + \"/\");\n}\n\n/**\n * Helper to check if a pathname is a static asset (has extension or is internal)\n */\nexport function isStaticAsset(pathname: string): boolean {\n return pathname.includes(\".\") || isInternalEndpoint(pathname);\n}\n\n/**\n * Normalize a chunk path to include the base prefix\n */\nexport function normalizeChunkPath(\n filename: string,\n basePath: string = INTERNAL_PATH_PREFIXES.CHUNKS,\n): string {\n if (filename.startsWith(\"/\")) {\n return filename;\n }\n return `${basePath.replace(/\\/$/, \"\")}/${filename}`;\n}\n\n// Re-export for backward compatibility\nexport const DEV_SERVER_ENDPOINTS = {\n HMR_RUNTIME: INTERNAL_ENDPOINTS.HMR_RUNTIME,\n ERROR_OVERLAY: INTERNAL_ENDPOINTS.ERROR_OVERLAY,\n} as const;\n", "/**\n * Project directory paths and file extensions\n *\n * For internal veryfront URL endpoints, see ./constants/server.ts\n */\n\nimport {\n BUILD_DIRS,\n INTERNAL_ENDPOINTS,\n INTERNAL_PATH_PREFIXES,\n INTERNAL_PREFIX,\n} from \"./constants/server.ts\";\n\nexport const PATHS = {\n PAGES_DIR: \"pages\",\n COMPONENTS_DIR: \"components\",\n PUBLIC_DIR: \"public\",\n STYLES_DIR: \"styles\",\n DIST_DIR: \"dist\",\n CONFIG_FILE: \"veryfront.config.js\",\n} as const;\n\n/**\n * @deprecated Use INTERNAL_PREFIX, INTERNAL_ENDPOINTS, INTERNAL_PATH_PREFIXES from ./constants/server.ts\n */\nexport const VERYFRONT_PATHS = {\n INTERNAL_PREFIX: INTERNAL_PREFIX,\n BUILD_DIR: BUILD_DIRS.ROOT,\n CHUNKS_DIR: BUILD_DIRS.CHUNKS,\n DATA_DIR: BUILD_DIRS.DATA,\n ASSETS_DIR: BUILD_DIRS.ASSETS,\n HMR_RUNTIME: INTERNAL_ENDPOINTS.HMR_RUNTIME,\n CLIENT_JS: INTERNAL_ENDPOINTS.CLIENT_JS,\n ROUTER_JS: INTERNAL_ENDPOINTS.ROUTER_JS,\n ERROR_OVERLAY: INTERNAL_ENDPOINTS.ERROR_OVERLAY,\n} as const;\n\nexport const FILE_EXTENSIONS = {\n MDX: [\".mdx\", \".md\"],\n SCRIPT: [\".tsx\", \".ts\", \".jsx\", \".js\"],\n STYLE: [\".css\", \".scss\", \".sass\"],\n ALL: [\".mdx\", \".md\", \".tsx\", \".ts\", \".jsx\", \".js\", \".css\"],\n} as const;\n\n// Re-export for convenience\nexport { BUILD_DIRS, INTERNAL_ENDPOINTS, INTERNAL_PATH_PREFIXES, INTERNAL_PREFIX };\n", "import { serverLogger as logger } from \"./logger/index.ts\";\n\nexport interface BundleMetadata {\n hash: string;\n codeHash: string;\n size: number;\n compiledAt: number;\n source: string;\n mode: \"development\" | \"production\";\n meta?: {\n type?: \"mdx\" | \"component\" | \"layout\" | \"provider\";\n depsHash?: string;\n reactVersion?: string;\n };\n}\n\nexport interface BundleCode {\n code: string;\n sourceMap?: string;\n css?: string;\n}\n\nexport interface BundleManifestStore {\n getBundleMetadata(key: string): Promise<BundleMetadata | undefined>;\n\n setBundleMetadata(key: string, metadata: BundleMetadata, ttlMs?: number): Promise<void>;\n\n getBundleCode(hash: string): Promise<BundleCode | undefined>;\n\n setBundleCode(hash: string, code: BundleCode, ttlMs?: number): Promise<void>;\n\n deleteBundle(key: string): Promise<void>;\n\n invalidateSource(source: string): Promise<number>;\n\n clear(): Promise<void>;\n\n isAvailable(): Promise<boolean>;\n\n getStats(): Promise<{\n totalBundles: number;\n totalSize: number;\n oldestBundle?: number;\n newestBundle?: number;\n }>;\n}\n\nexport class InMemoryBundleManifestStore implements BundleManifestStore {\n private metadata = new Map<string, { value: BundleMetadata; expiry?: number }>();\n private code = new Map<string, { value: BundleCode; expiry?: number }>();\n private sourceIndex = new Map<string, Set<string>>();\n\n getBundleMetadata(key: string): Promise<BundleMetadata | undefined> {\n const entry = this.metadata.get(key);\n if (!entry) return Promise.resolve(undefined);\n if (entry.expiry && Date.now() > entry.expiry) {\n this.metadata.delete(key);\n return Promise.resolve(undefined);\n }\n return Promise.resolve(entry.value);\n }\n\n setBundleMetadata(key: string, metadata: BundleMetadata, ttlMs?: number): Promise<void> {\n const expiry = ttlMs ? Date.now() + ttlMs : undefined;\n this.metadata.set(key, { value: metadata, expiry });\n\n if (!this.sourceIndex.has(metadata.source)) {\n this.sourceIndex.set(metadata.source, new Set());\n }\n this.sourceIndex.get(metadata.source)!.add(key);\n return Promise.resolve();\n }\n\n getBundleCode(hash: string): Promise<BundleCode | undefined> {\n const entry = this.code.get(hash);\n if (!entry) return Promise.resolve(undefined);\n if (entry.expiry && Date.now() > entry.expiry) {\n this.code.delete(hash);\n return Promise.resolve(undefined);\n }\n return Promise.resolve(entry.value);\n }\n\n setBundleCode(hash: string, code: BundleCode, ttlMs?: number): Promise<void> {\n const expiry = ttlMs ? Date.now() + ttlMs : undefined;\n this.code.set(hash, { value: code, expiry });\n return Promise.resolve();\n }\n\n async deleteBundle(key: string): Promise<void> {\n const metadata = await this.getBundleMetadata(key);\n this.metadata.delete(key);\n if (metadata) {\n this.code.delete(metadata.codeHash);\n const sourceKeys = this.sourceIndex.get(metadata.source);\n if (sourceKeys) {\n sourceKeys.delete(key);\n if (sourceKeys.size === 0) {\n this.sourceIndex.delete(metadata.source);\n }\n }\n }\n }\n\n async invalidateSource(source: string): Promise<number> {\n const keys = this.sourceIndex.get(source);\n if (!keys) return 0;\n\n let count = 0;\n for (const key of Array.from(keys)) {\n await this.deleteBundle(key);\n count++;\n }\n this.sourceIndex.delete(source);\n return count;\n }\n\n clear(): Promise<void> {\n this.metadata.clear();\n this.code.clear();\n this.sourceIndex.clear();\n return Promise.resolve();\n }\n\n isAvailable(): Promise<boolean> {\n return Promise.resolve(true);\n }\n\n getStats(): Promise<{\n totalBundles: number;\n totalSize: number;\n oldestBundle?: number;\n newestBundle?: number;\n }> {\n let totalSize = 0;\n let oldest: number | undefined;\n let newest: number | undefined;\n\n for (const { value } of this.metadata.values()) {\n totalSize += value.size;\n if (!oldest || value.compiledAt < oldest) oldest = value.compiledAt;\n if (!newest || value.compiledAt > newest) newest = value.compiledAt;\n }\n\n return Promise.resolve({\n totalBundles: this.metadata.size,\n totalSize,\n oldestBundle: oldest,\n newestBundle: newest,\n });\n }\n}\n\nlet manifestStore: BundleManifestStore = new InMemoryBundleManifestStore();\n\nexport function setBundleManifestStore(store: BundleManifestStore): void {\n manifestStore = store;\n logger.info(\"[bundle-manifest] Bundle manifest store configured\", {\n type: store.constructor.name,\n });\n}\n\nexport function getBundleManifestStore(): BundleManifestStore {\n return manifestStore;\n}\n\nexport { computeCodeHash, computeContentHash } from \"./hash-utils.ts\";\n", "import { LRUCacheAdapter } from \"./cache/stores/memory/lru-cache-adapter.ts\";\nimport type { LRUCacheOptions } from \"./cache/stores/memory/types.ts\";\nimport { DEFAULT_LRU_MAX_ENTRIES } from \"@veryfront/utils\";\nimport { getEnv } from \"../../platform/compat/process.ts\";\n\nexport interface LRUOptions {\n maxEntries?: number;\n ttlMs?: number;\n cleanupIntervalMs?: number;\n}\n\nexport class LRUCache<K, V> {\n private adapter: LRUCacheAdapter;\n private cleanupTimer?: ReturnType<typeof setInterval>;\n private cleanupIntervalMs: number;\n private ttlMs?: number;\n\n constructor(options: LRUOptions = {}) {\n const adapterOptions: LRUCacheOptions = {\n maxEntries: options.maxEntries ?? DEFAULT_LRU_MAX_ENTRIES,\n ttlMs: options.ttlMs,\n };\n\n this.adapter = new LRUCacheAdapter(adapterOptions);\n this.ttlMs = options.ttlMs;\n this.cleanupIntervalMs = options.cleanupIntervalMs ?? 60000;\n\n if (this.ttlMs && this.ttlMs > 0) {\n this.startPeriodicCleanup();\n }\n }\n\n private startPeriodicCleanup(): void {\n if (shouldDisableInterval()) {\n return;\n }\n if (this.cleanupTimer) {\n clearInterval(this.cleanupTimer);\n }\n\n const timer = setInterval(() => {\n this.adapter.cleanupExpired();\n }, this.cleanupIntervalMs);\n this.cleanupTimer = timer;\n }\n\n private toStringKey(key: K): string {\n if (typeof key === \"string\") {\n return key;\n }\n return String(key);\n }\n\n get size(): number {\n return this.adapter.getStats().entries;\n }\n\n has(key: K): boolean {\n return this.adapter.get(this.toStringKey(key)) !== undefined;\n }\n\n get(key: K): V | undefined {\n return this.adapter.get<V>(this.toStringKey(key));\n }\n\n set(key: K, value: V): void {\n this.adapter.set(this.toStringKey(key), value);\n }\n\n delete(key: K): boolean {\n const stringKey = this.toStringKey(key);\n const had = this.adapter.get(stringKey) !== undefined;\n this.adapter.delete(stringKey);\n return had;\n }\n\n clear(): void {\n this.adapter.clear();\n }\n\n cleanup(): void {\n this.adapter.cleanupExpired();\n }\n\n destroy(): void {\n if (this.cleanupTimer) {\n clearInterval(this.cleanupTimer);\n this.cleanupTimer = undefined;\n }\n\n this.adapter.clear();\n }\n\n keys(): IterableIterator<K> {\n return this.adapter.keys() as IterableIterator<K>;\n }\n}\n\nfunction shouldDisableInterval(): boolean {\n if ((globalThis as Record<string, unknown>).__vfDisableLruInterval === true) {\n return true;\n }\n try {\n return getEnv(\"VF_DISABLE_LRU_INTERVAL\") === \"1\";\n } catch {\n return false;\n }\n}\n", "import { LRUCache } from \"@veryfront/utils/lru-wrapper.ts\";\nimport {\n DATA_FETCHING_MAX_ENTRIES,\n DATA_FETCHING_TTL_MS,\n} from \"@veryfront/utils/constants/cache.ts\";\nimport type { CacheEntry, DataContext } from \"./types.ts\";\nimport { getEnv } from \"../platform/compat/process.ts\";\n\nfunction isLruIntervalDisabled(): boolean {\n if ((globalThis as Record<string, unknown>).__vfDisableLruInterval === true) {\n return true;\n }\n try {\n return getEnv(\"VF_DISABLE_LRU_INTERVAL\") === \"1\";\n } catch {\n return false;\n }\n}\n\nexport class CacheManager {\n private cache = new LRUCache<string, CacheEntry>({\n maxEntries: DATA_FETCHING_MAX_ENTRIES,\n ttlMs: isLruIntervalDisabled() ? undefined : DATA_FETCHING_TTL_MS,\n });\n private cacheKeys = new Set<string>();\n\n get(key: string): CacheEntry | null {\n const entry = this.cache.get(key);\n return entry ?? null;\n }\n\n set(key: string, entry: CacheEntry): void {\n this.cache.set(key, entry);\n this.cacheKeys.add(key);\n }\n\n delete(key: string): void {\n this.cache.delete(key);\n this.cacheKeys.delete(key);\n }\n\n clear(): void {\n this.cache.clear();\n this.cacheKeys.clear();\n }\n\n clearPattern(pattern: string): void {\n for (const key of this.cacheKeys) {\n if (key.includes(pattern)) {\n this.delete(key);\n }\n }\n }\n\n shouldRevalidate(entry: CacheEntry): boolean {\n if (entry.revalidate === false) {\n return false;\n }\n\n if (typeof entry.revalidate === \"number\") {\n const age = Date.now() - entry.timestamp;\n return age > entry.revalidate * 1000;\n }\n\n return false;\n }\n\n createCacheKey(context: DataContext): string {\n const params = JSON.stringify(context.params);\n const pathname = context.url.pathname;\n return `${pathname}::${params}`;\n }\n}\n", "import type { RuntimeAdapter } from \"@veryfront/platform/adapters/index.ts\";\nimport type { DataContext, DataResult, PageWithData } from \"./types.ts\";\nimport { serverLogger } from \"@veryfront/utils\";\n\nexport class ServerDataFetcher {\n constructor(private adapter?: RuntimeAdapter) {}\n\n async fetch(pageModule: PageWithData, context: DataContext): Promise<DataResult> {\n if (!pageModule.getServerData) {\n return { props: {} };\n }\n\n try {\n const result = await pageModule.getServerData(context);\n\n if (result.redirect) {\n return { redirect: result.redirect };\n }\n\n if (result.notFound) {\n return { notFound: true };\n }\n\n return {\n props: result.props ?? {},\n revalidate: result.revalidate,\n };\n } catch (error) {\n this.logError(\"Error in getServerData:\", error);\n throw error;\n }\n }\n\n private logError(message: string, error: unknown): void {\n const debugEnabled = this.adapter?.env.get(\"VERYFRONT_DEBUG\");\n if (debugEnabled) {\n serverLogger.error(message, error);\n }\n }\n}\n", "import type { RuntimeAdapter } from \"@veryfront/platform/adapters/index.ts\";\nimport type { CacheManager } from \"./data-fetching-cache.ts\";\nimport type { DataContext, DataResult, PageWithData } from \"./types.ts\";\nimport { serverLogger } from \"@veryfront/utils\";\n\nexport class StaticDataFetcher {\n private pendingRevalidations = new Map<string, Promise<void>>();\n\n constructor(\n private cacheManager: CacheManager,\n private adapter?: RuntimeAdapter,\n ) {}\n\n async fetch(pageModule: PageWithData, context: DataContext): Promise<DataResult> {\n if (!pageModule.getStaticData) {\n return { props: {} };\n }\n\n const cacheKey = this.cacheManager.createCacheKey(context);\n const cached = this.cacheManager.get(cacheKey);\n\n if (cached && !this.cacheManager.shouldRevalidate(cached)) {\n return cached.data;\n }\n\n if (cached && this.cacheManager.shouldRevalidate(cached)) {\n if (!this.pendingRevalidations.has(cacheKey)) {\n this.pendingRevalidations.set(\n cacheKey,\n this.revalidateInBackground(pageModule, context, cacheKey),\n );\n }\n return cached.data;\n }\n\n return await this.fetchFresh(pageModule, context, cacheKey);\n }\n\n private async fetchFresh(\n pageModule: PageWithData,\n context: DataContext,\n cacheKey: string,\n ): Promise<DataResult> {\n if (!pageModule.getStaticData) {\n return { props: {} };\n }\n\n try {\n const result = await pageModule.getStaticData({\n params: context.params,\n url: context.url,\n });\n\n this.cacheManager.set(cacheKey, {\n data: result,\n timestamp: Date.now(),\n revalidate: result.revalidate,\n });\n\n return result;\n } catch (error) {\n this.logError(\"Error in getStaticData:\", error);\n throw error;\n }\n }\n\n private async revalidateInBackground(\n pageModule: PageWithData,\n context: DataContext,\n cacheKey: string,\n ): Promise<void> {\n try {\n if (!pageModule.getStaticData) {\n return;\n }\n\n const result = await pageModule.getStaticData({\n params: context.params,\n url: context.url,\n });\n\n this.cacheManager.set(cacheKey, {\n data: result,\n timestamp: Date.now(),\n revalidate: result.revalidate,\n });\n } catch (error) {\n this.logError(\"Error revalidating data:\", error);\n } finally {\n this.pendingRevalidations.delete(cacheKey);\n }\n }\n\n private logError(message: string, error: unknown): void {\n const debugEnabled = this.adapter?.env.get(\"VERYFRONT_DEBUG\");\n if (debugEnabled) {\n serverLogger.error(message, error);\n }\n }\n}\n", "import type { PageWithData, StaticPathsResult } from \"./types.ts\";\nimport { serverLogger } from \"@veryfront/utils\";\n\nexport class StaticPathsFetcher {\n async fetch(pageModule: PageWithData): Promise<StaticPathsResult | null> {\n if (!pageModule.getStaticPaths) {\n return null;\n }\n\n try {\n return await pageModule.getStaticPaths();\n } catch (error) {\n this.logError(\"Error in getStaticPaths:\", error);\n throw error;\n }\n }\n\n private logError(message: string, error: unknown): void {\n serverLogger.error(message, error);\n }\n}\n", "import type { RuntimeAdapter } from \"@veryfront/platform/adapters/index.ts\";\nimport { CacheManager } from \"./data-fetching-cache.ts\";\nimport { ServerDataFetcher } from \"./server-data-fetcher.ts\";\nimport { StaticDataFetcher } from \"./static-data-fetcher.ts\";\nimport { StaticPathsFetcher } from \"./static-paths-fetcher.ts\";\nimport type { DataContext, DataResult, PageWithData, StaticPathsResult } from \"./types.ts\";\n\nexport class DataFetcher {\n private cacheManager: CacheManager;\n private serverFetcher: ServerDataFetcher;\n private staticFetcher: StaticDataFetcher;\n private pathsFetcher: StaticPathsFetcher;\n\n constructor(adapter?: RuntimeAdapter) {\n this.cacheManager = new CacheManager();\n this.serverFetcher = new ServerDataFetcher(adapter);\n this.staticFetcher = new StaticDataFetcher(this.cacheManager, adapter);\n this.pathsFetcher = new StaticPathsFetcher();\n }\n\n async fetchData(\n pageModule: PageWithData,\n context: DataContext,\n mode: \"development\" | \"production\" = \"development\",\n ): Promise<DataResult> {\n if (!pageModule.getServerData && !pageModule.getStaticData) {\n return { props: {} };\n }\n\n if (mode === \"development\" && pageModule.getServerData) {\n return await this.serverFetcher.fetch(pageModule, context);\n }\n\n if (pageModule.getStaticData) {\n return await this.staticFetcher.fetch(pageModule, context);\n }\n\n if (pageModule.getServerData) {\n return await this.serverFetcher.fetch(pageModule, context);\n }\n\n return { props: {} };\n }\n\n async getStaticPaths(pageModule: PageWithData): Promise<StaticPathsResult | null> {\n return await this.pathsFetcher.fetch(pageModule);\n }\n\n clearCache(pattern?: string): void {\n if (pattern) {\n this.cacheManager.clearPattern(pattern);\n } else {\n this.cacheManager.clear();\n }\n }\n}\n", "import type { DataResult } from \"./types.ts\";\n\nexport const redirect = (destination: string, permanent = false): DataResult => ({\n redirect: { destination, permanent },\n});\n\nexport const notFound = (): DataResult => ({\n notFound: true,\n});\n"],
4
+ "sourcesContent": ["import type { LRUNode } from \"./lru-node.ts\";\n\nexport class LRUListManager<T> {\n private head: LRUNode<T> | null = null;\n private tail: LRUNode<T> | null = null;\n\n getHead(): LRUNode<T> | null {\n return this.head;\n }\n\n getTail(): LRUNode<T> | null {\n return this.tail;\n }\n\n moveToFront(node: LRUNode<T>): void {\n if (node === this.head) {\n node.entry.lastAccessed = Date.now();\n return;\n }\n\n this.removeNode(node);\n\n this.addToFront(node);\n }\n\n addToFront(node: LRUNode<T>): void {\n node.next = this.head;\n node.prev = null;\n if (this.head) {\n this.head.prev = node;\n }\n this.head = node;\n if (!this.tail) {\n this.tail = node;\n }\n node.entry.lastAccessed = Date.now();\n }\n\n removeNode(node: LRUNode<T>): void {\n if (node.prev) {\n node.prev.next = node.next;\n }\n if (node.next) {\n node.next.prev = node.prev;\n }\n if (node === this.head) {\n this.head = node.next;\n }\n if (node === this.tail) {\n this.tail = node.prev;\n }\n }\n\n clear(): void {\n this.head = null;\n this.tail = null;\n }\n}\n", "export interface EvictableEntry {\n size: number;\n timestamp?: number;\n expiry?: number;\n value?: unknown;\n tags?: string[];\n}\n\nexport interface LRUTrackerInterface {\n getLRU(): string | undefined;\n remove(key: string): void;\n}\n\nexport interface LRUNodeInterface<T> {\n key: string;\n entry: T;\n prev: LRUNodeInterface<T> | null;\n next: LRUNodeInterface<T> | null;\n}\n\nexport interface LRUListManagerInterface<T> {\n getTail(): LRUNodeInterface<T> | null;\n removeNode(node: LRUNodeInterface<T>): void;\n}\n\nexport interface EvictionManagerOptions {\n onEvict?: (key: string, value: unknown) => void;\n loggerContext?: string;\n}\n\nexport class EvictionManager<TEntry extends EvictableEntry> {\n private readonly onEvict?: (key: string, value: unknown) => void;\n\n constructor(options: EvictionManagerOptions = {}) {\n this.onEvict = options.onEvict;\n }\n\n evictIfNeeded(\n cache: Map<string, TEntry>,\n lruTracker: LRUTrackerInterface,\n newEntrySize: number,\n maxSize: number,\n maxMemory: number,\n ): void {\n while (cache.size >= maxSize) {\n this.evictLRU(cache, lruTracker);\n }\n\n let memoryUsed = Array.from(cache.values()).reduce((sum, entry) => sum + entry.size, 0);\n\n while (memoryUsed + newEntrySize > maxMemory && cache.size > 0) {\n const evictedSize = this.evictLRU(cache, lruTracker);\n memoryUsed -= evictedSize;\n }\n }\n\n evictLRU(cache: Map<string, TEntry>, lruTracker: LRUTrackerInterface): number {\n const keyToEvict = lruTracker.getLRU();\n\n if (!keyToEvict) {\n return 0;\n }\n\n const entry = cache.get(keyToEvict);\n const size = entry?.size || 0;\n const value = entry?.value;\n\n cache.delete(keyToEvict);\n lruTracker.remove(keyToEvict);\n\n if (this.onEvict && entry) {\n this.onEvict(keyToEvict, value);\n }\n\n return size;\n }\n\n evictLRUFromList<T extends TEntry>(\n listManager: LRUListManagerInterface<T>,\n store: Map<string, LRUNodeInterface<T>>,\n tagIndex: Map<string, Set<string>>,\n currentSize: number,\n ): number {\n const tail = listManager.getTail();\n if (!tail) return currentSize;\n\n const node = tail;\n listManager.removeNode(node);\n store.delete(node.key);\n const newSize = currentSize - node.entry.size;\n\n if (node.entry.tags) {\n this.cleanupTags(node.entry.tags, node.key, tagIndex);\n }\n\n if (this.onEvict) {\n this.onEvict(node.key, node.entry.value);\n }\n\n return newSize;\n }\n\n enforceMemoryLimits<T extends TEntry>(\n listManager: LRUListManagerInterface<T>,\n store: Map<string, LRUNodeInterface<T>>,\n tagIndex: Map<string, Set<string>>,\n currentSize: number,\n maxEntries: number,\n maxSizeBytes: number,\n ): number {\n let size = currentSize;\n while ((store.size > maxEntries || size > maxSizeBytes) && listManager.getTail()) {\n size = this.evictLRUFromList(listManager, store, tagIndex, size);\n }\n return size;\n }\n\n private cleanupTags(tags: string[], key: string, tagIndex: Map<string, Set<string>>): void {\n for (const tag of tags) {\n const set = tagIndex.get(tag);\n if (set) {\n set.delete(key);\n if (set.size === 0) {\n tagIndex.delete(tag);\n }\n }\n }\n }\n\n evictExpired(cache: Map<string, TEntry>, lruTracker: LRUTrackerInterface, ttl: number): number {\n const now = Date.now();\n let evicted = 0;\n\n for (const [key, entry] of cache.entries()) {\n if (this.isExpired(entry, ttl, now)) {\n cache.delete(key);\n lruTracker.remove(key);\n evicted++;\n }\n }\n\n return evicted;\n }\n\n isExpired(entry: TEntry, ttl?: number, now: number = Date.now()): boolean {\n if (typeof entry.expiry === \"number\") {\n return now > entry.expiry;\n }\n\n if (typeof entry.timestamp === \"number\" && typeof ttl === \"number\") {\n const age = now - entry.timestamp;\n return age > ttl;\n }\n\n return false;\n }\n}\n", "import type { LRUEntry } from \"./types.ts\";\n\nexport class LRUNode<T> {\n constructor(\n public key: string,\n public entry: LRUEntry<T>,\n public prev: LRUNode<T> | null = null,\n public next: LRUNode<T> | null = null,\n ) {}\n}\n", "import type { LRUEntry } from \"./types.ts\";\nimport { LRUNode } from \"./lru-node.ts\";\nimport type { LRUListManager } from \"./lru-list-manager.ts\";\n\nexport class EntryManager {\n constructor(\n private readonly estimateSizeOf: (value: unknown) => number,\n ) {}\n\n updateExistingEntry<T>(\n node: LRUNode<unknown>,\n value: T,\n ttlMs: number | undefined,\n tags: string[] | undefined,\n defaultTtlMs: number | undefined,\n listManager: LRUListManager<unknown>,\n tagIndex: Map<string, Set<string>>,\n key: string,\n ): number {\n const oldSize = node.entry.size;\n const newSize = this.estimateSizeOf(value);\n const expiry = this.calculateExpiry(ttlMs, defaultTtlMs);\n\n if (node.entry.tags) {\n this.cleanupTags(node.entry.tags, key, tagIndex);\n }\n\n node.entry = {\n value,\n size: newSize,\n expiry,\n tags,\n lastAccessed: Date.now(),\n };\n\n listManager.moveToFront(node);\n\n return newSize - oldSize;\n }\n\n createNewEntry<T>(\n key: string,\n value: T,\n ttlMs: number | undefined,\n tags: string[] | undefined,\n defaultTtlMs: number | undefined,\n listManager: LRUListManager<unknown>,\n store: Map<string, LRUNode<unknown>>,\n ): [LRUNode<unknown>, number] {\n const size = this.estimateSizeOf(value);\n const expiry = this.calculateExpiry(ttlMs, defaultTtlMs);\n\n const entry: LRUEntry<unknown> = {\n value,\n size,\n expiry,\n tags,\n lastAccessed: Date.now(),\n };\n\n const node = new LRUNode(key, entry);\n store.set(key, node);\n listManager.addToFront(node);\n\n return [node, size];\n }\n\n updateTagIndex(\n tags: string[],\n key: string,\n tagIndex: Map<string, Set<string>>,\n ): void {\n for (const tag of tags) {\n if (!tagIndex.has(tag)) {\n tagIndex.set(tag, new Set());\n }\n tagIndex.get(tag)?.add(key);\n }\n }\n\n cleanupTags(\n tags: string[],\n key: string,\n tagIndex: Map<string, Set<string>>,\n ): void {\n for (const tag of tags) {\n const set = tagIndex.get(tag);\n if (set) {\n set.delete(key);\n if (set.size === 0) {\n tagIndex.delete(tag);\n }\n }\n }\n }\n\n private calculateExpiry(\n ttlMs: number | undefined,\n defaultTtlMs: number | undefined,\n ): number | undefined {\n if (typeof ttlMs === \"number\") {\n return Date.now() + ttlMs;\n }\n if (defaultTtlMs) {\n return Date.now() + defaultTtlMs;\n }\n return undefined;\n }\n}\n", "import type { CacheAdapter, LRUCacheOptions, LRUCacheStats, LRUEntry } from \"./types.ts\";\nimport { LRUNode } from \"./lru-node.ts\";\nimport { LRUListManager } from \"./lru-list-manager.ts\";\nimport { EvictionManager } from \"../../eviction/eviction-manager.ts\";\nimport { EntryManager } from \"./entry-manager.ts\";\n\nfunction defaultSizeEstimator(value: unknown): number {\n if (value === null || value === undefined) return 0;\n if (typeof value === \"string\") return value.length * 2;\n if (typeof value === \"number\" || typeof value === \"bigint\") return 8;\n if (typeof value === \"boolean\") return 4;\n if (value instanceof Uint8Array || ArrayBuffer.isView(value)) return value.byteLength;\n if (value instanceof ArrayBuffer) return value.byteLength;\n if (typeof Blob !== \"undefined\" && value instanceof Blob) return value.size;\n\n try {\n return JSON.stringify(value).length * 2;\n } catch {\n return 0;\n }\n}\n\nexport class LRUCacheAdapter implements CacheAdapter {\n private readonly store = new Map<string, LRUNode<unknown>>();\n private readonly tagIndex = new Map<string, Set<string>>();\n private readonly listManager = new LRUListManager<unknown>();\n private readonly evictionManager: EvictionManager<LRUEntry<unknown>>;\n private readonly entryManager: EntryManager;\n private currentSize = 0;\n private readonly maxEntries: number;\n private readonly maxSizeBytes: number;\n private readonly defaultTtlMs?: number;\n private readonly onEvict?: (key: string, value: unknown) => void;\n\n constructor(options: LRUCacheOptions = {}) {\n this.maxEntries = options.maxEntries || 1000;\n this.maxSizeBytes = options.maxSizeBytes || 50 * 1024 * 1024; // 50MB default\n this.defaultTtlMs = options.ttlMs;\n this.onEvict = options.onEvict;\n\n const estimateSizeOf = options.estimateSizeOf || defaultSizeEstimator;\n\n this.evictionManager = new EvictionManager({\n onEvict: this.onEvict,\n loggerContext: \"MemoryCache\",\n });\n this.entryManager = new EntryManager(estimateSizeOf);\n }\n\n get<T>(key: string): T | undefined {\n const node = this.store.get(key);\n if (!node) return undefined;\n\n if (this.evictionManager.isExpired(node.entry)) {\n this.delete(key);\n return undefined;\n }\n\n this.listManager.moveToFront(node);\n return node.entry.value as T;\n }\n\n set<T>(key: string, value: T, ttlMs?: number, tags?: string[]): void {\n const existingNode = this.store.get(key);\n\n if (existingNode) {\n const sizeDelta = this.entryManager.updateExistingEntry(\n existingNode,\n value,\n ttlMs,\n tags,\n this.defaultTtlMs,\n this.listManager,\n this.tagIndex,\n key,\n );\n this.currentSize += sizeDelta;\n } else {\n const [_node, size] = this.entryManager.createNewEntry(\n key,\n value,\n ttlMs,\n tags,\n this.defaultTtlMs,\n this.listManager,\n this.store,\n );\n this.currentSize += size;\n }\n\n if (tags && tags.length > 0) {\n this.entryManager.updateTagIndex(tags, key, this.tagIndex);\n }\n\n this.currentSize = this.evictionManager.enforceMemoryLimits(\n this.listManager,\n this.store,\n this.tagIndex,\n this.currentSize,\n this.maxEntries,\n this.maxSizeBytes,\n );\n }\n\n delete(key: string): void {\n const node = this.store.get(key);\n if (!node) return;\n\n this.listManager.removeNode(node);\n this.store.delete(key);\n this.currentSize -= node.entry.size;\n\n if (node.entry.tags) {\n this.entryManager.cleanupTags(node.entry.tags, key, this.tagIndex);\n }\n\n if (this.onEvict) {\n this.onEvict(key, node.entry.value);\n }\n }\n\n invalidateTag(tag: string): number {\n const set = this.tagIndex.get(tag);\n if (!set) return 0;\n\n let count = 0;\n for (const key of set) {\n this.delete(key);\n count++;\n }\n this.tagIndex.delete(tag);\n return count;\n }\n\n clear(): void {\n if (this.onEvict) {\n for (const [key, node] of this.store) {\n this.onEvict(key, node.entry.value);\n }\n }\n\n this.store.clear();\n this.tagIndex.clear();\n this.listManager.clear();\n this.currentSize = 0;\n }\n\n getStats(): LRUCacheStats {\n return {\n entries: this.store.size,\n sizeBytes: this.currentSize,\n maxEntries: this.maxEntries,\n maxSizeBytes: this.maxSizeBytes,\n tags: this.tagIndex.size,\n };\n }\n\n cleanupExpired(): number {\n const now = Date.now();\n let cleaned = 0;\n\n for (const [key, node] of this.store) {\n if (typeof node.entry.expiry === \"number\" && now > node.entry.expiry) {\n this.delete(key);\n cleaned++;\n }\n }\n\n return cleaned;\n }\n\n keys(): IterableIterator<string> {\n return this.store.keys();\n }\n\n has(key: string): boolean {\n return this.get(key) !== undefined;\n }\n}\n", "export interface GlobalWithDeno {\n Deno?: {\n env: {\n get(key: string): string | undefined;\n };\n };\n}\n\nexport interface GlobalWithProcess {\n process?: {\n env: Record<string, string | undefined>;\n version?: string;\n versions?: Record<string, string>;\n };\n}\n\nexport interface GlobalWithBun {\n Bun?: {\n version: string;\n };\n}\n\nexport function hasDenoRuntime(global: unknown): global is GlobalWithDeno {\n return (\n typeof global === \"object\" &&\n global !== null &&\n \"Deno\" in global &&\n typeof (global as GlobalWithDeno).Deno?.env?.get === \"function\"\n );\n}\n\nexport function hasNodeProcess(global: unknown): global is GlobalWithProcess {\n return (\n typeof global === \"object\" &&\n global !== null &&\n \"process\" in global &&\n typeof (global as GlobalWithProcess).process?.env === \"object\"\n );\n}\n\nexport function hasBunRuntime(global: unknown): global is GlobalWithBun {\n return (\n typeof global === \"object\" &&\n global !== null &&\n \"Bun\" in global &&\n typeof (global as GlobalWithBun).Bun !== \"undefined\"\n );\n}\n", "import type { GlobalWithDeno, GlobalWithProcess } from \"../runtime-guards.ts\";\nimport { hasDenoRuntime, hasNodeProcess } from \"../runtime-guards.ts\";\n\nexport function getEnvironmentVariable(name: string): string | undefined {\n try {\n if (typeof Deno !== \"undefined\" && hasDenoRuntime(globalThis)) {\n const value = (globalThis as GlobalWithDeno).Deno?.env.get(name);\n return value === \"\" ? undefined : value;\n }\n if (hasNodeProcess(globalThis)) {\n const value = (globalThis as GlobalWithProcess).process?.env[name];\n return value === \"\" ? undefined : value;\n }\n } catch {\n return undefined;\n }\n return undefined;\n}\n\nexport function isTestEnvironment(): boolean {\n return getEnvironmentVariable(\"NODE_ENV\") === \"test\";\n}\n\nexport function isProductionEnvironment(): boolean {\n return getEnvironmentVariable(\"NODE_ENV\") === \"production\";\n}\n\nexport function isDevelopmentEnvironment(): boolean {\n const env = getEnvironmentVariable(\"NODE_ENV\");\n return env === \"development\" || env === undefined;\n}\n", "import { getEnvironmentVariable } from \"./env.ts\";\n\nexport enum LogLevel {\n DEBUG = 0,\n INFO = 1,\n WARN = 2,\n ERROR = 3,\n}\n\nexport interface Logger {\n debug(message: string, ...args: unknown[]): void;\n info(message: string, ...args: unknown[]): void;\n warn(message: string, ...args: unknown[]): void;\n error(message: string, ...args: unknown[]): void;\n time<T>(label: string, fn: () => Promise<T>): Promise<T>;\n}\n\nconst originalConsole = {\n debug: console.debug,\n log: console.log,\n warn: console.warn,\n error: console.error,\n};\n\nlet cachedLogLevel: LogLevel | undefined;\n\nfunction resolveLogLevel(force = false): LogLevel {\n if (force || cachedLogLevel === undefined) {\n cachedLogLevel = getDefaultLevel();\n }\n return cachedLogLevel;\n}\n\nclass ConsoleLogger implements Logger {\n constructor(\n private prefix: string,\n private level: LogLevel = resolveLogLevel(),\n ) {}\n\n setLevel(level: LogLevel): void {\n this.level = level;\n }\n\n getLevel(): LogLevel {\n return this.level;\n }\n\n debug(message: string, ...args: unknown[]): void {\n if (this.level <= LogLevel.DEBUG) {\n console.debug(`[${this.prefix}] DEBUG: ${message}`, ...args);\n }\n }\n\n info(message: string, ...args: unknown[]): void {\n if (this.level <= LogLevel.INFO) {\n console.log(`[${this.prefix}] ${message}`, ...args);\n }\n }\n\n warn(message: string, ...args: unknown[]): void {\n if (this.level <= LogLevel.WARN) {\n console.warn(`[${this.prefix}] WARN: ${message}`, ...args);\n }\n }\n\n error(message: string, ...args: unknown[]): void {\n if (this.level <= LogLevel.ERROR) {\n console.error(`[${this.prefix}] ERROR: ${message}`, ...args);\n }\n }\n\n async time<T>(label: string, fn: () => Promise<T>): Promise<T> {\n const start = performance.now();\n try {\n const result = await fn();\n const end = performance.now();\n this.debug(`${label} completed in ${(end - start).toFixed(2)}ms`);\n return result;\n } catch (error) {\n const end = performance.now();\n this.error(`${label} failed after ${(end - start).toFixed(2)}ms`, error);\n throw error;\n }\n }\n}\n\nfunction parseLogLevel(levelString: string | undefined): LogLevel | undefined {\n if (!levelString) return undefined;\n const upper = levelString.toUpperCase();\n switch (upper) {\n case \"DEBUG\":\n return LogLevel.DEBUG;\n case \"WARN\":\n return LogLevel.WARN;\n case \"ERROR\":\n return LogLevel.ERROR;\n case \"INFO\":\n return LogLevel.INFO;\n default:\n return undefined;\n }\n}\n\nconst getDefaultLevel = (): LogLevel => {\n const envLevel = getEnvironmentVariable(\"LOG_LEVEL\");\n const parsedLevel = parseLogLevel(envLevel);\n if (parsedLevel !== undefined) return parsedLevel;\n\n const debugFlag = getEnvironmentVariable(\"VERYFRONT_DEBUG\");\n if (debugFlag === \"1\" || debugFlag === \"true\") return LogLevel.DEBUG;\n\n return LogLevel.INFO;\n};\n\nconst trackedLoggers = new Set<ConsoleLogger>();\n\nfunction createLogger(prefix: string): ConsoleLogger {\n const logger = new ConsoleLogger(prefix);\n trackedLoggers.add(logger);\n return logger;\n}\n\nexport const cliLogger = createLogger(\"CLI\");\nexport const serverLogger = createLogger(\"SERVER\");\nexport const rendererLogger = createLogger(\"RENDERER\");\nexport const bundlerLogger = createLogger(\"BUNDLER\");\nexport const agentLogger = createLogger(\"AGENT\");\n\nexport const logger = createLogger(\"VERYFRONT\");\n\ntype LoggerResetOptions = {\n restoreConsole?: boolean;\n};\n\nexport function __loggerResetForTests(options: LoggerResetOptions = {}): void {\n const updatedLevel = resolveLogLevel(true);\n for (const instance of trackedLoggers) {\n instance.setLevel(updatedLevel);\n }\n\n if (options.restoreConsole) {\n console.debug = originalConsole.debug;\n console.log = originalConsole.log;\n console.warn = originalConsole.warn;\n console.error = originalConsole.error;\n }\n}\n", "export const SECONDS_PER_MINUTE = 60;\n\nexport const MINUTES_PER_HOUR = 60;\n\nexport const HOURS_PER_DAY = 24;\n\nexport const MS_PER_SECOND = 1000;\n\nexport const DEFAULT_LRU_MAX_ENTRIES = 100;\n\nexport const COMPONENT_LOADER_MAX_ENTRIES = 100;\nexport const COMPONENT_LOADER_TTL_MS = 10 * SECONDS_PER_MINUTE * MS_PER_SECOND;\n\nexport const MDX_RENDERER_MAX_ENTRIES = 200;\nexport const MDX_RENDERER_TTL_MS = 10 * SECONDS_PER_MINUTE * MS_PER_SECOND;\n\nexport const RENDERER_CORE_MAX_ENTRIES = 100;\nexport const RENDERER_CORE_TTL_MS = 5 * SECONDS_PER_MINUTE * MS_PER_SECOND;\n\nexport const TSX_LAYOUT_MAX_ENTRIES = 50;\nexport const TSX_LAYOUT_TTL_MS = 10 * SECONDS_PER_MINUTE * MS_PER_SECOND;\n\nexport const DATA_FETCHING_MAX_ENTRIES = 200;\nexport const DATA_FETCHING_TTL_MS = 10 * SECONDS_PER_MINUTE * MS_PER_SECOND;\n\nexport const MDX_CACHE_TTL_PRODUCTION_MS = HOURS_PER_DAY * MINUTES_PER_HOUR * SECONDS_PER_MINUTE *\n MS_PER_SECOND;\nexport const MDX_CACHE_TTL_DEVELOPMENT_MS = 5 * SECONDS_PER_MINUTE * MS_PER_SECOND;\n\nexport const BUNDLE_CACHE_TTL_PRODUCTION_MS = HOURS_PER_DAY * MINUTES_PER_HOUR *\n SECONDS_PER_MINUTE * MS_PER_SECOND;\nexport const BUNDLE_CACHE_TTL_DEVELOPMENT_MS = 5 * SECONDS_PER_MINUTE * MS_PER_SECOND;\n\nexport const BUNDLE_MANIFEST_PROD_TTL_MS = 7 * HOURS_PER_DAY * MINUTES_PER_HOUR *\n SECONDS_PER_MINUTE * MS_PER_SECOND;\nexport const BUNDLE_MANIFEST_DEV_TTL_MS = MINUTES_PER_HOUR * SECONDS_PER_MINUTE * MS_PER_SECOND;\n\nexport const RSC_MANIFEST_CACHE_TTL_MS = 5000;\n\nexport const SERVER_ACTION_DEFAULT_TTL_SEC = MINUTES_PER_HOUR * SECONDS_PER_MINUTE;\n\nexport const DENO_KV_SAFE_SIZE_LIMIT_BYTES = 64_000;\n\nexport const HTTP_CACHE_SHORT_MAX_AGE_SEC = 60;\nexport const HTTP_CACHE_MEDIUM_MAX_AGE_SEC = 3600;\nexport const HTTP_CACHE_LONG_MAX_AGE_SEC = 31536000;\n\nexport const ONE_DAY_MS = HOURS_PER_DAY * MINUTES_PER_HOUR * SECONDS_PER_MINUTE * MS_PER_SECOND;\n\nexport const CACHE_CLEANUP_INTERVAL_MS = 60000;\n\nexport const LRU_DEFAULT_MAX_ENTRIES = 1000;\n\nexport const LRU_DEFAULT_MAX_SIZE_BYTES = 50 * 1024 * 1024;\n\nexport const CLEANUP_INTERVAL_MULTIPLIER = 2;\n", "{\n \"name\": \"veryfront\",\n \"version\": \"0.0.43\",\n \"exclude\": [\n \"npm/\",\n \"dist/\",\n \"coverage/\",\n \"scripts/\",\n \"examples/\",\n \"tests/\",\n \"src/cli/templates/files/\"\n ],\n \"exports\": {\n \".\": \"./src/index.ts\",\n \"./cli\": \"./src/cli/main.ts\",\n \"./server\": \"./src/server/index.ts\",\n \"./middleware\": \"./src/middleware/index.ts\",\n \"./components\": \"./src/react/components/index.ts\",\n \"./data\": \"./src/data/index.ts\",\n \"./config\": \"./src/core/config/index.ts\",\n \"./platform\": \"./src/platform/index.ts\",\n \"./ai\": \"./src/ai/index.ts\",\n \"./ai/client\": \"./src/ai/client.ts\",\n \"./ai/react\": \"./src/ai/react/index.ts\",\n \"./ai/primitives\": \"./src/ai/react/primitives/index.ts\",\n \"./ai/components\": \"./src/ai/react/components/index.ts\",\n \"./ai/production\": \"./src/ai/production/index.ts\",\n \"./ai/dev\": \"./src/ai/dev/index.ts\",\n \"./ai/workflow\": \"./src/ai/workflow/index.ts\",\n \"./ai/workflow/react\": \"./src/ai/workflow/react/index.ts\"\n },\n \"imports\": {\n \"@veryfront\": \"./src/index.ts\",\n \"@veryfront/\": \"./src/\",\n \"@veryfront/ai\": \"./src/ai/index.ts\",\n \"@veryfront/ai/\": \"./src/ai/\",\n \"@veryfront/platform\": \"./src/platform/index.ts\",\n \"@veryfront/platform/\": \"./src/platform/\",\n \"@veryfront/types\": \"./src/core/types/index.ts\",\n \"@veryfront/types/\": \"./src/core/types/\",\n \"@veryfront/utils\": \"./src/core/utils/index.ts\",\n \"@veryfront/utils/\": \"./src/core/utils/\",\n \"@veryfront/middleware\": \"./src/middleware/index.ts\",\n \"@veryfront/middleware/\": \"./src/middleware/\",\n \"@veryfront/errors\": \"./src/core/errors/index.ts\",\n \"@veryfront/errors/\": \"./src/core/errors/\",\n \"@veryfront/config\": \"./src/core/config/index.ts\",\n \"@veryfront/config/\": \"./src/core/config/\",\n \"@veryfront/observability\": \"./src/observability/index.ts\",\n \"@veryfront/observability/\": \"./src/observability/\",\n \"@veryfront/routing\": \"./src/routing/index.ts\",\n \"@veryfront/routing/\": \"./src/routing/\",\n \"@veryfront/transforms\": \"./src/build/transforms/index.ts\",\n \"@veryfront/transforms/\": \"./src/build/transforms/\",\n \"@veryfront/data\": \"./src/data/index.ts\",\n \"@veryfront/data/\": \"./src/data/\",\n \"@veryfront/security\": \"./src/security/index.ts\",\n \"@veryfront/security/\": \"./src/security/\",\n \"@veryfront/components\": \"./src/react/components/index.ts\",\n \"@veryfront/react\": \"./src/react/index.ts\",\n \"@veryfront/react/\": \"./src/react/\",\n \"@veryfront/html\": \"./src/html/index.ts\",\n \"@veryfront/html/\": \"./src/html/\",\n \"@veryfront/rendering\": \"./src/rendering/index.ts\",\n \"@veryfront/rendering/\": \"./src/rendering/\",\n \"@veryfront/build\": \"./src/build/index.ts\",\n \"@veryfront/build/\": \"./src/build/\",\n \"@veryfront/server\": \"./src/server/index.ts\",\n \"@veryfront/server/\": \"./src/server/\",\n \"@veryfront/modules\": \"./src/module-system/index.ts\",\n \"@veryfront/modules/\": \"./src/module-system/\",\n \"@veryfront/compat/console\": \"./src/platform/compat/console/index.ts\",\n \"@veryfront/compat/\": \"./src/platform/compat/\",\n \"std/\": \"https://deno.land/std@0.220.0/\",\n \"@std/path\": \"https://deno.land/std@0.220.0/path/mod.ts\",\n \"@std/testing/bdd.ts\": \"https://deno.land/std@0.220.0/testing/bdd.ts\",\n \"@std/expect\": \"https://deno.land/std@0.220.0/expect/mod.ts\",\n \"csstype\": \"https://esm.sh/csstype@3.2.3\",\n \"@types/react\": \"https://esm.sh/@types/react@18.3.27?deps=csstype@3.2.3\",\n \"@types/react-dom\": \"https://esm.sh/@types/react-dom@18.3.7?deps=csstype@3.2.3\",\n \"react\": \"https://esm.sh/react@18.3.1\",\n \"react-dom\": \"https://esm.sh/react-dom@18.3.1\",\n \"react-dom/server\": \"https://esm.sh/react-dom@18.3.1/server\",\n \"react-dom/client\": \"https://esm.sh/react-dom@18.3.1/client\",\n \"react/jsx-runtime\": \"https://esm.sh/react@18.3.1/jsx-runtime\",\n \"react/jsx-dev-runtime\": \"https://esm.sh/react@18.3.1/jsx-dev-runtime\",\n \"@mdx-js/mdx\": \"https://esm.sh/@mdx-js/mdx@3.0.0?deps=react@18.3.1,react-dom@18.3.1\",\n \"@mdx-js/react\": \"https://esm.sh/@mdx-js/react@3.0.0?deps=react@18.3.1,react-dom@18.3.1\",\n \"unist-util-visit\": \"https://esm.sh/unist-util-visit@5.0.0\",\n \"mdast-util-to-string\": \"https://esm.sh/mdast-util-to-string@4.0.0\",\n \"github-slugger\": \"https://esm.sh/github-slugger@2.0.0\",\n \"remark-gfm\": \"https://esm.sh/remark-gfm@4.0.1\",\n \"remark-frontmatter\": \"https://esm.sh/remark-frontmatter@5.0.0\",\n \"rehype-highlight\": \"https://esm.sh/rehype-highlight@7.0.2\",\n \"rehype-slug\": \"https://esm.sh/rehype-slug@6.0.0\",\n \"esbuild\": \"https://deno.land/x/esbuild@v0.20.1/wasm.js\",\n \"esbuild/mod.js\": \"https://deno.land/x/esbuild@v0.20.1/mod.js\",\n \"es-module-lexer\": \"https://esm.sh/es-module-lexer@1.5.0\",\n \"zod\": \"https://esm.sh/zod@3.22.0\",\n \"mime-types\": \"https://esm.sh/mime-types@2.1.35\",\n \"mdast\": \"https://esm.sh/@types/mdast@4.0.3\",\n \"hast\": \"https://esm.sh/@types/hast@3.0.3\",\n \"unist\": \"https://esm.sh/@types/unist@3.0.2\",\n \"unified\": \"https://esm.sh/unified@11.0.5?dts\",\n \"ai\": \"https://esm.sh/ai@5.0.76?deps=react@18.3.1,react-dom@18.3.1\",\n \"ai/react\": \"https://esm.sh/@ai-sdk/react@2.0.59?deps=react@18.3.1,react-dom@18.3.1\",\n \"@ai-sdk/react\": \"https://esm.sh/@ai-sdk/react@2.0.59?deps=react@18.3.1,react-dom@18.3.1\",\n \"@ai-sdk/openai\": \"https://esm.sh/@ai-sdk/openai@2.0.1\",\n \"@ai-sdk/anthropic\": \"https://esm.sh/@ai-sdk/anthropic@2.0.4\",\n \"unocss\": \"https://esm.sh/unocss@0.59.0\",\n \"@unocss/core\": \"https://esm.sh/@unocss/core@0.59.0\",\n \"@unocss/preset-wind\": \"https://esm.sh/@unocss/preset-wind@0.59.0\",\n \"redis\": \"npm:redis\"\n },\n \"compilerOptions\": {\n \"jsx\": \"react-jsx\",\n \"jsxImportSource\": \"react\",\n \"strict\": true,\n \"noImplicitAny\": true,\n \"noUncheckedIndexedAccess\": true,\n \"types\": [],\n \"lib\": [\n \"deno.window\",\n \"dom\",\n \"dom.iterable\",\n \"dom.asynciterable\",\n \"deno.ns\"\n ]\n },\n \"tasks\": {\n \"setup\": \"deno run --allow-all scripts/setup.ts\",\n \"dev\": \"deno run --allow-all --no-lock --unstable-net --unstable-worker-options src/cli/main.ts dev\",\n \"build\": \"deno compile --allow-all --output ../../bin/veryfront src/cli/main.ts\",\n \"build:npm\": \"deno run -A scripts/build-npm.ts\",\n \"release\": \"deno run -A scripts/release.ts\",\n \"test\": \"DENO_JOBS=1 deno test --parallel --fail-fast --allow-all --unstable-worker-options --unstable-net\",\n \"test:unit\": \"DENO_JOBS=1 deno test --parallel --allow-all --v8-flags=--max-old-space-size=8192 --ignore=tests --unstable-worker-options --unstable-net\",\n \"test:integration\": \"DENO_JOBS=1 deno test --parallel --fail-fast --allow-all tests --unstable-worker-options --unstable-net\",\n \"test:coverage\": \"rm -rf coverage && DENO_JOBS=1 deno test --parallel --fail-fast --allow-all --coverage=coverage --unstable-worker-options --unstable-net || exit 1\",\n \"test:coverage:unit\": \"rm -rf coverage && DENO_JOBS=1 deno test --parallel --fail-fast --allow-all --coverage=coverage --ignore=tests --unstable-worker-options --unstable-net || exit 1\",\n \"test:coverage:integration\": \"rm -rf coverage && DENO_JOBS=1 deno test --parallel --fail-fast --allow-all --coverage=coverage tests --unstable-worker-options --unstable-net || exit 1\",\n \"coverage:report\": \"deno coverage coverage --include=src/ --exclude=tests --exclude=src/**/*_test.ts --exclude=src/**/*_test.tsx --exclude=src/**/*.test.ts --exclude=src/**/*.test.tsx --lcov > coverage/lcov.info && deno run --allow-read scripts/check-coverage.ts 80\",\n \"coverage:html\": \"deno coverage coverage --include=src/ --exclude=tests --exclude=src/**/*_test.ts --exclude=src/**/*_test.tsx --exclude=src/**/*.test.ts --exclude=src/**/*.test.tsx --html\",\n \"lint\": \"DENO_NO_PACKAGE_JSON=1 deno lint src/\",\n \"fmt\": \"deno fmt src/\",\n \"typecheck\": \"deno check src/index.ts src/cli/main.ts src/server/index.ts src/routing/api/index.ts src/rendering/index.ts src/platform/index.ts src/platform/adapters/index.ts src/build/index.ts src/build/production-build/index.ts src/build/transforms/index.ts src/core/config/index.ts src/core/utils/index.ts src/data/index.ts src/security/index.ts src/middleware/index.ts src/server/handlers/dev/index.ts src/server/handlers/request/api/index.ts src/rendering/cache/index.ts src/rendering/cache/stores/index.ts src/rendering/rsc/actions/index.ts src/html/index.ts src/module-system/index.ts\",\n \"docs:check-links\": \"deno run -A scripts/check-doc-links.ts\",\n \"lint:ban-console\": \"deno run --allow-read scripts/ban-console.ts\",\n \"lint:ban-deep-imports\": \"deno run --allow-read scripts/ban-deep-imports.ts\",\n \"lint:ban-internal-root-imports\": \"deno run --allow-read scripts/ban-internal-root-imports.ts\",\n \"lint:check-awaits\": \"deno run --allow-read scripts/check-unawaited-promises.ts\",\n \"lint:platform\": \"deno run --allow-read scripts/lint-platform-agnostic.ts\",\n \"check:circular\": \"deno run -A jsr:@cunarist/deno-circular-deps src/index.ts\"\n },\n \"lint\": {\n \"include\": [\n \"src/**/*.ts\",\n \"src/**/*.tsx\"\n ],\n \"exclude\": [\n \"dist/\",\n \"coverage/\"\n ],\n \"rules\": {\n \"tags\": [\n \"recommended\"\n ],\n \"include\": [\n \"ban-untagged-todo\"\n ],\n \"exclude\": [\n \"no-explicit-any\",\n \"no-process-global\",\n \"no-console\"\n ]\n }\n },\n \"fmt\": {\n \"include\": [\n \"src/**/*.ts\",\n \"src/**/*.tsx\"\n ],\n \"exclude\": [\n \"dist/\",\n \"coverage/\"\n ],\n \"options\": {\n \"useTabs\": false,\n \"lineWidth\": 100,\n \"indentWidth\": 2,\n \"semiColons\": true,\n \"singleQuote\": false,\n \"proseWrap\": \"preserve\"\n }\n }\n}\n", "export const isDeno = typeof Deno !== \"undefined\";\nexport const isNode =\n typeof (globalThis as { process?: { versions?: { node?: string } } }).process !== \"undefined\" &&\n (globalThis as { process?: { versions?: { node?: string } } }).process?.versions?.node !==\n undefined;\nexport const isBun = typeof (globalThis as { Bun?: unknown }).Bun !== \"undefined\";\nexport const isCloudflare = typeof globalThis !== \"undefined\" && \"caches\" in globalThis &&\n \"WebSocketPair\" in globalThis;\n\n/**\n * Detect if running in Node.js (vs Deno)\n * Use this function instead of the constant when runtime detection needs to happen\n * at call time (e.g., when bundled with esbuild's __esm lazy initialization pattern)\n */\nexport function isNodeRuntime(): boolean {\n // deno-lint-ignore no-explicit-any\n const _global = globalThis as any;\n return typeof Deno === \"undefined\" && typeof _global.process !== \"undefined\" &&\n !!_global.process?.versions?.node;\n}\n", "import { isDeno as IS_DENO } from \"./runtime.ts\";\n\nconst nodeProcess = (globalThis as { process?: typeof import(\"node:process\") }).process;\nconst hasNodeProcess = !!nodeProcess?.versions?.node;\n\nexport function getArgs(): string[] {\n if (IS_DENO) {\n return Deno.args;\n }\n if (hasNodeProcess) {\n return nodeProcess!.argv.slice(2);\n }\n return [];\n}\n\nexport function exit(code?: number): never {\n if (IS_DENO) {\n Deno.exit(code);\n }\n if (hasNodeProcess) {\n nodeProcess!.exit(code);\n }\n throw new Error(\"exit() is not supported in this runtime\");\n}\n\nexport function cwd(): string {\n if (IS_DENO) {\n return Deno.cwd();\n }\n if (hasNodeProcess) {\n return nodeProcess!.cwd();\n }\n throw new Error(\"cwd() is not supported in this runtime\");\n}\n\nexport function chdir(directory: string): void {\n if (IS_DENO) {\n Deno.chdir(directory);\n } else {\n if (hasNodeProcess) {\n nodeProcess!.chdir(directory);\n return;\n }\n throw new Error(\"chdir() is not supported in this runtime\");\n }\n}\n\nexport function env(): Record<string, string> {\n if (IS_DENO) {\n return Deno.env.toObject();\n }\n if (hasNodeProcess) {\n return nodeProcess!.env as Record<string, string>;\n }\n return {};\n}\n\nexport function getEnv(key: string): string | undefined {\n if (IS_DENO) {\n return Deno.env.get(key);\n }\n if (hasNodeProcess) {\n return nodeProcess!.env[key];\n }\n return undefined;\n}\n\n/**\n * Get an environment variable or throw if not set\n * @throws Error if the environment variable is not set\n */\nexport function requireEnv(key: string): string {\n const value = getEnv(key);\n if (value === undefined) {\n throw new Error(`Required environment variable \"${key}\" is not set`);\n }\n return value;\n}\n\nexport function setEnv(key: string, value: string): void {\n if (IS_DENO) {\n Deno.env.set(key, value);\n } else {\n if (hasNodeProcess) {\n nodeProcess!.env[key] = value;\n return;\n }\n throw new Error(\"setEnv() is not supported in this runtime\");\n }\n}\n\nexport function deleteEnv(key: string): void {\n if (IS_DENO) {\n Deno.env.delete(key);\n } else {\n if (hasNodeProcess) {\n delete nodeProcess!.env[key];\n return;\n }\n throw new Error(\"deleteEnv() is not supported in this runtime\");\n }\n}\n\nexport function pid(): number {\n if (IS_DENO) {\n return Deno.pid;\n }\n if (hasNodeProcess) {\n return nodeProcess!.pid;\n }\n return 0;\n}\n\nexport function ppid(): number {\n if (IS_DENO && \"ppid\" in Deno) {\n return Deno.ppid || 0;\n }\n if (hasNodeProcess) {\n return nodeProcess!.ppid || 0;\n }\n return 0;\n}\n\nexport function memoryUsage(): {\n rss: number;\n heapTotal: number;\n heapUsed: number;\n external: number;\n} {\n if (IS_DENO) {\n const usage = Deno.memoryUsage();\n return {\n rss: usage.rss,\n heapTotal: usage.heapTotal,\n heapUsed: usage.heapUsed,\n external: usage.external,\n };\n }\n\n if (!hasNodeProcess) {\n throw new Error(\"memoryUsage() is not supported in this runtime\");\n }\n\n const usage = nodeProcess!.memoryUsage();\n return {\n rss: usage.rss,\n heapTotal: usage.heapTotal,\n heapUsed: usage.heapUsed,\n external: usage.external || 0,\n };\n}\n\n/**\n * Check if stdin is a TTY (terminal)\n */\nexport function isInteractive(): boolean {\n if (IS_DENO) {\n return Deno.stdin.isTerminal();\n }\n if (hasNodeProcess) {\n return nodeProcess!.stdin.isTTY ?? false;\n }\n return false;\n}\n\n/**\n * Get network interfaces\n */\nexport async function getNetworkInterfaces(): Promise<\n Array<{ name: string; address: string; family: \"IPv4\" | \"IPv6\" }>\n> {\n if (IS_DENO) {\n const interfaces = Deno.networkInterfaces();\n return interfaces.map((iface) => ({\n name: iface.name,\n address: iface.address,\n family: iface.family as \"IPv4\" | \"IPv6\",\n }));\n }\n\n if (!hasNodeProcess) {\n throw new Error(\"networkInterfaces() is not supported in this runtime\");\n }\n\n const os = await import(\"node:os\");\n const interfaces = os.networkInterfaces();\n const result: Array<{ name: string; address: string; family: \"IPv4\" | \"IPv6\" }> = [];\n\n for (const [name, addrs] of Object.entries(interfaces)) {\n if (!addrs) continue;\n for (const addr of addrs) {\n result.push({\n name,\n address: addr.address,\n family: addr.family as \"IPv4\" | \"IPv6\",\n });\n }\n }\n\n return result;\n}\n\n/**\n * Get runtime version string\n */\nexport function getRuntimeVersion(): string {\n if (IS_DENO) {\n return `Deno ${Deno.version.deno}`;\n }\n if (\"Bun\" in globalThis) {\n return `Bun ${(globalThis as unknown as { Bun: { version: string } }).Bun.version}`;\n }\n if (hasNodeProcess) {\n return `Node.js ${nodeProcess!.version}`;\n }\n return \"unknown\";\n}\n\n/**\n * Register a signal handler (SIGINT, SIGTERM) for graceful shutdown\n */\nexport function onSignal(signal: \"SIGINT\" | \"SIGTERM\", handler: () => void): void {\n if (IS_DENO) {\n Deno.addSignalListener(signal, handler);\n } else if (hasNodeProcess) {\n nodeProcess!.on(signal, handler);\n }\n}\n\n/**\n * Unreference a timer to prevent it from keeping the process alive\n */\nexport function unrefTimer(timerId: ReturnType<typeof setInterval>): void {\n if (IS_DENO) {\n Deno.unrefTimer(timerId as number);\n } else if (timerId && typeof timerId === \"object\" && \"unref\" in timerId) {\n (timerId as { unref: () => void }).unref();\n }\n}\n\n/**\n * Get the executable path of the current runtime\n */\nexport function execPath(): string {\n if (IS_DENO) {\n return Deno.execPath();\n }\n if (hasNodeProcess) {\n return nodeProcess!.execPath;\n }\n return \"\";\n}\n\n/**\n * Get process uptime in seconds\n * Returns OS uptime on Deno, process uptime on Node.js\n */\nexport function uptime(): number {\n if (IS_DENO) {\n // Deno.osUptime() returns system uptime in seconds\n return Deno.osUptime?.() ?? 0;\n }\n if (hasNodeProcess) {\n // process.uptime() returns process uptime in seconds\n return nodeProcess!.uptime?.() ?? 0;\n }\n return 0;\n}\n\n/**\n * Get stdout stream for writing\n * Returns null if not available (e.g., in browser/workers)\n */\nexport function getStdout(): { write: (data: string) => void } | null {\n if (IS_DENO) {\n const encoder = new TextEncoder();\n return {\n write: (data: string) => {\n Deno.stdout.writeSync(encoder.encode(data));\n },\n };\n }\n if (hasNodeProcess && nodeProcess!.stdout) {\n return {\n write: (data: string) => {\n nodeProcess!.stdout.write(data);\n },\n };\n }\n return null;\n}\n\n// Cached Node.js modules for synchronous prompt\nlet cachedNodeFs: typeof import(\"node:fs\") | null = null;\n\n/**\n * Synchronous prompt function that works across Deno and Node.js\n * Displays a message and reads user input from stdin\n */\nexport function promptSync(message?: string): string | null {\n if (IS_DENO) {\n // Deno has a built-in prompt() function\n return prompt(message);\n }\n\n if (hasNodeProcess) {\n // Print the message\n if (message) {\n nodeProcess!.stdout.write(message + \" \");\n }\n\n // Lazy load fs module\n if (!cachedNodeFs) {\n // Dynamic import converted to sync require for bundling\n // @ts-ignore - dynamic require for Node.js\n cachedNodeFs = globalThis.require?.(\"node:fs\") || null;\n if (!cachedNodeFs) {\n // Try alternative approach\n try {\n // @ts-ignore: __require is injected by bundlers for Node.js require\n cachedNodeFs = __require(\"node:fs\");\n } catch {\n return null;\n }\n }\n }\n\n if (!cachedNodeFs) {\n return null;\n }\n\n // Read synchronously using fs\n // This works by reading from file descriptor 0 (stdin)\n // Use Uint8Array for cross-platform compatibility\n const bufferSize = 1024;\n const uint8Array = new Uint8Array(bufferSize);\n let input = \"\";\n\n try {\n // Read from stdin (fd 0) synchronously\n const bytesRead = cachedNodeFs.readSync(0, uint8Array, 0, bufferSize, null);\n if (bytesRead > 0) {\n const decoder = new TextDecoder(\"utf-8\");\n input = decoder.decode(uint8Array.subarray(0, bytesRead)).trim();\n }\n } catch {\n // If stdin is not available or EOF, return null\n return null;\n }\n\n return input || null;\n }\n\n return null;\n}\n", "import denoConfig from \"../../../deno.json\" with { type: \"json\" };\nimport { getEnv } from \"../../platform/compat/process.ts\";\n\nexport const VERSION: string = getEnv(\"VERYFRONT_VERSION\") ||\n (typeof denoConfig.version === \"string\" ? denoConfig.version : \"0.0.0\");\n", "export const KB_IN_BYTES = 1024;\n\nexport const HTTP_MODULE_FETCH_TIMEOUT_MS = 2500;\n\nexport const HMR_RECONNECT_DELAY_MS = 1000;\n\nexport const HMR_RELOAD_DELAY_MS = 1000;\n\nexport const HMR_FILE_WATCHER_DEBOUNCE_MS = 100;\n\nexport const HMR_KEEP_ALIVE_INTERVAL_MS = 30000;\n\nexport const DASHBOARD_RECONNECT_DELAY_MS = 3000;\n\nexport const SERVER_FUNCTION_DEFAULT_TIMEOUT_MS = 30000;\n\nexport const PREFETCH_MAX_SIZE_BYTES = 200 * KB_IN_BYTES;\n\nexport const PREFETCH_DEFAULT_TIMEOUT_MS = 10000;\n\nexport const PREFETCH_DEFAULT_DELAY_MS = 200;\n\nexport const HTTP_OK = 200;\n\nexport const HTTP_NO_CONTENT = 204;\n\nexport const HTTP_CREATED = 201;\n\nexport const HTTP_REDIRECT_FOUND = 302;\n\nexport const HTTP_NOT_MODIFIED = 304;\n\nexport const HTTP_BAD_REQUEST = 400;\n\nexport const HTTP_UNAUTHORIZED = 401;\n\nexport const HTTP_FORBIDDEN = 403;\n\nexport const HTTP_NOT_FOUND = 404;\n\nexport const HTTP_METHOD_NOT_ALLOWED = 405;\n\nexport const HTTP_GONE = 410;\n\nexport const HTTP_PAYLOAD_TOO_LARGE = 413;\n\nexport const HTTP_URI_TOO_LONG = 414;\n\nexport const HTTP_TOO_MANY_REQUESTS = 429;\n\nexport const HTTP_REQUEST_HEADER_FIELDS_TOO_LARGE = 431;\n\nexport const HTTP_SERVER_ERROR = 500;\n\nexport const HTTP_INTERNAL_SERVER_ERROR = 500;\n\nexport const HTTP_BAD_GATEWAY = 502;\n\nexport const HTTP_NOT_IMPLEMENTED = 501;\n\nexport const HTTP_UNAVAILABLE = 503;\n\nexport const HTTP_NETWORK_CONNECT_TIMEOUT = 599;\n\nexport const HTTP_STATUS_SUCCESS_MIN = 200;\n\nexport const HTTP_STATUS_REDIRECT_MIN = 300;\n\nexport const HTTP_STATUS_CLIENT_ERROR_MIN = 400;\n\nexport const HTTP_STATUS_SERVER_ERROR_MIN = 500;\n\nexport const HTTP_CONTENT_TYPES = {\n JS: \"application/javascript; charset=utf-8\",\n JSON: \"application/json; charset=utf-8\",\n HTML: \"text/html; charset=utf-8\",\n CSS: \"text/css; charset=utf-8\",\n TEXT: \"text/plain; charset=utf-8\",\n} as const;\n\nimport { MS_PER_SECOND, SECONDS_PER_MINUTE } from \"./cache.ts\";\n\nexport const MS_PER_MINUTE = 60000;\n\nexport { MS_PER_SECOND, SECONDS_PER_MINUTE };\n\nexport const HTTP_CONTENT_TYPE_IMAGE_PNG = \"image/png\";\n\nexport const HTTP_CONTENT_TYPE_IMAGE_JPEG = \"image/jpeg\";\n\nexport const HTTP_CONTENT_TYPE_IMAGE_WEBP = \"image/webp\";\n\nexport const HTTP_CONTENT_TYPE_IMAGE_AVIF = \"image/avif\";\n\nexport const HTTP_CONTENT_TYPE_IMAGE_SVG = \"image/svg+xml\";\n\nexport const HTTP_CONTENT_TYPE_IMAGE_GIF = \"image/gif\";\n\nexport const HTTP_CONTENT_TYPE_IMAGE_ICO = \"image/x-icon\";\n", "import { KB_IN_BYTES } from \"./http.ts\";\n\nexport const HMR_MAX_MESSAGE_SIZE_BYTES = 1024 * KB_IN_BYTES;\n\nexport const HMR_MAX_MESSAGES_PER_MINUTE = 100;\n\nexport const HMR_CLIENT_RELOAD_DELAY_MS = 3000;\n\nexport const HMR_PORT_OFFSET = 1;\n\nexport const HMR_RATE_LIMIT_WINDOW_MS = 60000;\n\nexport const HMR_CLOSE_NORMAL = 1000;\n\nexport const HMR_CLOSE_RATE_LIMIT = 1008;\n\nexport const HMR_CLOSE_MESSAGE_TOO_LARGE = 1009;\n\nexport const HMR_MESSAGE_TYPES = {\n CONNECTED: \"connected\",\n UPDATE: \"update\",\n RELOAD: \"reload\",\n PING: \"ping\",\n PONG: \"pong\",\n} as const;\n\nexport function isValidHMRMessageType(type: string): type is keyof typeof HMR_MESSAGE_TYPES {\n return Object.values(HMR_MESSAGE_TYPES).includes(\n type as typeof HMR_MESSAGE_TYPES[keyof typeof HMR_MESSAGE_TYPES],\n );\n}\n", "export const DEFAULT_DEV_SERVER_PORT = 3000;\nexport const DEFAULT_REDIS_PORT = 6379;\nexport const DEFAULT_API_SERVER_PORT = 8080;\nexport const DEFAULT_PREVIEW_SERVER_PORT = 5000;\nexport const DEFAULT_METRICS_PORT = 9000;\n\nexport const BYTES_PER_KB = 1024;\nexport const BYTES_PER_MB = 1024 * 1024;\n\nexport const DEFAULT_IMAGE_THUMBNAIL_SIZE = 256;\nexport const DEFAULT_IMAGE_SMALL_SIZE = 512;\nexport const DEFAULT_IMAGE_LARGE_SIZE = 2048;\n\nexport const RESPONSIVE_IMAGE_WIDTH_XS = 320;\nexport const RESPONSIVE_IMAGE_WIDTH_SM = 640;\nexport const RESPONSIVE_IMAGE_WIDTH_MD = 1024;\nexport const RESPONSIVE_IMAGE_WIDTH_LG = 1920;\n\nexport const RESPONSIVE_IMAGE_WIDTHS = [\n RESPONSIVE_IMAGE_WIDTH_XS,\n RESPONSIVE_IMAGE_WIDTH_SM,\n RESPONSIVE_IMAGE_WIDTH_MD,\n RESPONSIVE_IMAGE_WIDTH_LG,\n] as const;\n\nexport const MAX_CHUNK_SIZE_KB = 4096;\n\nexport const MIN_PORT = 1;\n\nexport const MAX_PORT = 65535;\n\nexport const DEFAULT_SERVER_PORT = 8000;\n", "/**\n * Centralized server endpoints and paths registry\n *\n * All internal veryfront URLs should be defined here as the single source of truth.\n * This prevents hardcoding URLs across the codebase and makes refactoring easier.\n */\n\n/** Default port for development dashboard */\nexport const DEFAULT_DASHBOARD_PORT = 3002;\n\n/** Default port for veryfront server */\nexport const DEFAULT_PORT = 3000;\n\n/** Internal URL prefix for all veryfront endpoints */\nexport const INTERNAL_PREFIX = \"/_veryfront\" as const;\n\n/**\n * All internal veryfront URL path prefixes (directories)\n */\nexport const INTERNAL_PATH_PREFIXES = {\n /** React Server Components endpoints */\n RSC: `${INTERNAL_PREFIX}/rsc/`,\n /** File system access endpoints (base64 encoded paths) */\n FS: `${INTERNAL_PREFIX}/fs/`,\n /** Virtual module system */\n MODULES: `${INTERNAL_PREFIX}/modules/`,\n /** Generated page modules */\n PAGES: `${INTERNAL_PREFIX}/pages/`,\n /** Data JSON endpoints */\n DATA: `${INTERNAL_PREFIX}/data/`,\n /** Library modules (AI SDK, etc.) */\n LIB: `${INTERNAL_PREFIX}/lib/`,\n /** Chunk assets */\n CHUNKS: `${INTERNAL_PREFIX}/chunks/`,\n /** Client component modules */\n CLIENT: `${INTERNAL_PREFIX}/client/`,\n} as const;\n\n/**\n * Specific internal endpoint URLs\n */\nexport const INTERNAL_ENDPOINTS = {\n // Development endpoints\n HMR_RUNTIME: `${INTERNAL_PREFIX}/hmr-runtime.js`,\n HMR: `${INTERNAL_PREFIX}/hmr.js`,\n HYDRATE: `${INTERNAL_PREFIX}/hydrate.js`,\n ERROR_OVERLAY: `${INTERNAL_PREFIX}/error-overlay.js`,\n DEV_LOADER: `${INTERNAL_PREFIX}/dev-loader.js`,\n CLIENT_LOG: `${INTERNAL_PREFIX}/log`,\n\n // Production endpoints\n CLIENT_JS: `${INTERNAL_PREFIX}/client.js`,\n ROUTER_JS: `${INTERNAL_PREFIX}/router.js`,\n PREFETCH_JS: `${INTERNAL_PREFIX}/prefetch.js`,\n MANIFEST_JSON: `${INTERNAL_PREFIX}/manifest.json`,\n APP_JS: `${INTERNAL_PREFIX}/app.js`,\n\n // RSC endpoints\n RSC_CLIENT: `${INTERNAL_PREFIX}/rsc/client.js`,\n RSC_MANIFEST: `${INTERNAL_PREFIX}/rsc/manifest`,\n RSC_STREAM: `${INTERNAL_PREFIX}/rsc/stream`,\n RSC_PAYLOAD: `${INTERNAL_PREFIX}/rsc/payload`,\n RSC_RENDER: `${INTERNAL_PREFIX}/rsc/render`,\n RSC_PAGE: `${INTERNAL_PREFIX}/rsc/page`,\n RSC_MODULE: `${INTERNAL_PREFIX}/rsc/module`,\n RSC_DOM: `${INTERNAL_PREFIX}/rsc/dom.js`,\n RSC_HYDRATOR: `${INTERNAL_PREFIX}/rsc/hydrator.js`,\n RSC_HYDRATE_CLIENT: `${INTERNAL_PREFIX}/rsc/hydrate-client.js`,\n\n // Library module endpoints\n LIB_AI_REACT: `${INTERNAL_PREFIX}/lib/ai/react.js`,\n LIB_AI_COMPONENTS: `${INTERNAL_PREFIX}/lib/ai/components.js`,\n LIB_AI_PRIMITIVES: `${INTERNAL_PREFIX}/lib/ai/primitives.js`,\n} as const;\n\n/**\n * Build output directory paths (relative)\n */\nexport const BUILD_DIRS = {\n /** Main build output directory */\n ROOT: \"_veryfront\",\n /** Chunks directory */\n CHUNKS: \"_veryfront/chunks\",\n /** Data directory */\n DATA: \"_veryfront/data\",\n /** Assets directory */\n ASSETS: \"_veryfront/assets\",\n} as const;\n\n/**\n * Local project directory paths (relative to project root)\n * These are .gitignore'd directories for caching and temporary files\n */\nexport const PROJECT_DIRS = {\n /** Base veryfront internal directory */\n ROOT: \".veryfront\",\n /** Cache directory for build artifacts, transforms, etc. */\n CACHE: \".veryfront/cache\",\n /** KV store directory */\n KV: \".veryfront/kv\",\n /** Log files directory */\n LOGS: \".veryfront/logs\",\n /** Temporary files directory */\n TMP: \".veryfront/tmp\",\n} as const;\n\n/** Default cache directory path */\nexport const DEFAULT_CACHE_DIR = PROJECT_DIRS.CACHE;\n\n/**\n * Helper to check if a pathname is an internal veryfront endpoint\n */\nexport function isInternalEndpoint(pathname: string): boolean {\n return pathname.startsWith(INTERNAL_PREFIX + \"/\");\n}\n\n/**\n * Helper to check if a pathname is a static asset (has extension or is internal)\n */\nexport function isStaticAsset(pathname: string): boolean {\n return pathname.includes(\".\") || isInternalEndpoint(pathname);\n}\n\n/**\n * Normalize a chunk path to include the base prefix\n */\nexport function normalizeChunkPath(\n filename: string,\n basePath: string = INTERNAL_PATH_PREFIXES.CHUNKS,\n): string {\n if (filename.startsWith(\"/\")) {\n return filename;\n }\n return `${basePath.replace(/\\/$/, \"\")}/${filename}`;\n}\n\n// Re-export for backward compatibility\nexport const DEV_SERVER_ENDPOINTS = {\n HMR_RUNTIME: INTERNAL_ENDPOINTS.HMR_RUNTIME,\n ERROR_OVERLAY: INTERNAL_ENDPOINTS.ERROR_OVERLAY,\n} as const;\n", "/**\n * Project directory paths and file extensions\n *\n * For internal veryfront URL endpoints, see ./constants/server.ts\n */\n\nimport {\n BUILD_DIRS,\n INTERNAL_ENDPOINTS,\n INTERNAL_PATH_PREFIXES,\n INTERNAL_PREFIX,\n} from \"./constants/server.ts\";\n\nexport const PATHS = {\n PAGES_DIR: \"pages\",\n COMPONENTS_DIR: \"components\",\n PUBLIC_DIR: \"public\",\n STYLES_DIR: \"styles\",\n DIST_DIR: \"dist\",\n CONFIG_FILE: \"veryfront.config.js\",\n} as const;\n\n/**\n * @deprecated Use INTERNAL_PREFIX, INTERNAL_ENDPOINTS, INTERNAL_PATH_PREFIXES from ./constants/server.ts\n */\nexport const VERYFRONT_PATHS = {\n INTERNAL_PREFIX: INTERNAL_PREFIX,\n BUILD_DIR: BUILD_DIRS.ROOT,\n CHUNKS_DIR: BUILD_DIRS.CHUNKS,\n DATA_DIR: BUILD_DIRS.DATA,\n ASSETS_DIR: BUILD_DIRS.ASSETS,\n HMR_RUNTIME: INTERNAL_ENDPOINTS.HMR_RUNTIME,\n CLIENT_JS: INTERNAL_ENDPOINTS.CLIENT_JS,\n ROUTER_JS: INTERNAL_ENDPOINTS.ROUTER_JS,\n ERROR_OVERLAY: INTERNAL_ENDPOINTS.ERROR_OVERLAY,\n} as const;\n\nexport const FILE_EXTENSIONS = {\n MDX: [\".mdx\", \".md\"],\n SCRIPT: [\".tsx\", \".ts\", \".jsx\", \".js\"],\n STYLE: [\".css\", \".scss\", \".sass\"],\n ALL: [\".mdx\", \".md\", \".tsx\", \".ts\", \".jsx\", \".js\", \".css\"],\n} as const;\n\n// Re-export for convenience\nexport { BUILD_DIRS, INTERNAL_ENDPOINTS, INTERNAL_PATH_PREFIXES, INTERNAL_PREFIX };\n", "import { serverLogger as logger } from \"./logger/index.ts\";\n\nexport interface BundleMetadata {\n hash: string;\n codeHash: string;\n size: number;\n compiledAt: number;\n source: string;\n mode: \"development\" | \"production\";\n meta?: {\n type?: \"mdx\" | \"component\" | \"layout\" | \"provider\";\n depsHash?: string;\n reactVersion?: string;\n };\n}\n\nexport interface BundleCode {\n code: string;\n sourceMap?: string;\n css?: string;\n}\n\nexport interface BundleManifestStore {\n getBundleMetadata(key: string): Promise<BundleMetadata | undefined>;\n\n setBundleMetadata(key: string, metadata: BundleMetadata, ttlMs?: number): Promise<void>;\n\n getBundleCode(hash: string): Promise<BundleCode | undefined>;\n\n setBundleCode(hash: string, code: BundleCode, ttlMs?: number): Promise<void>;\n\n deleteBundle(key: string): Promise<void>;\n\n invalidateSource(source: string): Promise<number>;\n\n clear(): Promise<void>;\n\n isAvailable(): Promise<boolean>;\n\n getStats(): Promise<{\n totalBundles: number;\n totalSize: number;\n oldestBundle?: number;\n newestBundle?: number;\n }>;\n}\n\nexport class InMemoryBundleManifestStore implements BundleManifestStore {\n private metadata = new Map<string, { value: BundleMetadata; expiry?: number }>();\n private code = new Map<string, { value: BundleCode; expiry?: number }>();\n private sourceIndex = new Map<string, Set<string>>();\n\n getBundleMetadata(key: string): Promise<BundleMetadata | undefined> {\n const entry = this.metadata.get(key);\n if (!entry) return Promise.resolve(undefined);\n if (entry.expiry && Date.now() > entry.expiry) {\n this.metadata.delete(key);\n return Promise.resolve(undefined);\n }\n return Promise.resolve(entry.value);\n }\n\n setBundleMetadata(key: string, metadata: BundleMetadata, ttlMs?: number): Promise<void> {\n const expiry = ttlMs ? Date.now() + ttlMs : undefined;\n this.metadata.set(key, { value: metadata, expiry });\n\n if (!this.sourceIndex.has(metadata.source)) {\n this.sourceIndex.set(metadata.source, new Set());\n }\n this.sourceIndex.get(metadata.source)!.add(key);\n return Promise.resolve();\n }\n\n getBundleCode(hash: string): Promise<BundleCode | undefined> {\n const entry = this.code.get(hash);\n if (!entry) return Promise.resolve(undefined);\n if (entry.expiry && Date.now() > entry.expiry) {\n this.code.delete(hash);\n return Promise.resolve(undefined);\n }\n return Promise.resolve(entry.value);\n }\n\n setBundleCode(hash: string, code: BundleCode, ttlMs?: number): Promise<void> {\n const expiry = ttlMs ? Date.now() + ttlMs : undefined;\n this.code.set(hash, { value: code, expiry });\n return Promise.resolve();\n }\n\n async deleteBundle(key: string): Promise<void> {\n const metadata = await this.getBundleMetadata(key);\n this.metadata.delete(key);\n if (metadata) {\n this.code.delete(metadata.codeHash);\n const sourceKeys = this.sourceIndex.get(metadata.source);\n if (sourceKeys) {\n sourceKeys.delete(key);\n if (sourceKeys.size === 0) {\n this.sourceIndex.delete(metadata.source);\n }\n }\n }\n }\n\n async invalidateSource(source: string): Promise<number> {\n const keys = this.sourceIndex.get(source);\n if (!keys) return 0;\n\n let count = 0;\n for (const key of Array.from(keys)) {\n await this.deleteBundle(key);\n count++;\n }\n this.sourceIndex.delete(source);\n return count;\n }\n\n clear(): Promise<void> {\n this.metadata.clear();\n this.code.clear();\n this.sourceIndex.clear();\n return Promise.resolve();\n }\n\n isAvailable(): Promise<boolean> {\n return Promise.resolve(true);\n }\n\n getStats(): Promise<{\n totalBundles: number;\n totalSize: number;\n oldestBundle?: number;\n newestBundle?: number;\n }> {\n let totalSize = 0;\n let oldest: number | undefined;\n let newest: number | undefined;\n\n for (const { value } of this.metadata.values()) {\n totalSize += value.size;\n if (!oldest || value.compiledAt < oldest) oldest = value.compiledAt;\n if (!newest || value.compiledAt > newest) newest = value.compiledAt;\n }\n\n return Promise.resolve({\n totalBundles: this.metadata.size,\n totalSize,\n oldestBundle: oldest,\n newestBundle: newest,\n });\n }\n}\n\nlet manifestStore: BundleManifestStore = new InMemoryBundleManifestStore();\n\nexport function setBundleManifestStore(store: BundleManifestStore): void {\n manifestStore = store;\n logger.info(\"[bundle-manifest] Bundle manifest store configured\", {\n type: store.constructor.name,\n });\n}\n\nexport function getBundleManifestStore(): BundleManifestStore {\n return manifestStore;\n}\n\nexport { computeCodeHash, computeContentHash } from \"./hash-utils.ts\";\n", "import { LRUCacheAdapter } from \"./cache/stores/memory/lru-cache-adapter.ts\";\nimport type { LRUCacheOptions } from \"./cache/stores/memory/types.ts\";\nimport { DEFAULT_LRU_MAX_ENTRIES } from \"@veryfront/utils\";\nimport { getEnv } from \"../../platform/compat/process.ts\";\n\nexport interface LRUOptions {\n maxEntries?: number;\n ttlMs?: number;\n cleanupIntervalMs?: number;\n}\n\nexport class LRUCache<K, V> {\n private adapter: LRUCacheAdapter;\n private cleanupTimer?: ReturnType<typeof setInterval>;\n private cleanupIntervalMs: number;\n private ttlMs?: number;\n\n constructor(options: LRUOptions = {}) {\n const adapterOptions: LRUCacheOptions = {\n maxEntries: options.maxEntries ?? DEFAULT_LRU_MAX_ENTRIES,\n ttlMs: options.ttlMs,\n };\n\n this.adapter = new LRUCacheAdapter(adapterOptions);\n this.ttlMs = options.ttlMs;\n this.cleanupIntervalMs = options.cleanupIntervalMs ?? 60000;\n\n if (this.ttlMs && this.ttlMs > 0) {\n this.startPeriodicCleanup();\n }\n }\n\n private startPeriodicCleanup(): void {\n if (shouldDisableInterval()) {\n return;\n }\n if (this.cleanupTimer) {\n clearInterval(this.cleanupTimer);\n }\n\n const timer = setInterval(() => {\n this.adapter.cleanupExpired();\n }, this.cleanupIntervalMs);\n this.cleanupTimer = timer;\n }\n\n private toStringKey(key: K): string {\n if (typeof key === \"string\") {\n return key;\n }\n return String(key);\n }\n\n get size(): number {\n return this.adapter.getStats().entries;\n }\n\n has(key: K): boolean {\n return this.adapter.get(this.toStringKey(key)) !== undefined;\n }\n\n get(key: K): V | undefined {\n return this.adapter.get<V>(this.toStringKey(key));\n }\n\n set(key: K, value: V): void {\n this.adapter.set(this.toStringKey(key), value);\n }\n\n delete(key: K): boolean {\n const stringKey = this.toStringKey(key);\n const had = this.adapter.get(stringKey) !== undefined;\n this.adapter.delete(stringKey);\n return had;\n }\n\n clear(): void {\n this.adapter.clear();\n }\n\n cleanup(): void {\n this.adapter.cleanupExpired();\n }\n\n destroy(): void {\n if (this.cleanupTimer) {\n clearInterval(this.cleanupTimer);\n this.cleanupTimer = undefined;\n }\n\n this.adapter.clear();\n }\n\n keys(): IterableIterator<K> {\n return this.adapter.keys() as IterableIterator<K>;\n }\n}\n\nfunction shouldDisableInterval(): boolean {\n if ((globalThis as Record<string, unknown>).__vfDisableLruInterval === true) {\n return true;\n }\n try {\n return getEnv(\"VF_DISABLE_LRU_INTERVAL\") === \"1\";\n } catch {\n return false;\n }\n}\n", "import { LRUCache } from \"@veryfront/utils/lru-wrapper.ts\";\nimport {\n DATA_FETCHING_MAX_ENTRIES,\n DATA_FETCHING_TTL_MS,\n} from \"@veryfront/utils/constants/cache.ts\";\nimport type { CacheEntry, DataContext } from \"./types.ts\";\nimport { getEnv } from \"../platform/compat/process.ts\";\n\nfunction isLruIntervalDisabled(): boolean {\n if ((globalThis as Record<string, unknown>).__vfDisableLruInterval === true) {\n return true;\n }\n try {\n return getEnv(\"VF_DISABLE_LRU_INTERVAL\") === \"1\";\n } catch {\n return false;\n }\n}\n\nexport class CacheManager {\n private cache = new LRUCache<string, CacheEntry>({\n maxEntries: DATA_FETCHING_MAX_ENTRIES,\n ttlMs: isLruIntervalDisabled() ? undefined : DATA_FETCHING_TTL_MS,\n });\n private cacheKeys = new Set<string>();\n\n get(key: string): CacheEntry | null {\n const entry = this.cache.get(key);\n return entry ?? null;\n }\n\n set(key: string, entry: CacheEntry): void {\n this.cache.set(key, entry);\n this.cacheKeys.add(key);\n }\n\n delete(key: string): void {\n this.cache.delete(key);\n this.cacheKeys.delete(key);\n }\n\n clear(): void {\n this.cache.clear();\n this.cacheKeys.clear();\n }\n\n clearPattern(pattern: string): void {\n for (const key of this.cacheKeys) {\n if (key.includes(pattern)) {\n this.delete(key);\n }\n }\n }\n\n shouldRevalidate(entry: CacheEntry): boolean {\n if (entry.revalidate === false) {\n return false;\n }\n\n if (typeof entry.revalidate === \"number\") {\n const age = Date.now() - entry.timestamp;\n return age > entry.revalidate * 1000;\n }\n\n return false;\n }\n\n createCacheKey(context: DataContext): string {\n const params = JSON.stringify(context.params);\n const pathname = context.url.pathname;\n return `${pathname}::${params}`;\n }\n}\n", "import type { RuntimeAdapter } from \"@veryfront/platform/adapters/index.ts\";\nimport type { DataContext, DataResult, PageWithData } from \"./types.ts\";\nimport { serverLogger } from \"@veryfront/utils\";\n\nexport class ServerDataFetcher {\n constructor(private adapter?: RuntimeAdapter) {}\n\n async fetch(pageModule: PageWithData, context: DataContext): Promise<DataResult> {\n if (!pageModule.getServerData) {\n return { props: {} };\n }\n\n try {\n const result = await pageModule.getServerData(context);\n\n if (result.redirect) {\n return { redirect: result.redirect };\n }\n\n if (result.notFound) {\n return { notFound: true };\n }\n\n return {\n props: result.props ?? {},\n revalidate: result.revalidate,\n };\n } catch (error) {\n this.logError(\"Error in getServerData:\", error);\n throw error;\n }\n }\n\n private logError(message: string, error: unknown): void {\n const debugEnabled = this.adapter?.env.get(\"VERYFRONT_DEBUG\");\n if (debugEnabled) {\n serverLogger.error(message, error);\n }\n }\n}\n", "import type { RuntimeAdapter } from \"@veryfront/platform/adapters/index.ts\";\nimport type { CacheManager } from \"./data-fetching-cache.ts\";\nimport type { DataContext, DataResult, PageWithData } from \"./types.ts\";\nimport { serverLogger } from \"@veryfront/utils\";\n\nexport class StaticDataFetcher {\n private pendingRevalidations = new Map<string, Promise<void>>();\n\n constructor(\n private cacheManager: CacheManager,\n private adapter?: RuntimeAdapter,\n ) {}\n\n async fetch(pageModule: PageWithData, context: DataContext): Promise<DataResult> {\n if (!pageModule.getStaticData) {\n return { props: {} };\n }\n\n const cacheKey = this.cacheManager.createCacheKey(context);\n const cached = this.cacheManager.get(cacheKey);\n\n if (cached && !this.cacheManager.shouldRevalidate(cached)) {\n return cached.data;\n }\n\n if (cached && this.cacheManager.shouldRevalidate(cached)) {\n if (!this.pendingRevalidations.has(cacheKey)) {\n this.pendingRevalidations.set(\n cacheKey,\n this.revalidateInBackground(pageModule, context, cacheKey),\n );\n }\n return cached.data;\n }\n\n return await this.fetchFresh(pageModule, context, cacheKey);\n }\n\n private async fetchFresh(\n pageModule: PageWithData,\n context: DataContext,\n cacheKey: string,\n ): Promise<DataResult> {\n if (!pageModule.getStaticData) {\n return { props: {} };\n }\n\n try {\n const result = await pageModule.getStaticData({\n params: context.params,\n url: context.url,\n });\n\n this.cacheManager.set(cacheKey, {\n data: result,\n timestamp: Date.now(),\n revalidate: result.revalidate,\n });\n\n return result;\n } catch (error) {\n this.logError(\"Error in getStaticData:\", error);\n throw error;\n }\n }\n\n private async revalidateInBackground(\n pageModule: PageWithData,\n context: DataContext,\n cacheKey: string,\n ): Promise<void> {\n try {\n if (!pageModule.getStaticData) {\n return;\n }\n\n const result = await pageModule.getStaticData({\n params: context.params,\n url: context.url,\n });\n\n this.cacheManager.set(cacheKey, {\n data: result,\n timestamp: Date.now(),\n revalidate: result.revalidate,\n });\n } catch (error) {\n this.logError(\"Error revalidating data:\", error);\n } finally {\n this.pendingRevalidations.delete(cacheKey);\n }\n }\n\n private logError(message: string, error: unknown): void {\n const debugEnabled = this.adapter?.env.get(\"VERYFRONT_DEBUG\");\n if (debugEnabled) {\n serverLogger.error(message, error);\n }\n }\n}\n", "import type { PageWithData, StaticPathsResult } from \"./types.ts\";\nimport { serverLogger } from \"@veryfront/utils\";\n\nexport class StaticPathsFetcher {\n async fetch(pageModule: PageWithData): Promise<StaticPathsResult | null> {\n if (!pageModule.getStaticPaths) {\n return null;\n }\n\n try {\n return await pageModule.getStaticPaths();\n } catch (error) {\n this.logError(\"Error in getStaticPaths:\", error);\n throw error;\n }\n }\n\n private logError(message: string, error: unknown): void {\n serverLogger.error(message, error);\n }\n}\n", "import type { RuntimeAdapter } from \"@veryfront/platform/adapters/index.ts\";\nimport { CacheManager } from \"./data-fetching-cache.ts\";\nimport { ServerDataFetcher } from \"./server-data-fetcher.ts\";\nimport { StaticDataFetcher } from \"./static-data-fetcher.ts\";\nimport { StaticPathsFetcher } from \"./static-paths-fetcher.ts\";\nimport type { DataContext, DataResult, PageWithData, StaticPathsResult } from \"./types.ts\";\n\nexport class DataFetcher {\n private cacheManager: CacheManager;\n private serverFetcher: ServerDataFetcher;\n private staticFetcher: StaticDataFetcher;\n private pathsFetcher: StaticPathsFetcher;\n\n constructor(adapter?: RuntimeAdapter) {\n this.cacheManager = new CacheManager();\n this.serverFetcher = new ServerDataFetcher(adapter);\n this.staticFetcher = new StaticDataFetcher(this.cacheManager, adapter);\n this.pathsFetcher = new StaticPathsFetcher();\n }\n\n async fetchData(\n pageModule: PageWithData,\n context: DataContext,\n mode: \"development\" | \"production\" = \"development\",\n ): Promise<DataResult> {\n if (!pageModule.getServerData && !pageModule.getStaticData) {\n return { props: {} };\n }\n\n if (mode === \"development\" && pageModule.getServerData) {\n return await this.serverFetcher.fetch(pageModule, context);\n }\n\n if (pageModule.getStaticData) {\n return await this.staticFetcher.fetch(pageModule, context);\n }\n\n if (pageModule.getServerData) {\n return await this.serverFetcher.fetch(pageModule, context);\n }\n\n return { props: {} };\n }\n\n async getStaticPaths(pageModule: PageWithData): Promise<StaticPathsResult | null> {\n return await this.pathsFetcher.fetch(pageModule);\n }\n\n clearCache(pattern?: string): void {\n if (pattern) {\n this.cacheManager.clearPattern(pattern);\n } else {\n this.cacheManager.clear();\n }\n }\n}\n", "import type { DataResult } from \"./types.ts\";\n\nexport const redirect = (destination: string, permanent = false): DataResult => ({\n redirect: { destination, permanent },\n});\n\nexport const notFound = (): DataResult => ({\n notFound: true,\n});\n"],
5
5
  "mappings": ";AAEO,IAAM,iBAAN,MAAwB;AAAA,EAAxB;AACL,SAAQ,OAA0B;AAClC,SAAQ,OAA0B;AAAA;AAAA,EAElC,UAA6B;AAC3B,WAAO,KAAK;AAAA,EACd;AAAA,EAEA,UAA6B;AAC3B,WAAO,KAAK;AAAA,EACd;AAAA,EAEA,YAAY,MAAwB;AAClC,QAAI,SAAS,KAAK,MAAM;AACtB,WAAK,MAAM,eAAe,KAAK,IAAI;AACnC;AAAA,IACF;AAEA,SAAK,WAAW,IAAI;AAEpB,SAAK,WAAW,IAAI;AAAA,EACtB;AAAA,EAEA,WAAW,MAAwB;AACjC,SAAK,OAAO,KAAK;AACjB,SAAK,OAAO;AACZ,QAAI,KAAK,MAAM;AACb,WAAK,KAAK,OAAO;AAAA,IACnB;AACA,SAAK,OAAO;AACZ,QAAI,CAAC,KAAK,MAAM;AACd,WAAK,OAAO;AAAA,IACd;AACA,SAAK,MAAM,eAAe,KAAK,IAAI;AAAA,EACrC;AAAA,EAEA,WAAW,MAAwB;AACjC,QAAI,KAAK,MAAM;AACb,WAAK,KAAK,OAAO,K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;AAEA,WAAO,EAAE,OAAO,CAAC,EAAE;AAAA,EACrB;AAAA,EAEA,MAAM,eAAe,YAA6D;AAChF,WAAO,MAAM,KAAK,aAAa,MAAM,UAAU;AAAA,EACjD;AAAA,EAEA,WAAW,SAAwB;AACjC,QAAI,SAAS;AACX,WAAK,aAAa,aAAa,OAAO;AAAA,IACxC,OAAO;AACL,WAAK,aAAa,MAAM;AAAA,IAC1B;AAAA,EACF;AACF;;;ACrDO,IAAM,WAAW,CAAC,aAAqB,YAAY,WAAuB;AAAA,EAC/E,UAAU,EAAE,aAAa,UAAU;AACrC;AAEO,IAAM,WAAW,OAAmB;AAAA,EACzC,UAAU;AACZ;",
6
6
  "names": ["logger", "hasNodeProcess", "hasNodeProcess"]
7
7
  }
package/dist/index.js CHANGED
@@ -131,7 +131,6 @@ function __loggerResetForTests(options = {}) {
131
131
  var LogLevel, originalConsole, cachedLogLevel, ConsoleLogger, getDefaultLevel, trackedLoggers, cliLogger, serverLogger, rendererLogger, bundlerLogger, agentLogger, logger;
132
132
  var init_logger = __esm({
133
133
  "src/core/utils/logger/logger.ts"() {
134
- "use strict";
135
134
  init_env();
136
135
  LogLevel = /* @__PURE__ */ ((LogLevel2) => {
137
136
  LogLevel2[LogLevel2["DEBUG"] = 0] = "DEBUG";
@@ -278,7 +277,7 @@ var init_deno = __esm({
278
277
  "deno.json"() {
279
278
  deno_default = {
280
279
  name: "veryfront",
281
- version: "0.0.42",
280
+ version: "0.0.43",
282
281
  exclude: [
283
282
  "npm/",
284
283
  "dist/",
@@ -595,7 +594,6 @@ function getUnoCSSTailwindResetUrl() {
595
594
  var ESM_CDN_BASE, JSDELIVR_CDN_BASE, DENO_STD_BASE, REACT_VERSION_17, REACT_VERSION_18_2, REACT_VERSION_18_3, REACT_VERSION_19_RC, REACT_VERSION_19, REACT_DEFAULT_VERSION, DEFAULT_ALLOWED_CDN_HOSTS, DENO_STD_VERSION, UNOCSS_VERSION;
596
595
  var init_cdn = __esm({
597
596
  "src/core/utils/constants/cdn.ts"() {
598
- "use strict";
599
597
  init_version();
600
598
  ESM_CDN_BASE = "https://esm.sh";
601
599
  JSDELIVR_CDN_BASE = "https://cdn.jsdelivr.net";
@@ -646,7 +644,6 @@ var init_env2 = __esm({
646
644
  var HASH_SEED_DJB2, HASH_SEED_FNV1A;
647
645
  var init_hash = __esm({
648
646
  "src/core/utils/constants/hash.ts"() {
649
- "use strict";
650
647
  HASH_SEED_DJB2 = 5381;
651
648
  HASH_SEED_FNV1A = 2166136261;
652
649
  }
@@ -656,7 +653,6 @@ var init_hash = __esm({
656
653
  var KB_IN_BYTES, HTTP_MODULE_FETCH_TIMEOUT_MS, HMR_RECONNECT_DELAY_MS, HMR_RELOAD_DELAY_MS, HMR_FILE_WATCHER_DEBOUNCE_MS, HMR_KEEP_ALIVE_INTERVAL_MS, DASHBOARD_RECONNECT_DELAY_MS, SERVER_FUNCTION_DEFAULT_TIMEOUT_MS, PREFETCH_MAX_SIZE_BYTES, PREFETCH_DEFAULT_TIMEOUT_MS, PREFETCH_DEFAULT_DELAY_MS, HTTP_OK, HTTP_NO_CONTENT, HTTP_CREATED, HTTP_REDIRECT_FOUND, HTTP_NOT_MODIFIED, HTTP_BAD_REQUEST, HTTP_UNAUTHORIZED, HTTP_FORBIDDEN, HTTP_NOT_FOUND, HTTP_METHOD_NOT_ALLOWED, HTTP_GONE, HTTP_PAYLOAD_TOO_LARGE, HTTP_URI_TOO_LONG, HTTP_TOO_MANY_REQUESTS, HTTP_REQUEST_HEADER_FIELDS_TOO_LARGE, HTTP_SERVER_ERROR, HTTP_INTERNAL_SERVER_ERROR, HTTP_BAD_GATEWAY, HTTP_NOT_IMPLEMENTED, HTTP_UNAVAILABLE, HTTP_NETWORK_CONNECT_TIMEOUT, HTTP_STATUS_SUCCESS_MIN, HTTP_STATUS_REDIRECT_MIN, HTTP_STATUS_CLIENT_ERROR_MIN, HTTP_STATUS_SERVER_ERROR_MIN, HTTP_CONTENT_TYPES, MS_PER_MINUTE, HTTP_CONTENT_TYPE_IMAGE_PNG, HTTP_CONTENT_TYPE_IMAGE_JPEG, HTTP_CONTENT_TYPE_IMAGE_WEBP, HTTP_CONTENT_TYPE_IMAGE_AVIF, HTTP_CONTENT_TYPE_IMAGE_SVG, HTTP_CONTENT_TYPE_IMAGE_GIF, HTTP_CONTENT_TYPE_IMAGE_ICO;
657
654
  var init_http = __esm({
658
655
  "src/core/utils/constants/http.ts"() {
659
- "use strict";
660
656
  init_cache();
661
657
  KB_IN_BYTES = 1024;
662
658
  HTTP_MODULE_FETCH_TIMEOUT_MS = 2500;
@@ -760,7 +756,6 @@ var init_html = __esm({
760
756
  var DEFAULT_DEV_SERVER_PORT, DEFAULT_REDIS_PORT, DEFAULT_API_SERVER_PORT, DEFAULT_PREVIEW_SERVER_PORT, DEFAULT_METRICS_PORT, BYTES_PER_KB, BYTES_PER_MB, DEFAULT_IMAGE_THUMBNAIL_SIZE, DEFAULT_IMAGE_SMALL_SIZE, DEFAULT_IMAGE_LARGE_SIZE, RESPONSIVE_IMAGE_WIDTH_XS, RESPONSIVE_IMAGE_WIDTH_SM, RESPONSIVE_IMAGE_WIDTH_MD, RESPONSIVE_IMAGE_WIDTH_LG, RESPONSIVE_IMAGE_WIDTHS, MAX_CHUNK_SIZE_KB, MIN_PORT, MAX_PORT, DEFAULT_SERVER_PORT;
761
757
  var init_network = __esm({
762
758
  "src/core/utils/constants/network.ts"() {
763
- "use strict";
764
759
  DEFAULT_DEV_SERVER_PORT = 3e3;
765
760
  DEFAULT_REDIS_PORT = 6379;
766
761
  DEFAULT_API_SERVER_PORT = 8080;