UNPKG

zephyr-agent

Version:
57 lines (56 loc) • 2.28 kB
"use strict"; var __webpack_require__ = {}; (()=>{ __webpack_require__.d = (exports1, getters, values)=>{ var define = (defs, kind)=>{ for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, { enumerable: true, [kind]: defs[key] }); }; define(getters, "get"); define(values, "value"); }; })(); (()=>{ __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop); })(); (()=>{ __webpack_require__.r = (exports1)=>{ if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, { value: 'Module' }); Object.defineProperty(exports1, '__esModule', { value: true }); }; })(); var __webpack_exports__ = {}; __webpack_require__.r(__webpack_exports__); __webpack_require__.d(__webpack_exports__, { getPackageJsonCache: ()=>getPackageJsonCache, setPackageJsonCache: ()=>setPackageJsonCache }); const external_zephyr_edge_contract_namespaceObject = require("zephyr-edge-contract"); const fs_cache_js_namespaceObject = require("../node-persist/fs-cache.js"); const cache_prefix = 'package_json'; async function getPackageJsonCache(startingPath) { const cache_key = `${cache_prefix}:${startingPath}`; const cached = await (0, fs_cache_js_namespaceObject.getCache)(cache_key); if (!cached) return; return (0, external_zephyr_edge_contract_namespaceObject.safe_json_parse)(cached); } async function setPackageJsonCache(startingPath, parsed_package_json) { const cache_key = `${cache_prefix}:${startingPath}`; await (0, fs_cache_js_namespaceObject.saveCache)(cache_key, JSON.stringify(parsed_package_json)); } exports.getPackageJsonCache = __webpack_exports__.getPackageJsonCache; exports.setPackageJsonCache = __webpack_exports__.setPackageJsonCache; for(var __rspack_i in __webpack_exports__)if (-1 === [ "getPackageJsonCache", "setPackageJsonCache" ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i]; Object.defineProperty(exports, '__esModule', { value: true }); //# sourceMappingURL=fs-cache-for-package-json.js.map