rsnext/test/e2e/app-dir/app-static/cache-handler-default-export.js
Zack Tanner 9ea6bc4bcb
fix: custom incremental cache handlers should work when transpiled (#54472)
This fixes a `CurCacheHandler is not a constructor` error when the custom cache handler path is transpiled from ESM -> CJS (resulting in the handler being attached to the `default` property on the module's exports)

Closes NEXT-1558
Fixes #54453
2023-08-24 03:48:30 +00:00

26 lines
700 B
JavaScript

Object.defineProperty(exports, '__esModule', { value: true })
const cache = new Map()
var CacheHandler = /** @class */ (function () {
function CacheHandler(options) {
this.options = options
this.cache = cache
console.log('initialized custom cache-handler')
}
CacheHandler.prototype.get = function (key) {
console.log('cache-handler get', key)
return Promise.resolve(this.cache.get(key))
}
CacheHandler.prototype.set = function (key, data) {
console.log('cache-handler set', key)
this.cache.set(key, {
value: data,
lastModified: Date.now(),
})
return Promise.resolve(undefined)
}
return CacheHandler
})()
exports.default = CacheHandler