Initial boiler plate project
This commit is contained in:
266
node_modules/next/dist/esm/server/web/adapter.js
generated
vendored
Normal file
266
node_modules/next/dist/esm/server/web/adapter.js
generated
vendored
Normal file
@ -0,0 +1,266 @@
|
||||
import { PageSignatureError } from "./error";
|
||||
import { fromNodeOutgoingHttpHeaders } from "./utils";
|
||||
import { NextFetchEvent } from "./spec-extension/fetch-event";
|
||||
import { NextRequest } from "./spec-extension/request";
|
||||
import { NextResponse } from "./spec-extension/response";
|
||||
import { relativizeURL } from "../../shared/lib/router/utils/relativize-url";
|
||||
import { waitUntilSymbol } from "./spec-extension/fetch-event";
|
||||
import { NextURL } from "./next-url";
|
||||
import { stripInternalSearchParams } from "../internal-utils";
|
||||
import { normalizeRscURL } from "../../shared/lib/router/utils/app-paths";
|
||||
import { FLIGHT_PARAMETERS } from "../../client/components/app-router-headers";
|
||||
import { NEXT_QUERY_PARAM_PREFIX } from "../../lib/constants";
|
||||
import { ensureInstrumentationRegistered } from "./globals";
|
||||
import { RequestAsyncStorageWrapper } from "../async-storage/request-async-storage-wrapper";
|
||||
import { requestAsyncStorage } from "../../client/components/request-async-storage.external";
|
||||
import { getTracer } from "../lib/trace/tracer";
|
||||
import { MiddlewareSpan } from "../lib/trace/constants";
|
||||
import { getEdgePreviewProps } from "./get-edge-preview-props";
|
||||
export class NextRequestHint extends NextRequest {
|
||||
constructor(params){
|
||||
super(params.input, params.init);
|
||||
this.sourcePage = params.page;
|
||||
}
|
||||
get request() {
|
||||
throw new PageSignatureError({
|
||||
page: this.sourcePage
|
||||
});
|
||||
}
|
||||
respondWith() {
|
||||
throw new PageSignatureError({
|
||||
page: this.sourcePage
|
||||
});
|
||||
}
|
||||
waitUntil() {
|
||||
throw new PageSignatureError({
|
||||
page: this.sourcePage
|
||||
});
|
||||
}
|
||||
}
|
||||
const headersGetter = {
|
||||
keys: (headers)=>Array.from(headers.keys()),
|
||||
get: (headers, key)=>headers.get(key) ?? undefined
|
||||
};
|
||||
let propagator = (request, fn)=>{
|
||||
const tracer = getTracer();
|
||||
return tracer.withPropagatedContext(request.headers, fn, headersGetter);
|
||||
};
|
||||
let testApisIntercepted = false;
|
||||
function ensureTestApisIntercepted() {
|
||||
if (!testApisIntercepted) {
|
||||
testApisIntercepted = true;
|
||||
if (process.env.NEXT_PRIVATE_TEST_PROXY === "true") {
|
||||
const { interceptTestApis, wrapRequestHandler } = require("next/dist/experimental/testmode/server-edge");
|
||||
interceptTestApis();
|
||||
propagator = wrapRequestHandler(propagator);
|
||||
}
|
||||
}
|
||||
}
|
||||
export async function adapter(params) {
|
||||
ensureTestApisIntercepted();
|
||||
await ensureInstrumentationRegistered();
|
||||
// TODO-APP: use explicit marker for this
|
||||
const isEdgeRendering = typeof self.__BUILD_MANIFEST !== "undefined";
|
||||
params.request.url = normalizeRscURL(params.request.url);
|
||||
const requestUrl = new NextURL(params.request.url, {
|
||||
headers: params.request.headers,
|
||||
nextConfig: params.request.nextConfig
|
||||
});
|
||||
// Iterator uses an index to keep track of the current iteration. Because of deleting and appending below we can't just use the iterator.
|
||||
// Instead we use the keys before iteration.
|
||||
const keys = [
|
||||
...requestUrl.searchParams.keys()
|
||||
];
|
||||
for (const key of keys){
|
||||
const value = requestUrl.searchParams.getAll(key);
|
||||
if (key !== NEXT_QUERY_PARAM_PREFIX && key.startsWith(NEXT_QUERY_PARAM_PREFIX)) {
|
||||
const normalizedKey = key.substring(NEXT_QUERY_PARAM_PREFIX.length);
|
||||
requestUrl.searchParams.delete(normalizedKey);
|
||||
for (const val of value){
|
||||
requestUrl.searchParams.append(normalizedKey, val);
|
||||
}
|
||||
requestUrl.searchParams.delete(key);
|
||||
}
|
||||
}
|
||||
// Ensure users only see page requests, never data requests.
|
||||
const buildId = requestUrl.buildId;
|
||||
requestUrl.buildId = "";
|
||||
const isNextDataRequest = params.request.headers["x-nextjs-data"];
|
||||
if (isNextDataRequest && requestUrl.pathname === "/index") {
|
||||
requestUrl.pathname = "/";
|
||||
}
|
||||
const requestHeaders = fromNodeOutgoingHttpHeaders(params.request.headers);
|
||||
const flightHeaders = new Map();
|
||||
// Parameters should only be stripped for middleware
|
||||
if (!isEdgeRendering) {
|
||||
for (const param of FLIGHT_PARAMETERS){
|
||||
const key = param.toString().toLowerCase();
|
||||
const value = requestHeaders.get(key);
|
||||
if (value) {
|
||||
flightHeaders.set(key, requestHeaders.get(key));
|
||||
requestHeaders.delete(key);
|
||||
}
|
||||
}
|
||||
}
|
||||
const normalizeUrl = process.env.__NEXT_NO_MIDDLEWARE_URL_NORMALIZE ? new URL(params.request.url) : requestUrl;
|
||||
const request = new NextRequestHint({
|
||||
page: params.page,
|
||||
// Strip internal query parameters off the request.
|
||||
input: stripInternalSearchParams(normalizeUrl, true).toString(),
|
||||
init: {
|
||||
body: params.request.body,
|
||||
geo: params.request.geo,
|
||||
headers: requestHeaders,
|
||||
ip: params.request.ip,
|
||||
method: params.request.method,
|
||||
nextConfig: params.request.nextConfig,
|
||||
signal: params.request.signal
|
||||
}
|
||||
});
|
||||
/**
|
||||
* This allows to identify the request as a data request. The user doesn't
|
||||
* need to know about this property neither use it. We add it for testing
|
||||
* purposes.
|
||||
*/ if (isNextDataRequest) {
|
||||
Object.defineProperty(request, "__isData", {
|
||||
enumerable: false,
|
||||
value: true
|
||||
});
|
||||
}
|
||||
if (!globalThis.__incrementalCache && params.IncrementalCache) {
|
||||
globalThis.__incrementalCache = new params.IncrementalCache({
|
||||
appDir: true,
|
||||
fetchCache: true,
|
||||
minimalMode: process.env.NODE_ENV !== "development",
|
||||
fetchCacheKeyPrefix: process.env.__NEXT_FETCH_CACHE_KEY_PREFIX,
|
||||
dev: process.env.NODE_ENV === "development",
|
||||
requestHeaders: params.request.headers,
|
||||
requestProtocol: "https",
|
||||
getPrerenderManifest: ()=>{
|
||||
return {
|
||||
version: -1,
|
||||
routes: {},
|
||||
dynamicRoutes: {},
|
||||
notFoundRoutes: [],
|
||||
preview: getEdgePreviewProps()
|
||||
};
|
||||
}
|
||||
});
|
||||
}
|
||||
const event = new NextFetchEvent({
|
||||
request,
|
||||
page: params.page
|
||||
});
|
||||
let response;
|
||||
let cookiesFromResponse;
|
||||
response = await propagator(request, ()=>{
|
||||
// we only care to make async storage available for middleware
|
||||
const isMiddleware = params.page === "/middleware" || params.page === "/src/middleware";
|
||||
if (isMiddleware) {
|
||||
return getTracer().trace(MiddlewareSpan.execute, {
|
||||
spanName: `middleware ${request.method} ${request.nextUrl.pathname}`,
|
||||
attributes: {
|
||||
"http.target": request.nextUrl.pathname,
|
||||
"http.method": request.method
|
||||
}
|
||||
}, ()=>RequestAsyncStorageWrapper.wrap(requestAsyncStorage, {
|
||||
req: request,
|
||||
renderOpts: {
|
||||
onUpdateCookies: (cookies)=>{
|
||||
cookiesFromResponse = cookies;
|
||||
},
|
||||
// @ts-expect-error: TODO: investigate why previewProps isn't on RenderOpts
|
||||
previewProps: getEdgePreviewProps()
|
||||
}
|
||||
}, ()=>params.handler(request, event)));
|
||||
}
|
||||
return params.handler(request, event);
|
||||
});
|
||||
// check if response is a Response object
|
||||
if (response && !(response instanceof Response)) {
|
||||
throw new TypeError("Expected an instance of Response to be returned");
|
||||
}
|
||||
if (response && cookiesFromResponse) {
|
||||
response.headers.set("set-cookie", cookiesFromResponse);
|
||||
}
|
||||
/**
|
||||
* For rewrites we must always include the locale in the final pathname
|
||||
* so we re-create the NextURL forcing it to include it when the it is
|
||||
* an internal rewrite. Also we make sure the outgoing rewrite URL is
|
||||
* a data URL if the request was a data request.
|
||||
*/ const rewrite = response == null ? void 0 : response.headers.get("x-middleware-rewrite");
|
||||
if (response && rewrite && !isEdgeRendering) {
|
||||
const rewriteUrl = new NextURL(rewrite, {
|
||||
forceLocale: true,
|
||||
headers: params.request.headers,
|
||||
nextConfig: params.request.nextConfig
|
||||
});
|
||||
if (!process.env.__NEXT_NO_MIDDLEWARE_URL_NORMALIZE) {
|
||||
if (rewriteUrl.host === request.nextUrl.host) {
|
||||
rewriteUrl.buildId = buildId || rewriteUrl.buildId;
|
||||
response.headers.set("x-middleware-rewrite", String(rewriteUrl));
|
||||
}
|
||||
}
|
||||
/**
|
||||
* When the request is a data request we must show if there was a rewrite
|
||||
* with an internal header so the client knows which component to load
|
||||
* from the data request.
|
||||
*/ const relativizedRewrite = relativizeURL(String(rewriteUrl), String(requestUrl));
|
||||
if (isNextDataRequest && // if the rewrite is external and external rewrite
|
||||
// resolving config is enabled don't add this header
|
||||
// so the upstream app can set it instead
|
||||
!(process.env.__NEXT_EXTERNAL_MIDDLEWARE_REWRITE_RESOLVE && relativizedRewrite.match(/http(s)?:\/\//))) {
|
||||
response.headers.set("x-nextjs-rewrite", relativizedRewrite);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* For redirects we will not include the locale in case when it is the
|
||||
* default and we must also make sure the outgoing URL is a data one if
|
||||
* the incoming request was a data request.
|
||||
*/ const redirect = response == null ? void 0 : response.headers.get("Location");
|
||||
if (response && redirect && !isEdgeRendering) {
|
||||
const redirectURL = new NextURL(redirect, {
|
||||
forceLocale: false,
|
||||
headers: params.request.headers,
|
||||
nextConfig: params.request.nextConfig
|
||||
});
|
||||
/**
|
||||
* Responses created from redirects have immutable headers so we have
|
||||
* to clone the response to be able to modify it.
|
||||
*/ response = new Response(response.body, response);
|
||||
if (!process.env.__NEXT_NO_MIDDLEWARE_URL_NORMALIZE) {
|
||||
if (redirectURL.host === request.nextUrl.host) {
|
||||
redirectURL.buildId = buildId || redirectURL.buildId;
|
||||
response.headers.set("Location", String(redirectURL));
|
||||
}
|
||||
}
|
||||
/**
|
||||
* When the request is a data request we can't use the location header as
|
||||
* it may end up with CORS error. Instead we map to an internal header so
|
||||
* the client knows the destination.
|
||||
*/ if (isNextDataRequest) {
|
||||
response.headers.delete("Location");
|
||||
response.headers.set("x-nextjs-redirect", relativizeURL(String(redirectURL), String(requestUrl)));
|
||||
}
|
||||
}
|
||||
const finalResponse = response ? response : NextResponse.next();
|
||||
// Flight headers are not overridable / removable so they are applied at the end.
|
||||
const middlewareOverrideHeaders = finalResponse.headers.get("x-middleware-override-headers");
|
||||
const overwrittenHeaders = [];
|
||||
if (middlewareOverrideHeaders) {
|
||||
for (const [key, value] of flightHeaders){
|
||||
finalResponse.headers.set(`x-middleware-request-${key}`, value);
|
||||
overwrittenHeaders.push(key);
|
||||
}
|
||||
if (overwrittenHeaders.length > 0) {
|
||||
finalResponse.headers.set("x-middleware-override-headers", middlewareOverrideHeaders + "," + overwrittenHeaders.join(","));
|
||||
}
|
||||
}
|
||||
return {
|
||||
response: finalResponse,
|
||||
waitUntil: Promise.all(event[waitUntilSymbol]),
|
||||
fetchMetrics: request.fetchMetrics
|
||||
};
|
||||
}
|
||||
|
||||
//# sourceMappingURL=adapter.js.map
|
||||
1
node_modules/next/dist/esm/server/web/adapter.js.map
generated
vendored
Normal file
1
node_modules/next/dist/esm/server/web/adapter.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
90
node_modules/next/dist/esm/server/web/edge-route-module-wrapper.js
generated
vendored
Normal file
90
node_modules/next/dist/esm/server/web/edge-route-module-wrapper.js
generated
vendored
Normal file
@ -0,0 +1,90 @@
|
||||
import "./globals";
|
||||
import { adapter } from "./adapter";
|
||||
import { IncrementalCache } from "../lib/incremental-cache";
|
||||
import { RouteMatcher } from "../future/route-matchers/route-matcher";
|
||||
import { internal_getCurrentFunctionWaitUntil } from "./internal-edge-wait-until";
|
||||
import { getUtils } from "../server-utils";
|
||||
import { searchParamsToUrlQuery } from "../../shared/lib/router/utils/querystring";
|
||||
import { getEdgePreviewProps } from "./get-edge-preview-props";
|
||||
/**
|
||||
* EdgeRouteModuleWrapper is a wrapper around a route module.
|
||||
*
|
||||
* Note that this class should only be used in the edge runtime.
|
||||
*/ export class EdgeRouteModuleWrapper {
|
||||
/**
|
||||
* The constructor is wrapped with private to ensure that it can only be
|
||||
* constructed by the static wrap method.
|
||||
*
|
||||
* @param routeModule the route module to wrap
|
||||
*/ constructor(routeModule){
|
||||
this.routeModule = routeModule;
|
||||
// TODO: (wyattjoh) possibly allow the module to define it's own matcher
|
||||
this.matcher = new RouteMatcher(routeModule.definition);
|
||||
}
|
||||
/**
|
||||
* This will wrap a module with the EdgeModuleWrapper and return a function
|
||||
* that can be used as a handler for the edge runtime.
|
||||
*
|
||||
* @param module the module to wrap
|
||||
* @param options any options that should be passed to the adapter and
|
||||
* override the ones passed from the runtime
|
||||
* @returns a function that can be used as a handler for the edge runtime
|
||||
*/ static wrap(routeModule, options = {}) {
|
||||
// Create the module wrapper.
|
||||
const wrapper = new EdgeRouteModuleWrapper(routeModule);
|
||||
// Return the wrapping function.
|
||||
return (opts)=>{
|
||||
return adapter({
|
||||
...opts,
|
||||
...options,
|
||||
IncrementalCache,
|
||||
// Bind the handler method to the wrapper so it still has context.
|
||||
handler: wrapper.handler.bind(wrapper)
|
||||
});
|
||||
};
|
||||
}
|
||||
async handler(request, evt) {
|
||||
const utils = getUtils({
|
||||
pageIsDynamic: this.matcher.isDynamic,
|
||||
page: this.matcher.definition.pathname,
|
||||
basePath: request.nextUrl.basePath,
|
||||
// We don't need the `handleRewrite` util, so can just pass an empty object
|
||||
rewrites: {},
|
||||
// only used for rewrites, so setting an arbitrary default value here
|
||||
caseSensitive: false
|
||||
});
|
||||
const { params } = utils.normalizeDynamicRouteParams(searchParamsToUrlQuery(request.nextUrl.searchParams));
|
||||
const previewProps = getEdgePreviewProps();
|
||||
// Create the context for the handler. This contains the params from the
|
||||
// match (if any).
|
||||
const context = {
|
||||
params,
|
||||
prerenderManifest: {
|
||||
version: 4,
|
||||
routes: {},
|
||||
dynamicRoutes: {},
|
||||
preview: previewProps,
|
||||
notFoundRoutes: []
|
||||
},
|
||||
renderOpts: {
|
||||
supportsDynamicResponse: true,
|
||||
// App Route's cannot be postponed.
|
||||
experimental: {
|
||||
ppr: false
|
||||
}
|
||||
}
|
||||
};
|
||||
// Get the response from the handler.
|
||||
const res = await this.routeModule.handle(request, context);
|
||||
const waitUntilPromises = [
|
||||
internal_getCurrentFunctionWaitUntil()
|
||||
];
|
||||
if (context.renderOpts.waitUntil) {
|
||||
waitUntilPromises.push(context.renderOpts.waitUntil);
|
||||
}
|
||||
evt.waitUntil(Promise.all(waitUntilPromises));
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
//# sourceMappingURL=edge-route-module-wrapper.js.map
|
||||
1
node_modules/next/dist/esm/server/web/edge-route-module-wrapper.js.map
generated
vendored
Normal file
1
node_modules/next/dist/esm/server/web/edge-route-module-wrapper.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../src/server/web/edge-route-module-wrapper.ts"],"names":["adapter","IncrementalCache","RouteMatcher","internal_getCurrentFunctionWaitUntil","getUtils","searchParamsToUrlQuery","getEdgePreviewProps","EdgeRouteModuleWrapper","routeModule","matcher","definition","wrap","options","wrapper","opts","handler","bind","request","evt","utils","pageIsDynamic","isDynamic","page","pathname","basePath","nextUrl","rewrites","caseSensitive","params","normalizeDynamicRouteParams","searchParams","previewProps","context","prerenderManifest","version","routes","dynamicRoutes","preview","notFoundRoutes","renderOpts","supportsDynamicResponse","experimental","ppr","res","handle","waitUntilPromises","waitUntil","push","Promise","all"],"mappings":"AAMA,OAAO,YAAW;AAElB,SAASA,OAAO,QAA6B,YAAW;AACxD,SAASC,gBAAgB,QAAQ,2BAA0B;AAC3D,SAASC,YAAY,QAAQ,yCAAwC;AAErE,SAASC,oCAAoC,QAAQ,6BAA4B;AACjF,SAASC,QAAQ,QAAQ,kBAAiB;AAC1C,SAASC,sBAAsB,QAAQ,4CAA2C;AAClF,SAASC,mBAAmB,QAAQ,2BAA0B;AAI9D;;;;CAIC,GACD,OAAO,MAAMC;IAGX;;;;;GAKC,GACD,YAAoB,AAAiBC,WAAgC,CAAE;aAAlCA,cAAAA;QACnC,wEAAwE;QACxE,IAAI,CAACC,OAAO,GAAG,IAAIP,aAAaM,YAAYE,UAAU;IACxD;IAEA;;;;;;;;GAQC,GACD,OAAcC,KACZH,WAAgC,EAChCI,UAAuB,CAAC,CAAC,EACzB;QACA,6BAA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file
28
node_modules/next/dist/esm/server/web/error.js
generated
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
export class PageSignatureError extends Error {
|
||||
constructor({ page }){
|
||||
super(`The middleware "${page}" accepts an async API directly with the form:
|
||||
|
||||
export function middleware(request, event) {
|
||||
return NextResponse.redirect('/new-location')
|
||||
}
|
||||
|
||||
Read more: https://nextjs.org/docs/messages/middleware-new-signature
|
||||
`);
|
||||
}
|
||||
}
|
||||
export class RemovedPageError extends Error {
|
||||
constructor(){
|
||||
super(`The request.page has been deprecated in favour of \`URLPattern\`.
|
||||
Read more: https://nextjs.org/docs/messages/middleware-request-page
|
||||
`);
|
||||
}
|
||||
}
|
||||
export class RemovedUAError extends Error {
|
||||
constructor(){
|
||||
super(`The request.ua has been removed in favour of \`userAgent\` function.
|
||||
Read more: https://nextjs.org/docs/messages/middleware-parse-user-agent
|
||||
`);
|
||||
}
|
||||
}
|
||||
|
||||
//# sourceMappingURL=error.js.map
|
||||
1
node_modules/next/dist/esm/server/web/error.js.map
generated
vendored
Normal file
1
node_modules/next/dist/esm/server/web/error.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../src/server/web/error.ts"],"names":["PageSignatureError","Error","constructor","page","RemovedPageError","RemovedUAError"],"mappings":"AAAA,OAAO,MAAMA,2BAA2BC;IACtCC,YAAY,EAAEC,IAAI,EAAoB,CAAE;QACtC,KAAK,CAAC,CAAC,gBAAgB,EAAEA,KAAK;;;;;;;EAOhC,CAAC;IACD;AACF;AAEA,OAAO,MAAMC,yBAAyBH;IACpCC,aAAc;QACZ,KAAK,CAAC,CAAC;;EAET,CAAC;IACD;AACF;AAEA,OAAO,MAAMG,uBAAuBJ;IAClCC,aAAc;QACZ,KAAK,CAAC,CAAC;;EAET,CAAC;IACD;AACF"}
|
||||
8
node_modules/next/dist/esm/server/web/exports/index.js
generated
vendored
Normal file
8
node_modules/next/dist/esm/server/web/exports/index.js
generated
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
// Alias index file of next/server for edge runtime for tree-shaking purpose
|
||||
export { ImageResponse } from "../spec-extension/image-response";
|
||||
export { NextRequest } from "../spec-extension/request";
|
||||
export { NextResponse } from "../spec-extension/response";
|
||||
export { userAgent, userAgentFromString } from "../spec-extension/user-agent";
|
||||
export { URLPattern } from "../spec-extension/url-pattern";
|
||||
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/next/dist/esm/server/web/exports/index.js.map
generated
vendored
Normal file
1
node_modules/next/dist/esm/server/web/exports/index.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../src/server/web/exports/index.ts"],"names":["ImageResponse","NextRequest","NextResponse","userAgent","userAgentFromString","URLPattern"],"mappings":"AAAA,4EAA4E;AAE5E,SAASA,aAAa,QAAQ,mCAAkC;AAChE,SAASC,WAAW,QAAQ,4BAA2B;AACvD,SAASC,YAAY,QAAQ,6BAA4B;AACzD,SAASC,SAAS,EAAEC,mBAAmB,QAAQ,+BAA8B;AAC7E,SAASC,UAAU,QAAQ,gCAA+B"}
|
||||
13
node_modules/next/dist/esm/server/web/get-edge-preview-props.js
generated
vendored
Normal file
13
node_modules/next/dist/esm/server/web/get-edge-preview-props.js
generated
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
/**
|
||||
* In edge runtime, these props directly accessed from environment variables.
|
||||
* - local: env vars will be injected through edge-runtime as runtime env vars
|
||||
* - deployment: env vars will be replaced by edge build pipeline
|
||||
*/ export function getEdgePreviewProps() {
|
||||
return {
|
||||
previewModeId: process.env.NODE_ENV === "production" ? process.env.__NEXT_PREVIEW_MODE_ID : "development-id",
|
||||
previewModeSigningKey: process.env.__NEXT_PREVIEW_MODE_SIGNING_KEY || "",
|
||||
previewModeEncryptionKey: process.env.__NEXT_PREVIEW_MODE_ENCRYPTION_KEY || ""
|
||||
};
|
||||
}
|
||||
|
||||
//# sourceMappingURL=get-edge-preview-props.js.map
|
||||
1
node_modules/next/dist/esm/server/web/get-edge-preview-props.js.map
generated
vendored
Normal file
1
node_modules/next/dist/esm/server/web/get-edge-preview-props.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../src/server/web/get-edge-preview-props.ts"],"names":["getEdgePreviewProps","previewModeId","process","env","NODE_ENV","__NEXT_PREVIEW_MODE_ID","previewModeSigningKey","__NEXT_PREVIEW_MODE_SIGNING_KEY","previewModeEncryptionKey","__NEXT_PREVIEW_MODE_ENCRYPTION_KEY"],"mappings":"AAAA;;;;CAIC,GACD,OAAO,SAASA;IACd,OAAO;QACLC,eACEC,QAAQC,GAAG,CAACC,QAAQ,KAAK,eACrBF,QAAQC,GAAG,CAACE,sBAAsB,GAClC;QACNC,uBAAuBJ,QAAQC,GAAG,CAACI,+BAA+B,IAAI;QACtEC,0BACEN,QAAQC,GAAG,CAACM,kCAAkC,IAAI;IACtD;AACF"}
|
||||
65
node_modules/next/dist/esm/server/web/globals.js
generated
vendored
Normal file
65
node_modules/next/dist/esm/server/web/globals.js
generated
vendored
Normal file
@ -0,0 +1,65 @@
|
||||
async function registerInstrumentation() {
|
||||
const register = "_ENTRIES" in globalThis && _ENTRIES.middleware_instrumentation && (await _ENTRIES.middleware_instrumentation).register;
|
||||
if (register) {
|
||||
try {
|
||||
await register();
|
||||
} catch (err) {
|
||||
err.message = `An error occurred while loading instrumentation hook: ${err.message}`;
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
}
|
||||
let registerInstrumentationPromise = null;
|
||||
export function ensureInstrumentationRegistered() {
|
||||
if (!registerInstrumentationPromise) {
|
||||
registerInstrumentationPromise = registerInstrumentation();
|
||||
}
|
||||
return registerInstrumentationPromise;
|
||||
}
|
||||
function getUnsupportedModuleErrorMessage(module) {
|
||||
// warning: if you change these messages, you must adjust how react-dev-overlay's middleware detects modules not found
|
||||
return `The edge runtime does not support Node.js '${module}' module.
|
||||
Learn More: https://nextjs.org/docs/messages/node-module-in-edge-runtime`;
|
||||
}
|
||||
function __import_unsupported(moduleName) {
|
||||
const proxy = new Proxy(function() {}, {
|
||||
get (_obj, prop) {
|
||||
if (prop === "then") {
|
||||
return {};
|
||||
}
|
||||
throw new Error(getUnsupportedModuleErrorMessage(moduleName));
|
||||
},
|
||||
construct () {
|
||||
throw new Error(getUnsupportedModuleErrorMessage(moduleName));
|
||||
},
|
||||
apply (_target, _this, args) {
|
||||
if (typeof args[0] === "function") {
|
||||
return args[0](proxy);
|
||||
}
|
||||
throw new Error(getUnsupportedModuleErrorMessage(moduleName));
|
||||
}
|
||||
});
|
||||
return new Proxy({}, {
|
||||
get: ()=>proxy
|
||||
});
|
||||
}
|
||||
function enhanceGlobals() {
|
||||
// The condition is true when the "process" module is provided
|
||||
if (process !== global.process) {
|
||||
// prefer local process but global.process has correct "env"
|
||||
process.env = global.process.env;
|
||||
global.process = process;
|
||||
}
|
||||
// to allow building code that import but does not use node.js modules,
|
||||
// webpack will expect this function to exist in global scope
|
||||
Object.defineProperty(globalThis, "__import_unsupported", {
|
||||
value: __import_unsupported,
|
||||
enumerable: false,
|
||||
configurable: false
|
||||
});
|
||||
// Eagerly fire instrumentation hook to make the startup faster.
|
||||
void ensureInstrumentationRegistered();
|
||||
}
|
||||
enhanceGlobals();
|
||||
|
||||
//# sourceMappingURL=globals.js.map
|
||||
1
node_modules/next/dist/esm/server/web/globals.js.map
generated
vendored
Normal file
1
node_modules/next/dist/esm/server/web/globals.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../src/server/web/globals.ts"],"names":["registerInstrumentation","register","globalThis","_ENTRIES","middleware_instrumentation","err","message","registerInstrumentationPromise","ensureInstrumentationRegistered","getUnsupportedModuleErrorMessage","module","__import_unsupported","moduleName","proxy","Proxy","get","_obj","prop","Error","construct","apply","_target","_this","args","enhanceGlobals","process","global","env","Object","defineProperty","value","enumerable","configurable"],"mappings":"AAEA,eAAeA;IACb,MAAMC,WACJ,cAAcC,cACdC,SAASC,0BAA0B,IACnC,AAAC,CAAA,MAAMD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AACP;AAEAgB"}
|
||||
23
node_modules/next/dist/esm/server/web/http.js
generated
vendored
Normal file
23
node_modules/next/dist/esm/server/web/http.js
generated
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
/**
|
||||
* List of valid HTTP methods that can be implemented by Next.js's Custom App
|
||||
* Routes.
|
||||
*/ export const HTTP_METHODS = [
|
||||
"GET",
|
||||
"HEAD",
|
||||
"OPTIONS",
|
||||
"POST",
|
||||
"PUT",
|
||||
"DELETE",
|
||||
"PATCH"
|
||||
];
|
||||
/**
|
||||
* Checks to see if the passed string is an HTTP method. Note that this is case
|
||||
* sensitive.
|
||||
*
|
||||
* @param maybeMethod the string that may be an HTTP method
|
||||
* @returns true if the string is an HTTP method
|
||||
*/ export function isHTTPMethod(maybeMethod) {
|
||||
return HTTP_METHODS.includes(maybeMethod);
|
||||
}
|
||||
|
||||
//# sourceMappingURL=http.js.map
|
||||
1
node_modules/next/dist/esm/server/web/http.js.map
generated
vendored
Normal file
1
node_modules/next/dist/esm/server/web/http.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../src/server/web/http.ts"],"names":["HTTP_METHODS","isHTTPMethod","maybeMethod","includes"],"mappings":"AAAA;;;CAGC,GACD,OAAO,MAAMA,eAAe;IAC1B;IACA;IACA;IACA;IACA;IACA;IACA;CACD,CAAS;AAQV;;;;;;CAMC,GACD,OAAO,SAASC,aAAaC,WAAmB;IAC9C,OAAOF,aAAaG,QAAQ,CAACD;AAC/B"}
|
||||
42
node_modules/next/dist/esm/server/web/internal-edge-wait-until.js
generated
vendored
Normal file
42
node_modules/next/dist/esm/server/web/internal-edge-wait-until.js
generated
vendored
Normal file
@ -0,0 +1,42 @@
|
||||
// An internal module to expose the "waitUntil" API to Edge SSR and Edge Route Handler functions.
|
||||
// This is highly experimental and subject to change.
|
||||
// We still need a global key to bypass Webpack's layering of modules.
|
||||
const GLOBAL_KEY = Symbol.for("__next_internal_waitUntil__");
|
||||
const state = // @ts-ignore
|
||||
globalThis[GLOBAL_KEY] || // @ts-ignore
|
||||
(globalThis[GLOBAL_KEY] = {
|
||||
waitUntilCounter: 0,
|
||||
waitUntilResolve: undefined,
|
||||
waitUntilPromise: null
|
||||
});
|
||||
// No matter how many concurrent requests are being handled, we want to make sure
|
||||
// that the final promise is only resolved once all of the waitUntil promises have
|
||||
// settled.
|
||||
function resolveOnePromise() {
|
||||
state.waitUntilCounter--;
|
||||
if (state.waitUntilCounter === 0) {
|
||||
state.waitUntilResolve();
|
||||
state.waitUntilPromise = null;
|
||||
}
|
||||
}
|
||||
export function internal_getCurrentFunctionWaitUntil() {
|
||||
return state.waitUntilPromise;
|
||||
}
|
||||
export function internal_runWithWaitUntil(fn) {
|
||||
const result = fn();
|
||||
if (result && typeof result === "object" && "then" in result && "finally" in result && typeof result.then === "function" && typeof result.finally === "function") {
|
||||
if (!state.waitUntilCounter) {
|
||||
// Create the promise for the next batch of waitUntil calls.
|
||||
state.waitUntilPromise = new Promise((resolve)=>{
|
||||
state.waitUntilResolve = resolve;
|
||||
});
|
||||
}
|
||||
state.waitUntilCounter++;
|
||||
return result.finally(()=>{
|
||||
resolveOnePromise();
|
||||
});
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=internal-edge-wait-until.js.map
|
||||
1
node_modules/next/dist/esm/server/web/internal-edge-wait-until.js.map
generated
vendored
Normal file
1
node_modules/next/dist/esm/server/web/internal-edge-wait-until.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../src/server/web/internal-edge-wait-until.ts"],"names":["GLOBAL_KEY","Symbol","for","state","globalThis","waitUntilCounter","waitUntilResolve","undefined","waitUntilPromise","resolveOnePromise","internal_getCurrentFunctionWaitUntil","internal_runWithWaitUntil","fn","result","then","finally","Promise","resolve"],"mappings":"AAAA,iGAAiG;AACjG,qDAAqD;AAErD,sEAAsE;AACtE,MAAMA,aAAaC,OAAOC,GAAG,CAAC;AAE9B,MAAMC,QAKJ,aAAa;AACbC,UAAU,CAACJ,WAAW,IACtB,aAAa;AACZI,CAAAA,UAAU,CAACJ,WAAW,GAAG;IACxBK,kBAAkB;IAClBC,kBAAkBC;IAClBC,kBAAkB;AACpB,CAAA;AAEF,iFAAiF;AACjF,kFAAkF;AAClF,WAAW;AACX,SAASC;IACPN,MAAME,gBAAgB;IACtB,IAAIF,MAAME,gBAAgB,KAAK,GAAG;QAChCF,MAAMG,gBAAgB;QACtBH,MAAMK,gBAAgB,GAAG;IAC3B;AACF;AAEA,OAAO,SAASE;IACd,OAAOP,MAAMK,gBAAgB;AAC/B;AAEA,OAAO,SAASG,0BAA6BC,EAAW;IACtD,MAAMC,SAASD;IACf,IACEC,UACA,OAAOA,WAAW,YAClB,UAAUA,UACV,aAAaA,UACb,OAAOA,OAAOC,IAAI,KAAK,cACvB,OAAOD,OAAOE,OAAO,KAAK,YAC1B;QACA,IAAI,CAACZ,MAAME,gBAAgB,EAAE;YAC3B,4DAA4D;YAC5DF,MAAMK,gBAAgB,GAAG,IAAIQ,QAAc,CAACC;gBAC1Cd,MAAMG,gBAAgB,GAAGW;YAC3B;QACF;QACAd,MAAME,gBAAgB;QACtB,OAAOQ,OAAOE,OAAO,CAAC;YACpBN;QACF;IACF;IAEA,OAAOI;AACT"}
|
||||
181
node_modules/next/dist/esm/server/web/next-url.js
generated
vendored
Normal file
181
node_modules/next/dist/esm/server/web/next-url.js
generated
vendored
Normal file
@ -0,0 +1,181 @@
|
||||
import { detectDomainLocale } from "../../shared/lib/i18n/detect-domain-locale";
|
||||
import { formatNextPathnameInfo } from "../../shared/lib/router/utils/format-next-pathname-info";
|
||||
import { getHostname } from "../../shared/lib/get-hostname";
|
||||
import { getNextPathnameInfo } from "../../shared/lib/router/utils/get-next-pathname-info";
|
||||
const REGEX_LOCALHOST_HOSTNAME = /(?!^https?:\/\/)(127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}|\[::1\]|localhost)/;
|
||||
function parseURL(url, base) {
|
||||
return new URL(String(url).replace(REGEX_LOCALHOST_HOSTNAME, "localhost"), base && String(base).replace(REGEX_LOCALHOST_HOSTNAME, "localhost"));
|
||||
}
|
||||
const Internal = Symbol("NextURLInternal");
|
||||
export class NextURL {
|
||||
constructor(input, baseOrOpts, opts){
|
||||
let base;
|
||||
let options;
|
||||
if (typeof baseOrOpts === "object" && "pathname" in baseOrOpts || typeof baseOrOpts === "string") {
|
||||
base = baseOrOpts;
|
||||
options = opts || {};
|
||||
} else {
|
||||
options = opts || baseOrOpts || {};
|
||||
}
|
||||
this[Internal] = {
|
||||
url: parseURL(input, base ?? options.base),
|
||||
options: options,
|
||||
basePath: ""
|
||||
};
|
||||
this.analyze();
|
||||
}
|
||||
analyze() {
|
||||
var _this_Internal_options_nextConfig_i18n, _this_Internal_options_nextConfig, _this_Internal_domainLocale, _this_Internal_options_nextConfig_i18n1, _this_Internal_options_nextConfig1;
|
||||
const info = getNextPathnameInfo(this[Internal].url.pathname, {
|
||||
nextConfig: this[Internal].options.nextConfig,
|
||||
parseData: !process.env.__NEXT_NO_MIDDLEWARE_URL_NORMALIZE,
|
||||
i18nProvider: this[Internal].options.i18nProvider
|
||||
});
|
||||
const hostname = getHostname(this[Internal].url, this[Internal].options.headers);
|
||||
this[Internal].domainLocale = this[Internal].options.i18nProvider ? this[Internal].options.i18nProvider.detectDomainLocale(hostname) : detectDomainLocale((_this_Internal_options_nextConfig = this[Internal].options.nextConfig) == null ? void 0 : (_this_Internal_options_nextConfig_i18n = _this_Internal_options_nextConfig.i18n) == null ? void 0 : _this_Internal_options_nextConfig_i18n.domains, hostname);
|
||||
const defaultLocale = ((_this_Internal_domainLocale = this[Internal].domainLocale) == null ? void 0 : _this_Internal_domainLocale.defaultLocale) || ((_this_Internal_options_nextConfig1 = this[Internal].options.nextConfig) == null ? void 0 : (_this_Internal_options_nextConfig_i18n1 = _this_Internal_options_nextConfig1.i18n) == null ? void 0 : _this_Internal_options_nextConfig_i18n1.defaultLocale);
|
||||
this[Internal].url.pathname = info.pathname;
|
||||
this[Internal].defaultLocale = defaultLocale;
|
||||
this[Internal].basePath = info.basePath ?? "";
|
||||
this[Internal].buildId = info.buildId;
|
||||
this[Internal].locale = info.locale ?? defaultLocale;
|
||||
this[Internal].trailingSlash = info.trailingSlash;
|
||||
}
|
||||
formatPathname() {
|
||||
return formatNextPathnameInfo({
|
||||
basePath: this[Internal].basePath,
|
||||
buildId: this[Internal].buildId,
|
||||
defaultLocale: !this[Internal].options.forceLocale ? this[Internal].defaultLocale : undefined,
|
||||
locale: this[Internal].locale,
|
||||
pathname: this[Internal].url.pathname,
|
||||
trailingSlash: this[Internal].trailingSlash
|
||||
});
|
||||
}
|
||||
formatSearch() {
|
||||
return this[Internal].url.search;
|
||||
}
|
||||
get buildId() {
|
||||
return this[Internal].buildId;
|
||||
}
|
||||
set buildId(buildId) {
|
||||
this[Internal].buildId = buildId;
|
||||
}
|
||||
get locale() {
|
||||
return this[Internal].locale ?? "";
|
||||
}
|
||||
set locale(locale) {
|
||||
var _this_Internal_options_nextConfig_i18n, _this_Internal_options_nextConfig;
|
||||
if (!this[Internal].locale || !((_this_Internal_options_nextConfig = this[Internal].options.nextConfig) == null ? void 0 : (_this_Internal_options_nextConfig_i18n = _this_Internal_options_nextConfig.i18n) == null ? void 0 : _this_Internal_options_nextConfig_i18n.locales.includes(locale))) {
|
||||
throw new TypeError(`The NextURL configuration includes no locale "${locale}"`);
|
||||
}
|
||||
this[Internal].locale = locale;
|
||||
}
|
||||
get defaultLocale() {
|
||||
return this[Internal].defaultLocale;
|
||||
}
|
||||
get domainLocale() {
|
||||
return this[Internal].domainLocale;
|
||||
}
|
||||
get searchParams() {
|
||||
return this[Internal].url.searchParams;
|
||||
}
|
||||
get host() {
|
||||
return this[Internal].url.host;
|
||||
}
|
||||
set host(value) {
|
||||
this[Internal].url.host = value;
|
||||
}
|
||||
get hostname() {
|
||||
return this[Internal].url.hostname;
|
||||
}
|
||||
set hostname(value) {
|
||||
this[Internal].url.hostname = value;
|
||||
}
|
||||
get port() {
|
||||
return this[Internal].url.port;
|
||||
}
|
||||
set port(value) {
|
||||
this[Internal].url.port = value;
|
||||
}
|
||||
get protocol() {
|
||||
return this[Internal].url.protocol;
|
||||
}
|
||||
set protocol(value) {
|
||||
this[Internal].url.protocol = value;
|
||||
}
|
||||
get href() {
|
||||
const pathname = this.formatPathname();
|
||||
const search = this.formatSearch();
|
||||
return `${this.protocol}//${this.host}${pathname}${search}${this.hash}`;
|
||||
}
|
||||
set href(url) {
|
||||
this[Internal].url = parseURL(url);
|
||||
this.analyze();
|
||||
}
|
||||
get origin() {
|
||||
return this[Internal].url.origin;
|
||||
}
|
||||
get pathname() {
|
||||
return this[Internal].url.pathname;
|
||||
}
|
||||
set pathname(value) {
|
||||
this[Internal].url.pathname = value;
|
||||
}
|
||||
get hash() {
|
||||
return this[Internal].url.hash;
|
||||
}
|
||||
set hash(value) {
|
||||
this[Internal].url.hash = value;
|
||||
}
|
||||
get search() {
|
||||
return this[Internal].url.search;
|
||||
}
|
||||
set search(value) {
|
||||
this[Internal].url.search = value;
|
||||
}
|
||||
get password() {
|
||||
return this[Internal].url.password;
|
||||
}
|
||||
set password(value) {
|
||||
this[Internal].url.password = value;
|
||||
}
|
||||
get username() {
|
||||
return this[Internal].url.username;
|
||||
}
|
||||
set username(value) {
|
||||
this[Internal].url.username = value;
|
||||
}
|
||||
get basePath() {
|
||||
return this[Internal].basePath;
|
||||
}
|
||||
set basePath(value) {
|
||||
this[Internal].basePath = value.startsWith("/") ? value : `/${value}`;
|
||||
}
|
||||
toString() {
|
||||
return this.href;
|
||||
}
|
||||
toJSON() {
|
||||
return this.href;
|
||||
}
|
||||
[Symbol.for("edge-runtime.inspect.custom")]() {
|
||||
return {
|
||||
href: this.href,
|
||||
origin: this.origin,
|
||||
protocol: this.protocol,
|
||||
username: this.username,
|
||||
password: this.password,
|
||||
host: this.host,
|
||||
hostname: this.hostname,
|
||||
port: this.port,
|
||||
pathname: this.pathname,
|
||||
search: this.search,
|
||||
searchParams: this.searchParams,
|
||||
hash: this.hash
|
||||
};
|
||||
}
|
||||
clone() {
|
||||
return new NextURL(String(this), this[Internal].options);
|
||||
}
|
||||
}
|
||||
|
||||
//# sourceMappingURL=next-url.js.map
|
||||
1
node_modules/next/dist/esm/server/web/next-url.js.map
generated
vendored
Normal file
1
node_modules/next/dist/esm/server/web/next-url.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
404
node_modules/next/dist/esm/server/web/sandbox/context.js
generated
vendored
Normal file
404
node_modules/next/dist/esm/server/web/sandbox/context.js
generated
vendored
Normal file
@ -0,0 +1,404 @@
|
||||
import { AsyncLocalStorage } from "async_hooks";
|
||||
import { COMPILER_NAMES, EDGE_UNSUPPORTED_NODE_APIS } from "../../../shared/lib/constants";
|
||||
import { EdgeRuntime } from "next/dist/compiled/edge-runtime";
|
||||
import { readFileSync, promises as fs } from "fs";
|
||||
import { validateURL } from "../utils";
|
||||
import { pick } from "../../../lib/pick";
|
||||
import { fetchInlineAsset } from "./fetch-inline-assets";
|
||||
import { runInContext } from "vm";
|
||||
import BufferImplementation from "node:buffer";
|
||||
import EventsImplementation from "node:events";
|
||||
import AssertImplementation from "node:assert";
|
||||
import UtilImplementation from "node:util";
|
||||
import AsyncHooksImplementation from "node:async_hooks";
|
||||
import { intervalsManager, timeoutsManager } from "./resource-managers";
|
||||
let getServerError;
|
||||
let decorateServerError;
|
||||
if (process.env.NODE_ENV === "development") {
|
||||
const middleware = require("../../../client/components/react-dev-overlay/server/middleware");
|
||||
getServerError = middleware.getServerError;
|
||||
decorateServerError = require("../../../shared/lib/error-source").decorateServerError;
|
||||
} else {
|
||||
getServerError = (error, _)=>error;
|
||||
decorateServerError = (_, __)=>{};
|
||||
}
|
||||
/**
|
||||
* A Map of cached module contexts indexed by the module name. It allows
|
||||
* to have a different cache scoped per module name or depending on the
|
||||
* provided module key on creation.
|
||||
*/ const moduleContexts = new Map();
|
||||
const pendingModuleCaches = new Map();
|
||||
/**
|
||||
* Same as clearModuleContext but for all module contexts.
|
||||
*/ export async function clearAllModuleContexts() {
|
||||
intervalsManager.removeAll();
|
||||
timeoutsManager.removeAll();
|
||||
moduleContexts.clear();
|
||||
pendingModuleCaches.clear();
|
||||
}
|
||||
/**
|
||||
* For a given path a context, this function checks if there is any module
|
||||
* context that contains the path with an older content and, if that's the
|
||||
* case, removes the context from the cache.
|
||||
*
|
||||
* This function also clears all intervals and timeouts created by the
|
||||
* module context.
|
||||
*/ export async function clearModuleContext(path) {
|
||||
intervalsManager.removeAll();
|
||||
timeoutsManager.removeAll();
|
||||
const handleContext = (key, cache, context)=>{
|
||||
if (cache == null ? void 0 : cache.paths.has(path)) {
|
||||
context.delete(key);
|
||||
}
|
||||
};
|
||||
for (const [key, cache] of moduleContexts){
|
||||
handleContext(key, cache, moduleContexts);
|
||||
}
|
||||
for (const [key, cache] of pendingModuleCaches){
|
||||
handleContext(key, await cache, pendingModuleCaches);
|
||||
}
|
||||
}
|
||||
async function loadWasm(wasm) {
|
||||
const modules = {};
|
||||
await Promise.all(wasm.map(async (binding)=>{
|
||||
const module = await WebAssembly.compile(await fs.readFile(binding.filePath));
|
||||
modules[binding.name] = module;
|
||||
}));
|
||||
return modules;
|
||||
}
|
||||
function buildEnvironmentVariablesFrom(injectedEnvironments) {
|
||||
const pairs = Object.keys(process.env).map((key)=>[
|
||||
key,
|
||||
process.env[key]
|
||||
]);
|
||||
const env = Object.fromEntries(pairs);
|
||||
for (const key of Object.keys(injectedEnvironments)){
|
||||
env[key] = injectedEnvironments[key];
|
||||
}
|
||||
env.NEXT_RUNTIME = "edge";
|
||||
return env;
|
||||
}
|
||||
function throwUnsupportedAPIError(name) {
|
||||
const error = new Error(`A Node.js API is used (${name}) which is not supported in the Edge Runtime.
|
||||
Learn more: https://nextjs.org/docs/api-reference/edge-runtime`);
|
||||
decorateServerError(error, COMPILER_NAMES.edgeServer);
|
||||
throw error;
|
||||
}
|
||||
function createProcessPolyfill(env) {
|
||||
const processPolyfill = {
|
||||
env: buildEnvironmentVariablesFrom(env)
|
||||
};
|
||||
const overriddenValue = {};
|
||||
for (const key of Object.keys(process)){
|
||||
if (key === "env") continue;
|
||||
Object.defineProperty(processPolyfill, key, {
|
||||
get () {
|
||||
if (overriddenValue[key] !== undefined) {
|
||||
return overriddenValue[key];
|
||||
}
|
||||
if (typeof process[key] === "function") {
|
||||
return ()=>throwUnsupportedAPIError(`process.${key}`);
|
||||
}
|
||||
return undefined;
|
||||
},
|
||||
set (value) {
|
||||
overriddenValue[key] = value;
|
||||
},
|
||||
enumerable: false
|
||||
});
|
||||
}
|
||||
return processPolyfill;
|
||||
}
|
||||
function addStub(context, name) {
|
||||
Object.defineProperty(context, name, {
|
||||
get () {
|
||||
return function() {
|
||||
throwUnsupportedAPIError(name);
|
||||
};
|
||||
},
|
||||
enumerable: false
|
||||
});
|
||||
}
|
||||
function getDecorateUnhandledError(runtime) {
|
||||
const EdgeRuntimeError = runtime.evaluate(`Error`);
|
||||
return (error)=>{
|
||||
if (error instanceof EdgeRuntimeError) {
|
||||
decorateServerError(error, COMPILER_NAMES.edgeServer);
|
||||
}
|
||||
};
|
||||
}
|
||||
function getDecorateUnhandledRejection(runtime) {
|
||||
const EdgeRuntimeError = runtime.evaluate(`Error`);
|
||||
return (rejected)=>{
|
||||
if (rejected.reason instanceof EdgeRuntimeError) {
|
||||
decorateServerError(rejected.reason, COMPILER_NAMES.edgeServer);
|
||||
}
|
||||
};
|
||||
}
|
||||
const NativeModuleMap = (()=>{
|
||||
const mods = {
|
||||
"node:buffer": pick(BufferImplementation, [
|
||||
"constants",
|
||||
"kMaxLength",
|
||||
"kStringMaxLength",
|
||||
"Buffer",
|
||||
"SlowBuffer"
|
||||
]),
|
||||
"node:events": pick(EventsImplementation, [
|
||||
"EventEmitter",
|
||||
"captureRejectionSymbol",
|
||||
"defaultMaxListeners",
|
||||
"errorMonitor",
|
||||
"listenerCount",
|
||||
"on",
|
||||
"once"
|
||||
]),
|
||||
"node:async_hooks": pick(AsyncHooksImplementation, [
|
||||
"AsyncLocalStorage",
|
||||
"AsyncResource"
|
||||
]),
|
||||
"node:assert": pick(AssertImplementation, [
|
||||
"AssertionError",
|
||||
"deepEqual",
|
||||
"deepStrictEqual",
|
||||
"doesNotMatch",
|
||||
"doesNotReject",
|
||||
"doesNotThrow",
|
||||
"equal",
|
||||
"fail",
|
||||
"ifError",
|
||||
"match",
|
||||
"notDeepEqual",
|
||||
"notDeepStrictEqual",
|
||||
"notEqual",
|
||||
"notStrictEqual",
|
||||
"ok",
|
||||
"rejects",
|
||||
"strict",
|
||||
"strictEqual",
|
||||
"throws"
|
||||
]),
|
||||
"node:util": pick(UtilImplementation, [
|
||||
"_extend",
|
||||
"callbackify",
|
||||
"format",
|
||||
"inherits",
|
||||
"promisify",
|
||||
"types"
|
||||
])
|
||||
};
|
||||
return new Map(Object.entries(mods));
|
||||
})();
|
||||
export const requestStore = new AsyncLocalStorage();
|
||||
/**
|
||||
* Create a module cache specific for the provided parameters. It includes
|
||||
* a runtime context, require cache and paths cache.
|
||||
*/ async function createModuleContext(options) {
|
||||
const warnedEvals = new Set();
|
||||
const warnedWasmCodegens = new Set();
|
||||
const { edgeFunctionEntry } = options;
|
||||
const wasm = await loadWasm(edgeFunctionEntry.wasm ?? []);
|
||||
const runtime = new EdgeRuntime({
|
||||
codeGeneration: process.env.NODE_ENV !== "production" ? {
|
||||
strings: true,
|
||||
wasm: true
|
||||
} : undefined,
|
||||
extend: (context)=>{
|
||||
context.process = createProcessPolyfill(edgeFunctionEntry.env);
|
||||
Object.defineProperty(context, "require", {
|
||||
enumerable: false,
|
||||
value: (id)=>{
|
||||
const value = NativeModuleMap.get(id);
|
||||
if (!value) {
|
||||
throw TypeError("Native module not found: " + id);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
});
|
||||
if (process.env.NODE_ENV !== "production") {
|
||||
context.__next_log_error__ = function(err) {
|
||||
options.onError(err);
|
||||
};
|
||||
}
|
||||
context.__next_eval__ = function __next_eval__(fn) {
|
||||
const key = fn.toString();
|
||||
if (!warnedEvals.has(key)) {
|
||||
const warning = getServerError(new Error(`Dynamic Code Evaluation (e. g. 'eval', 'new Function') not allowed in Edge Runtime
|
||||
Learn More: https://nextjs.org/docs/messages/edge-dynamic-code-evaluation`), COMPILER_NAMES.edgeServer);
|
||||
warning.name = "DynamicCodeEvaluationWarning";
|
||||
Error.captureStackTrace(warning, __next_eval__);
|
||||
warnedEvals.add(key);
|
||||
options.onWarning(warning);
|
||||
}
|
||||
return fn();
|
||||
};
|
||||
context.__next_webassembly_compile__ = function __next_webassembly_compile__(fn) {
|
||||
const key = fn.toString();
|
||||
if (!warnedWasmCodegens.has(key)) {
|
||||
const warning = getServerError(new Error(`Dynamic WASM code generation (e. g. 'WebAssembly.compile') not allowed in Edge Runtime.
|
||||
Learn More: https://nextjs.org/docs/messages/edge-dynamic-code-evaluation`), COMPILER_NAMES.edgeServer);
|
||||
warning.name = "DynamicWasmCodeGenerationWarning";
|
||||
Error.captureStackTrace(warning, __next_webassembly_compile__);
|
||||
warnedWasmCodegens.add(key);
|
||||
options.onWarning(warning);
|
||||
}
|
||||
return fn();
|
||||
};
|
||||
context.__next_webassembly_instantiate__ = async function __next_webassembly_instantiate__(fn) {
|
||||
const result = await fn();
|
||||
// If a buffer is given, WebAssembly.instantiate returns an object
|
||||
// containing both a module and an instance while it returns only an
|
||||
// instance if a WASM module is given. Utilize the fact to determine
|
||||
// if the WASM code generation happens.
|
||||
//
|
||||
// https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/instantiate#primary_overload_%E2%80%94_taking_wasm_binary_code
|
||||
const instantiatedFromBuffer = result.hasOwnProperty("module");
|
||||
const key = fn.toString();
|
||||
if (instantiatedFromBuffer && !warnedWasmCodegens.has(key)) {
|
||||
const warning = getServerError(new Error(`Dynamic WASM code generation ('WebAssembly.instantiate' with a buffer parameter) not allowed in Edge Runtime.
|
||||
Learn More: https://nextjs.org/docs/messages/edge-dynamic-code-evaluation`), COMPILER_NAMES.edgeServer);
|
||||
warning.name = "DynamicWasmCodeGenerationWarning";
|
||||
Error.captureStackTrace(warning, __next_webassembly_instantiate__);
|
||||
warnedWasmCodegens.add(key);
|
||||
options.onWarning(warning);
|
||||
}
|
||||
return result;
|
||||
};
|
||||
const __fetch = context.fetch;
|
||||
context.fetch = async (input, init = {})=>{
|
||||
var _init_headers_get;
|
||||
const callingError = new Error("[internal]");
|
||||
const assetResponse = await fetchInlineAsset({
|
||||
input,
|
||||
assets: options.edgeFunctionEntry.assets,
|
||||
distDir: options.distDir,
|
||||
context
|
||||
});
|
||||
if (assetResponse) {
|
||||
return assetResponse;
|
||||
}
|
||||
init.headers = new Headers(init.headers ?? {});
|
||||
// Forward subrequest header from incoming request to outgoing request
|
||||
const store = requestStore.getStore();
|
||||
if ((store == null ? void 0 : store.headers.has("x-middleware-subrequest")) && !init.headers.has("x-middleware-subrequest")) {
|
||||
init.headers.set("x-middleware-subrequest", store.headers.get("x-middleware-subrequest") ?? "");
|
||||
}
|
||||
const prevs = ((_init_headers_get = init.headers.get(`x-middleware-subrequest`)) == null ? void 0 : _init_headers_get.split(":")) || [];
|
||||
const value = prevs.concat(options.moduleName).join(":");
|
||||
init.headers.set("x-middleware-subrequest", value);
|
||||
if (!init.headers.has("user-agent")) {
|
||||
init.headers.set(`user-agent`, `Next.js Middleware`);
|
||||
}
|
||||
const response = typeof input === "object" && "url" in input ? __fetch(input.url, {
|
||||
...pick(input, [
|
||||
"method",
|
||||
"body",
|
||||
"cache",
|
||||
"credentials",
|
||||
"integrity",
|
||||
"keepalive",
|
||||
"mode",
|
||||
"redirect",
|
||||
"referrer",
|
||||
"referrerPolicy",
|
||||
"signal"
|
||||
]),
|
||||
...init,
|
||||
headers: {
|
||||
...Object.fromEntries(input.headers),
|
||||
...Object.fromEntries(init.headers)
|
||||
}
|
||||
}) : __fetch(String(input), init);
|
||||
return await response.catch((err)=>{
|
||||
callingError.message = err.message;
|
||||
err.stack = callingError.stack;
|
||||
throw err;
|
||||
});
|
||||
};
|
||||
const __Request = context.Request;
|
||||
context.Request = class extends __Request {
|
||||
constructor(input, init){
|
||||
const url = typeof input !== "string" && "url" in input ? input.url : String(input);
|
||||
validateURL(url);
|
||||
super(url, init);
|
||||
this.next = init == null ? void 0 : init.next;
|
||||
}
|
||||
};
|
||||
const __redirect = context.Response.redirect.bind(context.Response);
|
||||
context.Response.redirect = (...args)=>{
|
||||
validateURL(args[0]);
|
||||
return __redirect(...args);
|
||||
};
|
||||
for (const name of EDGE_UNSUPPORTED_NODE_APIS){
|
||||
addStub(context, name);
|
||||
}
|
||||
Object.assign(context, wasm);
|
||||
context.performance = performance;
|
||||
context.AsyncLocalStorage = AsyncLocalStorage;
|
||||
// @ts-ignore the timeouts have weird types in the edge runtime
|
||||
context.setInterval = (...args)=>intervalsManager.add(args);
|
||||
// @ts-ignore the timeouts have weird types in the edge runtime
|
||||
context.clearInterval = (interval)=>intervalsManager.remove(interval);
|
||||
// @ts-ignore the timeouts have weird types in the edge runtime
|
||||
context.setTimeout = (...args)=>timeoutsManager.add(args);
|
||||
// @ts-ignore the timeouts have weird types in the edge runtime
|
||||
context.clearTimeout = (timeout)=>timeoutsManager.remove(timeout);
|
||||
return context;
|
||||
}
|
||||
});
|
||||
const decorateUnhandledError = getDecorateUnhandledError(runtime);
|
||||
runtime.context.addEventListener("error", decorateUnhandledError);
|
||||
const decorateUnhandledRejection = getDecorateUnhandledRejection(runtime);
|
||||
runtime.context.addEventListener("unhandledrejection", decorateUnhandledRejection);
|
||||
return {
|
||||
runtime,
|
||||
paths: new Map(),
|
||||
warnedEvals: new Set()
|
||||
};
|
||||
}
|
||||
function getModuleContextShared(options) {
|
||||
let deferredModuleContext = pendingModuleCaches.get(options.moduleName);
|
||||
if (!deferredModuleContext) {
|
||||
deferredModuleContext = createModuleContext(options);
|
||||
pendingModuleCaches.set(options.moduleName, deferredModuleContext);
|
||||
}
|
||||
return deferredModuleContext;
|
||||
}
|
||||
/**
|
||||
* For a given module name this function will get a cached module
|
||||
* context or create it. It will return the module context along
|
||||
* with a function that allows to run some code from a given
|
||||
* filepath within the context.
|
||||
*/ export async function getModuleContext(options) {
|
||||
let lazyModuleContext;
|
||||
if (options.useCache) {
|
||||
lazyModuleContext = moduleContexts.get(options.moduleName) || await getModuleContextShared(options);
|
||||
}
|
||||
if (!lazyModuleContext) {
|
||||
lazyModuleContext = await createModuleContext(options);
|
||||
moduleContexts.set(options.moduleName, lazyModuleContext);
|
||||
}
|
||||
const moduleContext = lazyModuleContext;
|
||||
const evaluateInContext = (filepath)=>{
|
||||
if (!moduleContext.paths.has(filepath)) {
|
||||
const content = readFileSync(filepath, "utf-8");
|
||||
try {
|
||||
runInContext(content, moduleContext.runtime.context, {
|
||||
filename: filepath
|
||||
});
|
||||
moduleContext.paths.set(filepath, content);
|
||||
} catch (error) {
|
||||
if (options.useCache) {
|
||||
moduleContext == null ? void 0 : moduleContext.paths.delete(filepath);
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
};
|
||||
return {
|
||||
...moduleContext,
|
||||
evaluateInContext
|
||||
};
|
||||
}
|
||||
|
||||
//# sourceMappingURL=context.js.map
|
||||
1
node_modules/next/dist/esm/server/web/sandbox/context.js.map
generated
vendored
Normal file
1
node_modules/next/dist/esm/server/web/sandbox/context.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
29
node_modules/next/dist/esm/server/web/sandbox/fetch-inline-assets.js
generated
vendored
Normal file
29
node_modules/next/dist/esm/server/web/sandbox/fetch-inline-assets.js
generated
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
import { createReadStream, promises as fs } from "fs";
|
||||
import { requestToBodyStream } from "../../body-streams";
|
||||
import { resolve } from "path";
|
||||
/**
|
||||
* Short-circuits the `fetch` function
|
||||
* to return a stream for a given asset, if a user used `new URL("file", import.meta.url)`.
|
||||
* This allows to embed assets in Edge Runtime.
|
||||
*/ export async function fetchInlineAsset(options) {
|
||||
const inputString = String(options.input);
|
||||
if (!inputString.startsWith("blob:")) {
|
||||
return;
|
||||
}
|
||||
const name = inputString.replace("blob:", "");
|
||||
const asset = options.assets ? options.assets.find((x)=>x.name === name) : {
|
||||
name,
|
||||
filePath: name
|
||||
};
|
||||
if (!asset) {
|
||||
return;
|
||||
}
|
||||
const filePath = resolve(options.distDir, asset.filePath);
|
||||
const fileIsReadable = await fs.access(filePath).then(()=>true, ()=>false);
|
||||
if (fileIsReadable) {
|
||||
const readStream = createReadStream(filePath);
|
||||
return new options.context.Response(requestToBodyStream(options.context, Uint8Array, readStream));
|
||||
}
|
||||
}
|
||||
|
||||
//# sourceMappingURL=fetch-inline-assets.js.map
|
||||
1
node_modules/next/dist/esm/server/web/sandbox/fetch-inline-assets.js.map
generated
vendored
Normal file
1
node_modules/next/dist/esm/server/web/sandbox/fetch-inline-assets.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../src/server/web/sandbox/fetch-inline-assets.ts"],"names":["createReadStream","promises","fs","requestToBodyStream","resolve","fetchInlineAsset","options","inputString","String","input","startsWith","name","replace","asset","assets","find","x","filePath","distDir","fileIsReadable","access","then","readStream","context","Response","Uint8Array"],"mappings":"AACA,SAASA,gBAAgB,EAAEC,YAAYC,EAAE,QAAQ,KAAI;AACrD,SAASC,mBAAmB,QAAQ,qBAAoB;AACxD,SAASC,OAAO,QAAQ,OAAM;AAE9B;;;;CAIC,GACD,OAAO,eAAeC,iBAAiBC,OAKtC;IACC,MAAMC,cAAcC,OAAOF,QAAQG,KAAK;IACxC,IAAI,CAACF,YAAYG,UAAU,CAAC,UAAU;QACpC;IACF;IAEA,MAAMC,OAAOJ,YAAYK,OAAO,CAAC,SAAS;IAC1C,MAAMC,QAAQP,QAAQQ,MAAM,GACxBR,QAAQQ,MAAM,CAACC,IAAI,CAAC,CAACC,IAAMA,EAAEL,IAAI,KAAKA,QACtC;QACEA;QACAM,UAAUN;IACZ;IACJ,IAAI,CAACE,OAAO;QACV;IACF;IAEA,MAAMI,WAAWb,QAAQE,QAAQY,OAAO,EAAEL,MAAMI,QAAQ;IACxD,MAAME,iBAAiB,MAAMjB,GAAGkB,MAAM,CAACH,UAAUI,IAAI,CACnD,IAAM,MACN,IAAM;IAGR,IAAIF,gBAAgB;QAClB,MAAMG,aAAatB,iBAAiBiB;QACpC,OAAO,IAAIX,QAAQiB,OAAO,CAACC,QAAQ,CACjCrB,oBAAoBG,QAAQiB,OAAO,EAAEE,YAAYH;IAErD;AACF"}
|
||||
4
node_modules/next/dist/esm/server/web/sandbox/index.js
generated
vendored
Normal file
4
node_modules/next/dist/esm/server/web/sandbox/index.js
generated
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
export * from "./sandbox";
|
||||
export { clearModuleContext } from "./context";
|
||||
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/next/dist/esm/server/web/sandbox/index.js.map
generated
vendored
Normal file
1
node_modules/next/dist/esm/server/web/sandbox/index.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../src/server/web/sandbox/index.ts"],"names":["clearModuleContext"],"mappings":"AAAA,cAAc,YAAW;AACzB,SAASA,kBAAkB,QAAQ,YAAW"}
|
||||
40
node_modules/next/dist/esm/server/web/sandbox/resource-managers.js
generated
vendored
Normal file
40
node_modules/next/dist/esm/server/web/sandbox/resource-managers.js
generated
vendored
Normal file
@ -0,0 +1,40 @@
|
||||
class ResourceManager {
|
||||
add(resourceArgs) {
|
||||
const resource = this.create(resourceArgs);
|
||||
this.resources.push(resource);
|
||||
return resource;
|
||||
}
|
||||
remove(resource) {
|
||||
this.resources = this.resources.filter((r)=>r !== resource);
|
||||
this.destroy(resource);
|
||||
}
|
||||
removeAll() {
|
||||
this.resources.forEach(this.destroy);
|
||||
this.resources = [];
|
||||
}
|
||||
constructor(){
|
||||
this.resources = [];
|
||||
}
|
||||
}
|
||||
class IntervalsManager extends ResourceManager {
|
||||
create(args) {
|
||||
// TODO: use the edge runtime provided `setInterval` instead
|
||||
return setInterval(...args)[Symbol.toPrimitive]();
|
||||
}
|
||||
destroy(interval) {
|
||||
clearInterval(interval);
|
||||
}
|
||||
}
|
||||
class TimeoutsManager extends ResourceManager {
|
||||
create(args) {
|
||||
// TODO: use the edge runtime provided `setTimeout` instead
|
||||
return setTimeout(...args)[Symbol.toPrimitive]();
|
||||
}
|
||||
destroy(timeout) {
|
||||
clearTimeout(timeout);
|
||||
}
|
||||
}
|
||||
export const intervalsManager = new IntervalsManager();
|
||||
export const timeoutsManager = new TimeoutsManager();
|
||||
|
||||
//# sourceMappingURL=resource-managers.js.map
|
||||
1
node_modules/next/dist/esm/server/web/sandbox/resource-managers.js.map
generated
vendored
Normal file
1
node_modules/next/dist/esm/server/web/sandbox/resource-managers.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../src/server/web/sandbox/resource-managers.ts"],"names":["ResourceManager","add","resourceArgs","resource","create","resources","push","remove","filter","r","destroy","removeAll","forEach","IntervalsManager","args","setInterval","Symbol","toPrimitive","interval","clearInterval","TimeoutsManager","setTimeout","timeout","clearTimeout","intervalsManager","timeoutsManager"],"mappings":"AAAA,MAAeA;IAMbC,IAAIC,YAAe,EAAE;QACnB,MAAMC,WAAW,IAAI,CAACC,MAAM,CAACF;QAC7B,IAAI,CAACG,SAAS,CAACC,IAAI,CAACH;QACpB,OAAOA;IACT;IAEAI,OAAOJ,QAAW,EAAE;QAClB,IAAI,CAACE,SAAS,GAAG,IAAI,CAACA,SAAS,CAACG,MAAM,CAAC,CAACC,IAAMA,MAAMN;QACpD,IAAI,CAACO,OAAO,CAACP;IACf;IAEAQ,YAAY;QACV,IAAI,CAACN,SAAS,CAACO,OAAO,CAAC,IAAI,CAACF,OAAO;QACnC,IAAI,CAACL,SAAS,GAAG,EAAE;IACrB;;aAnBQA,YAAiB,EAAE;;AAoB7B;AAEA,MAAMQ,yBAAyBb;IAI7BI,OAAOU,IAAoC,EAAE;QAC3C,4DAA4D;QAC5D,OAAOC,eAAeD,KAAK,CAACE,OAAOC,WAAW,CAAC;IACjD;IAEAP,QAAQQ,QAAgB,EAAE;QACxBC,cAAcD;IAChB;AACF;AAEA,MAAME,wBAAwBpB;IAI5BI,OAAOU,IAAmC,EAAE;QAC1C,2DAA2D;QAC3D,OAAOO,cAAcP,KAAK,CAACE,OAAOC,WAAW,CAAC;IAChD;IAEAP,QAAQY,OAAe,EAAE;QACvBC,aAAaD;IACf;AACF;AAEA,OAAO,MAAME,mBAAmB,IAAIX,mBAAkB;AACtD,OAAO,MAAMY,kBAAkB,IAAIL,kBAAiB"}
|
||||
102
node_modules/next/dist/esm/server/web/sandbox/sandbox.js
generated
vendored
Normal file
102
node_modules/next/dist/esm/server/web/sandbox/sandbox.js
generated
vendored
Normal file
@ -0,0 +1,102 @@
|
||||
import { getModuleContext, requestStore } from "./context";
|
||||
import { requestToBodyStream } from "../../body-streams";
|
||||
import { NEXT_RSC_UNION_QUERY } from "../../../client/components/app-router-headers";
|
||||
export const ErrorSource = Symbol("SandboxError");
|
||||
const FORBIDDEN_HEADERS = [
|
||||
"content-length",
|
||||
"content-encoding",
|
||||
"transfer-encoding"
|
||||
];
|
||||
/**
|
||||
* Decorates the runner function making sure all errors it can produce are
|
||||
* tagged with `edge-server` so they can properly be rendered in dev.
|
||||
*/ function withTaggedErrors(fn) {
|
||||
if (process.env.NODE_ENV === "development") {
|
||||
const { getServerError } = require("../../../client/components/react-dev-overlay/server/middleware");
|
||||
return (params)=>fn(params).then((result)=>{
|
||||
var _result_waitUntil;
|
||||
return {
|
||||
...result,
|
||||
waitUntil: result == null ? void 0 : (_result_waitUntil = result.waitUntil) == null ? void 0 : _result_waitUntil.catch((error)=>{
|
||||
// TODO: used COMPILER_NAMES.edgeServer instead. Verify that it does not increase the runtime size.
|
||||
throw getServerError(error, "edge-server");
|
||||
})
|
||||
};
|
||||
}).catch((error)=>{
|
||||
// TODO: used COMPILER_NAMES.edgeServer instead
|
||||
throw getServerError(error, "edge-server");
|
||||
});
|
||||
}
|
||||
return fn;
|
||||
}
|
||||
export async function getRuntimeContext(params) {
|
||||
const { runtime, evaluateInContext } = await getModuleContext({
|
||||
moduleName: params.name,
|
||||
onWarning: params.onWarning ?? (()=>{}),
|
||||
onError: params.onError ?? (()=>{}),
|
||||
useCache: params.useCache !== false,
|
||||
edgeFunctionEntry: params.edgeFunctionEntry,
|
||||
distDir: params.distDir
|
||||
});
|
||||
if (params.incrementalCache) {
|
||||
runtime.context.globalThis.__incrementalCache = params.incrementalCache;
|
||||
}
|
||||
for (const paramPath of params.paths){
|
||||
evaluateInContext(paramPath);
|
||||
}
|
||||
return runtime;
|
||||
}
|
||||
export const run = withTaggedErrors(async function runWithTaggedErrors(params) {
|
||||
var _params_request_body;
|
||||
const runtime = await getRuntimeContext(params);
|
||||
const subreq = params.request.headers[`x-middleware-subrequest`];
|
||||
const subrequests = typeof subreq === "string" ? subreq.split(":") : [];
|
||||
const MAX_RECURSION_DEPTH = 5;
|
||||
const depth = subrequests.reduce((acc, curr)=>curr === params.name ? acc + 1 : acc, 0);
|
||||
if (depth >= MAX_RECURSION_DEPTH) {
|
||||
return {
|
||||
waitUntil: Promise.resolve(),
|
||||
response: new runtime.context.Response(null, {
|
||||
headers: {
|
||||
"x-middleware-next": "1"
|
||||
}
|
||||
})
|
||||
};
|
||||
}
|
||||
const edgeFunction = (await runtime.context._ENTRIES[`middleware_${params.name}`]).default;
|
||||
const cloned = ![
|
||||
"HEAD",
|
||||
"GET"
|
||||
].includes(params.request.method) ? (_params_request_body = params.request.body) == null ? void 0 : _params_request_body.cloneBodyStream() : undefined;
|
||||
const KUint8Array = runtime.evaluate("Uint8Array");
|
||||
const urlInstance = new URL(params.request.url);
|
||||
urlInstance.searchParams.delete(NEXT_RSC_UNION_QUERY);
|
||||
params.request.url = urlInstance.toString();
|
||||
const headers = new Headers();
|
||||
for (const [key, value] of Object.entries(params.request.headers)){
|
||||
headers.set(key, (value == null ? void 0 : value.toString()) ?? "");
|
||||
}
|
||||
try {
|
||||
let result = undefined;
|
||||
await requestStore.run({
|
||||
headers
|
||||
}, async ()=>{
|
||||
result = await edgeFunction({
|
||||
request: {
|
||||
...params.request,
|
||||
body: cloned && requestToBodyStream(runtime.context, KUint8Array, cloned)
|
||||
}
|
||||
});
|
||||
for (const headerName of FORBIDDEN_HEADERS){
|
||||
result.response.headers.delete(headerName);
|
||||
}
|
||||
});
|
||||
if (!result) throw new Error("Edge function did not return a response");
|
||||
return result;
|
||||
} finally{
|
||||
var _params_request_body1;
|
||||
await ((_params_request_body1 = params.request.body) == null ? void 0 : _params_request_body1.finalize());
|
||||
}
|
||||
});
|
||||
|
||||
//# sourceMappingURL=sandbox.js.map
|
||||
1
node_modules/next/dist/esm/server/web/sandbox/sandbox.js.map
generated
vendored
Normal file
1
node_modules/next/dist/esm/server/web/sandbox/sandbox.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../src/server/web/sandbox/sandbox.ts"],"names":["getModuleContext","requestStore","requestToBodyStream","NEXT_RSC_UNION_QUERY","ErrorSource","Symbol","FORBIDDEN_HEADERS","withTaggedErrors","fn","process","env","NODE_ENV","getServerError","require","params","then","result","waitUntil","catch","error","getRuntimeContext","runtime","evaluateInContext","moduleName","name","onWarning","onError","useCache","edgeFunctionEntry","distDir","incrementalCache","context","globalThis","__incrementalCache","paramPath","paths","run","runWithTaggedErrors","subreq","request","headers","subrequests","split","MAX_RECURSION_DEPTH","depth","reduce","acc","curr","Promise","resolve","response","Response","edgeFunction","_ENTRIES","default","cloned","includes","method","body","cloneBodyStream","undefined","KUint8Array","evaluate","urlInstance","URL","url","searchParams","delete","toString","Headers","key","value","Object","entries","set","headerName","Error","finalize"],"mappings":"AAGA,SAASA,gBAAgB,EAAEC,YAAY,QAAQ,YAAW;AAC1D,SAASC,mBAAmB,QAAQ,qBAAoB;AACxD,SAASC,oBAAoB,QAAQ,gDAA+C;AAEpF,OAAO,MAAMC,cAAcC,OAAO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GAAG;YAClCxB,SAAS,MAAMoC,aAAa;gBAC1Bb,SAAS;oBACP,GAAGzB,OAAOyB,OAAO;oBACjBmB,MACEH,UAAUrD,oBAAoBmB,QAAQU,OAAO,EAAE8B,aAAaN;gBAChE;YACF;YACA,KAAK,MAAMoB,cAAcrE,kBAAmB;gBAC1CU,OAAOkC,QAAQ,CAACV,OAAO,CAAC2B,MAAM,CAACQ;YACjC;QACF;QACA,IAAI,CAAC3D,QAAQ,MAAM,IAAI4D,MAAM;QAC7B,OAAO5D;IACT,SAAU;YACFF;QAAN,QAAMA,wBAAAA,OAAOyB,OAAO,CAACmB,IAAI,qBAAnB5C,sBAAqB+D,QAAQ;IACrC;AACF,GAAE"}
|
||||
172
node_modules/next/dist/esm/server/web/spec-extension/adapters/headers.js
generated
vendored
Normal file
172
node_modules/next/dist/esm/server/web/spec-extension/adapters/headers.js
generated
vendored
Normal file
@ -0,0 +1,172 @@
|
||||
import { ReflectAdapter } from "./reflect";
|
||||
/**
|
||||
* @internal
|
||||
*/ export class ReadonlyHeadersError extends Error {
|
||||
constructor(){
|
||||
super("Headers cannot be modified. Read more: https://nextjs.org/docs/app/api-reference/functions/headers");
|
||||
}
|
||||
static callable() {
|
||||
throw new ReadonlyHeadersError();
|
||||
}
|
||||
}
|
||||
export class HeadersAdapter extends Headers {
|
||||
constructor(headers){
|
||||
// We've already overridden the methods that would be called, so we're just
|
||||
// calling the super constructor to ensure that the instanceof check works.
|
||||
super();
|
||||
this.headers = new Proxy(headers, {
|
||||
get (target, prop, receiver) {
|
||||
// Because this is just an object, we expect that all "get" operations
|
||||
// are for properties. If it's a "get" for a symbol, we'll just return
|
||||
// the symbol.
|
||||
if (typeof prop === "symbol") {
|
||||
return ReflectAdapter.get(target, prop, receiver);
|
||||
}
|
||||
const lowercased = prop.toLowerCase();
|
||||
// Let's find the original casing of the key. This assumes that there is
|
||||
// no mixed case keys (e.g. "Content-Type" and "content-type") in the
|
||||
// headers object.
|
||||
const original = Object.keys(headers).find((o)=>o.toLowerCase() === lowercased);
|
||||
// If the original casing doesn't exist, return undefined.
|
||||
if (typeof original === "undefined") return;
|
||||
// If the original casing exists, return the value.
|
||||
return ReflectAdapter.get(target, original, receiver);
|
||||
},
|
||||
set (target, prop, value, receiver) {
|
||||
if (typeof prop === "symbol") {
|
||||
return ReflectAdapter.set(target, prop, value, receiver);
|
||||
}
|
||||
const lowercased = prop.toLowerCase();
|
||||
// Let's find the original casing of the key. This assumes that there is
|
||||
// no mixed case keys (e.g. "Content-Type" and "content-type") in the
|
||||
// headers object.
|
||||
const original = Object.keys(headers).find((o)=>o.toLowerCase() === lowercased);
|
||||
// If the original casing doesn't exist, use the prop as the key.
|
||||
return ReflectAdapter.set(target, original ?? prop, value, receiver);
|
||||
},
|
||||
has (target, prop) {
|
||||
if (typeof prop === "symbol") return ReflectAdapter.has(target, prop);
|
||||
const lowercased = prop.toLowerCase();
|
||||
// Let's find the original casing of the key. This assumes that there is
|
||||
// no mixed case keys (e.g. "Content-Type" and "content-type") in the
|
||||
// headers object.
|
||||
const original = Object.keys(headers).find((o)=>o.toLowerCase() === lowercased);
|
||||
// If the original casing doesn't exist, return false.
|
||||
if (typeof original === "undefined") return false;
|
||||
// If the original casing exists, return true.
|
||||
return ReflectAdapter.has(target, original);
|
||||
},
|
||||
deleteProperty (target, prop) {
|
||||
if (typeof prop === "symbol") return ReflectAdapter.deleteProperty(target, prop);
|
||||
const lowercased = prop.toLowerCase();
|
||||
// Let's find the original casing of the key. This assumes that there is
|
||||
// no mixed case keys (e.g. "Content-Type" and "content-type") in the
|
||||
// headers object.
|
||||
const original = Object.keys(headers).find((o)=>o.toLowerCase() === lowercased);
|
||||
// If the original casing doesn't exist, return true.
|
||||
if (typeof original === "undefined") return true;
|
||||
// If the original casing exists, delete the property.
|
||||
return ReflectAdapter.deleteProperty(target, original);
|
||||
}
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Seals a Headers instance to prevent modification by throwing an error when
|
||||
* any mutating method is called.
|
||||
*/ static seal(headers) {
|
||||
return new Proxy(headers, {
|
||||
get (target, prop, receiver) {
|
||||
switch(prop){
|
||||
case "append":
|
||||
case "delete":
|
||||
case "set":
|
||||
return ReadonlyHeadersError.callable;
|
||||
default:
|
||||
return ReflectAdapter.get(target, prop, receiver);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Merges a header value into a string. This stores multiple values as an
|
||||
* array, so we need to merge them into a string.
|
||||
*
|
||||
* @param value a header value
|
||||
* @returns a merged header value (a string)
|
||||
*/ merge(value) {
|
||||
if (Array.isArray(value)) return value.join(", ");
|
||||
return value;
|
||||
}
|
||||
/**
|
||||
* Creates a Headers instance from a plain object or a Headers instance.
|
||||
*
|
||||
* @param headers a plain object or a Headers instance
|
||||
* @returns a headers instance
|
||||
*/ static from(headers) {
|
||||
if (headers instanceof Headers) return headers;
|
||||
return new HeadersAdapter(headers);
|
||||
}
|
||||
append(name, value) {
|
||||
const existing = this.headers[name];
|
||||
if (typeof existing === "string") {
|
||||
this.headers[name] = [
|
||||
existing,
|
||||
value
|
||||
];
|
||||
} else if (Array.isArray(existing)) {
|
||||
existing.push(value);
|
||||
} else {
|
||||
this.headers[name] = value;
|
||||
}
|
||||
}
|
||||
delete(name) {
|
||||
delete this.headers[name];
|
||||
}
|
||||
get(name) {
|
||||
const value = this.headers[name];
|
||||
if (typeof value !== "undefined") return this.merge(value);
|
||||
return null;
|
||||
}
|
||||
has(name) {
|
||||
return typeof this.headers[name] !== "undefined";
|
||||
}
|
||||
set(name, value) {
|
||||
this.headers[name] = value;
|
||||
}
|
||||
forEach(callbackfn, thisArg) {
|
||||
for (const [name, value] of this.entries()){
|
||||
callbackfn.call(thisArg, value, name, this);
|
||||
}
|
||||
}
|
||||
*entries() {
|
||||
for (const key of Object.keys(this.headers)){
|
||||
const name = key.toLowerCase();
|
||||
// We assert here that this is a string because we got it from the
|
||||
// Object.keys() call above.
|
||||
const value = this.get(name);
|
||||
yield [
|
||||
name,
|
||||
value
|
||||
];
|
||||
}
|
||||
}
|
||||
*keys() {
|
||||
for (const key of Object.keys(this.headers)){
|
||||
const name = key.toLowerCase();
|
||||
yield name;
|
||||
}
|
||||
}
|
||||
*values() {
|
||||
for (const key of Object.keys(this.headers)){
|
||||
// We assert here that this is a string because we got it from the
|
||||
// Object.keys() call above.
|
||||
const value = this.get(key);
|
||||
yield value;
|
||||
}
|
||||
}
|
||||
[Symbol.iterator]() {
|
||||
return this.entries();
|
||||
}
|
||||
}
|
||||
|
||||
//# sourceMappingURL=headers.js.map
|
||||
1
node_modules/next/dist/esm/server/web/spec-extension/adapters/headers.js.map
generated
vendored
Normal file
1
node_modules/next/dist/esm/server/web/spec-extension/adapters/headers.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../../src/server/web/spec-extension/adapters/headers.ts"],"names":["ReflectAdapter","ReadonlyHeadersError","Error","constructor","callable","HeadersAdapter","Headers","headers","Proxy","get","target","prop","receiver","lowercased","toLowerCase","original","Object","keys","find","o","set","value","has","deleteProperty","seal","merge","Array","isArray","join","from","append","name","existing","push","delete","forEach","callbackfn","thisArg","entries","call","key","values","Symbol","iterator"],"mappings":"AAEA,SAASA,cAAc,QAAQ,YAAW;AAE1C;;CAEC,GACD,OAAO,MAAMC,6BAA6BC;IACxCC,aAAc;QACZ,KAAK,CACH;IAEJ;IAEA,OAAcC,WAAW;QACvB,MAAM,IAAIH;IACZ;AACF;AAUA,OAAO,MAAMI,uBAAuBC;IAGlCH,YAAYI,OAA4B,CAAE;QACxC,2EAA2E;QAC3E,2EAA2E;QAC3E,KAAK;QAEL,IAAI,CAACA,OAAO,GAAG,IAAIC,MAAMD,SAAS;YAChCE,KAAIC,MAAM,EAAEC,IAAI,EAAEC,QAAQ;gBACxB,sEAAsE;gBACtE,sEAAsE;gBACtE,cAAc;gBACd,IAAI,OAAOD,SAAS,UAAU;oBAC5B,OAAOX,eAAeS,GAAG,CAACC,QAAQC,MAAMC;gBAC1C;gBAEA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_modules/next/dist/esm/server/web/spec-extension/adapters/next-request.js
generated
vendored
Normal file
113
node_modules/next/dist/esm/server/web/spec-extension/adapters/next-request.js
generated
vendored
Normal file
@ -0,0 +1,113 @@
|
||||
import { getRequestMeta } from "../../../request-meta";
|
||||
import { fromNodeOutgoingHttpHeaders } from "../../utils";
|
||||
import { NextRequest } from "../request";
|
||||
export const ResponseAbortedName = "ResponseAborted";
|
||||
export class ResponseAborted extends Error {
|
||||
constructor(...args){
|
||||
super(...args);
|
||||
this.name = ResponseAbortedName;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Creates an AbortController tied to the closing of a ServerResponse (or other
|
||||
* appropriate Writable).
|
||||
*
|
||||
* If the `close` event is fired before the `finish` event, then we'll send the
|
||||
* `abort` signal.
|
||||
*/ export function createAbortController(response) {
|
||||
const controller = new AbortController();
|
||||
// If `finish` fires first, then `res.end()` has been called and the close is
|
||||
// just us finishing the stream on our side. If `close` fires first, then we
|
||||
// know the client disconnected before we finished.
|
||||
response.once("close", ()=>{
|
||||
if (response.writableFinished) return;
|
||||
controller.abort(new ResponseAborted());
|
||||
});
|
||||
return controller;
|
||||
}
|
||||
/**
|
||||
* Creates an AbortSignal tied to the closing of a ServerResponse (or other
|
||||
* appropriate Writable).
|
||||
*
|
||||
* This cannot be done with the request (IncomingMessage or Readable) because
|
||||
* the `abort` event will not fire if to data has been fully read (because that
|
||||
* will "close" the readable stream and nothing fires after that).
|
||||
*/ export function signalFromNodeResponse(response) {
|
||||
const { errored, destroyed } = response;
|
||||
if (errored || destroyed) {
|
||||
return AbortSignal.abort(errored ?? new ResponseAborted());
|
||||
}
|
||||
const { signal } = createAbortController(response);
|
||||
return signal;
|
||||
}
|
||||
export class NextRequestAdapter {
|
||||
static fromBaseNextRequest(request, signal) {
|
||||
// TODO: look at refining this check
|
||||
if ("request" in request && request.request) {
|
||||
return NextRequestAdapter.fromWebNextRequest(request);
|
||||
}
|
||||
return NextRequestAdapter.fromNodeNextRequest(request, signal);
|
||||
}
|
||||
static fromNodeNextRequest(request, signal) {
|
||||
// HEAD and GET requests can not have a body.
|
||||
let body = null;
|
||||
if (request.method !== "GET" && request.method !== "HEAD" && request.body) {
|
||||
// @ts-expect-error - this is handled by undici, when streams/web land use it instead
|
||||
body = request.body;
|
||||
}
|
||||
let url;
|
||||
if (request.url.startsWith("http")) {
|
||||
url = new URL(request.url);
|
||||
} else {
|
||||
// Grab the full URL from the request metadata.
|
||||
const base = getRequestMeta(request, "initURL");
|
||||
if (!base || !base.startsWith("http")) {
|
||||
// Because the URL construction relies on the fact that the URL provided
|
||||
// is absolute, we need to provide a base URL. We can't use the request
|
||||
// URL because it's relative, so we use a dummy URL instead.
|
||||
url = new URL(request.url, "http://n");
|
||||
} else {
|
||||
url = new URL(request.url, base);
|
||||
}
|
||||
}
|
||||
return new NextRequest(url, {
|
||||
method: request.method,
|
||||
headers: fromNodeOutgoingHttpHeaders(request.headers),
|
||||
// @ts-expect-error - see https://github.com/whatwg/fetch/pull/1457
|
||||
duplex: "half",
|
||||
signal,
|
||||
// geo
|
||||
// ip
|
||||
// nextConfig
|
||||
// body can not be passed if request was aborted
|
||||
// or we get a Request body was disturbed error
|
||||
...signal.aborted ? {} : {
|
||||
body
|
||||
}
|
||||
});
|
||||
}
|
||||
static fromWebNextRequest(request) {
|
||||
// HEAD and GET requests can not have a body.
|
||||
let body = null;
|
||||
if (request.method !== "GET" && request.method !== "HEAD") {
|
||||
body = request.body;
|
||||
}
|
||||
return new NextRequest(request.url, {
|
||||
method: request.method,
|
||||
headers: fromNodeOutgoingHttpHeaders(request.headers),
|
||||
// @ts-expect-error - see https://github.com/whatwg/fetch/pull/1457
|
||||
duplex: "half",
|
||||
signal: request.request.signal,
|
||||
// geo
|
||||
// ip
|
||||
// nextConfig
|
||||
// body can not be passed if request was aborted
|
||||
// or we get a Request body was disturbed error
|
||||
...request.request.signal.aborted ? {} : {
|
||||
body
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
//# sourceMappingURL=next-request.js.map
|
||||
1
node_modules/next/dist/esm/server/web/spec-extension/adapters/next-request.js.map
generated
vendored
Normal file
1
node_modules/next/dist/esm/server/web/spec-extension/adapters/next-request.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../../src/server/web/spec-extension/adapters/next-request.ts"],"names":["getRequestMeta","fromNodeOutgoingHttpHeaders","NextRequest","ResponseAbortedName","ResponseAborted","Error","name","createAbortController","response","controller","AbortController","once","writableFinished","abort","signalFromNodeResponse","errored","destroyed","AbortSignal","signal","NextRequestAdapter","fromBaseNextRequest","request","fromWebNextRequest","fromNodeNextRequest","body","method","url","startsWith","URL","base","headers","duplex","aborted"],"mappings":"AAKA,SAASA,cAAc,QAAQ,wBAAuB;AACtD,SAASC,2BAA2B,QAAQ,cAAa;AACzD,SAASC,WAAW,QAAQ,aAAY;AAExC,OAAO,MAAMC,sBAAsB,kBAAiB;AACpD,OAAO,MAAMC,wBAAwBC;;;aACnBC,OAAOH;;AACzB;AAEA;;;;;;CAMC,GACD,OAAO,SAASI,sBAAsBC,QAAkB;IACtD,MAAMC,aAAa,IAAIC;IAEvB,6EAA6E;IAC7E,4EAA4E;IAC5E,mDAAmD;IACnDF,SAASG,IAAI,CAAC,SAAS;QACrB,IAAIH,SAASI,gBAAgB,EAAE;QAE/BH,WAAWI,KAAK,CAAC,IAAIT;IACvB;IAEA,OAAOK;AACT;AAEA;;;;;;;CAOC,GACD,OAAO,SAASK,uBAAuBN,QAAkB;IACvD,MAAM,EAAEO,OAAO,EAAEC,SAAS,EAAE,GAAGR;IAC/B,IAAIO,WAAWC,WAAW;QACxB,OAAOC,YAAYJ,KAAK,CAACE,WAAW,IAAIX;IAC1C;IAEA,MAAM,EAAEc,MAAM,EAAE,GAAGX,sBAAsBC;IACzC,OAAOU;AACT;AAEA,OAAO,MAAMC;IACX,OAAcC,oBACZC,OAAwB,EACxBH,MAAmB,EACN;QACb,oCAAoC;QACpC,IAAI,aAAaG,WAAW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ClCD,QAAQJ,QAAQI,MAAM;YACtBK,SAAS7B,4BAA4BoB,QAAQS,OAAO;YACpD,mEAAmE;YACnEC,QAAQ;YACRb,QAAQG,QAAQA,OAAO,CAACH,MAAM;YAC9B,MAAM;YACN,KAAK;YACL,aAAa;YAEb,gDAAgD;YAChD,+CAA+C;YAC/C,GAAIG,QAAQA,OAAO,CAACH,MAAM,CAACc,OAAO,GAC9B,CAAC,IACD;gBACER;YACF,CAAC;QACP;IACF;AACF"}
|
||||
20
node_modules/next/dist/esm/server/web/spec-extension/adapters/reflect.js
generated
vendored
Normal file
20
node_modules/next/dist/esm/server/web/spec-extension/adapters/reflect.js
generated
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
export class ReflectAdapter {
|
||||
static get(target, prop, receiver) {
|
||||
const value = Reflect.get(target, prop, receiver);
|
||||
if (typeof value === "function") {
|
||||
return value.bind(target);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
static set(target, prop, value, receiver) {
|
||||
return Reflect.set(target, prop, value, receiver);
|
||||
}
|
||||
static has(target, prop) {
|
||||
return Reflect.has(target, prop);
|
||||
}
|
||||
static deleteProperty(target, prop) {
|
||||
return Reflect.deleteProperty(target, prop);
|
||||
}
|
||||
}
|
||||
|
||||
//# sourceMappingURL=reflect.js.map
|
||||
1
node_modules/next/dist/esm/server/web/spec-extension/adapters/reflect.js.map
generated
vendored
Normal file
1
node_modules/next/dist/esm/server/web/spec-extension/adapters/reflect.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../../src/server/web/spec-extension/adapters/reflect.ts"],"names":["ReflectAdapter","get","target","prop","receiver","value","Reflect","bind","set","has","deleteProperty"],"mappings":"AAAA,OAAO,MAAMA;IACX,OAAOC,IACLC,MAAS,EACTC,IAAqB,EACrBC,QAAiB,EACZ;QACL,MAAMC,QAAQC,QAAQL,GAAG,CAACC,QAAQC,MAAMC;QACxC,IAAI,OAAOC,UAAU,YAAY;YAC/B,OAAOA,MAAME,IAAI,CAACL;QACpB;QAEA,OAAOG;IACT;IAEA,OAAOG,IACLN,MAAS,EACTC,IAAqB,EACrBE,KAAU,EACVD,QAAa,EACJ;QACT,OAAOE,QAAQE,GAAG,CAACN,QAAQC,MAAME,OAAOD;IAC1C;IAEA,OAAOK,IAAsBP,MAAS,EAAEC,IAAqB,EAAW;QACtE,OAAOG,QAAQG,GAAG,CAACP,QAAQC;IAC7B;IAEA,OAAOO,eACLR,MAAS,EACTC,IAAqB,EACZ;QACT,OAAOG,QAAQI,cAAc,CAACR,QAAQC;IACxC;AACF"}
|
||||
118
node_modules/next/dist/esm/server/web/spec-extension/adapters/request-cookies.js
generated
vendored
Normal file
118
node_modules/next/dist/esm/server/web/spec-extension/adapters/request-cookies.js
generated
vendored
Normal file
@ -0,0 +1,118 @@
|
||||
import { ResponseCookies } from "../cookies";
|
||||
import { ReflectAdapter } from "./reflect";
|
||||
import { staticGenerationAsyncStorage } from "../../../../client/components/static-generation-async-storage.external";
|
||||
/**
|
||||
* @internal
|
||||
*/ export class ReadonlyRequestCookiesError extends Error {
|
||||
constructor(){
|
||||
super("Cookies can only be modified in a Server Action or Route Handler. Read more: https://nextjs.org/docs/app/api-reference/functions/cookies#cookiessetname-value-options");
|
||||
}
|
||||
static callable() {
|
||||
throw new ReadonlyRequestCookiesError();
|
||||
}
|
||||
}
|
||||
export class RequestCookiesAdapter {
|
||||
static seal(cookies) {
|
||||
return new Proxy(cookies, {
|
||||
get (target, prop, receiver) {
|
||||
switch(prop){
|
||||
case "clear":
|
||||
case "delete":
|
||||
case "set":
|
||||
return ReadonlyRequestCookiesError.callable;
|
||||
default:
|
||||
return ReflectAdapter.get(target, prop, receiver);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
const SYMBOL_MODIFY_COOKIE_VALUES = Symbol.for("next.mutated.cookies");
|
||||
export function getModifiedCookieValues(cookies) {
|
||||
const modified = cookies[SYMBOL_MODIFY_COOKIE_VALUES];
|
||||
if (!modified || !Array.isArray(modified) || modified.length === 0) {
|
||||
return [];
|
||||
}
|
||||
return modified;
|
||||
}
|
||||
export function appendMutableCookies(headers, mutableCookies) {
|
||||
const modifiedCookieValues = getModifiedCookieValues(mutableCookies);
|
||||
if (modifiedCookieValues.length === 0) {
|
||||
return false;
|
||||
}
|
||||
// Return a new response that extends the response with
|
||||
// the modified cookies as fallbacks. `res` cookies
|
||||
// will still take precedence.
|
||||
const resCookies = new ResponseCookies(headers);
|
||||
const returnedCookies = resCookies.getAll();
|
||||
// Set the modified cookies as fallbacks.
|
||||
for (const cookie of modifiedCookieValues){
|
||||
resCookies.set(cookie);
|
||||
}
|
||||
// Set the original cookies as the final values.
|
||||
for (const cookie of returnedCookies){
|
||||
resCookies.set(cookie);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
export class MutableRequestCookiesAdapter {
|
||||
static wrap(cookies, onUpdateCookies) {
|
||||
const responseCookies = new ResponseCookies(new Headers());
|
||||
for (const cookie of cookies.getAll()){
|
||||
responseCookies.set(cookie);
|
||||
}
|
||||
let modifiedValues = [];
|
||||
const modifiedCookies = new Set();
|
||||
const updateResponseCookies = ()=>{
|
||||
// TODO-APP: change method of getting staticGenerationAsyncStore
|
||||
const staticGenerationAsyncStore = staticGenerationAsyncStorage.getStore();
|
||||
if (staticGenerationAsyncStore) {
|
||||
staticGenerationAsyncStore.pathWasRevalidated = true;
|
||||
}
|
||||
const allCookies = responseCookies.getAll();
|
||||
modifiedValues = allCookies.filter((c)=>modifiedCookies.has(c.name));
|
||||
if (onUpdateCookies) {
|
||||
const serializedCookies = [];
|
||||
for (const cookie of modifiedValues){
|
||||
const tempCookies = new ResponseCookies(new Headers());
|
||||
tempCookies.set(cookie);
|
||||
serializedCookies.push(tempCookies.toString());
|
||||
}
|
||||
onUpdateCookies(serializedCookies);
|
||||
}
|
||||
};
|
||||
return new Proxy(responseCookies, {
|
||||
get (target, prop, receiver) {
|
||||
switch(prop){
|
||||
// A special symbol to get the modified cookie values
|
||||
case SYMBOL_MODIFY_COOKIE_VALUES:
|
||||
return modifiedValues;
|
||||
// TODO: Throw error if trying to set a cookie after the response
|
||||
// headers have been set.
|
||||
case "delete":
|
||||
return function(...args) {
|
||||
modifiedCookies.add(typeof args[0] === "string" ? args[0] : args[0].name);
|
||||
try {
|
||||
target.delete(...args);
|
||||
} finally{
|
||||
updateResponseCookies();
|
||||
}
|
||||
};
|
||||
case "set":
|
||||
return function(...args) {
|
||||
modifiedCookies.add(typeof args[0] === "string" ? args[0] : args[0].name);
|
||||
try {
|
||||
return target.set(...args);
|
||||
} finally{
|
||||
updateResponseCookies();
|
||||
}
|
||||
};
|
||||
default:
|
||||
return ReflectAdapter.get(target, prop, receiver);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
//# sourceMappingURL=request-cookies.js.map
|
||||
1
node_modules/next/dist/esm/server/web/spec-extension/adapters/request-cookies.js.map
generated
vendored
Normal file
1
node_modules/next/dist/esm/server/web/spec-extension/adapters/request-cookies.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../../src/server/web/spec-extension/adapters/request-cookies.ts"],"names":["ResponseCookies","ReflectAdapter","staticGenerationAsyncStorage","ReadonlyRequestCookiesError","Error","constructor","callable","RequestCookiesAdapter","seal","cookies","Proxy","get","target","prop","receiver","SYMBOL_MODIFY_COOKIE_VALUES","Symbol","for","getModifiedCookieValues","modified","Array","isArray","length","appendMutableCookies","headers","mutableCookies","modifiedCookieValues","resCookies","returnedCookies","getAll","cookie","set","MutableRequestCookiesAdapter","wrap","onUpdateCookies","responseCookies","Headers","modifiedValues","modifiedCookies","Set","updateResponseCookies","staticGenerationAsyncStore","getStore","pathWasRevalidated","allCookies","filter","c","has","name","serializedCookies","tempCookies","push","toString","args","add","delete"],"mappings":"AAEA,SAASA,eAAe,QAAQ,aAAY;AAC5C,SAASC,cAAc,QAAQ,YAAW;AAC1C,SAASC,4BAA4B,QAAQ,yEAAwE;AAErH;;CAEC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,IAAI;gCACF,OAAOpC,OAAOmB,GAAG,IAAIsB;4BACvB,SAAU;gCACRb;4BACF;wBACF;oBACF;wBACE,OAAOvC,eAAeU,GAAG,CAACC,QAAQC,MAAMC;gBAC5C;YACF;QACF;IACF;AACF"}
|
||||
3
node_modules/next/dist/esm/server/web/spec-extension/cookies.js
generated
vendored
Normal file
3
node_modules/next/dist/esm/server/web/spec-extension/cookies.js
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
export { RequestCookies, ResponseCookies, stringifyCookie } from "next/dist/compiled/@edge-runtime/cookies";
|
||||
|
||||
//# sourceMappingURL=cookies.js.map
|
||||
1
node_modules/next/dist/esm/server/web/spec-extension/cookies.js.map
generated
vendored
Normal file
1
node_modules/next/dist/esm/server/web/spec-extension/cookies.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../src/server/web/spec-extension/cookies.ts"],"names":["RequestCookies","ResponseCookies","stringifyCookie"],"mappings":"AAAA,SACEA,cAAc,EACdC,eAAe,EACfC,eAAe,QACV,2CAA0C"}
|
||||
48
node_modules/next/dist/esm/server/web/spec-extension/fetch-event.js
generated
vendored
Normal file
48
node_modules/next/dist/esm/server/web/spec-extension/fetch-event.js
generated
vendored
Normal file
@ -0,0 +1,48 @@
|
||||
import { PageSignatureError } from "../error";
|
||||
const responseSymbol = Symbol("response");
|
||||
const passThroughSymbol = Symbol("passThrough");
|
||||
export const waitUntilSymbol = Symbol("waitUntil");
|
||||
class FetchEvent {
|
||||
// eslint-disable-next-line @typescript-eslint/no-useless-constructor
|
||||
constructor(_request){
|
||||
this[waitUntilSymbol] = [];
|
||||
this[passThroughSymbol] = false;
|
||||
}
|
||||
respondWith(response) {
|
||||
if (!this[responseSymbol]) {
|
||||
this[responseSymbol] = Promise.resolve(response);
|
||||
}
|
||||
}
|
||||
passThroughOnException() {
|
||||
this[passThroughSymbol] = true;
|
||||
}
|
||||
waitUntil(promise) {
|
||||
this[waitUntilSymbol].push(promise);
|
||||
}
|
||||
}
|
||||
export class NextFetchEvent extends FetchEvent {
|
||||
constructor(params){
|
||||
super(params.request);
|
||||
this.sourcePage = params.page;
|
||||
}
|
||||
/**
|
||||
* @deprecated The `request` is now the first parameter and the API is now async.
|
||||
*
|
||||
* Read more: https://nextjs.org/docs/messages/middleware-new-signature
|
||||
*/ get request() {
|
||||
throw new PageSignatureError({
|
||||
page: this.sourcePage
|
||||
});
|
||||
}
|
||||
/**
|
||||
* @deprecated Using `respondWith` is no longer needed.
|
||||
*
|
||||
* Read more: https://nextjs.org/docs/messages/middleware-new-signature
|
||||
*/ respondWith() {
|
||||
throw new PageSignatureError({
|
||||
page: this.sourcePage
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
//# sourceMappingURL=fetch-event.js.map
|
||||
1
node_modules/next/dist/esm/server/web/spec-extension/fetch-event.js.map
generated
vendored
Normal file
1
node_modules/next/dist/esm/server/web/spec-extension/fetch-event.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../src/server/web/spec-extension/fetch-event.ts"],"names":["PageSignatureError","responseSymbol","Symbol","passThroughSymbol","waitUntilSymbol","FetchEvent","constructor","_request","respondWith","response","Promise","resolve","passThroughOnException","waitUntil","promise","push","NextFetchEvent","params","request","sourcePage","page"],"mappings":"AAAA,SAASA,kBAAkB,QAAQ,WAAU;AAG7C,MAAMC,iBAAiBC,OAAO;AAC9B,MAAMC,oBAAoBD,OAAO;AACjC,OAAO,MAAME,kBAAkBF,OAAO,aAAY;AAElD,MAAMG;IAKJ,qEAAqE;IACrEC,YAAYC,QAAiB,CAAE;YALtB,CAACH,gBAAgB,GAAmB,EAAE;YAE/C,CAACD,kBAAkB,GAAG;IAGU;IAEhCK,YAAYC,QAAsC,EAAQ;QACxD,IAAI,CAAC,IAAI,CAACR,eAAe,EAAE;YACzB,IAAI,CAACA,eAAe,GAAGS,QAAQC,OAAO,CAACF;QACzC;IACF;IAEAG,yBAA+B;QAC7B,IAAI,CAACT,kBAAkB,GAAG;IAC5B;IAEAU,UAAUC,OAAqB,EAAQ;QACrC,IAAI,CAACV,gBAAgB,CAACW,IAAI,CAACD;IAC7B;AACF;AAEA,OAAO,MAAME,uBAAuBX;IAGlCC,YAAYW,MAA8C,CAAE;QAC1D,KAAK,CAACA,OAAOC,OAAO;QACpB,IAAI,CAACC,UAAU,GAAGF,OAAOG,IAAI;IAC/B;IAEA;;;;GAIC,GACD,IAAIF,UAAU;QACZ,MAAM,IAAIlB,mBAAmB;YAC3BoB,MAAM,IAAI,CAACD,UAAU;QACvB;IACF;IAEA;;;;GAIC,GACDX,cAAc;QACZ,MAAM,IAAIR,mBAAmB;YAC3BoB,MAAM,IAAI,CAACD,UAAU;QACvB;IACF;AACF"}
|
||||
8
node_modules/next/dist/esm/server/web/spec-extension/image-response.js
generated
vendored
Normal file
8
node_modules/next/dist/esm/server/web/spec-extension/image-response.js
generated
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
/**
|
||||
* @deprecated ImageResponse moved from "next/server" to "next/og" since Next.js 14, please import from "next/og" instead.
|
||||
* Migration with codemods: https://nextjs.org/docs/app/building-your-application/upgrading/codemods#next-og-import
|
||||
*/ export function ImageResponse() {
|
||||
throw new Error('ImageResponse moved from "next/server" to "next/og" since Next.js 14, please import from "next/og" instead');
|
||||
}
|
||||
|
||||
//# sourceMappingURL=image-response.js.map
|
||||
1
node_modules/next/dist/esm/server/web/spec-extension/image-response.js.map
generated
vendored
Normal file
1
node_modules/next/dist/esm/server/web/spec-extension/image-response.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../src/server/web/spec-extension/image-response.ts"],"names":["ImageResponse","Error"],"mappings":"AAAA;;;CAGC,GACD,OAAO,SAASA;IACd,MAAM,IAAIC,MACR;AAEJ"}
|
||||
82
node_modules/next/dist/esm/server/web/spec-extension/request.js
generated
vendored
Normal file
82
node_modules/next/dist/esm/server/web/spec-extension/request.js
generated
vendored
Normal file
@ -0,0 +1,82 @@
|
||||
import { NextURL } from "../next-url";
|
||||
import { toNodeOutgoingHttpHeaders, validateURL } from "../utils";
|
||||
import { RemovedUAError, RemovedPageError } from "../error";
|
||||
import { RequestCookies } from "./cookies";
|
||||
export const INTERNALS = Symbol("internal request");
|
||||
/**
|
||||
* This class extends the [Web `Request` API](https://developer.mozilla.org/docs/Web/API/Request) with additional convenience methods.
|
||||
*
|
||||
* Read more: [Next.js Docs: `NextRequest`](https://nextjs.org/docs/app/api-reference/functions/next-request)
|
||||
*/ export class NextRequest extends Request {
|
||||
constructor(input, init = {}){
|
||||
const url = typeof input !== "string" && "url" in input ? input.url : String(input);
|
||||
validateURL(url);
|
||||
if (input instanceof Request) super(input, init);
|
||||
else super(url, init);
|
||||
const nextUrl = new NextURL(url, {
|
||||
headers: toNodeOutgoingHttpHeaders(this.headers),
|
||||
nextConfig: init.nextConfig
|
||||
});
|
||||
this[INTERNALS] = {
|
||||
cookies: new RequestCookies(this.headers),
|
||||
geo: init.geo || {},
|
||||
ip: init.ip,
|
||||
nextUrl,
|
||||
url: process.env.__NEXT_NO_MIDDLEWARE_URL_NORMALIZE ? url : nextUrl.toString()
|
||||
};
|
||||
}
|
||||
[Symbol.for("edge-runtime.inspect.custom")]() {
|
||||
return {
|
||||
cookies: this.cookies,
|
||||
geo: this.geo,
|
||||
ip: this.ip,
|
||||
nextUrl: this.nextUrl,
|
||||
url: this.url,
|
||||
// rest of props come from Request
|
||||
bodyUsed: this.bodyUsed,
|
||||
cache: this.cache,
|
||||
credentials: this.credentials,
|
||||
destination: this.destination,
|
||||
headers: Object.fromEntries(this.headers),
|
||||
integrity: this.integrity,
|
||||
keepalive: this.keepalive,
|
||||
method: this.method,
|
||||
mode: this.mode,
|
||||
redirect: this.redirect,
|
||||
referrer: this.referrer,
|
||||
referrerPolicy: this.referrerPolicy,
|
||||
signal: this.signal
|
||||
};
|
||||
}
|
||||
get cookies() {
|
||||
return this[INTERNALS].cookies;
|
||||
}
|
||||
get geo() {
|
||||
return this[INTERNALS].geo;
|
||||
}
|
||||
get ip() {
|
||||
return this[INTERNALS].ip;
|
||||
}
|
||||
get nextUrl() {
|
||||
return this[INTERNALS].nextUrl;
|
||||
}
|
||||
/**
|
||||
* @deprecated
|
||||
* `page` has been deprecated in favour of `URLPattern`.
|
||||
* Read more: https://nextjs.org/docs/messages/middleware-request-page
|
||||
*/ get page() {
|
||||
throw new RemovedPageError();
|
||||
}
|
||||
/**
|
||||
* @deprecated
|
||||
* `ua` has been removed in favour of \`userAgent\` function.
|
||||
* Read more: https://nextjs.org/docs/messages/middleware-parse-user-agent
|
||||
*/ get ua() {
|
||||
throw new RemovedUAError();
|
||||
}
|
||||
get url() {
|
||||
return this[INTERNALS].url;
|
||||
}
|
||||
}
|
||||
|
||||
//# sourceMappingURL=request.js.map
|
||||
1
node_modules/next/dist/esm/server/web/spec-extension/request.js.map
generated
vendored
Normal file
1
node_modules/next/dist/esm/server/web/spec-extension/request.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../src/server/web/spec-extension/request.ts"],"names":["NextURL","toNodeOutgoingHttpHeaders","validateURL","RemovedUAError","RemovedPageError","RequestCookies","INTERNALS","Symbol","NextRequest","Request","constructor","input","init","url","String","nextUrl","headers","nextConfig","cookies","geo","ip","process","env","__NEXT_NO_MIDDLEWARE_URL_NORMALIZE","toString","for","bodyUsed","cache","credentials","destination","Object","fromEntries","integrity","keepalive","method","mode","redirect","referrer","referrerPolicy","signal","page","ua"],"mappings":"AAEA,SAASA,OAAO,QAAQ,cAAa;AACrC,SAASC,yBAAyB,EAAEC,WAAW,QAAQ,WAAU;AACjE,SAASC,cAAc,EAAEC,gBAAgB,QAAQ,WAAU;AAC3D,SAASC,cAAc,QAAQ,YAAW;AAE1C,OAAO,MAAMC,YAAYC,OAAO,oBAAmB;AAEnD;;;;CAIC,GACD,OAAO,MAAMC,oBAAoBC;IAS/BC,YAAYC,KAAwB,EAAEC,OAAoB,CAAC,CAAC,C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CAACZ,UAAU,CAACY,OAAO;IAChC;IAEA,IAAWC,MAAM;QACf,OAAO,IAAI,CAACb,UAAU,CAACa,GAAG;IAC5B;IAEA,IAAWC,KAAK;QACd,OAAO,IAAI,CAACd,UAAU,CAACc,EAAE;IAC3B;IAEA,IAAWL,UAAU;QACnB,OAAO,IAAI,CAACT,UAAU,CAACS,OAAO;IAChC;IAEA;;;;GAIC,GACD,IAAWyB,OAAO;QAChB,MAAM,IAAIpC;IACZ;IAEA;;;;GAIC,GACD,IAAWqC,KAAK;QACd,MAAM,IAAItC;IACZ;IAEA,IAAWU,MAAM;QACf,OAAO,IAAI,CAACP,UAAU,CAACO,GAAG;IAC5B;AACF"}
|
||||
122
node_modules/next/dist/esm/server/web/spec-extension/response.js
generated
vendored
Normal file
122
node_modules/next/dist/esm/server/web/spec-extension/response.js
generated
vendored
Normal file
@ -0,0 +1,122 @@
|
||||
import { stringifyCookie } from "../../web/spec-extension/cookies";
|
||||
import { NextURL } from "../next-url";
|
||||
import { toNodeOutgoingHttpHeaders, validateURL } from "../utils";
|
||||
import { ReflectAdapter } from "./adapters/reflect";
|
||||
import { ResponseCookies } from "./cookies";
|
||||
const INTERNALS = Symbol("internal response");
|
||||
const REDIRECTS = new Set([
|
||||
301,
|
||||
302,
|
||||
303,
|
||||
307,
|
||||
308
|
||||
]);
|
||||
function handleMiddlewareField(init, headers) {
|
||||
var _init_request;
|
||||
if (init == null ? void 0 : (_init_request = init.request) == null ? void 0 : _init_request.headers) {
|
||||
if (!(init.request.headers instanceof Headers)) {
|
||||
throw new Error("request.headers must be an instance of Headers");
|
||||
}
|
||||
const keys = [];
|
||||
for (const [key, value] of init.request.headers){
|
||||
headers.set("x-middleware-request-" + key, value);
|
||||
keys.push(key);
|
||||
}
|
||||
headers.set("x-middleware-override-headers", keys.join(","));
|
||||
}
|
||||
}
|
||||
/**
|
||||
* This class extends the [Web `Response` API](https://developer.mozilla.org/docs/Web/API/Response) with additional convenience methods.
|
||||
*
|
||||
* Read more: [Next.js Docs: `NextResponse`](https://nextjs.org/docs/app/api-reference/functions/next-response)
|
||||
*/ export class NextResponse extends Response {
|
||||
constructor(body, init = {}){
|
||||
super(body, init);
|
||||
const headers = this.headers;
|
||||
const cookies = new ResponseCookies(headers);
|
||||
const cookiesProxy = new Proxy(cookies, {
|
||||
get (target, prop, receiver) {
|
||||
switch(prop){
|
||||
case "delete":
|
||||
case "set":
|
||||
{
|
||||
return (...args)=>{
|
||||
const result = Reflect.apply(target[prop], target, args);
|
||||
const newHeaders = new Headers(headers);
|
||||
if (result instanceof ResponseCookies) {
|
||||
headers.set("x-middleware-set-cookie", result.getAll().map((cookie)=>stringifyCookie(cookie)).join(","));
|
||||
}
|
||||
handleMiddlewareField(init, newHeaders);
|
||||
return result;
|
||||
};
|
||||
}
|
||||
default:
|
||||
return ReflectAdapter.get(target, prop, receiver);
|
||||
}
|
||||
}
|
||||
});
|
||||
this[INTERNALS] = {
|
||||
cookies: cookiesProxy,
|
||||
url: init.url ? new NextURL(init.url, {
|
||||
headers: toNodeOutgoingHttpHeaders(headers),
|
||||
nextConfig: init.nextConfig
|
||||
}) : undefined
|
||||
};
|
||||
}
|
||||
[Symbol.for("edge-runtime.inspect.custom")]() {
|
||||
return {
|
||||
cookies: this.cookies,
|
||||
url: this.url,
|
||||
// rest of props come from Response
|
||||
body: this.body,
|
||||
bodyUsed: this.bodyUsed,
|
||||
headers: Object.fromEntries(this.headers),
|
||||
ok: this.ok,
|
||||
redirected: this.redirected,
|
||||
status: this.status,
|
||||
statusText: this.statusText,
|
||||
type: this.type
|
||||
};
|
||||
}
|
||||
get cookies() {
|
||||
return this[INTERNALS].cookies;
|
||||
}
|
||||
static json(body, init) {
|
||||
const response = Response.json(body, init);
|
||||
return new NextResponse(response.body, response);
|
||||
}
|
||||
static redirect(url, init) {
|
||||
const status = typeof init === "number" ? init : (init == null ? void 0 : init.status) ?? 307;
|
||||
if (!REDIRECTS.has(status)) {
|
||||
throw new RangeError('Failed to execute "redirect" on "response": Invalid status code');
|
||||
}
|
||||
const initObj = typeof init === "object" ? init : {};
|
||||
const headers = new Headers(initObj == null ? void 0 : initObj.headers);
|
||||
headers.set("Location", validateURL(url));
|
||||
return new NextResponse(null, {
|
||||
...initObj,
|
||||
headers,
|
||||
status
|
||||
});
|
||||
}
|
||||
static rewrite(destination, init) {
|
||||
const headers = new Headers(init == null ? void 0 : init.headers);
|
||||
headers.set("x-middleware-rewrite", validateURL(destination));
|
||||
handleMiddlewareField(init, headers);
|
||||
return new NextResponse(null, {
|
||||
...init,
|
||||
headers
|
||||
});
|
||||
}
|
||||
static next(init) {
|
||||
const headers = new Headers(init == null ? void 0 : init.headers);
|
||||
headers.set("x-middleware-next", "1");
|
||||
handleMiddlewareField(init, headers);
|
||||
return new NextResponse(null, {
|
||||
...init,
|
||||
headers
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
//# sourceMappingURL=response.js.map
|
||||
1
node_modules/next/dist/esm/server/web/spec-extension/response.js.map
generated
vendored
Normal file
1
node_modules/next/dist/esm/server/web/spec-extension/response.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../src/server/web/spec-extension/response.ts"],"names":["stringifyCookie","NextURL","toNodeOutgoingHttpHeaders","validateURL","ReflectAdapter","ResponseCookies","INTERNALS","Symbol","REDIRECTS","Set","handleMiddlewareField","init","headers","request","Headers","Error","keys","key","value","set","push","join","NextResponse","Response","constructor","body","cookies","cookiesProxy","Proxy","get","target","prop","receiver","args","result","Reflect","apply","newHeaders","getAll","map","cookie","url","nextConfig","undefined","for","bodyUsed","Object","fromEntries","ok","redirected","status","statusText","type","json","response","redirect","has","RangeError","initObj","rewrite","destination","next"],"mappings":"AAAA,SAASA,eAAe,QAAQ,mCAAkC;AAElE,SAASC,OAAO,QAAQ,cAAa;AACrC,SAASC,yBAAyB,EAAEC,WAAW,QAAQ,WAAU;AACjE,SAASC,cAAc,QAAQ,qBAAoB;AAEnD,SAASC,eAAe,QAAQ,Y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Q4C,2BAAAA,QAAS9C,OAAO;QAC5CA,QAAQO,GAAG,CAAC,YAAYhB,YAAYsC;QAEpC,OAAO,IAAInB,aAAa,MAAM;YAC5B,GAAGoC,OAAO;YACV9C;YACAsC;QACF;IACF;IAEA,OAAOS,QACLC,WAAmC,EACnCjD,IAA6B,EAC7B;QACA,MAAMC,UAAU,IAAIE,QAAQH,wBAAAA,KAAMC,OAAO;QACzCA,QAAQO,GAAG,CAAC,wBAAwBhB,YAAYyD;QAEhDlD,sBAAsBC,MAAMC;QAC5B,OAAO,IAAIU,aAAa,MAAM;YAAE,GAAGX,IAAI;YAAEC;QAAQ;IACnD;IAEA,OAAOiD,KAAKlD,IAA6B,EAAE;QACzC,MAAMC,UAAU,IAAIE,QAAQH,wBAAAA,KAAMC,OAAO;QACzCA,QAAQO,GAAG,CAAC,qBAAqB;QAEjCT,sBAAsBC,MAAMC;QAC5B,OAAO,IAAIU,aAAa,MAAM;YAAE,GAAGX,IAAI;YAAEC;QAAQ;IACnD;AACF"}
|
||||
51
node_modules/next/dist/esm/server/web/spec-extension/revalidate.js
generated
vendored
Normal file
51
node_modules/next/dist/esm/server/web/spec-extension/revalidate.js
generated
vendored
Normal file
@ -0,0 +1,51 @@
|
||||
import { trackDynamicDataAccessed } from "../../app-render/dynamic-rendering";
|
||||
import { isDynamicRoute } from "../../../shared/lib/router/utils";
|
||||
import { NEXT_CACHE_IMPLICIT_TAG_ID, NEXT_CACHE_SOFT_TAG_MAX_LENGTH } from "../../../lib/constants";
|
||||
import { getPathname } from "../../../lib/url";
|
||||
import { staticGenerationAsyncStorage } from "../../../client/components/static-generation-async-storage.external";
|
||||
/**
|
||||
* This function allows you to purge [cached data](https://nextjs.org/docs/app/building-your-application/caching) on-demand for a specific cache tag.
|
||||
*
|
||||
* Read more: [Next.js Docs: `revalidateTag`](https://nextjs.org/docs/app/api-reference/functions/revalidateTag)
|
||||
*/ export function revalidateTag(tag) {
|
||||
return revalidate(tag, `revalidateTag ${tag}`);
|
||||
}
|
||||
/**
|
||||
* This function allows you to purge [cached data](https://nextjs.org/docs/app/building-your-application/caching) on-demand for a specific path.
|
||||
*
|
||||
* Read more: [Next.js Docs: `revalidatePath`](https://nextjs.org/docs/app/api-reference/functions/revalidatePath)
|
||||
*/ export function revalidatePath(originalPath, type) {
|
||||
if (originalPath.length > NEXT_CACHE_SOFT_TAG_MAX_LENGTH) {
|
||||
console.warn(`Warning: revalidatePath received "${originalPath}" which exceeded max length of ${NEXT_CACHE_SOFT_TAG_MAX_LENGTH}. See more info here https://nextjs.org/docs/app/api-reference/functions/revalidatePath`);
|
||||
return;
|
||||
}
|
||||
let normalizedPath = `${NEXT_CACHE_IMPLICIT_TAG_ID}${originalPath}`;
|
||||
if (type) {
|
||||
normalizedPath += `${normalizedPath.endsWith("/") ? "" : "/"}${type}`;
|
||||
} else if (isDynamicRoute(originalPath)) {
|
||||
console.warn(`Warning: a dynamic page path "${originalPath}" was passed to "revalidatePath", but the "type" parameter is missing. This has no effect by default, see more info here https://nextjs.org/docs/app/api-reference/functions/revalidatePath`);
|
||||
}
|
||||
return revalidate(normalizedPath, `revalidatePath ${originalPath}`);
|
||||
}
|
||||
function revalidate(tag, expression) {
|
||||
const store = staticGenerationAsyncStorage.getStore();
|
||||
if (!store || !store.incrementalCache) {
|
||||
throw new Error(`Invariant: static generation store missing in ${expression}`);
|
||||
}
|
||||
if (store.isUnstableCacheCallback) {
|
||||
throw new Error(`Route ${getPathname(store.urlPathname)} used "${expression}" inside a function cached with "unstable_cache(...)" which is unsupported. To ensure revalidation is performed consistently it must always happen outside of renders and cached functions. See more info here: https://nextjs.org/docs/app/building-your-application/rendering/static-and-dynamic#dynamic-rendering`);
|
||||
}
|
||||
// a route that makes use of revalidation APIs should be considered dynamic
|
||||
// as otherwise it would be impossible to revalidate
|
||||
trackDynamicDataAccessed(store, expression);
|
||||
if (!store.revalidatedTags) {
|
||||
store.revalidatedTags = [];
|
||||
}
|
||||
if (!store.revalidatedTags.includes(tag)) {
|
||||
store.revalidatedTags.push(tag);
|
||||
}
|
||||
// TODO: only revalidate if the path matches
|
||||
store.pathWasRevalidated = true;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=revalidate.js.map
|
||||
1
node_modules/next/dist/esm/server/web/spec-extension/revalidate.js.map
generated
vendored
Normal file
1
node_modules/next/dist/esm/server/web/spec-extension/revalidate.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../src/server/web/spec-extension/revalidate.ts"],"names":["trackDynamicDataAccessed","isDynamicRoute","NEXT_CACHE_IMPLICIT_TAG_ID","NEXT_CACHE_SOFT_TAG_MAX_LENGTH","getPathname","staticGenerationAsyncStorage","revalidateTag","tag","revalidate","revalidatePath","originalPath","type","length","console","warn","normalizedPath","endsWith","expression","store","getStore","incrementalCache","Error","isUnstableCacheCallback","urlPathname","revalidatedTags","includes","push","pathWasRevalidated"],"mappings":"AAAA,SAASA,wBAAwB,QAAQ,qCAAoC;AAC7E,SAASC,cAAc,QAAQ,mCAAkC;AACjE,SACEC,0BAA0B,EAC1BC,8BAA8B,QACzB,yBAAwB;AAC/B,SAASC,WAAW,QAAQ,mBAAkB;AAC9C,SAASC,4BAA4B,QAAQ,sEAAqE;AAElH;;;;CAIC,GACD,OAAO,SAASC,cAAcC,GAAW;IACvC,OAAOC,WAAWD,KAAK,CAAC,cAAc,EAAEA,IAAI,CAAC;AAC/C;AAEA;;;;CAIC,GACD,OAAO,SAASE,eAAeC,YAAoB,EAAEC,IAAwB;IAC3E,IAAID,aAAaE,MAAM,GAAGT,gCAAgC;QACxDU,QAAQC,IAAI,CACV,CAAC,kCAAkC,EAAEJ,aAAa,+BAA+B,EAAEP,+BAA+B,uFAAuF,CAAC;QAE5M;IACF;IAEA,IAAIY,iBAAiB,CAAC,EAAEb,2BAA2B,EAAEQ,aAAa,CAAC;IAEnE,IAAIC,MAAM;QACRI,kBAAkB,CAAC,EAAEA,eAAeC,QAAQ,CAAC,OAAO,KAAK,IAAI,EAAEL,KAAK,CAAC;IACvE,OAAO,IAAIV,eAAeS,eAAe;QACvCG,QAAQC,IAAI,CACV,CAAC,8BAA8B,EAAEJ,aAAa,2LAA2L,CAAC;IAE9O;IACA,OAAOF,WAAWO,gBAAgB,CAAC,eAAe,EAAEL,aAAa,CAAC;AACpE;AAEA,SAASF,WAAWD,GAAW,EAAEU,UAAkB;IACjD,MAAMC,QAAQb,6BAA6Bc,QAAQ;IACnD,IAAI,CAACD,SAAS,CAACA,MAAME,gBAAgB,EAAE;QACrC,MAAM,IAAIC,MACR,CAAC,8CAA8C,EAAEJ,WAAW,CAAC;IAEjE;IAEA,IAAIC,MAAMI,uBAAuB,EAAE;QACjC,MAAM,IAAID,MACR,CAAC,MAAM,EAAEjB,YACPc,MAAMK,WAAW,EACjB,OAAO,EAAEN,WAAW,oTAAoT,CAAC;IAE/U;IAEA,2EAA2E;IAC3E,oDAAoD;IACpDjB,yBAAyBkB,OAAOD;IAEhC,IAAI,CAACC,MAAMM,eAAe,EAAE;QAC1BN,MAAMM,eAAe,GAAG,EAAE;IAC5B;IACA,IAAI,CAACN,MAAMM,eAAe,CAACC,QAAQ,CAAClB,MAAM;QACxCW,MAAMM,eAAe,CAACE,IAAI,CAACnB;IAC7B;IAEA,4CAA4C;IAC5CW,MAAMS,kBAAkB,GAAG;AAC7B"}
|
||||
217
node_modules/next/dist/esm/server/web/spec-extension/unstable-cache.js
generated
vendored
Normal file
217
node_modules/next/dist/esm/server/web/spec-extension/unstable-cache.js
generated
vendored
Normal file
@ -0,0 +1,217 @@
|
||||
import { CACHE_ONE_YEAR } from "../../../lib/constants";
|
||||
import { addImplicitTags, validateRevalidate, validateTags } from "../../lib/patch-fetch";
|
||||
import { staticGenerationAsyncStorage } from "../../../client/components/static-generation-async-storage.external";
|
||||
let noStoreFetchIdx = 0;
|
||||
async function cacheNewResult(result, incrementalCache, cacheKey, tags, revalidate, fetchIdx, fetchUrl) {
|
||||
await incrementalCache.set(cacheKey, {
|
||||
kind: "FETCH",
|
||||
data: {
|
||||
headers: {},
|
||||
// TODO: handle non-JSON values?
|
||||
body: JSON.stringify(result),
|
||||
status: 200,
|
||||
url: ""
|
||||
},
|
||||
revalidate: typeof revalidate !== "number" ? CACHE_ONE_YEAR : revalidate
|
||||
}, {
|
||||
revalidate,
|
||||
fetchCache: true,
|
||||
tags,
|
||||
fetchIdx,
|
||||
fetchUrl
|
||||
});
|
||||
return;
|
||||
}
|
||||
/**
|
||||
* This function allows you to cache the results of expensive operations, like database queries, and reuse them across multiple requests.
|
||||
*
|
||||
* Read more: [Next.js Docs: `unstable_cache`](https://nextjs.org/docs/app/api-reference/functions/unstable_cache)
|
||||
*/ export function unstable_cache(cb, keyParts, options = {}) {
|
||||
if (options.revalidate === 0) {
|
||||
throw new Error(`Invariant revalidate: 0 can not be passed to unstable_cache(), must be "false" or "> 0" ${cb.toString()}`);
|
||||
}
|
||||
// Validate the tags provided are valid
|
||||
const tags = options.tags ? validateTags(options.tags, `unstable_cache ${cb.toString()}`) : [];
|
||||
// Validate the revalidate options
|
||||
validateRevalidate(options.revalidate, `unstable_cache ${cb.name || cb.toString()}`);
|
||||
// Stash the fixed part of the key at construction time. The invocation key will combine
|
||||
// the fixed key with the arguments when actually called
|
||||
// @TODO if cb.toString() is long we should hash it
|
||||
// @TODO come up with a collision-free way to combine keyParts
|
||||
// @TODO consider validating the keyParts are all strings. TS can't provide runtime guarantees
|
||||
// and the error produced by accidentally using something that cannot be safely coerced is likely
|
||||
// hard to debug
|
||||
const fixedKey = `${cb.toString()}-${Array.isArray(keyParts) && keyParts.join(",")}`;
|
||||
const cachedCb = async (...args)=>{
|
||||
const store = staticGenerationAsyncStorage.getStore();
|
||||
// We must be able to find the incremental cache otherwise we throw
|
||||
const maybeIncrementalCache = (store == null ? void 0 : store.incrementalCache) || globalThis.__incrementalCache;
|
||||
if (!maybeIncrementalCache) {
|
||||
throw new Error(`Invariant: incrementalCache missing in unstable_cache ${cb.toString()}`);
|
||||
}
|
||||
const incrementalCache = maybeIncrementalCache;
|
||||
const { pathname, searchParams } = new URL((store == null ? void 0 : store.urlPathname) || "/", "http://n");
|
||||
const sortedSearchKeys = [
|
||||
...searchParams.keys()
|
||||
].sort((a, b)=>{
|
||||
return a.localeCompare(b);
|
||||
});
|
||||
const sortedSearch = sortedSearchKeys.map((key)=>`${key}=${searchParams.get(key)}`).join("&");
|
||||
// Construct the complete cache key for this function invocation
|
||||
// @TODO stringify is likely not safe here. We will coerce undefined to null which will make
|
||||
// the keyspace smaller than the execution space
|
||||
const invocationKey = `${fixedKey}-${JSON.stringify(args)}`;
|
||||
const cacheKey = await incrementalCache.fetchCacheKey(invocationKey);
|
||||
// $urlWithPath,$sortedQueryStringKeys,$hashOfEveryThingElse
|
||||
const fetchUrl = `unstable_cache ${pathname}${sortedSearch.length ? "?" : ""}${sortedSearch} ${cb.name ? ` ${cb.name}` : cacheKey}`;
|
||||
const fetchIdx = (store ? store.nextFetchId : noStoreFetchIdx) ?? 1;
|
||||
if (store) {
|
||||
store.nextFetchId = fetchIdx + 1;
|
||||
// We are in an App Router context. We try to return the cached entry if it exists and is valid
|
||||
// If the entry is fresh we return it. If the entry is stale we return it but revalidate the entry in
|
||||
// the background. If the entry is missing or invalid we generate a new entry and return it.
|
||||
// We update the store's revalidate property if the option.revalidate is a higher precedence
|
||||
if (typeof options.revalidate === "number") {
|
||||
if (typeof store.revalidate === "number" && store.revalidate < options.revalidate) {
|
||||
// The store is already revalidating on a shorter time interval, leave it alone
|
||||
} else {
|
||||
store.revalidate = options.revalidate;
|
||||
}
|
||||
} else if (options.revalidate === false && typeof store.revalidate === "undefined") {
|
||||
// The store has not defined revalidate type so we can use the false option
|
||||
store.revalidate = options.revalidate;
|
||||
}
|
||||
// We need to accumulate the tags for this invocation within the store
|
||||
if (!store.tags) {
|
||||
store.tags = tags.slice();
|
||||
} else {
|
||||
for (const tag of tags){
|
||||
// @TODO refactor tags to be a set to avoid this O(n) lookup
|
||||
if (!store.tags.includes(tag)) {
|
||||
store.tags.push(tag);
|
||||
}
|
||||
}
|
||||
}
|
||||
// @TODO check on this API. addImplicitTags mutates the store and returns the implicit tags. The naming
|
||||
// of this function is potentially a little confusing
|
||||
const implicitTags = addImplicitTags(store);
|
||||
if (// when we are nested inside of other unstable_cache's
|
||||
// we should bypass cache similar to fetches
|
||||
store.fetchCache !== "force-no-store" && !store.isOnDemandRevalidate && !incrementalCache.isOnDemandRevalidate && !store.isDraftMode) {
|
||||
// We attempt to get the current cache entry from the incremental cache.
|
||||
const cacheEntry = await incrementalCache.get(cacheKey, {
|
||||
kindHint: "fetch",
|
||||
revalidate: options.revalidate,
|
||||
tags,
|
||||
softTags: implicitTags,
|
||||
fetchIdx,
|
||||
fetchUrl
|
||||
});
|
||||
if (cacheEntry && cacheEntry.value) {
|
||||
// The entry exists and has a value
|
||||
if (cacheEntry.value.kind !== "FETCH") {
|
||||
// The entry is invalid and we need a special warning
|
||||
// @TODO why do we warn this way? Should this just be an error? How are these errors surfaced
|
||||
// so bugs can be reported
|
||||
// @TODO the invocation key can have sensitive data in it. we should not log this entire object
|
||||
console.error(`Invariant invalid cacheEntry returned for ${invocationKey}`);
|
||||
// will fall through to generating a new cache entry below
|
||||
} else {
|
||||
// We have a valid cache entry so we will be returning it. We also check to see if we need
|
||||
// to background revalidate it by checking if it is stale.
|
||||
const cachedResponse = cacheEntry.value.data.body !== undefined ? JSON.parse(cacheEntry.value.data.body) : undefined;
|
||||
if (cacheEntry.isStale) {
|
||||
// In App Router we return the stale result and revalidate in the background
|
||||
if (!store.pendingRevalidates) {
|
||||
store.pendingRevalidates = {};
|
||||
}
|
||||
// We run the cache function asynchronously and save the result when it completes
|
||||
store.pendingRevalidates[invocationKey] = staticGenerationAsyncStorage.run({
|
||||
...store,
|
||||
// force any nested fetches to bypass cache so they revalidate
|
||||
// when the unstable_cache call is revalidated
|
||||
fetchCache: "force-no-store",
|
||||
isUnstableCacheCallback: true
|
||||
}, cb, ...args).then((result)=>{
|
||||
return cacheNewResult(result, incrementalCache, cacheKey, tags, options.revalidate, fetchIdx, fetchUrl);
|
||||
})// @TODO This error handling seems wrong. We swallow the error?
|
||||
.catch((err)=>console.error(`revalidating cache with key: ${invocationKey}`, err));
|
||||
}
|
||||
// We had a valid cache entry so we return it here
|
||||
return cachedResponse;
|
||||
}
|
||||
}
|
||||
}
|
||||
// If we got this far then we had an invalid cache entry and need to generate a new one
|
||||
const result = await staticGenerationAsyncStorage.run({
|
||||
...store,
|
||||
// force any nested fetches to bypass cache so they revalidate
|
||||
// when the unstable_cache call is revalidated
|
||||
fetchCache: "force-no-store",
|
||||
isUnstableCacheCallback: true
|
||||
}, cb, ...args);
|
||||
if (!store.isDraftMode) {
|
||||
cacheNewResult(result, incrementalCache, cacheKey, tags, options.revalidate, fetchIdx, fetchUrl);
|
||||
}
|
||||
return result;
|
||||
} else {
|
||||
noStoreFetchIdx += 1;
|
||||
// We are in Pages Router or were called outside of a render. We don't have a store
|
||||
// so we just call the callback directly when it needs to run.
|
||||
// If the entry is fresh we return it. If the entry is stale we return it but revalidate the entry in
|
||||
// the background. If the entry is missing or invalid we generate a new entry and return it.
|
||||
if (!incrementalCache.isOnDemandRevalidate) {
|
||||
// We aren't doing an on demand revalidation so we check use the cache if valid
|
||||
// @TODO check on this API. addImplicitTags mutates the store and returns the implicit tags. The naming
|
||||
// of this function is potentially a little confusing
|
||||
const implicitTags = store && addImplicitTags(store);
|
||||
const cacheEntry = await incrementalCache.get(cacheKey, {
|
||||
kindHint: "fetch",
|
||||
revalidate: options.revalidate,
|
||||
tags,
|
||||
fetchIdx,
|
||||
fetchUrl,
|
||||
softTags: implicitTags
|
||||
});
|
||||
if (cacheEntry && cacheEntry.value) {
|
||||
// The entry exists and has a value
|
||||
if (cacheEntry.value.kind !== "FETCH") {
|
||||
// The entry is invalid and we need a special warning
|
||||
// @TODO why do we warn this way? Should this just be an error? How are these errors surfaced
|
||||
// so bugs can be reported
|
||||
console.error(`Invariant invalid cacheEntry returned for ${invocationKey}`);
|
||||
// will fall through to generating a new cache entry below
|
||||
} else if (!cacheEntry.isStale) {
|
||||
// We have a valid cache entry and it is fresh so we return it
|
||||
return cacheEntry.value.data.body !== undefined ? JSON.parse(cacheEntry.value.data.body) : undefined;
|
||||
}
|
||||
}
|
||||
}
|
||||
// If we got this far then we had an invalid cache entry and need to generate a new one
|
||||
// @TODO this storage wrapper is included here because it existed prior to the latest refactor
|
||||
// however it is incorrect logic because it causes any internal cache calls to follow the App Router
|
||||
// path rather than Pages router path. This may mean there is existing buggy behavior however no specific
|
||||
// issues are known at this time. The whole static generation storage pathways should be reworked
|
||||
// to allow tracking which "mode" we are in without the presence of a store or not. For now I have
|
||||
// maintained the existing behavior to limit the impact of the current refactor
|
||||
const result = await staticGenerationAsyncStorage.run(// We are making a fake store that is useful for scoping fetchCache: 'force-no-store' and isUnstableCacheCallback: true
|
||||
// The fact that we need to construct this kind of fake store indicates the code is not factored correctly
|
||||
// @TODO refactor to not require this fake store object
|
||||
{
|
||||
// force any nested fetches to bypass cache so they revalidate
|
||||
// when the unstable_cache call is revalidated
|
||||
fetchCache: "force-no-store",
|
||||
isUnstableCacheCallback: true,
|
||||
urlPathname: "/",
|
||||
isStaticGeneration: false,
|
||||
prerenderState: null
|
||||
}, cb, ...args);
|
||||
cacheNewResult(result, incrementalCache, cacheKey, tags, options.revalidate, fetchIdx, fetchUrl);
|
||||
return result;
|
||||
}
|
||||
};
|
||||
// TODO: once AsyncLocalStorage.run() returns the correct types this override will no longer be necessary
|
||||
return cachedCb;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=unstable-cache.js.map
|
||||
1
node_modules/next/dist/esm/server/web/spec-extension/unstable-cache.js.map
generated
vendored
Normal file
1
node_modules/next/dist/esm/server/web/spec-extension/unstable-cache.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
33
node_modules/next/dist/esm/server/web/spec-extension/unstable-no-store.js
generated
vendored
Normal file
33
node_modules/next/dist/esm/server/web/spec-extension/unstable-no-store.js
generated
vendored
Normal file
@ -0,0 +1,33 @@
|
||||
import { staticGenerationAsyncStorage } from "../../../client/components/static-generation-async-storage.external";
|
||||
import { markCurrentScopeAsDynamic } from "../../app-render/dynamic-rendering";
|
||||
/**
|
||||
* This function can be used to declaratively opt out of static rendering and indicate a particular component should not be cached.
|
||||
*
|
||||
* It marks the current scope as dynamic.
|
||||
*
|
||||
* - In [non-PPR](https://nextjs.org/docs/app/api-reference/next-config-js/partial-prerendering) cases this will make a static render
|
||||
* halt and mark the page as dynamic.
|
||||
* - In PPR cases this will postpone the render at this location.
|
||||
*
|
||||
* If we are inside a cache scope then this function does nothing.
|
||||
*
|
||||
* @note It expects to be called within App Router and will error otherwise.
|
||||
*
|
||||
* Read more: [Next.js Docs: `unstable_noStore`](https://nextjs.org/docs/app/api-reference/functions/unstable_noStore)
|
||||
*/ export function unstable_noStore() {
|
||||
const callingExpression = "unstable_noStore()";
|
||||
const store = staticGenerationAsyncStorage.getStore();
|
||||
if (!store) {
|
||||
// This generally implies we are being called in Pages router. We should probably not support
|
||||
// unstable_noStore in contexts outside of `react-server` condition but since we historically
|
||||
// have not errored here previously, we maintain that behavior for now.
|
||||
return;
|
||||
} else if (store.forceStatic) {
|
||||
return;
|
||||
} else {
|
||||
store.isUnstableNoStore = true;
|
||||
markCurrentScopeAsDynamic(store, callingExpression);
|
||||
}
|
||||
}
|
||||
|
||||
//# sourceMappingURL=unstable-no-store.js.map
|
||||
1
node_modules/next/dist/esm/server/web/spec-extension/unstable-no-store.js.map
generated
vendored
Normal file
1
node_modules/next/dist/esm/server/web/spec-extension/unstable-no-store.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../src/server/web/spec-extension/unstable-no-store.ts"],"names":["staticGenerationAsyncStorage","markCurrentScopeAsDynamic","unstable_noStore","callingExpression","store","getStore","forceStatic","isUnstableNoStore"],"mappings":"AAAA,SAASA,4BAA4B,QAAQ,sEAAqE;AAClH,SAASC,yBAAyB,QAAQ,qCAAoC;AAE9E;;;;;;;;;;;;;;CAcC,GACD,OAAO,SAASC;IACd,MAAMC,oBAAoB;IAC1B,MAAMC,QAAQJ,6BAA6BK,QAAQ;IACnD,IAAI,CAACD,OAAO;QACV,6FAA6F;QAC7F,6FAA6F;QAC7F,uEAAuE;QACvE;IACF,OAAO,IAAIA,MAAME,WAAW,EAAE;QAC5B;IACF,OAAO;QACLF,MAAMG,iBAAiB,GAAG;QAC1BN,0BAA0BG,OAAOD;IACnC;AACF"}
|
||||
5
node_modules/next/dist/esm/server/web/spec-extension/url-pattern.js
generated
vendored
Normal file
5
node_modules/next/dist/esm/server/web/spec-extension/url-pattern.js
generated
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
const GlobalURLPattern = // @ts-expect-error: URLPattern is not available in Node.js
|
||||
typeof URLPattern === "undefined" ? undefined : URLPattern;
|
||||
export { GlobalURLPattern as URLPattern };
|
||||
|
||||
//# sourceMappingURL=url-pattern.js.map
|
||||
1
node_modules/next/dist/esm/server/web/spec-extension/url-pattern.js.map
generated
vendored
Normal file
1
node_modules/next/dist/esm/server/web/spec-extension/url-pattern.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../src/server/web/spec-extension/url-pattern.ts"],"names":["GlobalURLPattern","URLPattern","undefined"],"mappings":"AAAA,MAAMA,mBACJ,2DAA2D;AAC3D,OAAOC,eAAe,cAAcC,YAAYD;AAElD,SAASD,oBAAoBC,UAAU,GAAE"}
|
||||
15
node_modules/next/dist/esm/server/web/spec-extension/user-agent.js
generated
vendored
Normal file
15
node_modules/next/dist/esm/server/web/spec-extension/user-agent.js
generated
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
import parseua from "next/dist/compiled/ua-parser-js";
|
||||
export function isBot(input) {
|
||||
return /Googlebot|Mediapartners-Google|AdsBot-Google|googleweblight|Storebot-Google|Google-PageRenderer|Google-InspectionTool|Bingbot|BingPreview|Slurp|DuckDuckBot|baiduspider|yandex|sogou|LinkedInBot|bitlybot|tumblr|vkShare|quora link preview|facebookexternalhit|facebookcatalog|Twitterbot|applebot|redditbot|Slackbot|Discordbot|WhatsApp|SkypeUriPreview|ia_archiver/i.test(input);
|
||||
}
|
||||
export function userAgentFromString(input) {
|
||||
return {
|
||||
...parseua(input),
|
||||
isBot: input === undefined ? false : isBot(input)
|
||||
};
|
||||
}
|
||||
export function userAgent({ headers }) {
|
||||
return userAgentFromString(headers.get("user-agent") || undefined);
|
||||
}
|
||||
|
||||
//# sourceMappingURL=user-agent.js.map
|
||||
1
node_modules/next/dist/esm/server/web/spec-extension/user-agent.js.map
generated
vendored
Normal file
1
node_modules/next/dist/esm/server/web/spec-extension/user-agent.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../src/server/web/spec-extension/user-agent.ts"],"names":["parseua","isBot","input","test","userAgentFromString","undefined","userAgent","headers","get"],"mappings":"AAAA,OAAOA,aAAa,kCAAiC;AA2BrD,OAAO,SAASC,MAAMC,KAAa;IACjC,OAAO,0WAA0WC,IAAI,CACnXD;AAEJ;AAEA,OAAO,SAASE,oBAAoBF,KAAyB;IAC3D,OAAO;QACL,GAAGF,QAAQE,MAAM;QACjBD,OAAOC,UAAUG,YAAY,QAAQJ,MAAMC;IAC7C;AACF;AAEA,OAAO,SAASI,UAAU,EAAEC,OAAO,EAAwB;IACzD,OAAOH,oBAAoBG,QAAQC,GAAG,CAAC,iBAAiBH;AAC1D"}
|
||||
10
node_modules/next/dist/esm/server/web/types.js
generated
vendored
Normal file
10
node_modules/next/dist/esm/server/web/types.js
generated
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
/**
|
||||
* Middleware allows you to run code before a request is completed.
|
||||
* Then, based on the incoming request, you can modify the response
|
||||
* by rewriting, redirecting, modifying the request or response headers,
|
||||
* or responding directly.
|
||||
*
|
||||
* Read more: [Next.js Docs: Middleware](https://nextjs.org/docs/app/building-your-application/routing/middleware)
|
||||
*/ export { };
|
||||
|
||||
//# sourceMappingURL=types.js.map
|
||||
1
node_modules/next/dist/esm/server/web/types.js.map
generated
vendored
Normal file
1
node_modules/next/dist/esm/server/web/types.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../src/server/web/types.ts"],"names":[],"mappings":"AAoDA;;;;;;;CAOC,GACD,WAGyD"}
|
||||
125
node_modules/next/dist/esm/server/web/utils.js
generated
vendored
Normal file
125
node_modules/next/dist/esm/server/web/utils.js
generated
vendored
Normal file
@ -0,0 +1,125 @@
|
||||
/**
|
||||
* Converts a Node.js IncomingHttpHeaders object to a Headers object. Any
|
||||
* headers with multiple values will be joined with a comma and space. Any
|
||||
* headers that have an undefined value will be ignored and others will be
|
||||
* coerced to strings.
|
||||
*
|
||||
* @param nodeHeaders the headers object to convert
|
||||
* @returns the converted headers object
|
||||
*/ export function fromNodeOutgoingHttpHeaders(nodeHeaders) {
|
||||
const headers = new Headers();
|
||||
for (let [key, value] of Object.entries(nodeHeaders)){
|
||||
const values = Array.isArray(value) ? value : [
|
||||
value
|
||||
];
|
||||
for (let v of values){
|
||||
if (typeof v === "undefined") continue;
|
||||
if (typeof v === "number") {
|
||||
v = v.toString();
|
||||
}
|
||||
headers.append(key, v);
|
||||
}
|
||||
}
|
||||
return headers;
|
||||
}
|
||||
/*
|
||||
Set-Cookie header field-values are sometimes comma joined in one string. This splits them without choking on commas
|
||||
that are within a single set-cookie field-value, such as in the Expires portion.
|
||||
This is uncommon, but explicitly allowed - see https://tools.ietf.org/html/rfc2616#section-4.2
|
||||
Node.js does this for every header *except* set-cookie - see https://github.com/nodejs/node/blob/d5e363b77ebaf1caf67cd7528224b651c86815c1/lib/_http_incoming.js#L128
|
||||
React Native's fetch does this for *every* header, including set-cookie.
|
||||
|
||||
Based on: https://github.com/google/j2objc/commit/16820fdbc8f76ca0c33472810ce0cb03d20efe25
|
||||
Credits to: https://github.com/tomball for original and https://github.com/chrusart for JavaScript implementation
|
||||
*/ export function splitCookiesString(cookiesString) {
|
||||
var cookiesStrings = [];
|
||||
var pos = 0;
|
||||
var start;
|
||||
var ch;
|
||||
var lastComma;
|
||||
var nextStart;
|
||||
var cookiesSeparatorFound;
|
||||
function skipWhitespace() {
|
||||
while(pos < cookiesString.length && /\s/.test(cookiesString.charAt(pos))){
|
||||
pos += 1;
|
||||
}
|
||||
return pos < cookiesString.length;
|
||||
}
|
||||
function notSpecialChar() {
|
||||
ch = cookiesString.charAt(pos);
|
||||
return ch !== "=" && ch !== ";" && ch !== ",";
|
||||
}
|
||||
while(pos < cookiesString.length){
|
||||
start = pos;
|
||||
cookiesSeparatorFound = false;
|
||||
while(skipWhitespace()){
|
||||
ch = cookiesString.charAt(pos);
|
||||
if (ch === ",") {
|
||||
// ',' is a cookie separator if we have later first '=', not ';' or ','
|
||||
lastComma = pos;
|
||||
pos += 1;
|
||||
skipWhitespace();
|
||||
nextStart = pos;
|
||||
while(pos < cookiesString.length && notSpecialChar()){
|
||||
pos += 1;
|
||||
}
|
||||
// currently special character
|
||||
if (pos < cookiesString.length && cookiesString.charAt(pos) === "=") {
|
||||
// we found cookies separator
|
||||
cookiesSeparatorFound = true;
|
||||
// pos is inside the next cookie, so back up and return it.
|
||||
pos = nextStart;
|
||||
cookiesStrings.push(cookiesString.substring(start, lastComma));
|
||||
start = pos;
|
||||
} else {
|
||||
// in param ',' or param separator ';',
|
||||
// we continue from that comma
|
||||
pos = lastComma + 1;
|
||||
}
|
||||
} else {
|
||||
pos += 1;
|
||||
}
|
||||
}
|
||||
if (!cookiesSeparatorFound || pos >= cookiesString.length) {
|
||||
cookiesStrings.push(cookiesString.substring(start, cookiesString.length));
|
||||
}
|
||||
}
|
||||
return cookiesStrings;
|
||||
}
|
||||
/**
|
||||
* Converts a Headers object to a Node.js OutgoingHttpHeaders object. This is
|
||||
* required to support the set-cookie header, which may have multiple values.
|
||||
*
|
||||
* @param headers the headers object to convert
|
||||
* @returns the converted headers object
|
||||
*/ export function toNodeOutgoingHttpHeaders(headers) {
|
||||
const nodeHeaders = {};
|
||||
const cookies = [];
|
||||
if (headers) {
|
||||
for (const [key, value] of headers.entries()){
|
||||
if (key.toLowerCase() === "set-cookie") {
|
||||
// We may have gotten a comma joined string of cookies, or multiple
|
||||
// set-cookie headers. We need to merge them into one header array
|
||||
// to represent all the cookies.
|
||||
cookies.push(...splitCookiesString(value));
|
||||
nodeHeaders[key] = cookies.length === 1 ? cookies[0] : cookies;
|
||||
} else {
|
||||
nodeHeaders[key] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
return nodeHeaders;
|
||||
}
|
||||
/**
|
||||
* Validate the correctness of a user-provided URL.
|
||||
*/ export function validateURL(url) {
|
||||
try {
|
||||
return String(new URL(String(url)));
|
||||
} catch (error) {
|
||||
throw new Error(`URL is malformed "${String(url)}". Please use only absolute URLs - https://nextjs.org/docs/messages/middleware-relative-urls`, {
|
||||
cause: error
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
//# sourceMappingURL=utils.js.map
|
||||
1
node_modules/next/dist/esm/server/web/utils.js.map
generated
vendored
Normal file
1
node_modules/next/dist/esm/server/web/utils.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../src/server/web/utils.ts"],"names":["fromNodeOutgoingHttpHeaders","nodeHeaders","headers","Headers","key","value","Object","entries","values","Array","isArray","v","toString","append","splitCookiesString","cookiesString","cookiesStrings","pos","start","ch","lastComma","nextStart","cookiesSeparatorFound","skipWhitespace","length","test","charAt","notSpecialChar","push","substring","toNodeOutgoingHttpHeaders","cookies","toLowerCase","validateURL","url","String","URL","error","Error","cause"],"mappings":"AAEA;;;;;;;;CAQC,GACD,OAAO,SAASA,4BACdC,WAAgC;IAEhC,MAAMC,UAAU,IAAIC;IACpB,KAAK,IAAI,CAACC,KAAKC,MAAM,IAAIC,OAAOC,OAAO,CAACN,aAAc;QACpD,MAAMO,SAASC,MAAMC,OAAO,CAACL,SAASA,QAAQ;YAACA;SAAM;QACrD,KAAK,IAAIM,KAAKH,OAAQ;YACpB,I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