create project
This commit is contained in:
1
kitabcitab/node_modules/next/dist/server/accept-header.d.ts
generated
vendored
Normal file
1
kitabcitab/node_modules/next/dist/server/accept-header.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export declare function acceptLanguage(header?: string, preferences?: string[]): string;
|
||||
115
kitabcitab/node_modules/next/dist/server/accept-header.js
generated
vendored
Normal file
115
kitabcitab/node_modules/next/dist/server/accept-header.js
generated
vendored
Normal file
@@ -0,0 +1,115 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.acceptLanguage = acceptLanguage;
|
||||
function parse(raw, preferences, options) {
|
||||
const lowers = new Map();
|
||||
const header = raw.replace(/[ \t]/g, "");
|
||||
if (preferences) {
|
||||
let pos = 0;
|
||||
for (const preference of preferences){
|
||||
const lower = preference.toLowerCase();
|
||||
lowers.set(lower, {
|
||||
orig: preference,
|
||||
pos: pos++
|
||||
});
|
||||
if (options.prefixMatch) {
|
||||
const parts = lower.split("-");
|
||||
while(parts.pop(), parts.length > 0){
|
||||
const joined = parts.join("-");
|
||||
if (!lowers.has(joined)) {
|
||||
lowers.set(joined, {
|
||||
orig: preference,
|
||||
pos: pos++
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
const parts = header.split(",");
|
||||
const selections = [];
|
||||
const map = new Set();
|
||||
for(let i = 0; i < parts.length; ++i){
|
||||
const part = parts[i];
|
||||
if (!part) {
|
||||
continue;
|
||||
}
|
||||
const params = part.split(";");
|
||||
if (params.length > 2) {
|
||||
throw new Error(`Invalid ${options.type} header`);
|
||||
}
|
||||
let token = params[0].toLowerCase();
|
||||
if (!token) {
|
||||
throw new Error(`Invalid ${options.type} header`);
|
||||
}
|
||||
const selection = {
|
||||
token,
|
||||
pos: i,
|
||||
q: 1
|
||||
};
|
||||
if (preferences && lowers.has(token)) {
|
||||
selection.pref = lowers.get(token).pos;
|
||||
}
|
||||
map.add(selection.token);
|
||||
if (params.length === 2) {
|
||||
const q = params[1];
|
||||
const [key, value] = q.split("=");
|
||||
if (!value || key !== "q" && key !== "Q") {
|
||||
throw new Error(`Invalid ${options.type} header`);
|
||||
}
|
||||
const score = parseFloat(value);
|
||||
if (score === 0) {
|
||||
continue;
|
||||
}
|
||||
if (Number.isFinite(score) && score <= 1 && score >= 0.001) {
|
||||
selection.q = score;
|
||||
}
|
||||
}
|
||||
selections.push(selection);
|
||||
}
|
||||
selections.sort((a, b)=>{
|
||||
if (b.q !== a.q) {
|
||||
return b.q - a.q;
|
||||
}
|
||||
if (b.pref !== a.pref) {
|
||||
if (a.pref === undefined) {
|
||||
return 1;
|
||||
}
|
||||
if (b.pref === undefined) {
|
||||
return -1;
|
||||
}
|
||||
return a.pref - b.pref;
|
||||
}
|
||||
return a.pos - b.pos;
|
||||
});
|
||||
const values = selections.map((selection)=>selection.token);
|
||||
if (!preferences || !preferences.length) {
|
||||
return values;
|
||||
}
|
||||
const preferred = [];
|
||||
for (const selection1 of values){
|
||||
if (selection1 === "*") {
|
||||
for (const [preference, value] of lowers){
|
||||
if (!map.has(preference)) {
|
||||
preferred.push(value.orig);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
const lower = selection1.toLowerCase();
|
||||
if (lowers.has(lower)) {
|
||||
preferred.push(lowers.get(lower).orig);
|
||||
}
|
||||
}
|
||||
}
|
||||
return preferred;
|
||||
}
|
||||
function acceptLanguage(header = "", preferences) {
|
||||
return parse(header, preferences, {
|
||||
type: "accept-language",
|
||||
prefixMatch: true
|
||||
})[0] || "";
|
||||
}
|
||||
|
||||
//# sourceMappingURL=accept-header.js.map
|
||||
1
kitabcitab/node_modules/next/dist/server/accept-header.js.map
generated
vendored
Normal file
1
kitabcitab/node_modules/next/dist/server/accept-header.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../server/accept-header.ts"],"names":["acceptLanguage","parse","raw","preferences","options","lowers","Map","header","replace","pos","preference","lower","toLowerCase","set","orig","prefixMatch","parts","split","pop","length","joined","join","has","selections","map","Set","i","part","params","Error","type","token","selection","q","pref","get","add","key","value","score","parseFloat","Number","isFinite","push","sort","a","b","undefined","values","preferred"],"mappings":"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"}
|
||||
74
kitabcitab/node_modules/next/dist/server/api-utils/index.d.ts
generated
vendored
Normal file
74
kitabcitab/node_modules/next/dist/server/api-utils/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,74 @@
|
||||
/// <reference types="node" />
|
||||
import type { IncomingMessage } from 'http';
|
||||
import type { BaseNextRequest } from '../base-http';
|
||||
import { NextApiRequest, NextApiResponse } from '../../shared/lib/utils';
|
||||
export declare type NextApiRequestCookies = Partial<{
|
||||
[key: string]: string;
|
||||
}>;
|
||||
export declare type NextApiRequestQuery = Partial<{
|
||||
[key: string]: string | string[];
|
||||
}>;
|
||||
export declare type __ApiPreviewProps = {
|
||||
previewModeId: string;
|
||||
previewModeEncryptionKey: string;
|
||||
previewModeSigningKey: string;
|
||||
};
|
||||
/**
|
||||
* Parse cookies from the `headers` of request
|
||||
* @param req request object
|
||||
*/
|
||||
export declare function getCookieParser(headers: {
|
||||
[key: string]: undefined | string | string[];
|
||||
}): () => NextApiRequestCookies;
|
||||
/**
|
||||
*
|
||||
* @param res response object
|
||||
* @param statusCode `HTTP` status code of response
|
||||
*/
|
||||
export declare function sendStatusCode(res: NextApiResponse, statusCode: number): NextApiResponse<any>;
|
||||
/**
|
||||
*
|
||||
* @param res response object
|
||||
* @param [statusOrUrl] `HTTP` status code of redirect
|
||||
* @param url URL of redirect
|
||||
*/
|
||||
export declare function redirect(res: NextApiResponse, statusOrUrl: string | number, url?: string): NextApiResponse<any>;
|
||||
export declare const PRERENDER_REVALIDATE_HEADER = "x-prerender-revalidate";
|
||||
export declare const PRERENDER_REVALIDATE_ONLY_GENERATED_HEADER = "x-prerender-revalidate-if-generated";
|
||||
export declare function checkIsManualRevalidate(req: IncomingMessage | BaseNextRequest, previewProps: __ApiPreviewProps): {
|
||||
isManualRevalidate: boolean;
|
||||
revalidateOnlyGenerated: boolean;
|
||||
};
|
||||
export declare const COOKIE_NAME_PRERENDER_BYPASS = "__prerender_bypass";
|
||||
export declare const COOKIE_NAME_PRERENDER_DATA = "__next_preview_data";
|
||||
export declare const RESPONSE_LIMIT_DEFAULT: number;
|
||||
export declare const SYMBOL_PREVIEW_DATA: unique symbol;
|
||||
export declare const SYMBOL_CLEARED_COOKIES: unique symbol;
|
||||
export declare function clearPreviewData<T>(res: NextApiResponse<T>, options?: {
|
||||
path?: string;
|
||||
}): NextApiResponse<T>;
|
||||
/**
|
||||
* Custom error class
|
||||
*/
|
||||
export declare class ApiError extends Error {
|
||||
readonly statusCode: number;
|
||||
constructor(statusCode: number, message: string);
|
||||
}
|
||||
/**
|
||||
* Sends error in `response`
|
||||
* @param res response object
|
||||
* @param statusCode of response
|
||||
* @param message of response
|
||||
*/
|
||||
export declare function sendError(res: NextApiResponse, statusCode: number, message: string): void;
|
||||
interface LazyProps {
|
||||
req: NextApiRequest;
|
||||
}
|
||||
/**
|
||||
* Execute getter function only if its needed
|
||||
* @param LazyProps `req` and `params` for lazyProp
|
||||
* @param prop name of property
|
||||
* @param getter function to get data
|
||||
*/
|
||||
export declare function setLazyProp<T>({ req }: LazyProps, prop: string, getter: () => T): void;
|
||||
export {};
|
||||
146
kitabcitab/node_modules/next/dist/server/api-utils/index.js
generated
vendored
Normal file
146
kitabcitab/node_modules/next/dist/server/api-utils/index.js
generated
vendored
Normal file
@@ -0,0 +1,146 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.getCookieParser = getCookieParser;
|
||||
exports.sendStatusCode = sendStatusCode;
|
||||
exports.redirect = redirect;
|
||||
exports.checkIsManualRevalidate = checkIsManualRevalidate;
|
||||
exports.clearPreviewData = clearPreviewData;
|
||||
exports.sendError = sendError;
|
||||
exports.setLazyProp = setLazyProp;
|
||||
exports.SYMBOL_CLEARED_COOKIES = exports.SYMBOL_PREVIEW_DATA = exports.RESPONSE_LIMIT_DEFAULT = exports.COOKIE_NAME_PRERENDER_DATA = exports.COOKIE_NAME_PRERENDER_BYPASS = exports.PRERENDER_REVALIDATE_ONLY_GENERATED_HEADER = exports.PRERENDER_REVALIDATE_HEADER = void 0;
|
||||
function getCookieParser(headers) {
|
||||
return function parseCookie() {
|
||||
const header = headers.cookie;
|
||||
if (!header) {
|
||||
return {};
|
||||
}
|
||||
const { parse: parseCookieFn } = require("next/dist/compiled/cookie");
|
||||
return parseCookieFn(Array.isArray(header) ? header.join(";") : header);
|
||||
};
|
||||
}
|
||||
function sendStatusCode(res, statusCode) {
|
||||
res.statusCode = statusCode;
|
||||
return res;
|
||||
}
|
||||
function redirect(res, statusOrUrl, url) {
|
||||
if (typeof statusOrUrl === "string") {
|
||||
url = statusOrUrl;
|
||||
statusOrUrl = 307;
|
||||
}
|
||||
if (typeof statusOrUrl !== "number" || typeof url !== "string") {
|
||||
throw new Error(`Invalid redirect arguments. Please use a single argument URL, e.g. res.redirect('/destination') or use a status code and URL, e.g. res.redirect(307, '/destination').`);
|
||||
}
|
||||
res.writeHead(statusOrUrl, {
|
||||
Location: url
|
||||
});
|
||||
res.write(url);
|
||||
res.end();
|
||||
return res;
|
||||
}
|
||||
const PRERENDER_REVALIDATE_HEADER = "x-prerender-revalidate";
|
||||
exports.PRERENDER_REVALIDATE_HEADER = PRERENDER_REVALIDATE_HEADER;
|
||||
const PRERENDER_REVALIDATE_ONLY_GENERATED_HEADER = "x-prerender-revalidate-if-generated";
|
||||
exports.PRERENDER_REVALIDATE_ONLY_GENERATED_HEADER = PRERENDER_REVALIDATE_ONLY_GENERATED_HEADER;
|
||||
function checkIsManualRevalidate(req, previewProps) {
|
||||
return {
|
||||
isManualRevalidate: req.headers[PRERENDER_REVALIDATE_HEADER] === previewProps.previewModeId,
|
||||
revalidateOnlyGenerated: !!req.headers[PRERENDER_REVALIDATE_ONLY_GENERATED_HEADER]
|
||||
};
|
||||
}
|
||||
const COOKIE_NAME_PRERENDER_BYPASS = `__prerender_bypass`;
|
||||
exports.COOKIE_NAME_PRERENDER_BYPASS = COOKIE_NAME_PRERENDER_BYPASS;
|
||||
const COOKIE_NAME_PRERENDER_DATA = `__next_preview_data`;
|
||||
exports.COOKIE_NAME_PRERENDER_DATA = COOKIE_NAME_PRERENDER_DATA;
|
||||
const RESPONSE_LIMIT_DEFAULT = 4 * 1024 * 1024;
|
||||
exports.RESPONSE_LIMIT_DEFAULT = RESPONSE_LIMIT_DEFAULT;
|
||||
const SYMBOL_PREVIEW_DATA = Symbol(COOKIE_NAME_PRERENDER_DATA);
|
||||
exports.SYMBOL_PREVIEW_DATA = SYMBOL_PREVIEW_DATA;
|
||||
const SYMBOL_CLEARED_COOKIES = Symbol(COOKIE_NAME_PRERENDER_BYPASS);
|
||||
exports.SYMBOL_CLEARED_COOKIES = SYMBOL_CLEARED_COOKIES;
|
||||
function clearPreviewData(res, options = {}) {
|
||||
if (SYMBOL_CLEARED_COOKIES in res) {
|
||||
return res;
|
||||
}
|
||||
const { serialize } = require("next/dist/compiled/cookie");
|
||||
const previous = res.getHeader("Set-Cookie");
|
||||
res.setHeader(`Set-Cookie`, [
|
||||
...typeof previous === "string" ? [
|
||||
previous
|
||||
] : Array.isArray(previous) ? previous : [],
|
||||
serialize(COOKIE_NAME_PRERENDER_BYPASS, "", {
|
||||
// To delete a cookie, set `expires` to a date in the past:
|
||||
// https://tools.ietf.org/html/rfc6265#section-4.1.1
|
||||
// `Max-Age: 0` is not valid, thus ignored, and the cookie is persisted.
|
||||
expires: new Date(0),
|
||||
httpOnly: true,
|
||||
sameSite: process.env.NODE_ENV !== "development" ? "none" : "lax",
|
||||
secure: process.env.NODE_ENV !== "development",
|
||||
path: "/",
|
||||
...options.path !== undefined ? {
|
||||
path: options.path
|
||||
} : undefined
|
||||
}),
|
||||
serialize(COOKIE_NAME_PRERENDER_DATA, "", {
|
||||
// To delete a cookie, set `expires` to a date in the past:
|
||||
// https://tools.ietf.org/html/rfc6265#section-4.1.1
|
||||
// `Max-Age: 0` is not valid, thus ignored, and the cookie is persisted.
|
||||
expires: new Date(0),
|
||||
httpOnly: true,
|
||||
sameSite: process.env.NODE_ENV !== "development" ? "none" : "lax",
|
||||
secure: process.env.NODE_ENV !== "development",
|
||||
path: "/",
|
||||
...options.path !== undefined ? {
|
||||
path: options.path
|
||||
} : undefined
|
||||
}),
|
||||
]);
|
||||
Object.defineProperty(res, SYMBOL_CLEARED_COOKIES, {
|
||||
value: true,
|
||||
enumerable: false
|
||||
});
|
||||
return res;
|
||||
}
|
||||
class ApiError extends Error {
|
||||
constructor(statusCode, message){
|
||||
super(message);
|
||||
this.statusCode = statusCode;
|
||||
}
|
||||
}
|
||||
exports.ApiError = ApiError;
|
||||
function sendError(res, statusCode, message) {
|
||||
res.statusCode = statusCode;
|
||||
res.statusMessage = message;
|
||||
res.end(message);
|
||||
}
|
||||
function setLazyProp({ req }, prop, getter) {
|
||||
const opts = {
|
||||
configurable: true,
|
||||
enumerable: true
|
||||
};
|
||||
const optsReset = {
|
||||
...opts,
|
||||
writable: true
|
||||
};
|
||||
Object.defineProperty(req, prop, {
|
||||
...opts,
|
||||
get: ()=>{
|
||||
const value = getter();
|
||||
// we set the property on the object to avoid recalculating it
|
||||
Object.defineProperty(req, prop, {
|
||||
...optsReset,
|
||||
value
|
||||
});
|
||||
return value;
|
||||
},
|
||||
set: (value)=>{
|
||||
Object.defineProperty(req, prop, {
|
||||
...optsReset,
|
||||
value
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
kitabcitab/node_modules/next/dist/server/api-utils/index.js.map
generated
vendored
Normal file
1
kitabcitab/node_modules/next/dist/server/api-utils/index.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
18
kitabcitab/node_modules/next/dist/server/api-utils/node.d.ts
generated
vendored
Normal file
18
kitabcitab/node_modules/next/dist/server/api-utils/node.d.ts
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
/// <reference types="node" />
|
||||
import type { IncomingMessage, ServerResponse } from 'http';
|
||||
import type { SizeLimit } from 'next/types';
|
||||
import { __ApiPreviewProps } from '.';
|
||||
import type { BaseNextRequest, BaseNextResponse } from '../base-http';
|
||||
import type { PreviewData } from 'next/types';
|
||||
export declare function tryGetPreviewData(req: IncomingMessage | BaseNextRequest, res: ServerResponse | BaseNextResponse, options: __ApiPreviewProps): PreviewData;
|
||||
/**
|
||||
* Parse incoming message like `json` or `urlencoded`
|
||||
* @param req request object
|
||||
*/
|
||||
export declare function parseBody(req: IncomingMessage, limit: SizeLimit): Promise<any>;
|
||||
declare type ApiContext = __ApiPreviewProps & {
|
||||
trustHostHeader?: boolean;
|
||||
revalidate?: (_req: IncomingMessage, _res: ServerResponse) => Promise<any>;
|
||||
};
|
||||
export declare function apiResolver(req: IncomingMessage, res: ServerResponse, query: any, resolverModule: any, apiContext: ApiContext, propagateError: boolean, dev?: boolean, page?: string): Promise<void>;
|
||||
export {};
|
||||
386
kitabcitab/node_modules/next/dist/server/api-utils/node.js
generated
vendored
Normal file
386
kitabcitab/node_modules/next/dist/server/api-utils/node.js
generated
vendored
Normal file
@@ -0,0 +1,386 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.tryGetPreviewData = tryGetPreviewData;
|
||||
exports.parseBody = parseBody;
|
||||
exports.apiResolver = apiResolver;
|
||||
var _ = require(".");
|
||||
var _bytes = _interopRequireDefault(require("next/dist/compiled/bytes"));
|
||||
var _etag = require("../lib/etag");
|
||||
var _sendPayload = require("../send-payload");
|
||||
var _stream = require("stream");
|
||||
var _contentType = require("next/dist/compiled/content-type");
|
||||
var _isError = _interopRequireDefault(require("../../lib/is-error"));
|
||||
var _utils = require("../../shared/lib/utils");
|
||||
var _interopDefault = require("../../lib/interop-default");
|
||||
var _index = require("./index");
|
||||
var _mockRequest = require("../lib/mock-request");
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {
|
||||
default: obj
|
||||
};
|
||||
}
|
||||
function tryGetPreviewData(req, res, options) {
|
||||
// if an On-Demand revalidation is being done preview mode
|
||||
// is disabled
|
||||
if (options && (0, _).checkIsManualRevalidate(req, options).isManualRevalidate) {
|
||||
return false;
|
||||
}
|
||||
// Read cached preview data if present
|
||||
if (_index.SYMBOL_PREVIEW_DATA in req) {
|
||||
return req[_index.SYMBOL_PREVIEW_DATA];
|
||||
}
|
||||
const getCookies = (0, _index).getCookieParser(req.headers);
|
||||
let cookies;
|
||||
try {
|
||||
cookies = getCookies();
|
||||
} catch {
|
||||
// TODO: warn
|
||||
return false;
|
||||
}
|
||||
const hasBypass = _index.COOKIE_NAME_PRERENDER_BYPASS in cookies;
|
||||
const hasData = _index.COOKIE_NAME_PRERENDER_DATA in cookies;
|
||||
// Case: neither cookie is set.
|
||||
if (!(hasBypass || hasData)) {
|
||||
return false;
|
||||
}
|
||||
// Case: one cookie is set, but not the other.
|
||||
if (hasBypass !== hasData) {
|
||||
(0, _index).clearPreviewData(res);
|
||||
return false;
|
||||
}
|
||||
// Case: preview session is for an old build.
|
||||
if (cookies[_index.COOKIE_NAME_PRERENDER_BYPASS] !== options.previewModeId) {
|
||||
(0, _index).clearPreviewData(res);
|
||||
return false;
|
||||
}
|
||||
const tokenPreviewData = cookies[_index.COOKIE_NAME_PRERENDER_DATA];
|
||||
let encryptedPreviewData;
|
||||
try {
|
||||
const jsonwebtoken = require("next/dist/compiled/jsonwebtoken");
|
||||
encryptedPreviewData = jsonwebtoken.verify(tokenPreviewData, options.previewModeSigningKey);
|
||||
} catch {
|
||||
// TODO: warn
|
||||
(0, _index).clearPreviewData(res);
|
||||
return false;
|
||||
}
|
||||
const { decryptWithSecret } = require("../crypto-utils");
|
||||
const decryptedPreviewData = decryptWithSecret(Buffer.from(options.previewModeEncryptionKey), encryptedPreviewData.data);
|
||||
try {
|
||||
// TODO: strict runtime type checking
|
||||
const data = JSON.parse(decryptedPreviewData);
|
||||
// Cache lookup
|
||||
Object.defineProperty(req, _index.SYMBOL_PREVIEW_DATA, {
|
||||
value: data,
|
||||
enumerable: false
|
||||
});
|
||||
return data;
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Parse `JSON` and handles invalid `JSON` strings
|
||||
* @param str `JSON` string
|
||||
*/ function parseJson(str) {
|
||||
if (str.length === 0) {
|
||||
// special-case empty json body, as it's a common client-side mistake
|
||||
return {};
|
||||
}
|
||||
try {
|
||||
return JSON.parse(str);
|
||||
} catch (e) {
|
||||
throw new _index.ApiError(400, "Invalid JSON");
|
||||
}
|
||||
}
|
||||
async function parseBody(req, limit) {
|
||||
let contentType;
|
||||
try {
|
||||
contentType = (0, _contentType).parse(req.headers["content-type"] || "text/plain");
|
||||
} catch {
|
||||
contentType = (0, _contentType).parse("text/plain");
|
||||
}
|
||||
const { type , parameters } = contentType;
|
||||
const encoding = parameters.charset || "utf-8";
|
||||
let buffer;
|
||||
try {
|
||||
const getRawBody = require("next/dist/compiled/raw-body");
|
||||
buffer = await getRawBody(req, {
|
||||
encoding,
|
||||
limit
|
||||
});
|
||||
} catch (e) {
|
||||
if ((0, _isError).default(e) && e.type === "entity.too.large") {
|
||||
throw new _index.ApiError(413, `Body exceeded ${limit} limit`);
|
||||
} else {
|
||||
throw new _index.ApiError(400, "Invalid body");
|
||||
}
|
||||
}
|
||||
const body = buffer.toString();
|
||||
if (type === "application/json" || type === "application/ld+json") {
|
||||
return parseJson(body);
|
||||
} else if (type === "application/x-www-form-urlencoded") {
|
||||
const qs = require("querystring");
|
||||
return qs.decode(body);
|
||||
} else {
|
||||
return body;
|
||||
}
|
||||
}
|
||||
function getMaxContentLength(responseLimit) {
|
||||
if (responseLimit && typeof responseLimit !== "boolean") {
|
||||
return _bytes.default.parse(responseLimit);
|
||||
}
|
||||
return _index.RESPONSE_LIMIT_DEFAULT;
|
||||
}
|
||||
/**
|
||||
* Send `any` body to response
|
||||
* @param req request object
|
||||
* @param res response object
|
||||
* @param body of response
|
||||
*/ function sendData(req, res, body) {
|
||||
if (body === null || body === undefined) {
|
||||
res.end();
|
||||
return;
|
||||
}
|
||||
// strip irrelevant headers/body
|
||||
if (res.statusCode === 204 || res.statusCode === 304) {
|
||||
res.removeHeader("Content-Type");
|
||||
res.removeHeader("Content-Length");
|
||||
res.removeHeader("Transfer-Encoding");
|
||||
if (process.env.NODE_ENV === "development" && body) {
|
||||
console.warn(`A body was attempted to be set with a 204 statusCode for ${req.url}, this is invalid and the body was ignored.\n` + `See more info here https://nextjs.org/docs/messages/invalid-api-status-body`);
|
||||
}
|
||||
res.end();
|
||||
return;
|
||||
}
|
||||
const contentType = res.getHeader("Content-Type");
|
||||
if (body instanceof _stream.Stream) {
|
||||
if (!contentType) {
|
||||
res.setHeader("Content-Type", "application/octet-stream");
|
||||
}
|
||||
body.pipe(res);
|
||||
return;
|
||||
}
|
||||
const isJSONLike = [
|
||||
"object",
|
||||
"number",
|
||||
"boolean"
|
||||
].includes(typeof body);
|
||||
const stringifiedBody = isJSONLike ? JSON.stringify(body) : body;
|
||||
const etag = (0, _etag).generateETag(stringifiedBody);
|
||||
if ((0, _sendPayload).sendEtagResponse(req, res, etag)) {
|
||||
return;
|
||||
}
|
||||
if (Buffer.isBuffer(body)) {
|
||||
if (!contentType) {
|
||||
res.setHeader("Content-Type", "application/octet-stream");
|
||||
}
|
||||
res.setHeader("Content-Length", body.length);
|
||||
res.end(body);
|
||||
return;
|
||||
}
|
||||
if (isJSONLike) {
|
||||
res.setHeader("Content-Type", "application/json; charset=utf-8");
|
||||
}
|
||||
res.setHeader("Content-Length", Buffer.byteLength(stringifiedBody));
|
||||
res.end(stringifiedBody);
|
||||
}
|
||||
/**
|
||||
* Send `JSON` object
|
||||
* @param res response object
|
||||
* @param jsonBody of data
|
||||
*/ function sendJson(res, jsonBody) {
|
||||
// Set header to application/json
|
||||
res.setHeader("Content-Type", "application/json; charset=utf-8");
|
||||
// Use send to handle request
|
||||
res.send(JSON.stringify(jsonBody));
|
||||
}
|
||||
function isNotValidData(str) {
|
||||
return typeof str !== "string" || str.length < 16;
|
||||
}
|
||||
function setPreviewData(res, data, options) {
|
||||
if (isNotValidData(options.previewModeId)) {
|
||||
throw new Error("invariant: invalid previewModeId");
|
||||
}
|
||||
if (isNotValidData(options.previewModeEncryptionKey)) {
|
||||
throw new Error("invariant: invalid previewModeEncryptionKey");
|
||||
}
|
||||
if (isNotValidData(options.previewModeSigningKey)) {
|
||||
throw new Error("invariant: invalid previewModeSigningKey");
|
||||
}
|
||||
const jsonwebtoken = require("next/dist/compiled/jsonwebtoken");
|
||||
const { encryptWithSecret } = require("../crypto-utils");
|
||||
const payload = jsonwebtoken.sign({
|
||||
data: encryptWithSecret(Buffer.from(options.previewModeEncryptionKey), JSON.stringify(data))
|
||||
}, options.previewModeSigningKey, {
|
||||
algorithm: "HS256",
|
||||
...options.maxAge !== undefined ? {
|
||||
expiresIn: options.maxAge
|
||||
} : undefined
|
||||
});
|
||||
// limit preview mode cookie to 2KB since we shouldn't store too much
|
||||
// data here and browsers drop cookies over 4KB
|
||||
if (payload.length > 2048) {
|
||||
throw new Error(`Preview data is limited to 2KB currently, reduce how much data you are storing as preview data to continue`);
|
||||
}
|
||||
const { serialize } = require("next/dist/compiled/cookie");
|
||||
const previous = res.getHeader("Set-Cookie");
|
||||
res.setHeader(`Set-Cookie`, [
|
||||
...typeof previous === "string" ? [
|
||||
previous
|
||||
] : Array.isArray(previous) ? previous : [],
|
||||
serialize(_index.COOKIE_NAME_PRERENDER_BYPASS, options.previewModeId, {
|
||||
httpOnly: true,
|
||||
sameSite: process.env.NODE_ENV !== "development" ? "none" : "lax",
|
||||
secure: process.env.NODE_ENV !== "development",
|
||||
path: "/",
|
||||
...options.maxAge !== undefined ? {
|
||||
maxAge: options.maxAge
|
||||
} : undefined,
|
||||
...options.path !== undefined ? {
|
||||
path: options.path
|
||||
} : undefined
|
||||
}),
|
||||
serialize(_index.COOKIE_NAME_PRERENDER_DATA, payload, {
|
||||
httpOnly: true,
|
||||
sameSite: process.env.NODE_ENV !== "development" ? "none" : "lax",
|
||||
secure: process.env.NODE_ENV !== "development",
|
||||
path: "/",
|
||||
...options.maxAge !== undefined ? {
|
||||
maxAge: options.maxAge
|
||||
} : undefined,
|
||||
...options.path !== undefined ? {
|
||||
path: options.path
|
||||
} : undefined
|
||||
}),
|
||||
]);
|
||||
return res;
|
||||
}
|
||||
async function revalidate(urlPath, opts, req, context) {
|
||||
if (typeof urlPath !== "string" || !urlPath.startsWith("/")) {
|
||||
throw new Error(`Invalid urlPath provided to revalidate(), must be a path e.g. /blog/post-1, received ${urlPath}`);
|
||||
}
|
||||
const revalidateHeaders = {
|
||||
[_index.PRERENDER_REVALIDATE_HEADER]: context.previewModeId,
|
||||
...opts.unstable_onlyGenerated ? {
|
||||
[_.PRERENDER_REVALIDATE_ONLY_GENERATED_HEADER]: "1"
|
||||
} : {}
|
||||
};
|
||||
try {
|
||||
if (context.trustHostHeader) {
|
||||
const res = await fetch(`https://${req.headers.host}${urlPath}`, {
|
||||
method: "HEAD",
|
||||
headers: {
|
||||
...revalidateHeaders,
|
||||
cookie: req.headers.cookie || ""
|
||||
}
|
||||
});
|
||||
// we use the cache header to determine successful revalidate as
|
||||
// a non-200 status code can be returned from a successful revalidate
|
||||
// e.g. notFound: true returns 404 status code but is successful
|
||||
const cacheHeader = res.headers.get("x-vercel-cache") || res.headers.get("x-nextjs-cache");
|
||||
if ((cacheHeader == null ? void 0 : cacheHeader.toUpperCase()) !== "REVALIDATED" && !(res.status === 404 && opts.unstable_onlyGenerated)) {
|
||||
throw new Error(`Invalid response ${res.status}`);
|
||||
}
|
||||
} else if (context.revalidate) {
|
||||
const { req: mockReq , res: mockRes , streamPromise , } = (0, _mockRequest).mockRequest(urlPath, revalidateHeaders, "GET");
|
||||
await context.revalidate(mockReq, mockRes);
|
||||
await streamPromise;
|
||||
if (mockRes.getHeader("x-nextjs-cache") !== "REVALIDATED" && !(mockRes.statusCode === 404 && opts.unstable_onlyGenerated)) {
|
||||
throw new Error(`Invalid response ${mockRes.statusCode}`);
|
||||
}
|
||||
} else {
|
||||
throw new Error(`Invariant: required internal revalidate method not passed to api-utils`);
|
||||
}
|
||||
} catch (err) {
|
||||
throw new Error(`Failed to revalidate ${urlPath}: ${(0, _isError).default(err) ? err.message : err}`);
|
||||
}
|
||||
}
|
||||
async function apiResolver(req, res, query, resolverModule, apiContext, propagateError, dev, page) {
|
||||
const apiReq = req;
|
||||
const apiRes = res;
|
||||
try {
|
||||
var ref, ref1, ref2;
|
||||
if (!resolverModule) {
|
||||
res.statusCode = 404;
|
||||
res.end("Not Found");
|
||||
return;
|
||||
}
|
||||
const config = resolverModule.config || {};
|
||||
const bodyParser = ((ref = config.api) == null ? void 0 : ref.bodyParser) !== false;
|
||||
const responseLimit = ((ref1 = config.api) == null ? void 0 : ref1.responseLimit) ?? true;
|
||||
const externalResolver = ((ref2 = config.api) == null ? void 0 : ref2.externalResolver) || false;
|
||||
// Parsing of cookies
|
||||
(0, _index).setLazyProp({
|
||||
req: apiReq
|
||||
}, "cookies", (0, _index).getCookieParser(req.headers));
|
||||
// Parsing query string
|
||||
apiReq.query = query;
|
||||
// Parsing preview data
|
||||
(0, _index).setLazyProp({
|
||||
req: apiReq
|
||||
}, "previewData", ()=>tryGetPreviewData(req, res, apiContext));
|
||||
// Checking if preview mode is enabled
|
||||
(0, _index).setLazyProp({
|
||||
req: apiReq
|
||||
}, "preview", ()=>apiReq.previewData !== false ? true : undefined);
|
||||
// Parsing of body
|
||||
if (bodyParser && !apiReq.body) {
|
||||
apiReq.body = await parseBody(apiReq, config.api && config.api.bodyParser && config.api.bodyParser.sizeLimit ? config.api.bodyParser.sizeLimit : "1mb");
|
||||
}
|
||||
let contentLength = 0;
|
||||
const maxContentLength = getMaxContentLength(responseLimit);
|
||||
const writeData = apiRes.write;
|
||||
const endResponse = apiRes.end;
|
||||
apiRes.write = (...args)=>{
|
||||
contentLength += Buffer.byteLength(args[0] || "");
|
||||
return writeData.apply(apiRes, args);
|
||||
};
|
||||
apiRes.end = (...args)=>{
|
||||
if (args.length && typeof args[0] !== "function") {
|
||||
contentLength += Buffer.byteLength(args[0] || "");
|
||||
}
|
||||
if (responseLimit && contentLength >= maxContentLength) {
|
||||
console.warn(`API response for ${req.url} exceeds ${_bytes.default.format(maxContentLength)}. API Routes are meant to respond quickly. https://nextjs.org/docs/messages/api-routes-response-size-limit`);
|
||||
}
|
||||
endResponse.apply(apiRes, args);
|
||||
};
|
||||
apiRes.status = (statusCode)=>(0, _index).sendStatusCode(apiRes, statusCode);
|
||||
apiRes.send = (data)=>sendData(apiReq, apiRes, data);
|
||||
apiRes.json = (data)=>sendJson(apiRes, data);
|
||||
apiRes.redirect = (statusOrUrl, url)=>(0, _index).redirect(apiRes, statusOrUrl, url);
|
||||
apiRes.setPreviewData = (data, options = {})=>setPreviewData(apiRes, data, Object.assign({}, apiContext, options));
|
||||
apiRes.clearPreviewData = (options = {})=>(0, _index).clearPreviewData(apiRes, options);
|
||||
apiRes.revalidate = (urlPath, opts)=>revalidate(urlPath, opts || {}, req, apiContext);
|
||||
const resolver = (0, _interopDefault).interopDefault(resolverModule);
|
||||
let wasPiped = false;
|
||||
if (process.env.NODE_ENV !== "production") {
|
||||
// listen for pipe event and don't show resolve warning
|
||||
res.once("pipe", ()=>wasPiped = true);
|
||||
}
|
||||
// Call API route method
|
||||
await resolver(req, res);
|
||||
if (process.env.NODE_ENV !== "production" && !externalResolver && !(0, _utils).isResSent(res) && !wasPiped) {
|
||||
console.warn(`API resolved without sending a response for ${req.url}, this may result in stalled requests.`);
|
||||
}
|
||||
} catch (err) {
|
||||
if (err instanceof _index.ApiError) {
|
||||
(0, _index).sendError(apiRes, err.statusCode, err.message);
|
||||
} else {
|
||||
if (dev) {
|
||||
if ((0, _isError).default(err)) {
|
||||
err.page = page;
|
||||
}
|
||||
throw err;
|
||||
}
|
||||
console.error(err);
|
||||
if (propagateError) {
|
||||
throw err;
|
||||
}
|
||||
(0, _index).sendError(apiRes, 500, "Internal Server Error");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//# sourceMappingURL=node.js.map
|
||||
1
kitabcitab/node_modules/next/dist/server/api-utils/node.js.map
generated
vendored
Normal file
1
kitabcitab/node_modules/next/dist/server/api-utils/node.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
1
kitabcitab/node_modules/next/dist/server/api-utils/web.d.ts
generated
vendored
Normal file
1
kitabcitab/node_modules/next/dist/server/api-utils/web.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export declare function byteLength(payload: string): number;
|
||||
10
kitabcitab/node_modules/next/dist/server/api-utils/web.js
generated
vendored
Normal file
10
kitabcitab/node_modules/next/dist/server/api-utils/web.js
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.byteLength = byteLength;
|
||||
function byteLength(payload) {
|
||||
return new TextEncoder().encode(payload).buffer.byteLength;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=web.js.map
|
||||
1
kitabcitab/node_modules/next/dist/server/api-utils/web.js.map
generated
vendored
Normal file
1
kitabcitab/node_modules/next/dist/server/api-utils/web.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../server/api-utils/web.ts"],"names":["byteLength","payload","TextEncoder","encode","buffer"],"mappings":"AAEA;;;;QAAgBA,UAAU,GAAVA,UAAU;AAAnB,SAASA,UAAU,CAACC,OAAe,EAAU;IAClD,OAAO,IAAIC,WAAW,EAAE,CAACC,MAAM,CAACF,OAAO,CAAC,CAACG,MAAM,CAACJ,UAAU,CAAA;CAC3D"}
|
||||
109
kitabcitab/node_modules/next/dist/server/app-render.d.ts
generated
vendored
Normal file
109
kitabcitab/node_modules/next/dist/server/app-render.d.ts
generated
vendored
Normal file
@@ -0,0 +1,109 @@
|
||||
/// <reference types="node" />
|
||||
/// <reference types="react" />
|
||||
import type { IncomingHttpHeaders, IncomingMessage, ServerResponse } from 'http';
|
||||
import type { LoadComponentsReturnType } from './load-components';
|
||||
import type { ServerRuntime } from '../types';
|
||||
import type { FontLoaderManifest } from '../build/webpack/plugins/font-loader-manifest-plugin';
|
||||
import React from 'next/dist/compiled/react';
|
||||
import { NextParsedUrlQuery } from './request-meta';
|
||||
import RenderResult from './render-result';
|
||||
import { FlightCSSManifest, FlightManifest } from '../build/webpack/plugins/flight-manifest-plugin';
|
||||
import { RequestCookies } from './web/spec-extension/cookies';
|
||||
declare const INTERNAL_HEADERS_INSTANCE: unique symbol;
|
||||
export declare class ReadonlyHeaders {
|
||||
[INTERNAL_HEADERS_INSTANCE]: Headers;
|
||||
entries: Headers['entries'];
|
||||
forEach: Headers['forEach'];
|
||||
get: Headers['get'];
|
||||
has: Headers['has'];
|
||||
keys: Headers['keys'];
|
||||
values: Headers['values'];
|
||||
constructor(headers: IncomingHttpHeaders);
|
||||
[Symbol.iterator](): IterableIterator<[string, string]>;
|
||||
append(): void;
|
||||
delete(): void;
|
||||
set(): void;
|
||||
}
|
||||
declare const INTERNAL_COOKIES_INSTANCE: unique symbol;
|
||||
export declare class ReadonlyRequestCookies {
|
||||
[INTERNAL_COOKIES_INSTANCE]: RequestCookies;
|
||||
get: RequestCookies['get'];
|
||||
getAll: RequestCookies['getAll'];
|
||||
has: RequestCookies['has'];
|
||||
constructor(request: {
|
||||
headers: {
|
||||
get(key: 'cookie'): string | null | undefined;
|
||||
};
|
||||
});
|
||||
[Symbol.iterator](): any;
|
||||
clear(): void;
|
||||
delete(): void;
|
||||
set(): void;
|
||||
}
|
||||
export declare type RenderOptsPartial = {
|
||||
err?: Error | null;
|
||||
dev?: boolean;
|
||||
serverComponentManifest?: FlightManifest;
|
||||
serverCSSManifest?: FlightCSSManifest;
|
||||
supportsDynamicHTML?: boolean;
|
||||
runtime?: ServerRuntime;
|
||||
serverComponents?: boolean;
|
||||
assetPrefix?: string;
|
||||
fontLoaderManifest?: FontLoaderManifest;
|
||||
isBot?: boolean;
|
||||
incrementalCache?: import('./lib/incremental-cache').IncrementalCache;
|
||||
isRevalidate?: boolean;
|
||||
};
|
||||
export declare type RenderOpts = LoadComponentsReturnType & RenderOptsPartial;
|
||||
export declare type DynamicParamTypesShort = 'c' | 'oc' | 'd';
|
||||
/**
|
||||
* Segment in the router state.
|
||||
*/
|
||||
export declare type Segment = string | [param: string, value: string, type: DynamicParamTypesShort];
|
||||
/**
|
||||
* Router state
|
||||
*/
|
||||
export declare type FlightRouterState = [
|
||||
segment: Segment,
|
||||
parallelRoutes: {
|
||||
[parallelRouterKey: string]: FlightRouterState;
|
||||
},
|
||||
url?: string,
|
||||
refresh?: 'refetch',
|
||||
isRootLayout?: boolean
|
||||
];
|
||||
/**
|
||||
* Individual Flight response path
|
||||
*/
|
||||
export declare type FlightSegmentPath = any[] | [
|
||||
segment: Segment,
|
||||
parallelRouterKey: string,
|
||||
segment: Segment,
|
||||
parallelRouterKey: string,
|
||||
segment: Segment,
|
||||
parallelRouterKey: string
|
||||
];
|
||||
export declare type FlightDataPath = any[] | [
|
||||
...FlightSegmentPath[],
|
||||
Segment,
|
||||
FlightRouterState,
|
||||
React.ReactNode | null,
|
||||
// Can be null during prefetch if there's no loading component
|
||||
React.ReactNode | null
|
||||
];
|
||||
/**
|
||||
* The Flight response data
|
||||
*/
|
||||
export declare type FlightData = Array<FlightDataPath> | string;
|
||||
/**
|
||||
* Property holding the current subTreeData.
|
||||
*/
|
||||
export declare type ChildProp = {
|
||||
/**
|
||||
* Null indicates that the tree is partial
|
||||
*/
|
||||
current: React.ReactNode | null;
|
||||
segment: Segment;
|
||||
};
|
||||
export declare function renderToHTMLOrFlight(req: IncomingMessage, res: ServerResponse, pathname: string, query: NextParsedUrlQuery, renderOpts: RenderOpts): Promise<RenderResult | null>;
|
||||
export {};
|
||||
1260
kitabcitab/node_modules/next/dist/server/app-render.js
generated
vendored
Normal file
1260
kitabcitab/node_modules/next/dist/server/app-render.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1
kitabcitab/node_modules/next/dist/server/app-render.js.map
generated
vendored
Normal file
1
kitabcitab/node_modules/next/dist/server/app-render.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
48
kitabcitab/node_modules/next/dist/server/base-http/index.d.ts
generated
vendored
Normal file
48
kitabcitab/node_modules/next/dist/server/base-http/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
/// <reference types="node" />
|
||||
import type { IncomingHttpHeaders } from 'http';
|
||||
import type { I18NConfig } from '../config-shared';
|
||||
import { NextApiRequestCookies } from '../api-utils';
|
||||
export interface BaseNextRequestConfig {
|
||||
basePath: string | undefined;
|
||||
i18n?: I18NConfig;
|
||||
trailingSlash?: boolean | undefined;
|
||||
}
|
||||
export declare abstract class BaseNextRequest<Body = any> {
|
||||
method: string;
|
||||
url: string;
|
||||
body: Body;
|
||||
protected _cookies: NextApiRequestCookies | undefined;
|
||||
abstract headers: IncomingHttpHeaders;
|
||||
constructor(method: string, url: string, body: Body);
|
||||
abstract parseBody(limit: string | number): Promise<any>;
|
||||
get cookies(): Partial<{
|
||||
[key: string]: string;
|
||||
}>;
|
||||
}
|
||||
export declare abstract class BaseNextResponse<Destination = any> {
|
||||
destination: Destination;
|
||||
abstract statusCode: number | undefined;
|
||||
abstract statusMessage: string | undefined;
|
||||
abstract get sent(): boolean;
|
||||
constructor(destination: Destination);
|
||||
/**
|
||||
* Sets a value for the header overwriting existing values
|
||||
*/
|
||||
abstract setHeader(name: string, value: string | string[]): this;
|
||||
/**
|
||||
* Appends value for the given header name
|
||||
*/
|
||||
abstract appendHeader(name: string, value: string): this;
|
||||
/**
|
||||
* Get all vaues for a header as an array or undefined if no value is present
|
||||
*/
|
||||
abstract getHeaderValues(name: string): string[] | undefined;
|
||||
abstract hasHeader(name: string): boolean;
|
||||
/**
|
||||
* Get vaues for a header concatenated using `,` or undefined if no value is present
|
||||
*/
|
||||
abstract getHeader(name: string): string | undefined;
|
||||
abstract body(value: string): this;
|
||||
abstract send(): void;
|
||||
redirect(destination: string, statusCode: number): this;
|
||||
}
|
||||
38
kitabcitab/node_modules/next/dist/server/base-http/index.js
generated
vendored
Normal file
38
kitabcitab/node_modules/next/dist/server/base-http/index.js
generated
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
var _constants = require("../../shared/lib/constants");
|
||||
var _apiUtils = require("../api-utils");
|
||||
class BaseNextRequest {
|
||||
constructor(method, url, body){
|
||||
this.method = method;
|
||||
this.url = url;
|
||||
this.body = body;
|
||||
}
|
||||
// Utils implemented using the abstract methods above
|
||||
get cookies() {
|
||||
if (this._cookies) return this._cookies;
|
||||
return this._cookies = (0, _apiUtils).getCookieParser(this.headers)();
|
||||
}
|
||||
}
|
||||
exports.BaseNextRequest = BaseNextRequest;
|
||||
class BaseNextResponse {
|
||||
constructor(destination){
|
||||
this.destination = destination;
|
||||
}
|
||||
// Utils implemented using the abstract methods above
|
||||
redirect(destination, statusCode) {
|
||||
this.setHeader("Location", destination);
|
||||
this.statusCode = statusCode;
|
||||
// Since IE11 doesn't support the 308 header add backwards
|
||||
// compatibility using refresh header
|
||||
if (statusCode === _constants.PERMANENT_REDIRECT_STATUS) {
|
||||
this.setHeader("Refresh", `0;url=${destination}`);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
}
|
||||
exports.BaseNextResponse = BaseNextResponse;
|
||||
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
kitabcitab/node_modules/next/dist/server/base-http/index.js.map
generated
vendored
Normal file
1
kitabcitab/node_modules/next/dist/server/base-http/index.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../server/base-http/index.ts"],"names":["BaseNextRequest","constructor","method","url","body","cookies","_cookies","getCookieParser","headers","BaseNextResponse","destination","redirect","statusCode","setHeader","PERMANENT_REDIRECT_STATUS"],"mappings":"AAAA;;;;AAG0C,IAAA,UAA4B,WAA5B,4BAA4B,CAAA;AACf,IAAA,SAAc,WAAd,cAAc,CAAA;AAQ9D,MAAeA,eAAe;IAInCC,YAAmBC,MAAc,EAASC,GAAW,EAASC,IAAU,CAAE;aAAvDF,MAAc,GAAdA,MAAc;aAASC,GAAW,GAAXA,GAAW;aAASC,IAAU,GAAVA,IAAU;KAAI;IAI5E,qDAAqD;IAErD,IAAWC,OAAO,GAAG;QACnB,IAAI,IAAI,CAACC,QAAQ,EAAE,OAAO,IAAI,CAACA,QAAQ,CAAA;QACvC,OAAQ,IAAI,CAACA,QAAQ,GAAGC,CAAAA,GAAAA,SAAe,AAAc,CAAA,gBAAd,CAAC,IAAI,CAACC,OAAO,CAAC,EAAE,CAAC;KACzD;CACF;QAdqBR,eAAe,GAAfA,eAAe;AAgB9B,MAAeS,gBAAgB;IAKpCR,YAAmBS,WAAwB,CAAE;aAA1BA,WAAwB,GAAxBA,WAAwB;KAAI;IA4B/C,qDAAqD;IAErDC,QAAQ,CAACD,WAAmB,EAAEE,UAAkB,EAAE;QAChD,IAAI,CAACC,SAAS,CAAC,UAAU,EAAEH,WAAW,CAAC;QACvC,IAAI,CAACE,UAAU,GAAGA,UAAU;QAE5B,0DAA0D;QAC1D,qCAAqC;QACrC,IAAIA,UAAU,KAAKE,UAAyB,0BAAA,EAAE;YAC5C,IAAI,CAACD,SAAS,CAAC,SAAS,EAAE,CAAC,MAAM,EAAEH,WAAW,CAAC,CAAC,CAAC;SAClD;QACD,OAAO,IAAI,CAAA;KACZ;CACF;QA9CqBD,gBAAgB,GAAhBA,gBAAgB"}
|
||||
45
kitabcitab/node_modules/next/dist/server/base-http/node.d.ts
generated
vendored
Normal file
45
kitabcitab/node_modules/next/dist/server/base-http/node.d.ts
generated
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
/// <reference types="node" />
|
||||
/// <reference types="node" />
|
||||
import type { ServerResponse, IncomingMessage } from 'http';
|
||||
import type { Writable, Readable } from 'stream';
|
||||
import type { SizeLimit } from 'next/types';
|
||||
import { NextApiRequestCookies, SYMBOL_CLEARED_COOKIES } from '../api-utils';
|
||||
import { NEXT_REQUEST_META, RequestMeta } from '../request-meta';
|
||||
import { BaseNextRequest, BaseNextResponse } from './index';
|
||||
declare type Req = IncomingMessage & {
|
||||
[NEXT_REQUEST_META]?: RequestMeta;
|
||||
cookies?: NextApiRequestCookies;
|
||||
};
|
||||
export declare class NodeNextRequest extends BaseNextRequest<Readable> {
|
||||
private _req;
|
||||
headers: import("http").IncomingHttpHeaders;
|
||||
[NEXT_REQUEST_META]: RequestMeta;
|
||||
get originalRequest(): Req;
|
||||
set originalRequest(value: Req);
|
||||
constructor(_req: Req);
|
||||
parseBody(limit: SizeLimit): Promise<any>;
|
||||
}
|
||||
export declare class NodeNextResponse extends BaseNextResponse<Writable> {
|
||||
private _res;
|
||||
private textBody;
|
||||
[SYMBOL_CLEARED_COOKIES]?: boolean;
|
||||
get originalResponse(): ServerResponse & {
|
||||
[SYMBOL_CLEARED_COOKIES]?: boolean | undefined;
|
||||
};
|
||||
constructor(_res: ServerResponse & {
|
||||
[SYMBOL_CLEARED_COOKIES]?: boolean;
|
||||
});
|
||||
get sent(): boolean;
|
||||
get statusCode(): number;
|
||||
set statusCode(value: number);
|
||||
get statusMessage(): string;
|
||||
set statusMessage(value: string);
|
||||
setHeader(name: string, value: string | string[]): this;
|
||||
getHeaderValues(name: string): string[] | undefined;
|
||||
hasHeader(name: string): boolean;
|
||||
getHeader(name: string): string | undefined;
|
||||
appendHeader(name: string, value: string): this;
|
||||
body(value: string): this;
|
||||
send(): void;
|
||||
}
|
||||
export {};
|
||||
98
kitabcitab/node_modules/next/dist/server/base-http/node.js
generated
vendored
Normal file
98
kitabcitab/node_modules/next/dist/server/base-http/node.js
generated
vendored
Normal file
@@ -0,0 +1,98 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
var _apiUtils = require("../api-utils");
|
||||
var _node = require("../api-utils/node");
|
||||
var _requestMeta = require("../request-meta");
|
||||
var _index = require("./index");
|
||||
let _NEXT_REQUEST_META = _requestMeta.NEXT_REQUEST_META;
|
||||
class NodeNextRequest extends _index.BaseNextRequest {
|
||||
get originalRequest() {
|
||||
// Need to mimic these changes to the original req object for places where we use it:
|
||||
// render.tsx, api/ssg requests
|
||||
this._req[_requestMeta.NEXT_REQUEST_META] = this[_requestMeta.NEXT_REQUEST_META];
|
||||
this._req.url = this.url;
|
||||
this._req.cookies = this.cookies;
|
||||
return this._req;
|
||||
}
|
||||
set originalRequest(value) {
|
||||
this._req = value;
|
||||
}
|
||||
constructor(_req){
|
||||
super(_req.method.toUpperCase(), _req.url, _req);
|
||||
this._req = _req;
|
||||
this.headers = this._req.headers;
|
||||
this[_NEXT_REQUEST_META] = {};
|
||||
}
|
||||
async parseBody(limit) {
|
||||
return (0, _node).parseBody(this._req, limit);
|
||||
}
|
||||
}
|
||||
exports.NodeNextRequest = NodeNextRequest;
|
||||
class NodeNextResponse extends _index.BaseNextResponse {
|
||||
get originalResponse() {
|
||||
if (_apiUtils.SYMBOL_CLEARED_COOKIES in this) {
|
||||
this._res[_apiUtils.SYMBOL_CLEARED_COOKIES] = this[_apiUtils.SYMBOL_CLEARED_COOKIES];
|
||||
}
|
||||
return this._res;
|
||||
}
|
||||
constructor(_res){
|
||||
super(_res);
|
||||
this._res = _res;
|
||||
this.textBody = undefined;
|
||||
}
|
||||
get sent() {
|
||||
return this._res.finished || this._res.headersSent;
|
||||
}
|
||||
get statusCode() {
|
||||
return this._res.statusCode;
|
||||
}
|
||||
set statusCode(value) {
|
||||
this._res.statusCode = value;
|
||||
}
|
||||
get statusMessage() {
|
||||
return this._res.statusMessage;
|
||||
}
|
||||
set statusMessage(value) {
|
||||
this._res.statusMessage = value;
|
||||
}
|
||||
setHeader(name, value) {
|
||||
this._res.setHeader(name, value);
|
||||
return this;
|
||||
}
|
||||
getHeaderValues(name) {
|
||||
const values = this._res.getHeader(name);
|
||||
if (values === undefined) return undefined;
|
||||
return (Array.isArray(values) ? values : [
|
||||
values
|
||||
]).map((value)=>value.toString());
|
||||
}
|
||||
hasHeader(name) {
|
||||
return this._res.hasHeader(name);
|
||||
}
|
||||
getHeader(name) {
|
||||
const values = this.getHeaderValues(name);
|
||||
return Array.isArray(values) ? values.join(",") : undefined;
|
||||
}
|
||||
appendHeader(name, value) {
|
||||
const currentValues = this.getHeaderValues(name) ?? [];
|
||||
if (!currentValues.includes(value)) {
|
||||
this._res.setHeader(name, [
|
||||
...currentValues,
|
||||
value
|
||||
]);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
body(value) {
|
||||
this.textBody = value;
|
||||
return this;
|
||||
}
|
||||
send() {
|
||||
this._res.end(this.textBody);
|
||||
}
|
||||
}
|
||||
exports.NodeNextResponse = NodeNextResponse;
|
||||
|
||||
//# sourceMappingURL=node.js.map
|
||||
1
kitabcitab/node_modules/next/dist/server/base-http/node.js.map
generated
vendored
Normal file
1
kitabcitab/node_modules/next/dist/server/base-http/node.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../server/base-http/node.ts"],"names":["NEXT_REQUEST_META","NodeNextRequest","BaseNextRequest","originalRequest","_req","url","cookies","value","constructor","method","toUpperCase","headers","parseBody","limit","NodeNextResponse","BaseNextResponse","originalResponse","SYMBOL_CLEARED_COOKIES","_res","textBody","undefined","sent","finished","headersSent","statusCode","statusMessage","setHeader","name","getHeaderValues","values","getHeader","Array","isArray","map","toString","hasHeader","join","appendHeader","currentValues","includes","body","send","end"],"mappings":"AAAA;;;;AAI8D,IAAA,SAAc,WAAd,cAAc,CAAA;AAClD,IAAA,KAAmB,WAAnB,mBAAmB,CAAA;AACE,IAAA,YAAiB,WAAjB,iBAAiB,CAAA;AAEd,IAAA,MAAS,WAAT,SAAS,CAAA;IAUxDA,kBAAiB,GAAjBA,YAAiB,kBAAA;AAHb,MAAMC,eAAe,SAASC,MAAe,gBAAA;IAKlD,IAAIC,eAAe,GAAG;QACpB,qFAAqF;QACrF,+BAA+B;QAC/B,IAAI,CAACC,IAAI,CAACJ,YAAiB,kBAAA,CAAC,GAAG,IAAI,CAACA,YAAiB,kBAAA,CAAC;QACtD,IAAI,CAACI,IAAI,CAACC,GAAG,GAAG,IAAI,CAACA,GAAG;QACxB,IAAI,CAACD,IAAI,CAACE,OAAO,GAAG,IAAI,CAACA,OAAO;QAChC,OAAO,IAAI,CAACF,IAAI,CAAA;KACjB;IAED,IAAID,eAAe,CAACI,KAAU,EAAE;QAC9B,IAAI,CAACH,IAAI,GAAGG,KAAK;KAClB;IAEDC,YAAoBJ,IAAS,CAAE;QAC7B,KAAK,CAACA,IAAI,CAACK,MAAM,CAAEC,WAAW,EAAE,EAAEN,IAAI,CAACC,GAAG,EAAGD,IAAI,CAAC;aADhCA,IAAS,GAATA,IAAS;aAjBtBO,OAAO,GAAG,IAAI,CAACP,IAAI,CAACO,OAAO;YAElC,CAACX,kBAAiB,CAAC,GAAgB,EAAE;KAiBpC;IAED,MAAMY,SAAS,CAACC,KAAgB,EAAgB;QAC9C,OAAOD,CAAAA,GAAAA,KAAS,AAAkB,CAAA,UAAlB,CAAC,IAAI,CAACR,IAAI,EAAES,KAAK,CAAC,CAAA;KACnC;CACF;QAzBYZ,eAAe,GAAfA,eAAe;AA2BrB,MAAMa,gBAAgB,SAASC,MAAgB,iBAAA;IAKpD,IAAIC,gBAAgB,GAAG;QACrB,IAAIC,SAAsB,uBAAA,IAAI,IAAI,EAAE;YAClC,IAAI,CAACC,IAAI,CAACD,SAAsB,uBAAA,CAAC,GAAG,IAAI,CAACA,SAAsB,uBAAA,CAAC;SACjE;QAED,OAAO,IAAI,CAACC,IAAI,CAAA;KACjB;IAEDV,YACUU,IAA6D,CACrE;QACA,KAAK,CAACA,IAAI,CAAC;aAFHA,IAA6D,GAA7DA,IAA6D;aAb/DC,QAAQ,GAAuBC,SAAS;KAgB/C;IAED,IAAIC,IAAI,GAAG;QACT,OAAO,IAAI,CAACH,IAAI,CAACI,QAAQ,IAAI,IAAI,CAACJ,IAAI,CAACK,WAAW,CAAA;KACnD;IAED,IAAIC,UAAU,GAAG;QACf,OAAO,IAAI,CAACN,IAAI,CAACM,UAAU,CAAA;KAC5B;IAED,IAAIA,UAAU,CAACjB,KAAa,EAAE;QAC5B,IAAI,CAACW,IAAI,CAACM,UAAU,GAAGjB,KAAK;KAC7B;IAED,IAAIkB,aAAa,GAAG;QAClB,OAAO,IAAI,CAACP,IAAI,CAACO,aAAa,CAAA;KAC/B;IAED,IAAIA,aAAa,CAAClB,KAAa,EAAE;QAC/B,IAAI,CAACW,IAAI,CAACO,aAAa,GAAGlB,KAAK;KAChC;IAEDmB,SAAS,CAACC,IAAY,EAAEpB,KAAwB,EAAQ;QACtD,IAAI,CAACW,IAAI,CAACQ,SAAS,CAACC,IAAI,EAAEpB,KAAK,CAAC;QAChC,OAAO,IAAI,CAAA;KACZ;IAEDqB,eAAe,CAACD,IAAY,EAAwB;QAClD,MAAME,MAAM,GAAG,IAAI,CAACX,IAAI,CAACY,SAAS,CAACH,IAAI,CAAC;QAExC,IAAIE,MAAM,KAAKT,SAAS,EAAE,OAAOA,SAAS,CAAA;QAE1C,OAAO,CAACW,KAAK,CAACC,OAAO,CAACH,MAAM,CAAC,GAAGA,MAAM,GAAG;YAACA,MAAM;SAAC,CAAC,CAACI,GAAG,CAAC,CAAC1B,KAAK,GAC3DA,KAAK,CAAC2B,QAAQ,EAAE,CACjB,CAAA;KACF;IAEDC,SAAS,CAACR,IAAY,EAAW;QAC/B,OAAO,IAAI,CAACT,IAAI,CAACiB,SAAS,CAACR,IAAI,CAAC,CAAA;KACjC;IAEDG,SAAS,CAACH,IAAY,EAAsB;QAC1C,MAAME,MAAM,GAAG,IAAI,CAACD,eAAe,CAACD,IAAI,CAAC;QACzC,OAAOI,KAAK,CAACC,OAAO,CAACH,MAAM,CAAC,GAAGA,MAAM,CAACO,IAAI,CAAC,GAAG,CAAC,GAAGhB,SAAS,CAAA;KAC5D;IAEDiB,YAAY,CAACV,IAAY,EAAEpB,KAAa,EAAQ;QAC9C,MAAM+B,aAAa,GAAG,IAAI,CAACV,eAAe,CAACD,IAAI,CAAC,IAAI,EAAE;QAEtD,IAAI,CAACW,aAAa,CAACC,QAAQ,CAAChC,KAAK,CAAC,EAAE;YAClC,IAAI,CAACW,IAAI,CAACQ,SAAS,CAACC,IAAI,EAAE;mBAAIW,aAAa;gBAAE/B,KAAK;aAAC,CAAC;SACrD;QAED,OAAO,IAAI,CAAA;KACZ;IAEDiC,IAAI,CAACjC,KAAa,EAAE;QAClB,IAAI,CAACY,QAAQ,GAAGZ,KAAK;QACrB,OAAO,IAAI,CAAA;KACZ;IAEDkC,IAAI,GAAG;QACL,IAAI,CAACvB,IAAI,CAACwB,GAAG,CAAC,IAAI,CAACvB,QAAQ,CAAC;KAC7B;CACF;QAjFYL,gBAAgB,GAAhBA,gBAAgB"}
|
||||
30
kitabcitab/node_modules/next/dist/server/base-http/web.d.ts
generated
vendored
Normal file
30
kitabcitab/node_modules/next/dist/server/base-http/web.d.ts
generated
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
/// <reference types="node" />
|
||||
import type { IncomingHttpHeaders } from 'http';
|
||||
import { BaseNextRequest, BaseNextResponse } from './index';
|
||||
export declare class WebNextRequest extends BaseNextRequest<ReadableStream | null> {
|
||||
request: Request;
|
||||
headers: IncomingHttpHeaders;
|
||||
constructor(request: Request);
|
||||
parseBody(_limit: string | number): Promise<any>;
|
||||
}
|
||||
export declare class WebNextResponse extends BaseNextResponse<WritableStream> {
|
||||
transformStream: TransformStream<any, any>;
|
||||
private headers;
|
||||
private textBody;
|
||||
private _sent;
|
||||
private sendPromise;
|
||||
private sendResolve?;
|
||||
private response;
|
||||
statusCode: number | undefined;
|
||||
statusMessage: string | undefined;
|
||||
get sent(): boolean;
|
||||
constructor(transformStream?: TransformStream<any, any>);
|
||||
setHeader(name: string, value: string | string[]): this;
|
||||
getHeaderValues(name: string): string[] | undefined;
|
||||
getHeader(name: string): string | undefined;
|
||||
hasHeader(name: string): boolean;
|
||||
appendHeader(name: string, value: string): this;
|
||||
body(value: string): this;
|
||||
send(): void;
|
||||
toResponse(): Promise<Response>;
|
||||
}
|
||||
81
kitabcitab/node_modules/next/dist/server/base-http/web.js
generated
vendored
Normal file
81
kitabcitab/node_modules/next/dist/server/base-http/web.js
generated
vendored
Normal file
@@ -0,0 +1,81 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
var _index = require("./index");
|
||||
class WebNextRequest extends _index.BaseNextRequest {
|
||||
constructor(request){
|
||||
const url = new URL(request.url);
|
||||
super(request.method, url.href.slice(url.origin.length), request.clone().body);
|
||||
this.request = request;
|
||||
this.headers = {};
|
||||
for (const [name, value] of request.headers.entries()){
|
||||
this.headers[name] = value;
|
||||
}
|
||||
}
|
||||
async parseBody(_limit) {
|
||||
throw new Error("parseBody is not implemented in the web runtime");
|
||||
}
|
||||
}
|
||||
exports.WebNextRequest = WebNextRequest;
|
||||
class WebNextResponse extends _index.BaseNextResponse {
|
||||
get sent() {
|
||||
return this._sent;
|
||||
}
|
||||
constructor(transformStream = new TransformStream()){
|
||||
super(transformStream.writable);
|
||||
this.transformStream = transformStream;
|
||||
this.headers = new Headers();
|
||||
this.textBody = undefined;
|
||||
this._sent = false;
|
||||
this.sendPromise = new Promise((resolve)=>{
|
||||
this.sendResolve = resolve;
|
||||
});
|
||||
this.response = this.sendPromise.then(()=>{
|
||||
return new Response(this.textBody ?? this.transformStream.readable, {
|
||||
headers: this.headers,
|
||||
status: this.statusCode,
|
||||
statusText: this.statusMessage
|
||||
});
|
||||
});
|
||||
}
|
||||
setHeader(name, value) {
|
||||
this.headers.delete(name);
|
||||
for (const val of Array.isArray(value) ? value : [
|
||||
value
|
||||
]){
|
||||
this.headers.append(name, val);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
getHeaderValues(name) {
|
||||
var ref;
|
||||
// https://developer.mozilla.org/en-US/docs/Web/API/Headers/get#example
|
||||
return (ref = this.getHeader(name)) == null ? void 0 : ref.split(",").map((v)=>v.trimStart());
|
||||
}
|
||||
getHeader(name) {
|
||||
return this.headers.get(name) ?? undefined;
|
||||
}
|
||||
hasHeader(name) {
|
||||
return this.headers.has(name);
|
||||
}
|
||||
appendHeader(name, value) {
|
||||
this.headers.append(name, value);
|
||||
return this;
|
||||
}
|
||||
body(value) {
|
||||
this.textBody = value;
|
||||
return this;
|
||||
}
|
||||
send() {
|
||||
var _obj, ref;
|
||||
(ref = (_obj = this).sendResolve) == null ? void 0 : ref.call(_obj);
|
||||
this._sent = true;
|
||||
}
|
||||
toResponse() {
|
||||
return this.response;
|
||||
}
|
||||
}
|
||||
exports.WebNextResponse = WebNextResponse;
|
||||
|
||||
//# sourceMappingURL=web.js.map
|
||||
1
kitabcitab/node_modules/next/dist/server/base-http/web.js.map
generated
vendored
Normal file
1
kitabcitab/node_modules/next/dist/server/base-http/web.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../server/base-http/web.ts"],"names":["WebNextRequest","BaseNextRequest","constructor","request","url","URL","method","href","slice","origin","length","clone","body","headers","name","value","entries","parseBody","_limit","Error","WebNextResponse","BaseNextResponse","sent","_sent","transformStream","TransformStream","writable","Headers","textBody","undefined","sendPromise","Promise","resolve","sendResolve","response","then","Response","readable","status","statusCode","statusText","statusMessage","setHeader","delete","val","Array","isArray","append","getHeaderValues","getHeader","split","map","v","trimStart","get","hasHeader","has","appendHeader","send","toResponse"],"mappings":"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"}
|
||||
259
kitabcitab/node_modules/next/dist/server/base-server.d.ts
generated
vendored
Normal file
259
kitabcitab/node_modules/next/dist/server/base-server.d.ts
generated
vendored
Normal file
@@ -0,0 +1,259 @@
|
||||
/// <reference types="node" />
|
||||
/// <reference types="node" />
|
||||
import type { __ApiPreviewProps } from './api-utils';
|
||||
import type { CustomRoutes } from '../lib/load-custom-routes';
|
||||
import type { DomainLocale } from './config';
|
||||
import type { DynamicRoutes, PageChecker, Route } from './router';
|
||||
import type { FontManifest, FontConfig } from './font-utils';
|
||||
import type { LoadComponentsReturnType } from './load-components';
|
||||
import type { RouteMatch } from '../shared/lib/router/utils/route-matcher';
|
||||
import type { MiddlewareRouteMatch } from '../shared/lib/router/utils/middleware-route-matcher';
|
||||
import type { Params } from '../shared/lib/router/utils/route-matcher';
|
||||
import type { NextConfig, NextConfigComplete } from './config-shared';
|
||||
import type { NextParsedUrlQuery, NextUrlWithParsedQuery } from './request-meta';
|
||||
import type { ParsedUrlQuery } from 'querystring';
|
||||
import type { RenderOpts, RenderOptsPartial } from './render';
|
||||
import type { ResponseCacheBase } from './response-cache';
|
||||
import type { UrlWithParsedQuery } from 'url';
|
||||
import type { ServerRuntime } from 'next/types';
|
||||
import type { PagesManifest } from '../build/webpack/plugins/pages-manifest-plugin';
|
||||
import type { BaseNextRequest, BaseNextResponse } from './base-http';
|
||||
import type { PayloadOptions } from './send-payload';
|
||||
import type { PrerenderManifest } from '../build';
|
||||
import type { FontLoaderManifest } from '../build/webpack/plugins/font-loader-manifest-plugin';
|
||||
import Router from './router';
|
||||
import RenderResult from './render-result';
|
||||
import { ImageConfigComplete } from '../shared/lib/image-config';
|
||||
import { MiddlewareMatcher } from '../build/analysis/get-page-static-info';
|
||||
export declare type FindComponentsResult = {
|
||||
components: LoadComponentsReturnType;
|
||||
query: NextParsedUrlQuery;
|
||||
};
|
||||
export interface RoutingItem {
|
||||
page: string;
|
||||
match: RouteMatch;
|
||||
re?: RegExp;
|
||||
}
|
||||
export interface MiddlewareRoutingItem {
|
||||
page: string;
|
||||
match: MiddlewareRouteMatch;
|
||||
matchers?: MiddlewareMatcher[];
|
||||
}
|
||||
export interface Options {
|
||||
/**
|
||||
* Object containing the configuration next.config.js
|
||||
*/
|
||||
conf: NextConfig;
|
||||
/**
|
||||
* Set to false when the server was created by Next.js
|
||||
*/
|
||||
customServer?: boolean;
|
||||
/**
|
||||
* Tells if Next.js is running in dev mode
|
||||
*/
|
||||
dev?: boolean;
|
||||
/**
|
||||
* Where the Next project is located
|
||||
*/
|
||||
dir?: string;
|
||||
/**
|
||||
* Tells if Next.js is running in a Serverless platform
|
||||
*/
|
||||
minimalMode?: boolean;
|
||||
/**
|
||||
* Hide error messages containing server information
|
||||
*/
|
||||
quiet?: boolean;
|
||||
/**
|
||||
* The hostname the server is running behind
|
||||
*/
|
||||
hostname?: string;
|
||||
/**
|
||||
* The port the server is running behind
|
||||
*/
|
||||
port?: number;
|
||||
/**
|
||||
* The HTTP Server that Next.js is running behind
|
||||
*/
|
||||
httpServer?: import('http').Server;
|
||||
}
|
||||
export interface BaseRequestHandler {
|
||||
(req: BaseNextRequest, res: BaseNextResponse, parsedUrl?: NextUrlWithParsedQuery | undefined): Promise<void>;
|
||||
}
|
||||
export declare type RequestContext = {
|
||||
req: BaseNextRequest;
|
||||
res: BaseNextResponse;
|
||||
pathname: string;
|
||||
query: NextParsedUrlQuery;
|
||||
renderOpts: RenderOptsPartial;
|
||||
};
|
||||
export declare class NoFallbackError extends Error {
|
||||
}
|
||||
export declare class WrappedBuildError extends Error {
|
||||
innerError: Error;
|
||||
constructor(innerError: Error);
|
||||
}
|
||||
declare type ResponsePayload = {
|
||||
type: 'html' | 'json' | 'rsc';
|
||||
body: RenderResult;
|
||||
revalidateOptions?: any;
|
||||
};
|
||||
export default abstract class Server<ServerOptions extends Options = Options> {
|
||||
protected dir: string;
|
||||
protected quiet: boolean;
|
||||
protected nextConfig: NextConfigComplete;
|
||||
protected distDir: string;
|
||||
protected publicDir: string;
|
||||
protected hasStaticDir: boolean;
|
||||
protected hasAppDir: boolean;
|
||||
protected pagesManifest?: PagesManifest;
|
||||
protected appPathsManifest?: PagesManifest;
|
||||
protected buildId: string;
|
||||
protected minimalMode: boolean;
|
||||
protected renderOpts: {
|
||||
poweredByHeader: boolean;
|
||||
buildId: string;
|
||||
generateEtags: boolean;
|
||||
runtimeConfig?: {
|
||||
[key: string]: any;
|
||||
};
|
||||
assetPrefix?: string;
|
||||
canonicalBase: string;
|
||||
dev?: boolean;
|
||||
previewProps: __ApiPreviewProps;
|
||||
customServer?: boolean;
|
||||
ampOptimizerConfig?: {
|
||||
[key: string]: any;
|
||||
};
|
||||
basePath: string;
|
||||
optimizeFonts: FontConfig;
|
||||
images: ImageConfigComplete;
|
||||
fontManifest?: FontManifest;
|
||||
disableOptimizedLoading?: boolean;
|
||||
optimizeCss: any;
|
||||
nextScriptWorkers: any;
|
||||
locale?: string;
|
||||
locales?: string[];
|
||||
defaultLocale?: string;
|
||||
domainLocales?: DomainLocale[];
|
||||
distDir: string;
|
||||
runtime?: ServerRuntime;
|
||||
serverComponents?: boolean;
|
||||
crossOrigin?: string;
|
||||
supportsDynamicHTML?: boolean;
|
||||
isBot?: boolean;
|
||||
serverComponentManifest?: any;
|
||||
serverCSSManifest?: any;
|
||||
fontLoaderManifest?: FontLoaderManifest;
|
||||
renderServerComponentData?: boolean;
|
||||
serverComponentProps?: any;
|
||||
largePageDataBytes?: number;
|
||||
};
|
||||
protected serverOptions: ServerOptions;
|
||||
private responseCache;
|
||||
protected router: Router;
|
||||
protected dynamicRoutes?: DynamicRoutes;
|
||||
protected appPathRoutes?: Record<string, string[]>;
|
||||
protected customRoutes: CustomRoutes;
|
||||
protected serverComponentManifest?: any;
|
||||
protected serverCSSManifest?: any;
|
||||
protected fontLoaderManifest?: FontLoaderManifest;
|
||||
readonly hostname?: string;
|
||||
readonly port?: number;
|
||||
protected abstract getPublicDir(): string;
|
||||
protected abstract getHasStaticDir(): boolean;
|
||||
protected abstract getHasAppDir(dev: boolean): boolean;
|
||||
protected abstract getPagesManifest(): PagesManifest | undefined;
|
||||
protected abstract getAppPathsManifest(): PagesManifest | undefined;
|
||||
protected abstract getBuildId(): string;
|
||||
protected abstract getFilesystemPaths(): Set<string>;
|
||||
protected abstract findPageComponents(params: {
|
||||
pathname: string;
|
||||
query: NextParsedUrlQuery;
|
||||
params: Params;
|
||||
isAppPath: boolean;
|
||||
appPaths?: string[] | null;
|
||||
sriEnabled?: boolean;
|
||||
}): Promise<FindComponentsResult | null>;
|
||||
protected abstract getFontManifest(): FontManifest | undefined;
|
||||
protected abstract getPrerenderManifest(): PrerenderManifest;
|
||||
protected abstract getServerComponentManifest(): any;
|
||||
protected abstract getServerCSSManifest(): any;
|
||||
protected abstract getFontLoaderManifest(): FontLoaderManifest | undefined;
|
||||
protected abstract attachRequestMeta(req: BaseNextRequest, parsedUrl: NextUrlWithParsedQuery): void;
|
||||
protected abstract getFallback(page: string): Promise<string>;
|
||||
protected abstract getCustomRoutes(): CustomRoutes;
|
||||
protected abstract hasPage(pathname: string): Promise<boolean>;
|
||||
protected abstract generateRoutes(): {
|
||||
headers: Route[];
|
||||
rewrites: {
|
||||
beforeFiles: Route[];
|
||||
afterFiles: Route[];
|
||||
fallback: Route[];
|
||||
};
|
||||
fsRoutes: Route[];
|
||||
redirects: Route[];
|
||||
catchAllRoute: Route;
|
||||
catchAllMiddleware: Route[];
|
||||
pageChecker: PageChecker;
|
||||
useFileSystemPublicRoutes: boolean;
|
||||
dynamicRoutes: DynamicRoutes | undefined;
|
||||
nextConfig: NextConfig;
|
||||
};
|
||||
protected abstract sendRenderResult(req: BaseNextRequest, res: BaseNextResponse, options: {
|
||||
result: RenderResult;
|
||||
type: 'html' | 'json' | 'rsc';
|
||||
generateEtags: boolean;
|
||||
poweredByHeader: boolean;
|
||||
options?: PayloadOptions;
|
||||
}): Promise<void>;
|
||||
protected abstract runApi(req: BaseNextRequest, res: BaseNextResponse, query: ParsedUrlQuery, params: Params | undefined, page: string, builtPagePath: string): Promise<boolean>;
|
||||
protected abstract renderHTML(req: BaseNextRequest, res: BaseNextResponse, pathname: string, query: NextParsedUrlQuery, renderOpts: RenderOpts): Promise<RenderResult | null>;
|
||||
protected abstract handleCompression(req: BaseNextRequest, res: BaseNextResponse): void;
|
||||
protected abstract getIncrementalCache(options: {
|
||||
requestHeaders: Record<string, undefined | string | string[]>;
|
||||
}): import('./lib/incremental-cache').IncrementalCache;
|
||||
protected abstract getResponseCache(options: {
|
||||
dev: boolean;
|
||||
}): ResponseCacheBase;
|
||||
protected abstract loadEnvConfig(params: {
|
||||
dev: boolean;
|
||||
forceReload?: boolean;
|
||||
}): void;
|
||||
constructor(options: ServerOptions);
|
||||
logError(err: Error): void;
|
||||
private handleRequest;
|
||||
getRequestHandler(): BaseRequestHandler;
|
||||
protected handleUpgrade(_req: BaseNextRequest, _socket: any, _head?: any): Promise<void>;
|
||||
setAssetPrefix(prefix?: string): void;
|
||||
prepare(): Promise<void>;
|
||||
protected close(): Promise<void>;
|
||||
protected getPreviewProps(): __ApiPreviewProps;
|
||||
protected _beforeCatchAllRender(_req: BaseNextRequest, _res: BaseNextResponse, _params: Params, _parsedUrl: UrlWithParsedQuery): Promise<boolean>;
|
||||
protected getDynamicRoutes(): Array<RoutingItem>;
|
||||
protected getAppPathRoutes(): Record<string, string[]>;
|
||||
protected run(req: BaseNextRequest, res: BaseNextResponse, parsedUrl: UrlWithParsedQuery): Promise<void>;
|
||||
private pipe;
|
||||
private getStaticHTML;
|
||||
render(req: BaseNextRequest, res: BaseNextResponse, pathname: string, query?: NextParsedUrlQuery, parsedUrl?: NextUrlWithParsedQuery, internalRender?: boolean): Promise<void>;
|
||||
protected getStaticPaths({ pathname, }: {
|
||||
pathname: string;
|
||||
originalAppPath?: string;
|
||||
}): Promise<{
|
||||
staticPaths?: string[];
|
||||
fallbackMode?: 'static' | 'blocking' | false;
|
||||
}>;
|
||||
private renderToResponseWithComponents;
|
||||
private stripNextDataPath;
|
||||
protected getOriginalAppPaths(route: string): string[] | null;
|
||||
protected renderPageComponent(ctx: RequestContext, bubbleNoFallback: boolean): Promise<false | ResponsePayload | null>;
|
||||
private renderToResponse;
|
||||
renderToHTML(req: BaseNextRequest, res: BaseNextResponse, pathname: string, query?: ParsedUrlQuery): Promise<string | null>;
|
||||
renderError(err: Error | null, req: BaseNextRequest, res: BaseNextResponse, pathname: string, query?: NextParsedUrlQuery, setHeaders?: boolean): Promise<void>;
|
||||
private customErrorNo404Warn;
|
||||
private renderErrorToResponse;
|
||||
renderErrorToHTML(err: Error | null, req: BaseNextRequest, res: BaseNextResponse, pathname: string, query?: ParsedUrlQuery): Promise<string | null>;
|
||||
protected getFallbackErrorComponents(): Promise<LoadComponentsReturnType | null>;
|
||||
render404(req: BaseNextRequest, res: BaseNextResponse, parsedUrl?: NextUrlWithParsedQuery, setHeaders?: boolean): Promise<void>;
|
||||
}
|
||||
export {};
|
||||
1244
kitabcitab/node_modules/next/dist/server/base-server.js
generated
vendored
Normal file
1244
kitabcitab/node_modules/next/dist/server/base-server.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1
kitabcitab/node_modules/next/dist/server/base-server.js.map
generated
vendored
Normal file
1
kitabcitab/node_modules/next/dist/server/base-server.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
12
kitabcitab/node_modules/next/dist/server/body-streams.d.ts
generated
vendored
Normal file
12
kitabcitab/node_modules/next/dist/server/body-streams.d.ts
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
/// <reference types="node" />
|
||||
/// <reference types="node" />
|
||||
import type { IncomingMessage } from 'http';
|
||||
import { Readable } from 'stream';
|
||||
export declare function requestToBodyStream(context: {
|
||||
ReadableStream: typeof ReadableStream;
|
||||
}, KUint8Array: typeof Uint8Array, stream: Readable): ReadableStream<any>;
|
||||
export interface ClonableBody {
|
||||
finalize(): Promise<void>;
|
||||
cloneBodyStream(): Readable;
|
||||
}
|
||||
export declare function getClonableBody<T extends IncomingMessage>(readable: T): ClonableBody;
|
||||
75
kitabcitab/node_modules/next/dist/server/body-streams.js
generated
vendored
Normal file
75
kitabcitab/node_modules/next/dist/server/body-streams.js
generated
vendored
Normal file
@@ -0,0 +1,75 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.requestToBodyStream = requestToBodyStream;
|
||||
exports.getClonableBody = getClonableBody;
|
||||
var _stream = require("stream");
|
||||
function requestToBodyStream(context, KUint8Array, stream) {
|
||||
return new context.ReadableStream({
|
||||
start (controller) {
|
||||
stream.on("data", (chunk)=>controller.enqueue(new KUint8Array([
|
||||
...new Uint8Array(chunk)
|
||||
])));
|
||||
stream.on("end", ()=>controller.close());
|
||||
stream.on("error", (err)=>controller.error(err));
|
||||
}
|
||||
});
|
||||
}
|
||||
function replaceRequestBody(base, stream) {
|
||||
for(const key in stream){
|
||||
let v = stream[key];
|
||||
if (typeof v === "function") {
|
||||
v = v.bind(base);
|
||||
}
|
||||
base[key] = v;
|
||||
}
|
||||
return base;
|
||||
}
|
||||
function getClonableBody(readable) {
|
||||
let buffered = null;
|
||||
const endPromise = new Promise((resolve, reject)=>{
|
||||
readable.on("end", resolve);
|
||||
readable.on("error", reject);
|
||||
}).catch((error)=>{
|
||||
return {
|
||||
error
|
||||
};
|
||||
});
|
||||
return {
|
||||
/**
|
||||
* Replaces the original request body if necessary.
|
||||
* This is done because once we read the body from the original request,
|
||||
* we can't read it again.
|
||||
*/ async finalize () {
|
||||
if (buffered) {
|
||||
const res = await endPromise;
|
||||
if (res && typeof res === "object" && res.error) {
|
||||
throw res.error;
|
||||
}
|
||||
replaceRequestBody(readable, buffered);
|
||||
buffered = readable;
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Clones the body stream
|
||||
* to pass into a middleware
|
||||
*/ cloneBodyStream () {
|
||||
const input = buffered ?? readable;
|
||||
const p1 = new _stream.PassThrough();
|
||||
const p2 = new _stream.PassThrough();
|
||||
input.on("data", (chunk)=>{
|
||||
p1.push(chunk);
|
||||
p2.push(chunk);
|
||||
});
|
||||
input.on("end", ()=>{
|
||||
p1.push(null);
|
||||
p2.push(null);
|
||||
});
|
||||
buffered = p2;
|
||||
return p1;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
//# sourceMappingURL=body-streams.js.map
|
||||
1
kitabcitab/node_modules/next/dist/server/body-streams.js.map
generated
vendored
Normal file
1
kitabcitab/node_modules/next/dist/server/body-streams.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../server/body-streams.ts"],"names":["requestToBodyStream","getClonableBody","context","KUint8Array","stream","ReadableStream","start","controller","on","chunk","enqueue","Uint8Array","close","err","error","replaceRequestBody","base","key","v","bind","readable","buffered","endPromise","Promise","resolve","reject","catch","finalize","res","cloneBodyStream","input","p1","PassThrough","p2","push"],"mappings":"AAAA;;;;QAGgBA,mBAAmB,GAAnBA,mBAAmB;QAoCnBC,eAAe,GAAfA,eAAe;AAtCO,IAAA,OAAQ,WAAR,QAAQ,CAAA;AAEvC,SAASD,mBAAmB,CACjCE,OAAkD,EAClDC,WAA8B,EAC9BC,MAAgB,EAChB;IACA,OAAO,IAAIF,OAAO,CAACG,cAAc,CAAC;QAChCC,KAAK,EAACC,UAAU,EAAE;YAChBH,MAAM,CAACI,EAAE,CAAC,MAAM,EAAE,CAACC,KAAK,GACtBF,UAAU,CAACG,OAAO,CAAC,IAAIP,WAAW,CAAC;uBAAI,IAAIQ,UAAU,CAACF,KAAK,CAAC;iBAAC,CAAC,CAAC,CAChE;YACDL,MAAM,CAACI,EAAE,CAAC,KAAK,EAAE,IAAMD,UAAU,CAACK,KAAK,EAAE,CAAC;YAC1CR,MAAM,CAACI,EAAE,CAAC,OAAO,EAAE,CAACK,GAAG,GAAKN,UAAU,CAACO,KAAK,CAACD,GAAG,CAAC,CAAC;SACnD;KACF,CAAC,CAAA;CACH;AAED,SAASE,kBAAkB,CACzBC,IAAO,EACPZ,MAAgB,EACb;IACH,IAAK,MAAMa,GAAG,IAAIb,MAAM,CAAE;QACxB,IAAIc,CAAC,GAAGd,MAAM,CAACa,GAAG,CAAmB,AAAO;QAC5C,IAAI,OAAOC,CAAC,KAAK,UAAU,EAAE;YAC3BA,CAAC,GAAGA,CAAC,CAACC,IAAI,CAACH,IAAI,CAAC;SACjB;QACDA,IAAI,CAACC,GAAG,CAAY,GAAGC,CAAC;KACzB;IAED,OAAOF,IAAI,CAAA;CACZ;AAOM,SAASf,eAAe,CAC7BmB,QAAW,EACG;IACd,IAAIC,QAAQ,GAAoB,IAAI;IAEpC,MAAMC,UAAU,GAAG,IAAIC,OAAO,CAC5B,CAACC,OAAO,EAAEC,MAAM,GAAK;QACnBL,QAAQ,CAACZ,EAAE,CAAC,KAAK,EAAEgB,OAAO,CAAC;QAC3BJ,QAAQ,CAACZ,EAAE,CAAC,OAAO,EAAEiB,MAAM,CAAC;KAC7B,CACF,CAACC,KAAK,CAAC,CAACZ,KAAK,GAAK;QACjB,OAAO;YAAEA,KAAK;SAAE,CAAA;KACjB,CAAC;IAEF,OAAO;QACL;;;;OAIG,CACH,MAAMa,QAAQ,IAAkB;YAC9B,IAAIN,QAAQ,EAAE;gBACZ,MAAMO,GAAG,GAAG,MAAMN,UAAU;gBAE5B,IAAIM,GAAG,IAAI,OAAOA,GAAG,KAAK,QAAQ,IAAIA,GAAG,CAACd,KAAK,EAAE;oBAC/C,MAAMc,GAAG,CAACd,KAAK,CAAA;iBAChB;gBACDC,kBAAkB,CAACK,QAAQ,EAAEC,QAAQ,CAAC;gBACtCA,QAAQ,GAAGD,QAAQ;aACpB;SACF;QACD;;;OAGG,CACHS,eAAe,IAAG;YAChB,MAAMC,KAAK,GAAGT,QAAQ,IAAID,QAAQ;YAClC,MAAMW,EAAE,GAAG,IAAIC,OAAW,YAAA,EAAE;YAC5B,MAAMC,EAAE,GAAG,IAAID,OAAW,YAAA,EAAE;YAC5BF,KAAK,CAACtB,EAAE,CAAC,MAAM,EAAE,CAACC,KAAK,GAAK;gBAC1BsB,EAAE,CAACG,IAAI,CAACzB,KAAK,CAAC;gBACdwB,EAAE,CAACC,IAAI,CAACzB,KAAK,CAAC;aACf,CAAC;YACFqB,KAAK,CAACtB,EAAE,CAAC,KAAK,EAAE,IAAM;gBACpBuB,EAAE,CAACG,IAAI,CAAC,IAAI,CAAC;gBACbD,EAAE,CAACC,IAAI,CAAC,IAAI,CAAC;aACd,CAAC;YACFb,QAAQ,GAAGY,EAAE;YACb,OAAOF,EAAE,CAAA;SACV;KACF,CAAA;CACF"}
|
||||
1
kitabcitab/node_modules/next/dist/server/config-schema.d.ts
generated
vendored
Normal file
1
kitabcitab/node_modules/next/dist/server/config-schema.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export {};
|
||||
772
kitabcitab/node_modules/next/dist/server/config-schema.js
generated
vendored
Normal file
772
kitabcitab/node_modules/next/dist/server/config-schema.js
generated
vendored
Normal file
@@ -0,0 +1,772 @@
|
||||
"use strict";
|
||||
var _imageConfig = require("../shared/lib/image-config");
|
||||
var _constants = require("../lib/constants");
|
||||
const configSchema = {
|
||||
type: "object",
|
||||
additionalProperties: false,
|
||||
properties: {
|
||||
amp: {
|
||||
additionalProperties: false,
|
||||
properties: {
|
||||
canonicalBase: {
|
||||
minLength: 1,
|
||||
type: "string"
|
||||
}
|
||||
},
|
||||
type: "object"
|
||||
},
|
||||
analyticsId: {
|
||||
type: "string"
|
||||
},
|
||||
assetPrefix: {
|
||||
minLength: 1,
|
||||
type: "string"
|
||||
},
|
||||
basePath: {
|
||||
type: "string"
|
||||
},
|
||||
cleanDistDir: {
|
||||
type: "boolean"
|
||||
},
|
||||
compiler: {
|
||||
additionalProperties: false,
|
||||
properties: {
|
||||
emotion: {
|
||||
oneOf: [
|
||||
{
|
||||
type: "boolean"
|
||||
},
|
||||
{
|
||||
type: "object",
|
||||
additionalProperties: false,
|
||||
properties: {
|
||||
sourceMap: {
|
||||
type: "boolean"
|
||||
},
|
||||
autoLabel: {
|
||||
type: "string",
|
||||
enum: [
|
||||
"always",
|
||||
"dev-only",
|
||||
"never"
|
||||
]
|
||||
},
|
||||
labelFormat: {
|
||||
type: "string",
|
||||
minLength: 1
|
||||
},
|
||||
importMap: {
|
||||
type: "object"
|
||||
}
|
||||
}
|
||||
},
|
||||
]
|
||||
},
|
||||
reactRemoveProperties: {
|
||||
oneOf: [
|
||||
{
|
||||
type: "boolean"
|
||||
},
|
||||
{
|
||||
type: "object",
|
||||
additionalProperties: false,
|
||||
properties: {
|
||||
properties: {
|
||||
type: "array",
|
||||
items: {
|
||||
type: "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
]
|
||||
},
|
||||
relay: {
|
||||
type: "object"
|
||||
},
|
||||
removeConsole: {
|
||||
oneOf: [
|
||||
{
|
||||
type: "boolean"
|
||||
},
|
||||
{
|
||||
type: "object",
|
||||
additionalProperties: false,
|
||||
properties: {
|
||||
exclude: {
|
||||
type: "array",
|
||||
items: {
|
||||
type: "string",
|
||||
minLength: 1
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
]
|
||||
},
|
||||
styledComponents: {
|
||||
oneOf: [
|
||||
{
|
||||
type: "boolean"
|
||||
},
|
||||
{
|
||||
type: "object",
|
||||
additionalProperties: false,
|
||||
properties: {
|
||||
displayName: {
|
||||
type: "boolean"
|
||||
},
|
||||
topLevelImportPaths: {
|
||||
oneOf: [
|
||||
{
|
||||
type: "boolean"
|
||||
},
|
||||
{
|
||||
type: "array",
|
||||
items: {
|
||||
type: "string",
|
||||
minLength: 1
|
||||
}
|
||||
},
|
||||
]
|
||||
},
|
||||
ssr: {
|
||||
type: "boolean"
|
||||
},
|
||||
fileName: {
|
||||
type: "boolean"
|
||||
},
|
||||
meaninglessFileNames: {
|
||||
oneOf: [
|
||||
{
|
||||
type: "boolean"
|
||||
},
|
||||
{
|
||||
type: "array",
|
||||
items: {
|
||||
type: "string",
|
||||
minLength: 1
|
||||
}
|
||||
},
|
||||
]
|
||||
},
|
||||
minify: {
|
||||
type: "boolean"
|
||||
},
|
||||
transpileTemplateLiterals: {
|
||||
type: "boolean"
|
||||
},
|
||||
namespace: {
|
||||
type: "string",
|
||||
minLength: 1
|
||||
},
|
||||
pure: {
|
||||
type: "boolean"
|
||||
},
|
||||
cssProp: {
|
||||
type: "boolean"
|
||||
}
|
||||
}
|
||||
},
|
||||
]
|
||||
}
|
||||
},
|
||||
type: "object"
|
||||
},
|
||||
compress: {
|
||||
type: "boolean"
|
||||
},
|
||||
crossOrigin: {
|
||||
oneOf: [
|
||||
false,
|
||||
{
|
||||
enum: [
|
||||
"anonymous",
|
||||
"use-credentials"
|
||||
],
|
||||
type: "string"
|
||||
},
|
||||
]
|
||||
},
|
||||
devIndicators: {
|
||||
additionalProperties: false,
|
||||
properties: {
|
||||
buildActivity: {
|
||||
type: "boolean"
|
||||
},
|
||||
buildActivityPosition: {
|
||||
// automatic typing does not like enum
|
||||
enum: [
|
||||
"bottom-left",
|
||||
"bottom-right",
|
||||
"top-left",
|
||||
"top-right"
|
||||
],
|
||||
type: "string"
|
||||
}
|
||||
},
|
||||
type: "object"
|
||||
},
|
||||
distDir: {
|
||||
minLength: 1,
|
||||
type: "string",
|
||||
nullable: true
|
||||
},
|
||||
env: {
|
||||
type: "object"
|
||||
},
|
||||
eslint: {
|
||||
additionalProperties: false,
|
||||
properties: {
|
||||
dirs: {
|
||||
items: {
|
||||
minLength: 1,
|
||||
type: "string"
|
||||
},
|
||||
type: "array"
|
||||
},
|
||||
ignoreDuringBuilds: {
|
||||
type: "boolean"
|
||||
}
|
||||
},
|
||||
type: "object"
|
||||
},
|
||||
excludeDefaultMomentLocales: {
|
||||
type: "boolean"
|
||||
},
|
||||
experimental: {
|
||||
additionalProperties: false,
|
||||
properties: {
|
||||
adjustFontFallbacks: {
|
||||
type: "boolean"
|
||||
},
|
||||
adjustFontFallbacksWithSizeAdjust: {
|
||||
type: "boolean"
|
||||
},
|
||||
amp: {
|
||||
additionalProperties: false,
|
||||
properties: {
|
||||
optimizer: {
|
||||
type: "object"
|
||||
},
|
||||
skipValidation: {
|
||||
type: "boolean"
|
||||
},
|
||||
validator: {
|
||||
type: "string"
|
||||
}
|
||||
},
|
||||
type: "object"
|
||||
},
|
||||
cpus: {
|
||||
type: "number"
|
||||
},
|
||||
craCompat: {
|
||||
type: "boolean"
|
||||
},
|
||||
disableOptimizedLoading: {
|
||||
type: "boolean"
|
||||
},
|
||||
disablePostcssPresetEnv: {
|
||||
type: "boolean"
|
||||
},
|
||||
esmExternals: {
|
||||
oneOf: [
|
||||
{
|
||||
type: "boolean"
|
||||
},
|
||||
{
|
||||
const: "loose"
|
||||
},
|
||||
]
|
||||
},
|
||||
appDir: {
|
||||
type: "boolean"
|
||||
},
|
||||
externalDir: {
|
||||
type: "boolean"
|
||||
},
|
||||
fallbackNodePolyfills: {
|
||||
type: "boolean"
|
||||
},
|
||||
fetchCache: {
|
||||
type: "boolean"
|
||||
},
|
||||
forceSwcTransforms: {
|
||||
type: "boolean"
|
||||
},
|
||||
fullySpecified: {
|
||||
type: "boolean"
|
||||
},
|
||||
gzipSize: {
|
||||
type: "boolean"
|
||||
},
|
||||
incrementalCacheHandlerPath: {
|
||||
type: "string"
|
||||
},
|
||||
isrFlushToDisk: {
|
||||
type: "boolean"
|
||||
},
|
||||
isrMemoryCacheSize: {
|
||||
type: "number"
|
||||
},
|
||||
largePageDataBytes: {
|
||||
type: "number"
|
||||
},
|
||||
legacyBrowsers: {
|
||||
type: "boolean"
|
||||
},
|
||||
manualClientBasePath: {
|
||||
type: "boolean"
|
||||
},
|
||||
middlewarePrefetch: {
|
||||
// automatic typing doesn't like enum
|
||||
enum: [
|
||||
"strict",
|
||||
"flexible"
|
||||
],
|
||||
type: "string"
|
||||
},
|
||||
newNextLinkBehavior: {
|
||||
type: "boolean"
|
||||
},
|
||||
nextScriptWorkers: {
|
||||
type: "boolean"
|
||||
},
|
||||
optimizeCss: {
|
||||
oneOf: [
|
||||
{
|
||||
type: "boolean"
|
||||
},
|
||||
{
|
||||
type: "object"
|
||||
},
|
||||
]
|
||||
},
|
||||
optimisticClientCache: {
|
||||
type: "boolean"
|
||||
},
|
||||
outputFileTracingRoot: {
|
||||
minLength: 1,
|
||||
type: "string"
|
||||
},
|
||||
outputFileTracingIgnores: {
|
||||
type: "array"
|
||||
},
|
||||
pageEnv: {
|
||||
type: "boolean"
|
||||
},
|
||||
profiling: {
|
||||
type: "boolean"
|
||||
},
|
||||
proxyTimeout: {
|
||||
minimum: 0,
|
||||
type: "number"
|
||||
},
|
||||
runtime: {
|
||||
// automatic typing doesn't like enum
|
||||
enum: Object.values(_constants.SERVER_RUNTIME),
|
||||
type: "string"
|
||||
},
|
||||
serverComponentsExternalPackages: {
|
||||
items: {
|
||||
type: "string"
|
||||
},
|
||||
type: "array"
|
||||
},
|
||||
scrollRestoration: {
|
||||
type: "boolean"
|
||||
},
|
||||
sharedPool: {
|
||||
type: "boolean"
|
||||
},
|
||||
sri: {
|
||||
properties: {
|
||||
algorithm: {
|
||||
enum: [
|
||||
"sha256",
|
||||
"sha384",
|
||||
"sha512"
|
||||
],
|
||||
type: "string"
|
||||
}
|
||||
},
|
||||
type: "object"
|
||||
},
|
||||
swcFileReading: {
|
||||
type: "boolean"
|
||||
},
|
||||
swcMinify: {
|
||||
type: "boolean"
|
||||
},
|
||||
swcMinifyDebugOptions: {
|
||||
additionalProperties: false,
|
||||
properties: {
|
||||
compress: {
|
||||
type: "object"
|
||||
},
|
||||
mangle: {
|
||||
type: "object"
|
||||
}
|
||||
},
|
||||
type: "object"
|
||||
},
|
||||
swcPlugins: {
|
||||
type: "array"
|
||||
},
|
||||
swcTraceProfiling: {
|
||||
type: "boolean"
|
||||
},
|
||||
urlImports: {
|
||||
items: {
|
||||
type: "string"
|
||||
},
|
||||
type: "array"
|
||||
},
|
||||
enableUndici: {
|
||||
type: "boolean"
|
||||
},
|
||||
workerThreads: {
|
||||
type: "boolean"
|
||||
},
|
||||
fontLoaders: {
|
||||
items: {
|
||||
additionalProperties: false,
|
||||
properties: {
|
||||
loader: {
|
||||
type: "string"
|
||||
},
|
||||
options: {}
|
||||
},
|
||||
type: "object",
|
||||
required: [
|
||||
"loader"
|
||||
]
|
||||
},
|
||||
type: "array"
|
||||
},
|
||||
webVitalsAttribution: {
|
||||
type: "array",
|
||||
items: {
|
||||
type: "string",
|
||||
enum: [
|
||||
"CLS",
|
||||
"FCP",
|
||||
"FID",
|
||||
"INP",
|
||||
"LCP",
|
||||
"TTFB"
|
||||
]
|
||||
}
|
||||
},
|
||||
mdxRs: {
|
||||
type: "boolean"
|
||||
},
|
||||
turbotrace: {
|
||||
type: "object",
|
||||
properties: {
|
||||
logLevel: {
|
||||
type: "string",
|
||||
enum: [
|
||||
"bug",
|
||||
"fatal",
|
||||
"error",
|
||||
"warning",
|
||||
"hint",
|
||||
"note",
|
||||
"suggestions",
|
||||
"info",
|
||||
]
|
||||
},
|
||||
logAll: {
|
||||
type: "boolean"
|
||||
},
|
||||
logDetail: {
|
||||
type: "boolean"
|
||||
},
|
||||
contextDirectory: {
|
||||
type: "string"
|
||||
},
|
||||
processCwd: {
|
||||
type: "string"
|
||||
},
|
||||
maxFiles: {
|
||||
type: "integer"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
type: "object"
|
||||
},
|
||||
exportPathMap: {
|
||||
isFunction: true,
|
||||
errorMessage: "must be a function that returns a Promise"
|
||||
},
|
||||
generateBuildId: {
|
||||
isFunction: true,
|
||||
errorMessage: "must be a function that returns a Promise"
|
||||
},
|
||||
generateEtags: {
|
||||
type: "boolean"
|
||||
},
|
||||
headers: {
|
||||
isFunction: true,
|
||||
errorMessage: "must be a function that returns a Promise"
|
||||
},
|
||||
httpAgentOptions: {
|
||||
additionalProperties: false,
|
||||
properties: {
|
||||
keepAlive: {
|
||||
type: "boolean"
|
||||
}
|
||||
},
|
||||
type: "object"
|
||||
},
|
||||
i18n: {
|
||||
additionalProperties: false,
|
||||
properties: {
|
||||
defaultLocale: {
|
||||
minLength: 1,
|
||||
type: "string"
|
||||
},
|
||||
domains: {
|
||||
items: {
|
||||
additionalProperties: false,
|
||||
properties: {
|
||||
defaultLocale: {
|
||||
minLength: 1,
|
||||
type: "string"
|
||||
},
|
||||
domain: {
|
||||
minLength: 1,
|
||||
type: "string"
|
||||
},
|
||||
http: {
|
||||
type: "boolean"
|
||||
},
|
||||
locales: {
|
||||
items: {
|
||||
minLength: 1,
|
||||
type: "string"
|
||||
},
|
||||
type: "array"
|
||||
}
|
||||
},
|
||||
type: "object"
|
||||
},
|
||||
type: "array"
|
||||
},
|
||||
localeDetection: {
|
||||
type: "boolean"
|
||||
},
|
||||
locales: {
|
||||
items: {
|
||||
minLength: 1,
|
||||
type: "string"
|
||||
},
|
||||
type: "array"
|
||||
}
|
||||
},
|
||||
type: "object"
|
||||
},
|
||||
images: {
|
||||
additionalProperties: false,
|
||||
properties: {
|
||||
remotePatterns: {
|
||||
items: {
|
||||
additionalProperties: false,
|
||||
properties: {
|
||||
hostname: {
|
||||
minLength: 1,
|
||||
type: "string"
|
||||
},
|
||||
pathname: {
|
||||
minLength: 1,
|
||||
type: "string"
|
||||
},
|
||||
port: {
|
||||
type: "string"
|
||||
},
|
||||
protocol: {
|
||||
// automatic typing doesn't like enum
|
||||
enum: [
|
||||
"http",
|
||||
"https"
|
||||
],
|
||||
type: "string"
|
||||
}
|
||||
},
|
||||
type: "object"
|
||||
},
|
||||
type: "array"
|
||||
},
|
||||
unoptimized: {
|
||||
type: "boolean"
|
||||
},
|
||||
contentSecurityPolicy: {
|
||||
minLength: 1,
|
||||
type: "string"
|
||||
},
|
||||
dangerouslyAllowSVG: {
|
||||
type: "boolean"
|
||||
},
|
||||
deviceSizes: {
|
||||
items: {
|
||||
type: "number"
|
||||
},
|
||||
minItems: 1,
|
||||
type: "array"
|
||||
},
|
||||
disableStaticImages: {
|
||||
type: "boolean"
|
||||
},
|
||||
domains: {
|
||||
items: {
|
||||
type: "string"
|
||||
},
|
||||
type: "array"
|
||||
},
|
||||
formats: {
|
||||
items: {
|
||||
enum: [
|
||||
"image/avif",
|
||||
"image/webp"
|
||||
],
|
||||
type: "string"
|
||||
},
|
||||
type: "array"
|
||||
},
|
||||
imageSizes: {
|
||||
items: {
|
||||
type: "number"
|
||||
},
|
||||
minItems: 1,
|
||||
type: "array"
|
||||
},
|
||||
loader: {
|
||||
// automatic typing does not like enum
|
||||
enum: _imageConfig.VALID_LOADERS,
|
||||
type: "string"
|
||||
},
|
||||
loaderFile: {
|
||||
minLength: 1,
|
||||
type: "string"
|
||||
},
|
||||
minimumCacheTTL: {
|
||||
type: "number"
|
||||
},
|
||||
path: {
|
||||
minLength: 1,
|
||||
type: "string"
|
||||
}
|
||||
},
|
||||
type: "object"
|
||||
},
|
||||
modularizeImports: {
|
||||
type: "object"
|
||||
},
|
||||
onDemandEntries: {
|
||||
additionalProperties: false,
|
||||
properties: {
|
||||
maxInactiveAge: {
|
||||
type: "number"
|
||||
},
|
||||
pagesBufferLength: {
|
||||
type: "number"
|
||||
}
|
||||
},
|
||||
type: "object"
|
||||
},
|
||||
optimizeFonts: {
|
||||
type: "boolean"
|
||||
},
|
||||
output: {
|
||||
// automatic typing doesn't like enum
|
||||
enum: [
|
||||
"standalone"
|
||||
],
|
||||
type: "string"
|
||||
},
|
||||
outputFileTracing: {
|
||||
type: "boolean"
|
||||
},
|
||||
pageExtensions: {
|
||||
minItems: 1,
|
||||
type: "array"
|
||||
},
|
||||
poweredByHeader: {
|
||||
type: "boolean"
|
||||
},
|
||||
productionBrowserSourceMaps: {
|
||||
type: "boolean"
|
||||
},
|
||||
publicRuntimeConfig: {
|
||||
type: "object"
|
||||
},
|
||||
reactStrictMode: {
|
||||
type: "boolean"
|
||||
},
|
||||
redirects: {
|
||||
isFunction: true,
|
||||
errorMessage: "must be a function that returns a Promise"
|
||||
},
|
||||
rewrites: {
|
||||
isFunction: true,
|
||||
errorMessage: "must be a function that returns a Promise"
|
||||
},
|
||||
sassOptions: {
|
||||
type: "object"
|
||||
},
|
||||
serverRuntimeConfig: {
|
||||
type: "object"
|
||||
},
|
||||
skipMiddlewareUrlNormalize: {
|
||||
type: "boolean"
|
||||
},
|
||||
skipTrailingSlashRedirect: {
|
||||
type: "boolean"
|
||||
},
|
||||
staticPageGenerationTimeout: {
|
||||
type: "number"
|
||||
},
|
||||
swcMinify: {
|
||||
type: "boolean"
|
||||
},
|
||||
trailingSlash: {
|
||||
type: "boolean"
|
||||
},
|
||||
transpilePackages: {
|
||||
items: {
|
||||
type: "string"
|
||||
},
|
||||
type: "array"
|
||||
},
|
||||
typescript: {
|
||||
additionalProperties: false,
|
||||
properties: {
|
||||
ignoreBuildErrors: {
|
||||
type: "boolean"
|
||||
},
|
||||
tsconfigPath: {
|
||||
minLength: 1,
|
||||
type: "string"
|
||||
}
|
||||
},
|
||||
type: "object"
|
||||
},
|
||||
useFileSystemPublicRoutes: {
|
||||
type: "boolean"
|
||||
},
|
||||
webpack: {
|
||||
isFunction: true,
|
||||
errorMessage: "must be a function that returns a webpack configuration object"
|
||||
}
|
||||
}
|
||||
};
|
||||
// module.exports is used to get around an export bug with TypeScript
|
||||
// and the Ajv automatic typing
|
||||
module.exports = {
|
||||
configSchema
|
||||
};
|
||||
|
||||
//# sourceMappingURL=config-schema.js.map
|
||||
1
kitabcitab/node_modules/next/dist/server/config-schema.js.map
generated
vendored
Normal file
1
kitabcitab/node_modules/next/dist/server/config-schema.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
436
kitabcitab/node_modules/next/dist/server/config-shared.d.ts
generated
vendored
Normal file
436
kitabcitab/node_modules/next/dist/server/config-shared.d.ts
generated
vendored
Normal file
@@ -0,0 +1,436 @@
|
||||
import type { webpack } from 'next/dist/compiled/webpack/webpack';
|
||||
import type { Header, Redirect, Rewrite } from '../lib/load-custom-routes';
|
||||
import { ImageConfig, ImageConfigComplete } from '../shared/lib/image-config';
|
||||
import { ServerRuntime } from 'next/types';
|
||||
import { SubresourceIntegrityAlgorithm } from '../build/webpack/plugins/subresource-integrity-plugin';
|
||||
import { WEB_VITALS } from '../shared/lib/utils';
|
||||
export declare type NextConfigComplete = Required<NextConfig> & {
|
||||
images: Required<ImageConfigComplete>;
|
||||
typescript: Required<TypeScriptConfig>;
|
||||
configOrigin?: string;
|
||||
configFile?: string;
|
||||
configFileName: string;
|
||||
};
|
||||
export interface I18NConfig {
|
||||
defaultLocale: string;
|
||||
domains?: DomainLocale[];
|
||||
localeDetection?: false;
|
||||
locales: string[];
|
||||
}
|
||||
export interface DomainLocale {
|
||||
defaultLocale: string;
|
||||
domain: string;
|
||||
http?: true;
|
||||
locales?: string[];
|
||||
}
|
||||
export interface ESLintConfig {
|
||||
/** Only run ESLint on these directories with `next lint` and `next build`. */
|
||||
dirs?: string[];
|
||||
/** Do not run ESLint during production builds (`next build`). */
|
||||
ignoreDuringBuilds?: boolean;
|
||||
}
|
||||
export interface TypeScriptConfig {
|
||||
/** Do not run TypeScript during production builds (`next build`). */
|
||||
ignoreBuildErrors?: boolean;
|
||||
/** Relative path to a custom tsconfig file */
|
||||
tsconfigPath?: string;
|
||||
}
|
||||
export interface WebpackConfigContext {
|
||||
/** Next.js root directory */
|
||||
dir: string;
|
||||
/** Indicates if the compilation will be done in development */
|
||||
dev: boolean;
|
||||
/** It's `true` for server-side compilation, and `false` for client-side compilation */
|
||||
isServer: boolean;
|
||||
/** The build id, used as a unique identifier between builds */
|
||||
buildId: string;
|
||||
/** The next.config.js merged with default values */
|
||||
config: NextConfigComplete;
|
||||
/** Default loaders used internally by Next.js */
|
||||
defaultLoaders: {
|
||||
/** Default babel-loader configuration */
|
||||
babel: any;
|
||||
};
|
||||
/** Number of total Next.js pages */
|
||||
totalPages: number;
|
||||
/** The webpack configuration */
|
||||
webpack: any;
|
||||
/** The current server runtime */
|
||||
nextRuntime?: 'nodejs' | 'edge';
|
||||
}
|
||||
export interface NextJsWebpackConfig {
|
||||
(
|
||||
/** Existing Webpack config */
|
||||
config: any, context: WebpackConfigContext): any;
|
||||
}
|
||||
export interface ExperimentalConfig {
|
||||
fetchCache?: boolean;
|
||||
optimisticClientCache?: boolean;
|
||||
middlewarePrefetch?: 'strict' | 'flexible';
|
||||
legacyBrowsers?: boolean;
|
||||
manualClientBasePath?: boolean;
|
||||
newNextLinkBehavior?: boolean;
|
||||
incrementalCacheHandlerPath?: string;
|
||||
disablePostcssPresetEnv?: boolean;
|
||||
swcMinify?: boolean;
|
||||
swcFileReading?: boolean;
|
||||
cpus?: number;
|
||||
sharedPool?: boolean;
|
||||
profiling?: boolean;
|
||||
proxyTimeout?: number;
|
||||
isrFlushToDisk?: boolean;
|
||||
workerThreads?: boolean;
|
||||
pageEnv?: boolean;
|
||||
optimizeCss?: boolean | Record<string, unknown>;
|
||||
nextScriptWorkers?: boolean;
|
||||
scrollRestoration?: boolean;
|
||||
externalDir?: boolean;
|
||||
appDir?: boolean;
|
||||
amp?: {
|
||||
optimizer?: any;
|
||||
validator?: string;
|
||||
skipValidation?: boolean;
|
||||
};
|
||||
disableOptimizedLoading?: boolean;
|
||||
gzipSize?: boolean;
|
||||
craCompat?: boolean;
|
||||
esmExternals?: boolean | 'loose';
|
||||
isrMemoryCacheSize?: number;
|
||||
runtime?: Exclude<ServerRuntime, undefined>;
|
||||
fullySpecified?: boolean;
|
||||
urlImports?: NonNullable<webpack.Configuration['experiments']>['buildHttp'];
|
||||
outputFileTracingRoot?: string;
|
||||
outputFileTracingIgnores?: string[];
|
||||
swcTraceProfiling?: boolean;
|
||||
forceSwcTransforms?: boolean;
|
||||
/**
|
||||
* The option for the minifier of [SWC compiler](https://swc.rs).
|
||||
* This option is only for debugging the SWC minifier, and will be removed once the SWC minifier is stable.
|
||||
*
|
||||
* @see [SWC Minification](https://nextjs.org/docs/advanced-features/compiler#minification)
|
||||
*/
|
||||
swcMinifyDebugOptions?: {
|
||||
compress?: object;
|
||||
mangle?: object;
|
||||
};
|
||||
swcPlugins?: Array<[string, Record<string, unknown>]>;
|
||||
largePageDataBytes?: number;
|
||||
/**
|
||||
* If set to `false`, webpack won't fall back to polyfill Node.js modules in the browser
|
||||
* Full list of old polyfills is accessible here:
|
||||
* [webpack/webpack#ModuleNotoundError.js#L13-L42](https://github.com/webpack/webpack/blob/2a0536cf510768111a3a6dceeb14cb79b9f59273/lib/ModuleNotFoundError.js#L13-L42)
|
||||
*/
|
||||
fallbackNodePolyfills?: false;
|
||||
enableUndici?: boolean;
|
||||
sri?: {
|
||||
algorithm?: SubresourceIntegrityAlgorithm;
|
||||
};
|
||||
adjustFontFallbacks?: boolean;
|
||||
adjustFontFallbacksWithSizeAdjust?: boolean;
|
||||
serverComponentsExternalPackages?: string[];
|
||||
fontLoaders?: Array<{
|
||||
loader: string;
|
||||
options?: any;
|
||||
}>;
|
||||
webVitalsAttribution?: Array<typeof WEB_VITALS[number]>;
|
||||
turbotrace?: {
|
||||
logLevel?: 'bug' | 'fatal' | 'error' | 'warning' | 'hint' | 'note' | 'suggestions' | 'info';
|
||||
logDetail?: boolean;
|
||||
logAll?: boolean;
|
||||
contextDirectory?: string;
|
||||
processCwd?: string;
|
||||
maxFiles?: number;
|
||||
};
|
||||
mdxRs?: boolean;
|
||||
}
|
||||
export declare type ExportPathMap = {
|
||||
[path: string]: {
|
||||
page: string;
|
||||
query?: Record<string, string | string[]>;
|
||||
};
|
||||
};
|
||||
/**
|
||||
* Next configuration object
|
||||
* @see [configuration documentation](https://nextjs.org/docs/api-reference/next.config.js/introduction)
|
||||
*/
|
||||
export interface NextConfig extends Record<string, any> {
|
||||
exportPathMap?: (defaultMap: ExportPathMap, ctx: {
|
||||
dev: boolean;
|
||||
dir: string;
|
||||
outDir: string | null;
|
||||
distDir: string;
|
||||
buildId: string;
|
||||
}) => Promise<ExportPathMap> | ExportPathMap;
|
||||
/**
|
||||
* Internationalization configuration
|
||||
*
|
||||
* @see [Internationalization docs](https://nextjs.org/docs/advanced-features/i18n-routing)
|
||||
*/
|
||||
i18n?: I18NConfig | null;
|
||||
/**
|
||||
* @since version 11
|
||||
* @see [ESLint configuration](https://nextjs.org/docs/basic-features/eslint)
|
||||
*/
|
||||
eslint?: ESLintConfig;
|
||||
/**
|
||||
* @see [Next.js TypeScript documentation](https://nextjs.org/docs/basic-features/typescript)
|
||||
*/
|
||||
typescript?: TypeScriptConfig;
|
||||
/**
|
||||
* Headers allow you to set custom HTTP headers for an incoming request path.
|
||||
*
|
||||
* @see [Headers configuration documentation](https://nextjs.org/docs/api-reference/next.config.js/headers)
|
||||
*/
|
||||
headers?: () => Promise<Header[]>;
|
||||
/**
|
||||
* Rewrites allow you to map an incoming request path to a different destination path.
|
||||
*
|
||||
* @see [Rewrites configuration documentation](https://nextjs.org/docs/api-reference/next.config.js/rewrites)
|
||||
*/
|
||||
rewrites?: () => Promise<Rewrite[] | {
|
||||
beforeFiles: Rewrite[];
|
||||
afterFiles: Rewrite[];
|
||||
fallback: Rewrite[];
|
||||
}>;
|
||||
/**
|
||||
* Redirects allow you to redirect an incoming request path to a different destination path.
|
||||
*
|
||||
* @see [Redirects configuration documentation](https://nextjs.org/docs/api-reference/next.config.js/redirects)
|
||||
*/
|
||||
redirects?: () => Promise<Redirect[]>;
|
||||
/**
|
||||
* @see [Moment.js locales excluded by default](https://nextjs.org/docs/upgrading#momentjs-locales-excluded-by-default)
|
||||
*/
|
||||
excludeDefaultMomentLocales?: boolean;
|
||||
/**
|
||||
* Before continuing to add custom webpack configuration to your application make sure Next.js doesn't already support your use-case
|
||||
*
|
||||
* @see [Custom Webpack Config documentation](https://nextjs.org/docs/api-reference/next.config.js/custom-webpack-config)
|
||||
*/
|
||||
webpack?: NextJsWebpackConfig | null;
|
||||
/**
|
||||
* By default Next.js will redirect urls with trailing slashes to their counterpart without a trailing slash.
|
||||
*
|
||||
* @default false
|
||||
* @see [Trailing Slash Configuration](https://nextjs.org/docs/api-reference/next.config.js/trailing-slash)
|
||||
*/
|
||||
trailingSlash?: boolean;
|
||||
/**
|
||||
* Next.js comes with built-in support for environment variables
|
||||
*
|
||||
* @see [Environment Variables documentation](https://nextjs.org/docs/api-reference/next.config.js/environment-variables)
|
||||
*/
|
||||
env?: Record<string, string>;
|
||||
/**
|
||||
* Destination directory (defaults to `.next`)
|
||||
*/
|
||||
distDir?: string;
|
||||
/**
|
||||
* The build output directory (defaults to `.next`) is now cleared by default except for the Next.js caches.
|
||||
*/
|
||||
cleanDistDir?: boolean;
|
||||
/**
|
||||
* To set up a CDN, you can set up an asset prefix and configure your CDN's origin to resolve to the domain that Next.js is hosted on.
|
||||
*
|
||||
* @see [CDN Support with Asset Prefix](https://nextjs.org/docs/api-reference/next.config.js/cdn-support-with-asset-prefix)
|
||||
*/
|
||||
assetPrefix?: string;
|
||||
/**
|
||||
* By default, `Next` will serve each file in the `pages` folder under a pathname matching the filename.
|
||||
* To disable this behavior and prevent routing based set this to `true`.
|
||||
*
|
||||
* @default true
|
||||
* @see [Disabling file-system routing](https://nextjs.org/docs/advanced-features/custom-server#disabling-file-system-routing)
|
||||
*/
|
||||
useFileSystemPublicRoutes?: boolean;
|
||||
/**
|
||||
* @see [Configuring the build ID](https://nextjs.org/docs/api-reference/next.config.js/configuring-the-build-id)
|
||||
*/
|
||||
generateBuildId?: () => string | null | Promise<string | null>;
|
||||
/** @see [Disabling ETag Configuration](https://nextjs.org/docs/api-reference/next.config.js/disabling-etag-generation) */
|
||||
generateEtags?: boolean;
|
||||
/** @see [Including non-page files in the pages directory](https://nextjs.org/docs/api-reference/next.config.js/custom-page-extensions) */
|
||||
pageExtensions?: string[];
|
||||
/** @see [Compression documentation](https://nextjs.org/docs/api-reference/next.config.js/compression) */
|
||||
compress?: boolean;
|
||||
/**
|
||||
* The field should only be used when a Next.js project is not hosted on Vercel while using Vercel Analytics.
|
||||
* Vercel provides zero-configuration analytics for Next.js projects hosted on Vercel.
|
||||
*
|
||||
* @default ''
|
||||
* @see [Next.js Analytics](https://nextjs.org/analytics)
|
||||
*/
|
||||
analyticsId?: string;
|
||||
/** @see [Disabling x-powered-by](https://nextjs.org/docs/api-reference/next.config.js/disabling-x-powered-by) */
|
||||
poweredByHeader?: boolean;
|
||||
/** @see [Using the Image Component](https://nextjs.org/docs/basic-features/image-optimization#using-the-image-component) */
|
||||
images?: ImageConfig;
|
||||
/** Configure indicators in development environment */
|
||||
devIndicators?: {
|
||||
/** Show "building..."" indicator in development */
|
||||
buildActivity?: boolean;
|
||||
/** Position of "building..." indicator in browser */
|
||||
buildActivityPosition?: 'bottom-right' | 'bottom-left' | 'top-right' | 'top-left';
|
||||
};
|
||||
/**
|
||||
* Next.js exposes some options that give you some control over how the server will dispose or keep in memory built pages in development.
|
||||
*
|
||||
* @see [Configuring `onDemandEntries`](https://nextjs.org/docs/api-reference/next.config.js/configuring-onDemandEntries)
|
||||
*/
|
||||
onDemandEntries?: {
|
||||
/** period (in ms) where the server will keep pages in the buffer */
|
||||
maxInactiveAge?: number;
|
||||
/** number of pages that should be kept simultaneously without being disposed */
|
||||
pagesBufferLength?: number;
|
||||
};
|
||||
/** @see [`next/amp`](https://nextjs.org/docs/api-reference/next/amp) */
|
||||
amp?: {
|
||||
canonicalBase?: string;
|
||||
};
|
||||
/**
|
||||
* Deploy a Next.js application under a sub-path of a domain
|
||||
*
|
||||
* @see [Base path configuration](https://nextjs.org/docs/api-reference/next.config.js/basepath)
|
||||
*/
|
||||
basePath?: string;
|
||||
/** @see [Customizing sass options](https://nextjs.org/docs/basic-features/built-in-css-support#customizing-sass-options) */
|
||||
sassOptions?: {
|
||||
[key: string]: any;
|
||||
};
|
||||
/**
|
||||
* Enable browser source map generation during the production build
|
||||
*
|
||||
* @see [Source Maps](https://nextjs.org/docs/advanced-features/source-maps)
|
||||
*/
|
||||
productionBrowserSourceMaps?: boolean;
|
||||
/**
|
||||
* By default, Next.js will automatically inline font CSS at build time
|
||||
*
|
||||
* @default true
|
||||
* @since version 10.2
|
||||
* @see [Font Optimization](https://nextjs.org/docs/basic-features/font-optimization)
|
||||
*/
|
||||
optimizeFonts?: boolean;
|
||||
/**
|
||||
* The Next.js runtime is Strict Mode-compliant.
|
||||
*
|
||||
* @see [React Strict Mode](https://nextjs.org/docs/api-reference/next.config.js/react-strict-mode)
|
||||
*/
|
||||
reactStrictMode?: boolean | null;
|
||||
/**
|
||||
* Add public (in browser) runtime configuration to your app
|
||||
*
|
||||
* @see [Runtime configuration](https://nextjs.org/docs/api-reference/next.config.js/runtime-configuration)
|
||||
*/
|
||||
publicRuntimeConfig?: {
|
||||
[key: string]: any;
|
||||
};
|
||||
/**
|
||||
* Add server runtime configuration to your app
|
||||
*
|
||||
* @see [Runtime configuration](https://nextjs.org/docs/api-reference/next.config.js/runtime-configuration)
|
||||
*/
|
||||
serverRuntimeConfig?: {
|
||||
[key: string]: any;
|
||||
};
|
||||
/**
|
||||
* Next.js automatically polyfills node-fetch and enables HTTP Keep-Alive by default.
|
||||
* You may want to disable HTTP Keep-Alive for certain `fetch()` calls or globally.
|
||||
*
|
||||
* @see [Disabling HTTP Keep-Alive](https://nextjs.org/docs/api-reference/next.config.js/disabling-http-keep-alive)
|
||||
*/
|
||||
httpAgentOptions?: {
|
||||
keepAlive?: boolean;
|
||||
};
|
||||
/**
|
||||
* During a build, Next.js will automatically trace each page and its dependencies to determine all of the files
|
||||
* that are needed for deploying a production version of your application.
|
||||
*
|
||||
* @see [Output File Tracing](https://nextjs.org/docs/advanced-features/output-file-tracing)
|
||||
*/
|
||||
outputFileTracing?: boolean;
|
||||
/**
|
||||
* Timeout after waiting to generate static pages in seconds
|
||||
*
|
||||
* @default 60
|
||||
*/
|
||||
staticPageGenerationTimeout?: number;
|
||||
/**
|
||||
* Add `"crossorigin"` attribute to generated `<script>` elements generated by `<Head />` or `<NextScript />` components
|
||||
*
|
||||
*
|
||||
* @see [`crossorigin` attribute documentation](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/crossorigin)
|
||||
*/
|
||||
crossOrigin?: false | 'anonymous' | 'use-credentials';
|
||||
/**
|
||||
* Use [SWC compiler](https://swc.rs) to minify the generated JavaScript
|
||||
*
|
||||
* @see [SWC Minification](https://nextjs.org/docs/advanced-features/compiler#minification)
|
||||
*/
|
||||
swcMinify?: boolean;
|
||||
/**
|
||||
* Optionally enable compiler transforms
|
||||
*
|
||||
* @see [Supported Compiler Options](https://nextjs.org/docs/advanced-features/compiler#supported-features)
|
||||
*/
|
||||
compiler?: {
|
||||
reactRemoveProperties?: boolean | {
|
||||
properties?: string[];
|
||||
};
|
||||
relay?: {
|
||||
src: string;
|
||||
artifactDirectory?: string;
|
||||
language?: 'typescript' | 'javascript' | 'flow';
|
||||
};
|
||||
removeConsole?: boolean | {
|
||||
exclude?: string[];
|
||||
};
|
||||
styledComponents?: boolean | {
|
||||
/**
|
||||
* Enabled by default in development, disabled in production to reduce file size,
|
||||
* setting this will override the default for all environments.
|
||||
*/
|
||||
displayName?: boolean;
|
||||
topLevelImportPaths?: string[];
|
||||
ssr?: boolean;
|
||||
fileName?: boolean;
|
||||
meaninglessFileNames?: string[];
|
||||
minify?: boolean;
|
||||
transpileTemplateLiterals?: boolean;
|
||||
namespace?: string;
|
||||
pure?: boolean;
|
||||
cssProp?: boolean;
|
||||
};
|
||||
emotion?: boolean | {
|
||||
sourceMap?: boolean;
|
||||
autoLabel?: 'dev-only' | 'always' | 'never';
|
||||
labelFormat?: string;
|
||||
importMap?: {
|
||||
[importName: string]: {
|
||||
[exportName: string]: {
|
||||
canonicalImport?: [string, string];
|
||||
styledBaseImport?: [string, string];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
output?: 'standalone';
|
||||
transpilePackages?: string[];
|
||||
skipMiddlewareUrlNormalize?: boolean;
|
||||
skipTrailingSlashRedirect?: boolean;
|
||||
modularizeImports?: Record<string, {
|
||||
transform: string;
|
||||
preventFullImport?: boolean;
|
||||
skipDefaultConversion?: boolean;
|
||||
}>;
|
||||
/**
|
||||
* Enable experimental features. Note that all experimental features are subject to breaking changes in the future.
|
||||
*/
|
||||
experimental?: ExperimentalConfig;
|
||||
}
|
||||
export declare const defaultConfig: NextConfig;
|
||||
export declare function normalizeConfig(phase: string, config: any): Promise<any>;
|
||||
export declare function validateConfig(userConfig: NextConfig): {
|
||||
errors?: Array<any> | null;
|
||||
};
|
||||
137
kitabcitab/node_modules/next/dist/server/config-shared.js
generated
vendored
Normal file
137
kitabcitab/node_modules/next/dist/server/config-shared.js
generated
vendored
Normal file
@@ -0,0 +1,137 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.normalizeConfig = normalizeConfig;
|
||||
exports.validateConfig = validateConfig;
|
||||
exports.defaultConfig = void 0;
|
||||
var _os = _interopRequireDefault(require("os"));
|
||||
var _imageConfig = require("../shared/lib/image-config");
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {
|
||||
default: obj
|
||||
};
|
||||
}
|
||||
const defaultConfig = {
|
||||
env: {},
|
||||
webpack: null,
|
||||
webpackDevMiddleware: null,
|
||||
eslint: {
|
||||
ignoreDuringBuilds: false
|
||||
},
|
||||
typescript: {
|
||||
ignoreBuildErrors: false,
|
||||
tsconfigPath: "tsconfig.json"
|
||||
},
|
||||
distDir: ".next",
|
||||
cleanDistDir: true,
|
||||
assetPrefix: "",
|
||||
configOrigin: "default",
|
||||
useFileSystemPublicRoutes: true,
|
||||
generateBuildId: ()=>null,
|
||||
generateEtags: true,
|
||||
pageExtensions: [
|
||||
"tsx",
|
||||
"ts",
|
||||
"jsx",
|
||||
"js"
|
||||
],
|
||||
target: "server",
|
||||
poweredByHeader: true,
|
||||
compress: true,
|
||||
analyticsId: process.env.VERCEL_ANALYTICS_ID || "",
|
||||
images: _imageConfig.imageConfigDefault,
|
||||
devIndicators: {
|
||||
buildActivity: true,
|
||||
buildActivityPosition: "bottom-right"
|
||||
},
|
||||
onDemandEntries: {
|
||||
maxInactiveAge: 15 * 1000,
|
||||
pagesBufferLength: 2
|
||||
},
|
||||
amp: {
|
||||
canonicalBase: ""
|
||||
},
|
||||
basePath: "",
|
||||
sassOptions: {},
|
||||
trailingSlash: false,
|
||||
i18n: null,
|
||||
productionBrowserSourceMaps: false,
|
||||
optimizeFonts: true,
|
||||
excludeDefaultMomentLocales: true,
|
||||
serverRuntimeConfig: {},
|
||||
publicRuntimeConfig: {},
|
||||
reactStrictMode: null,
|
||||
httpAgentOptions: {
|
||||
keepAlive: true
|
||||
},
|
||||
outputFileTracing: true,
|
||||
staticPageGenerationTimeout: 60,
|
||||
swcMinify: true,
|
||||
output: !!process.env.NEXT_PRIVATE_STANDALONE ? "standalone" : undefined,
|
||||
modularizeImports: undefined,
|
||||
experimental: {
|
||||
fetchCache: false,
|
||||
middlewarePrefetch: "flexible",
|
||||
optimisticClientCache: true,
|
||||
runtime: undefined,
|
||||
manualClientBasePath: false,
|
||||
legacyBrowsers: false,
|
||||
newNextLinkBehavior: true,
|
||||
cpus: Math.max(1, (Number(process.env.CIRCLE_NODE_TOTAL) || (_os.default.cpus() || {
|
||||
length: 1
|
||||
}).length) - 1),
|
||||
sharedPool: true,
|
||||
profiling: false,
|
||||
isrFlushToDisk: true,
|
||||
workerThreads: false,
|
||||
pageEnv: false,
|
||||
proxyTimeout: undefined,
|
||||
optimizeCss: false,
|
||||
nextScriptWorkers: false,
|
||||
scrollRestoration: false,
|
||||
externalDir: false,
|
||||
disableOptimizedLoading: false,
|
||||
gzipSize: true,
|
||||
swcFileReading: true,
|
||||
craCompat: false,
|
||||
esmExternals: true,
|
||||
appDir: false,
|
||||
// default to 50MB limit
|
||||
isrMemoryCacheSize: 50 * 1024 * 1024,
|
||||
incrementalCacheHandlerPath: undefined,
|
||||
fullySpecified: false,
|
||||
outputFileTracingRoot: process.env.NEXT_PRIVATE_OUTPUT_TRACE_ROOT || "",
|
||||
swcTraceProfiling: false,
|
||||
forceSwcTransforms: false,
|
||||
swcPlugins: undefined,
|
||||
swcMinifyDebugOptions: undefined,
|
||||
largePageDataBytes: 128 * 1000,
|
||||
disablePostcssPresetEnv: undefined,
|
||||
amp: undefined,
|
||||
urlImports: undefined,
|
||||
enableUndici: false,
|
||||
adjustFontFallbacks: false,
|
||||
adjustFontFallbacksWithSizeAdjust: false,
|
||||
turbotrace: undefined
|
||||
}
|
||||
};
|
||||
exports.defaultConfig = defaultConfig;
|
||||
async function normalizeConfig(phase, config) {
|
||||
if (typeof config === "function") {
|
||||
config = config(phase, {
|
||||
defaultConfig
|
||||
});
|
||||
}
|
||||
// Support `new Promise` and `async () =>` as return values of the config export
|
||||
return await config;
|
||||
}
|
||||
function validateConfig(userConfig) {
|
||||
const configValidator = require("next/dist/next-config-validate.js");
|
||||
configValidator(userConfig);
|
||||
return {
|
||||
errors: configValidator.errors
|
||||
};
|
||||
}
|
||||
|
||||
//# sourceMappingURL=config-shared.js.map
|
||||
1
kitabcitab/node_modules/next/dist/server/config-shared.js.map
generated
vendored
Normal file
1
kitabcitab/node_modules/next/dist/server/config-shared.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../server/config-shared.ts"],"names":["normalizeConfig","validateConfig","defaultConfig","env","webpack","webpackDevMiddleware","eslint","ignoreDuringBuilds","typescript","ignoreBuildErrors","tsconfigPath","distDir","cleanDistDir","assetPrefix","configOrigin","useFileSystemPublicRoutes","generateBuildId","generateEtags","pageExtensions","target","poweredByHeader","compress","analyticsId","process","VERCEL_ANALYTICS_ID","images","imageConfigDefault","devIndicators","buildActivity","buildActivityPosition","onDemandEntries","maxInactiveAge","pagesBufferLength","amp","canonicalBase","basePath","sassOptions","trailingSlash","i18n","productionBrowserSourceMaps","optimizeFonts","excludeDefaultMomentLocales","serverRuntimeConfig","publicRuntimeConfig","reactStrictMode","httpAgentOptions","keepAlive","outputFileTracing","staticPageGenerationTimeout","swcMinify","output","NEXT_PRIVATE_STANDALONE","undefined","modularizeImports","experimental","fetchCache","middlewarePrefetch","optimisticClientCache","runtime","manualClientBasePath","legacyBrowsers","newNextLinkBehavior","cpus","Math","max","Number","CIRCLE_NODE_TOTAL","os","length","sharedPool","profiling","isrFlushToDisk","workerThreads","pageEnv","proxyTimeout","optimizeCss","nextScriptWorkers","scrollRestoration","externalDir","disableOptimizedLoading","gzipSize","swcFileReading","craCompat","esmExternals","appDir","isrMemoryCacheSize","incrementalCacheHandlerPath","fullySpecified","outputFileTracingRoot","NEXT_PRIVATE_OUTPUT_TRACE_ROOT","swcTraceProfiling","forceSwcTransforms","swcPlugins","swcMinifyDebugOptions","largePageDataBytes","disablePostcssPresetEnv","urlImports","enableUndici","adjustFontFallbacks","adjustFontFallbacksWithSizeAdjust","turbotrace","phase","config","userConfig","configValidator","require","errors"],"mappings":"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"}
|
||||
1
kitabcitab/node_modules/next/dist/server/config-utils.d.ts
generated
vendored
Normal file
1
kitabcitab/node_modules/next/dist/server/config-utils.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export declare function loadWebpackHook(): void;
|
||||
192
kitabcitab/node_modules/next/dist/server/config-utils.js
generated
vendored
Normal file
192
kitabcitab/node_modules/next/dist/server/config-utils.js
generated
vendored
Normal file
@@ -0,0 +1,192 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.loadWebpackHook = loadWebpackHook;
|
||||
var _webpack = require("next/dist/compiled/webpack/webpack");
|
||||
let installed = false;
|
||||
function loadWebpackHook() {
|
||||
if (installed) {
|
||||
return;
|
||||
}
|
||||
installed = true;
|
||||
(0, _webpack).init();
|
||||
// hook the Node.js require so that webpack requires are
|
||||
// routed to the bundled and now initialized webpack version
|
||||
require("../build/webpack/require-hook").loadRequireHook([
|
||||
[
|
||||
"webpack",
|
||||
"next/dist/compiled/webpack/webpack-lib"
|
||||
],
|
||||
[
|
||||
"webpack/package",
|
||||
"next/dist/compiled/webpack/package"
|
||||
],
|
||||
[
|
||||
"webpack/package.json",
|
||||
"next/dist/compiled/webpack/package"
|
||||
],
|
||||
[
|
||||
"webpack/lib/webpack",
|
||||
"next/dist/compiled/webpack/webpack-lib"
|
||||
],
|
||||
[
|
||||
"webpack/lib/webpack.js",
|
||||
"next/dist/compiled/webpack/webpack-lib"
|
||||
],
|
||||
[
|
||||
"webpack/lib/node/NodeEnvironmentPlugin",
|
||||
"next/dist/compiled/webpack/NodeEnvironmentPlugin",
|
||||
],
|
||||
[
|
||||
"webpack/lib/node/NodeEnvironmentPlugin.js",
|
||||
"next/dist/compiled/webpack/NodeEnvironmentPlugin",
|
||||
],
|
||||
[
|
||||
"webpack/lib/BasicEvaluatedExpression",
|
||||
"next/dist/compiled/webpack/BasicEvaluatedExpression",
|
||||
],
|
||||
[
|
||||
"webpack/lib/BasicEvaluatedExpression.js",
|
||||
"next/dist/compiled/webpack/BasicEvaluatedExpression",
|
||||
],
|
||||
[
|
||||
"webpack/lib/node/NodeTargetPlugin",
|
||||
"next/dist/compiled/webpack/NodeTargetPlugin",
|
||||
],
|
||||
[
|
||||
"webpack/lib/node/NodeTargetPlugin.js",
|
||||
"next/dist/compiled/webpack/NodeTargetPlugin",
|
||||
],
|
||||
[
|
||||
"webpack/lib/node/NodeTemplatePlugin",
|
||||
"next/dist/compiled/webpack/NodeTemplatePlugin",
|
||||
],
|
||||
[
|
||||
"webpack/lib/node/NodeTemplatePlugin.js",
|
||||
"next/dist/compiled/webpack/NodeTemplatePlugin",
|
||||
],
|
||||
[
|
||||
"webpack/lib/LibraryTemplatePlugin",
|
||||
"next/dist/compiled/webpack/LibraryTemplatePlugin",
|
||||
],
|
||||
[
|
||||
"webpack/lib/LibraryTemplatePlugin.js",
|
||||
"next/dist/compiled/webpack/LibraryTemplatePlugin",
|
||||
],
|
||||
[
|
||||
"webpack/lib/SingleEntryPlugin",
|
||||
"next/dist/compiled/webpack/SingleEntryPlugin",
|
||||
],
|
||||
[
|
||||
"webpack/lib/SingleEntryPlugin.js",
|
||||
"next/dist/compiled/webpack/SingleEntryPlugin",
|
||||
],
|
||||
[
|
||||
"webpack/lib/optimize/LimitChunkCountPlugin",
|
||||
"next/dist/compiled/webpack/LimitChunkCountPlugin",
|
||||
],
|
||||
[
|
||||
"webpack/lib/optimize/LimitChunkCountPlugin.js",
|
||||
"next/dist/compiled/webpack/LimitChunkCountPlugin",
|
||||
],
|
||||
[
|
||||
"webpack/lib/webworker/WebWorkerTemplatePlugin",
|
||||
"next/dist/compiled/webpack/WebWorkerTemplatePlugin",
|
||||
],
|
||||
[
|
||||
"webpack/lib/webworker/WebWorkerTemplatePlugin.js",
|
||||
"next/dist/compiled/webpack/WebWorkerTemplatePlugin",
|
||||
],
|
||||
[
|
||||
"webpack/lib/ExternalsPlugin",
|
||||
"next/dist/compiled/webpack/ExternalsPlugin",
|
||||
],
|
||||
[
|
||||
"webpack/lib/ExternalsPlugin.js",
|
||||
"next/dist/compiled/webpack/ExternalsPlugin",
|
||||
],
|
||||
[
|
||||
"webpack/lib/web/FetchCompileWasmTemplatePlugin",
|
||||
"next/dist/compiled/webpack/FetchCompileWasmTemplatePlugin",
|
||||
],
|
||||
[
|
||||
"webpack/lib/web/FetchCompileWasmTemplatePlugin.js",
|
||||
"next/dist/compiled/webpack/FetchCompileWasmTemplatePlugin",
|
||||
],
|
||||
[
|
||||
"webpack/lib/web/FetchCompileWasmPlugin",
|
||||
"next/dist/compiled/webpack/FetchCompileWasmPlugin",
|
||||
],
|
||||
[
|
||||
"webpack/lib/web/FetchCompileWasmPlugin.js",
|
||||
"next/dist/compiled/webpack/FetchCompileWasmPlugin",
|
||||
],
|
||||
[
|
||||
"webpack/lib/web/FetchCompileAsyncWasmPlugin",
|
||||
"next/dist/compiled/webpack/FetchCompileAsyncWasmPlugin",
|
||||
],
|
||||
[
|
||||
"webpack/lib/web/FetchCompileAsyncWasmPlugin.js",
|
||||
"next/dist/compiled/webpack/FetchCompileAsyncWasmPlugin",
|
||||
],
|
||||
[
|
||||
"webpack/lib/ModuleFilenameHelpers",
|
||||
"next/dist/compiled/webpack/ModuleFilenameHelpers",
|
||||
],
|
||||
[
|
||||
"webpack/lib/ModuleFilenameHelpers.js",
|
||||
"next/dist/compiled/webpack/ModuleFilenameHelpers",
|
||||
],
|
||||
[
|
||||
"webpack/lib/GraphHelpers",
|
||||
"next/dist/compiled/webpack/GraphHelpers"
|
||||
],
|
||||
[
|
||||
"webpack/lib/GraphHelpers.js",
|
||||
"next/dist/compiled/webpack/GraphHelpers",
|
||||
],
|
||||
[
|
||||
"webpack/lib/NormalModule",
|
||||
"next/dist/compiled/webpack/NormalModule"
|
||||
],
|
||||
[
|
||||
"webpack-sources",
|
||||
"next/dist/compiled/webpack/sources"
|
||||
],
|
||||
[
|
||||
"webpack-sources/lib",
|
||||
"next/dist/compiled/webpack/sources"
|
||||
],
|
||||
[
|
||||
"webpack-sources/lib/index",
|
||||
"next/dist/compiled/webpack/sources"
|
||||
],
|
||||
[
|
||||
"webpack-sources/lib/index.js",
|
||||
"next/dist/compiled/webpack/sources"
|
||||
],
|
||||
[
|
||||
"@babel/runtime",
|
||||
"next/dist/compiled/@babel/runtime/package.json"
|
||||
],
|
||||
[
|
||||
"@babel/runtime/package.json",
|
||||
"next/dist/compiled/@babel/runtime/package.json",
|
||||
],
|
||||
[
|
||||
"node-fetch",
|
||||
"next/dist/compiled/node-fetch"
|
||||
],
|
||||
[
|
||||
"undici",
|
||||
"next/dist/compiled/undici"
|
||||
],
|
||||
].map(// Use dynamic require.resolve to avoid statically analyzable since they're only for build time
|
||||
([request, replacement])=>[
|
||||
request,
|
||||
require.resolve(replacement)
|
||||
]));
|
||||
}
|
||||
|
||||
//# sourceMappingURL=config-utils.js.map
|
||||
1
kitabcitab/node_modules/next/dist/server/config-utils.js.map
generated
vendored
Normal file
1
kitabcitab/node_modules/next/dist/server/config-utils.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../server/config-utils.ts"],"names":["loadWebpackHook","installed","initWebpack","require","loadRequireHook","map","request","replacement","resolve"],"mappings":"AAAA;;;;QAIgBA,eAAe,GAAfA,eAAe;AAJK,IAAA,QAAoC,WAApC,oCAAoC,CAAA;AAExE,IAAIC,SAAS,GAAY,KAAK;AAEvB,SAASD,eAAe,GAAG;IAChC,IAAIC,SAAS,EAAE;QACb,OAAM;KACP;IACDA,SAAS,GAAG,IAAI;IAEhBC,CAAAA,GAAAA,QAAW,AAAE,CAAA,KAAF,EAAE;IAEb,wDAAwD;IACxD,4DAA4D;IAC5DC,OAAO,CAAC,+BAA+B,CAAC,CAACC,eAAe,CACtD;QACE;YAAC,SAAS;YAAE,wCAAwC;SAAC;QACrD;YAAC,iBAAiB;YAAE,oCAAoC;SAAC;QACzD;YAAC,sBAAsB;YAAE,oCAAoC;SAAC;QAC9D;YAAC,qBAAqB;YAAE,wCAAwC;SAAC;QACjE;YAAC,wBAAwB;YAAE,wCAAwC;SAAC;QACpE;YACE,wCAAwC;YACxC,kDAAkD;SACnD;QACD;YACE,2CAA2C;YAC3C,kDAAkD;SACnD;QACD;YACE,sCAAsC;YACtC,qDAAqD;SACtD;QACD;YACE,yCAAyC;YACzC,qDAAqD;SACtD;QACD;YACE,mCAAmC;YACnC,6CAA6C;SAC9C;QACD;YACE,sCAAsC;YACtC,6CAA6C;SAC9C;QACD;YACE,qCAAqC;YACrC,+CAA+C;SAChD;QACD;YACE,wCAAwC;YACxC,+CAA+C;SAChD;QACD;YACE,mCAAmC;YACnC,kDAAkD;SACnD;QACD;YACE,sCAAsC;YACtC,kDAAkD;SACnD;QACD;YACE,+BAA+B;YAC/B,8CAA8C;SAC/C;QACD;YACE,kCAAkC;YAClC,8CAA8C;SAC/C;QACD;YACE,4CAA4C;YAC5C,kDAAkD;SACnD;QACD;YACE,+CAA+C;YAC/C,kDAAkD;SACnD;QACD;YACE,+CAA+C;YAC/C,oDAAoD;SACrD;QACD;YACE,kDAAkD;YAClD,oDAAoD;SACrD;QACD;YACE,6BAA6B;YAC7B,4CAA4C;SAC7C;QACD;YACE,gCAAgC;YAChC,4CAA4C;SAC7C;QACD;YACE,gDAAgD;YAChD,2DAA2D;SAC5D;QACD;YACE,mDAAmD;YACnD,2DAA2D;SAC5D;QACD;YACE,wCAAwC;YACxC,mDAAmD;SACpD;QACD;YACE,2CAA2C;YAC3C,mDAAmD;SACpD;QACD;YACE,6CAA6C;YAC7C,wDAAwD;SACzD;QACD;YACE,gDAAgD;YAChD,wDAAwD;SACzD;QACD;YACE,mCAAmC;YACnC,kDAAkD;SACnD;QACD;YACE,sCAAsC;YACtC,kDAAkD;SACnD;QACD;YAAC,0BAA0B;YAAE,yCAAyC;SAAC;QACvE;YACE,6BAA6B;YAC7B,yCAAyC;SAC1C;QACD;YAAC,0BAA0B;YAAE,yCAAyC;SAAC;QACvE;YAAC,iBAAiB;YAAE,oCAAoC;SAAC;QACzD;YAAC,qBAAqB;YAAE,oCAAoC;SAAC;QAC7D;YAAC,2BAA2B;YAAE,oCAAoC;SAAC;QACnE;YAAC,8BAA8B;YAAE,oCAAoC;SAAC;QACtE;YAAC,gBAAgB;YAAE,gDAAgD;SAAC;QACpE;YACE,6BAA6B;YAC7B,gDAAgD;SACjD;QACD;YAAC,YAAY;YAAE,+BAA+B;SAAC;QAC/C;YAAC,QAAQ;YAAE,2BAA2B;SAAC;KACxC,CAACC,GAAG,CACH,+FAA+F;IAC/F,CAAC,CAACC,OAAO,EAAEC,WAAW,CAAC,GAAK;YAACD,OAAO;YAAEH,OAAO,CAACK,OAAO,CAACD,WAAW,CAAC;SAAC,CACpE,CACF;CACF"}
|
||||
9
kitabcitab/node_modules/next/dist/server/config.d.ts
generated
vendored
Normal file
9
kitabcitab/node_modules/next/dist/server/config.d.ts
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
import { NextConfigComplete, NextConfig } from './config-shared';
|
||||
export { DomainLocale, NextConfig, normalizeConfig } from './config-shared';
|
||||
export declare function setHttpClientAndAgentOptions(config: {
|
||||
httpAgentOptions?: NextConfig['httpAgentOptions'];
|
||||
experimental?: {
|
||||
enableUndici?: boolean;
|
||||
};
|
||||
}): void;
|
||||
export default function loadConfig(phase: string, dir: string, customConfig?: object | null, rawConfig?: boolean): Promise<NextConfigComplete>;
|
||||
637
kitabcitab/node_modules/next/dist/server/config.js
generated
vendored
Normal file
637
kitabcitab/node_modules/next/dist/server/config.js
generated
vendored
Normal file
@@ -0,0 +1,637 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = loadConfig;
|
||||
Object.defineProperty(exports, "DomainLocale", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return _configShared.DomainLocale;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "NextConfig", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return _configShared.NextConfig;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "normalizeConfig", {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return _configShared.normalizeConfig;
|
||||
}
|
||||
});
|
||||
exports.setHttpClientAndAgentOptions = setHttpClientAndAgentOptions;
|
||||
var _fs = require("fs");
|
||||
var _path = require("path");
|
||||
var _url = require("url");
|
||||
var _http = require("http");
|
||||
var _https = require("https");
|
||||
var _findUp = _interopRequireDefault(require("next/dist/compiled/find-up"));
|
||||
var _chalk = _interopRequireDefault(require("../lib/chalk"));
|
||||
var Log = _interopRequireWildcard(require("../build/output/log"));
|
||||
var _constants = require("../shared/lib/constants");
|
||||
var _utils = require("../shared/lib/utils");
|
||||
var _configShared = require("./config-shared");
|
||||
var _configUtils = require("./config-utils");
|
||||
var _imageConfig = require("../shared/lib/image-config");
|
||||
var _env = require("@next/env");
|
||||
var _semver = require("next/dist/compiled/semver");
|
||||
async function loadConfig(phase, dir, customConfig, rawConfig) {
|
||||
await (0, _env).loadEnvConfig(dir, phase === _constants.PHASE_DEVELOPMENT_SERVER, Log);
|
||||
(0, _configUtils).loadWebpackHook();
|
||||
let configFileName = "next.config.js";
|
||||
if (customConfig) {
|
||||
return assignDefaults(dir, {
|
||||
configOrigin: "server",
|
||||
configFileName,
|
||||
...customConfig
|
||||
});
|
||||
}
|
||||
const path = await (0, _findUp).default(_constants.CONFIG_FILES, {
|
||||
cwd: dir
|
||||
});
|
||||
// If config file was found
|
||||
if (path == null ? void 0 : path.length) {
|
||||
var ref;
|
||||
configFileName = (0, _path).basename(path);
|
||||
let userConfigModule;
|
||||
try {
|
||||
// `import()` expects url-encoded strings, so the path must be properly
|
||||
// escaped and (especially on Windows) absolute paths must pe prefixed
|
||||
// with the `file://` protocol
|
||||
if (process.env.__NEXT_TEST_MODE === "jest") {
|
||||
// dynamic import does not currently work inside of vm which
|
||||
// jest relies on so we fall back to require for this case
|
||||
// https://github.com/nodejs/node/issues/35889
|
||||
userConfigModule = require(path);
|
||||
} else {
|
||||
userConfigModule = await import((0, _url).pathToFileURL(path).href);
|
||||
}
|
||||
if (rawConfig) {
|
||||
return userConfigModule;
|
||||
}
|
||||
} catch (err) {
|
||||
Log.error(`Failed to load ${configFileName}, see more info here https://nextjs.org/docs/messages/next-config-error`);
|
||||
throw err;
|
||||
}
|
||||
const userConfig = await (0, _configShared).normalizeConfig(phase, userConfigModule.default || userConfigModule);
|
||||
const validateResult = (0, _configShared).validateConfig(userConfig);
|
||||
if (validateResult.errors) {
|
||||
Log.warn(`Invalid next.config.js options detected: `);
|
||||
// Only load @segment/ajv-human-errors when invalid config is detected
|
||||
const { AggregateAjvError } = require("next/dist/compiled/@segment/ajv-human-errors");
|
||||
const aggregatedAjvErrors = new AggregateAjvError(validateResult.errors, {
|
||||
fieldLabels: "js"
|
||||
});
|
||||
for (const error of aggregatedAjvErrors){
|
||||
console.error(` - ${error.message}`);
|
||||
}
|
||||
console.error("\nSee more info here: https://nextjs.org/docs/messages/invalid-next-config");
|
||||
}
|
||||
if (Object.keys(userConfig).length === 0) {
|
||||
Log.warn(`Detected ${configFileName}, no exported configuration found. https://nextjs.org/docs/messages/empty-configuration`);
|
||||
}
|
||||
if (userConfig.target && userConfig.target !== "server") {
|
||||
throw new Error(`The "target" property is no longer supported in ${configFileName}.\n` + "See more info here https://nextjs.org/docs/messages/deprecated-target-config");
|
||||
}
|
||||
if ((ref = userConfig.amp) == null ? void 0 : ref.canonicalBase) {
|
||||
const { canonicalBase } = userConfig.amp || {};
|
||||
userConfig.amp = userConfig.amp || {};
|
||||
userConfig.amp.canonicalBase = (canonicalBase.endsWith("/") ? canonicalBase.slice(0, -1) : canonicalBase) || "";
|
||||
}
|
||||
const completeConfig = assignDefaults(dir, {
|
||||
configOrigin: (0, _path).relative(dir, path),
|
||||
configFile: path,
|
||||
configFileName,
|
||||
...userConfig
|
||||
});
|
||||
setFontLoaderDefaults(completeConfig);
|
||||
return completeConfig;
|
||||
} else {
|
||||
const configBaseName = (0, _path).basename(_constants.CONFIG_FILES[0], (0, _path).extname(_constants.CONFIG_FILES[0]));
|
||||
const nonJsPath = _findUp.default.sync([
|
||||
`${configBaseName}.jsx`,
|
||||
`${configBaseName}.ts`,
|
||||
`${configBaseName}.tsx`,
|
||||
`${configBaseName}.json`,
|
||||
], {
|
||||
cwd: dir
|
||||
});
|
||||
if (nonJsPath == null ? void 0 : nonJsPath.length) {
|
||||
throw new Error(`Configuring Next.js via '${(0, _path).basename(nonJsPath)}' is not supported. Please replace the file with 'next.config.js' or 'next.config.mjs'.`);
|
||||
}
|
||||
}
|
||||
// always call assignDefaults to ensure settings like
|
||||
// reactRoot can be updated correctly even with no next.config.js
|
||||
const completeConfig = assignDefaults(dir, _configShared.defaultConfig);
|
||||
completeConfig.configFileName = configFileName;
|
||||
setHttpClientAndAgentOptions(completeConfig);
|
||||
setFontLoaderDefaults(completeConfig);
|
||||
return completeConfig;
|
||||
}
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {
|
||||
default: obj
|
||||
};
|
||||
}
|
||||
function _getRequireWildcardCache() {
|
||||
if (typeof WeakMap !== "function") return null;
|
||||
var cache = new WeakMap();
|
||||
_getRequireWildcardCache = function() {
|
||||
return cache;
|
||||
};
|
||||
return cache;
|
||||
}
|
||||
function _interopRequireWildcard(obj) {
|
||||
if (obj && obj.__esModule) {
|
||||
return obj;
|
||||
}
|
||||
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
||||
return {
|
||||
default: obj
|
||||
};
|
||||
}
|
||||
var cache = _getRequireWildcardCache();
|
||||
if (cache && cache.has(obj)) {
|
||||
return cache.get(obj);
|
||||
}
|
||||
var newObj = {};
|
||||
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
||||
for(var key in obj){
|
||||
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
||||
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
||||
if (desc && (desc.get || desc.set)) {
|
||||
Object.defineProperty(newObj, key, desc);
|
||||
} else {
|
||||
newObj[key] = obj[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
newObj.default = obj;
|
||||
if (cache) {
|
||||
cache.set(obj, newObj);
|
||||
}
|
||||
return newObj;
|
||||
}
|
||||
const NODE_16_VERSION = "16.8.0";
|
||||
const NODE_18_VERSION = "18.0.0";
|
||||
const isAboveNodejs16 = (0, _semver).gte(process.version, NODE_16_VERSION);
|
||||
const isAboveNodejs18 = (0, _semver).gte(process.version, NODE_18_VERSION);
|
||||
const experimentalWarning = (0, _utils).execOnce((configFileName, features)=>{
|
||||
const s = features.length > 1 ? "s" : "";
|
||||
Log.warn(_chalk.default.bold(`You have enabled experimental feature${s} (${features.join(", ")}) in ${configFileName}.`));
|
||||
Log.warn(`Experimental features are not covered by semver, and may cause unexpected or broken application behavior. ` + `Use at your own risk.`);
|
||||
if (features.includes("appDir")) {
|
||||
Log.info(`Thank you for testing \`appDir\` please leave your feedback at https://nextjs.link/app-feedback`);
|
||||
}
|
||||
console.warn();
|
||||
});
|
||||
function setHttpClientAndAgentOptions(config) {
|
||||
var ref;
|
||||
if (isAboveNodejs16) {
|
||||
var ref1;
|
||||
// Node.js 18 has undici built-in.
|
||||
if (((ref1 = config.experimental) == null ? void 0 : ref1.enableUndici) && !isAboveNodejs18) {
|
||||
var ref2;
|
||||
globalThis.__NEXT_USE_UNDICI = (ref2 = config.experimental) == null ? void 0 : ref2.enableUndici;
|
||||
}
|
||||
} else if ((ref = config.experimental) == null ? void 0 : ref.enableUndici) {
|
||||
Log.warn(`\`enableUndici\` option requires Node.js v${NODE_16_VERSION} or greater. Falling back to \`node-fetch\``);
|
||||
}
|
||||
if (globalThis.__NEXT_HTTP_AGENT) {
|
||||
// We only need to assign once because we want
|
||||
// to reuse the same agent for all requests.
|
||||
return;
|
||||
}
|
||||
if (!config) {
|
||||
throw new Error("Expected config.httpAgentOptions to be an object");
|
||||
}
|
||||
globalThis.__NEXT_HTTP_AGENT_OPTIONS = config.httpAgentOptions;
|
||||
globalThis.__NEXT_HTTP_AGENT = new _http.Agent(config.httpAgentOptions);
|
||||
globalThis.__NEXT_HTTPS_AGENT = new _https.Agent(config.httpAgentOptions);
|
||||
}
|
||||
function setFontLoaderDefaults(config) {
|
||||
try {
|
||||
// eslint-disable-next-line import/no-extraneous-dependencies
|
||||
require("@next/font/package.json");
|
||||
const googleFontLoader = {
|
||||
loader: "@next/font/google"
|
||||
};
|
||||
const localFontLoader = {
|
||||
loader: "@next/font/local"
|
||||
};
|
||||
if (!config.experimental) {
|
||||
config.experimental = {};
|
||||
}
|
||||
if (!config.experimental.fontLoaders) {
|
||||
config.experimental.fontLoaders = [];
|
||||
}
|
||||
if (!config.experimental.fontLoaders.find(({ loader })=>loader === googleFontLoader.loader)) {
|
||||
config.experimental.fontLoaders.push(googleFontLoader);
|
||||
}
|
||||
if (!config.experimental.fontLoaders.find(({ loader })=>loader === localFontLoader.loader)) {
|
||||
config.experimental.fontLoaders.push(localFontLoader);
|
||||
}
|
||||
} catch {}
|
||||
}
|
||||
function assignDefaults(dir, userConfig) {
|
||||
var ref10, ref3, ref4, ref5;
|
||||
const configFileName = userConfig.configFileName;
|
||||
if (typeof userConfig.exportTrailingSlash !== "undefined") {
|
||||
console.warn(_chalk.default.yellow.bold("Warning: ") + `The "exportTrailingSlash" option has been renamed to "trailingSlash". Please update your ${configFileName}.`);
|
||||
if (typeof userConfig.trailingSlash === "undefined") {
|
||||
userConfig.trailingSlash = userConfig.exportTrailingSlash;
|
||||
}
|
||||
delete userConfig.exportTrailingSlash;
|
||||
}
|
||||
const config = Object.keys(userConfig).reduce((currentConfig, key)=>{
|
||||
const value = userConfig[key];
|
||||
if (value === undefined || value === null) {
|
||||
return currentConfig;
|
||||
}
|
||||
if (key === "experimental" && typeof value === "object") {
|
||||
const enabledExperiments = [];
|
||||
// defaultConfig.experimental is predefined and will never be undefined
|
||||
// This is only a type guard for the typescript
|
||||
if (_configShared.defaultConfig.experimental) {
|
||||
for (const featureName of Object.keys(value)){
|
||||
const featureValue = value[featureName];
|
||||
if (featureName === "appDir" && featureValue === true && !isAboveNodejs16) {
|
||||
throw new Error(`experimental.appDir requires Node v${NODE_16_VERSION} or later.`);
|
||||
}
|
||||
if (value[featureName] !== _configShared.defaultConfig.experimental[featureName]) {
|
||||
enabledExperiments.push(featureName);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (enabledExperiments.length > 0) {
|
||||
experimentalWarning(configFileName, enabledExperiments);
|
||||
}
|
||||
}
|
||||
if (key === "distDir") {
|
||||
if (typeof value !== "string") {
|
||||
throw new Error(`Specified distDir is not a string, found type "${typeof value}"`);
|
||||
}
|
||||
const userDistDir = value.trim();
|
||||
// don't allow public as the distDir as this is a reserved folder for
|
||||
// public files
|
||||
if (userDistDir === "public") {
|
||||
throw new Error(`The 'public' directory is reserved in Next.js and can not be set as the 'distDir'. https://nextjs.org/docs/messages/can-not-output-to-public`);
|
||||
}
|
||||
// make sure distDir isn't an empty string as it can result in the provided
|
||||
// directory being deleted in development mode
|
||||
if (userDistDir.length === 0) {
|
||||
throw new Error(`Invalid distDir provided, distDir can not be an empty string. Please remove this config or set it to undefined`);
|
||||
}
|
||||
}
|
||||
if (key === "pageExtensions") {
|
||||
if (!Array.isArray(value)) {
|
||||
throw new Error(`Specified pageExtensions is not an array of strings, found "${value}". Please update this config or remove it.`);
|
||||
}
|
||||
if (!value.length) {
|
||||
throw new Error(`Specified pageExtensions is an empty array. Please update it with the relevant extensions or remove it.`);
|
||||
}
|
||||
value.forEach((ext)=>{
|
||||
if (typeof ext !== "string") {
|
||||
throw new Error(`Specified pageExtensions is not an array of strings, found "${ext}" of type "${typeof ext}". Please update this config or remove it.`);
|
||||
}
|
||||
});
|
||||
}
|
||||
if (!!value && value.constructor === Object) {
|
||||
currentConfig[key] = {
|
||||
..._configShared.defaultConfig[key],
|
||||
...Object.keys(value).reduce((c, k)=>{
|
||||
const v = value[k];
|
||||
if (v !== undefined && v !== null) {
|
||||
c[k] = v;
|
||||
}
|
||||
return c;
|
||||
}, {})
|
||||
};
|
||||
} else {
|
||||
currentConfig[key] = value;
|
||||
}
|
||||
return currentConfig;
|
||||
}, {});
|
||||
const result = {
|
||||
..._configShared.defaultConfig,
|
||||
...config
|
||||
};
|
||||
if (typeof result.assetPrefix !== "string") {
|
||||
throw new Error(`Specified assetPrefix is not a string, found type "${typeof result.assetPrefix}" https://nextjs.org/docs/messages/invalid-assetprefix`);
|
||||
}
|
||||
if (typeof result.basePath !== "string") {
|
||||
throw new Error(`Specified basePath is not a string, found type "${typeof result.basePath}"`);
|
||||
}
|
||||
if ((ref10 = result.experimental) == null ? void 0 : ref10.appDir) {
|
||||
result.experimental.enableUndici = true;
|
||||
}
|
||||
if (result.basePath !== "") {
|
||||
if (result.basePath === "/") {
|
||||
throw new Error(`Specified basePath /. basePath has to be either an empty string or a path prefix"`);
|
||||
}
|
||||
if (!result.basePath.startsWith("/")) {
|
||||
throw new Error(`Specified basePath has to start with a /, found "${result.basePath}"`);
|
||||
}
|
||||
if (result.basePath !== "/") {
|
||||
var ref6;
|
||||
if (result.basePath.endsWith("/")) {
|
||||
throw new Error(`Specified basePath should not end with /, found "${result.basePath}"`);
|
||||
}
|
||||
if (result.assetPrefix === "") {
|
||||
result.assetPrefix = result.basePath;
|
||||
}
|
||||
if (((ref6 = result.amp) == null ? void 0 : ref6.canonicalBase) === "") {
|
||||
result.amp.canonicalBase = result.basePath;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (result == null ? void 0 : result.images) {
|
||||
var ref7, ref8;
|
||||
const images = result.images;
|
||||
if (typeof images !== "object") {
|
||||
throw new Error(`Specified images should be an object received ${typeof images}.\nSee more info here: https://nextjs.org/docs/messages/invalid-images-config`);
|
||||
}
|
||||
if (images.domains) {
|
||||
var ref9;
|
||||
if (!Array.isArray(images.domains)) {
|
||||
throw new Error(`Specified images.domains should be an Array received ${typeof images.domains}.\nSee more info here: https://nextjs.org/docs/messages/invalid-images-config`);
|
||||
}
|
||||
// static images are automatically prefixed with assetPrefix
|
||||
// so we need to ensure _next/image allows downloading from
|
||||
// this resource
|
||||
if ((ref9 = config.assetPrefix) == null ? void 0 : ref9.startsWith("http")) {
|
||||
images.domains.push(new URL(config.assetPrefix).hostname);
|
||||
}
|
||||
if (images.domains.length > 50) {
|
||||
throw new Error(`Specified images.domains exceeds length of 50, received length (${images.domains.length}), please reduce the length of the array to continue.\nSee more info here: https://nextjs.org/docs/messages/invalid-images-config`);
|
||||
}
|
||||
const invalid = images.domains.filter((d)=>typeof d !== "string");
|
||||
if (invalid.length > 0) {
|
||||
throw new Error(`Specified images.domains should be an Array of strings received invalid values (${invalid.join(", ")}).\nSee more info here: https://nextjs.org/docs/messages/invalid-images-config`);
|
||||
}
|
||||
}
|
||||
const remotePatterns = result == null ? void 0 : (ref7 = result.images) == null ? void 0 : ref7.remotePatterns;
|
||||
if (remotePatterns) {
|
||||
if (!Array.isArray(remotePatterns)) {
|
||||
throw new Error(`Specified images.remotePatterns should be an Array received ${typeof remotePatterns}.\nSee more info here: https://nextjs.org/docs/messages/invalid-images-config`);
|
||||
}
|
||||
if (remotePatterns.length > 50) {
|
||||
throw new Error(`Specified images.remotePatterns exceeds length of 50, received length (${remotePatterns.length}), please reduce the length of the array to continue.\nSee more info here: https://nextjs.org/docs/messages/invalid-images-config`);
|
||||
}
|
||||
const validProps = new Set([
|
||||
"protocol",
|
||||
"hostname",
|
||||
"pathname",
|
||||
"port"
|
||||
]);
|
||||
const requiredProps = [
|
||||
"hostname"
|
||||
];
|
||||
const invalidPatterns = remotePatterns.filter((d)=>!d || typeof d !== "object" || Object.entries(d).some(([k, v])=>!validProps.has(k) || typeof v !== "string") || requiredProps.some((k)=>!(k in d)));
|
||||
if (invalidPatterns.length > 0) {
|
||||
throw new Error(`Invalid images.remotePatterns values:\n${invalidPatterns.map((item)=>JSON.stringify(item)).join("\n")}\n\nremotePatterns value must follow format { protocol: 'https', hostname: 'example.com', port: '', pathname: '/imgs/**' }.\nSee more info here: https://nextjs.org/docs/messages/invalid-images-config`);
|
||||
}
|
||||
}
|
||||
if (images.deviceSizes) {
|
||||
const { deviceSizes } = images;
|
||||
if (!Array.isArray(deviceSizes)) {
|
||||
throw new Error(`Specified images.deviceSizes should be an Array received ${typeof deviceSizes}.\nSee more info here: https://nextjs.org/docs/messages/invalid-images-config`);
|
||||
}
|
||||
if (deviceSizes.length > 25) {
|
||||
throw new Error(`Specified images.deviceSizes exceeds length of 25, received length (${deviceSizes.length}), please reduce the length of the array to continue.\nSee more info here: https://nextjs.org/docs/messages/invalid-images-config`);
|
||||
}
|
||||
const invalid = deviceSizes.filter((d)=>{
|
||||
return typeof d !== "number" || d < 1 || d > 10000;
|
||||
});
|
||||
if (invalid.length > 0) {
|
||||
throw new Error(`Specified images.deviceSizes should be an Array of numbers that are between 1 and 10000, received invalid values (${invalid.join(", ")}).\nSee more info here: https://nextjs.org/docs/messages/invalid-images-config`);
|
||||
}
|
||||
}
|
||||
if (images.imageSizes) {
|
||||
const { imageSizes } = images;
|
||||
if (!Array.isArray(imageSizes)) {
|
||||
throw new Error(`Specified images.imageSizes should be an Array received ${typeof imageSizes}.\nSee more info here: https://nextjs.org/docs/messages/invalid-images-config`);
|
||||
}
|
||||
if (imageSizes.length > 25) {
|
||||
throw new Error(`Specified images.imageSizes exceeds length of 25, received length (${imageSizes.length}), please reduce the length of the array to continue.\nSee more info here: https://nextjs.org/docs/messages/invalid-images-config`);
|
||||
}
|
||||
const invalid = imageSizes.filter((d)=>{
|
||||
return typeof d !== "number" || d < 1 || d > 10000;
|
||||
});
|
||||
if (invalid.length > 0) {
|
||||
throw new Error(`Specified images.imageSizes should be an Array of numbers that are between 1 and 10000, received invalid values (${invalid.join(", ")}).\nSee more info here: https://nextjs.org/docs/messages/invalid-images-config`);
|
||||
}
|
||||
}
|
||||
if (!images.loader) {
|
||||
images.loader = "default";
|
||||
}
|
||||
if (!_imageConfig.VALID_LOADERS.includes(images.loader)) {
|
||||
throw new Error(`Specified images.loader should be one of (${_imageConfig.VALID_LOADERS.join(", ")}), received invalid value (${images.loader}).\nSee more info here: https://nextjs.org/docs/messages/invalid-images-config`);
|
||||
}
|
||||
if (images.loader !== "default" && images.loader !== "custom" && images.path === _imageConfig.imageConfigDefault.path) {
|
||||
throw new Error(`Specified images.loader property (${images.loader}) also requires images.path property to be assigned to a URL prefix.\nSee more info here: https://nextjs.org/docs/api-reference/next/legacy/image#loader-configuration`);
|
||||
}
|
||||
if (images.path === _imageConfig.imageConfigDefault.path && result.basePath) {
|
||||
images.path = `${result.basePath}${images.path}`;
|
||||
}
|
||||
// Append trailing slash for non-default loaders and when trailingSlash is set
|
||||
if (images.path) {
|
||||
if (images.loader !== "default" && images.path[images.path.length - 1] !== "/" || result.trailingSlash) {
|
||||
images.path += "/";
|
||||
}
|
||||
}
|
||||
if (images.loaderFile) {
|
||||
if (images.loader !== "default" && images.loader !== "custom") {
|
||||
throw new Error(`Specified images.loader property (${images.loader}) cannot be used with images.loaderFile property. Please set images.loader to "custom".`);
|
||||
}
|
||||
const absolutePath = (0, _path).join(dir, images.loaderFile);
|
||||
if (!(0, _fs).existsSync(absolutePath)) {
|
||||
throw new Error(`Specified images.loaderFile does not exist at "${absolutePath}".`);
|
||||
}
|
||||
images.loader = "custom";
|
||||
images.loaderFile = absolutePath;
|
||||
}
|
||||
if (images.minimumCacheTTL && (!Number.isInteger(images.minimumCacheTTL) || images.minimumCacheTTL < 0)) {
|
||||
throw new Error(`Specified images.minimumCacheTTL should be an integer 0 or more received (${images.minimumCacheTTL}).\nSee more info here: https://nextjs.org/docs/messages/invalid-images-config`);
|
||||
}
|
||||
if (images.formats) {
|
||||
const { formats } = images;
|
||||
if (!Array.isArray(formats)) {
|
||||
throw new Error(`Specified images.formats should be an Array received ${typeof formats}.\nSee more info here: https://nextjs.org/docs/messages/invalid-images-config`);
|
||||
}
|
||||
if (formats.length < 1 || formats.length > 2) {
|
||||
throw new Error(`Specified images.formats must be length 1 or 2, received length (${formats.length}), please reduce the length of the array to continue.\nSee more info here: https://nextjs.org/docs/messages/invalid-images-config`);
|
||||
}
|
||||
const invalid = formats.filter((f)=>{
|
||||
return f !== "image/avif" && f !== "image/webp";
|
||||
});
|
||||
if (invalid.length > 0) {
|
||||
throw new Error(`Specified images.formats should be an Array of mime type strings, received invalid values (${invalid.join(", ")}).\nSee more info here: https://nextjs.org/docs/messages/invalid-images-config`);
|
||||
}
|
||||
}
|
||||
if (typeof images.dangerouslyAllowSVG !== "undefined" && typeof images.dangerouslyAllowSVG !== "boolean") {
|
||||
throw new Error(`Specified images.dangerouslyAllowSVG should be a boolean received (${images.dangerouslyAllowSVG}).\nSee more info here: https://nextjs.org/docs/messages/invalid-images-config`);
|
||||
}
|
||||
if (typeof images.contentSecurityPolicy !== "undefined" && typeof images.contentSecurityPolicy !== "string") {
|
||||
throw new Error(`Specified images.contentSecurityPolicy should be a string received (${images.contentSecurityPolicy}).\nSee more info here: https://nextjs.org/docs/messages/invalid-images-config`);
|
||||
}
|
||||
const unoptimized = result == null ? void 0 : (ref8 = result.images) == null ? void 0 : ref8.unoptimized;
|
||||
if (typeof unoptimized !== "undefined" && typeof unoptimized !== "boolean") {
|
||||
throw new Error(`Specified images.unoptimized should be a boolean, received (${unoptimized}).\nSee more info here: https://nextjs.org/docs/messages/invalid-images-config`);
|
||||
}
|
||||
}
|
||||
if (result.experimental && "relay" in result.experimental) {
|
||||
Log.warn(`\`relay\` has been moved out of \`experimental\` and into \`compiler\`. Please update your ${configFileName} file accordingly.`);
|
||||
result.compiler = result.compiler || {};
|
||||
result.compiler.relay = result.experimental.relay;
|
||||
}
|
||||
if (result.experimental && "styledComponents" in result.experimental) {
|
||||
Log.warn(`\`styledComponents\` has been moved out of \`experimental\` and into \`compiler\`. Please update your ${configFileName} file accordingly.`);
|
||||
result.compiler = result.compiler || {};
|
||||
result.compiler.styledComponents = result.experimental.styledComponents;
|
||||
}
|
||||
if (result.experimental && "emotion" in result.experimental) {
|
||||
Log.warn(`\`emotion\` has been moved out of \`experimental\` and into \`compiler\`. Please update your ${configFileName} file accordingly.`);
|
||||
result.compiler = result.compiler || {};
|
||||
result.compiler.emotion = result.experimental.emotion;
|
||||
}
|
||||
if (result.experimental && "reactRemoveProperties" in result.experimental) {
|
||||
Log.warn(`\`reactRemoveProperties\` has been moved out of \`experimental\` and into \`compiler\`. Please update your ${configFileName} file accordingly.`);
|
||||
result.compiler = result.compiler || {};
|
||||
result.compiler.reactRemoveProperties = result.experimental.reactRemoveProperties;
|
||||
}
|
||||
if (result.experimental && "removeConsole" in result.experimental) {
|
||||
Log.warn(`\`removeConsole\` has been moved out of \`experimental\` and into \`compiler\`. Please update your ${configFileName} file accordingly.`);
|
||||
result.compiler = result.compiler || {};
|
||||
result.compiler.removeConsole = result.experimental.removeConsole;
|
||||
}
|
||||
if ((ref3 = result.experimental) == null ? void 0 : ref3.swcMinifyDebugOptions) {
|
||||
Log.warn("SWC minify debug option specified. This option is for debugging minifier issues and will be removed once SWC minifier is stable.");
|
||||
}
|
||||
if (result.experimental.outputStandalone) {
|
||||
Log.warn(`experimental.outputStandalone has been renamed to "output: 'standalone'", please move the config.`);
|
||||
result.output = "standalone";
|
||||
}
|
||||
if (result.experimental && "transpilePackages" in result.experimental) {
|
||||
Log.warn(`\`transpilePackages\` has been moved out of \`experimental\`. Please update your ${configFileName} file accordingly.`);
|
||||
result.transpilePackages = result.experimental.transpilePackages;
|
||||
}
|
||||
if (result.experimental && "skipMiddlewareUrlNormalize" in result.experimental) {
|
||||
Log.warn(`\`skipMiddlewareUrlNormalize\` has been moved out of \`experimental\`. Please update your ${configFileName} file accordingly.`);
|
||||
result.skipMiddlewareUrlNormalize = result.experimental.skipMiddlewareUrlNormalize;
|
||||
}
|
||||
if (result.experimental && "skipTrailingSlashRedirect" in result.experimental) {
|
||||
Log.warn(`\`skipTrailingSlashRedirect\` has been moved out of \`experimental\`. Please update your ${configFileName} file accordingly.`);
|
||||
result.skipTrailingSlashRedirect = result.experimental.skipTrailingSlashRedirect;
|
||||
}
|
||||
if (((ref4 = result.experimental) == null ? void 0 : ref4.outputFileTracingRoot) && !(0, _path).isAbsolute(result.experimental.outputFileTracingRoot)) {
|
||||
result.experimental.outputFileTracingRoot = (0, _path).resolve(result.experimental.outputFileTracingRoot);
|
||||
Log.warn(`experimental.outputFileTracingRoot should be absolute, using: ${result.experimental.outputFileTracingRoot}`);
|
||||
}
|
||||
if (result.output === "standalone" && !result.outputFileTracing) {
|
||||
Log.warn(`"output: 'standalone'" requires outputFileTracing not be disabled please enable it to leverage the standalone build`);
|
||||
result.output = undefined;
|
||||
}
|
||||
setHttpClientAndAgentOptions(result || _configShared.defaultConfig);
|
||||
if (result.i18n) {
|
||||
const { i18n } = result;
|
||||
const i18nType = typeof i18n;
|
||||
if (i18nType !== "object") {
|
||||
throw new Error(`Specified i18n should be an object received ${i18nType}.\nSee more info here: https://nextjs.org/docs/messages/invalid-i18n-config`);
|
||||
}
|
||||
if (!Array.isArray(i18n.locales)) {
|
||||
throw new Error(`Specified i18n.locales should be an Array received ${typeof i18n.locales}.\nSee more info here: https://nextjs.org/docs/messages/invalid-i18n-config`);
|
||||
}
|
||||
if (i18n.locales.length > 100) {
|
||||
Log.warn(`Received ${i18n.locales.length} i18n.locales items which exceeds the recommended max of 100.\nSee more info here: https://nextjs.org/docs/advanced-features/i18n-routing#how-does-this-work-with-static-generation`);
|
||||
}
|
||||
const defaultLocaleType = typeof i18n.defaultLocale;
|
||||
if (!i18n.defaultLocale || defaultLocaleType !== "string") {
|
||||
throw new Error(`Specified i18n.defaultLocale should be a string.\nSee more info here: https://nextjs.org/docs/messages/invalid-i18n-config`);
|
||||
}
|
||||
if (typeof i18n.domains !== "undefined" && !Array.isArray(i18n.domains)) {
|
||||
throw new Error(`Specified i18n.domains must be an array of domain objects e.g. [ { domain: 'example.fr', defaultLocale: 'fr', locales: ['fr'] } ] received ${typeof i18n.domains}.\nSee more info here: https://nextjs.org/docs/messages/invalid-i18n-config`);
|
||||
}
|
||||
if (i18n.domains) {
|
||||
const invalidDomainItems = i18n.domains.filter((item)=>{
|
||||
var ref;
|
||||
if (!item || typeof item !== "object") return true;
|
||||
if (!item.defaultLocale) return true;
|
||||
if (!item.domain || typeof item.domain !== "string") return true;
|
||||
const defaultLocaleDuplicate = (ref = i18n.domains) == null ? void 0 : ref.find((altItem)=>altItem.defaultLocale === item.defaultLocale && altItem.domain !== item.domain);
|
||||
if (defaultLocaleDuplicate) {
|
||||
console.warn(`Both ${item.domain} and ${defaultLocaleDuplicate.domain} configured the defaultLocale ${item.defaultLocale} but only one can. Change one item's default locale to continue`);
|
||||
return true;
|
||||
}
|
||||
let hasInvalidLocale = false;
|
||||
if (Array.isArray(item.locales)) {
|
||||
for (const locale of item.locales){
|
||||
if (typeof locale !== "string") hasInvalidLocale = true;
|
||||
for (const domainItem of i18n.domains || []){
|
||||
if (domainItem === item) continue;
|
||||
if (domainItem.locales && domainItem.locales.includes(locale)) {
|
||||
console.warn(`Both ${item.domain} and ${domainItem.domain} configured the locale (${locale}) but only one can. Remove it from one i18n.domains config to continue`);
|
||||
hasInvalidLocale = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return hasInvalidLocale;
|
||||
});
|
||||
if (invalidDomainItems.length > 0) {
|
||||
throw new Error(`Invalid i18n.domains values:\n${invalidDomainItems.map((item)=>JSON.stringify(item)).join("\n")}\n\ndomains value must follow format { domain: 'example.fr', defaultLocale: 'fr', locales: ['fr'] }.\nSee more info here: https://nextjs.org/docs/messages/invalid-i18n-config`);
|
||||
}
|
||||
}
|
||||
if (!Array.isArray(i18n.locales)) {
|
||||
throw new Error(`Specified i18n.locales must be an array of locale strings e.g. ["en-US", "nl-NL"] received ${typeof i18n.locales}.\nSee more info here: https://nextjs.org/docs/messages/invalid-i18n-config`);
|
||||
}
|
||||
const invalidLocales = i18n.locales.filter((locale)=>typeof locale !== "string");
|
||||
if (invalidLocales.length > 0) {
|
||||
throw new Error(`Specified i18n.locales contains invalid values (${invalidLocales.map(String).join(", ")}), locales must be valid locale tags provided as strings e.g. "en-US".\n` + `See here for list of valid language sub-tags: http://www.iana.org/assignments/language-subtag-registry/language-subtag-registry`);
|
||||
}
|
||||
if (!i18n.locales.includes(i18n.defaultLocale)) {
|
||||
throw new Error(`Specified i18n.defaultLocale should be included in i18n.locales.\nSee more info here: https://nextjs.org/docs/messages/invalid-i18n-config`);
|
||||
}
|
||||
const normalizedLocales = new Set();
|
||||
const duplicateLocales = new Set();
|
||||
i18n.locales.forEach((locale)=>{
|
||||
const localeLower = locale.toLowerCase();
|
||||
if (normalizedLocales.has(localeLower)) {
|
||||
duplicateLocales.add(locale);
|
||||
}
|
||||
normalizedLocales.add(localeLower);
|
||||
});
|
||||
if (duplicateLocales.size > 0) {
|
||||
throw new Error(`Specified i18n.locales contains the following duplicate locales:\n` + `${[
|
||||
...duplicateLocales
|
||||
].join(", ")}\n` + `Each locale should be listed only once.\n` + `See more info here: https://nextjs.org/docs/messages/invalid-i18n-config`);
|
||||
}
|
||||
// make sure default Locale is at the front
|
||||
i18n.locales = [
|
||||
i18n.defaultLocale,
|
||||
...i18n.locales.filter((locale)=>locale !== i18n.defaultLocale),
|
||||
];
|
||||
const localeDetectionType = typeof i18n.localeDetection;
|
||||
if (localeDetectionType !== "boolean" && localeDetectionType !== "undefined") {
|
||||
throw new Error(`Specified i18n.localeDetection should be undefined or a boolean received ${localeDetectionType}.\nSee more info here: https://nextjs.org/docs/messages/invalid-i18n-config`);
|
||||
}
|
||||
}
|
||||
if ((ref5 = result.devIndicators) == null ? void 0 : ref5.buildActivityPosition) {
|
||||
const { buildActivityPosition } = result.devIndicators;
|
||||
const allowedValues = [
|
||||
"top-left",
|
||||
"top-right",
|
||||
"bottom-left",
|
||||
"bottom-right",
|
||||
];
|
||||
if (!allowedValues.includes(buildActivityPosition)) {
|
||||
throw new Error(`Invalid "devIndicator.buildActivityPosition" provided, expected one of ${allowedValues.join(", ")}, received ${buildActivityPosition}`);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=config.js.map
|
||||
1
kitabcitab/node_modules/next/dist/server/config.js.map
generated
vendored
Normal file
1
kitabcitab/node_modules/next/dist/server/config.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
3
kitabcitab/node_modules/next/dist/server/crypto-utils.d.ts
generated
vendored
Normal file
3
kitabcitab/node_modules/next/dist/server/crypto-utils.d.ts
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
/// <reference types="node" />
|
||||
export declare function encryptWithSecret(secret: Buffer, data: string): string;
|
||||
export declare function decryptWithSecret(secret: Buffer, encryptedData: string): string;
|
||||
54
kitabcitab/node_modules/next/dist/server/crypto-utils.js
generated
vendored
Normal file
54
kitabcitab/node_modules/next/dist/server/crypto-utils.js
generated
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.encryptWithSecret = encryptWithSecret;
|
||||
exports.decryptWithSecret = decryptWithSecret;
|
||||
var _crypto = _interopRequireDefault(require("crypto"));
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {
|
||||
default: obj
|
||||
};
|
||||
}
|
||||
// Background:
|
||||
// https://security.stackexchange.com/questions/184305/why-would-i-ever-use-aes-256-cbc-if-aes-256-gcm-is-more-secure
|
||||
const CIPHER_ALGORITHM = `aes-256-gcm`, CIPHER_KEY_LENGTH = 32, CIPHER_IV_LENGTH = 16, CIPHER_TAG_LENGTH = 16, CIPHER_SALT_LENGTH = 64;
|
||||
const PBKDF2_ITERATIONS = 100000 // https://support.1password.com/pbkdf2/
|
||||
;
|
||||
function encryptWithSecret(secret, data) {
|
||||
const iv = _crypto.default.randomBytes(CIPHER_IV_LENGTH);
|
||||
const salt = _crypto.default.randomBytes(CIPHER_SALT_LENGTH);
|
||||
// https://nodejs.org/api/crypto.html#crypto_crypto_pbkdf2sync_password_salt_iterations_keylen_digest
|
||||
const key = _crypto.default.pbkdf2Sync(secret, salt, PBKDF2_ITERATIONS, CIPHER_KEY_LENGTH, `sha512`);
|
||||
const cipher = _crypto.default.createCipheriv(CIPHER_ALGORITHM, key, iv);
|
||||
const encrypted = Buffer.concat([
|
||||
cipher.update(data, `utf8`),
|
||||
cipher.final()
|
||||
]);
|
||||
// https://nodejs.org/api/crypto.html#crypto_cipher_getauthtag
|
||||
const tag = cipher.getAuthTag();
|
||||
return Buffer.concat([
|
||||
// Data as required by:
|
||||
// Salt for Key: https://nodejs.org/api/crypto.html#crypto_crypto_pbkdf2sync_password_salt_iterations_keylen_digest
|
||||
// IV: https://nodejs.org/api/crypto.html#crypto_class_decipher
|
||||
// Tag: https://nodejs.org/api/crypto.html#crypto_decipher_setauthtag_buffer
|
||||
salt,
|
||||
iv,
|
||||
tag,
|
||||
encrypted,
|
||||
]).toString(`hex`);
|
||||
}
|
||||
function decryptWithSecret(secret, encryptedData) {
|
||||
const buffer = Buffer.from(encryptedData, `hex`);
|
||||
const salt = buffer.slice(0, CIPHER_SALT_LENGTH);
|
||||
const iv = buffer.slice(CIPHER_SALT_LENGTH, CIPHER_SALT_LENGTH + CIPHER_IV_LENGTH);
|
||||
const tag = buffer.slice(CIPHER_SALT_LENGTH + CIPHER_IV_LENGTH, CIPHER_SALT_LENGTH + CIPHER_IV_LENGTH + CIPHER_TAG_LENGTH);
|
||||
const encrypted = buffer.slice(CIPHER_SALT_LENGTH + CIPHER_IV_LENGTH + CIPHER_TAG_LENGTH);
|
||||
// https://nodejs.org/api/crypto.html#crypto_crypto_pbkdf2sync_password_salt_iterations_keylen_digest
|
||||
const key = _crypto.default.pbkdf2Sync(secret, salt, PBKDF2_ITERATIONS, CIPHER_KEY_LENGTH, `sha512`);
|
||||
const decipher = _crypto.default.createDecipheriv(CIPHER_ALGORITHM, key, iv);
|
||||
decipher.setAuthTag(tag);
|
||||
return decipher.update(encrypted) + decipher.final(`utf8`);
|
||||
}
|
||||
|
||||
//# sourceMappingURL=crypto-utils.js.map
|
||||
1
kitabcitab/node_modules/next/dist/server/crypto-utils.js.map
generated
vendored
Normal file
1
kitabcitab/node_modules/next/dist/server/crypto-utils.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../server/crypto-utils.ts"],"names":["encryptWithSecret","decryptWithSecret","CIPHER_ALGORITHM","CIPHER_KEY_LENGTH","CIPHER_IV_LENGTH","CIPHER_TAG_LENGTH","CIPHER_SALT_LENGTH","PBKDF2_ITERATIONS","secret","data","iv","crypto","randomBytes","salt","key","pbkdf2Sync","cipher","createCipheriv","encrypted","Buffer","concat","update","final","tag","getAuthTag","toString","encryptedData","buffer","from","slice","decipher","createDecipheriv","setAuthTag"],"mappings":"AAAA;;;;QAagBA,iBAAiB,GAAjBA,iBAAiB;QA+BjBC,iBAAiB,GAAjBA,iBAAiB;AA5Cd,IAAA,OAAQ,kCAAR,QAAQ,EAAA;;;;;;AAE3B,cAAc;AACd,qHAAqH;AAErH,MAAMC,gBAAgB,GAAG,CAAC,WAAW,CAAC,EACpCC,iBAAiB,GAAG,EAAE,EACtBC,gBAAgB,GAAG,EAAE,EACrBC,iBAAiB,GAAG,EAAE,EACtBC,kBAAkB,GAAG,EAAE;AAEzB,MAAMC,iBAAiB,GAAG,MAAO,CAAC,wCAAwC;AAAzC;AAE1B,SAASP,iBAAiB,CAACQ,MAAc,EAAEC,IAAY,EAAU;IACtE,MAAMC,EAAE,GAAGC,OAAM,QAAA,CAACC,WAAW,CAACR,gBAAgB,CAAC;IAC/C,MAAMS,IAAI,GAAGF,OAAM,QAAA,CAACC,WAAW,CAACN,kBAAkB,CAAC;IAEnD,qGAAqG;IACrG,MAAMQ,GAAG,GAAGH,OAAM,QAAA,CAACI,UAAU,CAC3BP,MAAM,EACNK,IAAI,EACJN,iBAAiB,EACjBJ,iBAAiB,EACjB,CAAC,MAAM,CAAC,CACT;IAED,MAAMa,MAAM,GAAGL,OAAM,QAAA,CAACM,cAAc,CAACf,gBAAgB,EAAEY,GAAG,EAAEJ,EAAE,CAAC;IAC/D,MAAMQ,SAAS,GAAGC,MAAM,CAACC,MAAM,CAAC;QAACJ,MAAM,CAACK,MAAM,CAACZ,IAAI,EAAE,CAAC,IAAI,CAAC,CAAC;QAAEO,MAAM,CAACM,KAAK,EAAE;KAAC,CAAC;IAE9E,8DAA8D;IAC9D,MAAMC,GAAG,GAAGP,MAAM,CAACQ,UAAU,EAAE;IAE/B,OAAOL,MAAM,CAACC,MAAM,CAAC;QACnB,uBAAuB;QACvB,mHAAmH;QACnH,+DAA+D;QAC/D,4EAA4E;QAC5EP,IAAI;QACJH,EAAE;QACFa,GAAG;QACHL,SAAS;KACV,CAAC,CAACO,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAC,CAAA;CACnB;AAEM,SAASxB,iBAAiB,CAC/BO,MAAc,EACdkB,aAAqB,EACb;IACR,MAAMC,MAAM,GAAGR,MAAM,CAACS,IAAI,CAACF,aAAa,EAAE,CAAC,GAAG,CAAC,CAAC;IAEhD,MAAMb,IAAI,GAAGc,MAAM,CAACE,KAAK,CAAC,CAAC,EAAEvB,kBAAkB,CAAC;IAChD,MAAMI,EAAE,GAAGiB,MAAM,CAACE,KAAK,CACrBvB,kBAAkB,EAClBA,kBAAkB,GAAGF,gBAAgB,CACtC;IACD,MAAMmB,GAAG,GAAGI,MAAM,CAACE,KAAK,CACtBvB,kBAAkB,GAAGF,gBAAgB,EACrCE,kBAAkB,GAAGF,gBAAgB,GAAGC,iBAAiB,CAC1D;IACD,MAAMa,SAAS,GAAGS,MAAM,CAACE,KAAK,CAC5BvB,kBAAkB,GAAGF,gBAAgB,GAAGC,iBAAiB,CAC1D;IAED,qGAAqG;IACrG,MAAMS,GAAG,GAAGH,OAAM,QAAA,CAACI,UAAU,CAC3BP,MAAM,EACNK,IAAI,EACJN,iBAAiB,EACjBJ,iBAAiB,EACjB,CAAC,MAAM,CAAC,CACT;IAED,MAAM2B,QAAQ,GAAGnB,OAAM,QAAA,CAACoB,gBAAgB,CAAC7B,gBAAgB,EAAEY,GAAG,EAAEJ,EAAE,CAAC;IACnEoB,QAAQ,CAACE,UAAU,CAACT,GAAG,CAAC;IAExB,OAAOO,QAAQ,CAACT,MAAM,CAACH,SAAS,CAAC,GAAGY,QAAQ,CAACR,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,CAAA;CAC3D"}
|
||||
44
kitabcitab/node_modules/next/dist/server/dev/hot-middleware.d.ts
generated
vendored
Normal file
44
kitabcitab/node_modules/next/dist/server/dev/hot-middleware.d.ts
generated
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
import type { webpack } from 'next/dist/compiled/webpack/webpack';
|
||||
import type ws from 'ws';
|
||||
declare class EventStream {
|
||||
clients: Set<ws>;
|
||||
constructor();
|
||||
everyClient(fn: (client: ws) => void): void;
|
||||
close(): void;
|
||||
handler(client: ws): void;
|
||||
publish(payload: any): void;
|
||||
}
|
||||
export declare class WebpackHotMiddleware {
|
||||
eventStream: EventStream;
|
||||
clientLatestStats: {
|
||||
ts: number;
|
||||
stats: webpack.Stats;
|
||||
} | null;
|
||||
middlewareLatestStats: {
|
||||
ts: number;
|
||||
stats: webpack.Stats;
|
||||
} | null;
|
||||
serverLatestStats: {
|
||||
ts: number;
|
||||
stats: webpack.Stats;
|
||||
} | null;
|
||||
closed: boolean;
|
||||
constructor(compilers: webpack.Compiler[]);
|
||||
onClientInvalid: () => void;
|
||||
onClientDone: (statsResult: webpack.Stats) => void;
|
||||
onServerInvalid: () => void;
|
||||
onServerDone: (statsResult: webpack.Stats) => void;
|
||||
onEdgeServerInvalid: () => void;
|
||||
onEdgeServerDone: (statsResult: webpack.Stats) => void;
|
||||
/**
|
||||
* To sync we use the most recent stats but also we append middleware
|
||||
* errors. This is because it is possible that middleware fails to compile
|
||||
* and we still want to show the client overlay with the error while
|
||||
* the error page should be rendered just fine.
|
||||
*/
|
||||
onHMR: (client: ws) => void;
|
||||
publishStats: (action: string, statsResult: webpack.Stats) => void;
|
||||
publish: (payload: any) => void;
|
||||
close: () => void;
|
||||
}
|
||||
export {};
|
||||
178
kitabcitab/node_modules/next/dist/server/dev/hot-middleware.js
generated
vendored
Normal file
178
kitabcitab/node_modules/next/dist/server/dev/hot-middleware.js
generated
vendored
Normal file
@@ -0,0 +1,178 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
var _utils = require("../../build/utils");
|
||||
var _nonNullable = require("../../lib/non-nullable");
|
||||
function isMiddlewareStats(stats) {
|
||||
for (const key of stats.compilation.entrypoints.keys()){
|
||||
if ((0, _utils).isMiddlewareFilename(key)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function statsToJson(stats) {
|
||||
if (!stats) return {};
|
||||
return stats.toJson({
|
||||
all: false,
|
||||
errors: true,
|
||||
hash: true,
|
||||
warnings: true
|
||||
});
|
||||
}
|
||||
class EventStream {
|
||||
constructor(){
|
||||
this.clients = new Set();
|
||||
}
|
||||
everyClient(fn) {
|
||||
for (const client of this.clients){
|
||||
fn(client);
|
||||
}
|
||||
}
|
||||
close() {
|
||||
this.everyClient((client)=>{
|
||||
client.close();
|
||||
});
|
||||
this.clients.clear();
|
||||
}
|
||||
handler(client) {
|
||||
this.clients.add(client);
|
||||
client.addEventListener("close", ()=>{
|
||||
this.clients.delete(client);
|
||||
});
|
||||
}
|
||||
publish(payload) {
|
||||
this.everyClient((client)=>{
|
||||
client.send(JSON.stringify(payload));
|
||||
});
|
||||
}
|
||||
}
|
||||
class WebpackHotMiddleware {
|
||||
constructor(compilers){
|
||||
this.eventStream = new EventStream();
|
||||
this.clientLatestStats = null;
|
||||
this.middlewareLatestStats = null;
|
||||
this.serverLatestStats = null;
|
||||
this.closed = false;
|
||||
compilers[0].hooks.invalid.tap("webpack-hot-middleware", this.onClientInvalid);
|
||||
compilers[0].hooks.done.tap("webpack-hot-middleware", this.onClientDone);
|
||||
compilers[1].hooks.invalid.tap("webpack-hot-middleware", this.onServerInvalid);
|
||||
compilers[1].hooks.done.tap("webpack-hot-middleware", this.onServerDone);
|
||||
compilers[2].hooks.done.tap("webpack-hot-middleware", this.onEdgeServerDone);
|
||||
compilers[2].hooks.invalid.tap("webpack-hot-middleware", this.onEdgeServerInvalid);
|
||||
}
|
||||
onClientInvalid = ()=>{
|
||||
var ref;
|
||||
if (this.closed || ((ref = this.serverLatestStats) == null ? void 0 : ref.stats.hasErrors())) return;
|
||||
this.eventStream.publish({
|
||||
action: "building"
|
||||
});
|
||||
};
|
||||
onClientDone = (statsResult)=>{
|
||||
var ref;
|
||||
this.clientLatestStats = {
|
||||
ts: Date.now(),
|
||||
stats: statsResult
|
||||
};
|
||||
if (this.closed || ((ref = this.serverLatestStats) == null ? void 0 : ref.stats.hasErrors())) return;
|
||||
this.publishStats("built", statsResult);
|
||||
};
|
||||
onServerInvalid = ()=>{
|
||||
var ref, ref1;
|
||||
if (!((ref = this.serverLatestStats) == null ? void 0 : ref.stats.hasErrors())) return;
|
||||
this.serverLatestStats = null;
|
||||
if ((ref1 = this.clientLatestStats) == null ? void 0 : ref1.stats) {
|
||||
this.publishStats("built", this.clientLatestStats.stats);
|
||||
}
|
||||
};
|
||||
onServerDone = (statsResult)=>{
|
||||
if (this.closed) return;
|
||||
if (statsResult.hasErrors()) {
|
||||
this.serverLatestStats = {
|
||||
ts: Date.now(),
|
||||
stats: statsResult
|
||||
};
|
||||
this.publishStats("built", statsResult);
|
||||
}
|
||||
};
|
||||
onEdgeServerInvalid = ()=>{
|
||||
var ref, ref2;
|
||||
if (!((ref = this.middlewareLatestStats) == null ? void 0 : ref.stats.hasErrors())) return;
|
||||
this.middlewareLatestStats = null;
|
||||
if ((ref2 = this.clientLatestStats) == null ? void 0 : ref2.stats) {
|
||||
this.publishStats("built", this.clientLatestStats.stats);
|
||||
}
|
||||
};
|
||||
onEdgeServerDone = (statsResult)=>{
|
||||
if (!isMiddlewareStats(statsResult)) {
|
||||
this.onServerDone(statsResult);
|
||||
return;
|
||||
}
|
||||
if (statsResult.hasErrors()) {
|
||||
this.middlewareLatestStats = {
|
||||
ts: Date.now(),
|
||||
stats: statsResult
|
||||
};
|
||||
this.publishStats("built", statsResult);
|
||||
}
|
||||
};
|
||||
/**
|
||||
* To sync we use the most recent stats but also we append middleware
|
||||
* errors. This is because it is possible that middleware fails to compile
|
||||
* and we still want to show the client overlay with the error while
|
||||
* the error page should be rendered just fine.
|
||||
*/ onHMR = (client)=>{
|
||||
if (this.closed) return;
|
||||
this.eventStream.handler(client);
|
||||
const [latestStats] = [
|
||||
this.clientLatestStats,
|
||||
this.serverLatestStats
|
||||
].filter(_nonNullable.nonNullable).sort((statsA, statsB)=>statsB.ts - statsA.ts);
|
||||
if (latestStats == null ? void 0 : latestStats.stats) {
|
||||
var ref;
|
||||
const stats = statsToJson(latestStats.stats);
|
||||
const middlewareStats = statsToJson((ref = this.middlewareLatestStats) == null ? void 0 : ref.stats);
|
||||
this.eventStream.publish({
|
||||
action: "sync",
|
||||
hash: stats.hash,
|
||||
errors: [
|
||||
...stats.errors || [],
|
||||
...middlewareStats.errors || []
|
||||
],
|
||||
warnings: [
|
||||
...stats.warnings || [],
|
||||
...middlewareStats.warnings || [],
|
||||
]
|
||||
});
|
||||
}
|
||||
};
|
||||
publishStats = (action, statsResult)=>{
|
||||
const stats = statsResult.toJson({
|
||||
all: false,
|
||||
hash: true,
|
||||
warnings: true,
|
||||
errors: true
|
||||
});
|
||||
this.eventStream.publish({
|
||||
action: action,
|
||||
hash: stats.hash,
|
||||
warnings: stats.warnings || [],
|
||||
errors: stats.errors || []
|
||||
});
|
||||
};
|
||||
publish = (payload)=>{
|
||||
if (this.closed) return;
|
||||
this.eventStream.publish(payload);
|
||||
};
|
||||
close = ()=>{
|
||||
if (this.closed) return;
|
||||
// Can't remove compiler plugins, so we just set a flag and noop if closed
|
||||
// https://github.com/webpack/tapable/issues/32#issuecomment-350644466
|
||||
this.closed = true;
|
||||
this.eventStream.close();
|
||||
};
|
||||
}
|
||||
exports.WebpackHotMiddleware = WebpackHotMiddleware;
|
||||
|
||||
//# sourceMappingURL=hot-middleware.js.map
|
||||
1
kitabcitab/node_modules/next/dist/server/dev/hot-middleware.js.map
generated
vendored
Normal file
1
kitabcitab/node_modules/next/dist/server/dev/hot-middleware.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
67
kitabcitab/node_modules/next/dist/server/dev/hot-reloader.d.ts
generated
vendored
Normal file
67
kitabcitab/node_modules/next/dist/server/dev/hot-reloader.d.ts
generated
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
/// <reference types="node" />
|
||||
/// <reference types="node" />
|
||||
/// <reference types="node" />
|
||||
import { webpack } from 'next/dist/compiled/webpack/webpack';
|
||||
import type { NextConfigComplete } from '../config-shared';
|
||||
import type { CustomRoutes } from '../../lib/load-custom-routes';
|
||||
import { IncomingMessage, ServerResponse } from 'http';
|
||||
import { UrlObject } from 'url';
|
||||
import getBaseWebpackConfig from '../../build/webpack-config';
|
||||
import { __ApiPreviewProps } from '../api-utils';
|
||||
import { UnwrapPromise } from '../../lib/coalesced-function';
|
||||
export declare function renderScriptError(res: ServerResponse, error: Error, { verbose }?: {
|
||||
verbose?: boolean | undefined;
|
||||
}): Promise<void>;
|
||||
export default class HotReloader {
|
||||
private dir;
|
||||
private buildId;
|
||||
private interceptors;
|
||||
private pagesDir?;
|
||||
private distDir;
|
||||
private webpackHotMiddleware?;
|
||||
private config;
|
||||
hasServerComponents: boolean;
|
||||
clientStats: webpack.Stats | null;
|
||||
serverStats: webpack.Stats | null;
|
||||
edgeServerStats: webpack.Stats | null;
|
||||
private clientError;
|
||||
private serverError;
|
||||
private serverPrevDocumentHash;
|
||||
private prevChunkNames?;
|
||||
private onDemandEntries?;
|
||||
private previewProps;
|
||||
private watcher;
|
||||
private rewrites;
|
||||
private fallbackWatcher;
|
||||
private hotReloaderSpan;
|
||||
private pagesMapping;
|
||||
private appDir?;
|
||||
multiCompiler?: webpack.MultiCompiler;
|
||||
activeConfigs?: Array<UnwrapPromise<ReturnType<typeof getBaseWebpackConfig>>>;
|
||||
constructor(dir: string, { config, pagesDir, distDir, buildId, previewProps, rewrites, appDir, }: {
|
||||
config: NextConfigComplete;
|
||||
pagesDir?: string;
|
||||
distDir: string;
|
||||
buildId: string;
|
||||
previewProps: __ApiPreviewProps;
|
||||
rewrites: CustomRoutes['rewrites'];
|
||||
appDir?: string;
|
||||
});
|
||||
run(req: IncomingMessage, res: ServerResponse, parsedUrl: UrlObject): Promise<{
|
||||
finished?: true;
|
||||
}>;
|
||||
onHMR(req: IncomingMessage, _res: ServerResponse, head: Buffer): void;
|
||||
private clean;
|
||||
private getWebpackConfig;
|
||||
buildFallbackError(): Promise<void>;
|
||||
start(): Promise<void>;
|
||||
invalidate(): void;
|
||||
stop(): Promise<void>;
|
||||
getCompilationErrors(page: string): Promise<any[]>;
|
||||
send(action?: string | any, ...args: any[]): void;
|
||||
ensurePage({ page, clientOnly, appPaths, }: {
|
||||
page: string;
|
||||
clientOnly: boolean;
|
||||
appPaths?: string[] | null;
|
||||
}): Promise<void>;
|
||||
}
|
||||
867
kitabcitab/node_modules/next/dist/server/dev/hot-reloader.js
generated
vendored
Normal file
867
kitabcitab/node_modules/next/dist/server/dev/hot-reloader.js
generated
vendored
Normal file
@@ -0,0 +1,867 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.renderScriptError = renderScriptError;
|
||||
exports.default = void 0;
|
||||
var _webpack = require("next/dist/compiled/webpack/webpack");
|
||||
var _middleware = require("next/dist/compiled/@next/react-dev-overlay/dist/middleware");
|
||||
var _hotMiddleware = require("./hot-middleware");
|
||||
var _path = require("path");
|
||||
var _entries = require("../../build/entries");
|
||||
var _output = require("../../build/output");
|
||||
var Log = _interopRequireWildcard(require("../../build/output/log"));
|
||||
var _webpackConfig = _interopRequireDefault(require("../../build/webpack-config"));
|
||||
var _constants = require("../../lib/constants");
|
||||
var _recursiveDelete = require("../../lib/recursive-delete");
|
||||
var _constants1 = require("../../shared/lib/constants");
|
||||
var _pathMatch = require("../../shared/lib/router/utils/path-match");
|
||||
var _findPageFile = require("../lib/find-page-file");
|
||||
var _onDemandEntryHandler = require("./on-demand-entry-handler");
|
||||
var _denormalizePagePath = require("../../shared/lib/page-path/denormalize-page-path");
|
||||
var _normalizePathSep = require("../../shared/lib/page-path/normalize-path-sep");
|
||||
var _getRouteFromEntrypoint = _interopRequireDefault(require("../get-route-from-entrypoint"));
|
||||
var _fileExists = require("../../lib/file-exists");
|
||||
var _utils = require("../../build/utils");
|
||||
var _utils1 = require("../../shared/lib/utils");
|
||||
var _trace = require("../../trace");
|
||||
var _isError = require("../../lib/is-error");
|
||||
var _ws = _interopRequireDefault(require("next/dist/compiled/ws"));
|
||||
var _fs = require("fs");
|
||||
var _getPageStaticInfo = require("../../build/analysis/get-page-static-info");
|
||||
class HotReloader {
|
||||
clientError = null;
|
||||
serverError = null;
|
||||
pagesMapping = {};
|
||||
constructor(dir, { config , pagesDir , distDir , buildId , previewProps , rewrites , appDir }){
|
||||
this.buildId = buildId;
|
||||
this.dir = dir;
|
||||
this.interceptors = [];
|
||||
this.pagesDir = pagesDir;
|
||||
this.appDir = appDir;
|
||||
this.distDir = distDir;
|
||||
this.clientStats = null;
|
||||
this.serverStats = null;
|
||||
this.edgeServerStats = null;
|
||||
this.serverPrevDocumentHash = null;
|
||||
this.config = config;
|
||||
this.hasServerComponents = !!this.appDir;
|
||||
this.previewProps = previewProps;
|
||||
this.rewrites = rewrites;
|
||||
this.hotReloaderSpan = (0, _trace).trace("hot-reloader", undefined, {
|
||||
version: "13.1.1"
|
||||
});
|
||||
// Ensure the hotReloaderSpan is flushed immediately as it's the parentSpan for all processing
|
||||
// of the current `next dev` invocation.
|
||||
this.hotReloaderSpan.stop();
|
||||
}
|
||||
async run(req, res, parsedUrl) {
|
||||
// Usually CORS support is not needed for the hot-reloader (this is dev only feature)
|
||||
// With when the app runs for multi-zones support behind a proxy,
|
||||
// the current page is trying to access this URL via assetPrefix.
|
||||
// That's when the CORS support is needed.
|
||||
const { preflight } = addCorsSupport(req, res);
|
||||
if (preflight) {
|
||||
return {};
|
||||
}
|
||||
// When a request comes in that is a page bundle, e.g. /_next/static/<buildid>/pages/index.js
|
||||
// we have to compile the page using on-demand-entries, this middleware will handle doing that
|
||||
// by adding the page to on-demand-entries, waiting till it's done
|
||||
// and then the bundle will be served like usual by the actual route in server/index.js
|
||||
const handlePageBundleRequest = async (pageBundleRes, parsedPageBundleUrl)=>{
|
||||
const { pathname } = parsedPageBundleUrl;
|
||||
const params = matchNextPageBundleRequest(pathname);
|
||||
if (!params) {
|
||||
return {};
|
||||
}
|
||||
let decodedPagePath;
|
||||
try {
|
||||
decodedPagePath = `/${params.path.map((param)=>decodeURIComponent(param)).join("/")}`;
|
||||
} catch (_) {
|
||||
throw new _utils1.DecodeError("failed to decode param");
|
||||
}
|
||||
const page = (0, _denormalizePagePath).denormalizePagePath(decodedPagePath);
|
||||
if (page === "/_error" || _constants1.BLOCKED_PAGES.indexOf(page) === -1) {
|
||||
try {
|
||||
await this.ensurePage({
|
||||
page,
|
||||
clientOnly: true
|
||||
});
|
||||
} catch (error) {
|
||||
await renderScriptError(pageBundleRes, (0, _isError).getProperError(error));
|
||||
return {
|
||||
finished: true
|
||||
};
|
||||
}
|
||||
const errors = await this.getCompilationErrors(page);
|
||||
if (errors.length > 0) {
|
||||
await renderScriptError(pageBundleRes, errors[0], {
|
||||
verbose: false
|
||||
});
|
||||
return {
|
||||
finished: true
|
||||
};
|
||||
}
|
||||
}
|
||||
return {};
|
||||
};
|
||||
const { finished } = await handlePageBundleRequest(res, parsedUrl);
|
||||
for (const fn of this.interceptors){
|
||||
await new Promise((resolve, reject)=>{
|
||||
fn(req, res, (err)=>{
|
||||
if (err) return reject(err);
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
}
|
||||
return {
|
||||
finished
|
||||
};
|
||||
}
|
||||
onHMR(req, _res, head) {
|
||||
wsServer.handleUpgrade(req, req.socket, head, (client)=>{
|
||||
var ref2, ref1;
|
||||
(ref2 = this.webpackHotMiddleware) == null ? void 0 : ref2.onHMR(client);
|
||||
(ref1 = this.onDemandEntries) == null ? void 0 : ref1.onHMR(client);
|
||||
client.addEventListener("message", ({ data })=>{
|
||||
data = typeof data !== "string" ? data.toString() : data;
|
||||
try {
|
||||
const payload = JSON.parse(data);
|
||||
let traceChild;
|
||||
switch(payload.event){
|
||||
case "client-hmr-latency":
|
||||
{
|
||||
traceChild = {
|
||||
name: payload.event,
|
||||
startTime: BigInt(payload.startTime * 1000 * 1000),
|
||||
endTime: BigInt(payload.endTime * 1000 * 1000)
|
||||
};
|
||||
break;
|
||||
}
|
||||
case "client-reload-page":
|
||||
case "client-success":
|
||||
{
|
||||
traceChild = {
|
||||
name: payload.event
|
||||
};
|
||||
break;
|
||||
}
|
||||
case "client-error":
|
||||
{
|
||||
traceChild = {
|
||||
name: payload.event,
|
||||
attrs: {
|
||||
errorCount: payload.errorCount
|
||||
}
|
||||
};
|
||||
break;
|
||||
}
|
||||
case "client-warning":
|
||||
{
|
||||
traceChild = {
|
||||
name: payload.event,
|
||||
attrs: {
|
||||
warningCount: payload.warningCount
|
||||
}
|
||||
};
|
||||
break;
|
||||
}
|
||||
case "client-removed-page":
|
||||
case "client-added-page":
|
||||
{
|
||||
traceChild = {
|
||||
name: payload.event,
|
||||
attrs: {
|
||||
page: payload.page || ""
|
||||
}
|
||||
};
|
||||
break;
|
||||
}
|
||||
case "client-full-reload":
|
||||
{
|
||||
const { event , stackTrace , hadRuntimeError } = payload;
|
||||
traceChild = {
|
||||
name: event,
|
||||
attrs: {
|
||||
stackTrace: stackTrace ?? ""
|
||||
}
|
||||
};
|
||||
if (hadRuntimeError) {
|
||||
Log.warn(`Fast Refresh had to perform a full reload due to a runtime error.`);
|
||||
break;
|
||||
}
|
||||
let fileMessage = "";
|
||||
if (stackTrace) {
|
||||
var ref;
|
||||
const file = (ref = /Aborted because (.+) is not accepted/.exec(stackTrace)) == null ? void 0 : ref[1];
|
||||
if (file) {
|
||||
fileMessage = ` when ${file} changed`;
|
||||
}
|
||||
}
|
||||
Log.warn(`Fast Refresh had to perform a full reload${fileMessage}. Read more: https://nextjs.org/docs/messages/fast-refresh-reload`);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (traceChild) {
|
||||
this.hotReloaderSpan.manualTraceChild(traceChild.name, traceChild.startTime || process.hrtime.bigint(), traceChild.endTime || process.hrtime.bigint(), {
|
||||
...traceChild.attrs,
|
||||
clientId: payload.id
|
||||
});
|
||||
}
|
||||
} catch (_) {
|
||||
// invalid WebSocket message
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
async clean(span) {
|
||||
return span.traceChild("clean").traceAsyncFn(()=>(0, _recursiveDelete).recursiveDelete((0, _path).join(this.dir, this.config.distDir), /^cache/));
|
||||
}
|
||||
async getWebpackConfig(span) {
|
||||
const webpackConfigSpan = span.traceChild("get-webpack-config");
|
||||
const pageExtensions = this.config.pageExtensions;
|
||||
return webpackConfigSpan.traceAsyncFn(async ()=>{
|
||||
const pagePaths = !this.pagesDir ? [] : await webpackConfigSpan.traceChild("get-page-paths").traceAsyncFn(()=>Promise.all([
|
||||
(0, _findPageFile).findPageFile(this.pagesDir, "/_app", pageExtensions, false),
|
||||
(0, _findPageFile).findPageFile(this.pagesDir, "/_document", pageExtensions, false),
|
||||
]));
|
||||
this.pagesMapping = webpackConfigSpan.traceChild("create-pages-mapping").traceFn(()=>(0, _entries).createPagesMapping({
|
||||
isDev: true,
|
||||
pageExtensions: this.config.pageExtensions,
|
||||
pagesType: "pages",
|
||||
pagePaths: pagePaths.filter((i)=>typeof i === "string"),
|
||||
pagesDir: this.pagesDir
|
||||
}));
|
||||
const entrypoints = await webpackConfigSpan.traceChild("create-entrypoints").traceAsyncFn(()=>(0, _entries).createEntrypoints({
|
||||
appDir: this.appDir,
|
||||
buildId: this.buildId,
|
||||
config: this.config,
|
||||
envFiles: [],
|
||||
isDev: true,
|
||||
pages: this.pagesMapping,
|
||||
pagesDir: this.pagesDir,
|
||||
previewMode: this.previewProps,
|
||||
rootDir: this.dir,
|
||||
pageExtensions: this.config.pageExtensions
|
||||
}));
|
||||
const commonWebpackOptions = {
|
||||
dev: true,
|
||||
buildId: this.buildId,
|
||||
config: this.config,
|
||||
pagesDir: this.pagesDir,
|
||||
rewrites: this.rewrites,
|
||||
runWebpackSpan: this.hotReloaderSpan,
|
||||
appDir: this.appDir
|
||||
};
|
||||
return webpackConfigSpan.traceChild("generate-webpack-config").traceAsyncFn(()=>Promise.all([
|
||||
// order is important here
|
||||
(0, _webpackConfig).default(this.dir, {
|
||||
...commonWebpackOptions,
|
||||
compilerType: _constants1.COMPILER_NAMES.client,
|
||||
entrypoints: entrypoints.client
|
||||
}),
|
||||
(0, _webpackConfig).default(this.dir, {
|
||||
...commonWebpackOptions,
|
||||
compilerType: _constants1.COMPILER_NAMES.server,
|
||||
entrypoints: entrypoints.server
|
||||
}),
|
||||
(0, _webpackConfig).default(this.dir, {
|
||||
...commonWebpackOptions,
|
||||
compilerType: _constants1.COMPILER_NAMES.edgeServer,
|
||||
entrypoints: entrypoints.edgeServer
|
||||
}),
|
||||
]));
|
||||
});
|
||||
}
|
||||
async buildFallbackError() {
|
||||
if (this.fallbackWatcher) return;
|
||||
const fallbackConfig = await (0, _webpackConfig).default(this.dir, {
|
||||
runWebpackSpan: this.hotReloaderSpan,
|
||||
dev: true,
|
||||
compilerType: _constants1.COMPILER_NAMES.client,
|
||||
config: this.config,
|
||||
buildId: this.buildId,
|
||||
pagesDir: this.pagesDir,
|
||||
rewrites: {
|
||||
beforeFiles: [],
|
||||
afterFiles: [],
|
||||
fallback: []
|
||||
},
|
||||
isDevFallback: true,
|
||||
entrypoints: (await (0, _entries).createEntrypoints({
|
||||
appDir: this.appDir,
|
||||
buildId: this.buildId,
|
||||
config: this.config,
|
||||
envFiles: [],
|
||||
isDev: true,
|
||||
pages: {
|
||||
"/_app": "next/dist/pages/_app",
|
||||
"/_error": "next/dist/pages/_error"
|
||||
},
|
||||
pagesDir: this.pagesDir,
|
||||
previewMode: this.previewProps,
|
||||
rootDir: this.dir,
|
||||
pageExtensions: this.config.pageExtensions
|
||||
})).client
|
||||
});
|
||||
const fallbackCompiler = (0, _webpack).webpack(fallbackConfig);
|
||||
this.fallbackWatcher = await new Promise((resolve)=>{
|
||||
let bootedFallbackCompiler = false;
|
||||
fallbackCompiler.watch(// @ts-ignore webpack supports an array of watchOptions when using a multiCompiler
|
||||
fallbackConfig.watchOptions, // Errors are handled separately
|
||||
(_err)=>{
|
||||
if (!bootedFallbackCompiler) {
|
||||
bootedFallbackCompiler = true;
|
||||
resolve(true);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
async start() {
|
||||
const startSpan = this.hotReloaderSpan.traceChild("start");
|
||||
startSpan.stop() // Stop immediately to create an artificial parent span
|
||||
;
|
||||
await this.clean(startSpan);
|
||||
// Ensure distDir exists before writing package.json
|
||||
await _fs.promises.mkdir(this.distDir, {
|
||||
recursive: true
|
||||
});
|
||||
const distPackageJsonPath = (0, _path).join(this.distDir, "package.json");
|
||||
// Ensure commonjs handling is used for files in the distDir (generally .next)
|
||||
// Files outside of the distDir can be "type": "module"
|
||||
await _fs.promises.writeFile(distPackageJsonPath, '{"type": "commonjs"}');
|
||||
this.activeConfigs = await this.getWebpackConfig(startSpan);
|
||||
for (const config1 of this.activeConfigs){
|
||||
const defaultEntry = config1.entry;
|
||||
config1.entry = async (...args)=>{
|
||||
// @ts-ignore entry is always a function
|
||||
const entrypoints = await defaultEntry(...args);
|
||||
const isClientCompilation = config1.name === _constants1.COMPILER_NAMES.client;
|
||||
const isNodeServerCompilation = config1.name === _constants1.COMPILER_NAMES.server;
|
||||
const isEdgeServerCompilation = config1.name === _constants1.COMPILER_NAMES.edgeServer;
|
||||
await Promise.all(Object.keys(_onDemandEntryHandler.entries).map(async (entryKey)=>{
|
||||
const entryData = _onDemandEntryHandler.entries[entryKey];
|
||||
const { bundlePath , dispose } = entryData;
|
||||
const result = /^(client|server|edge-server)(.*)/g.exec(entryKey);
|
||||
const [, key, page] = result// this match should always happen
|
||||
;
|
||||
if (key === _constants1.COMPILER_NAMES.client && !isClientCompilation) return;
|
||||
if (key === _constants1.COMPILER_NAMES.server && !isNodeServerCompilation) return;
|
||||
if (key === _constants1.COMPILER_NAMES.edgeServer && !isEdgeServerCompilation) return;
|
||||
const isEntry = entryData.type === _onDemandEntryHandler.EntryTypes.ENTRY;
|
||||
const isChildEntry = entryData.type === _onDemandEntryHandler.EntryTypes.CHILD_ENTRY;
|
||||
// Check if the page was removed or disposed and remove it
|
||||
if (isEntry) {
|
||||
const pageExists = !dispose && await (0, _fileExists).fileExists(entryData.absolutePagePath);
|
||||
if (!pageExists) {
|
||||
delete _onDemandEntryHandler.entries[entryKey];
|
||||
return;
|
||||
}
|
||||
}
|
||||
const hasAppDir = !!this.appDir;
|
||||
const isAppPath = hasAppDir && bundlePath.startsWith("app/");
|
||||
const staticInfo = isEntry ? await (0, _getPageStaticInfo).getPageStaticInfo({
|
||||
pageFilePath: entryData.absolutePagePath,
|
||||
nextConfig: this.config,
|
||||
isDev: true,
|
||||
pageType: isAppPath ? "app" : "pages"
|
||||
}) : {};
|
||||
const isServerComponent = isAppPath && staticInfo.rsc !== _constants1.RSC_MODULE_TYPES.client;
|
||||
await (0, _entries).runDependingOnPageType({
|
||||
page,
|
||||
pageRuntime: staticInfo.runtime,
|
||||
onEdgeServer: ()=>{
|
||||
// TODO-APP: verify if child entry should support.
|
||||
if (!isEdgeServerCompilation || !isEntry) return;
|
||||
const appDirLoader = isAppPath ? (0, _entries).getAppEntry({
|
||||
name: bundlePath,
|
||||
appPaths: entryData.appPaths,
|
||||
pagePath: _path.posix.join(_constants.APP_DIR_ALIAS, (0, _path).relative(this.appDir, entryData.absolutePagePath).replace(/\\/g, "/")),
|
||||
appDir: this.appDir,
|
||||
pageExtensions: this.config.pageExtensions,
|
||||
rootDir: this.dir,
|
||||
isDev: true,
|
||||
tsconfigPath: this.config.typescript.tsconfigPath
|
||||
}).import : undefined;
|
||||
_onDemandEntryHandler.entries[entryKey].status = _onDemandEntryHandler.BUILDING;
|
||||
entrypoints[bundlePath] = (0, _entries).finalizeEntrypoint({
|
||||
compilerType: _constants1.COMPILER_NAMES.edgeServer,
|
||||
name: bundlePath,
|
||||
value: (0, _entries).getEdgeServerEntry({
|
||||
absolutePagePath: entryData.absolutePagePath,
|
||||
rootDir: this.dir,
|
||||
buildId: this.buildId,
|
||||
bundlePath,
|
||||
config: this.config,
|
||||
isDev: true,
|
||||
page,
|
||||
pages: this.pagesMapping,
|
||||
isServerComponent,
|
||||
appDirLoader,
|
||||
pagesType: isAppPath ? "app" : "pages"
|
||||
}),
|
||||
hasAppDir
|
||||
});
|
||||
},
|
||||
onClient: ()=>{
|
||||
if (!isClientCompilation) return;
|
||||
if (isChildEntry) {
|
||||
_onDemandEntryHandler.entries[entryKey].status = _onDemandEntryHandler.BUILDING;
|
||||
entrypoints[bundlePath] = (0, _entries).finalizeEntrypoint({
|
||||
name: bundlePath,
|
||||
compilerType: _constants1.COMPILER_NAMES.client,
|
||||
value: entryData.request,
|
||||
hasAppDir
|
||||
});
|
||||
} else {
|
||||
_onDemandEntryHandler.entries[entryKey].status = _onDemandEntryHandler.BUILDING;
|
||||
entrypoints[bundlePath] = (0, _entries).finalizeEntrypoint({
|
||||
name: bundlePath,
|
||||
compilerType: _constants1.COMPILER_NAMES.client,
|
||||
value: (0, _entries).getClientEntry({
|
||||
absolutePagePath: entryData.absolutePagePath,
|
||||
page
|
||||
}),
|
||||
hasAppDir
|
||||
});
|
||||
}
|
||||
},
|
||||
onServer: ()=>{
|
||||
// TODO-APP: verify if child entry should support.
|
||||
if (!isNodeServerCompilation || !isEntry) return;
|
||||
_onDemandEntryHandler.entries[entryKey].status = _onDemandEntryHandler.BUILDING;
|
||||
let relativeRequest = (0, _path).relative(config1.context, entryData.absolutePagePath);
|
||||
if (!(0, _path).isAbsolute(relativeRequest) && !relativeRequest.startsWith("../")) {
|
||||
relativeRequest = `./${relativeRequest}`;
|
||||
}
|
||||
entrypoints[bundlePath] = (0, _entries).finalizeEntrypoint({
|
||||
compilerType: _constants1.COMPILER_NAMES.server,
|
||||
name: bundlePath,
|
||||
isServerComponent,
|
||||
value: isAppPath ? (0, _entries).getAppEntry({
|
||||
name: bundlePath,
|
||||
appPaths: entryData.appPaths,
|
||||
pagePath: _path.posix.join(_constants.APP_DIR_ALIAS, (0, _path).relative(this.appDir, entryData.absolutePagePath).replace(/\\/g, "/")),
|
||||
appDir: this.appDir,
|
||||
pageExtensions: this.config.pageExtensions,
|
||||
rootDir: this.dir,
|
||||
isDev: true,
|
||||
tsconfigPath: this.config.typescript.tsconfigPath
|
||||
}) : relativeRequest,
|
||||
hasAppDir
|
||||
});
|
||||
}
|
||||
});
|
||||
}));
|
||||
return entrypoints;
|
||||
};
|
||||
}
|
||||
// Enable building of client compilation before server compilation in development
|
||||
// @ts-ignore webpack 5
|
||||
this.activeConfigs.parallelism = 1;
|
||||
this.multiCompiler = (0, _webpack).webpack(this.activeConfigs);
|
||||
(0, _output).watchCompilers(this.multiCompiler.compilers[0], this.multiCompiler.compilers[1], this.multiCompiler.compilers[2]);
|
||||
// Watch for changes to client/server page files so we can tell when just
|
||||
// the server file changes and trigger a reload for GS(S)P pages
|
||||
const changedClientPages = new Set();
|
||||
const changedServerPages = new Set();
|
||||
const changedEdgeServerPages = new Set();
|
||||
const changedServerComponentPages = new Set();
|
||||
const changedCSSImportPages = new Set();
|
||||
const prevClientPageHashes = new Map();
|
||||
const prevServerPageHashes = new Map();
|
||||
const prevEdgeServerPageHashes = new Map();
|
||||
const prevCSSImportModuleHashes = new Map();
|
||||
const trackPageChanges = (pageHashMap, changedItems, serverComponentChangedItems)=>{
|
||||
return (stats)=>{
|
||||
try {
|
||||
stats.entrypoints.forEach((entry, key)=>{
|
||||
if (key.startsWith("pages/") || key.startsWith("app/") || (0, _utils).isMiddlewareFilename(key)) {
|
||||
// TODO this doesn't handle on demand loaded chunks
|
||||
entry.chunks.forEach((chunk)=>{
|
||||
if (chunk.id === key) {
|
||||
const modsIterable = stats.chunkGraph.getChunkModulesIterable(chunk);
|
||||
let hasCSSModuleChanges = false;
|
||||
let chunksHash = new _webpack.StringXor();
|
||||
let chunksHashServerLayer = new _webpack.StringXor();
|
||||
modsIterable.forEach((mod)=>{
|
||||
if (mod.resource && mod.resource.replace(/\\/g, "/").includes(key)) {
|
||||
var ref, ref3;
|
||||
// use original source to calculate hash since mod.hash
|
||||
// includes the source map in development which changes
|
||||
// every time for both server and client so we calculate
|
||||
// the hash without the source map for the page module
|
||||
const hash = require("crypto").createHash("sha256").update(mod.originalSource().buffer()).digest().toString("hex");
|
||||
if (mod.layer === _constants.WEBPACK_LAYERS.server && (mod == null ? void 0 : (ref = mod.buildInfo) == null ? void 0 : (ref3 = ref.rsc) == null ? void 0 : ref3.type) !== "client") {
|
||||
chunksHashServerLayer.add(hash);
|
||||
}
|
||||
chunksHash.add(hash);
|
||||
} else {
|
||||
var ref4, ref5, ref6;
|
||||
// for non-pages we can use the module hash directly
|
||||
const hash = stats.chunkGraph.getModuleHash(mod, chunk.runtime);
|
||||
if (mod.layer === _constants.WEBPACK_LAYERS.server && (mod == null ? void 0 : (ref4 = mod.buildInfo) == null ? void 0 : (ref5 = ref4.rsc) == null ? void 0 : ref5.type) !== "client") {
|
||||
chunksHashServerLayer.add(hash);
|
||||
}
|
||||
chunksHash.add(hash);
|
||||
// Both CSS import changes from server and client
|
||||
// components are tracked.
|
||||
if (key.startsWith("app/") && ((ref6 = mod.resource) == null ? void 0 : ref6.endsWith(".css"))) {
|
||||
const prevHash = prevCSSImportModuleHashes.get(mod.resource);
|
||||
if (prevHash && prevHash !== hash) {
|
||||
hasCSSModuleChanges = true;
|
||||
}
|
||||
prevCSSImportModuleHashes.set(mod.resource, hash);
|
||||
}
|
||||
}
|
||||
});
|
||||
const prevHash1 = pageHashMap.get(key);
|
||||
const curHash = chunksHash.toString();
|
||||
if (prevHash1 && prevHash1 !== curHash) {
|
||||
changedItems.add(key);
|
||||
}
|
||||
pageHashMap.set(key, curHash);
|
||||
if (serverComponentChangedItems) {
|
||||
const serverKey = _constants.WEBPACK_LAYERS.server + ":" + key;
|
||||
const prevServerHash = pageHashMap.get(serverKey);
|
||||
const curServerHash = chunksHashServerLayer.toString();
|
||||
if (prevServerHash && prevServerHash !== curServerHash) {
|
||||
serverComponentChangedItems.add(key);
|
||||
}
|
||||
pageHashMap.set(serverKey, curServerHash);
|
||||
}
|
||||
if (hasCSSModuleChanges) {
|
||||
changedCSSImportPages.add(key);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
}
|
||||
};
|
||||
};
|
||||
this.multiCompiler.compilers[0].hooks.emit.tap("NextjsHotReloaderForClient", trackPageChanges(prevClientPageHashes, changedClientPages));
|
||||
this.multiCompiler.compilers[1].hooks.emit.tap("NextjsHotReloaderForServer", trackPageChanges(prevServerPageHashes, changedServerPages, changedServerComponentPages));
|
||||
this.multiCompiler.compilers[2].hooks.emit.tap("NextjsHotReloaderForServer", trackPageChanges(prevEdgeServerPageHashes, changedEdgeServerPages, changedServerComponentPages));
|
||||
// This plugin watches for changes to _document.js and notifies the client side that it should reload the page
|
||||
this.multiCompiler.compilers[1].hooks.failed.tap("NextjsHotReloaderForServer", (err)=>{
|
||||
this.serverError = err;
|
||||
this.serverStats = null;
|
||||
});
|
||||
this.multiCompiler.compilers[2].hooks.done.tap("NextjsHotReloaderForServer", (stats)=>{
|
||||
this.serverError = null;
|
||||
this.edgeServerStats = stats;
|
||||
});
|
||||
this.multiCompiler.compilers[1].hooks.done.tap("NextjsHotReloaderForServer", (stats)=>{
|
||||
this.serverError = null;
|
||||
this.serverStats = stats;
|
||||
if (!this.pagesDir) {
|
||||
return;
|
||||
}
|
||||
const { compilation } = stats;
|
||||
// We only watch `_document` for changes on the server compilation
|
||||
// the rest of the files will be triggered by the client compilation
|
||||
const documentChunk = compilation.namedChunks.get("pages/_document");
|
||||
// If the document chunk can't be found we do nothing
|
||||
if (!documentChunk) {
|
||||
console.warn("_document.js chunk not found");
|
||||
return;
|
||||
}
|
||||
// Initial value
|
||||
if (this.serverPrevDocumentHash === null) {
|
||||
this.serverPrevDocumentHash = documentChunk.hash || null;
|
||||
return;
|
||||
}
|
||||
// If _document.js didn't change we don't trigger a reload
|
||||
if (documentChunk.hash === this.serverPrevDocumentHash) {
|
||||
return;
|
||||
}
|
||||
// Notify reload to reload the page, as _document.js was changed (different hash)
|
||||
this.send("reloadPage");
|
||||
this.serverPrevDocumentHash = documentChunk.hash || null;
|
||||
});
|
||||
this.multiCompiler.hooks.done.tap("NextjsHotReloaderForServer", ()=>{
|
||||
const serverOnlyChanges = (0, _utils).difference(changedServerPages, changedClientPages);
|
||||
const edgeServerOnlyChanges = (0, _utils).difference(changedEdgeServerPages, changedClientPages);
|
||||
const pageChanges = serverOnlyChanges.concat(edgeServerOnlyChanges).filter((key)=>key.startsWith("pages/"));
|
||||
const middlewareChanges = Array.from(changedEdgeServerPages).filter((name)=>(0, _utils).isMiddlewareFilename(name));
|
||||
if (middlewareChanges.length > 0) {
|
||||
this.send({
|
||||
event: "middlewareChanges"
|
||||
});
|
||||
}
|
||||
if (pageChanges.length > 0) {
|
||||
this.send({
|
||||
event: "serverOnlyChanges",
|
||||
pages: serverOnlyChanges.map((pg)=>(0, _denormalizePagePath).denormalizePagePath(pg.slice("pages".length)))
|
||||
});
|
||||
}
|
||||
if (changedServerComponentPages.size || changedCSSImportPages.size) {
|
||||
this.send({
|
||||
action: "serverComponentChanges"
|
||||
});
|
||||
}
|
||||
changedClientPages.clear();
|
||||
changedServerPages.clear();
|
||||
changedEdgeServerPages.clear();
|
||||
changedServerComponentPages.clear();
|
||||
changedCSSImportPages.clear();
|
||||
});
|
||||
this.multiCompiler.compilers[0].hooks.failed.tap("NextjsHotReloaderForClient", (err)=>{
|
||||
this.clientError = err;
|
||||
this.clientStats = null;
|
||||
});
|
||||
this.multiCompiler.compilers[0].hooks.done.tap("NextjsHotReloaderForClient", (stats)=>{
|
||||
this.clientError = null;
|
||||
this.clientStats = stats;
|
||||
const { compilation } = stats;
|
||||
const chunkNames = new Set([
|
||||
...compilation.namedChunks.keys()
|
||||
].filter((name)=>!!(0, _getRouteFromEntrypoint).default(name)));
|
||||
if (this.prevChunkNames) {
|
||||
// detect chunks which have to be replaced with a new template
|
||||
// e.g, pages/index.js <-> pages/_error.js
|
||||
const addedPages = diff(chunkNames, this.prevChunkNames);
|
||||
const removedPages = diff(this.prevChunkNames, chunkNames);
|
||||
if (addedPages.size > 0) {
|
||||
for (const addedPage of addedPages){
|
||||
const page = (0, _getRouteFromEntrypoint).default(addedPage);
|
||||
this.send("addedPage", page);
|
||||
}
|
||||
}
|
||||
if (removedPages.size > 0) {
|
||||
for (const removedPage of removedPages){
|
||||
const page = (0, _getRouteFromEntrypoint).default(removedPage);
|
||||
this.send("removedPage", page);
|
||||
}
|
||||
}
|
||||
}
|
||||
this.prevChunkNames = chunkNames;
|
||||
});
|
||||
this.webpackHotMiddleware = new _hotMiddleware.WebpackHotMiddleware(this.multiCompiler.compilers);
|
||||
let booted = false;
|
||||
this.watcher = await new Promise((resolve)=>{
|
||||
var ref;
|
||||
const watcher = (ref = this.multiCompiler) == null ? void 0 : ref.watch(// @ts-ignore webpack supports an array of watchOptions when using a multiCompiler
|
||||
this.activeConfigs.map((config)=>config.watchOptions), // Errors are handled separately
|
||||
(_err)=>{
|
||||
if (!booted) {
|
||||
booted = true;
|
||||
resolve(watcher);
|
||||
}
|
||||
});
|
||||
});
|
||||
this.onDemandEntries = (0, _onDemandEntryHandler).onDemandEntryHandler({
|
||||
multiCompiler: this.multiCompiler,
|
||||
pagesDir: this.pagesDir,
|
||||
appDir: this.appDir,
|
||||
rootDir: this.dir,
|
||||
nextConfig: this.config,
|
||||
...this.config.onDemandEntries
|
||||
});
|
||||
this.interceptors = [
|
||||
(0, _middleware).getOverlayMiddleware({
|
||||
rootDirectory: this.dir,
|
||||
stats: ()=>this.clientStats,
|
||||
serverStats: ()=>this.serverStats,
|
||||
edgeServerStats: ()=>this.edgeServerStats
|
||||
}),
|
||||
];
|
||||
}
|
||||
invalidate() {
|
||||
var ref;
|
||||
return (ref = (0, _onDemandEntryHandler).getInvalidator()) == null ? void 0 : ref.invalidate();
|
||||
}
|
||||
async stop() {
|
||||
await new Promise((resolve, reject)=>{
|
||||
this.watcher.close((err)=>err ? reject(err) : resolve(true));
|
||||
});
|
||||
if (this.fallbackWatcher) {
|
||||
await new Promise((resolve, reject)=>{
|
||||
this.fallbackWatcher.close((err)=>err ? reject(err) : resolve(true));
|
||||
});
|
||||
}
|
||||
this.multiCompiler = undefined;
|
||||
}
|
||||
async getCompilationErrors(page) {
|
||||
var ref9, ref7, ref8;
|
||||
const getErrors = ({ compilation })=>{
|
||||
var ref;
|
||||
const failedPages = erroredPages(compilation);
|
||||
const normalizedPage = (0, _normalizePathSep).normalizePathSep(page);
|
||||
// If there is an error related to the requesting page we display it instead of the first error
|
||||
return ((ref = failedPages[normalizedPage]) == null ? void 0 : ref.length) > 0 ? failedPages[normalizedPage] : compilation.errors;
|
||||
};
|
||||
if (this.clientError || this.serverError) {
|
||||
return [
|
||||
this.clientError || this.serverError
|
||||
];
|
||||
} else if ((ref9 = this.clientStats) == null ? void 0 : ref9.hasErrors()) {
|
||||
return getErrors(this.clientStats);
|
||||
} else if ((ref7 = this.serverStats) == null ? void 0 : ref7.hasErrors()) {
|
||||
return getErrors(this.serverStats);
|
||||
} else if ((ref8 = this.edgeServerStats) == null ? void 0 : ref8.hasErrors()) {
|
||||
return getErrors(this.edgeServerStats);
|
||||
} else {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
send(action, ...args) {
|
||||
this.webpackHotMiddleware.publish(action && typeof action === "object" ? action : {
|
||||
action,
|
||||
data: args
|
||||
});
|
||||
}
|
||||
async ensurePage({ page , clientOnly , appPaths }) {
|
||||
var ref;
|
||||
// Make sure we don't re-build or dispose prebuilt pages
|
||||
if (page !== "/_error" && _constants1.BLOCKED_PAGES.indexOf(page) !== -1) {
|
||||
return;
|
||||
}
|
||||
const error = clientOnly ? this.clientError : this.serverError || this.clientError;
|
||||
if (error) {
|
||||
return Promise.reject(error);
|
||||
}
|
||||
return (ref = this.onDemandEntries) == null ? void 0 : ref.ensurePage({
|
||||
page,
|
||||
clientOnly,
|
||||
appPaths
|
||||
});
|
||||
}
|
||||
}
|
||||
exports.default = HotReloader;
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {
|
||||
default: obj
|
||||
};
|
||||
}
|
||||
function _getRequireWildcardCache() {
|
||||
if (typeof WeakMap !== "function") return null;
|
||||
var cache = new WeakMap();
|
||||
_getRequireWildcardCache = function() {
|
||||
return cache;
|
||||
};
|
||||
return cache;
|
||||
}
|
||||
function _interopRequireWildcard(obj) {
|
||||
if (obj && obj.__esModule) {
|
||||
return obj;
|
||||
}
|
||||
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
||||
return {
|
||||
default: obj
|
||||
};
|
||||
}
|
||||
var cache = _getRequireWildcardCache();
|
||||
if (cache && cache.has(obj)) {
|
||||
return cache.get(obj);
|
||||
}
|
||||
var newObj = {};
|
||||
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
||||
for(var key in obj){
|
||||
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
||||
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
||||
if (desc && (desc.get || desc.set)) {
|
||||
Object.defineProperty(newObj, key, desc);
|
||||
} else {
|
||||
newObj[key] = obj[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
newObj.default = obj;
|
||||
if (cache) {
|
||||
cache.set(obj, newObj);
|
||||
}
|
||||
return newObj;
|
||||
}
|
||||
function diff(a, b) {
|
||||
return new Set([
|
||||
...a
|
||||
].filter((v)=>!b.has(v)));
|
||||
}
|
||||
const wsServer = new _ws.default.Server({
|
||||
noServer: true
|
||||
});
|
||||
async function renderScriptError(res, error, { verbose =true } = {}) {
|
||||
// Asks CDNs and others to not to cache the errored page
|
||||
res.setHeader("Cache-Control", "no-cache, no-store, max-age=0, must-revalidate");
|
||||
if (error.code === "ENOENT") {
|
||||
res.statusCode = 404;
|
||||
res.end("404 - Not Found");
|
||||
return;
|
||||
}
|
||||
if (verbose) {
|
||||
console.error(error.stack);
|
||||
}
|
||||
res.statusCode = 500;
|
||||
res.end("500 - Internal Error");
|
||||
}
|
||||
function addCorsSupport(req, res) {
|
||||
// Only rewrite CORS handling when URL matches a hot-reloader middleware
|
||||
if (!req.url.startsWith("/__next")) {
|
||||
return {
|
||||
preflight: false
|
||||
};
|
||||
}
|
||||
if (!req.headers.origin) {
|
||||
return {
|
||||
preflight: false
|
||||
};
|
||||
}
|
||||
res.setHeader("Access-Control-Allow-Origin", req.headers.origin);
|
||||
res.setHeader("Access-Control-Allow-Methods", "OPTIONS, GET");
|
||||
// Based on https://github.com/primus/access-control/blob/4cf1bc0e54b086c91e6aa44fb14966fa5ef7549c/index.js#L158
|
||||
if (req.headers["access-control-request-headers"]) {
|
||||
res.setHeader("Access-Control-Allow-Headers", req.headers["access-control-request-headers"]);
|
||||
}
|
||||
if (req.method === "OPTIONS") {
|
||||
res.writeHead(200);
|
||||
res.end();
|
||||
return {
|
||||
preflight: true
|
||||
};
|
||||
}
|
||||
return {
|
||||
preflight: false
|
||||
};
|
||||
}
|
||||
const matchNextPageBundleRequest = (0, _pathMatch).getPathMatch("/_next/static/chunks/pages/:path*.js(\\.map|)");
|
||||
// Recursively look up the issuer till it ends up at the root
|
||||
function findEntryModule(compilation, issuerModule) {
|
||||
const issuer = compilation.moduleGraph.getIssuer(issuerModule);
|
||||
if (issuer) {
|
||||
return findEntryModule(compilation, issuer);
|
||||
}
|
||||
return issuerModule;
|
||||
}
|
||||
function erroredPages(compilation) {
|
||||
const failedPages = {};
|
||||
for (const error of compilation.errors){
|
||||
if (!error.module) {
|
||||
continue;
|
||||
}
|
||||
const entryModule = findEntryModule(compilation, error.module);
|
||||
const { name } = entryModule;
|
||||
if (!name) {
|
||||
continue;
|
||||
}
|
||||
// Only pages have to be reloaded
|
||||
const enhancedName = (0, _getRouteFromEntrypoint).default(name);
|
||||
if (!enhancedName) {
|
||||
continue;
|
||||
}
|
||||
if (!failedPages[enhancedName]) {
|
||||
failedPages[enhancedName] = [];
|
||||
}
|
||||
failedPages[enhancedName].push(error);
|
||||
}
|
||||
return failedPages;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=hot-reloader.js.map
|
||||
1
kitabcitab/node_modules/next/dist/server/dev/hot-reloader.js.map
generated
vendored
Normal file
1
kitabcitab/node_modules/next/dist/server/dev/hot-reloader.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
137
kitabcitab/node_modules/next/dist/server/dev/next-dev-server.d.ts
generated
vendored
Normal file
137
kitabcitab/node_modules/next/dist/server/dev/next-dev-server.d.ts
generated
vendored
Normal file
@@ -0,0 +1,137 @@
|
||||
/// <reference types="node" />
|
||||
/// <reference types="node" />
|
||||
import type { __ApiPreviewProps } from '../api-utils';
|
||||
import type { CustomRoutes } from '../../lib/load-custom-routes';
|
||||
import type { FindComponentsResult } from '../next-server';
|
||||
import type { LoadComponentsReturnType } from '../load-components';
|
||||
import type { Options as ServerOptions } from '../next-server';
|
||||
import type { Params } from '../../shared/lib/router/utils/route-matcher';
|
||||
import type { ParsedUrl } from '../../shared/lib/router/utils/parse-url';
|
||||
import type { ParsedUrlQuery } from 'querystring';
|
||||
import type { UrlWithParsedQuery } from 'url';
|
||||
import type { BaseNextRequest, BaseNextResponse } from '../base-http';
|
||||
import type { MiddlewareRoutingItem, RoutingItem } from '../base-server';
|
||||
import Server from '../next-server';
|
||||
import { NodeNextResponse, NodeNextRequest } from '../base-http/node';
|
||||
export interface Options extends ServerOptions {
|
||||
/**
|
||||
* Tells of Next.js is running from the `next dev` command
|
||||
*/
|
||||
isNextDevCommand?: boolean;
|
||||
}
|
||||
export default class DevServer extends Server {
|
||||
private devReady;
|
||||
private setDevReady?;
|
||||
private webpackWatcher?;
|
||||
private hotReloader?;
|
||||
private isCustomServer;
|
||||
protected sortedRoutes?: string[];
|
||||
private addedUpgradeListener;
|
||||
private pagesDir?;
|
||||
private appDir?;
|
||||
private actualMiddlewareFile?;
|
||||
private middleware?;
|
||||
private edgeFunctions?;
|
||||
private verifyingTypeScript?;
|
||||
private usingTypeScript?;
|
||||
private originalFetch?;
|
||||
protected staticPathsWorker?: {
|
||||
[key: string]: any;
|
||||
} & {
|
||||
loadStaticPaths: typeof import('./static-paths-worker').loadStaticPaths;
|
||||
};
|
||||
private getStaticPathsWorker;
|
||||
constructor(options: Options);
|
||||
protected getBuildId(): string;
|
||||
addExportPathMapRoutes(): Promise<void>;
|
||||
startWatcher(): Promise<void>;
|
||||
stopWatcher(): Promise<void>;
|
||||
private verifyTypeScript;
|
||||
prepare(): Promise<void>;
|
||||
protected close(): Promise<void>;
|
||||
protected hasPage(pathname: string): Promise<boolean>;
|
||||
protected _beforeCatchAllRender(req: BaseNextRequest, res: BaseNextResponse, params: Params, parsedUrl: UrlWithParsedQuery): Promise<boolean>;
|
||||
private setupWebSocketHandler;
|
||||
runMiddleware(params: {
|
||||
request: BaseNextRequest;
|
||||
response: BaseNextResponse;
|
||||
parsedUrl: ParsedUrl;
|
||||
parsed: UrlWithParsedQuery;
|
||||
middlewareList: MiddlewareRoutingItem[];
|
||||
}): Promise<import("../web/types").FetchEventResult | {
|
||||
finished: boolean;
|
||||
}>;
|
||||
runEdgeFunction(params: {
|
||||
req: BaseNextRequest;
|
||||
res: BaseNextResponse;
|
||||
query: ParsedUrlQuery;
|
||||
params: Params | undefined;
|
||||
page: string;
|
||||
appPaths: string[] | null;
|
||||
isAppPath: boolean;
|
||||
}): Promise<import("../web/types").FetchEventResult | null>;
|
||||
run(req: NodeNextRequest, res: NodeNextResponse, parsedUrl: UrlWithParsedQuery): Promise<void>;
|
||||
private logErrorWithOriginalStack;
|
||||
protected getCustomRoutes(): CustomRoutes;
|
||||
private _devCachedPreviewProps;
|
||||
protected getPreviewProps(): __ApiPreviewProps;
|
||||
protected getPagesManifest(): undefined;
|
||||
protected getAppPathsManifest(): undefined;
|
||||
protected getMiddleware(): MiddlewareRoutingItem | undefined;
|
||||
protected getEdgeFunctions(): RoutingItem[];
|
||||
protected getServerComponentManifest(): undefined;
|
||||
protected getServerCSSManifest(): undefined;
|
||||
protected getFontLoaderManifest(): undefined;
|
||||
protected hasMiddleware(): Promise<boolean>;
|
||||
protected ensureMiddleware(): Promise<void>;
|
||||
protected ensureEdgeFunction({ page, appPaths, }: {
|
||||
page: string;
|
||||
appPaths: string[] | null;
|
||||
}): Promise<void>;
|
||||
generateRoutes(): {
|
||||
headers: import("../router").Route[];
|
||||
rewrites: {
|
||||
beforeFiles: import("../router").Route[];
|
||||
afterFiles: import("../router").Route[];
|
||||
fallback: import("../router").Route[];
|
||||
};
|
||||
redirects: import("../router").Route[];
|
||||
catchAllRoute: import("../router").Route;
|
||||
catchAllMiddleware: import("../router").Route[];
|
||||
pageChecker: import("../router").PageChecker;
|
||||
useFileSystemPublicRoutes: boolean;
|
||||
dynamicRoutes: import("../router").DynamicRoutes | undefined;
|
||||
nextConfig: import("../config-shared").NextConfig;
|
||||
fsRoutes: import("../router").Route[];
|
||||
};
|
||||
protected generatePublicRoutes(): never[];
|
||||
protected getDynamicRoutes(): never[];
|
||||
_filterAmpDevelopmentScript(html: string, event: {
|
||||
line: number;
|
||||
col: number;
|
||||
code: string;
|
||||
}): boolean;
|
||||
protected getStaticPaths({ pathname, originalAppPath, }: {
|
||||
pathname: string;
|
||||
originalAppPath?: string;
|
||||
}): Promise<{
|
||||
staticPaths?: string[];
|
||||
fallbackMode?: false | 'static' | 'blocking';
|
||||
}>;
|
||||
protected ensureApiPage(pathname: string): Promise<void>;
|
||||
private persistPatchedGlobals;
|
||||
private restorePatchedGlobals;
|
||||
protected findPageComponents({ pathname, query, params, isAppPath, appPaths, }: {
|
||||
pathname: string;
|
||||
query: ParsedUrlQuery;
|
||||
params: Params;
|
||||
isAppPath: boolean;
|
||||
appPaths?: string[] | null;
|
||||
}): Promise<FindComponentsResult | null>;
|
||||
protected getFallbackErrorComponents(): Promise<LoadComponentsReturnType | null>;
|
||||
protected setImmutableAssetCacheControl(res: BaseNextResponse): void;
|
||||
private servePublic;
|
||||
hasPublicFile(path: string): Promise<boolean>;
|
||||
getCompilationError(page: string): Promise<any>;
|
||||
protected isServeableUrl(untrustedFileUrl: string): boolean;
|
||||
}
|
||||
1167
kitabcitab/node_modules/next/dist/server/dev/next-dev-server.js
generated
vendored
Normal file
1167
kitabcitab/node_modules/next/dist/server/dev/next-dev-server.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1
kitabcitab/node_modules/next/dist/server/dev/next-dev-server.js.map
generated
vendored
Normal file
1
kitabcitab/node_modules/next/dist/server/dev/next-dev-server.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
90
kitabcitab/node_modules/next/dist/server/dev/on-demand-entry-handler.d.ts
generated
vendored
Normal file
90
kitabcitab/node_modules/next/dist/server/dev/on-demand-entry-handler.d.ts
generated
vendored
Normal file
@@ -0,0 +1,90 @@
|
||||
import type ws from 'ws';
|
||||
import type { webpack } from 'next/dist/compiled/webpack/webpack';
|
||||
import type { NextConfigComplete } from '../config-shared';
|
||||
import { CompilerNameValues, COMPILER_INDEXES } from '../../shared/lib/constants';
|
||||
declare const COMPILER_KEYS: CompilerNameValues[];
|
||||
export declare const ADDED: unique symbol;
|
||||
export declare const BUILDING: unique symbol;
|
||||
export declare const BUILT: unique symbol;
|
||||
interface EntryType {
|
||||
/**
|
||||
* Tells if a page is scheduled to be disposed.
|
||||
*/
|
||||
dispose?: boolean;
|
||||
/**
|
||||
* Timestamp with the last time the page was active.
|
||||
*/
|
||||
lastActiveTime?: number;
|
||||
/**
|
||||
* Page build status.
|
||||
*/
|
||||
status?: typeof ADDED | typeof BUILDING | typeof BUILT;
|
||||
/**
|
||||
* Path to the page file relative to the dist folder with no extension.
|
||||
* For example: `pages/about/index`
|
||||
*/
|
||||
bundlePath: string;
|
||||
/**
|
||||
* Webpack request to create a dependency for.
|
||||
*/
|
||||
request: string;
|
||||
}
|
||||
export declare const enum EntryTypes {
|
||||
ENTRY = 0,
|
||||
CHILD_ENTRY = 1
|
||||
}
|
||||
interface Entry extends EntryType {
|
||||
type: EntryTypes.ENTRY;
|
||||
/**
|
||||
* The absolute page to the page file. Used for detecting if the file was removed. For example:
|
||||
* `/Users/Rick/project/pages/about/index.js`
|
||||
*/
|
||||
absolutePagePath: string;
|
||||
/**
|
||||
* All parallel pages that match the same entry, for example:
|
||||
* ['/parallel/@bar/nested/@a/page', '/parallel/@bar/nested/@b/page', '/parallel/@foo/nested/@a/page', '/parallel/@foo/nested/@b/page']
|
||||
*/
|
||||
appPaths: string[] | null;
|
||||
}
|
||||
interface ChildEntry extends EntryType {
|
||||
type: EntryTypes.CHILD_ENTRY;
|
||||
/**
|
||||
* Which parent entries use this childEntry.
|
||||
*/
|
||||
parentEntries: Set<string>;
|
||||
}
|
||||
export declare const entries: {
|
||||
/**
|
||||
* The key composed of the compiler name and the page. For example:
|
||||
* `edge-server/about`
|
||||
*/
|
||||
[entryName: string]: Entry | ChildEntry;
|
||||
};
|
||||
export declare const getInvalidator: () => Invalidator;
|
||||
declare class Invalidator {
|
||||
private multiCompiler;
|
||||
private building;
|
||||
private rebuildAgain;
|
||||
constructor(multiCompiler: webpack.MultiCompiler);
|
||||
shouldRebuildAll(): boolean;
|
||||
invalidate(compilerKeys?: typeof COMPILER_KEYS): void;
|
||||
startBuilding(compilerKey: keyof typeof COMPILER_INDEXES): void;
|
||||
doneBuilding(): void;
|
||||
}
|
||||
export declare function onDemandEntryHandler({ maxInactiveAge, multiCompiler, nextConfig, pagesBufferLength, pagesDir, rootDir, appDir, }: {
|
||||
maxInactiveAge: number;
|
||||
multiCompiler: webpack.MultiCompiler;
|
||||
nextConfig: NextConfigComplete;
|
||||
pagesBufferLength: number;
|
||||
pagesDir?: string;
|
||||
rootDir: string;
|
||||
appDir?: string;
|
||||
}): {
|
||||
ensurePage({ page, clientOnly, appPaths, }: {
|
||||
page: string;
|
||||
clientOnly: boolean;
|
||||
appPaths?: string[] | null | undefined;
|
||||
}): Promise<void>;
|
||||
onHMR(client: ws): void;
|
||||
};
|
||||
export {};
|
||||
492
kitabcitab/node_modules/next/dist/server/dev/on-demand-entry-handler.js
generated
vendored
Normal file
492
kitabcitab/node_modules/next/dist/server/dev/on-demand-entry-handler.js
generated
vendored
Normal file
@@ -0,0 +1,492 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.onDemandEntryHandler = onDemandEntryHandler;
|
||||
exports.getInvalidator = exports.entries = exports.EntryTypes = exports.BUILT = exports.BUILDING = exports.ADDED = void 0;
|
||||
var _debug = _interopRequireDefault(require("next/dist/compiled/debug"));
|
||||
var _events = require("events");
|
||||
var _findPageFile = require("../lib/find-page-file");
|
||||
var _entries = require("../../build/entries");
|
||||
var _path = require("path");
|
||||
var _normalizePathSep = require("../../shared/lib/page-path/normalize-path-sep");
|
||||
var _normalizePagePath = require("../../shared/lib/page-path/normalize-page-path");
|
||||
var _ensureLeadingSlash = require("../../shared/lib/page-path/ensure-leading-slash");
|
||||
var _removePagePathTail = require("../../shared/lib/page-path/remove-page-path-tail");
|
||||
var _output = require("../../build/output");
|
||||
var _getRouteFromEntrypoint = _interopRequireDefault(require("../get-route-from-entrypoint"));
|
||||
var _getPageStaticInfo = require("../../build/analysis/get-page-static-info");
|
||||
var _utils = require("../../build/utils");
|
||||
var _utils1 = require("../../shared/lib/utils");
|
||||
var _constants = require("../../shared/lib/constants");
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {
|
||||
default: obj
|
||||
};
|
||||
}
|
||||
const debug = (0, _debug).default("next:on-demand-entry-handler");
|
||||
/**
|
||||
* Returns object keys with type inferred from the object key
|
||||
*/ const keys = Object.keys;
|
||||
const COMPILER_KEYS = keys(_constants.COMPILER_INDEXES);
|
||||
function treePathToEntrypoint(segmentPath, parentPath) {
|
||||
const [parallelRouteKey, segment] = segmentPath;
|
||||
// TODO-APP: modify this path to cover parallelRouteKey convention
|
||||
const path = (parentPath ? parentPath + "/" : "") + (parallelRouteKey !== "children" && !segment.startsWith("@") ? parallelRouteKey + "/" : "") + (segment === "" ? "page" : segment);
|
||||
// Last segment
|
||||
if (segmentPath.length === 2) {
|
||||
return path;
|
||||
}
|
||||
const childSegmentPath = segmentPath.slice(2);
|
||||
return treePathToEntrypoint(childSegmentPath, path);
|
||||
}
|
||||
function convertDynamicParamTypeToSyntax(dynamicParamTypeShort, param) {
|
||||
switch(dynamicParamTypeShort){
|
||||
case "c":
|
||||
return `[...${param}]`;
|
||||
case "oc":
|
||||
return `[[...${param}]]`;
|
||||
case "d":
|
||||
return `[${param}]`;
|
||||
default:
|
||||
throw new Error("Unknown dynamic param type");
|
||||
}
|
||||
}
|
||||
function getEntrypointsFromTree(tree, isFirst, parentPath = []) {
|
||||
const [segment, parallelRoutes] = tree;
|
||||
const currentSegment = Array.isArray(segment) ? convertDynamicParamTypeToSyntax(segment[2], segment[0]) : segment;
|
||||
const currentPath = [
|
||||
...parentPath,
|
||||
currentSegment
|
||||
];
|
||||
if (!isFirst && currentSegment === "") {
|
||||
// TODO get rid of '' at the start of tree
|
||||
return [
|
||||
treePathToEntrypoint(currentPath.slice(1))
|
||||
];
|
||||
}
|
||||
return Object.keys(parallelRoutes).reduce((paths, key)=>{
|
||||
const childTree = parallelRoutes[key];
|
||||
const childPages = getEntrypointsFromTree(childTree, false, [
|
||||
...currentPath,
|
||||
key,
|
||||
]);
|
||||
return [
|
||||
...paths,
|
||||
...childPages
|
||||
];
|
||||
}, []);
|
||||
}
|
||||
const ADDED = Symbol("added");
|
||||
exports.ADDED = ADDED;
|
||||
const BUILDING = Symbol("building");
|
||||
exports.BUILDING = BUILDING;
|
||||
const BUILT = Symbol("built");
|
||||
exports.BUILT = BUILT;
|
||||
var EntryTypes;
|
||||
exports.EntryTypes = EntryTypes;
|
||||
(function(EntryTypes) {
|
||||
EntryTypes[EntryTypes["ENTRY"] = 0] = "ENTRY";
|
||||
EntryTypes[EntryTypes["CHILD_ENTRY"] = 1] = "CHILD_ENTRY";
|
||||
})(EntryTypes || (exports.EntryTypes = EntryTypes = {}));
|
||||
const entries = {};
|
||||
exports.entries = entries;
|
||||
let invalidator;
|
||||
const getInvalidator = ()=>invalidator;
|
||||
exports.getInvalidator = getInvalidator;
|
||||
const doneCallbacks = new _events.EventEmitter();
|
||||
const lastClientAccessPages = [
|
||||
""
|
||||
];
|
||||
const lastServerAccessPagesForAppDir = [
|
||||
""
|
||||
];
|
||||
// Make sure only one invalidation happens at a time
|
||||
// Otherwise, webpack hash gets changed and it'll force the client to reload.
|
||||
class Invalidator {
|
||||
building = new Set();
|
||||
rebuildAgain = new Set();
|
||||
constructor(multiCompiler){
|
||||
this.multiCompiler = multiCompiler;
|
||||
}
|
||||
shouldRebuildAll() {
|
||||
return this.rebuildAgain.size > 0;
|
||||
}
|
||||
invalidate(compilerKeys = COMPILER_KEYS) {
|
||||
for (const key of compilerKeys){
|
||||
var ref;
|
||||
// If there's a current build is processing, we won't abort it by invalidating.
|
||||
// (If aborted, it'll cause a client side hard reload)
|
||||
// But let it to invalidate just after the completion.
|
||||
// So, it can re-build the queued pages at once.
|
||||
if (this.building.has(key)) {
|
||||
this.rebuildAgain.add(key);
|
||||
continue;
|
||||
}
|
||||
(ref = this.multiCompiler.compilers[_constants.COMPILER_INDEXES[key]].watching) == null ? void 0 : ref.invalidate();
|
||||
this.building.add(key);
|
||||
}
|
||||
}
|
||||
startBuilding(compilerKey) {
|
||||
this.building.add(compilerKey);
|
||||
}
|
||||
doneBuilding() {
|
||||
const rebuild = [];
|
||||
for (const key of COMPILER_KEYS){
|
||||
this.building.delete(key);
|
||||
if (this.rebuildAgain.has(key)) {
|
||||
rebuild.push(key);
|
||||
this.rebuildAgain.delete(key);
|
||||
}
|
||||
}
|
||||
this.invalidate(rebuild);
|
||||
}
|
||||
}
|
||||
function disposeInactiveEntries(maxInactiveAge) {
|
||||
Object.keys(entries).forEach((entryKey)=>{
|
||||
const entryData = entries[entryKey];
|
||||
const { lastActiveTime , status , dispose } = entryData;
|
||||
// TODO-APP: implement disposing of CHILD_ENTRY
|
||||
if (entryData.type === 1) {
|
||||
return;
|
||||
}
|
||||
if (dispose) // Skip pages already scheduled for disposing
|
||||
return;
|
||||
// This means this entry is currently building or just added
|
||||
// We don't need to dispose those entries.
|
||||
if (status !== BUILT) return;
|
||||
// We should not build the last accessed page even we didn't get any pings
|
||||
// Sometimes, it's possible our XHR ping to wait before completing other requests.
|
||||
// In that case, we should not dispose the current viewing page
|
||||
if (lastClientAccessPages.includes(entryKey) || lastServerAccessPagesForAppDir.includes(entryKey)) return;
|
||||
if (lastActiveTime && Date.now() - lastActiveTime > maxInactiveAge) {
|
||||
entries[entryKey].dispose = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
// Normalize both app paths and page paths
|
||||
function tryToNormalizePagePath(page) {
|
||||
try {
|
||||
return (0, _normalizePagePath).normalizePagePath(page);
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
throw new _utils1.PageNotFoundError(page);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Attempts to find a page file path from the given pages absolute directory,
|
||||
* a page and allowed extensions. If the page can't be found it will throw an
|
||||
* error. It defaults the `/_error` page to Next.js internal error page.
|
||||
*
|
||||
* @param rootDir Absolute path to the project root.
|
||||
* @param pagesDir Absolute path to the pages folder with trailing `/pages`.
|
||||
* @param normalizedPagePath The page normalized (it will be denormalized).
|
||||
* @param pageExtensions Array of page extensions.
|
||||
*/ async function findPagePathData(rootDir, page, extensions, pagesDir, appDir) {
|
||||
const normalizedPagePath = tryToNormalizePagePath(page);
|
||||
let pagePath = null;
|
||||
if ((0, _utils).isMiddlewareFile(normalizedPagePath)) {
|
||||
pagePath = await (0, _findPageFile).findPageFile(rootDir, normalizedPagePath, extensions, false);
|
||||
if (!pagePath) {
|
||||
throw new _utils1.PageNotFoundError(normalizedPagePath);
|
||||
}
|
||||
const pageUrl = (0, _ensureLeadingSlash).ensureLeadingSlash((0, _removePagePathTail).removePagePathTail((0, _normalizePathSep).normalizePathSep(pagePath), {
|
||||
extensions
|
||||
}));
|
||||
return {
|
||||
absolutePagePath: (0, _path).join(rootDir, pagePath),
|
||||
bundlePath: normalizedPagePath.slice(1),
|
||||
page: _path.posix.normalize(pageUrl)
|
||||
};
|
||||
}
|
||||
// Check appDir first falling back to pagesDir
|
||||
if (appDir) {
|
||||
pagePath = await (0, _findPageFile).findPageFile(appDir, normalizedPagePath, extensions, true);
|
||||
if (pagePath) {
|
||||
const pageUrl = (0, _ensureLeadingSlash).ensureLeadingSlash((0, _removePagePathTail).removePagePathTail((0, _normalizePathSep).normalizePathSep(pagePath), {
|
||||
keepIndex: true,
|
||||
extensions
|
||||
}));
|
||||
return {
|
||||
absolutePagePath: (0, _path).join(appDir, pagePath),
|
||||
bundlePath: _path.posix.join("app", (0, _normalizePagePath).normalizePagePath(pageUrl)),
|
||||
page: _path.posix.normalize(pageUrl)
|
||||
};
|
||||
}
|
||||
}
|
||||
if (!pagePath && pagesDir) {
|
||||
pagePath = await (0, _findPageFile).findPageFile(pagesDir, normalizedPagePath, extensions, false);
|
||||
}
|
||||
if (pagePath !== null && pagesDir) {
|
||||
const pageUrl = (0, _ensureLeadingSlash).ensureLeadingSlash((0, _removePagePathTail).removePagePathTail((0, _normalizePathSep).normalizePathSep(pagePath), {
|
||||
extensions
|
||||
}));
|
||||
return {
|
||||
absolutePagePath: (0, _path).join(pagesDir, pagePath),
|
||||
bundlePath: _path.posix.join("pages", (0, _normalizePagePath).normalizePagePath(pageUrl)),
|
||||
page: _path.posix.normalize(pageUrl)
|
||||
};
|
||||
}
|
||||
if (page === "/_error") {
|
||||
return {
|
||||
absolutePagePath: require.resolve("next/dist/pages/_error"),
|
||||
bundlePath: page,
|
||||
page: (0, _normalizePathSep).normalizePathSep(page)
|
||||
};
|
||||
} else {
|
||||
throw new _utils1.PageNotFoundError(normalizedPagePath);
|
||||
}
|
||||
}
|
||||
function onDemandEntryHandler({ maxInactiveAge , multiCompiler , nextConfig , pagesBufferLength , pagesDir , rootDir , appDir }) {
|
||||
invalidator = new Invalidator(multiCompiler);
|
||||
const startBuilding = (compilation)=>{
|
||||
const compilationName = compilation.name;
|
||||
invalidator.startBuilding(compilationName);
|
||||
};
|
||||
for (const compiler of multiCompiler.compilers){
|
||||
compiler.hooks.make.tap("NextJsOnDemandEntries", startBuilding);
|
||||
}
|
||||
function getPagePathsFromEntrypoints(type, entrypoints, root) {
|
||||
const pagePaths = [];
|
||||
for (const entrypoint of entrypoints.values()){
|
||||
const page = (0, _getRouteFromEntrypoint).default(entrypoint.name, root);
|
||||
if (page) {
|
||||
pagePaths.push(`${type}${page}`);
|
||||
} else if (root && entrypoint.name === "root" || (0, _utils).isMiddlewareFilename(entrypoint.name)) {
|
||||
pagePaths.push(`${type}/${entrypoint.name}`);
|
||||
}
|
||||
}
|
||||
return pagePaths;
|
||||
}
|
||||
multiCompiler.hooks.done.tap("NextJsOnDemandEntries", (multiStats)=>{
|
||||
if (invalidator.shouldRebuildAll()) {
|
||||
return invalidator.doneBuilding();
|
||||
}
|
||||
const [clientStats, serverStats, edgeServerStats] = multiStats.stats;
|
||||
const root = !!appDir;
|
||||
const pagePaths = [
|
||||
...getPagePathsFromEntrypoints(_constants.COMPILER_NAMES.client, clientStats.compilation.entrypoints, root),
|
||||
...getPagePathsFromEntrypoints(_constants.COMPILER_NAMES.server, serverStats.compilation.entrypoints, root),
|
||||
...edgeServerStats ? getPagePathsFromEntrypoints(_constants.COMPILER_NAMES.edgeServer, edgeServerStats.compilation.entrypoints, root) : [],
|
||||
];
|
||||
for (const page of pagePaths){
|
||||
const entry = entries[page];
|
||||
if (!entry) {
|
||||
continue;
|
||||
}
|
||||
if (entry.status !== BUILDING) {
|
||||
continue;
|
||||
}
|
||||
entry.status = BUILT;
|
||||
doneCallbacks.emit(page);
|
||||
}
|
||||
invalidator.doneBuilding();
|
||||
});
|
||||
const pingIntervalTime = Math.max(1000, Math.min(5000, maxInactiveAge));
|
||||
setInterval(function() {
|
||||
disposeInactiveEntries(maxInactiveAge);
|
||||
}, pingIntervalTime + 1000).unref();
|
||||
function handleAppDirPing(tree) {
|
||||
const pages = getEntrypointsFromTree(tree, true);
|
||||
let toSend = {
|
||||
invalid: true
|
||||
};
|
||||
for (const page of pages){
|
||||
for (const compilerType of [
|
||||
_constants.COMPILER_NAMES.client,
|
||||
_constants.COMPILER_NAMES.server,
|
||||
_constants.COMPILER_NAMES.edgeServer,
|
||||
]){
|
||||
const pageKey = `${compilerType}/${page}`;
|
||||
const entryInfo = entries[pageKey];
|
||||
// If there's no entry, it may have been invalidated and needs to be re-built.
|
||||
if (!entryInfo) {
|
||||
continue;
|
||||
}
|
||||
// We don't need to maintain active state of anything other than BUILT entries
|
||||
if (entryInfo.status !== BUILT) continue;
|
||||
// If there's an entryInfo
|
||||
if (!lastServerAccessPagesForAppDir.includes(pageKey)) {
|
||||
lastServerAccessPagesForAppDir.unshift(pageKey);
|
||||
// Maintain the buffer max length
|
||||
// TODO: verify that the current pageKey is not at the end of the array as multiple entrypoints can exist
|
||||
if (lastServerAccessPagesForAppDir.length > pagesBufferLength) {
|
||||
lastServerAccessPagesForAppDir.pop();
|
||||
}
|
||||
}
|
||||
entryInfo.lastActiveTime = Date.now();
|
||||
entryInfo.dispose = false;
|
||||
toSend = {
|
||||
success: true
|
||||
};
|
||||
}
|
||||
}
|
||||
return toSend;
|
||||
}
|
||||
function handlePing(pg) {
|
||||
const page = (0, _normalizePathSep).normalizePathSep(pg);
|
||||
let toSend = {
|
||||
invalid: true
|
||||
};
|
||||
for (const compilerType of [
|
||||
_constants.COMPILER_NAMES.client,
|
||||
_constants.COMPILER_NAMES.server,
|
||||
_constants.COMPILER_NAMES.edgeServer,
|
||||
]){
|
||||
const pageKey = `${compilerType}${page}`;
|
||||
const entryInfo = entries[pageKey];
|
||||
// If there's no entry, it may have been invalidated and needs to be re-built.
|
||||
if (!entryInfo) {
|
||||
// if (page !== lastEntry) client pings, but there's no entry for page
|
||||
if (compilerType === _constants.COMPILER_NAMES.client) {
|
||||
return {
|
||||
invalid: true
|
||||
};
|
||||
}
|
||||
continue;
|
||||
}
|
||||
// 404 is an on demand entry but when a new page is added we have to refresh the page
|
||||
toSend = page === "/_error" ? {
|
||||
invalid: true
|
||||
} : {
|
||||
success: true
|
||||
};
|
||||
// We don't need to maintain active state of anything other than BUILT entries
|
||||
if (entryInfo.status !== BUILT) continue;
|
||||
// If there's an entryInfo
|
||||
if (!lastClientAccessPages.includes(pageKey)) {
|
||||
lastClientAccessPages.unshift(pageKey);
|
||||
// Maintain the buffer max length
|
||||
if (lastClientAccessPages.length > pagesBufferLength) {
|
||||
lastClientAccessPages.pop();
|
||||
}
|
||||
}
|
||||
entryInfo.lastActiveTime = Date.now();
|
||||
entryInfo.dispose = false;
|
||||
}
|
||||
return toSend;
|
||||
}
|
||||
return {
|
||||
async ensurePage ({ page , clientOnly , appPaths =null }) {
|
||||
const stalledTime = 60;
|
||||
const stalledEnsureTimeout = setTimeout(()=>{
|
||||
debug(`Ensuring ${page} has taken longer than ${stalledTime}s, if this continues to stall this may be a bug`);
|
||||
}, stalledTime * 1000);
|
||||
try {
|
||||
const pagePathData = await findPagePathData(rootDir, page, nextConfig.pageExtensions, pagesDir, appDir);
|
||||
const isInsideAppDir = !!appDir && pagePathData.absolutePagePath.startsWith(appDir);
|
||||
const addEntry = (compilerType)=>{
|
||||
const entryKey = `${compilerType}${pagePathData.page}`;
|
||||
if (entries[entryKey]) {
|
||||
entries[entryKey].dispose = false;
|
||||
entries[entryKey].lastActiveTime = Date.now();
|
||||
if (entries[entryKey].status === BUILT) {
|
||||
return {
|
||||
entryKey,
|
||||
newEntry: false,
|
||||
shouldInvalidate: false
|
||||
};
|
||||
}
|
||||
return {
|
||||
entryKey,
|
||||
newEntry: false,
|
||||
shouldInvalidate: true
|
||||
};
|
||||
}
|
||||
entries[entryKey] = {
|
||||
type: 0,
|
||||
appPaths,
|
||||
absolutePagePath: pagePathData.absolutePagePath,
|
||||
request: pagePathData.absolutePagePath,
|
||||
bundlePath: pagePathData.bundlePath,
|
||||
dispose: false,
|
||||
lastActiveTime: Date.now(),
|
||||
status: ADDED
|
||||
};
|
||||
return {
|
||||
entryKey: entryKey,
|
||||
newEntry: true,
|
||||
shouldInvalidate: true
|
||||
};
|
||||
};
|
||||
const staticInfo = await (0, _getPageStaticInfo).getPageStaticInfo({
|
||||
pageFilePath: pagePathData.absolutePagePath,
|
||||
nextConfig,
|
||||
isDev: true,
|
||||
pageType: isInsideAppDir ? "app" : "pages"
|
||||
});
|
||||
const added = new Map();
|
||||
const isServerComponent = isInsideAppDir && staticInfo.rsc !== _constants.RSC_MODULE_TYPES.client;
|
||||
await (0, _entries).runDependingOnPageType({
|
||||
page: pagePathData.page,
|
||||
pageRuntime: staticInfo.runtime,
|
||||
onClient: ()=>{
|
||||
// Skip adding the client entry for app / Server Components.
|
||||
if (isServerComponent || isInsideAppDir) {
|
||||
return;
|
||||
}
|
||||
added.set(_constants.COMPILER_NAMES.client, addEntry(_constants.COMPILER_NAMES.client));
|
||||
},
|
||||
onServer: ()=>{
|
||||
added.set(_constants.COMPILER_NAMES.server, addEntry(_constants.COMPILER_NAMES.server));
|
||||
const edgeServerEntry = `${_constants.COMPILER_NAMES.edgeServer}${pagePathData.page}`;
|
||||
if (entries[edgeServerEntry]) {
|
||||
// Runtime switched from edge to server
|
||||
delete entries[edgeServerEntry];
|
||||
}
|
||||
},
|
||||
onEdgeServer: ()=>{
|
||||
added.set(_constants.COMPILER_NAMES.edgeServer, addEntry(_constants.COMPILER_NAMES.edgeServer));
|
||||
const serverEntry = `${_constants.COMPILER_NAMES.server}${pagePathData.page}`;
|
||||
if (entries[serverEntry]) {
|
||||
// Runtime switched from server to edge
|
||||
delete entries[serverEntry];
|
||||
}
|
||||
}
|
||||
});
|
||||
const addedValues = [
|
||||
...added.values()
|
||||
];
|
||||
const entriesThatShouldBeInvalidated = addedValues.filter((entry)=>entry.shouldInvalidate);
|
||||
const hasNewEntry = addedValues.some((entry)=>entry.newEntry);
|
||||
if (hasNewEntry) {
|
||||
(0, _output).reportTrigger(!clientOnly && hasNewEntry ? `${pagePathData.page} (client and server)` : pagePathData.page);
|
||||
}
|
||||
if (entriesThatShouldBeInvalidated.length > 0) {
|
||||
const invalidatePromises = entriesThatShouldBeInvalidated.map(({ entryKey })=>{
|
||||
return new Promise((resolve, reject)=>{
|
||||
doneCallbacks.once(entryKey, (err)=>{
|
||||
if (err) {
|
||||
return reject(err);
|
||||
}
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
});
|
||||
invalidator.invalidate([
|
||||
...added.keys()
|
||||
]);
|
||||
await Promise.all(invalidatePromises);
|
||||
}
|
||||
} finally{
|
||||
clearTimeout(stalledEnsureTimeout);
|
||||
}
|
||||
},
|
||||
onHMR (client) {
|
||||
client.addEventListener("message", ({ data })=>{
|
||||
try {
|
||||
const parsedData = JSON.parse(typeof data !== "string" ? data.toString() : data);
|
||||
if (parsedData.event === "ping") {
|
||||
const result = parsedData.appDirRoute ? handleAppDirPing(parsedData.tree) : handlePing(parsedData.page);
|
||||
client.send(JSON.stringify({
|
||||
...result,
|
||||
[parsedData.appDirRoute ? "action" : "event"]: "pong"
|
||||
}));
|
||||
}
|
||||
} catch (_) {}
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
//# sourceMappingURL=on-demand-entry-handler.js.map
|
||||
1
kitabcitab/node_modules/next/dist/server/dev/on-demand-entry-handler.js.map
generated
vendored
Normal file
1
kitabcitab/node_modules/next/dist/server/dev/on-demand-entry-handler.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
19
kitabcitab/node_modules/next/dist/server/dev/static-paths-worker.d.ts
generated
vendored
Normal file
19
kitabcitab/node_modules/next/dist/server/dev/static-paths-worker.d.ts
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
import type { NextConfigComplete } from '../config-shared';
|
||||
import '../node-polyfill-fetch';
|
||||
declare type RuntimeConfig = any;
|
||||
export declare function loadStaticPaths({ distDir, pathname, config, httpAgentOptions, enableUndici, locales, defaultLocale, isAppPath, originalAppPath, }: {
|
||||
distDir: string;
|
||||
pathname: string;
|
||||
config: RuntimeConfig;
|
||||
httpAgentOptions: NextConfigComplete['httpAgentOptions'];
|
||||
enableUndici: NextConfigComplete['enableUndici'];
|
||||
locales?: string[];
|
||||
defaultLocale?: string;
|
||||
isAppPath?: boolean;
|
||||
originalAppPath?: string;
|
||||
}): Promise<{
|
||||
paths?: string[];
|
||||
encodedPaths?: string[];
|
||||
fallback?: boolean | 'blocking';
|
||||
}>;
|
||||
export {};
|
||||
62
kitabcitab/node_modules/next/dist/server/dev/static-paths-worker.js
generated
vendored
Normal file
62
kitabcitab/node_modules/next/dist/server/dev/static-paths-worker.js
generated
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.loadStaticPaths = loadStaticPaths;
|
||||
require("../node-polyfill-fetch");
|
||||
var _utils = require("../../build/utils");
|
||||
var _loadComponents = require("../load-components");
|
||||
var _config = require("../config");
|
||||
var _requireHook = require("../../build/webpack/require-hook");
|
||||
(0, _requireHook).loadRequireHook();
|
||||
if (process.env.NEXT_PREBUNDLED_REACT) {
|
||||
(0, _requireHook).overrideBuiltInReactPackages();
|
||||
}
|
||||
let workerWasUsed = false;
|
||||
// expose AsyncLocalStorage on globalThis for react usage
|
||||
const { AsyncLocalStorage } = require("async_hooks");
|
||||
globalThis.AsyncLocalStorage = AsyncLocalStorage;
|
||||
async function loadStaticPaths({ distDir , pathname , config , httpAgentOptions , enableUndici , locales , defaultLocale , isAppPath , originalAppPath }) {
|
||||
// we only want to use each worker once to prevent any invalid
|
||||
// caches
|
||||
if (workerWasUsed) {
|
||||
process.exit(1);
|
||||
}
|
||||
// update work memory runtime-config
|
||||
require("../../shared/lib/runtime-config").setConfig(config);
|
||||
(0, _config).setHttpClientAndAgentOptions({
|
||||
httpAgentOptions,
|
||||
experimental: {
|
||||
enableUndici
|
||||
}
|
||||
});
|
||||
const components = await (0, _loadComponents).loadComponents({
|
||||
distDir,
|
||||
pathname: originalAppPath || pathname,
|
||||
hasServerComponents: false,
|
||||
isAppPath: !!isAppPath
|
||||
});
|
||||
if (!components.getStaticPaths && !isAppPath) {
|
||||
// we shouldn't get to this point since the worker should
|
||||
// only be called for SSG pages with getStaticPaths
|
||||
throw new Error(`Invariant: failed to load page with getStaticPaths for ${pathname}`);
|
||||
}
|
||||
workerWasUsed = true;
|
||||
if (isAppPath) {
|
||||
const generateParams = await (0, _utils).collectGenerateParams(components.ComponentMod.tree);
|
||||
return (0, _utils).buildAppStaticPaths({
|
||||
page: pathname,
|
||||
generateParams,
|
||||
configFileName: config.configFileName
|
||||
});
|
||||
}
|
||||
return (0, _utils).buildStaticPaths({
|
||||
page: pathname,
|
||||
getStaticPaths: components.getStaticPaths,
|
||||
configFileName: config.configFileName,
|
||||
locales,
|
||||
defaultLocale
|
||||
});
|
||||
}
|
||||
|
||||
//# sourceMappingURL=static-paths-worker.js.map
|
||||
1
kitabcitab/node_modules/next/dist/server/dev/static-paths-worker.js.map
generated
vendored
Normal file
1
kitabcitab/node_modules/next/dist/server/dev/static-paths-worker.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../server/dev/static-paths-worker.ts"],"names":["loadStaticPaths","loadRequireHook","process","env","NEXT_PREBUNDLED_REACT","overrideBuiltInReactPackages","workerWasUsed","AsyncLocalStorage","require","globalThis","distDir","pathname","config","httpAgentOptions","enableUndici","locales","defaultLocale","isAppPath","originalAppPath","exit","setConfig","setHttpClientAndAgentOptions","experimental","components","loadComponents","hasServerComponents","getStaticPaths","Error","generateParams","collectGenerateParams","ComponentMod","tree","buildAppStaticPaths","page","configFileName","buildStaticPaths"],"mappings":"AAAA;;;;QA+BsBA,eAAe,GAAfA,eAAe;QA7B9B,wBAAwB;AAKxB,IAAA,MAAmB,WAAnB,mBAAmB,CAAA;AACK,IAAA,eAAoB,WAApB,oBAAoB,CAAA;AACN,IAAA,OAAW,WAAX,WAAW,CAAA;AAIjD,IAAA,YAAkC,WAAlC,kCAAkC,CAAA;AAIzCC,CAAAA,GAAAA,YAAe,AAAE,CAAA,gBAAF,EAAE;AACjB,IAAIC,OAAO,CAACC,GAAG,CAACC,qBAAqB,EAAE;IACrCC,CAAAA,GAAAA,YAA4B,AAAE,CAAA,6BAAF,EAAE;CAC/B;AAED,IAAIC,aAAa,GAAG,KAAK;AAEzB,yDAAyD;AACzD,MAAM,EAAEC,iBAAiB,CAAA,EAAE,GAAGC,OAAO,CAAC,aAAa,CAAC,AACnD;AAAA,AAACC,UAAU,CAASF,iBAAiB,GAAGA,iBAAiB;AAKnD,eAAeP,eAAe,CAAC,EACpCU,OAAO,CAAA,EACPC,QAAQ,CAAA,EACRC,MAAM,CAAA,EACNC,gBAAgB,CAAA,EAChBC,YAAY,CAAA,EACZC,OAAO,CAAA,EACPC,aAAa,CAAA,EACbC,SAAS,CAAA,EACTC,eAAe,CAAA,EAWhB,EAIE;IACD,8DAA8D;IAC9D,SAAS;IACT,IAAIZ,aAAa,EAAE;QACjBJ,OAAO,CAACiB,IAAI,CAAC,CAAC,CAAC;KAChB;IAED,oCAAoC;IACpCX,OAAO,CAAC,iCAAiC,CAAC,CAACY,SAAS,CAACR,MAAM,CAAC;IAC5DS,CAAAA,GAAAA,OAA4B,AAG1B,CAAA,6BAH0B,CAAC;QAC3BR,gBAAgB;QAChBS,YAAY,EAAE;YAAER,YAAY;SAAE;KAC/B,CAAC;IAEF,MAAMS,UAAU,GAAG,MAAMC,CAAAA,GAAAA,eAAc,AAKrC,CAAA,eALqC,CAAC;QACtCd,OAAO;QACPC,QAAQ,EAAEO,eAAe,IAAIP,QAAQ;QACrCc,mBAAmB,EAAE,KAAK;QAC1BR,SAAS,EAAE,CAAC,CAACA,SAAS;KACvB,CAAC;IAEF,IAAI,CAACM,UAAU,CAACG,cAAc,IAAI,CAACT,SAAS,EAAE;QAC5C,yDAAyD;QACzD,mDAAmD;QACnD,MAAM,IAAIU,KAAK,CACb,CAAC,uDAAuD,EAAEhB,QAAQ,CAAC,CAAC,CACrE,CAAA;KACF;IACDL,aAAa,GAAG,IAAI;IAEpB,IAAIW,SAAS,EAAE;QACb,MAAMW,cAAc,GAAG,MAAMC,CAAAA,GAAAA,MAAqB,AAEjD,CAAA,sBAFiD,CAChDN,UAAU,CAACO,YAAY,CAACC,IAAI,CAC7B;QACD,OAAOC,CAAAA,GAAAA,MAAmB,AAIxB,CAAA,oBAJwB,CAAC;YACzBC,IAAI,EAAEtB,QAAQ;YACdiB,cAAc;YACdM,cAAc,EAAEtB,MAAM,CAACsB,cAAc;SACtC,CAAC,CAAA;KACH;IAED,OAAOC,CAAAA,GAAAA,MAAgB,AAMrB,CAAA,iBANqB,CAAC;QACtBF,IAAI,EAAEtB,QAAQ;QACde,cAAc,EAAEH,UAAU,CAACG,cAAc;QACzCQ,cAAc,EAAEtB,MAAM,CAACsB,cAAc;QACrCnB,OAAO;QACPC,aAAa;KACd,CAAC,CAAA;CACH"}
|
||||
21
kitabcitab/node_modules/next/dist/server/font-utils.d.ts
generated
vendored
Normal file
21
kitabcitab/node_modules/next/dist/server/font-utils.d.ts
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
export declare type FontManifest = Array<{
|
||||
url: string;
|
||||
content: string;
|
||||
}>;
|
||||
export declare type FontConfig = boolean;
|
||||
export declare function getFontDefinitionFromNetwork(url: string): Promise<string>;
|
||||
export declare function getFontDefinitionFromManifest(url: string, manifest: FontManifest): string;
|
||||
export declare function calculateOverrideValues(fontMetrics: any): {
|
||||
ascent: any;
|
||||
descent: any;
|
||||
lineGap: any;
|
||||
fallbackFont: string;
|
||||
};
|
||||
export declare function calculateSizeAdjustValues(fontMetrics: any): {
|
||||
ascent: any;
|
||||
descent: any;
|
||||
lineGap: any;
|
||||
fallbackFont: string;
|
||||
sizeAdjust: string;
|
||||
};
|
||||
export declare function getFontOverrideCss(url: string, css: string, useSizeAdjust?: boolean): string;
|
||||
193
kitabcitab/node_modules/next/dist/server/font-utils.js
generated
vendored
Normal file
193
kitabcitab/node_modules/next/dist/server/font-utils.js
generated
vendored
Normal file
@@ -0,0 +1,193 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.getFontDefinitionFromNetwork = getFontDefinitionFromNetwork;
|
||||
exports.getFontDefinitionFromManifest = getFontDefinitionFromManifest;
|
||||
exports.calculateOverrideValues = calculateOverrideValues;
|
||||
exports.calculateSizeAdjustValues = calculateSizeAdjustValues;
|
||||
exports.getFontOverrideCss = getFontOverrideCss;
|
||||
var Log = _interopRequireWildcard(require("../build/output/log"));
|
||||
var _constants = require("../shared/lib/constants");
|
||||
function _getRequireWildcardCache() {
|
||||
if (typeof WeakMap !== "function") return null;
|
||||
var cache = new WeakMap();
|
||||
_getRequireWildcardCache = function() {
|
||||
return cache;
|
||||
};
|
||||
return cache;
|
||||
}
|
||||
function _interopRequireWildcard(obj) {
|
||||
if (obj && obj.__esModule) {
|
||||
return obj;
|
||||
}
|
||||
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
||||
return {
|
||||
default: obj
|
||||
};
|
||||
}
|
||||
var cache = _getRequireWildcardCache();
|
||||
if (cache && cache.has(obj)) {
|
||||
return cache.get(obj);
|
||||
}
|
||||
var newObj = {};
|
||||
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
||||
for(var key in obj){
|
||||
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
||||
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
||||
if (desc && (desc.get || desc.set)) {
|
||||
Object.defineProperty(newObj, key, desc);
|
||||
} else {
|
||||
newObj[key] = obj[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
newObj.default = obj;
|
||||
if (cache) {
|
||||
cache.set(obj, newObj);
|
||||
}
|
||||
return newObj;
|
||||
}
|
||||
const googleFontsMetrics = require("./google-font-metrics.json");
|
||||
const https = require("https");
|
||||
const CHROME_UA = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.61 Safari/537.36";
|
||||
const IE_UA = "Mozilla/5.0 (Windows NT 10.0; Trident/7.0; rv:11.0) like Gecko";
|
||||
function isGoogleFont(url) {
|
||||
return url.startsWith(_constants.GOOGLE_FONT_PROVIDER);
|
||||
}
|
||||
function getFontForUA(url, UA) {
|
||||
return new Promise((resolve, reject)=>{
|
||||
let rawData = "";
|
||||
https.get(url, {
|
||||
headers: {
|
||||
"user-agent": UA
|
||||
}
|
||||
}, (res)=>{
|
||||
res.on("data", (chunk)=>{
|
||||
rawData += chunk;
|
||||
});
|
||||
res.on("end", ()=>{
|
||||
resolve(rawData.toString("utf8"));
|
||||
});
|
||||
}).on("error", (e)=>{
|
||||
reject(e);
|
||||
});
|
||||
});
|
||||
}
|
||||
async function getFontDefinitionFromNetwork(url) {
|
||||
let result = "";
|
||||
/**
|
||||
* The order of IE -> Chrome is important, other wise chrome starts loading woff1.
|
||||
* CSS cascading 🤷♂️.
|
||||
*/ try {
|
||||
if (isGoogleFont(url)) {
|
||||
result += await getFontForUA(url, IE_UA);
|
||||
}
|
||||
result += await getFontForUA(url, CHROME_UA);
|
||||
} catch (e) {
|
||||
Log.warn(`Failed to download the stylesheet for ${url}. Skipped optimizing this font.`);
|
||||
return "";
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function getFontDefinitionFromManifest(url, manifest) {
|
||||
var ref;
|
||||
return ((ref = manifest.find((font)=>{
|
||||
if (font && font.url === url) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
})) == null ? void 0 : ref.content) || "";
|
||||
}
|
||||
function parseGoogleFontName(css) {
|
||||
const regex = /font-family: ([^;]*)/g;
|
||||
const matches = css.matchAll(regex);
|
||||
const fontNames = new Set();
|
||||
for (let font of matches){
|
||||
const fontFamily = font[1].replace(/^['"]|['"]$/g, "");
|
||||
fontNames.add(fontFamily);
|
||||
}
|
||||
return [
|
||||
...fontNames
|
||||
];
|
||||
}
|
||||
function formatOverrideValue(val) {
|
||||
return Math.abs(val * 100).toFixed(2);
|
||||
}
|
||||
function calculateOverrideValues(fontMetrics) {
|
||||
let { category , ascent , descent , lineGap , unitsPerEm } = fontMetrics;
|
||||
const fallbackFont = category === "serif" ? _constants.DEFAULT_SERIF_FONT : _constants.DEFAULT_SANS_SERIF_FONT;
|
||||
ascent = formatOverrideValue(ascent / unitsPerEm);
|
||||
descent = formatOverrideValue(descent / unitsPerEm);
|
||||
lineGap = formatOverrideValue(lineGap / unitsPerEm);
|
||||
return {
|
||||
ascent,
|
||||
descent,
|
||||
lineGap,
|
||||
fallbackFont: fallbackFont.name
|
||||
};
|
||||
}
|
||||
function calculateSizeAdjustValues(fontMetrics) {
|
||||
let { category , ascent , descent , lineGap , unitsPerEm , azAvgWidth } = fontMetrics;
|
||||
const fallbackFont = category === "serif" ? _constants.DEFAULT_SERIF_FONT : _constants.DEFAULT_SANS_SERIF_FONT;
|
||||
const mainFontAvgWidth = azAvgWidth / unitsPerEm;
|
||||
const fallbackFontAvgWidth = fallbackFont.azAvgWidth / fallbackFont.unitsPerEm;
|
||||
let sizeAdjust = azAvgWidth ? mainFontAvgWidth / fallbackFontAvgWidth : 1;
|
||||
ascent = formatOverrideValue(ascent / (unitsPerEm * sizeAdjust));
|
||||
descent = formatOverrideValue(descent / (unitsPerEm * sizeAdjust));
|
||||
lineGap = formatOverrideValue(lineGap / (unitsPerEm * sizeAdjust));
|
||||
return {
|
||||
ascent,
|
||||
descent,
|
||||
lineGap,
|
||||
fallbackFont: fallbackFont.name,
|
||||
sizeAdjust: formatOverrideValue(sizeAdjust)
|
||||
};
|
||||
}
|
||||
function calculateOverrideCSS(font, fontMetrics) {
|
||||
const fontName = font.trim();
|
||||
const { ascent , descent , lineGap , fallbackFont } = calculateOverrideValues(fontMetrics[fontName]);
|
||||
return `
|
||||
@font-face {
|
||||
font-family: "${fontName} Fallback";
|
||||
ascent-override: ${ascent}%;
|
||||
descent-override: ${descent}%;
|
||||
line-gap-override: ${lineGap}%;
|
||||
src: local("${fallbackFont}");
|
||||
}
|
||||
`;
|
||||
}
|
||||
function calculateSizeAdjustCSS(font, fontMetrics) {
|
||||
const fontName = font.trim();
|
||||
const { ascent , descent , lineGap , fallbackFont , sizeAdjust } = calculateSizeAdjustValues(fontMetrics[fontName]);
|
||||
return `
|
||||
@font-face {
|
||||
font-family: "${fontName} Fallback";
|
||||
ascent-override: ${ascent}%;
|
||||
descent-override: ${descent}%;
|
||||
line-gap-override: ${lineGap}%;
|
||||
size-adjust: ${sizeAdjust}%;
|
||||
src: local("${fallbackFont}");
|
||||
}
|
||||
`;
|
||||
}
|
||||
function getFontOverrideCss(url, css, useSizeAdjust = false) {
|
||||
if (!isGoogleFont(url)) {
|
||||
return "";
|
||||
}
|
||||
const calcFn = useSizeAdjust ? calculateSizeAdjustCSS : calculateOverrideCSS;
|
||||
try {
|
||||
const fontNames = parseGoogleFontName(css);
|
||||
const fontMetrics = googleFontsMetrics;
|
||||
const fontCss = fontNames.reduce((cssStr, fontName)=>{
|
||||
cssStr += calcFn(fontName, fontMetrics);
|
||||
return cssStr;
|
||||
}, "");
|
||||
return fontCss;
|
||||
} catch (e) {
|
||||
console.log("Error getting font override values - ", e);
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
//# sourceMappingURL=font-utils.js.map
|
||||
1
kitabcitab/node_modules/next/dist/server/font-utils.js.map
generated
vendored
Normal file
1
kitabcitab/node_modules/next/dist/server/font-utils.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
1
kitabcitab/node_modules/next/dist/server/get-app-route-from-entrypoint.d.ts
generated
vendored
Normal file
1
kitabcitab/node_modules/next/dist/server/get-app-route-from-entrypoint.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export default function getAppRouteFromEntrypoint(entryFile: string): string | null;
|
||||
25
kitabcitab/node_modules/next/dist/server/get-app-route-from-entrypoint.js
generated
vendored
Normal file
25
kitabcitab/node_modules/next/dist/server/get-app-route-from-entrypoint.js
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = getAppRouteFromEntrypoint;
|
||||
var _matchBundle = _interopRequireDefault(require("./match-bundle"));
|
||||
function getAppRouteFromEntrypoint(entryFile) {
|
||||
const pagePath = (0, _matchBundle).default(APP_ROUTE_NAME_REGEX, entryFile);
|
||||
if (typeof pagePath === "string" && !pagePath) {
|
||||
return "/";
|
||||
}
|
||||
if (!pagePath) {
|
||||
return null;
|
||||
}
|
||||
return pagePath;
|
||||
}
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {
|
||||
default: obj
|
||||
};
|
||||
}
|
||||
// matches app/:path*.js
|
||||
const APP_ROUTE_NAME_REGEX = /^app[/\\](.*)$/;
|
||||
|
||||
//# sourceMappingURL=get-app-route-from-entrypoint.js.map
|
||||
1
kitabcitab/node_modules/next/dist/server/get-app-route-from-entrypoint.js.map
generated
vendored
Normal file
1
kitabcitab/node_modules/next/dist/server/get-app-route-from-entrypoint.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../server/get-app-route-from-entrypoint.ts"],"names":["getAppRouteFromEntrypoint","entryFile","pagePath","matchBundle","APP_ROUTE_NAME_REGEX"],"mappings":"AAAA;;;;kBAKwBA,yBAAyB;AALzB,IAAA,YAAgB,kCAAhB,gBAAgB,EAAA;AAKzB,SAASA,yBAAyB,CAACC,SAAiB,EAAE;IACnE,MAAMC,QAAQ,GAAGC,CAAAA,GAAAA,YAAW,AAAiC,CAAA,QAAjC,CAACC,oBAAoB,EAAEH,SAAS,CAAC;IAC7D,IAAI,OAAOC,QAAQ,KAAK,QAAQ,IAAI,CAACA,QAAQ,EAAE;QAC7C,OAAO,GAAG,CAAA;KACX;IAED,IAAI,CAACA,QAAQ,EAAE;QACb,OAAO,IAAI,CAAA;KACZ;IAED,OAAOA,QAAQ,CAAA;CAChB;;;;;;AAdD,wBAAwB;AACxB,MAAME,oBAAoB,mBAAmB"}
|
||||
13
kitabcitab/node_modules/next/dist/server/get-page-files.d.ts
generated
vendored
Normal file
13
kitabcitab/node_modules/next/dist/server/get-page-files.d.ts
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
export declare type BuildManifest = {
|
||||
devFiles: readonly string[];
|
||||
ampDevFiles: readonly string[];
|
||||
polyfillFiles: readonly string[];
|
||||
lowPriorityFiles: readonly string[];
|
||||
rootMainFiles: readonly string[];
|
||||
pages: {
|
||||
'/_app': readonly string[];
|
||||
[page: string]: readonly string[];
|
||||
};
|
||||
ampFirstPages: readonly string[];
|
||||
};
|
||||
export declare function getPageFiles(buildManifest: BuildManifest, page: string): readonly string[];
|
||||
18
kitabcitab/node_modules/next/dist/server/get-page-files.js
generated
vendored
Normal file
18
kitabcitab/node_modules/next/dist/server/get-page-files.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.getPageFiles = getPageFiles;
|
||||
var _denormalizePagePath = require("../shared/lib/page-path/denormalize-page-path");
|
||||
var _normalizePagePath = require("../shared/lib/page-path/normalize-page-path");
|
||||
function getPageFiles(buildManifest, page) {
|
||||
const normalizedPage = (0, _denormalizePagePath).denormalizePagePath((0, _normalizePagePath).normalizePagePath(page));
|
||||
let files = buildManifest.pages[normalizedPage];
|
||||
if (!files) {
|
||||
console.warn(`Could not find files for ${normalizedPage} in .next/build-manifest.json`);
|
||||
return [];
|
||||
}
|
||||
return files;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=get-page-files.js.map
|
||||
1
kitabcitab/node_modules/next/dist/server/get-page-files.js.map
generated
vendored
Normal file
1
kitabcitab/node_modules/next/dist/server/get-page-files.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../server/get-page-files.ts"],"names":["getPageFiles","buildManifest","page","normalizedPage","denormalizePagePath","normalizePagePath","files","pages","console","warn"],"mappings":"AAAA;;;;QAgBgBA,YAAY,GAAZA,YAAY;AAhBQ,IAAA,oBAA+C,WAA/C,+CAA+C,CAAA;AACjD,IAAA,kBAA6C,WAA7C,6CAA6C,CAAA;AAexE,SAASA,YAAY,CAC1BC,aAA4B,EAC5BC,IAAY,EACO;IACnB,MAAMC,cAAc,GAAGC,CAAAA,GAAAA,oBAAmB,AAAyB,CAAA,oBAAzB,CAACC,CAAAA,GAAAA,kBAAiB,AAAM,CAAA,kBAAN,CAACH,IAAI,CAAC,CAAC;IACnE,IAAII,KAAK,GAAGL,aAAa,CAACM,KAAK,CAACJ,cAAc,CAAC;IAE/C,IAAI,CAACG,KAAK,EAAE;QACVE,OAAO,CAACC,IAAI,CACV,CAAC,yBAAyB,EAAEN,cAAc,CAAC,6BAA6B,CAAC,CAC1E;QACD,OAAO,EAAE,CAAA;KACV;IAED,OAAOG,KAAK,CAAA;CACb"}
|
||||
1
kitabcitab/node_modules/next/dist/server/get-route-from-entrypoint.d.ts
generated
vendored
Normal file
1
kitabcitab/node_modules/next/dist/server/get-route-from-entrypoint.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export default function getRouteFromEntrypoint(entryFile: string, app?: boolean): string | null;
|
||||
30
kitabcitab/node_modules/next/dist/server/get-route-from-entrypoint.js
generated
vendored
Normal file
30
kitabcitab/node_modules/next/dist/server/get-route-from-entrypoint.js
generated
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = getRouteFromEntrypoint;
|
||||
var _getAppRouteFromEntrypoint = _interopRequireDefault(require("./get-app-route-from-entrypoint"));
|
||||
var _matchBundle = _interopRequireDefault(require("./match-bundle"));
|
||||
function getRouteFromEntrypoint(entryFile, app) {
|
||||
let pagePath = (0, _matchBundle).default(SERVER_ROUTE_NAME_REGEX, entryFile);
|
||||
if (pagePath) {
|
||||
return pagePath;
|
||||
}
|
||||
if (app) {
|
||||
pagePath = (0, _getAppRouteFromEntrypoint).default(entryFile);
|
||||
if (pagePath) return pagePath;
|
||||
}
|
||||
// Potentially the passed item is a browser bundle so we try to match that also
|
||||
return (0, _matchBundle).default(BROWSER_ROUTE_NAME_REGEX, entryFile);
|
||||
}
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {
|
||||
default: obj
|
||||
};
|
||||
}
|
||||
// matches pages/:page*.js
|
||||
const SERVER_ROUTE_NAME_REGEX = /^pages[/\\](.*)$/;
|
||||
// matches static/pages/:page*.js
|
||||
const BROWSER_ROUTE_NAME_REGEX = /^static[/\\]pages[/\\](.*)$/;
|
||||
|
||||
//# sourceMappingURL=get-route-from-entrypoint.js.map
|
||||
1
kitabcitab/node_modules/next/dist/server/get-route-from-entrypoint.js.map
generated
vendored
Normal file
1
kitabcitab/node_modules/next/dist/server/get-route-from-entrypoint.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../server/get-route-from-entrypoint.ts"],"names":["getRouteFromEntrypoint","entryFile","app","pagePath","matchBundle","SERVER_ROUTE_NAME_REGEX","getAppRouteFromEntrypoint","BROWSER_ROUTE_NAME_REGEX"],"mappings":"AAAA;;;;kBASwBA,sBAAsB;AATR,IAAA,0BAAiC,kCAAjC,iCAAiC,EAAA;AAC/C,IAAA,YAAgB,kCAAhB,gBAAgB,EAAA;AAQzB,SAASA,sBAAsB,CAC5CC,SAAiB,EACjBC,GAAa,EACE;IACf,IAAIC,QAAQ,GAAGC,CAAAA,GAAAA,YAAW,AAAoC,CAAA,QAApC,CAACC,uBAAuB,EAAEJ,SAAS,CAAC;IAE9D,IAAIE,QAAQ,EAAE;QACZ,OAAOA,QAAQ,CAAA;KAChB;IAED,IAAID,GAAG,EAAE;QACPC,QAAQ,GAAGG,CAAAA,GAAAA,0BAAyB,AAAW,CAAA,QAAX,CAACL,SAAS,CAAC;QAC/C,IAAIE,QAAQ,EAAE,OAAOA,QAAQ,CAAA;KAC9B;IAED,+EAA+E;IAC/E,OAAOC,CAAAA,GAAAA,YAAW,AAAqC,CAAA,QAArC,CAACG,wBAAwB,EAAEN,SAAS,CAAC,CAAA;CACxD;;;;;;AAvBD,0BAA0B;AAC1B,MAAMI,uBAAuB,qBAAqB;AAElD,iCAAiC;AACjC,MAAME,wBAAwB,gCAAgC"}
|
||||
12872
kitabcitab/node_modules/next/dist/server/google-font-metrics.json
generated
vendored
Normal file
12872
kitabcitab/node_modules/next/dist/server/google-font-metrics.json
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
2
kitabcitab/node_modules/next/dist/server/htmlescape.d.ts
generated
vendored
Normal file
2
kitabcitab/node_modules/next/dist/server/htmlescape.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export declare const ESCAPE_REGEX: RegExp;
|
||||
export declare function htmlEscapeJsonString(str: string): string;
|
||||
22
kitabcitab/node_modules/next/dist/server/htmlescape.js
generated
vendored
Normal file
22
kitabcitab/node_modules/next/dist/server/htmlescape.js
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.htmlEscapeJsonString = htmlEscapeJsonString;
|
||||
exports.ESCAPE_REGEX = void 0;
|
||||
// This utility is based on https://github.com/zertosh/htmlescape
|
||||
// License: https://github.com/zertosh/htmlescape/blob/0527ca7156a524d256101bb310a9f970f63078ad/LICENSE
|
||||
const ESCAPE_LOOKUP = {
|
||||
"&": "\\u0026",
|
||||
">": "\\u003e",
|
||||
"<": "\\u003c",
|
||||
"\u2028": "\\u2028",
|
||||
"\u2029": "\\u2029"
|
||||
};
|
||||
const ESCAPE_REGEX = /[&><\u2028\u2029]/g;
|
||||
exports.ESCAPE_REGEX = ESCAPE_REGEX;
|
||||
function htmlEscapeJsonString(str) {
|
||||
return str.replace(ESCAPE_REGEX, (match)=>ESCAPE_LOOKUP[match]);
|
||||
}
|
||||
|
||||
//# sourceMappingURL=htmlescape.js.map
|
||||
1
kitabcitab/node_modules/next/dist/server/htmlescape.js.map
generated
vendored
Normal file
1
kitabcitab/node_modules/next/dist/server/htmlescape.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../server/htmlescape.ts"],"names":["htmlEscapeJsonString","ESCAPE_LOOKUP","ESCAPE_REGEX","str","replace","match"],"mappings":"AAGA;;;;QAUgBA,oBAAoB,GAApBA,oBAAoB;;AAbpC,iEAAiE;AACjE,uGAAuG;AAEvG,MAAMC,aAAa,GAAgC;IACjD,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,SAAS;IACd,QAAQ,EAAE,SAAS;IACnB,QAAQ,EAAE,SAAS;CACpB;AAEM,MAAMC,YAAY,uBAAuB;QAAnCA,YAAY,GAAZA,YAAY;AAElB,SAASF,oBAAoB,CAACG,GAAW,EAAU;IACxD,OAAOA,GAAG,CAACC,OAAO,CAACF,YAAY,EAAE,CAACG,KAAK,GAAKJ,aAAa,CAACI,KAAK,CAAC,CAAC,CAAA;CAClE"}
|
||||
75
kitabcitab/node_modules/next/dist/server/image-optimizer.d.ts
generated
vendored
Normal file
75
kitabcitab/node_modules/next/dist/server/image-optimizer.d.ts
generated
vendored
Normal file
@@ -0,0 +1,75 @@
|
||||
/// <reference types="node" />
|
||||
/// <reference types="node" />
|
||||
/// <reference types="node" />
|
||||
import { IncomingMessage, ServerResponse } from 'http';
|
||||
import { UrlWithParsedQuery } from 'url';
|
||||
import { NextConfigComplete } from './config-shared';
|
||||
import { NextUrlWithParsedQuery } from './request-meta';
|
||||
import { IncrementalCacheEntry, IncrementalCacheValue } from './response-cache';
|
||||
declare type XCacheHeader = 'MISS' | 'HIT' | 'STALE';
|
||||
export interface ImageParamsResult {
|
||||
href: string;
|
||||
isAbsolute: boolean;
|
||||
isStatic: boolean;
|
||||
width: number;
|
||||
quality: number;
|
||||
mimeType: string;
|
||||
sizes: number[];
|
||||
minimumCacheTTL: number;
|
||||
}
|
||||
export declare function getHash(items: (string | number | Buffer)[]): string;
|
||||
/**
|
||||
* Inspects the first few bytes of a buffer to determine if
|
||||
* it matches the "magic number" of known file signatures.
|
||||
* https://en.wikipedia.org/wiki/List_of_file_signatures
|
||||
*/
|
||||
export declare function detectContentType(buffer: Buffer): "image/svg+xml" | "image/avif" | "image/webp" | "image/png" | "image/jpeg" | "image/gif" | null;
|
||||
export declare class ImageOptimizerCache {
|
||||
private cacheDir;
|
||||
private nextConfig;
|
||||
static validateParams(req: IncomingMessage, query: UrlWithParsedQuery['query'], nextConfig: NextConfigComplete, isDev: boolean): ImageParamsResult | {
|
||||
errorMessage: string;
|
||||
};
|
||||
static getCacheKey({ href, width, quality, mimeType, }: {
|
||||
href: string;
|
||||
width: number;
|
||||
quality: number;
|
||||
mimeType: string;
|
||||
}): string;
|
||||
constructor({ distDir, nextConfig, }: {
|
||||
distDir: string;
|
||||
nextConfig: NextConfigComplete;
|
||||
});
|
||||
get(cacheKey: string): Promise<IncrementalCacheEntry | null>;
|
||||
set(cacheKey: string, value: IncrementalCacheValue | null, revalidate?: number | false): Promise<void>;
|
||||
}
|
||||
export declare class ImageError extends Error {
|
||||
statusCode: number;
|
||||
constructor(statusCode: number, message: string);
|
||||
}
|
||||
export declare function getMaxAge(str: string | null): number;
|
||||
export declare function optimizeImage({ buffer, contentType, quality, width, height, nextConfigOutput, }: {
|
||||
buffer: Buffer;
|
||||
contentType: string;
|
||||
quality: number;
|
||||
width: number;
|
||||
height?: number;
|
||||
nextConfigOutput?: 'standalone';
|
||||
}): Promise<Buffer>;
|
||||
export declare function imageOptimizer(_req: IncomingMessage, _res: ServerResponse, paramsResult: ImageParamsResult, nextConfig: NextConfigComplete, isDev: boolean | undefined, handleRequest: (newReq: IncomingMessage, newRes: ServerResponse, newParsedUrl?: NextUrlWithParsedQuery) => Promise<void>): Promise<{
|
||||
buffer: Buffer;
|
||||
contentType: string;
|
||||
maxAge: number;
|
||||
}>;
|
||||
export declare function sendResponse(req: IncomingMessage, res: ServerResponse, url: string, extension: string, buffer: Buffer, isStatic: boolean, xCache: XCacheHeader, contentSecurityPolicy: string, maxAge: number, isDev: boolean): void;
|
||||
export declare function getImageSize(buffer: Buffer, extension: 'avif' | 'webp' | 'png' | 'jpeg'): Promise<{
|
||||
width?: number;
|
||||
height?: number;
|
||||
}>;
|
||||
export declare class Deferred<T> {
|
||||
promise: Promise<T>;
|
||||
resolve: (value: T) => void;
|
||||
reject: (error?: Error) => void;
|
||||
constructor();
|
||||
}
|
||||
export {};
|
||||
650
kitabcitab/node_modules/next/dist/server/image-optimizer.js
generated
vendored
Normal file
650
kitabcitab/node_modules/next/dist/server/image-optimizer.js
generated
vendored
Normal file
@@ -0,0 +1,650 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.getHash = getHash;
|
||||
exports.detectContentType = detectContentType;
|
||||
exports.getMaxAge = getMaxAge;
|
||||
exports.optimizeImage = optimizeImage;
|
||||
exports.imageOptimizer = imageOptimizer;
|
||||
exports.sendResponse = sendResponse;
|
||||
exports.getImageSize = getImageSize;
|
||||
var _accept = require("next/dist/compiled/@hapi/accept");
|
||||
var _crypto = require("crypto");
|
||||
var _fs = require("fs");
|
||||
var _getOrientation = require("next/dist/compiled/get-orientation");
|
||||
var _imageSize = _interopRequireDefault(require("next/dist/compiled/image-size"));
|
||||
var _isAnimated = _interopRequireDefault(require("next/dist/compiled/is-animated"));
|
||||
var _contentDisposition = _interopRequireDefault(require("next/dist/compiled/content-disposition"));
|
||||
var _path = require("path");
|
||||
var _url = _interopRequireDefault(require("url"));
|
||||
var _main = require("./lib/squoosh/main");
|
||||
var _sendPayload = require("./send-payload");
|
||||
var _serveStatic = require("./serve-static");
|
||||
var _chalk = _interopRequireDefault(require("next/dist/compiled/chalk"));
|
||||
var _mockRequest = require("./lib/mock-request");
|
||||
var _matchRemotePattern = require("../shared/lib/match-remote-pattern");
|
||||
var _imageBlurSvg = require("../shared/lib/image-blur-svg");
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {
|
||||
default: obj
|
||||
};
|
||||
}
|
||||
const AVIF = "image/avif";
|
||||
const WEBP = "image/webp";
|
||||
const PNG = "image/png";
|
||||
const JPEG = "image/jpeg";
|
||||
const GIF = "image/gif";
|
||||
const SVG = "image/svg+xml";
|
||||
const CACHE_VERSION = 3;
|
||||
const ANIMATABLE_TYPES = [
|
||||
WEBP,
|
||||
PNG,
|
||||
GIF
|
||||
];
|
||||
const VECTOR_TYPES = [
|
||||
SVG
|
||||
];
|
||||
const BLUR_IMG_SIZE = 8 // should match `next-image-loader`
|
||||
;
|
||||
const BLUR_QUALITY = 70 // should match `next-image-loader`
|
||||
;
|
||||
let sharp;
|
||||
try {
|
||||
sharp = require(process.env.NEXT_SHARP_PATH || "sharp");
|
||||
} catch (e) {
|
||||
// Sharp not present on the server, Squoosh fallback will be used
|
||||
}
|
||||
let showSharpMissingWarning = process.env.NODE_ENV === "production";
|
||||
function getSupportedMimeType(options, accept = "") {
|
||||
const mimeType = (0, _accept).mediaType(accept, options);
|
||||
return accept.includes(mimeType) ? mimeType : "";
|
||||
}
|
||||
function getHash(items) {
|
||||
const hash = (0, _crypto).createHash("sha256");
|
||||
for (let item of items){
|
||||
if (typeof item === "number") hash.update(String(item));
|
||||
else {
|
||||
hash.update(item);
|
||||
}
|
||||
}
|
||||
// See https://en.wikipedia.org/wiki/Base64#Filenames
|
||||
return hash.digest("base64").replace(/\//g, "-");
|
||||
}
|
||||
async function writeToCacheDir(dir, extension, maxAge, expireAt, buffer, etag) {
|
||||
const filename = (0, _path).join(dir, `${maxAge}.${expireAt}.${etag}.${extension}`);
|
||||
// Added in: v14.14.0 https://nodejs.org/api/fs.html#fspromisesrmpath-options
|
||||
// attempt cleaning up existing stale cache
|
||||
if (_fs.promises.rm) {
|
||||
await _fs.promises.rm(dir, {
|
||||
force: true,
|
||||
recursive: true
|
||||
}).catch(()=>{});
|
||||
} else {
|
||||
await _fs.promises.rmdir(dir, {
|
||||
recursive: true
|
||||
}).catch(()=>{});
|
||||
}
|
||||
await _fs.promises.mkdir(dir, {
|
||||
recursive: true
|
||||
});
|
||||
await _fs.promises.writeFile(filename, buffer);
|
||||
}
|
||||
function detectContentType(buffer) {
|
||||
if ([
|
||||
0xff,
|
||||
0xd8,
|
||||
0xff
|
||||
].every((b, i)=>buffer[i] === b)) {
|
||||
return JPEG;
|
||||
}
|
||||
if ([
|
||||
0x89,
|
||||
0x50,
|
||||
0x4e,
|
||||
0x47,
|
||||
0x0d,
|
||||
0x0a,
|
||||
0x1a,
|
||||
0x0a
|
||||
].every((b, i)=>buffer[i] === b)) {
|
||||
return PNG;
|
||||
}
|
||||
if ([
|
||||
0x47,
|
||||
0x49,
|
||||
0x46,
|
||||
0x38
|
||||
].every((b, i)=>buffer[i] === b)) {
|
||||
return GIF;
|
||||
}
|
||||
if ([
|
||||
0x52,
|
||||
0x49,
|
||||
0x46,
|
||||
0x46,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0x57,
|
||||
0x45,
|
||||
0x42,
|
||||
0x50
|
||||
].every((b, i)=>!b || buffer[i] === b)) {
|
||||
return WEBP;
|
||||
}
|
||||
if ([
|
||||
0x3c,
|
||||
0x3f,
|
||||
0x78,
|
||||
0x6d,
|
||||
0x6c
|
||||
].every((b, i)=>buffer[i] === b)) {
|
||||
return SVG;
|
||||
}
|
||||
if ([
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0x66,
|
||||
0x74,
|
||||
0x79,
|
||||
0x70,
|
||||
0x61,
|
||||
0x76,
|
||||
0x69,
|
||||
0x66
|
||||
].every((b, i)=>!b || buffer[i] === b)) {
|
||||
return AVIF;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
class ImageOptimizerCache {
|
||||
static validateParams(req, query, nextConfig, isDev) {
|
||||
var ref;
|
||||
const imageData = nextConfig.images;
|
||||
const { deviceSizes =[] , imageSizes =[] , domains =[] , minimumCacheTTL =60 , formats =[
|
||||
"image/webp"
|
||||
] , } = imageData;
|
||||
const remotePatterns = ((ref = nextConfig.images) == null ? void 0 : ref.remotePatterns) || [];
|
||||
const { url , w , q } = query;
|
||||
let href;
|
||||
if (!url) {
|
||||
return {
|
||||
errorMessage: '"url" parameter is required'
|
||||
};
|
||||
} else if (Array.isArray(url)) {
|
||||
return {
|
||||
errorMessage: '"url" parameter cannot be an array'
|
||||
};
|
||||
}
|
||||
let isAbsolute;
|
||||
if (url.startsWith("/")) {
|
||||
href = url;
|
||||
isAbsolute = false;
|
||||
} else {
|
||||
let hrefParsed;
|
||||
try {
|
||||
hrefParsed = new URL(url);
|
||||
href = hrefParsed.toString();
|
||||
isAbsolute = true;
|
||||
} catch (_error) {
|
||||
return {
|
||||
errorMessage: '"url" parameter is invalid'
|
||||
};
|
||||
}
|
||||
if (![
|
||||
"http:",
|
||||
"https:"
|
||||
].includes(hrefParsed.protocol)) {
|
||||
return {
|
||||
errorMessage: '"url" parameter is invalid'
|
||||
};
|
||||
}
|
||||
if (!(0, _matchRemotePattern).hasMatch(domains, remotePatterns, hrefParsed)) {
|
||||
return {
|
||||
errorMessage: '"url" parameter is not allowed'
|
||||
};
|
||||
}
|
||||
}
|
||||
if (!w) {
|
||||
return {
|
||||
errorMessage: '"w" parameter (width) is required'
|
||||
};
|
||||
} else if (Array.isArray(w)) {
|
||||
return {
|
||||
errorMessage: '"w" parameter (width) cannot be an array'
|
||||
};
|
||||
}
|
||||
if (!q) {
|
||||
return {
|
||||
errorMessage: '"q" parameter (quality) is required'
|
||||
};
|
||||
} else if (Array.isArray(q)) {
|
||||
return {
|
||||
errorMessage: '"q" parameter (quality) cannot be an array'
|
||||
};
|
||||
}
|
||||
const width = parseInt(w, 10);
|
||||
if (width <= 0 || isNaN(width)) {
|
||||
return {
|
||||
errorMessage: '"w" parameter (width) must be a number greater than 0'
|
||||
};
|
||||
}
|
||||
const sizes = [
|
||||
...deviceSizes || [],
|
||||
...imageSizes || []
|
||||
];
|
||||
if (isDev) {
|
||||
sizes.push(BLUR_IMG_SIZE);
|
||||
}
|
||||
const isValidSize = sizes.includes(width) || isDev && width <= BLUR_IMG_SIZE;
|
||||
if (!isValidSize) {
|
||||
return {
|
||||
errorMessage: `"w" parameter (width) of ${width} is not allowed`
|
||||
};
|
||||
}
|
||||
const quality = parseInt(q);
|
||||
if (isNaN(quality) || quality < 1 || quality > 100) {
|
||||
return {
|
||||
errorMessage: '"q" parameter (quality) must be a number between 1 and 100'
|
||||
};
|
||||
}
|
||||
const mimeType = getSupportedMimeType(formats || [], req.headers["accept"]);
|
||||
const isStatic = url.startsWith(`${nextConfig.basePath || ""}/_next/static/media`);
|
||||
return {
|
||||
href,
|
||||
sizes,
|
||||
isAbsolute,
|
||||
isStatic,
|
||||
width,
|
||||
quality,
|
||||
mimeType,
|
||||
minimumCacheTTL
|
||||
};
|
||||
}
|
||||
static getCacheKey({ href , width , quality , mimeType }) {
|
||||
return getHash([
|
||||
CACHE_VERSION,
|
||||
href,
|
||||
width,
|
||||
quality,
|
||||
mimeType
|
||||
]);
|
||||
}
|
||||
constructor({ distDir , nextConfig }){
|
||||
this.cacheDir = (0, _path).join(distDir, "cache", "images");
|
||||
this.nextConfig = nextConfig;
|
||||
}
|
||||
async get(cacheKey) {
|
||||
try {
|
||||
const cacheDir = (0, _path).join(this.cacheDir, cacheKey);
|
||||
const files = await _fs.promises.readdir(cacheDir);
|
||||
const now = Date.now();
|
||||
for (const file of files){
|
||||
const [maxAgeSt, expireAtSt, etag, extension] = file.split(".");
|
||||
const buffer = await _fs.promises.readFile((0, _path).join(cacheDir, file));
|
||||
const expireAt = Number(expireAtSt);
|
||||
const maxAge = Number(maxAgeSt);
|
||||
return {
|
||||
value: {
|
||||
kind: "IMAGE",
|
||||
etag,
|
||||
buffer,
|
||||
extension
|
||||
},
|
||||
revalidateAfter: Math.max(maxAge, this.nextConfig.images.minimumCacheTTL) * 1000 + Date.now(),
|
||||
curRevalidate: maxAge,
|
||||
isStale: now > expireAt
|
||||
};
|
||||
}
|
||||
} catch (_) {
|
||||
// failed to read from cache dir, treat as cache miss
|
||||
}
|
||||
return null;
|
||||
}
|
||||
async set(cacheKey, value, revalidate) {
|
||||
if ((value == null ? void 0 : value.kind) !== "IMAGE") {
|
||||
throw new Error("invariant attempted to set non-image to image-cache");
|
||||
}
|
||||
if (typeof revalidate !== "number") {
|
||||
throw new Error("invariant revalidate must be a number for image-cache");
|
||||
}
|
||||
const expireAt = Math.max(revalidate, this.nextConfig.images.minimumCacheTTL) * 1000 + Date.now();
|
||||
try {
|
||||
await writeToCacheDir((0, _path).join(this.cacheDir, cacheKey), value.extension, revalidate, expireAt, value.buffer, value.etag);
|
||||
} catch (err) {
|
||||
console.error(`Failed to write image to cache ${cacheKey}`, err);
|
||||
}
|
||||
}
|
||||
}
|
||||
exports.ImageOptimizerCache = ImageOptimizerCache;
|
||||
class ImageError extends Error {
|
||||
constructor(statusCode, message){
|
||||
super(message);
|
||||
// ensure an error status is used > 400
|
||||
if (statusCode >= 400) {
|
||||
this.statusCode = statusCode;
|
||||
} else {
|
||||
this.statusCode = 500;
|
||||
}
|
||||
}
|
||||
}
|
||||
exports.ImageError = ImageError;
|
||||
function parseCacheControl(str) {
|
||||
const map = new Map();
|
||||
if (!str) {
|
||||
return map;
|
||||
}
|
||||
for (let directive of str.split(",")){
|
||||
let [key, value] = directive.trim().split("=");
|
||||
key = key.toLowerCase();
|
||||
if (value) {
|
||||
value = value.toLowerCase();
|
||||
}
|
||||
map.set(key, value);
|
||||
}
|
||||
return map;
|
||||
}
|
||||
function getMaxAge(str) {
|
||||
const map = parseCacheControl(str);
|
||||
if (map) {
|
||||
let age = map.get("s-maxage") || map.get("max-age") || "";
|
||||
if (age.startsWith('"') && age.endsWith('"')) {
|
||||
age = age.slice(1, -1);
|
||||
}
|
||||
const n = parseInt(age, 10);
|
||||
if (!isNaN(n)) {
|
||||
return n;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
async function optimizeImage({ buffer , contentType , quality , width , height , nextConfigOutput }) {
|
||||
let optimizedBuffer = buffer;
|
||||
if (sharp) {
|
||||
// Begin sharp transformation logic
|
||||
const transformer = sharp(buffer);
|
||||
transformer.rotate();
|
||||
if (height) {
|
||||
transformer.resize(width, height);
|
||||
} else {
|
||||
const { width: metaWidth } = await transformer.metadata();
|
||||
if (metaWidth && metaWidth > width) {
|
||||
transformer.resize(width);
|
||||
}
|
||||
}
|
||||
if (contentType === AVIF) {
|
||||
if (transformer.avif) {
|
||||
const avifQuality = quality - 15;
|
||||
transformer.avif({
|
||||
quality: Math.max(avifQuality, 0),
|
||||
chromaSubsampling: "4:2:0"
|
||||
});
|
||||
} else {
|
||||
console.warn(_chalk.default.yellow.bold("Warning: ") + `Your installed version of the 'sharp' package does not support AVIF images. Run 'yarn add sharp@latest' to upgrade to the latest version.\n` + "Read more: https://nextjs.org/docs/messages/sharp-version-avif");
|
||||
transformer.webp({
|
||||
quality
|
||||
});
|
||||
}
|
||||
} else if (contentType === WEBP) {
|
||||
transformer.webp({
|
||||
quality
|
||||
});
|
||||
} else if (contentType === PNG) {
|
||||
transformer.png({
|
||||
quality
|
||||
});
|
||||
} else if (contentType === JPEG) {
|
||||
transformer.jpeg({
|
||||
quality
|
||||
});
|
||||
}
|
||||
optimizedBuffer = await transformer.toBuffer();
|
||||
// End sharp transformation logic
|
||||
} else {
|
||||
if (showSharpMissingWarning && nextConfigOutput) {
|
||||
// TODO: should we ensure squoosh also works even though we don't
|
||||
// recommend it be used in production and this is a production feature
|
||||
console.error(`Error: 'sharp' is required to be installed in standalone mode for the image optimization to function correctly. Read more at: https://nextjs.org/docs/messages/sharp-missing-in-production`);
|
||||
throw new ImageError(500, "internal server error");
|
||||
}
|
||||
// Show sharp warning in production once
|
||||
if (showSharpMissingWarning) {
|
||||
console.warn(_chalk.default.yellow.bold("Warning: ") + `For production Image Optimization with Next.js, the optional 'sharp' package is strongly recommended. Run 'yarn add sharp', and Next.js will use it automatically for Image Optimization.\n` + "Read more: https://nextjs.org/docs/messages/sharp-missing-in-production");
|
||||
showSharpMissingWarning = false;
|
||||
}
|
||||
// Begin Squoosh transformation logic
|
||||
const orientation = await (0, _getOrientation).getOrientation(buffer);
|
||||
const operations = [];
|
||||
if (orientation === _getOrientation.Orientation.RIGHT_TOP) {
|
||||
operations.push({
|
||||
type: "rotate",
|
||||
numRotations: 1
|
||||
});
|
||||
} else if (orientation === _getOrientation.Orientation.BOTTOM_RIGHT) {
|
||||
operations.push({
|
||||
type: "rotate",
|
||||
numRotations: 2
|
||||
});
|
||||
} else if (orientation === _getOrientation.Orientation.LEFT_BOTTOM) {
|
||||
operations.push({
|
||||
type: "rotate",
|
||||
numRotations: 3
|
||||
});
|
||||
} else {
|
||||
// TODO: support more orientations
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
// const _: never = orientation
|
||||
}
|
||||
if (height) {
|
||||
operations.push({
|
||||
type: "resize",
|
||||
width,
|
||||
height
|
||||
});
|
||||
} else {
|
||||
operations.push({
|
||||
type: "resize",
|
||||
width
|
||||
});
|
||||
}
|
||||
if (contentType === AVIF) {
|
||||
optimizedBuffer = await (0, _main).processBuffer(buffer, operations, "avif", quality);
|
||||
} else if (contentType === WEBP) {
|
||||
optimizedBuffer = await (0, _main).processBuffer(buffer, operations, "webp", quality);
|
||||
} else if (contentType === PNG) {
|
||||
optimizedBuffer = await (0, _main).processBuffer(buffer, operations, "png", quality);
|
||||
} else if (contentType === JPEG) {
|
||||
optimizedBuffer = await (0, _main).processBuffer(buffer, operations, "jpeg", quality);
|
||||
}
|
||||
}
|
||||
return optimizedBuffer;
|
||||
}
|
||||
async function imageOptimizer(_req, _res, paramsResult, nextConfig, isDev, handleRequest) {
|
||||
let upstreamBuffer;
|
||||
let upstreamType;
|
||||
let maxAge;
|
||||
const { isAbsolute , href , width , mimeType , quality } = paramsResult;
|
||||
if (isAbsolute) {
|
||||
const upstreamRes = await fetch(href);
|
||||
if (!upstreamRes.ok) {
|
||||
console.error("upstream image response failed for", href, upstreamRes.status);
|
||||
throw new ImageError(upstreamRes.status, '"url" parameter is valid but upstream response is invalid');
|
||||
}
|
||||
upstreamBuffer = Buffer.from(await upstreamRes.arrayBuffer());
|
||||
upstreamType = detectContentType(upstreamBuffer) || upstreamRes.headers.get("Content-Type");
|
||||
maxAge = getMaxAge(upstreamRes.headers.get("Cache-Control"));
|
||||
} else {
|
||||
try {
|
||||
const { resBuffers , req: mockReq , res: mockRes , streamPromise: isStreamFinished , } = (0, _mockRequest).mockRequest(href, _req.headers, _req.method || "GET", _req.connection);
|
||||
await handleRequest(mockReq, mockRes, _url.default.parse(href, true));
|
||||
await isStreamFinished;
|
||||
if (!mockRes.statusCode) {
|
||||
console.error("image response failed for", href, mockRes.statusCode);
|
||||
throw new ImageError(mockRes.statusCode, '"url" parameter is valid but internal response is invalid');
|
||||
}
|
||||
upstreamBuffer = Buffer.concat(resBuffers);
|
||||
upstreamType = detectContentType(upstreamBuffer) || mockRes.getHeader("Content-Type");
|
||||
maxAge = getMaxAge(mockRes.getHeader("Cache-Control"));
|
||||
} catch (err) {
|
||||
console.error("upstream image response failed for", href, err);
|
||||
throw new ImageError(500, '"url" parameter is valid but upstream response is invalid');
|
||||
}
|
||||
}
|
||||
if (upstreamType === SVG && !nextConfig.images.dangerouslyAllowSVG) {
|
||||
console.error(`The requested resource "${href}" has type "${upstreamType}" but dangerouslyAllowSVG is disabled`);
|
||||
throw new ImageError(400, '"url" parameter is valid but image type is not allowed');
|
||||
}
|
||||
if (upstreamType) {
|
||||
const vector = VECTOR_TYPES.includes(upstreamType);
|
||||
const animate = ANIMATABLE_TYPES.includes(upstreamType) && (0, _isAnimated).default(upstreamBuffer);
|
||||
if (vector || animate) {
|
||||
return {
|
||||
buffer: upstreamBuffer,
|
||||
contentType: upstreamType,
|
||||
maxAge
|
||||
};
|
||||
}
|
||||
if (!upstreamType.startsWith("image/")) {
|
||||
console.error("The requested resource isn't a valid image for", href, "received", upstreamType);
|
||||
throw new ImageError(400, "The requested resource isn't a valid image.");
|
||||
}
|
||||
}
|
||||
let contentType;
|
||||
if (mimeType) {
|
||||
contentType = mimeType;
|
||||
} else if ((upstreamType == null ? void 0 : upstreamType.startsWith("image/")) && (0, _serveStatic).getExtension(upstreamType) && upstreamType !== WEBP && upstreamType !== AVIF) {
|
||||
contentType = upstreamType;
|
||||
} else {
|
||||
contentType = JPEG;
|
||||
}
|
||||
try {
|
||||
let optimizedBuffer = await optimizeImage({
|
||||
buffer: upstreamBuffer,
|
||||
contentType,
|
||||
quality,
|
||||
width,
|
||||
nextConfigOutput: nextConfig.output
|
||||
});
|
||||
if (optimizedBuffer) {
|
||||
if (isDev && width <= BLUR_IMG_SIZE && quality === BLUR_QUALITY) {
|
||||
// During `next dev`, we don't want to generate blur placeholders with webpack
|
||||
// because it can delay starting the dev server. Instead, `next-image-loader.js`
|
||||
// will inline a special url to lazily generate the blur placeholder at request time.
|
||||
const meta = await (0, _main).getMetadata(optimizedBuffer);
|
||||
const opts = {
|
||||
blurWidth: meta.width,
|
||||
blurHeight: meta.height,
|
||||
blurDataURL: `data:${contentType};base64,${optimizedBuffer.toString("base64")}`
|
||||
};
|
||||
optimizedBuffer = Buffer.from(unescape((0, _imageBlurSvg).getImageBlurSvg(opts)));
|
||||
contentType = "image/svg+xml";
|
||||
}
|
||||
return {
|
||||
buffer: optimizedBuffer,
|
||||
contentType,
|
||||
maxAge: Math.max(maxAge, nextConfig.images.minimumCacheTTL)
|
||||
};
|
||||
} else {
|
||||
throw new ImageError(500, "Unable to optimize buffer");
|
||||
}
|
||||
} catch (error) {
|
||||
if (upstreamBuffer && upstreamType) {
|
||||
// If we fail to optimize, fallback to the original image
|
||||
return {
|
||||
buffer: upstreamBuffer,
|
||||
contentType: upstreamType,
|
||||
maxAge: nextConfig.images.minimumCacheTTL
|
||||
};
|
||||
} else {
|
||||
throw new ImageError(400, "Unable to optimize image and unable to fallback to upstream image");
|
||||
}
|
||||
}
|
||||
}
|
||||
function getFileNameWithExtension(url, contentType) {
|
||||
const [urlWithoutQueryParams] = url.split("?");
|
||||
const fileNameWithExtension = urlWithoutQueryParams.split("/").pop();
|
||||
if (!contentType || !fileNameWithExtension) {
|
||||
return;
|
||||
}
|
||||
const [fileName] = fileNameWithExtension.split(".");
|
||||
const extension = (0, _serveStatic).getExtension(contentType);
|
||||
return `${fileName}.${extension}`;
|
||||
}
|
||||
function setResponseHeaders(req, res, url, etag, contentType, isStatic, xCache, contentSecurityPolicy, maxAge, isDev) {
|
||||
res.setHeader("Vary", "Accept");
|
||||
res.setHeader("Cache-Control", isStatic ? "public, max-age=315360000, immutable" : `public, max-age=${isDev ? 0 : maxAge}, must-revalidate`);
|
||||
if ((0, _sendPayload).sendEtagResponse(req, res, etag)) {
|
||||
// already called res.end() so we're finished
|
||||
return {
|
||||
finished: true
|
||||
};
|
||||
}
|
||||
if (contentType) {
|
||||
res.setHeader("Content-Type", contentType);
|
||||
}
|
||||
const fileName = getFileNameWithExtension(url, contentType);
|
||||
if (fileName) {
|
||||
res.setHeader("Content-Disposition", (0, _contentDisposition).default(fileName, {
|
||||
type: "inline"
|
||||
}));
|
||||
}
|
||||
if (contentSecurityPolicy) {
|
||||
res.setHeader("Content-Security-Policy", contentSecurityPolicy);
|
||||
}
|
||||
res.setHeader("X-Nextjs-Cache", xCache);
|
||||
return {
|
||||
finished: false
|
||||
};
|
||||
}
|
||||
function sendResponse(req, res, url, extension, buffer, isStatic, xCache, contentSecurityPolicy, maxAge, isDev) {
|
||||
const contentType = (0, _serveStatic).getContentType(extension);
|
||||
const etag = getHash([
|
||||
buffer
|
||||
]);
|
||||
const result = setResponseHeaders(req, res, url, etag, contentType, isStatic, xCache, contentSecurityPolicy, maxAge, isDev);
|
||||
if (!result.finished) {
|
||||
res.setHeader("Content-Length", Buffer.byteLength(buffer));
|
||||
res.end(buffer);
|
||||
}
|
||||
}
|
||||
async function getImageSize(buffer, // Should match VALID_BLUR_EXT
|
||||
extension) {
|
||||
// TODO: upgrade "image-size" package to support AVIF
|
||||
// See https://github.com/image-size/image-size/issues/348
|
||||
if (extension === "avif") {
|
||||
if (sharp) {
|
||||
const transformer = sharp(buffer);
|
||||
const { width , height } = await transformer.metadata();
|
||||
return {
|
||||
width,
|
||||
height
|
||||
};
|
||||
} else {
|
||||
const { width , height } = await (0, _main).decodeBuffer(buffer);
|
||||
return {
|
||||
width,
|
||||
height
|
||||
};
|
||||
}
|
||||
}
|
||||
const { width , height } = (0, _imageSize).default(buffer);
|
||||
return {
|
||||
width,
|
||||
height
|
||||
};
|
||||
}
|
||||
class Deferred {
|
||||
constructor(){
|
||||
this.promise = new Promise((resolve, reject)=>{
|
||||
this.resolve = resolve;
|
||||
this.reject = reject;
|
||||
});
|
||||
}
|
||||
}
|
||||
exports.Deferred = Deferred;
|
||||
|
||||
//# sourceMappingURL=image-optimizer.js.map
|
||||
1
kitabcitab/node_modules/next/dist/server/image-optimizer.js.map
generated
vendored
Normal file
1
kitabcitab/node_modules/next/dist/server/image-optimizer.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
1
kitabcitab/node_modules/next/dist/server/initialize-require-hook.d.ts
generated
vendored
Normal file
1
kitabcitab/node_modules/next/dist/server/initialize-require-hook.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export {};
|
||||
9
kitabcitab/node_modules/next/dist/server/initialize-require-hook.js
generated
vendored
Normal file
9
kitabcitab/node_modules/next/dist/server/initialize-require-hook.js
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
"use strict";
|
||||
var _requireHook = require("../build/webpack/require-hook");
|
||||
(0, _requireHook).loadRequireHook();
|
||||
const isPrebundled = false;
|
||||
if (isPrebundled) {
|
||||
(0, _requireHook).overrideBuiltInReactPackages();
|
||||
}
|
||||
|
||||
//# sourceMappingURL=initialize-require-hook.js.map
|
||||
1
kitabcitab/node_modules/next/dist/server/initialize-require-hook.js.map
generated
vendored
Normal file
1
kitabcitab/node_modules/next/dist/server/initialize-require-hook.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../server/initialize-require-hook.ts"],"names":["loadRequireHook","isPrebundled","overrideBuiltInReactPackages"],"mappings":"AAAA;AAGO,IAAA,YAA+B,WAA/B,+BAA+B,CAAA;AAEtCA,CAAAA,GAAAA,YAAe,AAAE,CAAA,gBAAF,EAAE;AAEjB,MAAMC,YAAY,GAAG,KAAK;AAE1B,IAAIA,YAAY,EAAE;IAChBC,CAAAA,GAAAA,YAA4B,AAAE,CAAA,6BAAF,EAAE;CAC/B"}
|
||||
3
kitabcitab/node_modules/next/dist/server/internal-utils.d.ts
generated
vendored
Normal file
3
kitabcitab/node_modules/next/dist/server/internal-utils.d.ts
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
import type { NextParsedUrlQuery } from './request-meta';
|
||||
export declare function stripInternalQueries(query: NextParsedUrlQuery): void;
|
||||
export declare function stripInternalSearchParams(searchParams: URLSearchParams, extended?: boolean): URLSearchParams;
|
||||
33
kitabcitab/node_modules/next/dist/server/internal-utils.js
generated
vendored
Normal file
33
kitabcitab/node_modules/next/dist/server/internal-utils.js
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.stripInternalQueries = stripInternalQueries;
|
||||
exports.stripInternalSearchParams = stripInternalSearchParams;
|
||||
const INTERNAL_QUERY_NAMES = [
|
||||
"__nextFallback",
|
||||
"__nextLocale",
|
||||
"__nextDefaultLocale",
|
||||
"__nextIsNotFound",
|
||||
];
|
||||
const EXTENDED_INTERNAL_QUERY_NAMES = [
|
||||
"__nextDataReq"
|
||||
];
|
||||
function stripInternalQueries(query) {
|
||||
for (const name of INTERNAL_QUERY_NAMES){
|
||||
delete query[name];
|
||||
}
|
||||
}
|
||||
function stripInternalSearchParams(searchParams, extended) {
|
||||
for (const name of INTERNAL_QUERY_NAMES){
|
||||
searchParams.delete(name);
|
||||
}
|
||||
if (extended) {
|
||||
for (const name of EXTENDED_INTERNAL_QUERY_NAMES){
|
||||
searchParams.delete(name);
|
||||
}
|
||||
}
|
||||
return searchParams;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=internal-utils.js.map
|
||||
1
kitabcitab/node_modules/next/dist/server/internal-utils.js.map
generated
vendored
Normal file
1
kitabcitab/node_modules/next/dist/server/internal-utils.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../server/internal-utils.ts"],"names":["stripInternalQueries","stripInternalSearchParams","INTERNAL_QUERY_NAMES","EXTENDED_INTERNAL_QUERY_NAMES","query","name","searchParams","extended","delete"],"mappings":"AAAA;;;;QAWgBA,oBAAoB,GAApBA,oBAAoB;QAMpBC,yBAAyB,GAAzBA,yBAAyB;AAfzC,MAAMC,oBAAoB,GAAG;IAC3B,gBAAgB;IAChB,cAAc;IACd,qBAAqB;IACrB,kBAAkB;CACnB,AAAS;AAEV,MAAMC,6BAA6B,GAAG;IAAC,eAAe;CAAC,AAAS;AAEzD,SAASH,oBAAoB,CAACI,KAAyB,EAAE;IAC9D,KAAK,MAAMC,IAAI,IAAIH,oBAAoB,CAAE;QACvC,OAAOE,KAAK,CAACC,IAAI,CAAC;KACnB;CACF;AAEM,SAASJ,yBAAyB,CACvCK,YAA6B,EAC7BC,QAAkB,EAClB;IACA,KAAK,MAAMF,IAAI,IAAIH,oBAAoB,CAAE;QACvCI,YAAY,CAACE,MAAM,CAACH,IAAI,CAAC;KAC1B;IAED,IAAIE,QAAQ,EAAE;QACZ,KAAK,MAAMF,IAAI,IAAIF,6BAA6B,CAAE;YAChDG,YAAY,CAACE,MAAM,CAACH,IAAI,CAAC;SAC1B;KACF;IAED,OAAOC,YAAY,CAAA;CACpB"}
|
||||
11
kitabcitab/node_modules/next/dist/server/lib/etag.d.ts
generated
vendored
Normal file
11
kitabcitab/node_modules/next/dist/server/lib/etag.d.ts
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
/**
|
||||
* FNV-1a Hash implementation
|
||||
* @author Travis Webb (tjwebb) <me@traviswebb.com>
|
||||
*
|
||||
* Ported from https://github.com/tjwebb/fnv-plus/blob/master/index.js
|
||||
*
|
||||
* Simplified, optimized and add modified for 52 bit, which provides a larger hash space
|
||||
* and still making use of Javascript's 53-bit integer space.
|
||||
*/
|
||||
export declare const fnv1a52: (str: string) => number;
|
||||
export declare const generateETag: (payload: string, weak?: boolean) => string;
|
||||
33
kitabcitab/node_modules/next/dist/server/lib/etag.js
generated
vendored
Normal file
33
kitabcitab/node_modules/next/dist/server/lib/etag.js
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.generateETag = exports.fnv1a52 = void 0;
|
||||
const fnv1a52 = (str)=>{
|
||||
const len = str.length;
|
||||
let i = 0, t0 = 0, v0 = 0x2325, t1 = 0, v1 = 0x8422, t2 = 0, v2 = 0x9ce4, t3 = 0, v3 = 0xcbf2;
|
||||
while(i < len){
|
||||
v0 ^= str.charCodeAt(i++);
|
||||
t0 = v0 * 435;
|
||||
t1 = v1 * 435;
|
||||
t2 = v2 * 435;
|
||||
t3 = v3 * 435;
|
||||
t2 += v0 << 8;
|
||||
t3 += v1 << 8;
|
||||
t1 += t0 >>> 16;
|
||||
v0 = t0 & 65535;
|
||||
t2 += t1 >>> 16;
|
||||
v1 = t1 & 65535;
|
||||
v3 = t3 + (t2 >>> 16) & 65535;
|
||||
v2 = t2 & 65535;
|
||||
}
|
||||
return (v3 & 15) * 281474976710656 + v2 * 4294967296 + v1 * 65536 + (v0 ^ v3 >> 4);
|
||||
};
|
||||
exports.fnv1a52 = fnv1a52;
|
||||
const generateETag = (payload, weak = false)=>{
|
||||
const prefix = weak ? 'W/"' : '"';
|
||||
return prefix + fnv1a52(payload).toString(36) + payload.length.toString(36) + '"';
|
||||
};
|
||||
exports.generateETag = generateETag;
|
||||
|
||||
//# sourceMappingURL=etag.js.map
|
||||
1
kitabcitab/node_modules/next/dist/server/lib/etag.js.map
generated
vendored
Normal file
1
kitabcitab/node_modules/next/dist/server/lib/etag.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../server/lib/etag.ts"],"names":["fnv1a52","str","len","length","i","t0","v0","t1","v1","t2","v2","t3","v3","charCodeAt","generateETag","payload","weak","prefix","toString"],"mappings":"AASA;;;;;AAAO,MAAMA,OAAO,GAAG,CAACC,GAAW,GAAK;IACtC,MAAMC,GAAG,GAAGD,GAAG,CAACE,MAAM;IACtB,IAAIC,CAAC,GAAG,CAAC,EACPC,EAAE,GAAG,CAAC,EACNC,EAAE,GAAG,MAAM,EACXC,EAAE,GAAG,CAAC,EACNC,EAAE,GAAG,MAAM,EACXC,EAAE,GAAG,CAAC,EACNC,EAAE,GAAG,MAAM,EACXC,EAAE,GAAG,CAAC,EACNC,EAAE,GAAG,MAAM;IAEb,MAAOR,CAAC,GAAGF,GAAG,CAAE;QACdI,EAAE,IAAIL,GAAG,CAACY,UAAU,CAACT,CAAC,EAAE,CAAC;QACzBC,EAAE,GAAGC,EAAE,GAAG,GAAG;QACbC,EAAE,GAAGC,EAAE,GAAG,GAAG;QACbC,EAAE,GAAGC,EAAE,GAAG,GAAG;QACbC,EAAE,GAAGC,EAAE,GAAG,GAAG;QACbH,EAAE,IAAIH,EAAE,IAAI,CAAC;QACbK,EAAE,IAAIH,EAAE,IAAI,CAAC;QACbD,EAAE,IAAIF,EAAE,KAAK,EAAE;QACfC,EAAE,GAAGD,EAAE,GAAG,KAAK;QACfI,EAAE,IAAIF,EAAE,KAAK,EAAE;QACfC,EAAE,GAAGD,EAAE,GAAG,KAAK;QACfK,EAAE,GAAG,AAACD,EAAE,GAAG,CAACF,EAAE,KAAK,EAAE,CAAC,GAAI,KAAK;QAC/BC,EAAE,GAAGD,EAAE,GAAG,KAAK;KAChB;IAED,OACE,CAACG,EAAE,GAAG,EAAE,CAAC,GAAG,eAAe,GAC3BF,EAAE,GAAG,UAAU,GACfF,EAAE,GAAG,KAAK,GACV,CAACF,EAAE,GAAIM,EAAE,IAAI,CAAC,AAAC,CAAC,CACjB;CACF;QAlCYZ,OAAO,GAAPA,OAAO;AAoCb,MAAMc,YAAY,GAAG,CAACC,OAAe,EAAEC,IAAI,GAAG,KAAK,GAAK;IAC7D,MAAMC,MAAM,GAAGD,IAAI,GAAG,KAAK,GAAG,GAAG;IACjC,OACEC,MAAM,GAAGjB,OAAO,CAACe,OAAO,CAAC,CAACG,QAAQ,CAAC,EAAE,CAAC,GAAGH,OAAO,CAACZ,MAAM,CAACe,QAAQ,CAAC,EAAE,CAAC,GAAG,GAAG,CAC3E;CACF;QALYJ,YAAY,GAAZA,YAAY"}
|
||||
11
kitabcitab/node_modules/next/dist/server/lib/find-page-file.d.ts
generated
vendored
Normal file
11
kitabcitab/node_modules/next/dist/server/lib/find-page-file.d.ts
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
/**
|
||||
* Finds a page file with the given parameters. If the page is duplicated with
|
||||
* multiple extensions it will throw, otherwise it will return the *relative*
|
||||
* path to the page file or null if it is not found.
|
||||
*
|
||||
* @param pagesDir Absolute path to the pages folder with trailing `/pages`.
|
||||
* @param normalizedPagePath The page normalized (it will be denormalized).
|
||||
* @param pageExtensions Array of page extensions.
|
||||
*/
|
||||
export declare function findPageFile(pagesDir: string, normalizedPagePath: string, pageExtensions: string[], isAppDir: boolean): Promise<string | null>;
|
||||
export declare function isLayoutsLeafPage(filePath: string, pageExtensions: string[]): boolean;
|
||||
49
kitabcitab/node_modules/next/dist/server/lib/find-page-file.js
generated
vendored
Normal file
49
kitabcitab/node_modules/next/dist/server/lib/find-page-file.js
generated
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.findPageFile = findPageFile;
|
||||
exports.isLayoutsLeafPage = isLayoutsLeafPage;
|
||||
var _fileExists = require("../../lib/file-exists");
|
||||
var _getPagePaths = require("../../shared/lib/page-path/get-page-paths");
|
||||
var _nonNullable = require("../../lib/non-nullable");
|
||||
var _path = require("path");
|
||||
var _fs = require("fs");
|
||||
var _log = require("../../build/output/log");
|
||||
var _chalk = _interopRequireDefault(require("../../lib/chalk"));
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {
|
||||
default: obj
|
||||
};
|
||||
}
|
||||
async function isTrueCasePagePath(pagePath, pagesDir) {
|
||||
const pageSegments = (0, _path).normalize(pagePath).split(_path.sep).filter(Boolean);
|
||||
const segmentExistsPromises = pageSegments.map(async (segment, i)=>{
|
||||
const segmentParentDir = (0, _path).join(pagesDir, ...pageSegments.slice(0, i));
|
||||
const parentDirEntries = await _fs.promises.readdir(segmentParentDir);
|
||||
return parentDirEntries.includes(segment);
|
||||
});
|
||||
return (await Promise.all(segmentExistsPromises)).every(Boolean);
|
||||
}
|
||||
async function findPageFile(pagesDir, normalizedPagePath, pageExtensions, isAppDir) {
|
||||
const pagePaths = (0, _getPagePaths).getPagePaths(normalizedPagePath, pageExtensions, isAppDir);
|
||||
const [existingPath, ...others] = (await Promise.all(pagePaths.map(async (path)=>{
|
||||
const filePath = (0, _path).join(pagesDir, path);
|
||||
return await (0, _fileExists).fileExists(filePath) ? path : null;
|
||||
}))).filter(_nonNullable.nonNullable);
|
||||
if (!existingPath) {
|
||||
return null;
|
||||
}
|
||||
if (!await isTrueCasePagePath(existingPath, pagesDir)) {
|
||||
return null;
|
||||
}
|
||||
if (others.length > 0) {
|
||||
(0, _log).warn(`Duplicate page detected. ${_chalk.default.cyan((0, _path).join("pages", existingPath))} and ${_chalk.default.cyan((0, _path).join("pages", others[0]))} both resolve to ${_chalk.default.cyan(normalizedPagePath)}.`);
|
||||
}
|
||||
return existingPath;
|
||||
}
|
||||
function isLayoutsLeafPage(filePath, pageExtensions) {
|
||||
return new RegExp(`(^page|[\\\\/]page)\\.(?:${pageExtensions.join("|")})$`).test(filePath);
|
||||
}
|
||||
|
||||
//# sourceMappingURL=find-page-file.js.map
|
||||
1
kitabcitab/node_modules/next/dist/server/lib/find-page-file.js.map
generated
vendored
Normal file
1
kitabcitab/node_modules/next/dist/server/lib/find-page-file.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../server/lib/find-page-file.ts"],"names":["findPageFile","isLayoutsLeafPage","isTrueCasePagePath","pagePath","pagesDir","pageSegments","normalize","split","sep","filter","Boolean","segmentExistsPromises","map","segment","i","segmentParentDir","join","slice","parentDirEntries","promises","readdir","includes","Promise","all","every","normalizedPagePath","pageExtensions","isAppDir","pagePaths","getPagePaths","existingPath","others","path","filePath","fileExists","nonNullable","length","warn","chalk","cyan","RegExp","test"],"mappings":"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"}
|
||||
9
kitabcitab/node_modules/next/dist/server/lib/incremental-cache/fetch-cache.d.ts
generated
vendored
Normal file
9
kitabcitab/node_modules/next/dist/server/lib/incremental-cache/fetch-cache.d.ts
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
import type { CacheHandler, CacheHandlerContext, CacheHandlerValue } from './';
|
||||
export default class FetchCache implements CacheHandler {
|
||||
private headers;
|
||||
private cacheEndpoint;
|
||||
private debug;
|
||||
constructor(ctx: CacheHandlerContext);
|
||||
get(key: string, fetchCache?: boolean): Promise<CacheHandlerValue | null>;
|
||||
set(key: string, data: CacheHandlerValue['value'], fetchCache?: boolean): Promise<void>;
|
||||
}
|
||||
134
kitabcitab/node_modules/next/dist/server/lib/incremental-cache/fetch-cache.js
generated
vendored
Normal file
134
kitabcitab/node_modules/next/dist/server/lib/incremental-cache/fetch-cache.js
generated
vendored
Normal file
@@ -0,0 +1,134 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
var _lruCache = _interopRequireDefault(require("next/dist/compiled/lru-cache"));
|
||||
var _appRouterHeaders = require("../../../client/components/app-router-headers");
|
||||
class FetchCache {
|
||||
constructor(ctx){
|
||||
if (ctx.maxMemoryCacheSize && !memoryCache) {
|
||||
memoryCache = new _lruCache.default({
|
||||
max: ctx.maxMemoryCacheSize,
|
||||
length ({ value }) {
|
||||
var ref;
|
||||
if (!value) {
|
||||
return 25;
|
||||
} else if (value.kind === "REDIRECT") {
|
||||
return JSON.stringify(value.props).length;
|
||||
} else if (value.kind === "IMAGE") {
|
||||
throw new Error("invariant image should not be incremental-cache");
|
||||
} else if (value.kind === "FETCH") {
|
||||
return JSON.stringify(value.data || "").length;
|
||||
}
|
||||
// rough estimate of size of cache value
|
||||
return value.html.length + (((ref = JSON.stringify(value.pageData)) == null ? void 0 : ref.length) || 0);
|
||||
}
|
||||
});
|
||||
}
|
||||
this.debug = !!process.env.NEXT_PRIVATE_DEBUG_CACHE;
|
||||
this.headers = {};
|
||||
this.headers["Content-Type"] = "application/json";
|
||||
if (_appRouterHeaders.FETCH_CACHE_HEADER in ctx._requestHeaders) {
|
||||
const newHeaders = JSON.parse(ctx._requestHeaders[_appRouterHeaders.FETCH_CACHE_HEADER]);
|
||||
for(const k in newHeaders){
|
||||
this.headers[k] = newHeaders[k];
|
||||
}
|
||||
}
|
||||
this.cacheEndpoint = `https://${ctx._requestHeaders["x-vercel-sc-host"]}${ctx._requestHeaders["x-vercel-sc-basepath"] || ""}`;
|
||||
if (this.debug) {
|
||||
console.log("using cache endpoint", this.cacheEndpoint);
|
||||
}
|
||||
}
|
||||
async get(key, fetchCache) {
|
||||
if (!fetchCache) return null;
|
||||
let data = memoryCache == null ? void 0 : memoryCache.get(key);
|
||||
// get data from fetch cache
|
||||
if (!data) {
|
||||
try {
|
||||
const start = Date.now();
|
||||
const res = await fetch(`${this.cacheEndpoint}/v1/suspense-cache/getItems`, {
|
||||
method: "POST",
|
||||
body: JSON.stringify([
|
||||
key
|
||||
]),
|
||||
headers: this.headers
|
||||
});
|
||||
if (!res.ok) {
|
||||
console.error(await res.text());
|
||||
throw new Error(`invalid response from cache ${res.status}`);
|
||||
}
|
||||
const items = await res.json();
|
||||
const item = items[key];
|
||||
if (!item || !item.value) {
|
||||
console.log({
|
||||
item
|
||||
});
|
||||
throw new Error(`invalid item returned`);
|
||||
}
|
||||
const cached = JSON.parse(item.value);
|
||||
if (!cached || cached.kind !== "FETCH") {
|
||||
this.debug && console.log({
|
||||
cached
|
||||
});
|
||||
throw new Error(`invalid cache value`);
|
||||
}
|
||||
data = {
|
||||
lastModified: Date.now() - item.age * 1000,
|
||||
value: cached
|
||||
};
|
||||
if (this.debug) {
|
||||
console.log("got fetch cache entry duration:", Date.now() - start, data);
|
||||
}
|
||||
if (data) {
|
||||
memoryCache == null ? void 0 : memoryCache.set(key, data);
|
||||
}
|
||||
} catch (err) {
|
||||
// unable to get data from fetch-cache
|
||||
console.error(`Failed to get from fetch-cache`, err);
|
||||
}
|
||||
}
|
||||
return data || null;
|
||||
}
|
||||
async set(key, data, fetchCache) {
|
||||
if (!fetchCache) return;
|
||||
memoryCache == null ? void 0 : memoryCache.set(key, {
|
||||
value: data,
|
||||
lastModified: Date.now()
|
||||
});
|
||||
try {
|
||||
const start = Date.now();
|
||||
const body = JSON.stringify([
|
||||
{
|
||||
id: key,
|
||||
value: JSON.stringify(data)
|
||||
},
|
||||
]);
|
||||
const res = await fetch(`${this.cacheEndpoint}/v1/suspense-cache/setItems`, {
|
||||
method: "POST",
|
||||
headers: this.headers,
|
||||
body: body
|
||||
});
|
||||
if (!res.ok) {
|
||||
this.debug && console.log(await res.text());
|
||||
throw new Error(`invalid response ${res.status}`);
|
||||
}
|
||||
if (this.debug) {
|
||||
console.log("successfully set to fetch-cache duration:", Date.now() - start, body);
|
||||
}
|
||||
} catch (err) {
|
||||
// unable to set to fetch-cache
|
||||
console.error(`Failed to update fetch cache`, err);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
exports.default = FetchCache;
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {
|
||||
default: obj
|
||||
};
|
||||
}
|
||||
let memoryCache;
|
||||
|
||||
//# sourceMappingURL=fetch-cache.js.map
|
||||
1
kitabcitab/node_modules/next/dist/server/lib/incremental-cache/fetch-cache.js.map
generated
vendored
Normal file
1
kitabcitab/node_modules/next/dist/server/lib/incremental-cache/fetch-cache.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
11
kitabcitab/node_modules/next/dist/server/lib/incremental-cache/file-system-cache.d.ts
generated
vendored
Normal file
11
kitabcitab/node_modules/next/dist/server/lib/incremental-cache/file-system-cache.d.ts
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
import type { CacheHandler, CacheHandlerContext, CacheHandlerValue } from './';
|
||||
export default class FileSystemCache implements CacheHandler {
|
||||
private fs;
|
||||
private flushToDisk?;
|
||||
private serverDistDir;
|
||||
private appDir;
|
||||
constructor(ctx: CacheHandlerContext);
|
||||
get(key: string, fetchCache?: boolean): Promise<CacheHandlerValue | null>;
|
||||
set(key: string, data: CacheHandlerValue['value']): Promise<void>;
|
||||
private getFsPath;
|
||||
}
|
||||
141
kitabcitab/node_modules/next/dist/server/lib/incremental-cache/file-system-cache.js
generated
vendored
Normal file
141
kitabcitab/node_modules/next/dist/server/lib/incremental-cache/file-system-cache.js
generated
vendored
Normal file
@@ -0,0 +1,141 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
var _lruCache = _interopRequireDefault(require("next/dist/compiled/lru-cache"));
|
||||
var _path = _interopRequireDefault(require("../../../shared/lib/isomorphic/path"));
|
||||
class FileSystemCache {
|
||||
constructor(ctx){
|
||||
this.fs = ctx.fs;
|
||||
this.flushToDisk = ctx.flushToDisk;
|
||||
this.serverDistDir = ctx.serverDistDir;
|
||||
this.appDir = !!ctx._appDir;
|
||||
if (ctx.maxMemoryCacheSize && !memoryCache) {
|
||||
memoryCache = new _lruCache.default({
|
||||
max: ctx.maxMemoryCacheSize,
|
||||
length ({ value }) {
|
||||
var ref;
|
||||
if (!value) {
|
||||
return 25;
|
||||
} else if (value.kind === "REDIRECT") {
|
||||
return JSON.stringify(value.props).length;
|
||||
} else if (value.kind === "IMAGE") {
|
||||
throw new Error("invariant image should not be incremental-cache");
|
||||
} else if (value.kind === "FETCH") {
|
||||
return JSON.stringify(value.data || "").length;
|
||||
}
|
||||
// rough estimate of size of cache value
|
||||
return value.html.length + (((ref = JSON.stringify(value.pageData)) == null ? void 0 : ref.length) || 0);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
async get(key, fetchCache) {
|
||||
let data = memoryCache == null ? void 0 : memoryCache.get(key);
|
||||
// let's check the disk for seed data
|
||||
if (!data) {
|
||||
try {
|
||||
const { filePath , isAppPath } = await this.getFsPath({
|
||||
pathname: fetchCache ? key : `${key}.html`,
|
||||
fetchCache
|
||||
});
|
||||
const fileData = await this.fs.readFile(filePath);
|
||||
const { mtime } = await this.fs.stat(filePath);
|
||||
if (fetchCache) {
|
||||
const lastModified = mtime.getTime();
|
||||
data = {
|
||||
lastModified,
|
||||
value: JSON.parse(fileData)
|
||||
};
|
||||
} else {
|
||||
const pageData = isAppPath ? await this.fs.readFile((await this.getFsPath({
|
||||
pathname: `${key}.rsc`,
|
||||
appDir: true
|
||||
})).filePath) : JSON.parse(await this.fs.readFile(await (await this.getFsPath({
|
||||
pathname: `${key}.json`,
|
||||
appDir: false
|
||||
})).filePath));
|
||||
data = {
|
||||
lastModified: mtime.getTime(),
|
||||
value: {
|
||||
kind: "PAGE",
|
||||
html: fileData,
|
||||
pageData
|
||||
}
|
||||
};
|
||||
}
|
||||
if (data) {
|
||||
memoryCache == null ? void 0 : memoryCache.set(key, data);
|
||||
}
|
||||
} catch (_) {
|
||||
// unable to get data from disk
|
||||
}
|
||||
}
|
||||
return data || null;
|
||||
}
|
||||
async set(key, data) {
|
||||
memoryCache == null ? void 0 : memoryCache.set(key, {
|
||||
value: data,
|
||||
lastModified: Date.now()
|
||||
});
|
||||
if (!this.flushToDisk) return;
|
||||
if ((data == null ? void 0 : data.kind) === "PAGE") {
|
||||
const isAppPath = typeof data.pageData === "string";
|
||||
const { filePath: htmlPath } = await this.getFsPath({
|
||||
pathname: `${key}.html`,
|
||||
appDir: isAppPath
|
||||
});
|
||||
await this.fs.mkdir(_path.default.dirname(htmlPath));
|
||||
await this.fs.writeFile(htmlPath, data.html);
|
||||
await this.fs.writeFile((await this.getFsPath({
|
||||
pathname: `${key}.${isAppPath ? "rsc" : "json"}`,
|
||||
appDir: isAppPath
|
||||
})).filePath, isAppPath ? data.pageData : JSON.stringify(data.pageData));
|
||||
} else if ((data == null ? void 0 : data.kind) === "FETCH") {
|
||||
const { filePath } = await this.getFsPath({
|
||||
pathname: key,
|
||||
fetchCache: true
|
||||
});
|
||||
await this.fs.mkdir(_path.default.dirname(filePath));
|
||||
await this.fs.writeFile(filePath, JSON.stringify(data));
|
||||
}
|
||||
}
|
||||
async getFsPath({ pathname , appDir , fetchCache }) {
|
||||
if (fetchCache) {
|
||||
// we store in .next/cache/fetch-cache so it can be persisted
|
||||
// across deploys
|
||||
return {
|
||||
filePath: _path.default.join(this.serverDistDir, "..", "cache", "fetch-cache", pathname),
|
||||
isAppPath: false
|
||||
};
|
||||
}
|
||||
let isAppPath = false;
|
||||
let filePath = _path.default.join(this.serverDistDir, "pages", pathname);
|
||||
if (!this.appDir || appDir === false) return {
|
||||
filePath,
|
||||
isAppPath
|
||||
};
|
||||
try {
|
||||
await this.fs.readFile(filePath);
|
||||
return {
|
||||
filePath,
|
||||
isAppPath
|
||||
};
|
||||
} catch (err) {
|
||||
return {
|
||||
filePath: _path.default.join(this.serverDistDir, "app", pathname),
|
||||
isAppPath: true
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
exports.default = FileSystemCache;
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {
|
||||
default: obj
|
||||
};
|
||||
}
|
||||
let memoryCache;
|
||||
|
||||
//# sourceMappingURL=file-system-cache.js.map
|
||||
1
kitabcitab/node_modules/next/dist/server/lib/incremental-cache/file-system-cache.js.map
generated
vendored
Normal file
1
kitabcitab/node_modules/next/dist/server/lib/incremental-cache/file-system-cache.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
46
kitabcitab/node_modules/next/dist/server/lib/incremental-cache/index.d.ts
generated
vendored
Normal file
46
kitabcitab/node_modules/next/dist/server/lib/incremental-cache/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
import type { CacheFs } from '../../../shared/lib/utils';
|
||||
import { PrerenderManifest } from '../../../build';
|
||||
import { IncrementalCacheValue, IncrementalCacheEntry } from '../../response-cache';
|
||||
export interface CacheHandlerContext {
|
||||
fs: CacheFs;
|
||||
dev?: boolean;
|
||||
flushToDisk?: boolean;
|
||||
serverDistDir: string;
|
||||
maxMemoryCacheSize?: number;
|
||||
_appDir: boolean;
|
||||
_requestHeaders: IncrementalCache['requestHeaders'];
|
||||
}
|
||||
export interface CacheHandlerValue {
|
||||
lastModified?: number;
|
||||
value: IncrementalCacheValue | null;
|
||||
}
|
||||
export declare class CacheHandler {
|
||||
constructor(_ctx: CacheHandlerContext);
|
||||
get(_key: string, _fetchCache?: boolean): Promise<CacheHandlerValue | null>;
|
||||
set(_key: string, _data: IncrementalCacheValue | null, _fetchCache?: boolean): Promise<void>;
|
||||
}
|
||||
export declare class IncrementalCache {
|
||||
dev?: boolean;
|
||||
cacheHandler: CacheHandler;
|
||||
prerenderManifest: PrerenderManifest;
|
||||
requestHeaders: Record<string, undefined | string | string[]>;
|
||||
minimalMode?: boolean;
|
||||
constructor({ fs, dev, appDir, flushToDisk, fetchCache, minimalMode, serverDistDir, requestHeaders, maxMemoryCacheSize, getPrerenderManifest, incrementalCacheHandlerPath, }: {
|
||||
fs: CacheFs;
|
||||
dev: boolean;
|
||||
appDir?: boolean;
|
||||
fetchCache?: boolean;
|
||||
minimalMode?: boolean;
|
||||
serverDistDir: string;
|
||||
flushToDisk?: boolean;
|
||||
requestHeaders: IncrementalCache['requestHeaders'];
|
||||
maxMemoryCacheSize?: number;
|
||||
incrementalCacheHandlerPath?: string;
|
||||
getPrerenderManifest: () => PrerenderManifest;
|
||||
});
|
||||
private calculateRevalidate;
|
||||
_getPathname(pathname: string, fetchCache?: boolean): string;
|
||||
fetchCacheKey(url: string, init?: RequestInit): Promise<string>;
|
||||
get(pathname: string, fetchCache?: boolean): Promise<IncrementalCacheEntry | null>;
|
||||
set(pathname: string, data: IncrementalCacheValue | null, revalidateSeconds?: number | false, fetchCache?: boolean): Promise<void>;
|
||||
}
|
||||
172
kitabcitab/node_modules/next/dist/server/lib/incremental-cache/index.js
generated
vendored
Normal file
172
kitabcitab/node_modules/next/dist/server/lib/incremental-cache/index.js
generated
vendored
Normal file
@@ -0,0 +1,172 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
var _fileSystemCache = _interopRequireDefault(require("./file-system-cache"));
|
||||
var _path = _interopRequireDefault(require("../../../shared/lib/isomorphic/path"));
|
||||
var _normalizePagePath = require("../../../shared/lib/page-path/normalize-page-path");
|
||||
var _fetchCache = _interopRequireDefault(require("./fetch-cache"));
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {
|
||||
default: obj
|
||||
};
|
||||
}
|
||||
function toRoute(pathname) {
|
||||
return pathname.replace(/\/$/, "").replace(/\/index$/, "") || "/";
|
||||
}
|
||||
class CacheHandler {
|
||||
// eslint-disable-next-line
|
||||
constructor(_ctx){}
|
||||
async get(_key, _fetchCache) {
|
||||
return {};
|
||||
}
|
||||
async set(_key, _data, _fetchCache) {}
|
||||
}
|
||||
exports.CacheHandler = CacheHandler;
|
||||
class IncrementalCache {
|
||||
constructor({ fs , dev , appDir , flushToDisk , fetchCache , minimalMode , serverDistDir , requestHeaders , maxMemoryCacheSize , getPrerenderManifest , incrementalCacheHandlerPath }){
|
||||
let cacheHandlerMod = _fileSystemCache.default;
|
||||
if (process.env.NEXT_RUNTIME !== "edge" && incrementalCacheHandlerPath) {
|
||||
cacheHandlerMod = require(incrementalCacheHandlerPath);
|
||||
cacheHandlerMod = cacheHandlerMod.default || cacheHandlerMod;
|
||||
}
|
||||
if (minimalMode && fetchCache) {
|
||||
cacheHandlerMod = _fetchCache.default;
|
||||
}
|
||||
if (process.env.__NEXT_TEST_MAX_ISR_CACHE) {
|
||||
// Allow cache size to be overridden for testing purposes
|
||||
maxMemoryCacheSize = parseInt(process.env.__NEXT_TEST_MAX_ISR_CACHE, 10);
|
||||
}
|
||||
this.dev = dev;
|
||||
this.minimalMode = minimalMode;
|
||||
this.requestHeaders = requestHeaders;
|
||||
this.prerenderManifest = getPrerenderManifest();
|
||||
this.cacheHandler = new cacheHandlerMod({
|
||||
dev,
|
||||
fs,
|
||||
flushToDisk,
|
||||
serverDistDir,
|
||||
maxMemoryCacheSize,
|
||||
_appDir: !!appDir,
|
||||
_requestHeaders: requestHeaders
|
||||
});
|
||||
}
|
||||
calculateRevalidate(pathname, fromTime) {
|
||||
// in development we don't have a prerender-manifest
|
||||
// and default to always revalidating to allow easier debugging
|
||||
if (this.dev) return new Date().getTime() - 1000;
|
||||
// if an entry isn't present in routes we fallback to a default
|
||||
// of revalidating after 1 second
|
||||
const { initialRevalidateSeconds } = this.prerenderManifest.routes[toRoute(pathname)] || {
|
||||
initialRevalidateSeconds: 1
|
||||
};
|
||||
const revalidateAfter = typeof initialRevalidateSeconds === "number" ? initialRevalidateSeconds * 1000 + fromTime : initialRevalidateSeconds;
|
||||
return revalidateAfter;
|
||||
}
|
||||
_getPathname(pathname, fetchCache) {
|
||||
return fetchCache ? pathname : (0, _normalizePagePath).normalizePagePath(pathname);
|
||||
}
|
||||
// x-ref: https://github.com/facebook/react/blob/2655c9354d8e1c54ba888444220f63e836925caa/packages/react/src/ReactFetch.js#L23
|
||||
async fetchCacheKey(url, init = {}) {
|
||||
const cacheString = JSON.stringify([
|
||||
url,
|
||||
init.method,
|
||||
init.headers,
|
||||
init.mode,
|
||||
init.redirect,
|
||||
init.credentials,
|
||||
init.referrer,
|
||||
init.referrerPolicy,
|
||||
init.integrity,
|
||||
init.next,
|
||||
init.cache,
|
||||
]);
|
||||
let cacheKey;
|
||||
if (process.env.NEXT_RUNTIME === "edge") {
|
||||
function bufferToHex(buffer) {
|
||||
return Array.prototype.map.call(new Uint8Array(buffer), (b)=>b.toString(16).padStart(2, "0")).join("");
|
||||
}
|
||||
const buffer1 = new TextEncoder().encode(cacheString);
|
||||
cacheKey = bufferToHex(await crypto.subtle.digest("SHA-256", buffer1));
|
||||
} else {
|
||||
const crypto = require("crypto");
|
||||
cacheKey = crypto.createHash("sha256").update(cacheString).digest("hex");
|
||||
}
|
||||
return cacheKey;
|
||||
}
|
||||
// get data from cache if available
|
||||
async get(pathname, fetchCache) {
|
||||
var ref, ref1;
|
||||
// we don't leverage the prerender cache in dev mode
|
||||
// so that getStaticProps is always called for easier debugging
|
||||
if (this.dev) return null;
|
||||
pathname = this._getPathname(pathname, fetchCache);
|
||||
let entry = null;
|
||||
const cacheData = await this.cacheHandler.get(pathname, fetchCache);
|
||||
if ((cacheData == null ? void 0 : (ref = cacheData.value) == null ? void 0 : ref.kind) === "FETCH") {
|
||||
const data = cacheData.value.data;
|
||||
const age = Math.round((Date.now() - (cacheData.lastModified || 0)) / 1000);
|
||||
const revalidate = cacheData.value.revalidate;
|
||||
return {
|
||||
isStale: age > revalidate,
|
||||
value: {
|
||||
kind: "FETCH",
|
||||
data,
|
||||
age,
|
||||
revalidate,
|
||||
isStale: age > revalidate
|
||||
},
|
||||
revalidateAfter: (cacheData.lastModified || Date.now()) + revalidate * 1000
|
||||
};
|
||||
}
|
||||
const curRevalidate = (ref1 = this.prerenderManifest.routes[toRoute(pathname)]) == null ? void 0 : ref1.initialRevalidateSeconds;
|
||||
const revalidateAfter = this.calculateRevalidate(pathname, (cacheData == null ? void 0 : cacheData.lastModified) || Date.now());
|
||||
const isStale = revalidateAfter !== false && revalidateAfter < Date.now() ? true : undefined;
|
||||
if (cacheData) {
|
||||
entry = {
|
||||
isStale,
|
||||
curRevalidate,
|
||||
revalidateAfter,
|
||||
value: cacheData.value
|
||||
};
|
||||
}
|
||||
if (!cacheData && this.prerenderManifest.notFoundRoutes.includes(pathname)) {
|
||||
// for the first hit after starting the server the cache
|
||||
// may not have a way to save notFound: true so if
|
||||
// the prerender-manifest marks this as notFound then we
|
||||
// return that entry and trigger a cache set to give it a
|
||||
// chance to update in-memory entries
|
||||
entry = {
|
||||
isStale,
|
||||
value: null,
|
||||
curRevalidate,
|
||||
revalidateAfter
|
||||
};
|
||||
this.set(pathname, entry.value, curRevalidate, fetchCache);
|
||||
}
|
||||
return entry;
|
||||
}
|
||||
// populate the incremental cache with new data
|
||||
async set(pathname, data, revalidateSeconds, fetchCache) {
|
||||
if (this.dev) return;
|
||||
pathname = this._getPathname(pathname, fetchCache);
|
||||
try {
|
||||
// we use the prerender manifest memory instance
|
||||
// to store revalidate timings for calculating
|
||||
// revalidateAfter values so we update this on set
|
||||
if (typeof revalidateSeconds !== "undefined" && !fetchCache) {
|
||||
this.prerenderManifest.routes[pathname] = {
|
||||
dataRoute: _path.default.posix.join("/_next/data", `${(0, _normalizePagePath).normalizePagePath(pathname)}.json`),
|
||||
srcRoute: null,
|
||||
initialRevalidateSeconds: revalidateSeconds
|
||||
};
|
||||
}
|
||||
await this.cacheHandler.set(pathname, data, fetchCache);
|
||||
} catch (error) {
|
||||
console.warn("Failed to update prerender cache for", pathname, error);
|
||||
}
|
||||
}
|
||||
}
|
||||
exports.IncrementalCache = IncrementalCache;
|
||||
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
kitabcitab/node_modules/next/dist/server/lib/incremental-cache/index.js.map
generated
vendored
Normal file
1
kitabcitab/node_modules/next/dist/server/lib/incremental-cache/index.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user