Initial boiler plate project
This commit is contained in:
15
node_modules/next/dist/server/response-cache/index.d.ts
generated
vendored
Normal file
15
node_modules/next/dist/server/response-cache/index.d.ts
generated
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
import type { IncrementalCache, ResponseCacheEntry, ResponseGenerator, ResponseCacheBase } from './types';
|
||||
import { RouteKind } from '../future/route-kind';
|
||||
export * from './types';
|
||||
export default class ResponseCache implements ResponseCacheBase {
|
||||
private readonly batcher;
|
||||
private previousCacheItem?;
|
||||
private minimalMode?;
|
||||
constructor(minimalMode: boolean);
|
||||
get(key: string | null, responseGenerator: ResponseGenerator, context: {
|
||||
routeKind?: RouteKind;
|
||||
isOnDemandRevalidate?: boolean;
|
||||
isPrefetch?: boolean;
|
||||
incrementalCache: IncrementalCache;
|
||||
}): Promise<ResponseCacheEntry | null>;
|
||||
}
|
||||
149
node_modules/next/dist/server/response-cache/index.js
generated
vendored
Normal file
149
node_modules/next/dist/server/response-cache/index.js
generated
vendored
Normal file
@ -0,0 +1,149 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "default", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return ResponseCache;
|
||||
}
|
||||
});
|
||||
0 && __export(require("./types"));
|
||||
const _routekind = require("../future/route-kind");
|
||||
const _batcher = require("../../lib/batcher");
|
||||
const _scheduler = require("../../lib/scheduler");
|
||||
const _utils = require("./utils");
|
||||
_export_star(require("./types"), exports);
|
||||
function _export_star(from, to) {
|
||||
Object.keys(from).forEach(function(k) {
|
||||
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
||||
Object.defineProperty(to, k, {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return from[k];
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
return from;
|
||||
}
|
||||
class ResponseCache {
|
||||
constructor(minimalMode){
|
||||
this.batcher = _batcher.Batcher.create({
|
||||
// Ensure on-demand revalidate doesn't block normal requests, it should be
|
||||
// safe to run an on-demand revalidate for the same key as a normal request.
|
||||
cacheKeyFn: ({ key, isOnDemandRevalidate })=>`${key}-${isOnDemandRevalidate ? "1" : "0"}`,
|
||||
// We wait to do any async work until after we've added our promise to
|
||||
// `pendingResponses` to ensure that any any other calls will reuse the
|
||||
// same promise until we've fully finished our work.
|
||||
schedulerFn: _scheduler.scheduleOnNextTick
|
||||
});
|
||||
// this is a hack to avoid Webpack knowing this is equal to this.minimalMode
|
||||
// because we replace this.minimalMode to true in production bundles.
|
||||
const minimalModeKey = "minimalMode";
|
||||
this[minimalModeKey] = minimalMode;
|
||||
}
|
||||
async get(key, responseGenerator, context) {
|
||||
// If there is no key for the cache, we can't possibly look this up in the
|
||||
// cache so just return the result of the response generator.
|
||||
if (!key) return responseGenerator(false, null);
|
||||
const { incrementalCache, isOnDemandRevalidate = false } = context;
|
||||
const response = await this.batcher.batch({
|
||||
key,
|
||||
isOnDemandRevalidate
|
||||
}, async (cacheKey, resolve)=>{
|
||||
var _this_previousCacheItem;
|
||||
// We keep the previous cache entry around to leverage when the
|
||||
// incremental cache is disabled in minimal mode.
|
||||
if (this.minimalMode && ((_this_previousCacheItem = this.previousCacheItem) == null ? void 0 : _this_previousCacheItem.key) === cacheKey && this.previousCacheItem.expiresAt > Date.now()) {
|
||||
return this.previousCacheItem.entry;
|
||||
}
|
||||
// Coerce the kindHint into a given kind for the incremental cache.
|
||||
let kindHint;
|
||||
if (context.routeKind === _routekind.RouteKind.APP_PAGE || context.routeKind === _routekind.RouteKind.APP_ROUTE) {
|
||||
kindHint = "app";
|
||||
} else if (context.routeKind === _routekind.RouteKind.PAGES) {
|
||||
kindHint = "pages";
|
||||
}
|
||||
let resolved = false;
|
||||
let cachedResponse = null;
|
||||
try {
|
||||
cachedResponse = !this.minimalMode ? await incrementalCache.get(key, {
|
||||
kindHint
|
||||
}) : null;
|
||||
if (cachedResponse && !isOnDemandRevalidate) {
|
||||
var _cachedResponse_value;
|
||||
if (((_cachedResponse_value = cachedResponse.value) == null ? void 0 : _cachedResponse_value.kind) === "FETCH") {
|
||||
throw new Error(`invariant: unexpected cachedResponse of kind fetch in response cache`);
|
||||
}
|
||||
resolve({
|
||||
...cachedResponse,
|
||||
revalidate: cachedResponse.curRevalidate
|
||||
});
|
||||
resolved = true;
|
||||
if (!cachedResponse.isStale || context.isPrefetch) {
|
||||
// The cached value is still valid, so we don't need
|
||||
// to update it yet.
|
||||
return null;
|
||||
}
|
||||
}
|
||||
const cacheEntry = await responseGenerator(resolved, cachedResponse, true);
|
||||
// If the cache entry couldn't be generated, we don't want to cache
|
||||
// the result.
|
||||
if (!cacheEntry) {
|
||||
// Unset the previous cache item if it was set.
|
||||
if (this.minimalMode) this.previousCacheItem = undefined;
|
||||
return null;
|
||||
}
|
||||
const resolveValue = await (0, _utils.fromResponseCacheEntry)({
|
||||
...cacheEntry,
|
||||
isMiss: !cachedResponse
|
||||
});
|
||||
if (!resolveValue) {
|
||||
// Unset the previous cache item if it was set.
|
||||
if (this.minimalMode) this.previousCacheItem = undefined;
|
||||
return null;
|
||||
}
|
||||
// For on-demand revalidate wait to resolve until cache is set.
|
||||
// Otherwise resolve now.
|
||||
if (!isOnDemandRevalidate && !resolved) {
|
||||
resolve(resolveValue);
|
||||
resolved = true;
|
||||
}
|
||||
if (typeof resolveValue.revalidate !== "undefined") {
|
||||
if (this.minimalMode) {
|
||||
this.previousCacheItem = {
|
||||
key: cacheKey,
|
||||
entry: resolveValue,
|
||||
expiresAt: Date.now() + 1000
|
||||
};
|
||||
} else {
|
||||
await incrementalCache.set(key, resolveValue.value, {
|
||||
revalidate: resolveValue.revalidate
|
||||
});
|
||||
}
|
||||
}
|
||||
return resolveValue;
|
||||
} catch (err) {
|
||||
// When a getStaticProps path is erroring we automatically re-set the
|
||||
// existing cache under a new expiration to prevent non-stop retrying.
|
||||
if (cachedResponse) {
|
||||
await incrementalCache.set(key, cachedResponse.value, {
|
||||
revalidate: Math.min(Math.max(cachedResponse.revalidate || 3, 3), 30)
|
||||
});
|
||||
}
|
||||
// While revalidating in the background we can't reject as we already
|
||||
// resolved the cache entry so log the error here.
|
||||
if (resolved) {
|
||||
console.error(err);
|
||||
return null;
|
||||
}
|
||||
// We haven't resolved yet, so let's throw to indicate an error.
|
||||
throw err;
|
||||
}
|
||||
});
|
||||
return (0, _utils.toResponseCacheEntry)(response);
|
||||
}
|
||||
}
|
||||
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/next/dist/server/response-cache/index.js.map
generated
vendored
Normal file
1
node_modules/next/dist/server/response-cache/index.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../src/server/response-cache/index.ts"],"names":["ResponseCache","constructor","minimalMode","batcher","Batcher","create","cacheKeyFn","key","isOnDemandRevalidate","schedulerFn","scheduleOnNextTick","minimalModeKey","get","responseGenerator","context","incrementalCache","response","batch","cacheKey","resolve","previousCacheItem","expiresAt","Date","now","entry","kindHint","routeKind","RouteKind","APP_PAGE","APP_ROUTE","PAGES","resolved","cachedResponse","value","kind","Error","revalidate","curRevalidate","isStale","isPrefetch","cacheEntry","undefined","resolveValue","fromResponseCacheEntry","isMiss","set","err","Math","min","max","console","error","toResponseCacheEntry"],"mappings":";;;;+BAgBA;;;eAAqBA;;;;2BARK;yBAEF;2BACW;uBAC0B;qBAE/C;;;;;;;;;;;;;;AAEC,MAAMA;IAwBnBC,YAAYC,WAAoB,CAAE;aAvBjBC,UAAUC,gBAAO,CAACC,MAAM,CAIvC;YACA,0EAA0E;YAC1E,4EAA4E;YAC5EC,YAAY,CAAC,EAAEC,GAAG,EAAEC,oBAAoB,EAAE,GACxC,CAAC,EAAED,IAAI,CAAC,EAAEC,uBAAuB,MAAM,IAAI,CAAC;YAC9C,sEAAsE;YACtE,uEAAuE;YACvE,oDAAoD;YACpDC,aAAaC,6BAAkB;QACjC;QAWE,4EAA4E;QAC5E,qEAAqE;QACrE,MAAMC,iBAAiB;QACvB,IAAI,CAACA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AAI,GAAG,IACzC;oBAEJ;gBACF;gBAEA,qEAAqE;gBACrE,kDAAkD;gBAClD,IAAIL,UAAU;oBACZmB,QAAQC,KAAK,CAACL;oBACd,OAAO;gBACT;gBAEA,gEAAgE;gBAChE,MAAMA;YACR;QACF;QAGF,OAAOM,IAAAA,2BAAoB,EAACpC;IAC9B;AACF"}
|
||||
107
node_modules/next/dist/server/response-cache/types.d.ts
generated
vendored
Normal file
107
node_modules/next/dist/server/response-cache/types.d.ts
generated
vendored
Normal file
@ -0,0 +1,107 @@
|
||||
/// <reference types="node" />
|
||||
/// <reference types="node" />
|
||||
import type { OutgoingHttpHeaders } from 'http';
|
||||
import type RenderResult from '../render-result';
|
||||
import type { Revalidate } from '../lib/revalidate';
|
||||
import type { RouteKind } from '../../server/future/route-kind';
|
||||
export interface ResponseCacheBase {
|
||||
get(key: string | null, responseGenerator: ResponseGenerator, context: {
|
||||
isOnDemandRevalidate?: boolean;
|
||||
isPrefetch?: boolean;
|
||||
incrementalCache: IncrementalCache;
|
||||
/**
|
||||
* This is a hint to the cache to help it determine what kind of route
|
||||
* this is so it knows where to look up the cache entry from. If not
|
||||
* provided it will test the filesystem to check.
|
||||
*/
|
||||
routeKind?: RouteKind;
|
||||
}): Promise<ResponseCacheEntry | null>;
|
||||
}
|
||||
export interface CachedFetchValue {
|
||||
kind: 'FETCH';
|
||||
data: {
|
||||
headers: {
|
||||
[k: string]: string;
|
||||
};
|
||||
body: string;
|
||||
url: string;
|
||||
status?: number;
|
||||
};
|
||||
tags?: string[];
|
||||
revalidate: number;
|
||||
}
|
||||
export interface CachedRedirectValue {
|
||||
kind: 'REDIRECT';
|
||||
props: Object;
|
||||
}
|
||||
interface CachedPageValue {
|
||||
kind: 'PAGE';
|
||||
html: RenderResult;
|
||||
postponed: string | undefined;
|
||||
pageData: Object;
|
||||
status: number | undefined;
|
||||
headers: OutgoingHttpHeaders | undefined;
|
||||
}
|
||||
export interface CachedRouteValue {
|
||||
kind: 'ROUTE';
|
||||
body: Buffer;
|
||||
status: number;
|
||||
headers: OutgoingHttpHeaders;
|
||||
}
|
||||
export interface CachedImageValue {
|
||||
kind: 'IMAGE';
|
||||
etag: string;
|
||||
buffer: Buffer;
|
||||
extension: string;
|
||||
isMiss?: boolean;
|
||||
isStale?: boolean;
|
||||
}
|
||||
interface IncrementalCachedPageValue {
|
||||
kind: 'PAGE';
|
||||
html: string;
|
||||
pageData: Object;
|
||||
postponed: string | undefined;
|
||||
headers: OutgoingHttpHeaders | undefined;
|
||||
status: number | undefined;
|
||||
}
|
||||
export type IncrementalCacheEntry = {
|
||||
curRevalidate?: Revalidate;
|
||||
revalidateAfter: Revalidate;
|
||||
isStale?: boolean | -1;
|
||||
value: IncrementalCacheValue | null;
|
||||
};
|
||||
export type IncrementalCacheValue = CachedRedirectValue | IncrementalCachedPageValue | CachedImageValue | CachedFetchValue | CachedRouteValue;
|
||||
export type ResponseCacheValue = CachedRedirectValue | CachedPageValue | CachedImageValue | CachedRouteValue;
|
||||
export type ResponseCacheEntry = {
|
||||
revalidate?: Revalidate;
|
||||
value: ResponseCacheValue | null;
|
||||
isStale?: boolean | -1;
|
||||
isMiss?: boolean;
|
||||
};
|
||||
/**
|
||||
* @param hasResolved whether the responseGenerator has resolved it's promise
|
||||
* @param previousCacheEntry the previous cache entry if it exists or the current
|
||||
*/
|
||||
export type ResponseGenerator = (hasResolved: boolean, previousCacheEntry?: IncrementalCacheItem, isRevalidating?: boolean) => Promise<ResponseCacheEntry | null>;
|
||||
export type IncrementalCacheItem = {
|
||||
revalidateAfter?: number | false;
|
||||
curRevalidate?: number | false;
|
||||
revalidate?: number | false;
|
||||
value: IncrementalCacheValue | null;
|
||||
isStale?: boolean | -1;
|
||||
isMiss?: boolean;
|
||||
} | null;
|
||||
export type IncrementalCacheKindHint = 'app' | 'pages' | 'fetch';
|
||||
export interface IncrementalCache {
|
||||
get: (key: string, ctx?: {
|
||||
/**
|
||||
* The kind of cache entry to get. If not provided it will try to
|
||||
* determine the kind from the filesystem.
|
||||
*/
|
||||
kindHint?: IncrementalCacheKindHint;
|
||||
}) => Promise<IncrementalCacheItem>;
|
||||
set: (key: string, data: IncrementalCacheValue | null, ctx: {
|
||||
revalidate: Revalidate;
|
||||
}) => Promise<void>;
|
||||
}
|
||||
export {};
|
||||
6
node_modules/next/dist/server/response-cache/types.js
generated
vendored
Normal file
6
node_modules/next/dist/server/response-cache/types.js
generated
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
//# sourceMappingURL=types.js.map
|
||||
1
node_modules/next/dist/server/response-cache/types.js.map
generated
vendored
Normal file
1
node_modules/next/dist/server/response-cache/types.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":[],"names":[],"mappings":""}
|
||||
3
node_modules/next/dist/server/response-cache/utils.d.ts
generated
vendored
Normal file
3
node_modules/next/dist/server/response-cache/utils.d.ts
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
import type { IncrementalCacheItem, ResponseCacheEntry } from './types';
|
||||
export declare function fromResponseCacheEntry(cacheEntry: ResponseCacheEntry): Promise<IncrementalCacheItem>;
|
||||
export declare function toResponseCacheEntry(response: IncrementalCacheItem): Promise<ResponseCacheEntry | null>;
|
||||
64
node_modules/next/dist/server/response-cache/utils.js
generated
vendored
Normal file
64
node_modules/next/dist/server/response-cache/utils.js
generated
vendored
Normal file
@ -0,0 +1,64 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
0 && (module.exports = {
|
||||
fromResponseCacheEntry: null,
|
||||
toResponseCacheEntry: null
|
||||
});
|
||||
function _export(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: true,
|
||||
get: all[name]
|
||||
});
|
||||
}
|
||||
_export(exports, {
|
||||
fromResponseCacheEntry: function() {
|
||||
return fromResponseCacheEntry;
|
||||
},
|
||||
toResponseCacheEntry: function() {
|
||||
return toResponseCacheEntry;
|
||||
}
|
||||
});
|
||||
const _renderresult = /*#__PURE__*/ _interop_require_default(require("../render-result"));
|
||||
function _interop_require_default(obj) {
|
||||
return obj && obj.__esModule ? obj : {
|
||||
default: obj
|
||||
};
|
||||
}
|
||||
async function fromResponseCacheEntry(cacheEntry) {
|
||||
var _cacheEntry_value;
|
||||
return {
|
||||
...cacheEntry,
|
||||
value: ((_cacheEntry_value = cacheEntry.value) == null ? void 0 : _cacheEntry_value.kind) === "PAGE" ? {
|
||||
kind: "PAGE",
|
||||
html: await cacheEntry.value.html.toUnchunkedString(true),
|
||||
postponed: cacheEntry.value.postponed,
|
||||
pageData: cacheEntry.value.pageData,
|
||||
headers: cacheEntry.value.headers,
|
||||
status: cacheEntry.value.status
|
||||
} : cacheEntry.value
|
||||
};
|
||||
}
|
||||
async function toResponseCacheEntry(response) {
|
||||
var _response_value, _response_value1;
|
||||
if (!response) return null;
|
||||
if (((_response_value = response.value) == null ? void 0 : _response_value.kind) === "FETCH") {
|
||||
throw new Error("Invariant: unexpected cachedResponse of kind fetch in response cache");
|
||||
}
|
||||
return {
|
||||
isMiss: response.isMiss,
|
||||
isStale: response.isStale,
|
||||
revalidate: response.revalidate,
|
||||
value: ((_response_value1 = response.value) == null ? void 0 : _response_value1.kind) === "PAGE" ? {
|
||||
kind: "PAGE",
|
||||
html: _renderresult.default.fromStatic(response.value.html),
|
||||
pageData: response.value.pageData,
|
||||
postponed: response.value.postponed,
|
||||
headers: response.value.headers,
|
||||
status: response.value.status
|
||||
} : response.value
|
||||
};
|
||||
}
|
||||
|
||||
//# sourceMappingURL=utils.js.map
|
||||
1
node_modules/next/dist/server/response-cache/utils.js.map
generated
vendored
Normal file
1
node_modules/next/dist/server/response-cache/utils.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../src/server/response-cache/utils.ts"],"names":["fromResponseCacheEntry","toResponseCacheEntry","cacheEntry","value","kind","html","toUnchunkedString","postponed","pageData","headers","status","response","Error","isMiss","isStale","revalidate","RenderResult","fromStatic"],"mappings":";;;;;;;;;;;;;;;IAIsBA,sBAAsB;eAAtBA;;IAmBAC,oBAAoB;eAApBA;;;qEArBG;;;;;;AAElB,eAAeD,uBACpBE,UAA8B;QAK1BA;IAHJ,OAAO;QACL,GAAGA,UAAU;QACbC,OACED,EAAAA,oBAAAA,WAAWC,KAAK,qBAAhBD,kBAAkBE,IAAI,MAAK,SACvB;YACEA,MAAM;YACNC,MAAM,MAAMH,WAAWC,KAAK,CAACE,IAAI,CAACC,iBAAiB,CAAC;YACpDC,WAAWL,WAAWC,KAAK,CAACI,SAAS;YACrCC,UAAUN,WAAWC,KAAK,CAACK,QAAQ;YACnCC,SAASP,WAAWC,KAAK,CAACM,OAAO;YACjCC,QAAQR,WAAWC,KAAK,CAACO,MAAM;QACjC,IACAR,WAAWC,KAAK;IACxB;AACF;AAEO,eAAeF,qBACpBU,QAA8B;QAI1BA,iBAWAA;IAbJ,IAAI,CAACA,UAAU,OAAO;IAEtB,IAAIA,EAAAA,kBAAAA,SAASR,KAAK,qBAAdQ,gBAAgBP,IAAI,MAAK,SAAS;QACpC,MAAM,IAAIQ,MACR;IAEJ;IAEA,OAAO;QACLC,QAAQF,SAASE,MAAM;QACvBC,SAASH,SAASG,OAAO;QACzBC,YAAYJ,SAASI,UAAU;QAC/BZ,OACEQ,EAAAA,mBAAAA,SAASR,KAAK,qBAAdQ,iBAAgBP,IAAI,MAAK,SACrB;YACEA,MAAM;YACNC,MAAMW,qBAAY,CAACC,UAAU,CAACN,SAASR,KAAK,CAACE,IAAI;YACjDG,UAAUG,SAASR,KAAK,CAACK,QAAQ;YACjCD,WAAWI,SAASR,KAAK,CAACI,SAAS;YACnCE,SAASE,SAASR,KAAK,CAACM,OAAO;YAC/BC,QAAQC,SAASR,KAAK,CAACO,MAAM;QAC/B,IACAC,SAASR,KAAK;IACtB;AACF"}
|
||||
20
node_modules/next/dist/server/response-cache/web.d.ts
generated
vendored
Normal file
20
node_modules/next/dist/server/response-cache/web.d.ts
generated
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
import type { ResponseCacheEntry, ResponseGenerator } from './types';
|
||||
/**
|
||||
* In the web server, there is currently no incremental cache provided and we
|
||||
* always SSR the page.
|
||||
*/
|
||||
export default class WebResponseCache {
|
||||
pendingResponses: Map<string, Promise<ResponseCacheEntry | null>>;
|
||||
previousCacheItem?: {
|
||||
key: string;
|
||||
entry: ResponseCacheEntry | null;
|
||||
expiresAt: number;
|
||||
};
|
||||
minimalMode?: boolean;
|
||||
constructor(minimalMode: boolean);
|
||||
get(key: string | null, responseGenerator: ResponseGenerator, context: {
|
||||
isOnDemandRevalidate?: boolean;
|
||||
isPrefetch?: boolean;
|
||||
incrementalCache: any;
|
||||
}): Promise<ResponseCacheEntry | null>;
|
||||
}
|
||||
95
node_modules/next/dist/server/response-cache/web.js
generated
vendored
Normal file
95
node_modules/next/dist/server/response-cache/web.js
generated
vendored
Normal file
@ -0,0 +1,95 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, /**
|
||||
* In the web server, there is currently no incremental cache provided and we
|
||||
* always SSR the page.
|
||||
*/ "default", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return WebResponseCache;
|
||||
}
|
||||
});
|
||||
const _detachedpromise = require("../../lib/detached-promise");
|
||||
class WebResponseCache {
|
||||
constructor(minimalMode){
|
||||
this.pendingResponses = new Map();
|
||||
// this is a hack to avoid Webpack knowing this is equal to this.minimalMode
|
||||
// because we replace this.minimalMode to true in production bundles.
|
||||
Object.assign(this, {
|
||||
minimalMode
|
||||
});
|
||||
}
|
||||
get(key, responseGenerator, context) {
|
||||
var _this_previousCacheItem;
|
||||
// ensure on-demand revalidate doesn't block normal requests
|
||||
const pendingResponseKey = key ? `${key}-${context.isOnDemandRevalidate ? "1" : "0"}` : null;
|
||||
const pendingResponse = pendingResponseKey ? this.pendingResponses.get(pendingResponseKey) : null;
|
||||
if (pendingResponse) {
|
||||
return pendingResponse;
|
||||
}
|
||||
const { promise, resolve: resolver, reject: rejecter } = new _detachedpromise.DetachedPromise();
|
||||
if (pendingResponseKey) {
|
||||
this.pendingResponses.set(pendingResponseKey, promise);
|
||||
}
|
||||
let resolved = false;
|
||||
const resolve = (cacheEntry)=>{
|
||||
if (pendingResponseKey) {
|
||||
// Ensure all reads from the cache get the latest value.
|
||||
this.pendingResponses.set(pendingResponseKey, Promise.resolve(cacheEntry));
|
||||
}
|
||||
if (!resolved) {
|
||||
resolved = true;
|
||||
resolver(cacheEntry);
|
||||
}
|
||||
};
|
||||
// we keep the previous cache entry around to leverage
|
||||
// when the incremental cache is disabled in minimal mode
|
||||
if (pendingResponseKey && this.minimalMode && ((_this_previousCacheItem = this.previousCacheItem) == null ? void 0 : _this_previousCacheItem.key) === pendingResponseKey && this.previousCacheItem.expiresAt > Date.now()) {
|
||||
resolve(this.previousCacheItem.entry);
|
||||
this.pendingResponses.delete(pendingResponseKey);
|
||||
return promise;
|
||||
}
|
||||
(async ()=>{
|
||||
try {
|
||||
const cacheEntry = await responseGenerator(resolved);
|
||||
const resolveValue = cacheEntry === null ? null : {
|
||||
...cacheEntry,
|
||||
isMiss: true
|
||||
};
|
||||
// for on-demand revalidate wait to resolve until cache is set
|
||||
if (!context.isOnDemandRevalidate) {
|
||||
resolve(resolveValue);
|
||||
}
|
||||
if (key && cacheEntry && typeof cacheEntry.revalidate !== "undefined") {
|
||||
this.previousCacheItem = {
|
||||
key: pendingResponseKey || key,
|
||||
entry: cacheEntry,
|
||||
expiresAt: Date.now() + 1000
|
||||
};
|
||||
} else {
|
||||
this.previousCacheItem = undefined;
|
||||
}
|
||||
if (context.isOnDemandRevalidate) {
|
||||
resolve(resolveValue);
|
||||
}
|
||||
} catch (err) {
|
||||
// while revalidating in the background we can't reject as
|
||||
// we already resolved the cache entry so log the error here
|
||||
if (resolved) {
|
||||
console.error(err);
|
||||
} else {
|
||||
rejecter(err);
|
||||
}
|
||||
} finally{
|
||||
if (pendingResponseKey) {
|
||||
this.pendingResponses.delete(pendingResponseKey);
|
||||
}
|
||||
}
|
||||
})();
|
||||
return promise;
|
||||
}
|
||||
}
|
||||
|
||||
//# sourceMappingURL=web.js.map
|
||||
1
node_modules/next/dist/server/response-cache/web.js.map
generated
vendored
Normal file
1
node_modules/next/dist/server/response-cache/web.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../src/server/response-cache/web.ts"],"names":["WebResponseCache","constructor","minimalMode","pendingResponses","Map","Object","assign","get","key","responseGenerator","context","pendingResponseKey","isOnDemandRevalidate","pendingResponse","promise","resolve","resolver","reject","rejecter","DetachedPromise","set","resolved","cacheEntry","Promise","previousCacheItem","expiresAt","Date","now","entry","delete","resolveValue","isMiss","revalidate","undefined","err","console","error"],"mappings":";;;;+BAGA;;;CAGC,GACD;;;eAAqBA;;;iCAPW;AAOjB,MAAMA;IASnBC,YAAYC,WAAoB,CAAE;QAChC,IAAI,CAACC,gBAAgB,GAAG,IAAIC;QAC5B,4EAA4E;QAC5E,qEAAqE;QACrEC,OAAOC,MAAM,CAAC,IAAI,EAAE;YAAEJ;QAAY;IACpC;IAEOK,IACLC,GAAkB,EAClBC,iBAAoC,EACpCC,OAIC,EACmC;YA0ClC;QAzCF,4DAA4D;QAC5D,MAAMC,qBAAqBH,MACvB,CAAC,EAAEA,IAAI,CAAC,EAAEE,QAAQE,oBAAoB,GAAG,MAAM,IAAI,CAAC,GACpD;QAEJ,MAAMC,kBAAkBF,qBACpB,IAAI,CAACR,gBAAgB,CAACI,GAAG,CAACI,sBAC1B;QACJ,IAAIE,iBAAiB;YACnB,OAAOA;QACT;QAEA,MAAM,EACJC,OAAO,EACPC,SAASC,QAAQ,EACjBC,QAAQC,QAAQ,EACjB,GAAG,IAAIC,gCAAe;QACvB,IAAIR,oBAAoB;YACtB,IAAI,CAACR,gBAAgB,CAAC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