/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/dedupe-fetch.js (6785B)
/** * Based on https://github.com/facebook/react/blob/d4e78c42a94be027b4dc7ed2659a5fddfbf9bd4e/packages/react/src/ReactFetch.js */ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "createDedupeFetch", { enumerable: true, get: function() { return createDedupeFetch; } }); const _react = /*#__PURE__*/ _interop_require_wildcard(require("react")); const _cloneresponse = require("./clone-response"); const _invarianterror = require("../../shared/lib/invariant-error"); function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } function _interop_require_wildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = { __proto__: null }; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for(var key in obj){ if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } const simpleCacheKey = '["GET",[],null,"follow",null,null,null,null]' // generateCacheKey(new Request('https://blank')); ; function generateCacheKey(request) { // We pick the fields that goes into the key used to dedupe requests. // We don't include the `cache` field, because we end up using whatever // caching resulted from the first request. // Notably we currently don't consider non-standard (or future) options. // This might not be safe. TODO: warn for non-standard extensions differing. // IF YOU CHANGE THIS UPDATE THE simpleCacheKey ABOVE. return JSON.stringify([ request.method, Array.from(request.headers.entries()), request.mode, request.redirect, request.credentials, request.referrer, request.referrerPolicy, request.integrity ]); } function createDedupeFetch(originalFetch) { const getCacheEntries = _react.cache(// eslint-disable-next-line @typescript-eslint/no-unused-vars -- url is the cache key (url)=>[]); return function dedupeFetch(resource, options) { if (options && options.signal) { // If we're passed a signal, then we assume that // someone else controls the lifetime of this object and opts out of // caching. It's effectively the opt-out mechanism. // Ideally we should be able to check this on the Request but // it always gets initialized with its own signal so we don't // know if it's supposed to override - unless we also override the // Request constructor. return originalFetch(resource, options); } // Normalize the Request let url; let cacheKey; if (typeof resource === 'string' && !options) { // Fast path. cacheKey = simpleCacheKey; url = resource; } else { // Normalize the request. // if resource is not a string or a URL (its an instance of Request) // then do not instantiate a new Request but instead // reuse the request as to not disturb the body in the event it's a ReadableStream. const request = typeof resource === 'string' || resource instanceof URL ? new Request(resource, options) : resource; if (request.method !== 'GET' && request.method !== 'HEAD' || request.keepalive) { // We currently don't dedupe requests that might have side-effects. Those // have to be explicitly cached. We assume that the request doesn't have a // body if it's GET or HEAD. // keepalive gets treated the same as if you passed a custom cache signal. return originalFetch(resource, options); } cacheKey = generateCacheKey(request); url = request.url; } const cacheEntries = getCacheEntries(url); for(let i = 0, j = cacheEntries.length; i < j; i += 1){ const [key, promise] = cacheEntries[i]; if (key === cacheKey) { return promise.then(()=>{ const response = cacheEntries[i][2]; if (!response) throw Object.defineProperty(new _invarianterror.InvariantError('No cached response'), "__NEXT_ERROR_CODE", { value: "E579", enumerable: false, configurable: true }); // We're cloning the response using this utility because there exists // a bug in the undici library around response cloning. See the // following pull request for more details: // https://github.com/vercel/next.js/pull/73274 const [cloned1, cloned2] = (0, _cloneresponse.cloneResponse)(response); cacheEntries[i][2] = cloned2; return cloned1; }); } } // We pass the original arguments here in case normalizing the Request // doesn't include all the options in this environment. const promise = originalFetch(resource, options); const entry = [ cacheKey, promise, null ]; cacheEntries.push(entry); return promise.then((response)=>{ // We're cloning the response using this utility because there exists // a bug in the undici library around response cloning. See the // following pull request for more details: // https://github.com/vercel/next.js/pull/73274 const [cloned1, cloned2] = (0, _cloneresponse.cloneResponse)(response); entry[2] = cloned2; return cloned1; }); }; } //# sourceMappingURL=dedupe-fetch.js.map