UNPKG

quickwire

Version:

Automatic API generator for Next.js applications that creates API routes and TypeScript client functions from backend functions

33 lines 1.02 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.fileCache = void 0; exports.getFileMtime = getFileMtime; exports.getCachedExports = getCachedExports; exports.setCachedExports = setCachedExports; const fs_1 = __importDefault(require("fs")); const fileCache = new Map(); exports.fileCache = fileCache; function getFileMtime(filePath) { try { return fs_1.default.statSync(filePath).mtimeMs; } catch { return 0; } } function getCachedExports(filePath) { const mtime = getFileMtime(filePath); const cached = fileCache.get(filePath); if (cached && cached.mtime === mtime) { return cached.exports; } return null; } function setCachedExports(filePath, exports) { const mtime = getFileMtime(filePath); fileCache.set(filePath, { mtime, exports }); } //# sourceMappingURL=cache.js.map