/opt/canhelp/node_modules/next/dist/server/lib
NameSizeModeActions
cache-handlers/-0755rm
experimental/-0755rm
incremental-cache/-0755rm
module-loader/-0755rm
router-utils/-0755rm
server-ipc/-0755rm
trace/-0755rm
app-dir-module.d.ts6230644editdlrm
app-dir-module.js16750644editdlrm
app-dir-module.js.map26320644editdlrm
app-info-log.d.ts6170644editdlrm
app-info-log.js48460644editdlrm
app-info-log.js.map58670644editdlrm
async-callback-set.d.ts1400644editdlrm
async-callback-set.js7330644editdlrm
async-callback-set.js.map11130644editdlrm
cache-control.d.ts5720644editdlrm
cache-control.js8150644editdlrm
cache-control.js.map16230644editdlrm
chrome-devtools-workspace.d.ts4180644editdlrm
chrome-devtools-workspace.js43680644editdlrm
chrome-devtools-workspace.js.map41900644editdlrm
clone-response.d.ts5310644editdlrm
clone-response.js26410644editdlrm
clone-response.js.map44410644editdlrm
cpu-profile.d.ts1120644editdlrm
cpu-profile.js10340644editdlrm
cpu-profile.js.map20620644editdlrm
decode-query-path-parameter.d.ts1890644editdlrm
decode-query-path-parameter.js6880644editdlrm
decode-query-path-parameter.js.map7550644editdlrm
dedupe-fetch.d.ts1470644editdlrm
dedupe-fetch.js67850644editdlrm
dedupe-fetch.js.map73960644editdlrm
dev-bundler-service.d.ts11830644editdlrm
dev-bundler-service.js32380644editdlrm
dev-bundler-service.js.map57920644editdlrm
disk-lru-cache.external.d.ts8080644editdlrm
disk-lru-cache.external.js19150644editdlrm
disk-lru-cache.external.js.map31460644editdlrm
etag.d.ts4530644editdlrm
etag.js15850644editdlrm
etag.js.map21980644editdlrm
find-page-file.d.ts13950644editdlrm
find-page-file.js54210644editdlrm
find-page-file.js.map94400644editdlrm
fix-mojibake.d.ts600644editdlrm
fix-mojibake.js7270644editdlrm
fix-mojibake.js.map10410644editdlrm
format-hostname.d.ts2150644editdlrm
format-hostname.js4080644editdlrm
format-hostname.js.map6100644editdlrm
i18n-provider.d.ts23910644editdlrm
i18n-provider.js55930644editdlrm
i18n-provider.js.map90460644editdlrm
implicit-tags.d.ts9860644editdlrm
implicit-tags.js26850644editdlrm
implicit-tags.js.map52120644editdlrm
is-ipv6.d.ts520644editdlrm
is-ipv6.js22840644editdlrm
is-ipv6.js.map34070644editdlrm
lazy-result.d.ts5650644editdlrm
lazy-result.js12460644editdlrm
lazy-result.js.map19070644editdlrm
lru-cache.d.ts36610644editdlrm
lru-cache.js66430644editdlrm
lru-cache.js.map113580644editdlrm
match-next-data-pathname.d.ts1130644editdlrm
match-next-data-pathname.js5510644editdlrm
match-next-data-pathname.js.map6360644editdlrm
mock-request.d.ts41250644editdlrm
mock-request.js144950644editdlrm
mock-request.js.map212690644editdlrm
node-fs-methods.d.ts930644editdlrm
node-fs-methods.js7720644editdlrm
node-fs-methods.js.map9760644editdlrm
parse-stack.d.ts2930644editdlrm
parse-stack.js17990644editdlrm
parse-stack.js.map29910644editdlrm
patch-fetch.d.ts9580644editdlrm
patch-fetch.js459600644editdlrm
patch-fetch.js.map647100644editdlrm
patch-set-header.d.ts4640644editdlrm
patch-set-header.js14520644editdlrm
patch-set-header.js.map24630644editdlrm
render-server.d.ts38030644editdlrm
render-server.js39380644editdlrm
render-server.js.map63770644editdlrm
router-server.d.ts8160644editdlrm
router-server.js330710644editdlrm
router-server.js.map464730644editdlrm
server-action-request-meta.d.ts5370644editdlrm
server-action-request-meta.js21160644editdlrm
server-action-request-meta.js.map30700644editdlrm
source-maps.d.ts19760644editdlrm
source-maps.js90100644editdlrm
source-maps.js.map149080644editdlrm
start-server.d.ts10600644editdlrm
start-server.js195790644editdlrm
start-server.js.map276000644editdlrm
streaming-metadata.d.ts2740644editdlrm
streaming-metadata.js11370644editdlrm
streaming-metadata.js.map15880644editdlrm
to-route.d.ts5060644editdlrm
to-route.js7780644editdlrm
to-route.js.map8630644editdlrm
types.d.ts2910644editdlrm
types.js1150644editdlrm
types.js.map670644editdlrm
utils.d.ts29660644editdlrm
utils.js83120644editdlrm
utils.js.map136580644editdlrm
worker-utils.d.ts570644editdlrm
worker-utils.js11280644editdlrm
worker-utils.js.map11250644editdlrm
Edit: /opt/canhelp/node_modules/next/dist/server/lib/lru-cache.js (6643B)
/** * Node in the doubly-linked list used for LRU tracking. * Each node represents a cache entry with bidirectional pointers. */ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "LRUCache", { enumerable: true, get: function() { return LRUCache; } }); class LRUNode { constructor(key, data, size){ this.prev = null; this.next = null; this.key = key; this.data = data; this.size = size; } } /** * Sentinel node used for head/tail boundaries. * These nodes don't contain actual cache data but simplify list operations. */ class SentinelNode { constructor(){ this.prev = null; this.next = null; } } class LRUCache { constructor(maxSize, calculateSize, onEvict){ this.cache = new Map(); this.totalSize = 0; this.maxSize = maxSize; this.calculateSize = calculateSize; this.onEvict = onEvict; // Create sentinel nodes to simplify doubly-linked list operations // HEAD <-> TAIL (empty list) this.head = new SentinelNode(); this.tail = new SentinelNode(); this.head.next = this.tail; this.tail.prev = this.head; } /** * Adds a node immediately after the head (marks as most recently used). * Used when inserting new items or when an item is accessed. * PRECONDITION: node must be disconnected (prev/next should be null) */ addToHead(node) { node.prev = this.head; node.next = this.head.next; // head.next is always non-null (points to tail or another node) this.head.next.prev = node; this.head.next = node; } /** * Removes a node from its current position in the doubly-linked list. * Updates the prev/next pointers of adjacent nodes to maintain list integrity. * PRECONDITION: node must be connected (prev/next are non-null) */ removeNode(node) { // Connected nodes always have non-null prev/next node.prev.next = node.next; node.next.prev = node.prev; } /** * Moves an existing node to the head position (marks as most recently used). * This is the core LRU operation - accessed items become most recent. */ moveToHead(node) { this.removeNode(node); this.addToHead(node); } /** * Removes and returns the least recently used node (the one before tail). * This is called during eviction when the cache exceeds capacity. * PRECONDITION: cache is not empty (ensured by caller) */ removeTail() { const lastNode = this.tail.prev; // tail.prev is always non-null and always LRUNode when cache is not empty this.removeNode(lastNode); return lastNode; } /** * Sets a key-value pair in the cache. * If the key exists, updates the value and moves to head. * If new, adds at head and evicts from tail if necessary. * * Time Complexity: * - O(1) for uniform item sizes * - O(k) where k is the number of items evicted (can be O(N) for variable sizes) */ set(key, value) { const size = (this.calculateSize == null ? void 0 : this.calculateSize.call(this, value)) ?? 1; if (size <= 0) { throw Object.defineProperty(new Error(`LRUCache: calculateSize returned ${size}, but size must be > 0. ` + `Items with size 0 would never be evicted, causing unbounded cache growth.`), "__NEXT_ERROR_CODE", { value: "E789", enumerable: false, configurable: true }); } if (size > this.maxSize) { console.warn('Single item size exceeds maxSize'); return false; } const existing = this.cache.get(key); if (existing) { // Update existing node: adjust size and move to head (most recent) existing.data = value; this.totalSize = this.totalSize - existing.size + size; existing.size = size; this.moveToHead(existing); } else { // Add new node at head (most recent position) const newNode = new LRUNode(key, value, size); this.cache.set(key, newNode); this.addToHead(newNode); this.totalSize += size; } // Evict least recently used items until under capacity while(this.totalSize > this.maxSize && this.cache.size > 0){ const tail = this.removeTail(); this.cache.delete(tail.key); this.totalSize -= tail.size; this.onEvict == null ? void 0 : this.onEvict.call(this, tail.key, tail.data); } return true; } /** * Checks if a key exists in the cache. * This is a pure query operation - does NOT update LRU order. * * Time Complexity: O(1) */ has(key) { return this.cache.has(key); } /** * Retrieves a value by key and marks it as most recently used. * Moving to head maintains the LRU property for future evictions. * * Time Complexity: O(1) */ get(key) { const node = this.cache.get(key); if (!node) return undefined; // Mark as most recently used by moving to head this.moveToHead(node); return node.data; } /** * Returns an iterator over the cache entries. The order is outputted in the * order of most recently used to least recently used. */ *[Symbol.iterator]() { let current = this.head.next; while(current && current !== this.tail){ // Between head and tail, current is always LRUNode const node = current; yield [ node.key, node.data ]; current = current.next; } } /** * Removes a specific key from the cache. * Updates both the hash map and doubly-linked list. * * Note: This is an explicit removal and does NOT trigger the `onEvict` * callback. Use this for intentional deletions where eviction tracking * is not needed. * * Time Complexity: O(1) */ remove(key) { const node = this.cache.get(key); if (!node) return; this.removeNode(node); this.cache.delete(key); this.totalSize -= node.size; } /** * Returns the number of items in the cache. */ get size() { return this.cache.size; } /** * Returns the current total size of all cached items. * This uses the custom size calculation if provided. */ get currentSize() { return this.totalSize; } } //# sourceMappingURL=lru-cache.js.map