Initial boiler plate project
This commit is contained in:
44
node_modules/next/dist/server/web/spec-extension/adapters/headers.d.ts
generated
vendored
Normal file
44
node_modules/next/dist/server/web/spec-extension/adapters/headers.d.ts
generated
vendored
Normal file
@ -0,0 +1,44 @@
|
||||
/// <reference types="node" />
|
||||
import type { IncomingHttpHeaders } from 'http';
|
||||
export type ReadonlyHeaders = Headers & {
|
||||
/** @deprecated Method unavailable on `ReadonlyHeaders`. Read more: https://nextjs.org/docs/app/api-reference/functions/headers */
|
||||
append(...args: any[]): void;
|
||||
/** @deprecated Method unavailable on `ReadonlyHeaders`. Read more: https://nextjs.org/docs/app/api-reference/functions/headers */
|
||||
set(...args: any[]): void;
|
||||
/** @deprecated Method unavailable on `ReadonlyHeaders`. Read more: https://nextjs.org/docs/app/api-reference/functions/headers */
|
||||
delete(...args: any[]): void;
|
||||
};
|
||||
export declare class HeadersAdapter extends Headers {
|
||||
private readonly headers;
|
||||
constructor(headers: IncomingHttpHeaders);
|
||||
/**
|
||||
* Seals a Headers instance to prevent modification by throwing an error when
|
||||
* any mutating method is called.
|
||||
*/
|
||||
static seal(headers: Headers): ReadonlyHeaders;
|
||||
/**
|
||||
* 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)
|
||||
*/
|
||||
private merge;
|
||||
/**
|
||||
* 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: IncomingHttpHeaders | Headers): Headers;
|
||||
append(name: string, value: string): void;
|
||||
delete(name: string): void;
|
||||
get(name: string): string | null;
|
||||
has(name: string): boolean;
|
||||
set(name: string, value: string): void;
|
||||
forEach(callbackfn: (value: string, name: string, parent: Headers) => void, thisArg?: any): void;
|
||||
entries(): IterableIterator<[string, string]>;
|
||||
keys(): IterableIterator<string>;
|
||||
values(): IterableIterator<string>;
|
||||
[Symbol.iterator](): IterableIterator<[string, string]>;
|
||||
}
|
||||
192
node_modules/next/dist/server/web/spec-extension/adapters/headers.js
generated
vendored
Normal file
192
node_modules/next/dist/server/web/spec-extension/adapters/headers.js
generated
vendored
Normal file
@ -0,0 +1,192 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
0 && (module.exports = {
|
||||
HeadersAdapter: null,
|
||||
ReadonlyHeadersError: null
|
||||
});
|
||||
function _export(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: true,
|
||||
get: all[name]
|
||||
});
|
||||
}
|
||||
_export(exports, {
|
||||
HeadersAdapter: function() {
|
||||
return HeadersAdapter;
|
||||
},
|
||||
ReadonlyHeadersError: function() {
|
||||
return ReadonlyHeadersError;
|
||||
}
|
||||
});
|
||||
const _reflect = require("./reflect");
|
||||
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();
|
||||
}
|
||||
}
|
||||
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 _reflect.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 _reflect.ReflectAdapter.get(target, original, receiver);
|
||||
},
|
||||
set (target, prop, value, receiver) {
|
||||
if (typeof prop === "symbol") {
|
||||
return _reflect.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 _reflect.ReflectAdapter.set(target, original ?? prop, value, receiver);
|
||||
},
|
||||
has (target, prop) {
|
||||
if (typeof prop === "symbol") return _reflect.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 _reflect.ReflectAdapter.has(target, original);
|
||||
},
|
||||
deleteProperty (target, prop) {
|
||||
if (typeof prop === "symbol") return _reflect.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 _reflect.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 _reflect.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/server/web/spec-extension/adapters/headers.js.map
generated
vendored
Normal file
1
node_modules/next/dist/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":["HeadersAdapter","ReadonlyHeadersError","Error","constructor","callable","Headers","headers","Proxy","get","target","prop","receiver","ReflectAdapter","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":";;;;;;;;;;;;;;;IA2BaA,cAAc;eAAdA;;IApBAC,oBAAoB;eAApBA;;;yBALkB;AAKxB,MAAMA,6BAA6BC;IACxCC,aAAc;QACZ,KAAK,CACH;IAEJ;IAEA,OAAcC,WAAW;QACvB,MAAM,IAAIH;IACZ;AACF;AAUO,MAAMD,uBAAuBK;IAGlCF,YAAYG,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,OAAOE,uBAAc,CAACJ,GAAG,CAACC,QAAQC,MAAMC;gBAC1C;gBAEA,MAAME,aAAaH,KAAK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IACrB;AACF"}
|
||||
1
node_modules/next/dist/server/web/spec-extension/adapters/headers.test.d.ts
generated
vendored
Normal file
1
node_modules/next/dist/server/web/spec-extension/adapters/headers.test.d.ts
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
export {};
|
||||
32
node_modules/next/dist/server/web/spec-extension/adapters/next-request.d.ts
generated
vendored
Normal file
32
node_modules/next/dist/server/web/spec-extension/adapters/next-request.d.ts
generated
vendored
Normal file
@ -0,0 +1,32 @@
|
||||
/// <reference types="node" />
|
||||
import type { BaseNextRequest } from '../../../base-http';
|
||||
import type { NodeNextRequest } from '../../../base-http/node';
|
||||
import type { WebNextRequest } from '../../../base-http/web';
|
||||
import type { Writable } from 'node:stream';
|
||||
import { NextRequest } from '../request';
|
||||
export declare const ResponseAbortedName = "ResponseAborted";
|
||||
export declare class ResponseAborted extends Error {
|
||||
readonly name = "ResponseAborted";
|
||||
}
|
||||
/**
|
||||
* 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 declare function createAbortController(response: Writable): AbortController;
|
||||
/**
|
||||
* 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 declare function signalFromNodeResponse(response: Writable): AbortSignal;
|
||||
export declare class NextRequestAdapter {
|
||||
static fromBaseNextRequest(request: BaseNextRequest, signal: AbortSignal): NextRequest;
|
||||
static fromNodeNextRequest(request: NodeNextRequest, signal: AbortSignal): NextRequest;
|
||||
static fromWebNextRequest(request: WebNextRequest): NextRequest;
|
||||
}
|
||||
134
node_modules/next/dist/server/web/spec-extension/adapters/next-request.js
generated
vendored
Normal file
134
node_modules/next/dist/server/web/spec-extension/adapters/next-request.js
generated
vendored
Normal file
@ -0,0 +1,134 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
0 && (module.exports = {
|
||||
NextRequestAdapter: null,
|
||||
ResponseAborted: null,
|
||||
ResponseAbortedName: null,
|
||||
createAbortController: null,
|
||||
signalFromNodeResponse: null
|
||||
});
|
||||
function _export(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: true,
|
||||
get: all[name]
|
||||
});
|
||||
}
|
||||
_export(exports, {
|
||||
NextRequestAdapter: function() {
|
||||
return NextRequestAdapter;
|
||||
},
|
||||
ResponseAborted: function() {
|
||||
return ResponseAborted;
|
||||
},
|
||||
ResponseAbortedName: function() {
|
||||
return ResponseAbortedName;
|
||||
},
|
||||
createAbortController: function() {
|
||||
return createAbortController;
|
||||
},
|
||||
signalFromNodeResponse: function() {
|
||||
return signalFromNodeResponse;
|
||||
}
|
||||
});
|
||||
const _requestmeta = require("../../../request-meta");
|
||||
const _utils = require("../../utils");
|
||||
const _request = require("../request");
|
||||
const ResponseAbortedName = "ResponseAborted";
|
||||
class ResponseAborted extends Error {
|
||||
constructor(...args){
|
||||
super(...args);
|
||||
this.name = ResponseAbortedName;
|
||||
}
|
||||
}
|
||||
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;
|
||||
}
|
||||
function signalFromNodeResponse(response) {
|
||||
const { errored, destroyed } = response;
|
||||
if (errored || destroyed) {
|
||||
return AbortSignal.abort(errored ?? new ResponseAborted());
|
||||
}
|
||||
const { signal } = createAbortController(response);
|
||||
return signal;
|
||||
}
|
||||
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 = (0, _requestmeta.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 _request.NextRequest(url, {
|
||||
method: request.method,
|
||||
headers: (0, _utils.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 _request.NextRequest(request.url, {
|
||||
method: request.method,
|
||||
headers: (0, _utils.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/server/web/spec-extension/adapters/next-request.js.map
generated
vendored
Normal file
1
node_modules/next/dist/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":["NextRequestAdapter","ResponseAborted","ResponseAbortedName","createAbortController","signalFromNodeResponse","Error","name","response","controller","AbortController","once","writableFinished","abort","errored","destroyed","AbortSignal","signal","fromBaseNextRequest","request","fromWebNextRequest","fromNodeNextRequest","body","method","url","startsWith","URL","base","getRequestMeta","NextRequest","headers","fromNodeOutgoingHttpHeaders","duplex","aborted"],"mappings":";;;;;;;;;;;;;;;;;;IAsDaA,kBAAkB;eAAlBA;;IA5CAC,eAAe;eAAfA;;IADAC,mBAAmB;eAAnBA;;IAYGC,qBAAqB;eAArBA;;IAuBAC,sBAAsB;eAAtBA;;;6BAvCe;uBACa;yBAChB;AAErB,MAAMF,sBAAsB;AAC5B,MAAMD,wBAAwBI;;;aACnBC,OAAOJ;;AACzB;AASO,SAASC,sBAAsBI,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,IAAIX;IACvB;IAEA,OAAOO;AACT;AAUO,SAASJ,uBAAuBG,QAAkB;IACvD,MAAM,EAAEM,OAAO,EAAEC,SAAS,EAAE,GAAGP;IAC/B,IAAIM,WAAWC,WAAW;QACxB,OAAOC,YAAYH,KAAK,CAACC,WAAW,IAAIZ;IAC1C;IAEA,M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e;QACrE,6CAA6C;QAC7C,IAAIG,OAA8B;QAClC,IAAIH,QAAQI,MAAM,KAAK,SAASJ,QAAQI,MAAM,KAAK,QAAQ;YACzDD,OAAOH,QAAQG,IAAI;QACrB;QAEA,OAAO,IAAIO,oBAAW,CAACV,QAAQK,GAAG,EAAE;YAClCD,QAAQJ,QAAQI,MAAM;YACtBO,SAASC,IAAAA,kCAA2B,EAACZ,QAAQW,OAAO;YACpD,mEAAmE;YACnEE,QAAQ;YACRf,QAAQE,QAAQA,OAAO,CAACF,MAAM;YAC9B,MAAM;YACN,KAAK;YACL,aAAa;YAEb,gDAAgD;YAChD,+CAA+C;YAC/C,GAAIE,QAAQA,OAAO,CAACF,MAAM,CAACgB,OAAO,GAC9B,CAAC,IACD;gBACEX;YACF,CAAC;QACP;IACF;AACF"}
|
||||
6
node_modules/next/dist/server/web/spec-extension/adapters/reflect.d.ts
generated
vendored
Normal file
6
node_modules/next/dist/server/web/spec-extension/adapters/reflect.d.ts
generated
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
export declare class ReflectAdapter {
|
||||
static get<T extends object>(target: T, prop: string | symbol, receiver: unknown): any;
|
||||
static set<T extends object>(target: T, prop: string | symbol, value: any, receiver: any): boolean;
|
||||
static has<T extends object>(target: T, prop: string | symbol): boolean;
|
||||
static deleteProperty<T extends object>(target: T, prop: string | symbol): boolean;
|
||||
}
|
||||
30
node_modules/next/dist/server/web/spec-extension/adapters/reflect.js
generated
vendored
Normal file
30
node_modules/next/dist/server/web/spec-extension/adapters/reflect.js
generated
vendored
Normal file
@ -0,0 +1,30 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "ReflectAdapter", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return ReflectAdapter;
|
||||
}
|
||||
});
|
||||
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/server/web/spec-extension/adapters/reflect.js.map
generated
vendored
Normal file
1
node_modules/next/dist/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":";;;;+BAAaA;;;eAAAA;;;AAAN,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"}
|
||||
13
node_modules/next/dist/server/web/spec-extension/adapters/request-cookies.d.ts
generated
vendored
Normal file
13
node_modules/next/dist/server/web/spec-extension/adapters/request-cookies.d.ts
generated
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
import type { RequestCookies } from '../cookies';
|
||||
import { ResponseCookies } from '../cookies';
|
||||
export type ReadonlyRequestCookies = Omit<RequestCookies, 'set' | 'clear' | 'delete'> & Pick<ResponseCookies, 'set' | 'delete'>;
|
||||
export declare class RequestCookiesAdapter {
|
||||
static seal(cookies: RequestCookies): ReadonlyRequestCookies;
|
||||
}
|
||||
export declare function getModifiedCookieValues(cookies: ResponseCookies): ResponseCookie[];
|
||||
export declare function appendMutableCookies(headers: Headers, mutableCookies: ResponseCookies): boolean;
|
||||
type ResponseCookie = NonNullable<ReturnType<InstanceType<typeof ResponseCookies>['get']>>;
|
||||
export declare class MutableRequestCookiesAdapter {
|
||||
static wrap(cookies: RequestCookies, onUpdateCookies?: (cookies: string[]) => void): ResponseCookies;
|
||||
}
|
||||
export {};
|
||||
150
node_modules/next/dist/server/web/spec-extension/adapters/request-cookies.js
generated
vendored
Normal file
150
node_modules/next/dist/server/web/spec-extension/adapters/request-cookies.js
generated
vendored
Normal file
@ -0,0 +1,150 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
0 && (module.exports = {
|
||||
MutableRequestCookiesAdapter: null,
|
||||
ReadonlyRequestCookiesError: null,
|
||||
RequestCookiesAdapter: null,
|
||||
appendMutableCookies: null,
|
||||
getModifiedCookieValues: null
|
||||
});
|
||||
function _export(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: true,
|
||||
get: all[name]
|
||||
});
|
||||
}
|
||||
_export(exports, {
|
||||
MutableRequestCookiesAdapter: function() {
|
||||
return MutableRequestCookiesAdapter;
|
||||
},
|
||||
ReadonlyRequestCookiesError: function() {
|
||||
return ReadonlyRequestCookiesError;
|
||||
},
|
||||
RequestCookiesAdapter: function() {
|
||||
return RequestCookiesAdapter;
|
||||
},
|
||||
appendMutableCookies: function() {
|
||||
return appendMutableCookies;
|
||||
},
|
||||
getModifiedCookieValues: function() {
|
||||
return getModifiedCookieValues;
|
||||
}
|
||||
});
|
||||
const _cookies = require("../cookies");
|
||||
const _reflect = require("./reflect");
|
||||
const _staticgenerationasyncstorageexternal = require("../../../../client/components/static-generation-async-storage.external");
|
||||
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();
|
||||
}
|
||||
}
|
||||
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 _reflect.ReflectAdapter.get(target, prop, receiver);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
const SYMBOL_MODIFY_COOKIE_VALUES = Symbol.for("next.mutated.cookies");
|
||||
function getModifiedCookieValues(cookies) {
|
||||
const modified = cookies[SYMBOL_MODIFY_COOKIE_VALUES];
|
||||
if (!modified || !Array.isArray(modified) || modified.length === 0) {
|
||||
return [];
|
||||
}
|
||||
return modified;
|
||||
}
|
||||
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 _cookies.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;
|
||||
}
|
||||
class MutableRequestCookiesAdapter {
|
||||
static wrap(cookies, onUpdateCookies) {
|
||||
const responseCookies = new _cookies.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 = _staticgenerationasyncstorageexternal.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 _cookies.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 _reflect.ReflectAdapter.get(target, prop, receiver);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
//# sourceMappingURL=request-cookies.js.map
|
||||
1
node_modules/next/dist/server/web/spec-extension/adapters/request-cookies.js.map
generated
vendored
Normal file
1
node_modules/next/dist/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":["MutableRequestCookiesAdapter","ReadonlyRequestCookiesError","RequestCookiesAdapter","appendMutableCookies","getModifiedCookieValues","Error","constructor","callable","seal","cookies","Proxy","get","target","prop","receiver","ReflectAdapter","SYMBOL_MODIFY_COOKIE_VALUES","Symbol","for","modified","Array","isArray","length","headers","mutableCookies","modifiedCookieValues","resCookies","ResponseCookies","returnedCookies","getAll","cookie","set","wrap","onUpdateCookies","responseCookies","Headers","modifiedValues","modifiedCookies","Set","updateResponseCookies","staticGenerationAsyncStore","staticGenerationAsyncStorage","getStore","pathWasRevalidated","allCookies","filter","c","has","name","serializedCookies","tempCookies","push","toString","args","add","delete"],"mappings":";;;;;;;;;;;;;;;;;;IA8FaA,4BAA4B;eAA5BA;;IArFAC,2BAA2B;eAA3BA;;IAqBAC,qBAAqB;eAArBA;;IAgCGC,oBAAoB;eAApBA;;IAbAC,uBAAuB;eAAvBA;;;yBA/CgB;yBACD;sDACc;AAKtC,MAAMH,oCAAoCI;IAC/CC,aAAc;QACZ,KAAK,CACH;IAEJ;IAEA,OAAcC,WAAW;QACvB,MAAM,IAAIN;IACZ;AACF;AAWO,MAAMC;IACX,OAAcM,KAAKC,OAAuB,EAA0B;QAClE,OAAO,IAAIC,MAAMD,SAAgB;YAC/BE,KAAIC,MAAM,EAAEC,IAAI,EAAEC,QAAQ;gBACxB,OAAQD;oBACN,KAAK;oBACL,KAAK;oBACL,KAAK;wBACH,OAAOZ,4BAA4BM,QAAQ;oBAC7C;wBACE,OAAOQ,uBAAc,CAACJ,GAAG,CAACC,QAAQC,MAAMC;gBAC5C;YACF;QACF;IACF;AACF;AAEA,MAAME,8BAA8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tC,KAAK,MAAMnB,UAAUM,eAAgB;oBACnC,MAAMc,cAAc,IAAIvB,wBAAe,CAAC,IAAIQ;oBAC5Ce,YAAYnB,GAAG,CAACD;oBAChBmB,kBAAkBE,IAAI,CAACD,YAAYE,QAAQ;gBAC7C;gBAEAnB,gBAAgBgB;YAClB;QACF;QAEA,OAAO,IAAIvC,MAAMwB,iBAAiB;YAChCvB,KAAIC,MAAM,EAAEC,IAAI,EAAEC,QAAQ;gBACxB,OAAQD;oBACN,qDAAqD;oBACrD,KAAKG;wBACH,OAAOoB;oBAET,iEAAiE;oBACjE,yBAAyB;oBACzB,KAAK;wBACH,OAAO,SAAU,GAAGiB,IAAiC;4BACnDhB,gBAAgBiB,GAAG,CACjB,OAAOD,IAAI,CAAC,EAAE,KAAK,WAAWA,IAAI,CAAC,EAAE,GAAGA,IAAI,CAAC,EAAE,CAACL,IAAI;4BAEtD,IAAI;gCACFpC,OAAO2C,MAAM,IAAIF;4BACnB,SAAU;gCACRd;4BACF;wBACF;oBACF,KAAK;wBACH,OAAO,SACL,GAAGc,IAE0B;4BAE7BhB,gBAAgBiB,GAAG,CACjB,OAAOD,IAAI,CAAC,EAAE,KAAK,WAAWA,IAAI,CAAC,EAAE,GAAGA,IAAI,CAAC,EAAE,CAACL,IAAI;4BAEtD,IAAI;gCACF,OAAOpC,OAAOmB,GAAG,IAAIsB;4BACvB,SAAU;gCACRd;4BACF;wBACF;oBACF;wBACE,OAAOxB,uBAAc,CAACJ,GAAG,CAACC,QAAQC,MAAMC;gBAC5C;YACF;QACF;IACF;AACF"}
|
||||
1
node_modules/next/dist/server/web/spec-extension/adapters/request-cookies.test.d.ts
generated
vendored
Normal file
1
node_modules/next/dist/server/web/spec-extension/adapters/request-cookies.test.d.ts
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
export {};
|
||||
1
node_modules/next/dist/server/web/spec-extension/cookies.d.ts
generated
vendored
Normal file
1
node_modules/next/dist/server/web/spec-extension/cookies.d.ts
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
export { RequestCookies, ResponseCookies, stringifyCookie, } from 'next/dist/compiled/@edge-runtime/cookies';
|
||||
29
node_modules/next/dist/server/web/spec-extension/cookies.js
generated
vendored
Normal file
29
node_modules/next/dist/server/web/spec-extension/cookies.js
generated
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
0 && (module.exports = {
|
||||
RequestCookies: null,
|
||||
ResponseCookies: null,
|
||||
stringifyCookie: null
|
||||
});
|
||||
function _export(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: true,
|
||||
get: all[name]
|
||||
});
|
||||
}
|
||||
_export(exports, {
|
||||
RequestCookies: function() {
|
||||
return _cookies.RequestCookies;
|
||||
},
|
||||
ResponseCookies: function() {
|
||||
return _cookies.ResponseCookies;
|
||||
},
|
||||
stringifyCookie: function() {
|
||||
return _cookies.stringifyCookie;
|
||||
}
|
||||
});
|
||||
const _cookies = require("next/dist/compiled/@edge-runtime/cookies");
|
||||
|
||||
//# sourceMappingURL=cookies.js.map
|
||||
1
node_modules/next/dist/server/web/spec-extension/cookies.js.map
generated
vendored
Normal file
1
node_modules/next/dist/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":";;;;;;;;;;;;;;;;IACEA,cAAc;eAAdA,uBAAc;;IACdC,eAAe;eAAfA,wBAAe;;IACfC,eAAe;eAAfA,wBAAe;;;yBACV"}
|
||||
33
node_modules/next/dist/server/web/spec-extension/fetch-event.d.ts
generated
vendored
Normal file
33
node_modules/next/dist/server/web/spec-extension/fetch-event.d.ts
generated
vendored
Normal file
@ -0,0 +1,33 @@
|
||||
import type { NextRequest } from './request';
|
||||
declare const responseSymbol: unique symbol;
|
||||
declare const passThroughSymbol: unique symbol;
|
||||
export declare const waitUntilSymbol: unique symbol;
|
||||
declare class FetchEvent {
|
||||
readonly [waitUntilSymbol]: Promise<any>[];
|
||||
[responseSymbol]?: Promise<Response>;
|
||||
[passThroughSymbol]: boolean;
|
||||
constructor(_request: Request);
|
||||
respondWith(response: Response | Promise<Response>): void;
|
||||
passThroughOnException(): void;
|
||||
waitUntil(promise: Promise<any>): void;
|
||||
}
|
||||
export declare class NextFetchEvent extends FetchEvent {
|
||||
sourcePage: string;
|
||||
constructor(params: {
|
||||
request: NextRequest;
|
||||
page: string;
|
||||
});
|
||||
/**
|
||||
* @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(): void;
|
||||
/**
|
||||
* @deprecated Using `respondWith` is no longer needed.
|
||||
*
|
||||
* Read more: https://nextjs.org/docs/messages/middleware-new-signature
|
||||
*/
|
||||
respondWith(): void;
|
||||
}
|
||||
export {};
|
||||
70
node_modules/next/dist/server/web/spec-extension/fetch-event.js
generated
vendored
Normal file
70
node_modules/next/dist/server/web/spec-extension/fetch-event.js
generated
vendored
Normal file
@ -0,0 +1,70 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
0 && (module.exports = {
|
||||
NextFetchEvent: null,
|
||||
waitUntilSymbol: null
|
||||
});
|
||||
function _export(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: true,
|
||||
get: all[name]
|
||||
});
|
||||
}
|
||||
_export(exports, {
|
||||
NextFetchEvent: function() {
|
||||
return NextFetchEvent;
|
||||
},
|
||||
waitUntilSymbol: function() {
|
||||
return waitUntilSymbol;
|
||||
}
|
||||
});
|
||||
const _error = require("../error");
|
||||
const responseSymbol = Symbol("response");
|
||||
const passThroughSymbol = Symbol("passThrough");
|
||||
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);
|
||||
}
|
||||
}
|
||||
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 _error.PageSignatureError({
|
||||
page: this.sourcePage
|
||||
});
|
||||
}
|
||||
/**
|
||||
* @deprecated Using `respondWith` is no longer needed.
|
||||
*
|
||||
* Read more: https://nextjs.org/docs/messages/middleware-new-signature
|
||||
*/ respondWith() {
|
||||
throw new _error.PageSignatureError({
|
||||
page: this.sourcePage
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
//# sourceMappingURL=fetch-event.js.map
|
||||
1
node_modules/next/dist/server/web/spec-extension/fetch-event.js.map
generated
vendored
Normal file
1
node_modules/next/dist/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":["NextFetchEvent","waitUntilSymbol","responseSymbol","Symbol","passThroughSymbol","FetchEvent","constructor","_request","respondWith","response","Promise","resolve","passThroughOnException","waitUntil","promise","push","params","request","sourcePage","page","PageSignatureError"],"mappings":";;;;;;;;;;;;;;;IA8BaA,cAAc;eAAdA;;IAzBAC,eAAe;eAAfA;;;uBALsB;AAGnC,MAAMC,iBAAiBC,OAAO;AAC9B,MAAMC,oBAAoBD,OAAO;AAC1B,MAAMF,kBAAkBE,OAAO;AAEtC,MAAME;IAKJ,qEAAqE;IACrEC,YAAYC,QAAiB,CAAE;YALtB,CAACN,gBAAgB,GAAmB,EAAE;YAE/C,CAACG,kBAAkB,GAAG;IAGU;IAEhCI,YAAYC,QAAsC,EAAQ;QACxD,IAAI,CAAC,IAAI,CAACP,eAAe,EAAE;YACzB,IAAI,CAACA,eAAe,GAAGQ,QAAQC,OAAO,CAACF;QACzC;IACF;IAEAG,yBAA+B;QAC7B,IAAI,CAACR,kBAAkB,GAAG;IAC5B;IAEAS,UAAUC,OAAqB,EAAQ;QACrC,IAAI,CAACb,gBAAgB,CAACc,IAAI,CAACD;IAC7B;AACF;AAEO,MAAMd,uBAAuBK;IAGlCC,YAAYU,MAA8C,CAAE;QAC1D,KAAK,CAACA,OAAOC,OAAO;QACpB,IAAI,CAACC,UAAU,GAAGF,OAAOG,IAAI;IAC/B;IAEA;;;;GAIC,GACD,IAAIF,UAAU;QACZ,MAAM,IAAIG,yBAAkB,CAAC;YAC3BD,MAAM,IAAI,CAACD,UAAU;QACvB;IACF;IAEA;;;;GAIC,GACDV,cAAc;QACZ,MAAM,IAAIY,yBAAkB,CAAC;YAC3BD,MAAM,IAAI,CAACD,UAAU;QACvB;IACF;AACF"}
|
||||
5
node_modules/next/dist/server/web/spec-extension/image-response.d.ts
generated
vendored
Normal file
5
node_modules/next/dist/server/web/spec-extension/image-response.d.ts
generated
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
/**
|
||||
* @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 declare function ImageResponse(): never;
|
||||
18
node_modules/next/dist/server/web/spec-extension/image-response.js
generated
vendored
Normal file
18
node_modules/next/dist/server/web/spec-extension/image-response.js
generated
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
/**
|
||||
* @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
|
||||
*/ "use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "ImageResponse", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return ImageResponse;
|
||||
}
|
||||
});
|
||||
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/server/web/spec-extension/image-response.js.map
generated
vendored
Normal file
1
node_modules/next/dist/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;;;;+BACeA;;;eAAAA;;;AAAT,SAASA;IACd,MAAM,IAAIC,MACR;AAEJ"}
|
||||
57
node_modules/next/dist/server/web/spec-extension/request.d.ts
generated
vendored
Normal file
57
node_modules/next/dist/server/web/spec-extension/request.d.ts
generated
vendored
Normal file
@ -0,0 +1,57 @@
|
||||
import type { I18NConfig } from '../../config-shared';
|
||||
import type { RequestData } from '../types';
|
||||
import { NextURL } from '../next-url';
|
||||
import { RequestCookies } from './cookies';
|
||||
export declare const INTERNALS: unique symbol;
|
||||
/**
|
||||
* 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 declare class NextRequest extends Request {
|
||||
[INTERNALS]: {
|
||||
cookies: RequestCookies;
|
||||
geo: RequestData['geo'];
|
||||
ip?: string;
|
||||
url: string;
|
||||
nextUrl: NextURL;
|
||||
};
|
||||
constructor(input: URL | RequestInfo, init?: RequestInit);
|
||||
get cookies(): RequestCookies;
|
||||
get geo(): {
|
||||
city?: string | undefined;
|
||||
country?: string | undefined;
|
||||
region?: string | undefined;
|
||||
latitude?: string | undefined;
|
||||
longitude?: string | undefined;
|
||||
} | undefined;
|
||||
get ip(): string | undefined;
|
||||
get nextUrl(): NextURL;
|
||||
/**
|
||||
* @deprecated
|
||||
* `page` has been deprecated in favour of `URLPattern`.
|
||||
* Read more: https://nextjs.org/docs/messages/middleware-request-page
|
||||
*/
|
||||
get page(): void;
|
||||
/**
|
||||
* @deprecated
|
||||
* `ua` has been removed in favour of \`userAgent\` function.
|
||||
* Read more: https://nextjs.org/docs/messages/middleware-parse-user-agent
|
||||
*/
|
||||
get ua(): void;
|
||||
get url(): string;
|
||||
}
|
||||
export interface RequestInit extends globalThis.RequestInit {
|
||||
geo?: {
|
||||
city?: string;
|
||||
country?: string;
|
||||
region?: string;
|
||||
};
|
||||
ip?: string;
|
||||
nextConfig?: {
|
||||
basePath?: string;
|
||||
i18n?: I18NConfig | null;
|
||||
trailingSlash?: boolean;
|
||||
};
|
||||
signal?: AbortSignal;
|
||||
}
|
||||
100
node_modules/next/dist/server/web/spec-extension/request.js
generated
vendored
Normal file
100
node_modules/next/dist/server/web/spec-extension/request.js
generated
vendored
Normal file
@ -0,0 +1,100 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
0 && (module.exports = {
|
||||
INTERNALS: null,
|
||||
NextRequest: null
|
||||
});
|
||||
function _export(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: true,
|
||||
get: all[name]
|
||||
});
|
||||
}
|
||||
_export(exports, {
|
||||
INTERNALS: function() {
|
||||
return INTERNALS;
|
||||
},
|
||||
NextRequest: function() {
|
||||
return NextRequest;
|
||||
}
|
||||
});
|
||||
const _nexturl = require("../next-url");
|
||||
const _utils = require("../utils");
|
||||
const _error = require("../error");
|
||||
const _cookies = require("./cookies");
|
||||
const INTERNALS = Symbol("internal request");
|
||||
class NextRequest extends Request {
|
||||
constructor(input, init = {}){
|
||||
const url = typeof input !== "string" && "url" in input ? input.url : String(input);
|
||||
(0, _utils.validateURL)(url);
|
||||
if (input instanceof Request) super(input, init);
|
||||
else super(url, init);
|
||||
const nextUrl = new _nexturl.NextURL(url, {
|
||||
headers: (0, _utils.toNodeOutgoingHttpHeaders)(this.headers),
|
||||
nextConfig: init.nextConfig
|
||||
});
|
||||
this[INTERNALS] = {
|
||||
cookies: new _cookies.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 _error.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 _error.RemovedUAError();
|
||||
}
|
||||
get url() {
|
||||
return this[INTERNALS].url;
|
||||
}
|
||||
}
|
||||
|
||||
//# sourceMappingURL=request.js.map
|
||||
1
node_modules/next/dist/server/web/spec-extension/request.js.map
generated
vendored
Normal file
1
node_modules/next/dist/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":["INTERNALS","NextRequest","Symbol","Request","constructor","input","init","url","String","validateURL","nextUrl","NextURL","headers","toNodeOutgoingHttpHeaders","nextConfig","cookies","RequestCookies","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","RemovedPageError","ua","RemovedUAError"],"mappings":";;;;;;;;;;;;;;;IAOaA,SAAS;eAATA;;IAOAC,WAAW;eAAXA;;;yBAZW;uBAC+B;uBACN;yBAClB;AAExB,MAAMD,YAAYE,OAAO;AAOzB,MAAMD,oBAAoBE;IAS/BC,YAAYC,KAAwB,EAAEC,OAAoB,CAAC,CAAC,CAAE;QAC5D,MAAMC,MACJ,OAAOF,UAAU,YAAY,SAASA,QAAQA,MAAME,GAAG,GAAGC,OAAOH;QACnEI,IAAAA,kBAAW,EAACF;QACZ,IAAIF,iBAAiBF,SAAS,KAAK,CAACE,OAAOC;aACtC,KAAK,CAACC,KAAKD;QAChB,MAAMI,UAAU,IAAIC,gBAAO,CAACJ,KAAK;YAC/BK,SAASC,IAAAA,gCAAyB,EAAC,IAAI,CAACD,OAAO;YAC/CE,YAAYR,KAAKQ,UAAU;QAC7B;QACA,IAAI,CAACd,UAAU,GAAG;YAChBe,SAA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;GAIC,GACD,IAAWC,KAAK;QACd,MAAM,IAAIC,qBAAc;IAC1B;IAEA,IAAWlC,MAAM;QACf,OAAO,IAAI,CAACP,UAAU,CAACO,GAAG;IAC5B;AACF"}
|
||||
43
node_modules/next/dist/server/web/spec-extension/response.d.ts
generated
vendored
Normal file
43
node_modules/next/dist/server/web/spec-extension/response.d.ts
generated
vendored
Normal file
@ -0,0 +1,43 @@
|
||||
import type { I18NConfig } from '../../config-shared';
|
||||
import { NextURL } from '../next-url';
|
||||
import { ResponseCookies } from './cookies';
|
||||
declare const INTERNALS: unique symbol;
|
||||
/**
|
||||
* 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 declare class NextResponse<Body = unknown> extends Response {
|
||||
[INTERNALS]: {
|
||||
cookies: ResponseCookies;
|
||||
url?: NextURL;
|
||||
body?: Body;
|
||||
};
|
||||
constructor(body?: BodyInit | null, init?: ResponseInit);
|
||||
get cookies(): ResponseCookies;
|
||||
static json<JsonBody>(body: JsonBody, init?: ResponseInit): NextResponse<JsonBody>;
|
||||
static redirect(url: string | NextURL | URL, init?: number | ResponseInit): NextResponse<unknown>;
|
||||
static rewrite(destination: string | NextURL | URL, init?: MiddlewareResponseInit): NextResponse<unknown>;
|
||||
static next(init?: MiddlewareResponseInit): NextResponse<unknown>;
|
||||
}
|
||||
interface ResponseInit extends globalThis.ResponseInit {
|
||||
nextConfig?: {
|
||||
basePath?: string;
|
||||
i18n?: I18NConfig;
|
||||
trailingSlash?: boolean;
|
||||
};
|
||||
url?: string;
|
||||
}
|
||||
interface ModifiedRequest {
|
||||
/**
|
||||
* If this is set, the request headers will be overridden with this value.
|
||||
*/
|
||||
headers?: Headers;
|
||||
}
|
||||
interface MiddlewareResponseInit extends globalThis.ResponseInit {
|
||||
/**
|
||||
* These fields will override the request from clients.
|
||||
*/
|
||||
request?: ModifiedRequest;
|
||||
}
|
||||
export {};
|
||||
128
node_modules/next/dist/server/web/spec-extension/response.js
generated
vendored
Normal file
128
node_modules/next/dist/server/web/spec-extension/response.js
generated
vendored
Normal file
@ -0,0 +1,128 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "NextResponse", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return NextResponse;
|
||||
}
|
||||
});
|
||||
const _cookies = require("../../web/spec-extension/cookies");
|
||||
const _nexturl = require("../next-url");
|
||||
const _utils = require("../utils");
|
||||
const _reflect = require("./adapters/reflect");
|
||||
const _cookies1 = require("./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(","));
|
||||
}
|
||||
}
|
||||
class NextResponse extends Response {
|
||||
constructor(body, init = {}){
|
||||
super(body, init);
|
||||
const headers = this.headers;
|
||||
const cookies = new _cookies1.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 _cookies1.ResponseCookies) {
|
||||
headers.set("x-middleware-set-cookie", result.getAll().map((cookie)=>(0, _cookies.stringifyCookie)(cookie)).join(","));
|
||||
}
|
||||
handleMiddlewareField(init, newHeaders);
|
||||
return result;
|
||||
};
|
||||
}
|
||||
default:
|
||||
return _reflect.ReflectAdapter.get(target, prop, receiver);
|
||||
}
|
||||
}
|
||||
});
|
||||
this[INTERNALS] = {
|
||||
cookies: cookiesProxy,
|
||||
url: init.url ? new _nexturl.NextURL(init.url, {
|
||||
headers: (0, _utils.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", (0, _utils.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", (0, _utils.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/server/web/spec-extension/response.js.map
generated
vendored
Normal file
1
node_modules/next/dist/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":["NextResponse","INTERNALS","Symbol","REDIRECTS","Set","handleMiddlewareField","init","headers","request","Headers","Error","keys","key","value","set","push","join","Response","constructor","body","cookies","ResponseCookies","cookiesProxy","Proxy","get","target","prop","receiver","args","result","Reflect","apply","newHeaders","getAll","map","cookie","stringifyCookie","ReflectAdapter","url","NextURL","toNodeOutgoingHttpHeaders","nextConfig","undefined","for","bodyUsed","Object","fromEntries","ok","redirected","status","statusText","type","json","response","redirect","has","RangeError","initObj","validateURL","rewrite","destination","next"],"mappings":";;;;+BAmCaA;;;eAAAA;;;yBAnCmB;yBAER;uBAC+B;yBACxB;0BAEC;AAEhC,MAAMC,YAAYC,OAAO;AACzB,MAAMC,YAAY,IAAIC,IAAI;IAAC;IAAK;IAAK;IAAK;IAAK;CAAI;AAEnD,SAASC,sBACPC,IAAwC,EACxCC,OAAgB;QAEZD;IAAJ,IAAIA,yBAAAA,gBAAAA,KAAME,OAAO,qBAAbF,cAAeC,OAAO,EAAE;QAC1B,IAAI,CAAED,CAAAA,KAAKE,OAAO,CAACD,OAAO,YAAYE,OAAM,GAAI;YAC9C,MAAM,IAAIC,MAAM;QAClB;QAEA,MAAMC,OAAO,EAAE;QACf,KAAK,MAAM,CAACC,KAAKC,MAAM,IAAIP,KAAKE,OAAO,CAACD,OAAO,CAAE;YAC/CA,QAAQO,GAAG,CAAC,0BAA0BF,KAAKC;YAC3CF,K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AE;QACzC,MAAMC,UAAU,IAAIE,QAAQH,wBAAAA,KAAMC,OAAO;QACzCA,QAAQO,GAAG,CAAC,qBAAqB;QAEjCT,sBAAsBC,MAAMC;QAC5B,OAAO,IAAIP,aAAa,MAAM;YAAE,GAAGM,IAAI;YAAEC;QAAQ;IACnD;AACF"}
|
||||
12
node_modules/next/dist/server/web/spec-extension/revalidate.d.ts
generated
vendored
Normal file
12
node_modules/next/dist/server/web/spec-extension/revalidate.d.ts
generated
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
/**
|
||||
* 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 declare function revalidateTag(tag: string): void;
|
||||
/**
|
||||
* 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 declare function revalidatePath(originalPath: string, type?: 'layout' | 'page'): void;
|
||||
65
node_modules/next/dist/server/web/spec-extension/revalidate.js
generated
vendored
Normal file
65
node_modules/next/dist/server/web/spec-extension/revalidate.js
generated
vendored
Normal file
@ -0,0 +1,65 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
0 && (module.exports = {
|
||||
revalidatePath: null,
|
||||
revalidateTag: null
|
||||
});
|
||||
function _export(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: true,
|
||||
get: all[name]
|
||||
});
|
||||
}
|
||||
_export(exports, {
|
||||
revalidatePath: function() {
|
||||
return revalidatePath;
|
||||
},
|
||||
revalidateTag: function() {
|
||||
return revalidateTag;
|
||||
}
|
||||
});
|
||||
const _dynamicrendering = require("../../app-render/dynamic-rendering");
|
||||
const _utils = require("../../../shared/lib/router/utils");
|
||||
const _constants = require("../../../lib/constants");
|
||||
const _url = require("../../../lib/url");
|
||||
const _staticgenerationasyncstorageexternal = require("../../../client/components/static-generation-async-storage.external");
|
||||
function revalidateTag(tag) {
|
||||
return revalidate(tag, `revalidateTag ${tag}`);
|
||||
}
|
||||
function revalidatePath(originalPath, type) {
|
||||
if (originalPath.length > _constants.NEXT_CACHE_SOFT_TAG_MAX_LENGTH) {
|
||||
console.warn(`Warning: revalidatePath received "${originalPath}" which exceeded max length of ${_constants.NEXT_CACHE_SOFT_TAG_MAX_LENGTH}. See more info here https://nextjs.org/docs/app/api-reference/functions/revalidatePath`);
|
||||
return;
|
||||
}
|
||||
let normalizedPath = `${_constants.NEXT_CACHE_IMPLICIT_TAG_ID}${originalPath}`;
|
||||
if (type) {
|
||||
normalizedPath += `${normalizedPath.endsWith("/") ? "" : "/"}${type}`;
|
||||
} else if ((0, _utils.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 = _staticgenerationasyncstorageexternal.staticGenerationAsyncStorage.getStore();
|
||||
if (!store || !store.incrementalCache) {
|
||||
throw new Error(`Invariant: static generation store missing in ${expression}`);
|
||||
}
|
||||
if (store.isUnstableCacheCallback) {
|
||||
throw new Error(`Route ${(0, _url.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
|
||||
(0, _dynamicrendering.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/server/web/spec-extension/revalidate.js.map
generated
vendored
Normal file
1
node_modules/next/dist/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":["revalidatePath","revalidateTag","tag","revalidate","originalPath","type","length","NEXT_CACHE_SOFT_TAG_MAX_LENGTH","console","warn","normalizedPath","NEXT_CACHE_IMPLICIT_TAG_ID","endsWith","isDynamicRoute","expression","store","staticGenerationAsyncStorage","getStore","incrementalCache","Error","isUnstableCacheCallback","getPathname","urlPathname","trackDynamicDataAccessed","revalidatedTags","includes","push","pathWasRevalidated"],"mappings":";;;;;;;;;;;;;;;IAuBgBA,cAAc;eAAdA;;IATAC,aAAa;eAAbA;;;kCAdyB;uBACV;2BAIxB;qBACqB;sDACiB;AAOtC,SAASA,cAAcC,GAAW;IACvC,OAAOC,WAAWD,KAAK,CAAC,cAAc,EAAEA,IAAI,CAAC;AAC/C;AAOO,SAASF,eAAeI,YAAoB,EAAEC,IAAwB;IAC3E,IAAID,aAAaE,MAAM,GAAGC,yCAA8B,EAAE;QACxDC,QAAQC,IAAI,CACV,CAAC,kCAAkC,EAAEL,aAAa,+BAA+B,EAAEG,yCAA8B,CAAC,uFAAuF,CAAC;QAE5M;IACF;IAEA,IAAIG,iBAAiB,CAAC,EAAEC,qCAA0B,CAAC,EAAEP,aAAa,CAAC;IAEnE,IAAIC,MAAM;QACRK,kBAAkB,CAAC,EAAEA,eAAeE,QAAQ,CAAC,OAAO,KAAK,IAAI,EAAEP,KAAK,CAAC;IACvE,OAAO,IAAIQ,IAAAA,qBAAc,EAACT,eAAe;QACvCI,QAAQC,IAAI,CACV,CAAC,8BAA8B,EAAEL,aAAa,2LAA2L,CAAC;IAE9O;IACA,OAAOD,WAAWO,gBAAgB,CAAC,eAAe,EAAEN,aAAa,CAAC;AACpE;AAEA,SAASD,WAAWD,GAAW,EAAEY,UAAkB;IACjD,MAAMC,QAAQC,kEAA4B,CAACC,QAAQ;IACnD,IAAI,CAACF,SAAS,CAACA,MAAMG,gBAAgB,EAAE;QACrC,MAAM,IAAIC,MACR,CAAC,8CAA8C,EAAEL,WAAW,CAAC;IAEjE;IAEA,IAAIC,MAAMK,uBAAuB,EAAE;QACjC,MAAM,IAAID,MACR,CAAC,MAAM,EAAEE,IAAAA,gBAAW,EAClBN,MAAMO,WAAW,EACjB,OAAO,EAAER,WAAW,oTAAoT,CAAC;IAE/U;IAEA,2EAA2E;IAC3E,oDAAoD;IACpDS,IAAAA,0CAAwB,EAACR,OAAOD;IAEhC,IAAI,CAACC,MAAMS,eAAe,EAAE;QAC1BT,MAAMS,eAAe,GAAG,EAAE;IAC5B;IACA,IAAI,CAACT,MAAMS,eAAe,CAACC,QAAQ,CAACvB,MAAM;QACxCa,MAAMS,eAAe,CAACE,IAAI,CAACxB;IAC7B;IAEA,4CAA4C;IAC5Ca,MAAMY,kBAAkB,GAAG;AAC7B"}
|
||||
14
node_modules/next/dist/server/web/spec-extension/unstable-cache.d.ts
generated
vendored
Normal file
14
node_modules/next/dist/server/web/spec-extension/unstable-cache.d.ts
generated
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
type Callback = (...args: any[]) => Promise<any>;
|
||||
/**
|
||||
* 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 declare function unstable_cache<T extends Callback>(cb: T, keyParts?: string[], options?: {
|
||||
/**
|
||||
* The revalidation interval in seconds.
|
||||
*/
|
||||
revalidate?: number | false;
|
||||
tags?: string[];
|
||||
}): T;
|
||||
export {};
|
||||
223
node_modules/next/dist/server/web/spec-extension/unstable-cache.js
generated
vendored
Normal file
223
node_modules/next/dist/server/web/spec-extension/unstable-cache.js
generated
vendored
Normal file
@ -0,0 +1,223 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "unstable_cache", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return unstable_cache;
|
||||
}
|
||||
});
|
||||
const _constants = require("../../../lib/constants");
|
||||
const _patchfetch = require("../../lib/patch-fetch");
|
||||
const _staticgenerationasyncstorageexternal = require("../../../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" ? _constants.CACHE_ONE_YEAR : revalidate
|
||||
}, {
|
||||
revalidate,
|
||||
fetchCache: true,
|
||||
tags,
|
||||
fetchIdx,
|
||||
fetchUrl
|
||||
});
|
||||
return;
|
||||
}
|
||||
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 ? (0, _patchfetch.validateTags)(options.tags, `unstable_cache ${cb.toString()}`) : [];
|
||||
// Validate the revalidate options
|
||||
(0, _patchfetch.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 = _staticgenerationasyncstorageexternal.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 = (0, _patchfetch.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] = _staticgenerationasyncstorageexternal.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 _staticgenerationasyncstorageexternal.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 && (0, _patchfetch.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 _staticgenerationasyncstorageexternal.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/server/web/spec-extension/unstable-cache.js.map
generated
vendored
Normal file
1
node_modules/next/dist/server/web/spec-extension/unstable-cache.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
16
node_modules/next/dist/server/web/spec-extension/unstable-no-store.d.ts
generated
vendored
Normal file
16
node_modules/next/dist/server/web/spec-extension/unstable-no-store.d.ts
generated
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
/**
|
||||
* 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 declare function unstable_noStore(): void;
|
||||
29
node_modules/next/dist/server/web/spec-extension/unstable-no-store.js
generated
vendored
Normal file
29
node_modules/next/dist/server/web/spec-extension/unstable-no-store.js
generated
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "unstable_noStore", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return unstable_noStore;
|
||||
}
|
||||
});
|
||||
const _staticgenerationasyncstorageexternal = require("../../../client/components/static-generation-async-storage.external");
|
||||
const _dynamicrendering = require("../../app-render/dynamic-rendering");
|
||||
function unstable_noStore() {
|
||||
const callingExpression = "unstable_noStore()";
|
||||
const store = _staticgenerationasyncstorageexternal.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;
|
||||
(0, _dynamicrendering.markCurrentScopeAsDynamic)(store, callingExpression);
|
||||
}
|
||||
}
|
||||
|
||||
//# sourceMappingURL=unstable-no-store.js.map
|
||||
1
node_modules/next/dist/server/web/spec-extension/unstable-no-store.js.map
generated
vendored
Normal file
1
node_modules/next/dist/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":["unstable_noStore","callingExpression","store","staticGenerationAsyncStorage","getStore","forceStatic","isUnstableNoStore","markCurrentScopeAsDynamic"],"mappings":";;;;+BAkBgBA;;;eAAAA;;;sDAlB6B;kCACH;AAiBnC,SAASA;IACd,MAAMC,oBAAoB;IAC1B,MAAMC,QAAQC,kEAA4B,CAACC,QAAQ;IACnD,IAAI,CAACF,OAAO;QACV,6FAA6F;QAC7F,6FAA6F;QAC7F,uEAAuE;QACvE;IACF,OAAO,IAAIA,MAAMG,WAAW,EAAE;QAC5B;IACF,OAAO;QACLH,MAAMI,iBAAiB,GAAG;QAC1BC,IAAAA,2CAAyB,EAACL,OAAOD;IACnC;AACF"}
|
||||
2
node_modules/next/dist/server/web/spec-extension/url-pattern.d.ts
generated
vendored
Normal file
2
node_modules/next/dist/server/web/spec-extension/url-pattern.d.ts
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
declare const GlobalURLPattern: any;
|
||||
export { GlobalURLPattern as URLPattern };
|
||||
14
node_modules/next/dist/server/web/spec-extension/url-pattern.js
generated
vendored
Normal file
14
node_modules/next/dist/server/web/spec-extension/url-pattern.js
generated
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "URLPattern", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return GlobalURLPattern;
|
||||
}
|
||||
});
|
||||
const GlobalURLPattern = // @ts-expect-error: URLPattern is not available in Node.js
|
||||
typeof URLPattern === "undefined" ? undefined : URLPattern;
|
||||
|
||||
//# sourceMappingURL=url-pattern.js.map
|
||||
1
node_modules/next/dist/server/web/spec-extension/url-pattern.js.map
generated
vendored
Normal file
1
node_modules/next/dist/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":["URLPattern","GlobalURLPattern","undefined"],"mappings":";;;;+BAI6BA;;;eAApBC;;;AAJT,MAAMA,mBACJ,2DAA2D;AAC3D,OAAOD,eAAe,cAAcE,YAAYF"}
|
||||
30
node_modules/next/dist/server/web/spec-extension/user-agent.d.ts
generated
vendored
Normal file
30
node_modules/next/dist/server/web/spec-extension/user-agent.d.ts
generated
vendored
Normal file
@ -0,0 +1,30 @@
|
||||
interface UserAgent {
|
||||
isBot: boolean;
|
||||
ua: string;
|
||||
browser: {
|
||||
name?: string;
|
||||
version?: string;
|
||||
};
|
||||
device: {
|
||||
model?: string;
|
||||
type?: string;
|
||||
vendor?: string;
|
||||
};
|
||||
engine: {
|
||||
name?: string;
|
||||
version?: string;
|
||||
};
|
||||
os: {
|
||||
name?: string;
|
||||
version?: string;
|
||||
};
|
||||
cpu: {
|
||||
architecture?: string;
|
||||
};
|
||||
}
|
||||
export declare function isBot(input: string): boolean;
|
||||
export declare function userAgentFromString(input: string | undefined): UserAgent;
|
||||
export declare function userAgent({ headers }: {
|
||||
headers: Headers;
|
||||
}): UserAgent;
|
||||
export {};
|
||||
46
node_modules/next/dist/server/web/spec-extension/user-agent.js
generated
vendored
Normal file
46
node_modules/next/dist/server/web/spec-extension/user-agent.js
generated
vendored
Normal file
@ -0,0 +1,46 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
0 && (module.exports = {
|
||||
isBot: null,
|
||||
userAgent: null,
|
||||
userAgentFromString: null
|
||||
});
|
||||
function _export(target, all) {
|
||||
for(var name in all)Object.defineProperty(target, name, {
|
||||
enumerable: true,
|
||||
get: all[name]
|
||||
});
|
||||
}
|
||||
_export(exports, {
|
||||
isBot: function() {
|
||||
return isBot;
|
||||
},
|
||||
userAgent: function() {
|
||||
return userAgent;
|
||||
},
|
||||
userAgentFromString: function() {
|
||||
return userAgentFromString;
|
||||
}
|
||||
});
|
||||
const _uaparserjs = /*#__PURE__*/ _interop_require_default(require("next/dist/compiled/ua-parser-js"));
|
||||
function _interop_require_default(obj) {
|
||||
return obj && obj.__esModule ? obj : {
|
||||
default: obj
|
||||
};
|
||||
}
|
||||
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);
|
||||
}
|
||||
function userAgentFromString(input) {
|
||||
return {
|
||||
...(0, _uaparserjs.default)(input),
|
||||
isBot: input === undefined ? false : isBot(input)
|
||||
};
|
||||
}
|
||||
function userAgent({ headers }) {
|
||||
return userAgentFromString(headers.get("user-agent") || undefined);
|
||||
}
|
||||
|
||||
//# sourceMappingURL=user-agent.js.map
|
||||
1
node_modules/next/dist/server/web/spec-extension/user-agent.js.map
generated
vendored
Normal file
1
node_modules/next/dist/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":["isBot","userAgent","userAgentFromString","input","test","parseua","undefined","headers","get"],"mappings":";;;;;;;;;;;;;;;;IA2BgBA,KAAK;eAALA;;IAaAC,SAAS;eAATA;;IAPAC,mBAAmB;eAAnBA;;;mEAjCI;;;;;;AA2Bb,SAASF,MAAMG,KAAa;IACjC,OAAO,0WAA0WC,IAAI,CACnXD;AAEJ;AAEO,SAASD,oBAAoBC,KAAyB;IAC3D,OAAO;QACL,GAAGE,IAAAA,mBAAO,EAACF,MAAM;QACjBH,OAAOG,UAAUG,YAAY,QAAQN,MAAMG;IAC7C;AACF;AAEO,SAASF,UAAU,EAAEM,OAAO,EAAwB;IACzD,OAAOL,oBAAoBK,QAAQC,GAAG,CAAC,iBAAiBF;AAC1D"}
|
||||
Reference in New Issue
Block a user