| "use strict"; |
| Object.defineProperty(exports, "__esModule", { |
| value: true |
| }); |
| 0 && (module.exports = { |
| checkPersistentCacheInvalidationAndCleanup: null, |
| invalidatePersistentCache: null |
| }); |
| function _export(target, all) { |
| for(var name in all)Object.defineProperty(target, name, { |
| enumerable: true, |
| get: all[name] |
| }); |
| } |
| _export(exports, { |
| checkPersistentCacheInvalidationAndCleanup: function() { |
| return checkPersistentCacheInvalidationAndCleanup; |
| }, |
| invalidatePersistentCache: function() { |
| return invalidatePersistentCache; |
| } |
| }); |
| const _promises = _interop_require_default(require("node:fs/promises")); |
| const _nodepath = _interop_require_default(require("node:path")); |
| function _interop_require_default(obj) { |
| return obj && obj.__esModule ? obj : { |
| default: obj |
| }; |
| } |
| const INVALIDATION_MARKER = '__nextjs_invalidated_cache'; |
| async function invalidatePersistentCache(cacheDirectory) { |
| let file; |
| try { |
| |
| file = await _promises.default.open(_nodepath.default.join(cacheDirectory, INVALIDATION_MARKER), 'w'); |
| |
| |
| } catch (err) { |
| |
| if (err.code !== 'ENOENT') { |
| throw err; |
| } |
| } finally{ |
| file == null ? void 0 : file.close(); |
| } |
| } |
| async function checkPersistentCacheInvalidationAndCleanup(cacheDirectory) { |
| const invalidated = await _promises.default.access(_nodepath.default.join(cacheDirectory, INVALIDATION_MARKER)).then(()=>true, ()=>false); |
| if (invalidated) { |
| await cleanupPersistentCache(cacheDirectory); |
| } |
| } |
| |
| |
| |
| |
| |
| |
| |
| |
| async function cleanupPersistentCache(cacheDirectory) { |
| try { |
| await cleanupPersistentCacheInner(cacheDirectory); |
| } catch (e) { |
| |
| throw Object.defineProperty(new Error(`Unable to remove an invalidated webpack cache. If this issue persists ` + `you can work around it by deleting ${cacheDirectory}`, { |
| cause: e |
| }), "__NEXT_ERROR_CODE", { |
| value: "E710", |
| enumerable: false, |
| configurable: true |
| }); |
| } |
| } |
| async function cleanupPersistentCacheInner(cacheDirectory) { |
| const files = await _promises.default.readdir(cacheDirectory); |
| |
| await Promise.all(files.map((name)=>name !== INVALIDATION_MARKER ? _promises.default.rm(_nodepath.default.join(cacheDirectory, name), { |
| force: true, |
| recursive: true, |
| maxRetries: 2 |
| }) : null)); |
| |
| |
| await _promises.default.rm(_nodepath.default.join(cacheDirectory, INVALIDATION_MARKER), { |
| force: true, |
| maxRetries: 2 |
| }); |
| } |
|
|
| |