Initial commit
This commit is contained in:
12
frontend/webapp/node_modules/next/dist/server/async-storage/draft-mode-provider.d.ts
generated
vendored
Normal file
12
frontend/webapp/node_modules/next/dist/server/async-storage/draft-mode-provider.d.ts
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
import type { IncomingMessage } from 'http';
|
||||
import type { ReadonlyRequestCookies } from '../web/spec-extension/adapters/request-cookies';
|
||||
import type { ResponseCookies } from '../web/spec-extension/cookies';
|
||||
import type { BaseNextRequest } from '../base-http';
|
||||
import type { NextRequest } from '../web/spec-extension/request';
|
||||
import type { __ApiPreviewProps } from '../api-utils';
|
||||
export declare class DraftModeProvider {
|
||||
constructor(previewProps: __ApiPreviewProps | undefined, req: IncomingMessage | BaseNextRequest<unknown> | NextRequest, cookies: ReadonlyRequestCookies, mutableCookies: ResponseCookies);
|
||||
get isEnabled(): boolean;
|
||||
enable(): void;
|
||||
disable(): void;
|
||||
}
|
||||
62
frontend/webapp/node_modules/next/dist/server/async-storage/draft-mode-provider.js
generated
vendored
Normal file
62
frontend/webapp/node_modules/next/dist/server/async-storage/draft-mode-provider.js
generated
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "DraftModeProvider", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return DraftModeProvider;
|
||||
}
|
||||
});
|
||||
const _apiutils = require("../api-utils");
|
||||
class DraftModeProvider {
|
||||
constructor(previewProps, req, cookies, mutableCookies){
|
||||
var _cookies_get;
|
||||
// The logic for draftMode() is very similar to tryGetPreviewData()
|
||||
// but Draft Mode does not have any data associated with it.
|
||||
const isOnDemandRevalidate = previewProps && (0, _apiutils.checkIsOnDemandRevalidate)(req, previewProps).isOnDemandRevalidate;
|
||||
const cookieValue = (_cookies_get = cookies.get(_apiutils.COOKIE_NAME_PRERENDER_BYPASS)) == null ? void 0 : _cookies_get.value;
|
||||
this._isEnabled = Boolean(!isOnDemandRevalidate && cookieValue && previewProps && (cookieValue === previewProps.previewModeId || // In dev mode, the cookie can be actual hash value preview id but the preview props can still be `development-id`.
|
||||
process.env.NODE_ENV !== 'production' && previewProps.previewModeId === 'development-id'));
|
||||
this._previewModeId = previewProps == null ? void 0 : previewProps.previewModeId;
|
||||
this._mutableCookies = mutableCookies;
|
||||
}
|
||||
get isEnabled() {
|
||||
return this._isEnabled;
|
||||
}
|
||||
enable() {
|
||||
if (!this._previewModeId) {
|
||||
throw Object.defineProperty(new Error('Invariant: previewProps missing previewModeId this should never happen'), "__NEXT_ERROR_CODE", {
|
||||
value: "E93",
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
}
|
||||
this._mutableCookies.set({
|
||||
name: _apiutils.COOKIE_NAME_PRERENDER_BYPASS,
|
||||
value: this._previewModeId,
|
||||
httpOnly: true,
|
||||
sameSite: process.env.NODE_ENV !== 'development' ? 'none' : 'lax',
|
||||
secure: process.env.NODE_ENV !== 'development',
|
||||
path: '/'
|
||||
});
|
||||
this._isEnabled = true;
|
||||
}
|
||||
disable() {
|
||||
// To delete a cookie, set `expires` to a date in the past:
|
||||
// https://tools.ietf.org/html/rfc6265#section-4.1.1
|
||||
// `Max-Age: 0` is not valid, thus ignored, and the cookie is persisted.
|
||||
this._mutableCookies.set({
|
||||
name: _apiutils.COOKIE_NAME_PRERENDER_BYPASS,
|
||||
value: '',
|
||||
httpOnly: true,
|
||||
sameSite: process.env.NODE_ENV !== 'development' ? 'none' : 'lax',
|
||||
secure: process.env.NODE_ENV !== 'development',
|
||||
path: '/',
|
||||
expires: new Date(0)
|
||||
});
|
||||
this._isEnabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
//# sourceMappingURL=draft-mode-provider.js.map
|
||||
1
frontend/webapp/node_modules/next/dist/server/async-storage/draft-mode-provider.js.map
generated
vendored
Normal file
1
frontend/webapp/node_modules/next/dist/server/async-storage/draft-mode-provider.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../src/server/async-storage/draft-mode-provider.ts"],"sourcesContent":["import type { IncomingMessage } from 'http'\nimport type { ReadonlyRequestCookies } from '../web/spec-extension/adapters/request-cookies'\nimport type { ResponseCookies } from '../web/spec-extension/cookies'\nimport type { BaseNextRequest } from '../base-http'\nimport type { NextRequest } from '../web/spec-extension/request'\n\nimport {\n COOKIE_NAME_PRERENDER_BYPASS,\n checkIsOnDemandRevalidate,\n} from '../api-utils'\nimport type { __ApiPreviewProps } from '../api-utils'\n\nexport class DraftModeProvider {\n /**\n * @internal - this declaration is stripped via `tsc --stripInternal`\n */\n private _isEnabled: boolean\n\n /**\n * @internal - this declaration is stripped via `tsc --stripInternal`\n */\n private readonly _previewModeId: string | undefined\n\n /**\n * @internal - this declaration is stripped via `tsc --stripInternal`\n */\n private readonly _mutableCookies: ResponseCookies\n\n constructor(\n previewProps: __ApiPreviewProps | undefined,\n req: IncomingMessage | BaseNextRequest<unknown> | NextRequest,\n cookies: ReadonlyRequestCookies,\n mutableCookies: ResponseCookies\n ) {\n // The logic for draftMode() is very similar to tryGetPreviewData()\n // but Draft Mode does not have any data associated with it.\n const isOnDemandRevalidate =\n previewProps &&\n checkIsOnDemandRevalidate(req, previewProps).isOnDemandRevalidate\n\n const cookieValue = cookies.get(COOKIE_NAME_PRERENDER_BYPASS)?.value\n\n this._isEnabled = Boolean(\n !isOnDemandRevalidate &&\n cookieValue &&\n previewProps &&\n (cookieValue === previewProps.previewModeId ||\n // In dev mode, the cookie can be actual hash value preview id but the preview props can still be `development-id`.\n (process.env.NODE_ENV !== 'production' &&\n previewProps.previewModeId === 'development-id'))\n )\n\n this._previewModeId = previewProps?.previewModeId\n this._mutableCookies = mutableCookies\n }\n\n get isEnabled() {\n return this._isEnabled\n }\n\n enable() {\n if (!this._previewModeId) {\n throw new Error(\n 'Invariant: previewProps missing previewModeId this should never happen'\n )\n }\n\n this._mutableCookies.set({\n name: COOKIE_NAME_PRERENDER_BYPASS,\n value: this._previewModeId,\n httpOnly: true,\n sameSite: process.env.NODE_ENV !== 'development' ? 'none' : 'lax',\n secure: process.env.NODE_ENV !== 'development',\n path: '/',\n })\n\n this._isEnabled = true\n }\n\n disable() {\n // To delete a cookie, set `expires` to a date in the past:\n // https://tools.ietf.org/html/rfc6265#section-4.1.1\n // `Max-Age: 0` is not valid, thus ignored, and the cookie is persisted.\n this._mutableCookies.set({\n name: COOKIE_NAME_PRERENDER_BYPASS,\n value: '',\n httpOnly: true,\n sameSite: process.env.NODE_ENV !== 'development' ? 'none' : 'lax',\n secure: process.env.NODE_ENV !== 'development',\n path: '/',\n expires: new Date(0),\n })\n\n this._isEnabled = false\n }\n}\n"],"names":["DraftModeProvider","constructor","previewProps","req","cookies","mutableCookies","isOnDemandRevalidate","checkIsOnDemandRevalidate","cookieValue","get","COOKIE_NAME_PRERENDER_BYPASS","value","_isEnabled","Boolean","previewModeId","process","env","NODE_ENV","_previewModeId","_mutableCookies","isEnabled","enable","Error","set","name","httpOnly","sameSite","secure","path","disable","expires","Date"],"mappings":";;;;+BAYaA;;;eAAAA;;;0BAHN;AAGA,MAAMA;IAgBXC,YACEC,YAA2C,EAC3CC,GAA6D,EAC7DC,OAA+B,EAC/BC,cAA+B,CAC/B;YAOoBD;QANpB,mEAAmE;QACnE,4DAA4D;QAC5D,MAAME,uBACJJ,gBACAK,IAAAA,mCAAyB,EAACJ,KAAKD,cAAcI,oBAAoB;QAEnE,MAAME,eAAcJ,eAAAA,QAAQK,GAAG,CAACC,sCAA4B,sBAAxCN,aAA2CO,KAAK;QAEpE,IAAI,CAACC,UAAU,GAAGC,QAChB,CAACP,wBACCE,eACAN,gBACCM,CAAAA,gBAAgBN,aAAaY,aAAa,IACzC,mHAAmH;QAClHC,QAAQC,GAAG,CAACC,QAAQ,KAAK,gBACxBf,aAAaY,aAAa,KAAK,gBAAgB;QAGvD,IAAI,CAACI,cAAc,GAAGhB,gCAAAA,aAAcY,aAAa;QACjD,IAAI,CAACK,eAAe,GAAGd;IACzB;IAEA,IAAIe,YAAY;QACd,OAAO,IAAI,CAACR,UAAU;IACxB;IAEAS,SAAS;QACP,IAAI,CAAC,IAAI,CAACH,cAAc,EAAE;YACxB,MAAM,qBAEL,CAFK,IAAII,MACR,2EADI,qBAAA;uBAAA;4BAAA;8BAAA;YAEN;QACF;QAEA,IAAI,CAACH,eAAe,CAACI,GAAG,CAAC;YACvBC,MAAMd,sCAA4B;YAClCC,OAAO,IAAI,CAACO,cAAc;YAC1BO,UAAU;YACVC,UAAUX,QAAQC,GAAG,CAACC,QAAQ,KAAK,gBAAgB,SAAS;YAC5DU,QAAQZ,QAAQC,GAAG,CAACC,QAAQ,KAAK;YACjCW,MAAM;QACR;QAEA,IAAI,CAAChB,UAAU,GAAG;IACpB;IAEAiB,UAAU;QACR,2DAA2D;QAC3D,oDAAoD;QACpD,wEAAwE;QACxE,IAAI,CAACV,eAAe,CAACI,GAAG,CAAC;YACvBC,MAAMd,sCAA4B;YAClCC,OAAO;YACPc,UAAU;YACVC,UAAUX,QAAQC,GAAG,CAACC,QAAQ,KAAK,gBAAgB,SAAS;YAC5DU,QAAQZ,QAAQC,GAAG,CAACC,QAAQ,KAAK;YACjCW,MAAM;YACNE,SAAS,IAAIC,KAAK;QACpB;QAEA,IAAI,CAACnB,UAAU,GAAG;IACpB;AACF"}
|
||||
46
frontend/webapp/node_modules/next/dist/server/async-storage/request-store.d.ts
generated
vendored
Normal file
46
frontend/webapp/node_modules/next/dist/server/async-storage/request-store.d.ts
generated
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
import type { BaseNextRequest, BaseNextResponse } from '../base-http';
|
||||
import type { RequestStore } from '../app-render/work-unit-async-storage.external';
|
||||
import type { RenderOpts } from '../app-render/types';
|
||||
import type { NextRequest } from '../web/spec-extension/request';
|
||||
import type { __ApiPreviewProps } from '../api-utils';
|
||||
import type { ServerComponentsHmrCache } from '../response-cache';
|
||||
import type { RenderResumeDataCache } from '../resume-data-cache/resume-data-cache';
|
||||
import type { Params } from '../request/params';
|
||||
import type { ImplicitTags } from '../lib/implicit-tags';
|
||||
export type WrapperRenderOpts = Partial<Pick<RenderOpts, 'onUpdateCookies'>> & {
|
||||
previewProps?: __ApiPreviewProps;
|
||||
};
|
||||
type RequestContext = RequestResponsePair & {
|
||||
/**
|
||||
* The URL of the request. This only specifies the pathname and the search
|
||||
* part of the URL. This is only undefined when generating static paths (ie,
|
||||
* there is no request in progress, nor do we know one).
|
||||
*/
|
||||
url: {
|
||||
/**
|
||||
* The pathname of the requested URL.
|
||||
*/
|
||||
pathname: string;
|
||||
/**
|
||||
* The search part of the requested URL. If the request did not provide a
|
||||
* search part, this will be an empty string.
|
||||
*/
|
||||
search?: string;
|
||||
};
|
||||
phase: RequestStore['phase'];
|
||||
renderOpts?: WrapperRenderOpts;
|
||||
isHmrRefresh?: boolean;
|
||||
serverComponentsHmrCache?: ServerComponentsHmrCache;
|
||||
implicitTags: ImplicitTags;
|
||||
};
|
||||
type RequestResponsePair = {
|
||||
req: BaseNextRequest;
|
||||
res: BaseNextResponse;
|
||||
} | {
|
||||
req: NextRequest;
|
||||
res: undefined;
|
||||
};
|
||||
export declare function createRequestStoreForRender(req: RequestContext['req'], res: RequestContext['res'], url: RequestContext['url'], rootParams: Params, implicitTags: RequestContext['implicitTags'], onUpdateCookies: RenderOpts['onUpdateCookies'], previewProps: WrapperRenderOpts['previewProps'], isHmrRefresh: RequestContext['isHmrRefresh'], serverComponentsHmrCache: RequestContext['serverComponentsHmrCache'], renderResumeDataCache: RenderResumeDataCache | undefined): RequestStore;
|
||||
export declare function createRequestStoreForAPI(req: RequestContext['req'], url: RequestContext['url'], implicitTags: RequestContext['implicitTags'], onUpdateCookies: RenderOpts['onUpdateCookies'], previewProps: WrapperRenderOpts['previewProps']): RequestStore;
|
||||
export declare function synchronizeMutableCookies(store: RequestStore): void;
|
||||
export {};
|
||||
143
frontend/webapp/node_modules/next/dist/server/async-storage/request-store.js
generated
vendored
Normal file
143
frontend/webapp/node_modules/next/dist/server/async-storage/request-store.js
generated
vendored
Normal file
@@ -0,0 +1,143 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
0 && (module.exports = {
|
||||
createRequestStoreForAPI: null,
|
||||
createRequestStoreForRender: null,
|
||||
synchronizeMutableCookies: null
|
||||
});
|
||||
function _export(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: true,
|
||||
get: all[name]
|
||||
});
|
||||
}
|
||||
_export(exports, {
|
||||
createRequestStoreForAPI: function() {
|
||||
return createRequestStoreForAPI;
|
||||
},
|
||||
createRequestStoreForRender: function() {
|
||||
return createRequestStoreForRender;
|
||||
},
|
||||
synchronizeMutableCookies: function() {
|
||||
return synchronizeMutableCookies;
|
||||
}
|
||||
});
|
||||
const _approuterheaders = require("../../client/components/app-router-headers");
|
||||
const _headers = require("../web/spec-extension/adapters/headers");
|
||||
const _requestcookies = require("../web/spec-extension/adapters/request-cookies");
|
||||
const _cookies = require("../web/spec-extension/cookies");
|
||||
const _draftmodeprovider = require("./draft-mode-provider");
|
||||
const _utils = require("../web/utils");
|
||||
function getHeaders(headers) {
|
||||
const cleaned = _headers.HeadersAdapter.from(headers);
|
||||
for (const header of _approuterheaders.FLIGHT_HEADERS){
|
||||
cleaned.delete(header.toLowerCase());
|
||||
}
|
||||
return _headers.HeadersAdapter.seal(cleaned);
|
||||
}
|
||||
function getMutableCookies(headers, onUpdateCookies) {
|
||||
const cookies = new _cookies.RequestCookies(_headers.HeadersAdapter.from(headers));
|
||||
return _requestcookies.MutableRequestCookiesAdapter.wrap(cookies, onUpdateCookies);
|
||||
}
|
||||
/**
|
||||
* If middleware set cookies in this request (indicated by `x-middleware-set-cookie`),
|
||||
* then merge those into the existing cookie object, so that when `cookies()` is accessed
|
||||
* it's able to read the newly set cookies.
|
||||
*/ function mergeMiddlewareCookies(req, existingCookies) {
|
||||
if ('x-middleware-set-cookie' in req.headers && typeof req.headers['x-middleware-set-cookie'] === 'string') {
|
||||
const setCookieValue = req.headers['x-middleware-set-cookie'];
|
||||
const responseHeaders = new Headers();
|
||||
for (const cookie of (0, _utils.splitCookiesString)(setCookieValue)){
|
||||
responseHeaders.append('set-cookie', cookie);
|
||||
}
|
||||
const responseCookies = new _cookies.ResponseCookies(responseHeaders);
|
||||
// Transfer cookies from ResponseCookies to RequestCookies
|
||||
for (const cookie of responseCookies.getAll()){
|
||||
existingCookies.set(cookie);
|
||||
}
|
||||
}
|
||||
}
|
||||
function createRequestStoreForRender(req, res, url, rootParams, implicitTags, onUpdateCookies, previewProps, isHmrRefresh, serverComponentsHmrCache, renderResumeDataCache) {
|
||||
return createRequestStoreImpl(// Pages start in render phase by default
|
||||
'render', req, res, url, rootParams, implicitTags, onUpdateCookies, renderResumeDataCache, previewProps, isHmrRefresh, serverComponentsHmrCache);
|
||||
}
|
||||
function createRequestStoreForAPI(req, url, implicitTags, onUpdateCookies, previewProps) {
|
||||
return createRequestStoreImpl(// API routes start in action phase by default
|
||||
'action', req, undefined, url, {}, implicitTags, onUpdateCookies, undefined, previewProps, false, undefined);
|
||||
}
|
||||
function createRequestStoreImpl(phase, req, res, url, rootParams, implicitTags, onUpdateCookies, renderResumeDataCache, previewProps, isHmrRefresh, serverComponentsHmrCache) {
|
||||
function defaultOnUpdateCookies(cookies) {
|
||||
if (res) {
|
||||
res.setHeader('Set-Cookie', cookies);
|
||||
}
|
||||
}
|
||||
const cache = {};
|
||||
return {
|
||||
type: 'request',
|
||||
phase,
|
||||
implicitTags,
|
||||
// Rather than just using the whole `url` here, we pull the parts we want
|
||||
// to ensure we don't use parts of the URL that we shouldn't. This also
|
||||
// lets us avoid requiring an empty string for `search` in the type.
|
||||
url: {
|
||||
pathname: url.pathname,
|
||||
search: url.search ?? ''
|
||||
},
|
||||
rootParams,
|
||||
get headers () {
|
||||
if (!cache.headers) {
|
||||
// Seal the headers object that'll freeze out any methods that could
|
||||
// mutate the underlying data.
|
||||
cache.headers = getHeaders(req.headers);
|
||||
}
|
||||
return cache.headers;
|
||||
},
|
||||
get cookies () {
|
||||
if (!cache.cookies) {
|
||||
// if middleware is setting cookie(s), then include those in
|
||||
// the initial cached cookies so they can be read in render
|
||||
const requestCookies = new _cookies.RequestCookies(_headers.HeadersAdapter.from(req.headers));
|
||||
mergeMiddlewareCookies(req, requestCookies);
|
||||
// Seal the cookies object that'll freeze out any methods that could
|
||||
// mutate the underlying data.
|
||||
cache.cookies = _requestcookies.RequestCookiesAdapter.seal(requestCookies);
|
||||
}
|
||||
return cache.cookies;
|
||||
},
|
||||
set cookies (value){
|
||||
cache.cookies = value;
|
||||
},
|
||||
get mutableCookies () {
|
||||
if (!cache.mutableCookies) {
|
||||
const mutableCookies = getMutableCookies(req.headers, onUpdateCookies || (res ? defaultOnUpdateCookies : undefined));
|
||||
mergeMiddlewareCookies(req, mutableCookies);
|
||||
cache.mutableCookies = mutableCookies;
|
||||
}
|
||||
return cache.mutableCookies;
|
||||
},
|
||||
get userspaceMutableCookies () {
|
||||
if (!cache.userspaceMutableCookies) {
|
||||
const userspaceMutableCookies = (0, _requestcookies.wrapWithMutableAccessCheck)(this.mutableCookies);
|
||||
cache.userspaceMutableCookies = userspaceMutableCookies;
|
||||
}
|
||||
return cache.userspaceMutableCookies;
|
||||
},
|
||||
get draftMode () {
|
||||
if (!cache.draftMode) {
|
||||
cache.draftMode = new _draftmodeprovider.DraftModeProvider(previewProps, req, this.cookies, this.mutableCookies);
|
||||
}
|
||||
return cache.draftMode;
|
||||
},
|
||||
renderResumeDataCache: renderResumeDataCache ?? null,
|
||||
isHmrRefresh,
|
||||
serverComponentsHmrCache: serverComponentsHmrCache || globalThis.__serverComponentsHmrCache
|
||||
};
|
||||
}
|
||||
function synchronizeMutableCookies(store) {
|
||||
// TODO: does this need to update headers as well?
|
||||
store.cookies = _requestcookies.RequestCookiesAdapter.seal((0, _requestcookies.responseCookiesToRequestCookies)(store.mutableCookies));
|
||||
}
|
||||
|
||||
//# sourceMappingURL=request-store.js.map
|
||||
1
frontend/webapp/node_modules/next/dist/server/async-storage/request-store.js.map
generated
vendored
Normal file
1
frontend/webapp/node_modules/next/dist/server/async-storage/request-store.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
11
frontend/webapp/node_modules/next/dist/server/async-storage/with-store.d.ts
generated
vendored
Normal file
11
frontend/webapp/node_modules/next/dist/server/async-storage/with-store.d.ts
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
import type { AsyncLocalStorage } from 'async_hooks';
|
||||
/**
|
||||
* Implementations provide a wrapping function that will provide the storage to
|
||||
* async calls derived from the provided callback function.
|
||||
*
|
||||
* @param storage underlying storage object
|
||||
* @param context context used to create the storage object
|
||||
* @param callback function to call within the scope of the storage
|
||||
* @returns the result of the callback
|
||||
*/
|
||||
export type WithStore<Store extends {}, Context extends {}> = <Result>(storage: AsyncLocalStorage<Store>, context: Context, callback: (store: Store) => Result) => Result;
|
||||
6
frontend/webapp/node_modules/next/dist/server/async-storage/with-store.js
generated
vendored
Normal file
6
frontend/webapp/node_modules/next/dist/server/async-storage/with-store.js
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
//# sourceMappingURL=with-store.js.map
|
||||
1
frontend/webapp/node_modules/next/dist/server/async-storage/with-store.js.map
generated
vendored
Normal file
1
frontend/webapp/node_modules/next/dist/server/async-storage/with-store.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":[],"names":[],"mappings":""}
|
||||
43
frontend/webapp/node_modules/next/dist/server/async-storage/work-store.d.ts
generated
vendored
Normal file
43
frontend/webapp/node_modules/next/dist/server/async-storage/work-store.d.ts
generated
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
import type { WorkStore } from '../app-render/work-async-storage.external';
|
||||
import type { IncrementalCache } from '../lib/incremental-cache';
|
||||
import type { RenderOpts } from '../app-render/types';
|
||||
import type { FetchMetric } from '../base-http';
|
||||
import type { RequestLifecycleOpts } from '../base-server';
|
||||
import type { FallbackRouteParams } from '../request/fallback-params';
|
||||
import type { AppSegmentConfig } from '../../build/segment-config/app/app-segment-config';
|
||||
import type { CacheLife } from '../use-cache/cache-life';
|
||||
export type WorkStoreContext = {
|
||||
/**
|
||||
* The page that is being rendered. This relates to the path to the page file.
|
||||
*/
|
||||
page: string;
|
||||
/**
|
||||
* The route parameters that are currently unknown.
|
||||
*/
|
||||
fallbackRouteParams: FallbackRouteParams | null;
|
||||
requestEndedState?: {
|
||||
ended?: boolean;
|
||||
};
|
||||
isPrefetchRequest?: boolean;
|
||||
renderOpts: {
|
||||
cacheLifeProfiles?: {
|
||||
[profile: string]: CacheLife;
|
||||
};
|
||||
incrementalCache?: IncrementalCache;
|
||||
isOnDemandRevalidate?: boolean;
|
||||
fetchCache?: AppSegmentConfig['fetchCache'];
|
||||
isPossibleServerAction?: boolean;
|
||||
pendingWaitUntil?: Promise<any>;
|
||||
experimental: Pick<RenderOpts['experimental'], 'isRoutePPREnabled' | 'dynamicIO' | 'authInterrupts'>;
|
||||
/**
|
||||
* Fetch metrics attached in patch-fetch.ts
|
||||
**/
|
||||
fetchMetrics?: FetchMetric[];
|
||||
} & Pick<RenderOpts, 'assetPrefix' | 'supportsDynamicResponse' | 'shouldWaitOnAllReady' | 'isRevalidate' | 'nextExport' | 'isDraftMode' | 'isDebugDynamicAccesses' | 'dev'> & RequestLifecycleOpts & Partial<Pick<RenderOpts, 'reactLoadableManifest'>>;
|
||||
/**
|
||||
* The build ID of the current build.
|
||||
*/
|
||||
buildId: string;
|
||||
previouslyRevalidatedTags: string[];
|
||||
};
|
||||
export declare function createWorkStore({ page, fallbackRouteParams, renderOpts, requestEndedState, isPrefetchRequest, buildId, previouslyRevalidatedTags, }: WorkStoreContext): WorkStore;
|
||||
86
frontend/webapp/node_modules/next/dist/server/async-storage/work-store.js
generated
vendored
Normal file
86
frontend/webapp/node_modules/next/dist/server/async-storage/work-store.js
generated
vendored
Normal file
@@ -0,0 +1,86 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "createWorkStore", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return createWorkStore;
|
||||
}
|
||||
});
|
||||
const _aftercontext = require("../after/after-context");
|
||||
const _apppaths = require("../../shared/lib/router/utils/app-paths");
|
||||
const _lazyresult = require("../lib/lazy-result");
|
||||
const _handlers = require("../use-cache/handlers");
|
||||
function createWorkStore({ page, fallbackRouteParams, renderOpts, requestEndedState, isPrefetchRequest, buildId, previouslyRevalidatedTags }) {
|
||||
/**
|
||||
* Rules of Static & Dynamic HTML:
|
||||
*
|
||||
* 1.) We must generate static HTML unless the caller explicitly opts
|
||||
* in to dynamic HTML support.
|
||||
*
|
||||
* 2.) If dynamic HTML support is requested, we must honor that request
|
||||
* or throw an error. It is the sole responsibility of the caller to
|
||||
* ensure they aren't e.g. requesting dynamic HTML for an AMP page.
|
||||
*
|
||||
* 3.) If the request is in draft mode, we must generate dynamic HTML.
|
||||
*
|
||||
* 4.) If the request is a server action, we must generate dynamic HTML.
|
||||
*
|
||||
* These rules help ensure that other existing features like request caching,
|
||||
* coalescing, and ISR continue working as intended.
|
||||
*/ const isStaticGeneration = !renderOpts.shouldWaitOnAllReady && !renderOpts.supportsDynamicResponse && !renderOpts.isDraftMode && !renderOpts.isPossibleServerAction;
|
||||
const store = {
|
||||
isStaticGeneration,
|
||||
page,
|
||||
fallbackRouteParams,
|
||||
route: (0, _apppaths.normalizeAppPath)(page),
|
||||
incrementalCache: // we fallback to a global incremental cache for edge-runtime locally
|
||||
// so that it can access the fs cache without mocks
|
||||
renderOpts.incrementalCache || globalThis.__incrementalCache,
|
||||
cacheLifeProfiles: renderOpts.cacheLifeProfiles,
|
||||
isRevalidate: renderOpts.isRevalidate,
|
||||
isPrerendering: renderOpts.nextExport,
|
||||
fetchCache: renderOpts.fetchCache,
|
||||
isOnDemandRevalidate: renderOpts.isOnDemandRevalidate,
|
||||
isDraftMode: renderOpts.isDraftMode,
|
||||
requestEndedState,
|
||||
isPrefetchRequest,
|
||||
buildId,
|
||||
reactLoadableManifest: (renderOpts == null ? void 0 : renderOpts.reactLoadableManifest) || {},
|
||||
assetPrefix: (renderOpts == null ? void 0 : renderOpts.assetPrefix) || '',
|
||||
afterContext: createAfterContext(renderOpts),
|
||||
dynamicIOEnabled: renderOpts.experimental.dynamicIO,
|
||||
dev: renderOpts.dev ?? false,
|
||||
previouslyRevalidatedTags,
|
||||
refreshTagsByCacheKind: createRefreshTagsByCacheKind()
|
||||
};
|
||||
// TODO: remove this when we resolve accessing the store outside the execution context
|
||||
renderOpts.store = store;
|
||||
return store;
|
||||
}
|
||||
function createAfterContext(renderOpts) {
|
||||
const { waitUntil, onClose, onAfterTaskError } = renderOpts;
|
||||
return new _aftercontext.AfterContext({
|
||||
waitUntil,
|
||||
onClose,
|
||||
onTaskError: onAfterTaskError
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Creates a map with lazy results that refresh tags for the respective cache
|
||||
* kind when they're awaited for the first time.
|
||||
*/ function createRefreshTagsByCacheKind() {
|
||||
const refreshTagsByCacheKind = new Map();
|
||||
const cacheHandlers = (0, _handlers.getCacheHandlerEntries)();
|
||||
if (cacheHandlers) {
|
||||
for (const [kind, cacheHandler] of cacheHandlers){
|
||||
if ('refreshTags' in cacheHandler) {
|
||||
refreshTagsByCacheKind.set(kind, (0, _lazyresult.createLazyResult)(async ()=>cacheHandler.refreshTags()));
|
||||
}
|
||||
}
|
||||
}
|
||||
return refreshTagsByCacheKind;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=work-store.js.map
|
||||
1
frontend/webapp/node_modules/next/dist/server/async-storage/work-store.js.map
generated
vendored
Normal file
1
frontend/webapp/node_modules/next/dist/server/async-storage/work-store.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user