zephyr-agent
Version:
Zephyr plugin agent
17 lines (16 loc) • 708 B
JavaScript
import "node:module";
import { safe_json_parse } from "zephyr-edge-contract";
import { getCache, saveCache } from "../node-persist/fs-cache.mjs";
const cache_prefix = 'package_json';
async function getPackageJsonCache(startingPath) {
const cache_key = `${cache_prefix}:${startingPath}`;
const cached = await getCache(cache_key);
if (!cached) return;
return safe_json_parse(cached);
}
async function setPackageJsonCache(startingPath, parsed_package_json) {
const cache_key = `${cache_prefix}:${startingPath}`;
await saveCache(cache_key, JSON.stringify(parsed_package_json));
}
export { getPackageJsonCache, setPackageJsonCache };
//# sourceMappingURL=fs-cache-for-package-json.mjs.map