{"version":3,"file":"registry.cjs","names":[],"sources":["../src/registry.ts"],"sourcesContent":["import type { TaintedModule } from '#types'\n\nconst taintedModuleStore = new Map<string, TaintedModule>()\n\n/**\n * Registers a module as tainted, meaning it contains one or more accesses\n * to server-only environment variables. If the module was previously registered,\n * the existing record is replaced with the new one.\n *\n * @param taintedModule - The tainted module record to store.\n */\nexport function registerTaintedModule(taintedModule: TaintedModule): void {\n  taintedModuleStore.set(taintedModule.moduleId, taintedModule)\n}\n\n/**\n * Retrieves a tainted module record by its absolute file path.\n *\n * @param moduleId - The absolute file path of the module to look up.\n * @returns The tainted module record, or `undefined` if the module is not registered.\n */\nexport function getTaintedModule(moduleId: string): TaintedModule | undefined {\n  return taintedModuleStore.get(moduleId)\n}\n\n/**\n * Returns all currently registered tainted modules as an array.\n *\n * @returns An array containing every tainted module record in the registry.\n */\nexport function getAllTaintedModules(): TaintedModule[] {\n  return Array.from(taintedModuleStore.values())\n}\n\n/**\n * Removes a single module from the tainted registry.\n * Used during HMR when a file is updated and must be re-evaluated from scratch.\n *\n * @param moduleId - The absolute file path of the module to remove.\n */\nexport function clearTaintedModule(moduleId: string): void {\n  taintedModuleStore.delete(moduleId)\n}\n\n/**\n * Removes all modules from the tainted registry.\n * Called at the start of each build to ensure state does not carry over\n * from a previous run.\n */\nexport function clearAllTaintedModules(): void {\n  taintedModuleStore.clear()\n}\n\n/**\n * Returns whether at least one tainted module is currently registered.\n *\n * @returns `true` if the registry contains one or more tainted modules.\n */\nexport function hasTaintedModules(): boolean {\n  return taintedModuleStore.size > 0\n}\n"],"mappings":";;AAEA,MAAM,qCAAqB,IAAI,KAA4B;;;;;;;;AAS3D,SAAgB,sBAAsB,eAAoC;AACxE,oBAAmB,IAAI,cAAc,UAAU,cAAc;;;;;;;;AAS/D,SAAgB,iBAAiB,UAA6C;AAC5E,QAAO,mBAAmB,IAAI,SAAS;;;;;;;AAQzC,SAAgB,uBAAwC;AACtD,QAAO,MAAM,KAAK,mBAAmB,QAAQ,CAAC;;;;;;;;AAShD,SAAgB,mBAAmB,UAAwB;AACzD,oBAAmB,OAAO,SAAS;;;;;;;AAQrC,SAAgB,yBAA+B;AAC7C,oBAAmB,OAAO;;;;;;;AAQ5B,SAAgB,oBAA6B;AAC3C,QAAO,mBAAmB,OAAO"}