create project
This commit is contained in:
110
kitabcitab/node_modules/next/dist/esm/server/accept-header.js
generated
vendored
Normal file
110
kitabcitab/node_modules/next/dist/esm/server/accept-header.js
generated
vendored
Normal file
@@ -0,0 +1,110 @@
|
||||
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;
|
||||
}
|
||||
export 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/esm/server/accept-header.js.map
generated
vendored
Normal file
1
kitabcitab/node_modules/next/dist/esm/server/accept-header.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../server/accept-header.ts"],"names":["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","acceptLanguage"],"mappings":"AAYA,SAASA,KAAK,CACZC,GAAW,EACXC,WAAiC,EACjCC,OAAgB,EAChB;IACA,MAAMC,MAAM,GAAG,IAAIC,GAAG,EAAyC;IAC/D,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GAAGqB,UAAS,CAACpB,WAAW,EAAE;YACrC,IAAIP,MAAM,CAACiB,GAAG,CAACX,KAAK,CAAC,EAAE;gBACrBsC,SAAS,CAACN,IAAI,CAACtC,MAAM,CAAC8B,GAAG,CAACxB,KAAK,CAAC,CAAEG,IAAI,CAAC;aACxC;SACF;KACF;IAED,OAAOmC,SAAS,CAAA;CACjB;AAED,OAAO,SAASC,cAAc,CAAC3C,MAAM,GAAG,EAAE,EAAEJ,WAAsB,EAAE;IAClE,OACEF,KAAK,CAACM,MAAM,EAAEJ,WAAW,EAAE;QACzB2B,IAAI,EAAE,iBAAiB;QACvBf,WAAW,EAAE,IAAI;KAClB,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CACZ;CACF"}
|
||||
150
kitabcitab/node_modules/next/dist/esm/server/api-utils/index.js
generated
vendored
Normal file
150
kitabcitab/node_modules/next/dist/esm/server/api-utils/index.js
generated
vendored
Normal file
@@ -0,0 +1,150 @@
|
||||
/**
|
||||
* Parse cookies from the `headers` of request
|
||||
* @param req request object
|
||||
*/ export 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);
|
||||
};
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param res response object
|
||||
* @param statusCode `HTTP` status code of response
|
||||
*/ export function sendStatusCode(res, statusCode) {
|
||||
res.statusCode = statusCode;
|
||||
return res;
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param res response object
|
||||
* @param [statusOrUrl] `HTTP` status code of redirect
|
||||
* @param url URL of redirect
|
||||
*/ export 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;
|
||||
}
|
||||
export const PRERENDER_REVALIDATE_HEADER = "x-prerender-revalidate";
|
||||
export const PRERENDER_REVALIDATE_ONLY_GENERATED_HEADER = "x-prerender-revalidate-if-generated";
|
||||
export function checkIsManualRevalidate(req, previewProps) {
|
||||
return {
|
||||
isManualRevalidate: req.headers[PRERENDER_REVALIDATE_HEADER] === previewProps.previewModeId,
|
||||
revalidateOnlyGenerated: !!req.headers[PRERENDER_REVALIDATE_ONLY_GENERATED_HEADER]
|
||||
};
|
||||
}
|
||||
export const COOKIE_NAME_PRERENDER_BYPASS = `__prerender_bypass`;
|
||||
export const COOKIE_NAME_PRERENDER_DATA = `__next_preview_data`;
|
||||
export const RESPONSE_LIMIT_DEFAULT = 4 * 1024 * 1024;
|
||||
export const SYMBOL_PREVIEW_DATA = Symbol(COOKIE_NAME_PRERENDER_DATA);
|
||||
export const SYMBOL_CLEARED_COOKIES = Symbol(COOKIE_NAME_PRERENDER_BYPASS);
|
||||
export 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;
|
||||
}
|
||||
/**
|
||||
* Custom error class
|
||||
*/ export class ApiError extends Error {
|
||||
constructor(statusCode, message){
|
||||
super(message);
|
||||
this.statusCode = statusCode;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Sends error in `response`
|
||||
* @param res response object
|
||||
* @param statusCode of response
|
||||
* @param message of response
|
||||
*/ export function sendError(res, statusCode, message) {
|
||||
res.statusCode = statusCode;
|
||||
res.statusMessage = message;
|
||||
res.end(message);
|
||||
}
|
||||
/**
|
||||
* 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 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/esm/server/api-utils/index.js.map
generated
vendored
Normal file
1
kitabcitab/node_modules/next/dist/esm/server/api-utils/index.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../server/api-utils/index.ts"],"names":["getCookieParser","headers","parseCookie","header","cookie","parse","parseCookieFn","require","Array","isArray","join","sendStatusCode","res","statusCode","redirect","statusOrUrl","url","Error","writeHead","Location","write","end","PRERENDER_REVALIDATE_HEADER","PRERENDER_REVALIDATE_ONLY_GENERATED_HEADER","checkIsManualRevalidate","req","previewProps","isManualRevalidate","previewModeId","revalidateOnlyGenerated","COOKIE_NAME_PRERENDER_BYPASS","COOKIE_NAME_PRERENDER_DATA","RESPONSE_LIMIT_DEFAULT","SYMBOL_PREVIEW_DATA","Symbol","SYMBOL_CLEARED_COOKIES","clearPreviewData","options","serialize","previous","getHeader","setHeader","expires","Date","httpOnly","sameSite","process","env","NODE_ENV","secure","path","undefined","Object","defineProperty","value","enumerable","ApiError","constructor","message","sendError","statusMessage","setLazyProp","prop","getter","opts","configurable","optsReset","writable","get","set"],"mappings":"AAeA;;;GAGG,CACH,OAAO,SAASA,eAAe,CAACC,OAE/B,EAA+B;IAC9B,OAAO,SAASC,WAAW,GAA0B;QACnD,MAAMC,MAAM,GAAkCF,OAAO,CAACG,MAAM;QAE5D,IAAI,CAACD,MAAM,EAAE;YACX,OAAO,EAAE,CAAA;SACV;QAED,MAAM,EAAEE,KAAK,EAAEC,aAAa,CAAA,EAAE,GAAGC,OAAO,CAAC,2BAA2B,CAAC;QACrE,OAAOD,aAAa,CAACE,KAAK,CAACC,OAAO,CAACN,MAAM,CAAC,GAAGA,MAAM,CAACO,IAAI,CAAC,GAAG,CAAC,GAAG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E,IAAI;QACPI,GAAG,EAAE,IAAM;YACT,MAAMd,KAAK,GAAGS,MAAM,EAAE;YACtB,8DAA8D;YAC9DX,MAAM,CAACC,cAAc,CAAC5B,GAAG,EAAEqC,IAAI,EAAE;gBAAE,GAAGI,SAAS;gBAAEZ,KAAK;aAAE,CAAC;YACzD,OAAOA,KAAK,CAAA;SACb;QACDe,GAAG,EAAE,CAACf,KAAK,GAAK;YACdF,MAAM,CAACC,cAAc,CAAC5B,GAAG,EAAEqC,IAAI,EAAE;gBAAE,GAAGI,SAAS;gBAAEZ,KAAK;aAAE,CAAC;SAC1D;KACF,CAAC;CACH"}
|
||||
377
kitabcitab/node_modules/next/dist/esm/server/api-utils/node.js
generated
vendored
Normal file
377
kitabcitab/node_modules/next/dist/esm/server/api-utils/node.js
generated
vendored
Normal file
@@ -0,0 +1,377 @@
|
||||
import { checkIsManualRevalidate, PRERENDER_REVALIDATE_ONLY_GENERATED_HEADER } from ".";
|
||||
import bytes from "next/dist/compiled/bytes";
|
||||
import { generateETag } from "../lib/etag";
|
||||
import { sendEtagResponse } from "../send-payload";
|
||||
import { Stream } from "stream";
|
||||
import { parse } from "next/dist/compiled/content-type";
|
||||
import isError from "../../lib/is-error";
|
||||
import { isResSent } from "../../shared/lib/utils";
|
||||
import { interopDefault } from "../../lib/interop-default";
|
||||
import { getCookieParser, setLazyProp, sendStatusCode, redirect, clearPreviewData, sendError, ApiError, PRERENDER_REVALIDATE_HEADER, COOKIE_NAME_PRERENDER_BYPASS, COOKIE_NAME_PRERENDER_DATA, SYMBOL_PREVIEW_DATA, RESPONSE_LIMIT_DEFAULT } from "./index";
|
||||
import { mockRequest } from "../lib/mock-request";
|
||||
export function tryGetPreviewData(req, res, options) {
|
||||
// if an On-Demand revalidation is being done preview mode
|
||||
// is disabled
|
||||
if (options && checkIsManualRevalidate(req, options).isManualRevalidate) {
|
||||
return false;
|
||||
}
|
||||
// Read cached preview data if present
|
||||
if (SYMBOL_PREVIEW_DATA in req) {
|
||||
return req[SYMBOL_PREVIEW_DATA];
|
||||
}
|
||||
const getCookies = getCookieParser(req.headers);
|
||||
let cookies;
|
||||
try {
|
||||
cookies = getCookies();
|
||||
} catch {
|
||||
// TODO: warn
|
||||
return false;
|
||||
}
|
||||
const hasBypass = COOKIE_NAME_PRERENDER_BYPASS in cookies;
|
||||
const hasData = 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) {
|
||||
clearPreviewData(res);
|
||||
return false;
|
||||
}
|
||||
// Case: preview session is for an old build.
|
||||
if (cookies[COOKIE_NAME_PRERENDER_BYPASS] !== options.previewModeId) {
|
||||
clearPreviewData(res);
|
||||
return false;
|
||||
}
|
||||
const tokenPreviewData = cookies[COOKIE_NAME_PRERENDER_DATA];
|
||||
let encryptedPreviewData;
|
||||
try {
|
||||
const jsonwebtoken = require("next/dist/compiled/jsonwebtoken");
|
||||
encryptedPreviewData = jsonwebtoken.verify(tokenPreviewData, options.previewModeSigningKey);
|
||||
} catch {
|
||||
// TODO: warn
|
||||
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, 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 ApiError(400, "Invalid JSON");
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Parse incoming message like `json` or `urlencoded`
|
||||
* @param req request object
|
||||
*/ export async function parseBody(req, limit) {
|
||||
let contentType;
|
||||
try {
|
||||
contentType = parse(req.headers["content-type"] || "text/plain");
|
||||
} catch {
|
||||
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 (isError(e) && e.type === "entity.too.large") {
|
||||
throw new ApiError(413, `Body exceeded ${limit} limit`);
|
||||
} else {
|
||||
throw new 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.parse(responseLimit);
|
||||
}
|
||||
return 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) {
|
||||
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 = generateETag(stringifiedBody);
|
||||
if (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(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(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 = {
|
||||
[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 , } = 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}: ${isError(err) ? err.message : err}`);
|
||||
}
|
||||
}
|
||||
export 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
|
||||
setLazyProp({
|
||||
req: apiReq
|
||||
}, "cookies", getCookieParser(req.headers));
|
||||
// Parsing query string
|
||||
apiReq.query = query;
|
||||
// Parsing preview data
|
||||
setLazyProp({
|
||||
req: apiReq
|
||||
}, "previewData", ()=>tryGetPreviewData(req, res, apiContext));
|
||||
// Checking if preview mode is enabled
|
||||
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.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)=>sendStatusCode(apiRes, statusCode);
|
||||
apiRes.send = (data)=>sendData(apiReq, apiRes, data);
|
||||
apiRes.json = (data)=>sendJson(apiRes, data);
|
||||
apiRes.redirect = (statusOrUrl, url)=>redirect(apiRes, statusOrUrl, url);
|
||||
apiRes.setPreviewData = (data, options = {})=>setPreviewData(apiRes, data, Object.assign({}, apiContext, options));
|
||||
apiRes.clearPreviewData = (options = {})=>clearPreviewData(apiRes, options);
|
||||
apiRes.revalidate = (urlPath, opts)=>revalidate(urlPath, opts || {}, req, apiContext);
|
||||
const resolver = 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 && !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 ApiError) {
|
||||
sendError(apiRes, err.statusCode, err.message);
|
||||
} else {
|
||||
if (dev) {
|
||||
if (isError(err)) {
|
||||
err.page = page;
|
||||
}
|
||||
throw err;
|
||||
}
|
||||
console.error(err);
|
||||
if (propagateError) {
|
||||
throw err;
|
||||
}
|
||||
sendError(apiRes, 500, "Internal Server Error");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//# sourceMappingURL=node.js.map
|
||||
1
kitabcitab/node_modules/next/dist/esm/server/api-utils/node.js.map
generated
vendored
Normal file
1
kitabcitab/node_modules/next/dist/esm/server/api-utils/node.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
7
kitabcitab/node_modules/next/dist/esm/server/api-utils/web.js
generated
vendored
Normal file
7
kitabcitab/node_modules/next/dist/esm/server/api-utils/web.js
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
// Buffer.byteLength polyfill in the Edge runtime, with only utf8 strings
|
||||
// supported at the moment.
|
||||
export function byteLength(payload) {
|
||||
return new TextEncoder().encode(payload).buffer.byteLength;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=web.js.map
|
||||
1
kitabcitab/node_modules/next/dist/esm/server/api-utils/web.js.map
generated
vendored
Normal file
1
kitabcitab/node_modules/next/dist/esm/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":"AAAA,yEAAyE;AACzE,2BAA2B;AAC3B,OAAO,SAASA,UAAU,CAACC,OAAe,EAAU;IAClD,OAAO,IAAIC,WAAW,EAAE,CAACC,MAAM,CAACF,OAAO,CAAC,CAACG,MAAM,CAACJ,UAAU,CAAA;CAC3D"}
|
||||
1212
kitabcitab/node_modules/next/dist/esm/server/app-render.js
generated
vendored
Normal file
1212
kitabcitab/node_modules/next/dist/esm/server/app-render.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1
kitabcitab/node_modules/next/dist/esm/server/app-render.js.map
generated
vendored
Normal file
1
kitabcitab/node_modules/next/dist/esm/server/app-render.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
32
kitabcitab/node_modules/next/dist/esm/server/base-http/index.js
generated
vendored
Normal file
32
kitabcitab/node_modules/next/dist/esm/server/base-http/index.js
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
import { PERMANENT_REDIRECT_STATUS } from "../../shared/lib/constants";
|
||||
import { getCookieParser } from "../api-utils";
|
||||
export 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 = getCookieParser(this.headers)();
|
||||
}
|
||||
}
|
||||
export 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 === PERMANENT_REDIRECT_STATUS) {
|
||||
this.setHeader("Refresh", `0;url=${destination}`);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
kitabcitab/node_modules/next/dist/esm/server/base-http/index.js.map
generated
vendored
Normal file
1
kitabcitab/node_modules/next/dist/esm/server/base-http/index.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../server/base-http/index.ts"],"names":["PERMANENT_REDIRECT_STATUS","getCookieParser","BaseNextRequest","constructor","method","url","body","cookies","_cookies","headers","BaseNextResponse","destination","redirect","statusCode","setHeader"],"mappings":"AAGA,SAASA,yBAAyB,QAAQ,4BAA4B,CAAA;AACtE,SAASC,eAAe,QAA+B,cAAc,CAAA;AAQrE,OAAO,MAAeC,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,GAAGP,eAAe,CAAC,IAAI,CAACQ,OAAO,CAAC,EAAE,CAAC;KACzD;CACF;AAED,OAAO,MAAeC,gBAAgB;IAKpCP,YAAmBQ,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,KAAKb,yBAAyB,EAAE;YAC5C,IAAI,CAACc,SAAS,CAAC,SAAS,EAAE,CAAC,MAAM,EAAEH,WAAW,CAAC,CAAC,CAAC;SAClD;QACD,OAAO,IAAI,CAAA;KACZ;CACF"}
|
||||
92
kitabcitab/node_modules/next/dist/esm/server/base-http/node.js
generated
vendored
Normal file
92
kitabcitab/node_modules/next/dist/esm/server/base-http/node.js
generated
vendored
Normal file
@@ -0,0 +1,92 @@
|
||||
import { SYMBOL_CLEARED_COOKIES } from "../api-utils";
|
||||
import { parseBody } from "../api-utils/node";
|
||||
import { NEXT_REQUEST_META } from "../request-meta";
|
||||
import { BaseNextRequest, BaseNextResponse } from "./index";
|
||||
let _NEXT_REQUEST_META = NEXT_REQUEST_META;
|
||||
export class NodeNextRequest extends 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[NEXT_REQUEST_META] = this[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 parseBody(this._req, limit);
|
||||
}
|
||||
}
|
||||
export class NodeNextResponse extends BaseNextResponse {
|
||||
get originalResponse() {
|
||||
if (SYMBOL_CLEARED_COOKIES in this) {
|
||||
this._res[SYMBOL_CLEARED_COOKIES] = this[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);
|
||||
}
|
||||
}
|
||||
|
||||
//# sourceMappingURL=node.js.map
|
||||
1
kitabcitab/node_modules/next/dist/esm/server/base-http/node.js.map
generated
vendored
Normal file
1
kitabcitab/node_modules/next/dist/esm/server/base-http/node.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../server/base-http/node.ts"],"names":["SYMBOL_CLEARED_COOKIES","parseBody","NEXT_REQUEST_META","BaseNextRequest","BaseNextResponse","NodeNextRequest","originalRequest","_req","url","cookies","value","constructor","method","toUpperCase","headers","limit","NodeNextResponse","originalResponse","_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":"AAIA,SAAgCA,sBAAsB,QAAQ,cAAc,CAAA;AAC5E,SAASC,SAAS,QAAQ,mBAAmB,CAAA;AAC7C,SAASC,iBAAiB,QAAqB,iBAAiB,CAAA;AAEhE,SAASC,eAAe,EAAEC,gBAAgB,QAAQ,SAAS,CAAA;IAUxDF,kBAAiB,GAAjBA,iBAAiB;AAHpB,OAAO,MAAMG,eAAe,SAASF,eAAe;IAKlD,IAAIG,eAAe,GAAG;QACpB,qFAAqF;QACrF,+BAA+B;QAC/B,IAAI,CAACC,IAAI,CAACL,iBAAiB,CAAC,GAAG,IAAI,CAACA,iBAAiB,CAAC;QACtD,IAAI,CAACK,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,CAACZ,kBAAiB,CAAC,GAAgB,EAAE;KAiBpC;IAED,MAAMD,SAAS,CAACc,KAAgB,EAAgB;QAC9C,OAAOd,SAAS,CAAC,IAAI,CAACM,IAAI,EAAEQ,KAAK,CAAC,CAAA;KACnC;CACF;AAED,OAAO,MAAMC,gBAAgB,SAASZ,gBAAgB;IAKpD,IAAIa,gBAAgB,GAAG;QACrB,IAAIjB,sBAAsB,IAAI,IAAI,EAAE;YAClC,IAAI,CAACkB,IAAI,CAAClB,sBAAsB,CAAC,GAAG,IAAI,CAACA,sB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AC,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,EAAEjB,KAAa,EAAQ;QAC9C,MAAM4B,aAAa,GAAG,IAAI,CAACV,eAAe,CAACD,IAAI,CAAC,IAAI,EAAE;QAEtD,IAAI,CAACW,aAAa,CAACC,QAAQ,CAAC7B,KAAK,CAAC,EAAE;YAClC,IAAI,CAACQ,IAAI,CAACQ,SAAS,CAACC,IAAI,EAAE;mBAAIW,aAAa;gBAAE5B,KAAK;aAAC,CAAC;SACrD;QAED,OAAO,IAAI,CAAA;KACZ;IAED8B,IAAI,CAAC9B,KAAa,EAAE;QAClB,IAAI,CAACS,QAAQ,GAAGT,KAAK;QACrB,OAAO,IAAI,CAAA;KACZ;IAED+B,IAAI,GAAG;QACL,IAAI,CAACvB,IAAI,CAACwB,GAAG,CAAC,IAAI,CAACvB,QAAQ,CAAC;KAC7B;CACF"}
|
||||
75
kitabcitab/node_modules/next/dist/esm/server/base-http/web.js
generated
vendored
Normal file
75
kitabcitab/node_modules/next/dist/esm/server/base-http/web.js
generated
vendored
Normal file
@@ -0,0 +1,75 @@
|
||||
import { BaseNextRequest, BaseNextResponse } from "./index";
|
||||
export class WebNextRequest extends 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");
|
||||
}
|
||||
}
|
||||
export class WebNextResponse extends 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;
|
||||
}
|
||||
}
|
||||
|
||||
//# sourceMappingURL=web.js.map
|
||||
1
kitabcitab/node_modules/next/dist/esm/server/base-http/web.js.map
generated
vendored
Normal file
1
kitabcitab/node_modules/next/dist/esm/server/base-http/web.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../server/base-http/web.ts"],"names":["BaseNextRequest","BaseNextResponse","WebNextRequest","constructor","request","url","URL","method","href","slice","origin","length","clone","body","headers","name","value","entries","parseBody","_limit","Error","WebNextResponse","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":"AAEA,SAASA,eAAe,EAAEC,gBAAgB,QAAQ,SAAS,CAAA;AAE3D,OAAO,MAAMC,cAAc,SAASF,eAAe;IAIjDG,YAAYC,OAAgB,CAAE;QAC5B,MAAMC,GAAG,GAAG,IAAIC,GAAG,CAACF,OAAO,CAACC,GAAG,CAAC;QAEhC,KAAK,CACHD,OAAO,CAACG,MAAM,EACdF,GAAG,CAACG,IAAI,CAACC,KAAK,CAACJ,GAAG,CAACK,MAAM,CAACC,MAAM,CAAC,EACjCP,OAAO,CAACQ,KAAK,EAAE,CAACC,IAAI,CACrB;QACD,IAAI,CAACT,OAAO,GAAGA,OAAO;QAEtB,IAAI,CAACU,OAAO,GAAG,EAAE;QACjB,KAAK,MAAM,CAACC,IAAI,EAAEC,KAAK,CAAC,IAAIZ,OAAO,CAACU,OAAO,CAACG,OAAO,EAAE,CAAE;YACrD,IAAI,CAACH,OAAO,CAACC,IAAI,CAAC,GAAGC,KAAK;SAC3B;KACF;IAED,MAAME,SAAS,CAACC,MAAuB,EAAgB;QACrD,MAAM,IAAIC,KAAK,CAAC,iDAAiD,CAAC,CAAA;KACnE;CACF;AAED,OAAO,MAAMC,eAAe,SAASpB,gBAAgB;IAoBnD,IAAIqB,IAAI,GAAG;QACT,OAAO,IAAI,CAACC,KAAK,CAAA;KAClB;IAEDpB,YAAmBqB,eAAe,GAAG,IAAIC,eAAe,EAAE,CAAE;QAC1D,KAAK,CAACD,eAAe,CAACE,QAAQ,CAAC;aADdF,eAAe,GAAfA,eAAe;aAvB1BV,OAAO,GAAG,IAAIa,OAAO,EAAE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,IAAY,EAAW;QAC/B,OAAO,IAAI,CAACD,OAAO,CAAC0C,GAAG,CAACzC,IAAI,CAAC,CAAA;KAC9B;IAED0C,YAAY,CAAC1C,IAAY,EAAEC,KAAa,EAAQ;QAC9C,IAAI,CAACF,OAAO,CAACiC,MAAM,CAAChC,IAAI,EAAEC,KAAK,CAAC;QAChC,OAAO,IAAI,CAAA;KACZ;IAEDH,IAAI,CAACG,KAAa,EAAE;QAClB,IAAI,CAACY,QAAQ,GAAGZ,KAAK;QACrB,OAAO,IAAI,CAAA;KACZ;IAED0C,IAAI,GAAG;YACL,IAAI,AAAY,EAAhB,GAAgB;QAAhB,CAAA,GAAgB,GAAhB,CAAA,IAAI,GAAJ,IAAI,EAACzB,WAAW,SAAI,GAApB,KAAA,CAAoB,GAApB,GAAgB,CAAhB,IAAoB,CAApB,IAAI,CAAgB,CAAA;QACpB,IAAI,CAACV,KAAK,GAAG,IAAI;KAClB;IAEDoC,UAAU,GAAG;QACX,OAAO,IAAI,CAACzB,QAAQ,CAAA;KACrB;CACF"}
|
||||
1195
kitabcitab/node_modules/next/dist/esm/server/base-server.js
generated
vendored
Normal file
1195
kitabcitab/node_modules/next/dist/esm/server/base-server.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1
kitabcitab/node_modules/next/dist/esm/server/base-server.js.map
generated
vendored
Normal file
1
kitabcitab/node_modules/next/dist/esm/server/base-server.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
69
kitabcitab/node_modules/next/dist/esm/server/body-streams.js
generated
vendored
Normal file
69
kitabcitab/node_modules/next/dist/esm/server/body-streams.js
generated
vendored
Normal file
@@ -0,0 +1,69 @@
|
||||
import { PassThrough } from "stream";
|
||||
export 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;
|
||||
}
|
||||
export 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 PassThrough();
|
||||
const p2 = new 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/esm/server/body-streams.js.map
generated
vendored
Normal file
1
kitabcitab/node_modules/next/dist/esm/server/body-streams.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../server/body-streams.ts"],"names":["PassThrough","requestToBodyStream","context","KUint8Array","stream","ReadableStream","start","controller","on","chunk","enqueue","Uint8Array","close","err","error","replaceRequestBody","base","key","v","bind","getClonableBody","readable","buffered","endPromise","Promise","resolve","reject","catch","finalize","res","cloneBodyStream","input","p1","p2","push"],"mappings":"AACA,SAASA,WAAW,QAAkB,QAAQ,CAAA;AAE9C,OAAO,SAASC,mBAAmB,CACjCC,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;AAOD,OAAO,SAASI,eAAe,CAC7BC,QAAW,EACG;IACd,IAAIC,QAAQ,GAAoB,IAAI;IAEpC,MAAMC,UAAU,GAAG,IAAIC,OAAO,CAC5B,CAACC,OAAO,EAAEC,MAAM,GAAK;QACnBL,QAAQ,CAACb,EAAE,CAAC,KAAK,EAAEiB,OAAO,CAAC;QAC3BJ,QAAQ,CAACb,EAAE,CAAC,OAAO,EAAEkB,MAAM,CAAC;KAC7B,CACF,CAACC,KAAK,CAAC,CAACb,KAAK,GAAK;QACjB,OAAO;YAAEA,KAAK;SAAE,CAAA;KACjB,CAAC;IAEF,OAAO;QACL;;;;OAIG,CACH,MAAMc,QAAQ,IAAkB;YAC9B,IAAIN,QAAQ,EAAE;gBACZ,MAAMO,GAAG,GAAG,MAAMN,UAAU;gBAE5B,IAAIM,GAAG,IAAI,OAAOA,GAAG,KAAK,QAAQ,IAAIA,GAAG,CAACf,KAAK,EAAE;oBAC/C,MAAMe,GAAG,CAACf,KAAK,CAAA;iBAChB;gBACDC,kBAAkB,CAACM,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,IAAIhC,WAAW,EAAE;YAC5B,MAAMiC,EAAE,GAAG,IAAIjC,WAAW,EAAE;YAC5B+B,KAAK,CAACvB,EAAE,CAAC,MAAM,EAAE,CAACC,KAAK,GAAK;gBAC1BuB,EAAE,CAACE,IAAI,CAACzB,KAAK,CAAC;gBACdwB,EAAE,CAACC,IAAI,CAACzB,KAAK,CAAC;aACf,CAAC;YACFsB,KAAK,CAACvB,EAAE,CAAC,KAAK,EAAE,IAAM;gBACpBwB,EAAE,CAACE,IAAI,CAAC,IAAI,CAAC;gBACbD,EAAE,CAACC,IAAI,CAAC,IAAI,CAAC;aACd,CAAC;YACFZ,QAAQ,GAAGW,EAAE;YACb,OAAOD,EAAE,CAAA;SACV;KACF,CAAA;CACF"}
|
||||
771
kitabcitab/node_modules/next/dist/esm/server/config-schema.js
generated
vendored
Normal file
771
kitabcitab/node_modules/next/dist/esm/server/config-schema.js
generated
vendored
Normal file
@@ -0,0 +1,771 @@
|
||||
import { VALID_LOADERS } from "../shared/lib/image-config";
|
||||
import { SERVER_RUNTIME } from "../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(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: 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/esm/server/config-schema.js.map
generated
vendored
Normal file
1
kitabcitab/node_modules/next/dist/esm/server/config-schema.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
124
kitabcitab/node_modules/next/dist/esm/server/config-shared.js
generated
vendored
Normal file
124
kitabcitab/node_modules/next/dist/esm/server/config-shared.js
generated
vendored
Normal file
@@ -0,0 +1,124 @@
|
||||
import os from "os";
|
||||
import { imageConfigDefault } from "../shared/lib/image-config";
|
||||
export 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: 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.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
|
||||
}
|
||||
};
|
||||
export 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;
|
||||
}
|
||||
export 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/esm/server/config-shared.js.map
generated
vendored
Normal file
1
kitabcitab/node_modules/next/dist/esm/server/config-shared.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../server/config-shared.ts"],"names":["os","imageConfigDefault","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","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","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","normalizeConfig","phase","config","validateConfig","userConfig","configValidator","require","errors"],"mappings":"AAAA,OAAOA,EAAE,MAAM,IAAI,CAAA;AAGnB,SAGEC,kBAAkB,QACb,4BAA4B,CAAA;AA8fnC,OAAO,MAAMC,aAAa,GAAe;IACvCC,GAAG,EAAE,EAAE;IACPC,OAAO,EAAE,IAAI;IACbC,oBAAoB,EAAE,IAAI;IAC1BC,MAAM,EAAE;QACNC,kBAAkB,EAAE,KAAK;KAC1B;IACDC,UAAU,EAAE;QACVC,iBAAiB,EAAE,KAAK;QACxBC,YAAY,EAAE,eAAe;KAC9B;IACDC,OAAO,EAAE,OAAO;IAChBC,YAAY,EAAE,IAAI;IAClBC,WAAW,EAAE,EAAE;IACfC,YAAY,EAAE,SAAS;IACvBC,yBAAyB,EAAE,IAAI;IAC/BC,eAAe,EAAE,IAAM,IAAI;IAC3BC,aAAa,EAAE,IAAI;IACnBC,cAAc,EAAE;QAAC,KAAK;QAAE,IAAI;QAAE,KAAK;QAAE,IAAI;KAAC;IAC1CC,MAAM,EAAE,QAAQ;IAChBC,eAAe,EAAE,IAAI;IACrBC,QAAQ,EAAE,IAAI;IACdC,WAAW,EAAEC,OAAO,CAACpB,GAAG,CAACqB,mBAAmB,IAAI,EAAE;IAClDC,MAAM,EAAExB,kBAAkB;IAC1ByB,aAAa,EAAE;QACbC,aAAa,EAAE,IAAI;QACnBC,qBAAqB,EAAE,cAAc;KACtC;IACDC,eAAe,EAAE;QACfC,cAAc,EAAE,EAAE,GAAG,IAAI;QACzBC,iBAAiB,EAAE,CAAC;KACrB;IACDC,GAAG,EAAE;QACHC,aAAa,EAAE,EAAE;KAClB;IACDC,QAAQ,EAAE,EAAE;I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Q,EAAE,IAAI;QACdC,cAAc,EAAE,IAAI;QACpBC,SAAS,EAAE,KAAK;QAChBC,YAAY,EAAE,IAAI;QAClBC,MAAM,EAAE,KAAK;QACb,wBAAwB;QACxBC,kBAAkB,EAAE,EAAE,GAAG,IAAI,GAAG,IAAI;QACpCC,2BAA2B,EAAEjC,SAAS;QACtCkC,cAAc,EAAE,KAAK;QACrBC,qBAAqB,EAAE/D,OAAO,CAACpB,GAAG,CAACoF,8BAA8B,IAAI,EAAE;QACvEC,iBAAiB,EAAE,KAAK;QACxBC,kBAAkB,EAAE,KAAK;QACzBC,UAAU,EAAEvC,SAAS;QACrBwC,qBAAqB,EAAExC,SAAS;QAChCyC,kBAAkB,EAAE,GAAG,GAAG,IAAI;QAC9BC,uBAAuB,EAAE1C,SAAS;QAClCnB,GAAG,EAAEmB,SAAS;QACd2C,UAAU,EAAE3C,SAAS;QACrB4C,YAAY,EAAE,KAAK;QACnBC,mBAAmB,EAAE,KAAK;QAC1BC,iCAAiC,EAAE,KAAK;QACxCC,UAAU,EAAE/C,SAAS;KACtB;CACF,CAAA;AAED,OAAO,eAAegD,eAAe,CAACC,KAAa,EAAEC,MAAW,EAAE;IAChE,IAAI,OAAOA,MAAM,KAAK,UAAU,EAAE;QAChCA,MAAM,GAAGA,MAAM,CAACD,KAAK,EAAE;YAAElG,aAAa;SAAE,CAAC;KAC1C;IACD,gFAAgF;IAChF,OAAO,MAAMmG,MAAM,CAAA;CACpB;AAED,OAAO,SAASC,cAAc,CAACC,UAAsB,EAEnD;IACA,MAAMC,eAAe,GAAGC,OAAO,CAAC,mCAAmC,CAAC;IACpED,eAAe,CAACD,UAAU,CAAC;IAC3B,OAAO;QACLG,MAAM,EAAEF,eAAe,CAACE,MAAM;KAC/B,CAAA;CACF"}
|
||||
187
kitabcitab/node_modules/next/dist/esm/server/config-utils.js
generated
vendored
Normal file
187
kitabcitab/node_modules/next/dist/esm/server/config-utils.js
generated
vendored
Normal file
@@ -0,0 +1,187 @@
|
||||
import { init as initWebpack } from "next/dist/compiled/webpack/webpack";
|
||||
let installed = false;
|
||||
export function loadWebpackHook() {
|
||||
if (installed) {
|
||||
return;
|
||||
}
|
||||
installed = true;
|
||||
initWebpack();
|
||||
// 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/esm/server/config-utils.js.map
generated
vendored
Normal file
1
kitabcitab/node_modules/next/dist/esm/server/config-utils.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../server/config-utils.ts"],"names":["init","initWebpack","installed","loadWebpackHook","require","loadRequireHook","map","request","replacement","resolve"],"mappings":"AAAA,SAASA,IAAI,IAAIC,WAAW,QAAQ,oCAAoC,CAAA;AAExE,IAAIC,SAAS,GAAY,KAAK;AAE9B,OAAO,SAASC,eAAe,GAAG;IAChC,IAAID,SAAS,EAAE;QACb,OAAM;KACP;IACDA,SAAS,GAAG,IAAI;IAEhBD,WAAW,EAAE;IAEb,wDAAwD;IACxD,4DAA4D;IAC5DG,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;S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K,OAAO,CAACD,WAAW,CAAC;SAAC,CACpE,CACF;CACF"}
|
||||
570
kitabcitab/node_modules/next/dist/esm/server/config.js
generated
vendored
Normal file
570
kitabcitab/node_modules/next/dist/esm/server/config.js
generated
vendored
Normal file
@@ -0,0 +1,570 @@
|
||||
import { existsSync } from "fs";
|
||||
import { basename, extname, join, relative, isAbsolute, resolve } from "path";
|
||||
import { pathToFileURL } from "url";
|
||||
import { Agent as HttpAgent } from "http";
|
||||
import { Agent as HttpsAgent } from "https";
|
||||
import findUp from "next/dist/compiled/find-up";
|
||||
import chalk from "../lib/chalk";
|
||||
import * as Log from "../build/output/log";
|
||||
import { CONFIG_FILES, PHASE_DEVELOPMENT_SERVER } from "../shared/lib/constants";
|
||||
import { execOnce } from "../shared/lib/utils";
|
||||
import { defaultConfig, normalizeConfig, validateConfig } from "./config-shared";
|
||||
import { loadWebpackHook } from "./config-utils";
|
||||
import { imageConfigDefault, VALID_LOADERS } from "../shared/lib/image-config";
|
||||
import { loadEnvConfig } from "@next/env";
|
||||
import { gte as semverGte } from "next/dist/compiled/semver";
|
||||
export { DomainLocale, NextConfig, normalizeConfig } from "./config-shared";
|
||||
const NODE_16_VERSION = "16.8.0";
|
||||
const NODE_18_VERSION = "18.0.0";
|
||||
const isAboveNodejs16 = semverGte(process.version, NODE_16_VERSION);
|
||||
const isAboveNodejs18 = semverGte(process.version, NODE_18_VERSION);
|
||||
const experimentalWarning = execOnce((configFileName, features)=>{
|
||||
const s = features.length > 1 ? "s" : "";
|
||||
Log.warn(chalk.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();
|
||||
});
|
||||
export 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 HttpAgent(config.httpAgentOptions);
|
||||
globalThis.__NEXT_HTTPS_AGENT = new HttpsAgent(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.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 (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] !== 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] = {
|
||||
...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 = {
|
||||
...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 (!VALID_LOADERS.includes(images.loader)) {
|
||||
throw new Error(`Specified images.loader should be one of (${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 === 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 === 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 = join(dir, images.loaderFile);
|
||||
if (!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) && !isAbsolute(result.experimental.outputFileTracingRoot)) {
|
||||
result.experimental.outputFileTracingRoot = 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 || 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;
|
||||
}
|
||||
export default async function loadConfig(phase, dir, customConfig, rawConfig) {
|
||||
await loadEnvConfig(dir, phase === PHASE_DEVELOPMENT_SERVER, Log);
|
||||
loadWebpackHook();
|
||||
let configFileName = "next.config.js";
|
||||
if (customConfig) {
|
||||
return assignDefaults(dir, {
|
||||
configOrigin: "server",
|
||||
configFileName,
|
||||
...customConfig
|
||||
});
|
||||
}
|
||||
const path = await findUp(CONFIG_FILES, {
|
||||
cwd: dir
|
||||
});
|
||||
// If config file was found
|
||||
if (path == null ? void 0 : path.length) {
|
||||
var ref;
|
||||
configFileName = 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(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 normalizeConfig(phase, userConfigModule.default || userConfigModule);
|
||||
const validateResult = 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: relative(dir, path),
|
||||
configFile: path,
|
||||
configFileName,
|
||||
...userConfig
|
||||
});
|
||||
setFontLoaderDefaults(completeConfig);
|
||||
return completeConfig;
|
||||
} else {
|
||||
const configBaseName = basename(CONFIG_FILES[0], extname(CONFIG_FILES[0]));
|
||||
const nonJsPath = findUp.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 '${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, defaultConfig);
|
||||
completeConfig.configFileName = configFileName;
|
||||
setHttpClientAndAgentOptions(completeConfig);
|
||||
setFontLoaderDefaults(completeConfig);
|
||||
return completeConfig;
|
||||
};
|
||||
|
||||
//# sourceMappingURL=config.js.map
|
||||
1
kitabcitab/node_modules/next/dist/esm/server/config.js.map
generated
vendored
Normal file
1
kitabcitab/node_modules/next/dist/esm/server/config.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
43
kitabcitab/node_modules/next/dist/esm/server/crypto-utils.js
generated
vendored
Normal file
43
kitabcitab/node_modules/next/dist/esm/server/crypto-utils.js
generated
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
import crypto from "crypto";
|
||||
// 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/
|
||||
;
|
||||
export function encryptWithSecret(secret, data) {
|
||||
const iv = crypto.randomBytes(CIPHER_IV_LENGTH);
|
||||
const salt = crypto.randomBytes(CIPHER_SALT_LENGTH);
|
||||
// https://nodejs.org/api/crypto.html#crypto_crypto_pbkdf2sync_password_salt_iterations_keylen_digest
|
||||
const key = crypto.pbkdf2Sync(secret, salt, PBKDF2_ITERATIONS, CIPHER_KEY_LENGTH, `sha512`);
|
||||
const cipher = crypto.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`);
|
||||
}
|
||||
export 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.pbkdf2Sync(secret, salt, PBKDF2_ITERATIONS, CIPHER_KEY_LENGTH, `sha512`);
|
||||
const decipher = crypto.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/esm/server/crypto-utils.js.map
generated
vendored
Normal file
1
kitabcitab/node_modules/next/dist/esm/server/crypto-utils.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../server/crypto-utils.ts"],"names":["crypto","CIPHER_ALGORITHM","CIPHER_KEY_LENGTH","CIPHER_IV_LENGTH","CIPHER_TAG_LENGTH","CIPHER_SALT_LENGTH","PBKDF2_ITERATIONS","encryptWithSecret","secret","data","iv","randomBytes","salt","key","pbkdf2Sync","cipher","createCipheriv","encrypted","Buffer","concat","update","final","tag","getAuthTag","toString","decryptWithSecret","encryptedData","buffer","from","slice","decipher","createDecipheriv","setAuthTag"],"mappings":"AAAA,OAAOA,MAAM,MAAM,QAAQ,CAAA;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;AAEjC,OAAO,SAASC,iBAAiB,CAACC,MAAc,EAAEC,IAAY,EAAU;IACtE,MAAMC,EAAE,GAAGV,MAAM,CAACW,WAAW,CAACR,gBAAgB,CAAC;IAC/C,MAAMS,IAAI,GAAGZ,MAAM,CAACW,WAAW,CAACN,kBAAkB,CAAC;IAEnD,qGAAqG;IACrG,MAAMQ,GAAG,GAAGb,MAAM,CAACc,UAAU,CAC3BN,MAAM,EACNI,IAAI,EACJN,iBAAiB,EACjBJ,iBAAiB,EACjB,CAAC,MAAM,CAAC,CACT;IAED,MAAMa,MAAM,GAAGf,MAAM,CAACgB,cAAc,CAACf,gBAAgB,EAAEY,GAAG,EAAEH,EAAE,CAAC;IAC/D,MAAMO,SAAS,GAAGC,MAAM,CAACC,MAAM,CAAC;QAACJ,MAAM,CAACK,MAAM,CAACX,IAAI,EAAE,CAAC,IAAI,CAAC,CAAC;QAAEM,MAAM,CAACM,KAAK,EAAE;KAAC,CAAC;IAE9E,8DAA8D;IAC9D,MAAMC,GAAG,GAAGP,M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next/dist/esm/server/dev/hot-middleware.js
generated
vendored
Normal file
173
kitabcitab/node_modules/next/dist/esm/server/dev/hot-middleware.js
generated
vendored
Normal file
@@ -0,0 +1,173 @@
|
||||
import { isMiddlewareFilename } from "../../build/utils";
|
||||
import { nonNullable } from "../../lib/non-nullable";
|
||||
function isMiddlewareStats(stats) {
|
||||
for (const key of stats.compilation.entrypoints.keys()){
|
||||
if (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));
|
||||
});
|
||||
}
|
||||
}
|
||||
export 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).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();
|
||||
};
|
||||
}
|
||||
|
||||
//# sourceMappingURL=hot-middleware.js.map
|
||||
1
kitabcitab/node_modules/next/dist/esm/server/dev/hot-middleware.js.map
generated
vendored
Normal file
1
kitabcitab/node_modules/next/dist/esm/server/dev/hot-middleware.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
816
kitabcitab/node_modules/next/dist/esm/server/dev/hot-reloader.js
generated
vendored
Normal file
816
kitabcitab/node_modules/next/dist/esm/server/dev/hot-reloader.js
generated
vendored
Normal file
@@ -0,0 +1,816 @@
|
||||
import { webpack, StringXor } from "next/dist/compiled/webpack/webpack";
|
||||
import { getOverlayMiddleware } from "next/dist/compiled/@next/react-dev-overlay/dist/middleware";
|
||||
import { WebpackHotMiddleware } from "./hot-middleware";
|
||||
import { join, relative, isAbsolute, posix } from "path";
|
||||
import { createEntrypoints, createPagesMapping, finalizeEntrypoint, getClientEntry, getEdgeServerEntry, getAppEntry, runDependingOnPageType } from "../../build/entries";
|
||||
import { watchCompilers } from "../../build/output";
|
||||
import * as Log from "../../build/output/log";
|
||||
import getBaseWebpackConfig from "../../build/webpack-config";
|
||||
import { APP_DIR_ALIAS, WEBPACK_LAYERS } from "../../lib/constants";
|
||||
import { recursiveDelete } from "../../lib/recursive-delete";
|
||||
import { BLOCKED_PAGES, COMPILER_NAMES, RSC_MODULE_TYPES } from "../../shared/lib/constants";
|
||||
import { getPathMatch } from "../../shared/lib/router/utils/path-match";
|
||||
import { findPageFile } from "../lib/find-page-file";
|
||||
import { BUILDING, entries, EntryTypes, getInvalidator, onDemandEntryHandler } from "./on-demand-entry-handler";
|
||||
import { denormalizePagePath } from "../../shared/lib/page-path/denormalize-page-path";
|
||||
import { normalizePathSep } from "../../shared/lib/page-path/normalize-path-sep";
|
||||
import getRouteFromEntrypoint from "../get-route-from-entrypoint";
|
||||
import { fileExists } from "../../lib/file-exists";
|
||||
import { difference, isMiddlewareFilename } from "../../build/utils";
|
||||
import { DecodeError } from "../../shared/lib/utils";
|
||||
import { trace } from "../../trace";
|
||||
import { getProperError } from "../../lib/is-error";
|
||||
import ws from "next/dist/compiled/ws";
|
||||
import { promises as fs } from "fs";
|
||||
import { getPageStaticInfo } from "../../build/analysis/get-page-static-info";
|
||||
function diff(a, b) {
|
||||
return new Set([
|
||||
...a
|
||||
].filter((v)=>!b.has(v)));
|
||||
}
|
||||
const wsServer = new ws.Server({
|
||||
noServer: true
|
||||
});
|
||||
export 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 = 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 = getRouteFromEntrypoint(name);
|
||||
if (!enhancedName) {
|
||||
continue;
|
||||
}
|
||||
if (!failedPages[enhancedName]) {
|
||||
failedPages[enhancedName] = [];
|
||||
}
|
||||
failedPages[enhancedName].push(error);
|
||||
}
|
||||
return failedPages;
|
||||
}
|
||||
export default 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 = 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 DecodeError("failed to decode param");
|
||||
}
|
||||
const page = denormalizePagePath(decodedPagePath);
|
||||
if (page === "/_error" || BLOCKED_PAGES.indexOf(page) === -1) {
|
||||
try {
|
||||
await this.ensurePage({
|
||||
page,
|
||||
clientOnly: true
|
||||
});
|
||||
} catch (error) {
|
||||
await renderScriptError(pageBundleRes, 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(()=>recursiveDelete(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([
|
||||
findPageFile(this.pagesDir, "/_app", pageExtensions, false),
|
||||
findPageFile(this.pagesDir, "/_document", pageExtensions, false),
|
||||
]));
|
||||
this.pagesMapping = webpackConfigSpan.traceChild("create-pages-mapping").traceFn(()=>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(()=>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
|
||||
getBaseWebpackConfig(this.dir, {
|
||||
...commonWebpackOptions,
|
||||
compilerType: COMPILER_NAMES.client,
|
||||
entrypoints: entrypoints.client
|
||||
}),
|
||||
getBaseWebpackConfig(this.dir, {
|
||||
...commonWebpackOptions,
|
||||
compilerType: COMPILER_NAMES.server,
|
||||
entrypoints: entrypoints.server
|
||||
}),
|
||||
getBaseWebpackConfig(this.dir, {
|
||||
...commonWebpackOptions,
|
||||
compilerType: COMPILER_NAMES.edgeServer,
|
||||
entrypoints: entrypoints.edgeServer
|
||||
}),
|
||||
]));
|
||||
});
|
||||
}
|
||||
async buildFallbackError() {
|
||||
if (this.fallbackWatcher) return;
|
||||
const fallbackConfig = await getBaseWebpackConfig(this.dir, {
|
||||
runWebpackSpan: this.hotReloaderSpan,
|
||||
dev: true,
|
||||
compilerType: COMPILER_NAMES.client,
|
||||
config: this.config,
|
||||
buildId: this.buildId,
|
||||
pagesDir: this.pagesDir,
|
||||
rewrites: {
|
||||
beforeFiles: [],
|
||||
afterFiles: [],
|
||||
fallback: []
|
||||
},
|
||||
isDevFallback: true,
|
||||
entrypoints: (await 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 = 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.mkdir(this.distDir, {
|
||||
recursive: true
|
||||
});
|
||||
const distPackageJsonPath = 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.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 === COMPILER_NAMES.client;
|
||||
const isNodeServerCompilation = config1.name === COMPILER_NAMES.server;
|
||||
const isEdgeServerCompilation = config1.name === COMPILER_NAMES.edgeServer;
|
||||
await Promise.all(Object.keys(entries).map(async (entryKey)=>{
|
||||
const entryData = 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 === COMPILER_NAMES.client && !isClientCompilation) return;
|
||||
if (key === COMPILER_NAMES.server && !isNodeServerCompilation) return;
|
||||
if (key === COMPILER_NAMES.edgeServer && !isEdgeServerCompilation) return;
|
||||
const isEntry = entryData.type === EntryTypes.ENTRY;
|
||||
const isChildEntry = entryData.type === EntryTypes.CHILD_ENTRY;
|
||||
// Check if the page was removed or disposed and remove it
|
||||
if (isEntry) {
|
||||
const pageExists = !dispose && await fileExists(entryData.absolutePagePath);
|
||||
if (!pageExists) {
|
||||
delete entries[entryKey];
|
||||
return;
|
||||
}
|
||||
}
|
||||
const hasAppDir = !!this.appDir;
|
||||
const isAppPath = hasAppDir && bundlePath.startsWith("app/");
|
||||
const staticInfo = isEntry ? await getPageStaticInfo({
|
||||
pageFilePath: entryData.absolutePagePath,
|
||||
nextConfig: this.config,
|
||||
isDev: true,
|
||||
pageType: isAppPath ? "app" : "pages"
|
||||
}) : {};
|
||||
const isServerComponent = isAppPath && staticInfo.rsc !== RSC_MODULE_TYPES.client;
|
||||
await runDependingOnPageType({
|
||||
page,
|
||||
pageRuntime: staticInfo.runtime,
|
||||
onEdgeServer: ()=>{
|
||||
// TODO-APP: verify if child entry should support.
|
||||
if (!isEdgeServerCompilation || !isEntry) return;
|
||||
const appDirLoader = isAppPath ? getAppEntry({
|
||||
name: bundlePath,
|
||||
appPaths: entryData.appPaths,
|
||||
pagePath: posix.join(APP_DIR_ALIAS, 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;
|
||||
entries[entryKey].status = BUILDING;
|
||||
entrypoints[bundlePath] = finalizeEntrypoint({
|
||||
compilerType: COMPILER_NAMES.edgeServer,
|
||||
name: bundlePath,
|
||||
value: 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) {
|
||||
entries[entryKey].status = BUILDING;
|
||||
entrypoints[bundlePath] = finalizeEntrypoint({
|
||||
name: bundlePath,
|
||||
compilerType: COMPILER_NAMES.client,
|
||||
value: entryData.request,
|
||||
hasAppDir
|
||||
});
|
||||
} else {
|
||||
entries[entryKey].status = BUILDING;
|
||||
entrypoints[bundlePath] = finalizeEntrypoint({
|
||||
name: bundlePath,
|
||||
compilerType: COMPILER_NAMES.client,
|
||||
value: getClientEntry({
|
||||
absolutePagePath: entryData.absolutePagePath,
|
||||
page
|
||||
}),
|
||||
hasAppDir
|
||||
});
|
||||
}
|
||||
},
|
||||
onServer: ()=>{
|
||||
// TODO-APP: verify if child entry should support.
|
||||
if (!isNodeServerCompilation || !isEntry) return;
|
||||
entries[entryKey].status = BUILDING;
|
||||
let relativeRequest = relative(config1.context, entryData.absolutePagePath);
|
||||
if (!isAbsolute(relativeRequest) && !relativeRequest.startsWith("../")) {
|
||||
relativeRequest = `./${relativeRequest}`;
|
||||
}
|
||||
entrypoints[bundlePath] = finalizeEntrypoint({
|
||||
compilerType: COMPILER_NAMES.server,
|
||||
name: bundlePath,
|
||||
isServerComponent,
|
||||
value: isAppPath ? getAppEntry({
|
||||
name: bundlePath,
|
||||
appPaths: entryData.appPaths,
|
||||
pagePath: posix.join(APP_DIR_ALIAS, 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 = webpack(this.activeConfigs);
|
||||
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/") || 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 StringXor();
|
||||
let chunksHashServerLayer = new 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 === 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 === 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 = 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 = difference(changedServerPages, changedClientPages);
|
||||
const edgeServerOnlyChanges = difference(changedEdgeServerPages, changedClientPages);
|
||||
const pageChanges = serverOnlyChanges.concat(edgeServerOnlyChanges).filter((key)=>key.startsWith("pages/"));
|
||||
const middlewareChanges = Array.from(changedEdgeServerPages).filter((name)=>isMiddlewareFilename(name));
|
||||
if (middlewareChanges.length > 0) {
|
||||
this.send({
|
||||
event: "middlewareChanges"
|
||||
});
|
||||
}
|
||||
if (pageChanges.length > 0) {
|
||||
this.send({
|
||||
event: "serverOnlyChanges",
|
||||
pages: serverOnlyChanges.map((pg)=>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)=>!!getRouteFromEntrypoint(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 = getRouteFromEntrypoint(addedPage);
|
||||
this.send("addedPage", page);
|
||||
}
|
||||
}
|
||||
if (removedPages.size > 0) {
|
||||
for (const removedPage of removedPages){
|
||||
const page = getRouteFromEntrypoint(removedPage);
|
||||
this.send("removedPage", page);
|
||||
}
|
||||
}
|
||||
}
|
||||
this.prevChunkNames = chunkNames;
|
||||
});
|
||||
this.webpackHotMiddleware = new 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 = onDemandEntryHandler({
|
||||
multiCompiler: this.multiCompiler,
|
||||
pagesDir: this.pagesDir,
|
||||
appDir: this.appDir,
|
||||
rootDir: this.dir,
|
||||
nextConfig: this.config,
|
||||
...this.config.onDemandEntries
|
||||
});
|
||||
this.interceptors = [
|
||||
getOverlayMiddleware({
|
||||
rootDirectory: this.dir,
|
||||
stats: ()=>this.clientStats,
|
||||
serverStats: ()=>this.serverStats,
|
||||
edgeServerStats: ()=>this.edgeServerStats
|
||||
}),
|
||||
];
|
||||
}
|
||||
invalidate() {
|
||||
var ref;
|
||||
return (ref = 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 = 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" && 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
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
//# sourceMappingURL=hot-reloader.js.map
|
||||
1
kitabcitab/node_modules/next/dist/esm/server/dev/hot-reloader.js.map
generated
vendored
Normal file
1
kitabcitab/node_modules/next/dist/esm/server/dev/hot-reloader.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
1117
kitabcitab/node_modules/next/dist/esm/server/dev/next-dev-server.js
generated
vendored
Normal file
1117
kitabcitab/node_modules/next/dist/esm/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/esm/server/dev/next-dev-server.js.map
generated
vendored
Normal file
1
kitabcitab/node_modules/next/dist/esm/server/dev/next-dev-server.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
475
kitabcitab/node_modules/next/dist/esm/server/dev/on-demand-entry-handler.js
generated
vendored
Normal file
475
kitabcitab/node_modules/next/dist/esm/server/dev/on-demand-entry-handler.js
generated
vendored
Normal file
@@ -0,0 +1,475 @@
|
||||
import origDebug from "next/dist/compiled/debug";
|
||||
import { EventEmitter } from "events";
|
||||
import { findPageFile } from "../lib/find-page-file";
|
||||
import { runDependingOnPageType } from "../../build/entries";
|
||||
import { join, posix } from "path";
|
||||
import { normalizePathSep } from "../../shared/lib/page-path/normalize-path-sep";
|
||||
import { normalizePagePath } from "../../shared/lib/page-path/normalize-page-path";
|
||||
import { ensureLeadingSlash } from "../../shared/lib/page-path/ensure-leading-slash";
|
||||
import { removePagePathTail } from "../../shared/lib/page-path/remove-page-path-tail";
|
||||
import { reportTrigger } from "../../build/output";
|
||||
import getRouteFromEntrypoint from "../get-route-from-entrypoint";
|
||||
import { getPageStaticInfo } from "../../build/analysis/get-page-static-info";
|
||||
import { isMiddlewareFile, isMiddlewareFilename } from "../../build/utils";
|
||||
import { PageNotFoundError } from "../../shared/lib/utils";
|
||||
import { COMPILER_INDEXES, COMPILER_NAMES, RSC_MODULE_TYPES } from "../../shared/lib/constants";
|
||||
const debug = origDebug("next:on-demand-entry-handler");
|
||||
/**
|
||||
* Returns object keys with type inferred from the object key
|
||||
*/ const keys = Object.keys;
|
||||
const COMPILER_KEYS = keys(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
|
||||
];
|
||||
}, []);
|
||||
}
|
||||
export const ADDED = Symbol("added");
|
||||
export const BUILDING = Symbol("building");
|
||||
export const BUILT = Symbol("built");
|
||||
export var EntryTypes;
|
||||
(function(EntryTypes) {
|
||||
EntryTypes[EntryTypes["ENTRY"] = 0] = "ENTRY";
|
||||
EntryTypes[EntryTypes["CHILD_ENTRY"] = 1] = "CHILD_ENTRY";
|
||||
})(EntryTypes || (EntryTypes = {}));
|
||||
export const entries = {};
|
||||
let invalidator;
|
||||
export const getInvalidator = ()=>invalidator;
|
||||
const doneCallbacks = new 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[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 normalizePagePath(page);
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
throw new 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 (isMiddlewareFile(normalizedPagePath)) {
|
||||
pagePath = await findPageFile(rootDir, normalizedPagePath, extensions, false);
|
||||
if (!pagePath) {
|
||||
throw new PageNotFoundError(normalizedPagePath);
|
||||
}
|
||||
const pageUrl = ensureLeadingSlash(removePagePathTail(normalizePathSep(pagePath), {
|
||||
extensions
|
||||
}));
|
||||
return {
|
||||
absolutePagePath: join(rootDir, pagePath),
|
||||
bundlePath: normalizedPagePath.slice(1),
|
||||
page: posix.normalize(pageUrl)
|
||||
};
|
||||
}
|
||||
// Check appDir first falling back to pagesDir
|
||||
if (appDir) {
|
||||
pagePath = await findPageFile(appDir, normalizedPagePath, extensions, true);
|
||||
if (pagePath) {
|
||||
const pageUrl = ensureLeadingSlash(removePagePathTail(normalizePathSep(pagePath), {
|
||||
keepIndex: true,
|
||||
extensions
|
||||
}));
|
||||
return {
|
||||
absolutePagePath: join(appDir, pagePath),
|
||||
bundlePath: posix.join("app", normalizePagePath(pageUrl)),
|
||||
page: posix.normalize(pageUrl)
|
||||
};
|
||||
}
|
||||
}
|
||||
if (!pagePath && pagesDir) {
|
||||
pagePath = await findPageFile(pagesDir, normalizedPagePath, extensions, false);
|
||||
}
|
||||
if (pagePath !== null && pagesDir) {
|
||||
const pageUrl = ensureLeadingSlash(removePagePathTail(normalizePathSep(pagePath), {
|
||||
extensions
|
||||
}));
|
||||
return {
|
||||
absolutePagePath: join(pagesDir, pagePath),
|
||||
bundlePath: posix.join("pages", normalizePagePath(pageUrl)),
|
||||
page: posix.normalize(pageUrl)
|
||||
};
|
||||
}
|
||||
if (page === "/_error") {
|
||||
return {
|
||||
absolutePagePath: require.resolve("next/dist/pages/_error"),
|
||||
bundlePath: page,
|
||||
page: normalizePathSep(page)
|
||||
};
|
||||
} else {
|
||||
throw new PageNotFoundError(normalizedPagePath);
|
||||
}
|
||||
}
|
||||
export 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 = getRouteFromEntrypoint(entrypoint.name, root);
|
||||
if (page) {
|
||||
pagePaths.push(`${type}${page}`);
|
||||
} else if (root && entrypoint.name === "root" || 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(COMPILER_NAMES.client, clientStats.compilation.entrypoints, root),
|
||||
...getPagePathsFromEntrypoints(COMPILER_NAMES.server, serverStats.compilation.entrypoints, root),
|
||||
...edgeServerStats ? getPagePathsFromEntrypoints(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 [
|
||||
COMPILER_NAMES.client,
|
||||
COMPILER_NAMES.server,
|
||||
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 = normalizePathSep(pg);
|
||||
let toSend = {
|
||||
invalid: true
|
||||
};
|
||||
for (const compilerType of [
|
||||
COMPILER_NAMES.client,
|
||||
COMPILER_NAMES.server,
|
||||
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 === 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 getPageStaticInfo({
|
||||
pageFilePath: pagePathData.absolutePagePath,
|
||||
nextConfig,
|
||||
isDev: true,
|
||||
pageType: isInsideAppDir ? "app" : "pages"
|
||||
});
|
||||
const added = new Map();
|
||||
const isServerComponent = isInsideAppDir && staticInfo.rsc !== RSC_MODULE_TYPES.client;
|
||||
await runDependingOnPageType({
|
||||
page: pagePathData.page,
|
||||
pageRuntime: staticInfo.runtime,
|
||||
onClient: ()=>{
|
||||
// Skip adding the client entry for app / Server Components.
|
||||
if (isServerComponent || isInsideAppDir) {
|
||||
return;
|
||||
}
|
||||
added.set(COMPILER_NAMES.client, addEntry(COMPILER_NAMES.client));
|
||||
},
|
||||
onServer: ()=>{
|
||||
added.set(COMPILER_NAMES.server, addEntry(COMPILER_NAMES.server));
|
||||
const edgeServerEntry = `${COMPILER_NAMES.edgeServer}${pagePathData.page}`;
|
||||
if (entries[edgeServerEntry]) {
|
||||
// Runtime switched from edge to server
|
||||
delete entries[edgeServerEntry];
|
||||
}
|
||||
},
|
||||
onEdgeServer: ()=>{
|
||||
added.set(COMPILER_NAMES.edgeServer, addEntry(COMPILER_NAMES.edgeServer));
|
||||
const serverEntry = `${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) {
|
||||
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/esm/server/dev/on-demand-entry-handler.js.map
generated
vendored
Normal file
1
kitabcitab/node_modules/next/dist/esm/server/dev/on-demand-entry-handler.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
60
kitabcitab/node_modules/next/dist/esm/server/dev/static-paths-worker.js
generated
vendored
Normal file
60
kitabcitab/node_modules/next/dist/esm/server/dev/static-paths-worker.js
generated
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
import "../node-polyfill-fetch";
|
||||
import { buildAppStaticPaths, buildStaticPaths, collectGenerateParams } from "../../build/utils";
|
||||
import { loadComponents } from "../load-components";
|
||||
import { setHttpClientAndAgentOptions } from "../config";
|
||||
import { loadRequireHook, overrideBuiltInReactPackages } from "../../build/webpack/require-hook";
|
||||
loadRequireHook();
|
||||
if (process.env.NEXT_PREBUNDLED_REACT) {
|
||||
overrideBuiltInReactPackages();
|
||||
}
|
||||
let workerWasUsed = false;
|
||||
// expose AsyncLocalStorage on globalThis for react usage
|
||||
const { AsyncLocalStorage } = require("async_hooks");
|
||||
globalThis.AsyncLocalStorage = AsyncLocalStorage;
|
||||
// we call getStaticPaths in a separate process to ensure
|
||||
// side-effects aren't relied on in dev that will break
|
||||
// during a production build
|
||||
export 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);
|
||||
setHttpClientAndAgentOptions({
|
||||
httpAgentOptions,
|
||||
experimental: {
|
||||
enableUndici
|
||||
}
|
||||
});
|
||||
const components = await 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 collectGenerateParams(components.ComponentMod.tree);
|
||||
return buildAppStaticPaths({
|
||||
page: pathname,
|
||||
generateParams,
|
||||
configFileName: config.configFileName
|
||||
});
|
||||
}
|
||||
return buildStaticPaths({
|
||||
page: pathname,
|
||||
getStaticPaths: components.getStaticPaths,
|
||||
configFileName: config.configFileName,
|
||||
locales,
|
||||
defaultLocale
|
||||
});
|
||||
}
|
||||
|
||||
//# sourceMappingURL=static-paths-worker.js.map
|
||||
1
kitabcitab/node_modules/next/dist/esm/server/dev/static-paths-worker.js.map
generated
vendored
Normal file
1
kitabcitab/node_modules/next/dist/esm/server/dev/static-paths-worker.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../server/dev/static-paths-worker.ts"],"names":["buildAppStaticPaths","buildStaticPaths","collectGenerateParams","loadComponents","setHttpClientAndAgentOptions","loadRequireHook","overrideBuiltInReactPackages","process","env","NEXT_PREBUNDLED_REACT","workerWasUsed","AsyncLocalStorage","require","globalThis","loadStaticPaths","distDir","pathname","config","httpAgentOptions","enableUndici","locales","defaultLocale","isAppPath","originalAppPath","exit","setConfig","experimental","components","hasServerComponents","getStaticPaths","Error","generateParams","ComponentMod","tree","page","configFileName"],"mappings":"AAEA,OAAO,wBAAwB,CAAA;AAC/B,SACEA,mBAAmB,EACnBC,gBAAgB,EAChBC,qBAAqB,QAChB,mBAAmB,CAAA;AAC1B,SAASC,cAAc,QAAQ,oBAAoB,CAAA;AACnD,SAASC,4BAA4B,QAAQ,WAAW,CAAA;AACxD,SACEC,eAAe,EACfC,4BAA4B,QACvB,kCAAkC,CAAA;AAIzCD,eAAe,EAAE;AACjB,IAAIE,OAAO,CAACC,GAAG,CAACC,qBAAqB,EAAE;IACrCH,4BAA4B,EAAE;CAC/B;AAED,IAAII,aAAa,GAAG,KAAK;AAEzB,yDAAyD;AACzD,MAAM,EAAEC,iBAAiB,CAAA,EAAE,GAAGC,OAAO,CAAC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OlC,gBAAgB,CAAC;QACtBiC,IAAI,EAAElB,QAAQ;QACda,cAAc,EAAEF,UAAU,CAACE,cAAc;QACzCM,cAAc,EAAElB,MAAM,CAACkB,cAAc;QACrCf,OAAO;QACPC,aAAa;KACd,CAAC,CAAA;CACH"}
|
||||
145
kitabcitab/node_modules/next/dist/esm/server/font-utils.js
generated
vendored
Normal file
145
kitabcitab/node_modules/next/dist/esm/server/font-utils.js
generated
vendored
Normal file
@@ -0,0 +1,145 @@
|
||||
import * as Log from "../build/output/log";
|
||||
import { GOOGLE_FONT_PROVIDER, DEFAULT_SERIF_FONT, DEFAULT_SANS_SERIF_FONT } from "../shared/lib/constants";
|
||||
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(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);
|
||||
});
|
||||
});
|
||||
}
|
||||
export 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;
|
||||
}
|
||||
export 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);
|
||||
}
|
||||
export function calculateOverrideValues(fontMetrics) {
|
||||
let { category , ascent , descent , lineGap , unitsPerEm } = fontMetrics;
|
||||
const fallbackFont = category === "serif" ? DEFAULT_SERIF_FONT : DEFAULT_SANS_SERIF_FONT;
|
||||
ascent = formatOverrideValue(ascent / unitsPerEm);
|
||||
descent = formatOverrideValue(descent / unitsPerEm);
|
||||
lineGap = formatOverrideValue(lineGap / unitsPerEm);
|
||||
return {
|
||||
ascent,
|
||||
descent,
|
||||
lineGap,
|
||||
fallbackFont: fallbackFont.name
|
||||
};
|
||||
}
|
||||
export function calculateSizeAdjustValues(fontMetrics) {
|
||||
let { category , ascent , descent , lineGap , unitsPerEm , azAvgWidth } = fontMetrics;
|
||||
const fallbackFont = category === "serif" ? DEFAULT_SERIF_FONT : 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}");
|
||||
}
|
||||
`;
|
||||
}
|
||||
export 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/esm/server/font-utils.js.map
generated
vendored
Normal file
1
kitabcitab/node_modules/next/dist/esm/server/font-utils.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
15
kitabcitab/node_modules/next/dist/esm/server/get-app-route-from-entrypoint.js
generated
vendored
Normal file
15
kitabcitab/node_modules/next/dist/esm/server/get-app-route-from-entrypoint.js
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
import matchBundle from "./match-bundle";
|
||||
// matches app/:path*.js
|
||||
const APP_ROUTE_NAME_REGEX = /^app[/\\](.*)$/;
|
||||
export default function getAppRouteFromEntrypoint(entryFile) {
|
||||
const pagePath = matchBundle(APP_ROUTE_NAME_REGEX, entryFile);
|
||||
if (typeof pagePath === "string" && !pagePath) {
|
||||
return "/";
|
||||
}
|
||||
if (!pagePath) {
|
||||
return null;
|
||||
}
|
||||
return pagePath;
|
||||
};
|
||||
|
||||
//# sourceMappingURL=get-app-route-from-entrypoint.js.map
|
||||
1
kitabcitab/node_modules/next/dist/esm/server/get-app-route-from-entrypoint.js.map
generated
vendored
Normal file
1
kitabcitab/node_modules/next/dist/esm/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":["matchBundle","APP_ROUTE_NAME_REGEX","getAppRouteFromEntrypoint","entryFile","pagePath"],"mappings":"AAAA,OAAOA,WAAW,MAAM,gBAAgB,CAAA;AAExC,wBAAwB;AACxB,MAAMC,oBAAoB,mBAAmB;AAE7C,eAAe,SAASC,yBAAyB,CAACC,SAAiB,EAAE;IACnE,MAAMC,QAAQ,GAAGJ,WAAW,CAACC,oBAAoB,EAAEE,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,CAAA"}
|
||||
13
kitabcitab/node_modules/next/dist/esm/server/get-page-files.js
generated
vendored
Normal file
13
kitabcitab/node_modules/next/dist/esm/server/get-page-files.js
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
import { denormalizePagePath } from "../shared/lib/page-path/denormalize-page-path";
|
||||
import { normalizePagePath } from "../shared/lib/page-path/normalize-page-path";
|
||||
export function getPageFiles(buildManifest, page) {
|
||||
const normalizedPage = denormalizePagePath(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/esm/server/get-page-files.js.map
generated
vendored
Normal file
1
kitabcitab/node_modules/next/dist/esm/server/get-page-files.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../server/get-page-files.ts"],"names":["denormalizePagePath","normalizePagePath","getPageFiles","buildManifest","page","normalizedPage","files","pages","console","warn"],"mappings":"AAAA,SAASA,mBAAmB,QAAQ,+CAA+C,CAAA;AACnF,SAASC,iBAAiB,QAAQ,6CAA6C,CAAA;AAe/E,OAAO,SAASC,YAAY,CAC1BC,aAA4B,EAC5BC,IAAY,EACO;IACnB,MAAMC,cAAc,GAAGL,mBAAmB,CAACC,iBAAiB,CAACG,IAAI,CAAC,CAAC;IACnE,IAAIE,KAAK,GAAGH,aAAa,CAACI,KAAK,CAACF,cAAc,CAAC;IAE/C,IAAI,CAACC,KAAK,EAAE;QACVE,OAAO,CAACC,IAAI,CACV,CAAC,yBAAyB,EAAEJ,cAAc,CAAC,6BAA6B,CAAC,CAC1E;QACD,OAAO,EAAE,CAAA;KACV;IAED,OAAOC,KAAK,CAAA;CACb"}
|
||||
20
kitabcitab/node_modules/next/dist/esm/server/get-route-from-entrypoint.js
generated
vendored
Normal file
20
kitabcitab/node_modules/next/dist/esm/server/get-route-from-entrypoint.js
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
import getAppRouteFromEntrypoint from "./get-app-route-from-entrypoint";
|
||||
import matchBundle from "./match-bundle";
|
||||
// matches pages/:page*.js
|
||||
const SERVER_ROUTE_NAME_REGEX = /^pages[/\\](.*)$/;
|
||||
// matches static/pages/:page*.js
|
||||
const BROWSER_ROUTE_NAME_REGEX = /^static[/\\]pages[/\\](.*)$/;
|
||||
export default function getRouteFromEntrypoint(entryFile, app) {
|
||||
let pagePath = matchBundle(SERVER_ROUTE_NAME_REGEX, entryFile);
|
||||
if (pagePath) {
|
||||
return pagePath;
|
||||
}
|
||||
if (app) {
|
||||
pagePath = getAppRouteFromEntrypoint(entryFile);
|
||||
if (pagePath) return pagePath;
|
||||
}
|
||||
// Potentially the passed item is a browser bundle so we try to match that also
|
||||
return matchBundle(BROWSER_ROUTE_NAME_REGEX, entryFile);
|
||||
};
|
||||
|
||||
//# sourceMappingURL=get-route-from-entrypoint.js.map
|
||||
1
kitabcitab/node_modules/next/dist/esm/server/get-route-from-entrypoint.js.map
generated
vendored
Normal file
1
kitabcitab/node_modules/next/dist/esm/server/get-route-from-entrypoint.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../server/get-route-from-entrypoint.ts"],"names":["getAppRouteFromEntrypoint","matchBundle","SERVER_ROUTE_NAME_REGEX","BROWSER_ROUTE_NAME_REGEX","getRouteFromEntrypoint","entryFile","app","pagePath"],"mappings":"AAAA,OAAOA,yBAAyB,MAAM,iCAAiC,CAAA;AACvE,OAAOC,WAAW,MAAM,gBAAgB,CAAA;AAExC,0BAA0B;AAC1B,MAAMC,uBAAuB,qBAAqB;AAElD,iCAAiC;AACjC,MAAMC,wBAAwB,gCAAgC;AAE9D,eAAe,SAASC,sBAAsB,CAC5CC,SAAiB,EACjBC,GAAa,EACE;IACf,IAAIC,QAAQ,GAAGN,WAAW,CAACC,uBAAuB,EAAEG,SAAS,CAAC;IAE9D,IAAIE,QAAQ,EAAE;QACZ,OAAOA,QAAQ,CAAA;KAChB;IAED,IAAID,GAAG,EAAE;QACPC,QAAQ,GAAGP,yBAAyB,CAACK,SAAS,CAAC;QAC/C,IAAIE,QAAQ,EAAE,OAAOA,QAAQ,CAAA;KAC9B;IAED,+EAA+E;IAC/E,OAAON,WAAW,CAACE,wBAAwB,EAAEE,SAAS,CAAC,CAAA;CACxD,CAAA"}
|
||||
15
kitabcitab/node_modules/next/dist/esm/server/htmlescape.js
generated
vendored
Normal file
15
kitabcitab/node_modules/next/dist/esm/server/htmlescape.js
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
// 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"
|
||||
};
|
||||
export const ESCAPE_REGEX = /[&><\u2028\u2029]/g;
|
||||
export function htmlEscapeJsonString(str) {
|
||||
return str.replace(ESCAPE_REGEX, (match)=>ESCAPE_LOOKUP[match]);
|
||||
}
|
||||
|
||||
//# sourceMappingURL=htmlescape.js.map
|
||||
1
kitabcitab/node_modules/next/dist/esm/server/htmlescape.js.map
generated
vendored
Normal file
1
kitabcitab/node_modules/next/dist/esm/server/htmlescape.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../server/htmlescape.ts"],"names":["ESCAPE_LOOKUP","ESCAPE_REGEX","htmlEscapeJsonString","str","replace","match"],"mappings":"AAAA,iEAAiE;AACjE,uGAAuG;AAEvG,MAAMA,aAAa,GAAgC;IACjD,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,SAAS;IACd,QAAQ,EAAE,SAAS;IACnB,QAAQ,EAAE,SAAS;CACpB;AAED,OAAO,MAAMC,YAAY,uBAAuB,CAAA;AAEhD,OAAO,SAASC,oBAAoB,CAACC,GAAW,EAAU;IACxD,OAAOA,GAAG,CAACC,OAAO,CAACH,YAAY,EAAE,CAACI,KAAK,GAAKL,aAAa,CAACK,KAAK,CAAC,CAAC,CAAA;CAClE"}
|
||||
635
kitabcitab/node_modules/next/dist/esm/server/image-optimizer.js
generated
vendored
Normal file
635
kitabcitab/node_modules/next/dist/esm/server/image-optimizer.js
generated
vendored
Normal file
@@ -0,0 +1,635 @@
|
||||
import { mediaType } from "next/dist/compiled/@hapi/accept";
|
||||
import { createHash } from "crypto";
|
||||
import { promises } from "fs";
|
||||
import { getOrientation, Orientation } from "next/dist/compiled/get-orientation";
|
||||
import imageSizeOf from "next/dist/compiled/image-size";
|
||||
import isAnimated from "next/dist/compiled/is-animated";
|
||||
import contentDisposition from "next/dist/compiled/content-disposition";
|
||||
import { join } from "path";
|
||||
import nodeUrl from "url";
|
||||
import { processBuffer, decodeBuffer, getMetadata } from "./lib/squoosh/main";
|
||||
import { sendEtagResponse } from "./send-payload";
|
||||
import { getContentType, getExtension } from "./serve-static";
|
||||
import chalk from "next/dist/compiled/chalk";
|
||||
import { mockRequest } from "./lib/mock-request";
|
||||
import { hasMatch } from "../shared/lib/match-remote-pattern";
|
||||
import { getImageBlurSvg } from "../shared/lib/image-blur-svg";
|
||||
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 = mediaType(accept, options);
|
||||
return accept.includes(mimeType) ? mimeType : "";
|
||||
}
|
||||
export function getHash(items) {
|
||||
const hash = 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 = 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 (promises.rm) {
|
||||
await promises.rm(dir, {
|
||||
force: true,
|
||||
recursive: true
|
||||
}).catch(()=>{});
|
||||
} else {
|
||||
await promises.rmdir(dir, {
|
||||
recursive: true
|
||||
}).catch(()=>{});
|
||||
}
|
||||
await promises.mkdir(dir, {
|
||||
recursive: true
|
||||
});
|
||||
await promises.writeFile(filename, buffer);
|
||||
}
|
||||
/**
|
||||
* 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 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;
|
||||
}
|
||||
export 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 (!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 = join(distDir, "cache", "images");
|
||||
this.nextConfig = nextConfig;
|
||||
}
|
||||
async get(cacheKey) {
|
||||
try {
|
||||
const cacheDir = join(this.cacheDir, cacheKey);
|
||||
const files = await promises.readdir(cacheDir);
|
||||
const now = Date.now();
|
||||
for (const file of files){
|
||||
const [maxAgeSt, expireAtSt, etag, extension] = file.split(".");
|
||||
const buffer = await promises.readFile(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(join(this.cacheDir, cacheKey), value.extension, revalidate, expireAt, value.buffer, value.etag);
|
||||
} catch (err) {
|
||||
console.error(`Failed to write image to cache ${cacheKey}`, err);
|
||||
}
|
||||
}
|
||||
}
|
||||
export 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
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;
|
||||
}
|
||||
export 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;
|
||||
}
|
||||
export 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.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.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 getOrientation(buffer);
|
||||
const operations = [];
|
||||
if (orientation === Orientation.RIGHT_TOP) {
|
||||
operations.push({
|
||||
type: "rotate",
|
||||
numRotations: 1
|
||||
});
|
||||
} else if (orientation === Orientation.BOTTOM_RIGHT) {
|
||||
operations.push({
|
||||
type: "rotate",
|
||||
numRotations: 2
|
||||
});
|
||||
} else if (orientation === 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 processBuffer(buffer, operations, "avif", quality);
|
||||
} else if (contentType === WEBP) {
|
||||
optimizedBuffer = await processBuffer(buffer, operations, "webp", quality);
|
||||
} else if (contentType === PNG) {
|
||||
optimizedBuffer = await processBuffer(buffer, operations, "png", quality);
|
||||
} else if (contentType === JPEG) {
|
||||
optimizedBuffer = await processBuffer(buffer, operations, "jpeg", quality);
|
||||
}
|
||||
}
|
||||
return optimizedBuffer;
|
||||
}
|
||||
export 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 , } = mockRequest(href, _req.headers, _req.method || "GET", _req.connection);
|
||||
await handleRequest(mockReq, mockRes, nodeUrl.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) && isAnimated(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/")) && 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 getMetadata(optimizedBuffer);
|
||||
const opts = {
|
||||
blurWidth: meta.width,
|
||||
blurHeight: meta.height,
|
||||
blurDataURL: `data:${contentType};base64,${optimizedBuffer.toString("base64")}`
|
||||
};
|
||||
optimizedBuffer = Buffer.from(unescape(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 = 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 (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", contentDisposition(fileName, {
|
||||
type: "inline"
|
||||
}));
|
||||
}
|
||||
if (contentSecurityPolicy) {
|
||||
res.setHeader("Content-Security-Policy", contentSecurityPolicy);
|
||||
}
|
||||
res.setHeader("X-Nextjs-Cache", xCache);
|
||||
return {
|
||||
finished: false
|
||||
};
|
||||
}
|
||||
export function sendResponse(req, res, url, extension, buffer, isStatic, xCache, contentSecurityPolicy, maxAge, isDev) {
|
||||
const contentType = 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);
|
||||
}
|
||||
}
|
||||
export 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 decodeBuffer(buffer);
|
||||
return {
|
||||
width,
|
||||
height
|
||||
};
|
||||
}
|
||||
}
|
||||
const { width , height } = imageSizeOf(buffer);
|
||||
return {
|
||||
width,
|
||||
height
|
||||
};
|
||||
}
|
||||
export class Deferred {
|
||||
constructor(){
|
||||
this.promise = new Promise((resolve, reject)=>{
|
||||
this.resolve = resolve;
|
||||
this.reject = reject;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
//# sourceMappingURL=image-optimizer.js.map
|
||||
1
kitabcitab/node_modules/next/dist/esm/server/image-optimizer.js.map
generated
vendored
Normal file
1
kitabcitab/node_modules/next/dist/esm/server/image-optimizer.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
8
kitabcitab/node_modules/next/dist/esm/server/initialize-require-hook.js
generated
vendored
Normal file
8
kitabcitab/node_modules/next/dist/esm/server/initialize-require-hook.js
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
import { loadRequireHook, overrideBuiltInReactPackages } from "../build/webpack/require-hook";
|
||||
loadRequireHook();
|
||||
const isPrebundled = false;
|
||||
if (isPrebundled) {
|
||||
overrideBuiltInReactPackages();
|
||||
}
|
||||
|
||||
//# sourceMappingURL=initialize-require-hook.js.map
|
||||
1
kitabcitab/node_modules/next/dist/esm/server/initialize-require-hook.js.map
generated
vendored
Normal file
1
kitabcitab/node_modules/next/dist/esm/server/initialize-require-hook.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../server/initialize-require-hook.ts"],"names":["loadRequireHook","overrideBuiltInReactPackages","isPrebundled"],"mappings":"AAAA,SACEA,eAAe,EACfC,4BAA4B,QACvB,+BAA+B,CAAA;AAEtCD,eAAe,EAAE;AAEjB,MAAME,YAAY,GAAG,KAAK;AAE1B,IAAIA,YAAY,EAAE;IAChBD,4BAA4B,EAAE;CAC/B"}
|
||||
27
kitabcitab/node_modules/next/dist/esm/server/internal-utils.js
generated
vendored
Normal file
27
kitabcitab/node_modules/next/dist/esm/server/internal-utils.js
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
const INTERNAL_QUERY_NAMES = [
|
||||
"__nextFallback",
|
||||
"__nextLocale",
|
||||
"__nextDefaultLocale",
|
||||
"__nextIsNotFound",
|
||||
];
|
||||
const EXTENDED_INTERNAL_QUERY_NAMES = [
|
||||
"__nextDataReq"
|
||||
];
|
||||
export function stripInternalQueries(query) {
|
||||
for (const name of INTERNAL_QUERY_NAMES){
|
||||
delete query[name];
|
||||
}
|
||||
}
|
||||
export 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/esm/server/internal-utils.js.map
generated
vendored
Normal file
1
kitabcitab/node_modules/next/dist/esm/server/internal-utils.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../server/internal-utils.ts"],"names":["INTERNAL_QUERY_NAMES","EXTENDED_INTERNAL_QUERY_NAMES","stripInternalQueries","query","name","stripInternalSearchParams","searchParams","extended","delete"],"mappings":"AAEA,MAAMA,oBAAoB,GAAG;IAC3B,gBAAgB;IAChB,cAAc;IACd,qBAAqB;IACrB,kBAAkB;CACnB,AAAS;AAEV,MAAMC,6BAA6B,GAAG;IAAC,eAAe;CAAC,AAAS;AAEhE,OAAO,SAASC,oBAAoB,CAACC,KAAyB,EAAE;IAC9D,KAAK,MAAMC,IAAI,IAAIJ,oBAAoB,CAAE;QACvC,OAAOG,KAAK,CAACC,IAAI,CAAC;KACnB;CACF;AAED,OAAO,SAASC,yBAAyB,CACvCC,YAA6B,EAC7BC,QAAkB,EAClB;IACA,KAAK,MAAMH,IAAI,IAAIJ,oBAAoB,CAAE;QACvCM,YAAY,CAACE,MAAM,CAACJ,IAAI,CAAC;KAC1B;IAED,IAAIG,QAAQ,EAAE;QACZ,KAAK,MAAMH,IAAI,IAAIH,6BAA6B,CAAE;YAChDK,YAAY,CAACE,MAAM,CAACJ,IAAI,CAAC;SAC1B;KACF;IAED,OAAOE,YAAY,CAAA;CACpB"}
|
||||
34
kitabcitab/node_modules/next/dist/esm/server/lib/etag.js
generated
vendored
Normal file
34
kitabcitab/node_modules/next/dist/esm/server/lib/etag.js
generated
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
/**
|
||||
* 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 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);
|
||||
};
|
||||
export const generateETag = (payload, weak = false)=>{
|
||||
const prefix = weak ? 'W/"' : '"';
|
||||
return prefix + fnv1a52(payload).toString(36) + payload.length.toString(36) + '"';
|
||||
};
|
||||
|
||||
//# sourceMappingURL=etag.js.map
|
||||
1
kitabcitab/node_modules/next/dist/esm/server/lib/etag.js.map
generated
vendored
Normal file
1
kitabcitab/node_modules/next/dist/esm/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":"AAAA;;;;;;;;GAQG,CACH,OAAO,MAAMA,OA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ACe,OAAO,CAAC,CAACG,QAAQ,CAAC,EAAE,CAAC,GAAGH,OAAO,CAACZ,MAAM,CAACe,QAAQ,CAAC,EAAE,CAAC,GAAG,GAAG,CAC3E;CACF,CAAA"}
|
||||
48
kitabcitab/node_modules/next/dist/esm/server/lib/find-page-file.js
generated
vendored
Normal file
48
kitabcitab/node_modules/next/dist/esm/server/lib/find-page-file.js
generated
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
import { fileExists } from "../../lib/file-exists";
|
||||
import { getPagePaths } from "../../shared/lib/page-path/get-page-paths";
|
||||
import { nonNullable } from "../../lib/non-nullable";
|
||||
import { join, sep, normalize } from "path";
|
||||
import { promises } from "fs";
|
||||
import { warn } from "../../build/output/log";
|
||||
import chalk from "../../lib/chalk";
|
||||
async function isTrueCasePagePath(pagePath, pagesDir) {
|
||||
const pageSegments = normalize(pagePath).split(sep).filter(Boolean);
|
||||
const segmentExistsPromises = pageSegments.map(async (segment, i)=>{
|
||||
const segmentParentDir = join(pagesDir, ...pageSegments.slice(0, i));
|
||||
const parentDirEntries = await promises.readdir(segmentParentDir);
|
||||
return parentDirEntries.includes(segment);
|
||||
});
|
||||
return (await Promise.all(segmentExistsPromises)).every(Boolean);
|
||||
}
|
||||
/**
|
||||
* 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 async function findPageFile(pagesDir, normalizedPagePath, pageExtensions, isAppDir) {
|
||||
const pagePaths = getPagePaths(normalizedPagePath, pageExtensions, isAppDir);
|
||||
const [existingPath, ...others] = (await Promise.all(pagePaths.map(async (path)=>{
|
||||
const filePath = join(pagesDir, path);
|
||||
return await fileExists(filePath) ? path : null;
|
||||
}))).filter(nonNullable);
|
||||
if (!existingPath) {
|
||||
return null;
|
||||
}
|
||||
if (!await isTrueCasePagePath(existingPath, pagesDir)) {
|
||||
return null;
|
||||
}
|
||||
if (others.length > 0) {
|
||||
warn(`Duplicate page detected. ${chalk.cyan(join("pages", existingPath))} and ${chalk.cyan(join("pages", others[0]))} both resolve to ${chalk.cyan(normalizedPagePath)}.`);
|
||||
}
|
||||
return existingPath;
|
||||
}
|
||||
// Determine if the file is leaf node page file under layouts,
|
||||
// The filename should start with 'page' and end with one of the allowed extensions
|
||||
export 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/esm/server/lib/find-page-file.js.map
generated
vendored
Normal file
1
kitabcitab/node_modules/next/dist/esm/server/lib/find-page-file.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../server/lib/find-page-file.ts"],"names":["fileExists","getPagePaths","nonNullable","join","sep","normalize","promises","warn","chalk","isTrueCasePagePath","pagePath","pagesDir","pageSegments","split","filter","Boolean","segmentExistsPromises","map","segment","i","segmentParentDir","slice","parentDirEntries","readdir","includes","Promise","all","every","findPageFile","normalizedPagePath","pageExtensions","isAppDir","pagePaths","existingPath","others","path","filePath","length","cyan","isLayoutsLeafPage","RegExp","test"],"mappings":"AAAA,SAASA,UAAU,QAAQ,uBAAuB,CAAA;AAClD,SAASC,YAAY,QAAQ,2CAA2C,CAAA;AACxE,SAASC,WAAW,QAAQ,wBAAwB,CAAA;AACpD,SAASC,IAAI,EAAEC,GAAG,EAAEC,SAAS,QAAQ,MAAM,CAAA;AAC3C,SAASC,QAAQ,QAAQ,IAAI,CAAA;AAC7B,SAASC,IAAI,QAAQ,wBAAwB,CAAA;AAC7C,OAAOC,KAAK,MAAM,iBAAiB,CAAA;AAEnC,eAAeC,kBAAkB,CAACC,QAAgB,EAAE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,YAAY,EAAEtB,QAAQ,CAAC,AAAC,EAAE;QACvD,OAAO,IAAI,CAAA;KACZ;IAED,IAAIuB,MAAM,CAACG,MAAM,GAAG,CAAC,EAAE;QACrB9B,IAAI,CACF,CAAC,yBAAyB,EAAEC,KAAK,CAAC8B,IAAI,CACpCnC,IAAI,CAAC,OAAO,EAAE8B,YAAY,CAAC,CAC5B,CAAC,KAAK,EAAEzB,KAAK,CAAC8B,IAAI,CACjBnC,IAAI,CAAC,OAAO,EAAE+B,MAAM,CAAC,CAAC,CAAC,CAAC,CACzB,CAAC,iBAAiB,EAAE1B,KAAK,CAAC8B,IAAI,CAACT,kBAAkB,CAAC,CAAC,CAAC,CAAC,CACvD;KACF;IAED,OAAOI,YAAY,CAAA;CACpB;AAED,8DAA8D;AAC9D,mFAAmF;AACnF,OAAO,SAASM,iBAAiB,CAACH,QAAgB,EAAEN,cAAwB,EAAE;IAC5E,OAAO,IAAIU,MAAM,CACf,CAAC,yBAAyB,EAAEV,cAAc,CAAC3B,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CACzD,CAACsC,IAAI,CAACL,QAAQ,CAAC,CAAA;CACjB"}
|
||||
123
kitabcitab/node_modules/next/dist/esm/server/lib/incremental-cache/fetch-cache.js
generated
vendored
Normal file
123
kitabcitab/node_modules/next/dist/esm/server/lib/incremental-cache/fetch-cache.js
generated
vendored
Normal file
@@ -0,0 +1,123 @@
|
||||
import LRUCache from "next/dist/compiled/lru-cache";
|
||||
import { FETCH_CACHE_HEADER } from "../../../client/components/app-router-headers";
|
||||
let memoryCache;
|
||||
export default class FetchCache {
|
||||
constructor(ctx){
|
||||
if (ctx.maxMemoryCacheSize && !memoryCache) {
|
||||
memoryCache = new LRUCache({
|
||||
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 (FETCH_CACHE_HEADER in ctx._requestHeaders) {
|
||||
const newHeaders = JSON.parse(ctx._requestHeaders[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;
|
||||
}
|
||||
};
|
||||
|
||||
//# sourceMappingURL=fetch-cache.js.map
|
||||
1
kitabcitab/node_modules/next/dist/esm/server/lib/incremental-cache/fetch-cache.js.map
generated
vendored
Normal file
1
kitabcitab/node_modules/next/dist/esm/server/lib/incremental-cache/fetch-cache.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
130
kitabcitab/node_modules/next/dist/esm/server/lib/incremental-cache/file-system-cache.js
generated
vendored
Normal file
130
kitabcitab/node_modules/next/dist/esm/server/lib/incremental-cache/file-system-cache.js
generated
vendored
Normal file
@@ -0,0 +1,130 @@
|
||||
import LRUCache from "next/dist/compiled/lru-cache";
|
||||
import path from "../../../shared/lib/isomorphic/path";
|
||||
let memoryCache;
|
||||
export default 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({
|
||||
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.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.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.join(this.serverDistDir, "..", "cache", "fetch-cache", pathname),
|
||||
isAppPath: false
|
||||
};
|
||||
}
|
||||
let isAppPath = false;
|
||||
let filePath = path.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.join(this.serverDistDir, "app", pathname),
|
||||
isAppPath: true
|
||||
};
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
//# sourceMappingURL=file-system-cache.js.map
|
||||
1
kitabcitab/node_modules/next/dist/esm/server/lib/incremental-cache/file-system-cache.js.map
generated
vendored
Normal file
1
kitabcitab/node_modules/next/dist/esm/server/lib/incremental-cache/file-system-cache.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
161
kitabcitab/node_modules/next/dist/esm/server/lib/incremental-cache/index.js
generated
vendored
Normal file
161
kitabcitab/node_modules/next/dist/esm/server/lib/incremental-cache/index.js
generated
vendored
Normal file
@@ -0,0 +1,161 @@
|
||||
import FileSystemCache from "./file-system-cache";
|
||||
import path from "../../../shared/lib/isomorphic/path";
|
||||
import { normalizePagePath } from "../../../shared/lib/page-path/normalize-page-path";
|
||||
import FetchCache from "./fetch-cache";
|
||||
function toRoute(pathname) {
|
||||
return pathname.replace(/\/$/, "").replace(/\/index$/, "") || "/";
|
||||
}
|
||||
export class CacheHandler {
|
||||
// eslint-disable-next-line
|
||||
constructor(_ctx){}
|
||||
async get(_key, _fetchCache) {
|
||||
return {};
|
||||
}
|
||||
async set(_key, _data, _fetchCache) {}
|
||||
}
|
||||
export class IncrementalCache {
|
||||
constructor({ fs , dev , appDir , flushToDisk , fetchCache , minimalMode , serverDistDir , requestHeaders , maxMemoryCacheSize , getPrerenderManifest , incrementalCacheHandlerPath }){
|
||||
let cacheHandlerMod = FileSystemCache;
|
||||
if (process.env.NEXT_RUNTIME !== "edge" && incrementalCacheHandlerPath) {
|
||||
cacheHandlerMod = require(incrementalCacheHandlerPath);
|
||||
cacheHandlerMod = cacheHandlerMod.default || cacheHandlerMod;
|
||||
}
|
||||
if (minimalMode && fetchCache) {
|
||||
cacheHandlerMod = FetchCache;
|
||||
}
|
||||
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 : 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.posix.join("/_next/data", `${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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
kitabcitab/node_modules/next/dist/esm/server/lib/incremental-cache/index.js.map
generated
vendored
Normal file
1
kitabcitab/node_modules/next/dist/esm/server/lib/incremental-cache/index.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
52
kitabcitab/node_modules/next/dist/esm/server/lib/mock-request.js
generated
vendored
Normal file
52
kitabcitab/node_modules/next/dist/esm/server/lib/mock-request.js
generated
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
import Stream from "stream";
|
||||
export function mockRequest(requestUrl, requestHeaders, requestMethod, requestConnection) {
|
||||
const resBuffers = [];
|
||||
const mockRes = new Stream.Writable();
|
||||
const isStreamFinished = new Promise(function(resolve, reject) {
|
||||
mockRes.on("finish", ()=>resolve(true));
|
||||
mockRes.on("end", ()=>resolve(true));
|
||||
mockRes.on("error", (err)=>reject(err));
|
||||
});
|
||||
mockRes.write = (chunk)=>{
|
||||
resBuffers.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
|
||||
};
|
||||
mockRes._write = (chunk, _encoding, callback)=>{
|
||||
mockRes.write(chunk);
|
||||
// According to Node.js documentation, the callback MUST be invoked to signal that
|
||||
// the write completed successfully. If this callback is not invoked, the 'finish' event
|
||||
// will not be emitted.
|
||||
// https://nodejs.org/docs/latest-v16.x/api/stream.html#writable_writechunk-encoding-callback
|
||||
callback();
|
||||
};
|
||||
const mockHeaders = {};
|
||||
mockRes.writeHead = (_status, _headers)=>Object.assign(mockHeaders, _headers);
|
||||
mockRes.getHeader = (name)=>mockHeaders[name.toLowerCase()];
|
||||
mockRes.getHeaders = ()=>mockHeaders;
|
||||
mockRes.getHeaderNames = ()=>Object.keys(mockHeaders);
|
||||
mockRes.setHeader = (name, value)=>mockHeaders[name.toLowerCase()] = value;
|
||||
mockRes.removeHeader = (name)=>{
|
||||
delete mockHeaders[name.toLowerCase()];
|
||||
};
|
||||
mockRes._implicitHeader = ()=>{};
|
||||
mockRes.connection = requestConnection;
|
||||
mockRes.finished = false;
|
||||
mockRes.statusCode = 200;
|
||||
const mockReq = new Stream.Readable();
|
||||
mockReq._read = ()=>{
|
||||
mockReq.emit("end");
|
||||
mockReq.emit("close");
|
||||
return Buffer.from("");
|
||||
};
|
||||
mockReq.headers = requestHeaders;
|
||||
mockReq.method = requestMethod;
|
||||
mockReq.url = requestUrl;
|
||||
mockReq.connection = requestConnection;
|
||||
return {
|
||||
resBuffers,
|
||||
req: mockReq,
|
||||
res: mockRes,
|
||||
streamPromise: isStreamFinished
|
||||
};
|
||||
}
|
||||
|
||||
//# sourceMappingURL=mock-request.js.map
|
||||
1
kitabcitab/node_modules/next/dist/esm/server/lib/mock-request.js.map
generated
vendored
Normal file
1
kitabcitab/node_modules/next/dist/esm/server/lib/mock-request.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../server/lib/mock-request.ts"],"names":["Stream","mockRequest","requestUrl","requestHeaders","requestMethod","requestConnection","resBuffers","mockRes","Writable","isStreamFinished","Promise","resolve","reject","on","err","write","chunk","push","Buffer","isBuffer","from","_write","_encoding","callback","mockHeaders","writeHead","_status","_headers","Object","assign","getHeader","name","toLowerCase","getHeaders","getHeaderNames","keys","setHeader","value","removeHeader","_implicitHeader","connection","finished","statusCode","mockReq","Readable","_read","emit","headers","method","url","req","res","streamPromise"],"mappings":"AAAA,OAAOA,MAAM,MAAM,QAAQ,CAAA;AAE3B,OAAO,SAASC,WAAW,CACzBC,UAAkB,EAClBC,cAA6D,EAC7DC,aAAqB,EACrBC,iBAAuB,EACvB;IACA,MAAMC,UAAU,GAAa,EAAE;IAC/B,MAAMC,OAAO,GAAQ,IAAIP,MAAM,CAACQ,QAAQ,EAAE;IAE1C,MAAMC,gBAAgB,GAAG,IAAIC,OAAO,CAAC,SAAUC,OAAO,EAAEC,MAAM,EAAE;QAC9DL,OAAO,CAACM,EAAE,CAAC,QAAQ,EAAE,IAAMF,OAAO,CAAC,IAAI,CAAC,CAAC;QACzCJ,OAAO,CAACM,EAAE,CAAC,KAAK,EAAE,IAAMF,OAAO,CAAC,IAAI,CAAC,CAAC;QACtCJ,OAAO,CAACM,EAAE,CAAC,OAAO,EAAE,CAACC,GAAQ,GAAKF,MAAM,CAACE,GAAG,CAAC,CAAC;KAC/C,CAAC;IAEFP,OAAO,CAACQ,KAAK,GAAG,CAACC,KAAsB,GAAK;QAC1CV,UAAU,CAACW,IAAI,CAACC,MAAM,CAACC,QAAQ,CAACH,KAAK,CAAC,GAAGA,KAAK,GAAGE,MAAM,CAACE,IAAI,CAACJ,KAAK,CAAC,CAAC;KACrE;IACDT,OAAO,CAACc,MAAM,GAAG,CACfL,KAAsB,EACtBM,SAAiB,EACjBC,QAAoB,GACjB;QACHhB,OAAO,CAACQ,KAAK,CAACC,KAAK,CAAC;QACpB,kFAAkF;QAClF,wFAAwF;QACxF,uBA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AGnC,iBAAiB;IAEtC,OAAO;QACLC,UAAU;QACV4C,GAAG,EAAEP,OAAO;QACZQ,GAAG,EAAE5C,OAAO;QACZ6C,aAAa,EAAE3C,gBAAgB;KAChC,CAAA;CACF"}
|
||||
20
kitabcitab/node_modules/next/dist/esm/server/lib/recursive-readdir-sync.js
generated
vendored
Normal file
20
kitabcitab/node_modules/next/dist/esm/server/lib/recursive-readdir-sync.js
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
import fs from "fs";
|
||||
import { join } from "path";
|
||||
/**
|
||||
* Recursively read directory
|
||||
* Returns array holding all relative paths
|
||||
*/ export function recursiveReadDirSync(/** The directory to read */ dir, /** This doesn't have to be provided, it's used for the recursion */ arr = [], /** Used to replace the initial path, only the relative path is left, it's faster than path.relative. */ rootDir = dir) {
|
||||
const result = fs.readdirSync(dir);
|
||||
result.forEach((part)=>{
|
||||
const absolutePath = join(dir, part);
|
||||
const pathStat = fs.statSync(absolutePath);
|
||||
if (pathStat.isDirectory()) {
|
||||
recursiveReadDirSync(absolutePath, arr, rootDir);
|
||||
return;
|
||||
}
|
||||
arr.push(absolutePath.replace(rootDir, ""));
|
||||
});
|
||||
return arr;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=recursive-readdir-sync.js.map
|
||||
1
kitabcitab/node_modules/next/dist/esm/server/lib/recursive-readdir-sync.js.map
generated
vendored
Normal file
1
kitabcitab/node_modules/next/dist/esm/server/lib/recursive-readdir-sync.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../server/lib/recursive-readdir-sync.ts"],"names":["fs","join","recursiveReadDirSync","dir","arr","rootDir","result","readdirSync","forEach","part","absolutePath","pathStat","statSync","isDirectory","push","replace"],"mappings":"AAAA,OAAOA,EAAE,MAAM,IAAI,CAAA;AACnB,SAASC,IAAI,QAAQ,MAAM,CAAA;AAE3B;;;GAGG,CACH,OAAO,SAASC,oBAAoB,CAClC,4BAA4B,CAC5BC,GAAW,EACX,oEAAoE,CACpEC,GAAa,GAAG,EAAE,EAClB,wGAAwG,CACxGC,OAAO,GAAGF,GAAG,EACH;IACV,MAAMG,MAAM,GAAGN,EAAE,CAACO,WAAW,CAACJ,GAAG,CAAC;IAElCG,MAAM,CAACE,OAAO,CAAC,CAACC,IAAY,GAAK;QAC/B,MAAMC,YAAY,GAAGT,IAAI,CAACE,GAAG,EAAEM,IAAI,CAAC;QACpC,MAAME,QAAQ,GAAGX,EAAE,CAACY,QAAQ,CAACF,YAAY,CAAC;QAE1C,IAAIC,QAAQ,CAACE,WAAW,EAAE,EAAE;YAC1BX,oBAAoB,CAACQ,YAAY,EAAEN,GAAG,EAAEC,OAAO,CAAC;YAChD,OAAM;SACP;QACDD,GAAG,CAACU,IAAI,CAACJ,YAAY,CAACK,OAAO,CAACV,OAAO,EAAE,EAAE,CAAC,CAAC;KAC5C,CAAC;IAEF,OAAOD,GAAG,CAAA;CACX"}
|
||||
32
kitabcitab/node_modules/next/dist/esm/server/lib/squoosh/avif/avif_enc.d.ts
generated
vendored
Normal file
32
kitabcitab/node_modules/next/dist/esm/server/lib/squoosh/avif/avif_enc.d.ts
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
// eslint-disable-next-line no-shadow
|
||||
export const enum AVIFTune {
|
||||
auto,
|
||||
psnr,
|
||||
ssim,
|
||||
}
|
||||
|
||||
export interface EncodeOptions {
|
||||
cqLevel: number
|
||||
denoiseLevel: number
|
||||
cqAlphaLevel: number
|
||||
tileRowsLog2: number
|
||||
tileColsLog2: number
|
||||
speed: number
|
||||
subsample: number
|
||||
chromaDeltaQ: boolean
|
||||
sharpness: number
|
||||
tune: AVIFTune
|
||||
}
|
||||
|
||||
export interface AVIFModule extends EmscriptenWasm.Module {
|
||||
encode(
|
||||
data: BufferSource,
|
||||
width: number,
|
||||
height: number,
|
||||
options: EncodeOptions
|
||||
): Uint8Array
|
||||
}
|
||||
|
||||
declare var moduleFactory: EmscriptenWasm.ModuleFactory<AVIFModule>
|
||||
|
||||
export default moduleFactory
|
||||
1522
kitabcitab/node_modules/next/dist/esm/server/lib/squoosh/avif/avif_node_dec.js
generated
vendored
Normal file
1522
kitabcitab/node_modules/next/dist/esm/server/lib/squoosh/avif/avif_node_dec.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1
kitabcitab/node_modules/next/dist/esm/server/lib/squoosh/avif/avif_node_dec.js.map
generated
vendored
Normal file
1
kitabcitab/node_modules/next/dist/esm/server/lib/squoosh/avif/avif_node_dec.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
1711
kitabcitab/node_modules/next/dist/esm/server/lib/squoosh/avif/avif_node_enc.js
generated
vendored
Normal file
1711
kitabcitab/node_modules/next/dist/esm/server/lib/squoosh/avif/avif_node_enc.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1
kitabcitab/node_modules/next/dist/esm/server/lib/squoosh/avif/avif_node_enc.js.map
generated
vendored
Normal file
1
kitabcitab/node_modules/next/dist/esm/server/lib/squoosh/avif/avif_node_enc.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
272
kitabcitab/node_modules/next/dist/esm/server/lib/squoosh/codecs.js
generated
vendored
Normal file
272
kitabcitab/node_modules/next/dist/esm/server/lib/squoosh/codecs.js
generated
vendored
Normal file
@@ -0,0 +1,272 @@
|
||||
import { promises as fsp } from "fs";
|
||||
import * as path from "path";
|
||||
import { instantiateEmscriptenWasm, pathify } from "./emscripten-utils.js";
|
||||
// @ts-ignore
|
||||
import mozEnc from "./mozjpeg/mozjpeg_node_enc.js";
|
||||
const mozEncWasm = path.resolve(__dirname, "./mozjpeg/mozjpeg_node_enc.wasm");
|
||||
// @ts-ignore
|
||||
import mozDec from "./mozjpeg/mozjpeg_node_dec.js";
|
||||
const mozDecWasm = path.resolve(__dirname, "./mozjpeg/mozjpeg_node_dec.wasm");
|
||||
// @ts-ignore
|
||||
import webpEnc from "./webp/webp_node_enc.js";
|
||||
const webpEncWasm = path.resolve(__dirname, "./webp/webp_node_enc.wasm");
|
||||
// @ts-ignore
|
||||
import webpDec from "./webp/webp_node_dec.js";
|
||||
const webpDecWasm = path.resolve(__dirname, "./webp/webp_node_dec.wasm");
|
||||
// @ts-ignore
|
||||
import avifEnc from "./avif/avif_node_enc.js";
|
||||
const avifEncWasm = path.resolve(__dirname, "./avif/avif_node_enc.wasm");
|
||||
// @ts-ignore
|
||||
import avifDec from "./avif/avif_node_dec.js";
|
||||
const avifDecWasm = path.resolve(__dirname, "./avif/avif_node_dec.wasm");
|
||||
// PNG
|
||||
// @ts-ignore
|
||||
import * as pngEncDec from "./png/squoosh_png.js";
|
||||
const pngEncDecWasm = path.resolve(__dirname, "./png/squoosh_png_bg.wasm");
|
||||
const pngEncDecInit = ()=>pngEncDec.default(fsp.readFile(pathify(pngEncDecWasm)));
|
||||
// OxiPNG
|
||||
// @ts-ignore
|
||||
import * as oxipng from "./png/squoosh_oxipng.js";
|
||||
const oxipngWasm = path.resolve(__dirname, "./png/squoosh_oxipng_bg.wasm");
|
||||
const oxipngInit = ()=>oxipng.default(fsp.readFile(pathify(oxipngWasm)));
|
||||
// Resize
|
||||
// @ts-ignore
|
||||
import * as resize from "./resize/squoosh_resize.js";
|
||||
const resizeWasm = path.resolve(__dirname, "./resize/squoosh_resize_bg.wasm");
|
||||
const resizeInit = ()=>resize.default(fsp.readFile(pathify(resizeWasm)));
|
||||
// rotate
|
||||
const rotateWasm = path.resolve(__dirname, "./rotate/rotate.wasm");
|
||||
// Our decoders currently rely on a `ImageData` global.
|
||||
import ImageData from "./image_data";
|
||||
globalThis.ImageData = ImageData;
|
||||
function resizeNameToIndex(name) {
|
||||
switch(name){
|
||||
case "triangle":
|
||||
return 0;
|
||||
case "catrom":
|
||||
return 1;
|
||||
case "mitchell":
|
||||
return 2;
|
||||
case "lanczos3":
|
||||
return 3;
|
||||
default:
|
||||
throw Error(`Unknown resize algorithm "${name}"`);
|
||||
}
|
||||
}
|
||||
function resizeWithAspect({ input_width , input_height , target_width , target_height }) {
|
||||
if (!target_width && !target_height) {
|
||||
throw Error("Need to specify at least width or height when resizing");
|
||||
}
|
||||
if (target_width && target_height) {
|
||||
return {
|
||||
width: target_width,
|
||||
height: target_height
|
||||
};
|
||||
}
|
||||
if (!target_width) {
|
||||
return {
|
||||
width: Math.round(input_width / input_height * target_height),
|
||||
height: target_height
|
||||
};
|
||||
}
|
||||
return {
|
||||
width: target_width,
|
||||
height: Math.round(input_height / input_width * target_width)
|
||||
};
|
||||
}
|
||||
export const preprocessors = {
|
||||
resize: {
|
||||
name: "Resize",
|
||||
description: "Resize the image before compressing",
|
||||
instantiate: async ()=>{
|
||||
await resizeInit();
|
||||
return (buffer, input_width, input_height, { width , height , method , premultiply , linearRGB })=>{
|
||||
({ width , height } = resizeWithAspect({
|
||||
input_width,
|
||||
input_height,
|
||||
target_width: width,
|
||||
target_height: height
|
||||
}));
|
||||
const imageData = new ImageData(resize.resize(buffer, input_width, input_height, width, height, resizeNameToIndex(method), premultiply, linearRGB), width, height);
|
||||
resize.cleanup();
|
||||
return imageData;
|
||||
};
|
||||
},
|
||||
defaultOptions: {
|
||||
method: "lanczos3",
|
||||
fitMethod: "stretch",
|
||||
premultiply: true,
|
||||
linearRGB: true
|
||||
}
|
||||
},
|
||||
rotate: {
|
||||
name: "Rotate",
|
||||
description: "Rotate image",
|
||||
instantiate: async ()=>{
|
||||
return async (buffer, width, height, { numRotations })=>{
|
||||
const degrees = numRotations * 90 % 360;
|
||||
const sameDimensions = degrees === 0 || degrees === 180;
|
||||
const size = width * height * 4;
|
||||
const instance = (await WebAssembly.instantiate(await fsp.readFile(pathify(rotateWasm)))).instance;
|
||||
const { memory } = instance.exports;
|
||||
const additionalPagesNeeded = Math.ceil((size * 2 - memory.buffer.byteLength + 8) / (64 * 1024));
|
||||
if (additionalPagesNeeded > 0) {
|
||||
memory.grow(additionalPagesNeeded);
|
||||
}
|
||||
const view = new Uint8ClampedArray(memory.buffer);
|
||||
view.set(buffer, 8);
|
||||
instance.exports.rotate(width, height, degrees);
|
||||
return new ImageData(view.slice(size + 8, size * 2 + 8), sameDimensions ? width : height, sameDimensions ? height : width);
|
||||
};
|
||||
},
|
||||
defaultOptions: {
|
||||
numRotations: 0
|
||||
}
|
||||
}
|
||||
};
|
||||
export const codecs = {
|
||||
mozjpeg: {
|
||||
name: "MozJPEG",
|
||||
extension: "jpg",
|
||||
detectors: [
|
||||
/^\xFF\xD8\xFF/
|
||||
],
|
||||
dec: ()=>instantiateEmscriptenWasm(mozDec, mozDecWasm),
|
||||
enc: ()=>instantiateEmscriptenWasm(mozEnc, mozEncWasm),
|
||||
defaultEncoderOptions: {
|
||||
quality: 75,
|
||||
baseline: false,
|
||||
arithmetic: false,
|
||||
progressive: true,
|
||||
optimize_coding: true,
|
||||
smoothing: 0,
|
||||
color_space: 3 /*YCbCr*/ ,
|
||||
quant_table: 3,
|
||||
trellis_multipass: false,
|
||||
trellis_opt_zero: false,
|
||||
trellis_opt_table: false,
|
||||
trellis_loops: 1,
|
||||
auto_subsample: true,
|
||||
chroma_subsample: 2,
|
||||
separate_chroma_quality: false,
|
||||
chroma_quality: 75
|
||||
},
|
||||
autoOptimize: {
|
||||
option: "quality",
|
||||
min: 0,
|
||||
max: 100
|
||||
}
|
||||
},
|
||||
webp: {
|
||||
name: "WebP",
|
||||
extension: "webp",
|
||||
detectors: [
|
||||
/^RIFF....WEBPVP8[LX ]/s
|
||||
],
|
||||
dec: ()=>instantiateEmscriptenWasm(webpDec, webpDecWasm),
|
||||
enc: ()=>instantiateEmscriptenWasm(webpEnc, webpEncWasm),
|
||||
defaultEncoderOptions: {
|
||||
quality: 75,
|
||||
target_size: 0,
|
||||
target_PSNR: 0,
|
||||
method: 4,
|
||||
sns_strength: 50,
|
||||
filter_strength: 60,
|
||||
filter_sharpness: 0,
|
||||
filter_type: 1,
|
||||
partitions: 0,
|
||||
segments: 4,
|
||||
pass: 1,
|
||||
show_compressed: 0,
|
||||
preprocessing: 0,
|
||||
autofilter: 0,
|
||||
partition_limit: 0,
|
||||
alpha_compression: 1,
|
||||
alpha_filtering: 1,
|
||||
alpha_quality: 100,
|
||||
lossless: 0,
|
||||
exact: 0,
|
||||
image_hint: 0,
|
||||
emulate_jpeg_size: 0,
|
||||
thread_level: 0,
|
||||
low_memory: 0,
|
||||
near_lossless: 100,
|
||||
use_delta_palette: 0,
|
||||
use_sharp_yuv: 0
|
||||
},
|
||||
autoOptimize: {
|
||||
option: "quality",
|
||||
min: 0,
|
||||
max: 100
|
||||
}
|
||||
},
|
||||
avif: {
|
||||
name: "AVIF",
|
||||
extension: "avif",
|
||||
// eslint-disable-next-line no-control-regex
|
||||
detectors: [
|
||||
/^\x00\x00\x00 ftypavif\x00\x00\x00\x00/
|
||||
],
|
||||
dec: ()=>instantiateEmscriptenWasm(avifDec, avifDecWasm),
|
||||
enc: async ()=>{
|
||||
return instantiateEmscriptenWasm(avifEnc, avifEncWasm);
|
||||
},
|
||||
defaultEncoderOptions: {
|
||||
cqLevel: 33,
|
||||
cqAlphaLevel: -1,
|
||||
denoiseLevel: 0,
|
||||
tileColsLog2: 0,
|
||||
tileRowsLog2: 0,
|
||||
speed: 6,
|
||||
subsample: 1,
|
||||
chromaDeltaQ: false,
|
||||
sharpness: 0,
|
||||
tune: 0 /* AVIFTune.auto */
|
||||
},
|
||||
autoOptimize: {
|
||||
option: "cqLevel",
|
||||
min: 62,
|
||||
max: 0
|
||||
}
|
||||
},
|
||||
oxipng: {
|
||||
name: "OxiPNG",
|
||||
extension: "png",
|
||||
// eslint-disable-next-line no-control-regex
|
||||
detectors: [
|
||||
/^\x89PNG\x0D\x0A\x1A\x0A/
|
||||
],
|
||||
dec: async ()=>{
|
||||
await pngEncDecInit();
|
||||
return {
|
||||
decode: (buffer)=>{
|
||||
const imageData = pngEncDec.decode(buffer);
|
||||
pngEncDec.cleanup();
|
||||
return imageData;
|
||||
}
|
||||
};
|
||||
},
|
||||
enc: async ()=>{
|
||||
await pngEncDecInit();
|
||||
await oxipngInit();
|
||||
return {
|
||||
encode: (buffer, width, height, opts)=>{
|
||||
const simplePng = pngEncDec.encode(new Uint8Array(buffer), width, height);
|
||||
const imageData = oxipng.optimise(simplePng, opts.level, false);
|
||||
oxipng.cleanup();
|
||||
return imageData;
|
||||
}
|
||||
};
|
||||
},
|
||||
defaultEncoderOptions: {
|
||||
level: 2
|
||||
},
|
||||
autoOptimize: {
|
||||
option: "level",
|
||||
min: 6,
|
||||
max: 1
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
//# sourceMappingURL=codecs.js.map
|
||||
1
kitabcitab/node_modules/next/dist/esm/server/lib/squoosh/codecs.js.map
generated
vendored
Normal file
1
kitabcitab/node_modules/next/dist/esm/server/lib/squoosh/codecs.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
121
kitabcitab/node_modules/next/dist/esm/server/lib/squoosh/emscripten-types.d.ts
generated
vendored
Normal file
121
kitabcitab/node_modules/next/dist/esm/server/lib/squoosh/emscripten-types.d.ts
generated
vendored
Normal file
@@ -0,0 +1,121 @@
|
||||
// These types roughly model the object that the JS files generated by Emscripten define. Copied from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/emscripten/index.d.ts and turned into a type definition rather than a global to support our way of using Emscripten.
|
||||
declare namespace EmscriptenWasm {
|
||||
type ModuleFactory<T extends Module = Module> = (
|
||||
moduleOverrides?: ModuleOpts
|
||||
) => Promise<T>
|
||||
|
||||
type EnvironmentType = 'WEB' | 'NODE' | 'SHELL' | 'WORKER'
|
||||
|
||||
// Options object for modularized Emscripten files. Shoe-horned by @surma.
|
||||
// FIXME: This an incomplete definition!
|
||||
interface ModuleOpts {
|
||||
mainScriptUrlOrBlob?: string
|
||||
noInitialRun?: boolean
|
||||
locateFile?: (url: string) => string
|
||||
onRuntimeInitialized?: () => void
|
||||
}
|
||||
|
||||
interface Module {
|
||||
print(str: string): void
|
||||
printErr(str: string): void
|
||||
arguments: string[]
|
||||
environment: EnvironmentType
|
||||
preInit: { (): void }[]
|
||||
preRun: { (): void }[]
|
||||
postRun: { (): void }[]
|
||||
preinitializedWebGLContext: WebGLRenderingContext
|
||||
noInitialRun: boolean
|
||||
noExitRuntime: boolean
|
||||
logReadFiles: boolean
|
||||
filePackagePrefixURL: string
|
||||
wasmBinary: ArrayBuffer
|
||||
|
||||
destroy(object: object): void
|
||||
getPreloadedPackage(
|
||||
remotePackageName: string,
|
||||
remotePackageSize: number
|
||||
): ArrayBuffer
|
||||
instantiateWasm(
|
||||
imports: WebAssembly.Imports,
|
||||
successCallback: (module: WebAssembly.Module) => void
|
||||
): WebAssembly.Exports
|
||||
locateFile(url: string): string
|
||||
onCustomMessage(event: MessageEvent): void
|
||||
|
||||
Runtime: any
|
||||
|
||||
ccall(
|
||||
ident: string,
|
||||
returnType: string | null,
|
||||
argTypes: string[],
|
||||
args: any[]
|
||||
): any
|
||||
cwrap(ident: string, returnType: string | null, argTypes: string[]): any
|
||||
|
||||
setValue(ptr: number, value: any, type: string, noSafe?: boolean): void
|
||||
getValue(ptr: number, type: string, noSafe?: boolean): number
|
||||
|
||||
ALLOC_NORMAL: number
|
||||
ALLOC_STACK: number
|
||||
ALLOC_STATIC: number
|
||||
ALLOC_DYNAMIC: number
|
||||
ALLOC_NONE: number
|
||||
|
||||
allocate(slab: any, types: string, allocator: number, ptr: number): number
|
||||
allocate(slab: any, types: string[], allocator: number, ptr: number): number
|
||||
|
||||
Pointer_stringify(ptr: number, length?: number): string
|
||||
UTF16ToString(ptr: number): string
|
||||
stringToUTF16(str: string, outPtr: number): void
|
||||
UTF32ToString(ptr: number): string
|
||||
stringToUTF32(str: string, outPtr: number): void
|
||||
|
||||
// USE_TYPED_ARRAYS == 1
|
||||
HEAP: Int32Array
|
||||
IHEAP: Int32Array
|
||||
FHEAP: Float64Array
|
||||
|
||||
// USE_TYPED_ARRAYS == 2
|
||||
HEAP8: Int8Array
|
||||
HEAP16: Int16Array
|
||||
HEAP32: Int32Array
|
||||
HEAPU8: Uint8Array
|
||||
HEAPU16: Uint16Array
|
||||
HEAPU32: Uint32Array
|
||||
HEAPF32: Float32Array
|
||||
HEAPF64: Float64Array
|
||||
|
||||
TOTAL_STACK: number
|
||||
TOTAL_MEMORY: number
|
||||
FAST_MEMORY: number
|
||||
|
||||
addOnPreRun(cb: () => any): void
|
||||
addOnInit(cb: () => any): void
|
||||
addOnPreMain(cb: () => any): void
|
||||
addOnExit(cb: () => any): void
|
||||
addOnPostRun(cb: () => any): void
|
||||
|
||||
// Tools
|
||||
intArrayFromString(
|
||||
stringy: string,
|
||||
dontAddNull?: boolean,
|
||||
length?: number
|
||||
): number[]
|
||||
intArrayToString(array: number[]): string
|
||||
writeStringToMemory(str: string, buffer: number, dontAddNull: boolean): void
|
||||
writeArrayToMemory(array: number[], buffer: number): void
|
||||
writeAsciiToMemory(str: string, buffer: number, dontAddNull: boolean): void
|
||||
|
||||
addRunDependency(id: any): void
|
||||
removeRunDependency(id: any): void
|
||||
|
||||
preloadedImages: any
|
||||
preloadedAudios: any
|
||||
|
||||
_malloc(size: number): number
|
||||
_free(ptr: number): void
|
||||
|
||||
// Augmentations below by @surma.
|
||||
onRuntimeInitialized: () => void | null
|
||||
}
|
||||
}
|
||||
22
kitabcitab/node_modules/next/dist/esm/server/lib/squoosh/emscripten-utils.js
generated
vendored
Normal file
22
kitabcitab/node_modules/next/dist/esm/server/lib/squoosh/emscripten-utils.js
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
import { fileURLToPath } from "url";
|
||||
export function pathify(path) {
|
||||
if (path.startsWith("file://")) {
|
||||
path = fileURLToPath(path);
|
||||
}
|
||||
return path;
|
||||
}
|
||||
export function instantiateEmscriptenWasm(factory, path, workerJS = "") {
|
||||
return factory({
|
||||
locateFile (requestPath) {
|
||||
// The glue code generated by emscripten uses the original
|
||||
// file names of the worker file and the wasm binary.
|
||||
// These will have changed in the bundling process and
|
||||
// we need to inject them here.
|
||||
if (requestPath.endsWith(".wasm")) return pathify(path);
|
||||
if (requestPath.endsWith(".worker.js")) return pathify(workerJS);
|
||||
return requestPath;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//# sourceMappingURL=emscripten-utils.js.map
|
||||
1
kitabcitab/node_modules/next/dist/esm/server/lib/squoosh/emscripten-utils.js.map
generated
vendored
Normal file
1
kitabcitab/node_modules/next/dist/esm/server/lib/squoosh/emscripten-utils.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../server/lib/squoosh/emscripten-utils.ts"],"names":["fileURLToPath","pathify","path","startsWith","instantiateEmscriptenWasm","factory","workerJS","locateFile","requestPath","endsWith"],"mappings":"AAAA,SAASA,aAAa,QAAQ,KAAK,CAAA;AAEnC,OAAO,SAASC,OAAO,CAACC,IAAY,EAAU;IAC5C,IAAIA,IAAI,CAACC,UAAU,CAAC,SAAS,CAAC,EAAE;QAC9BD,IAAI,GAAGF,aAAa,CAACE,IAAI,CAAC;KAC3B;IACD,OAAOA,IAAI,CAAA;CACZ;AAED,OAAO,SAASE,yBAAyB,CACvCC,OAAwC,EACxCH,IAAY,EACZI,QAAgB,GAAG,EAAE,EACT;IACZ,OAAOD,OAAO,CAAC;QACbE,UAAU,EAACC,WAAW,EAAE;YACtB,0DAA0D;YAC1D,qDAAqD;YACrD,sDAAsD;YACtD,+BAA+B;YAC/B,IAAIA,WAAW,CAACC,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAOR,OAAO,CAACC,IAAI,CAAC,CAAA;YACvD,IAAIM,WAAW,CAACC,QAAQ,CAAC,YAAY,CAAC,EAAE,OAAOR,OAAO,CAACK,QAAQ,CAAC,CAAA;YAChE,OAAOE,WAAW,CAAA;SACnB;KACF,CAAC,CAAA;CACH"}
|
||||
21
kitabcitab/node_modules/next/dist/esm/server/lib/squoosh/image_data.js
generated
vendored
Normal file
21
kitabcitab/node_modules/next/dist/esm/server/lib/squoosh/image_data.js
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
export default class ImageData {
|
||||
static from(input) {
|
||||
return new ImageData(input.data || input._data, input.width, input.height);
|
||||
}
|
||||
get data() {
|
||||
if (Object.prototype.toString.call(this._data) === "[object Object]") {
|
||||
return Buffer.from(Object.values(this._data));
|
||||
}
|
||||
if (this._data instanceof Buffer || this._data instanceof Uint8Array || this._data instanceof Uint8ClampedArray) {
|
||||
return Buffer.from(this._data);
|
||||
}
|
||||
throw new Error("invariant");
|
||||
}
|
||||
constructor(data, width, height){
|
||||
this._data = data;
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
}
|
||||
};
|
||||
|
||||
//# sourceMappingURL=image_data.js.map
|
||||
1
kitabcitab/node_modules/next/dist/esm/server/lib/squoosh/image_data.js.map
generated
vendored
Normal file
1
kitabcitab/node_modules/next/dist/esm/server/lib/squoosh/image_data.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../server/lib/squoosh/image_data.ts"],"names":["ImageData","from","input","data","_data","width","height","Object","prototype","toString","call","Buffer","values","Uint8Array","Uint8ClampedArray","Error","constructor"],"mappings":"AAAA,eAAe,MAAMA,SAAS;IAC5B,OAAOC,IAAI,CAACC,KAAgB,EAAa;QACvC,OAAO,IAAIF,SAAS,CAACE,KAAK,CAACC,IAAI,IAAID,KAAK,CAACE,KAAK,EAAEF,KAAK,CAACG,KAAK,EAAEH,KAAK,CAACI,MAAM,CAAC,CAAA;KAC3E;IAMD,IAAIH,IAAI,GAAW;QACjB,IAAII,MAAM,CAACC,SAAS,CAACC,QAAQ,CAACC,IAAI,CAAC,IAAI,CAACN,KAAK,CAAC,KAAK,iBAAiB,EAAE;YACpE,OAAOO,MAAM,CAACV,IAAI,CAACM,MAAM,CAACK,MAAM,CAAC,IAAI,CAACR,KAAK,CAAC,CAAC,CAAA;SAC9C;QACD,IACE,IAAI,CAACA,KAAK,YAAYO,MAAM,IAC5B,IAAI,CAACP,KAAK,YAAYS,UAAU,IAChC,IAAI,CAACT,KAAK,YAAYU,iBAAiB,EACvC;YACA,OAAOH,MAAM,CAACV,IAAI,CAAC,IAAI,CAACG,KAAK,CAAC,CAAA;SAC/B;QACD,MAAM,IAAIW,KAAK,CAAC,WAAW,CAAC,CAAA;KAC7B;IAEDC,YACEb,IAA6C,EAC7CE,KAAa,EACbC,MAAc,CACd;QACA,IAAI,CAACF,KAAK,GAAGD,IAAI;QACjB,IAAI,CAACE,KAAK,GAAGA,KAAK;QAClB,IAAI,CAACC,MAAM,GAAGA,MAAM;KACrB;CACF,CAAA"}
|
||||
105
kitabcitab/node_modules/next/dist/esm/server/lib/squoosh/impl.js
generated
vendored
Normal file
105
kitabcitab/node_modules/next/dist/esm/server/lib/squoosh/impl.js
generated
vendored
Normal file
@@ -0,0 +1,105 @@
|
||||
import semver from "next/dist/compiled/semver";
|
||||
import { codecs as supportedFormats, preprocessors } from "./codecs";
|
||||
import ImageData from "./image_data";
|
||||
// Fixed in Node.js 16.5.0 and newer.
|
||||
// See https://github.com/nodejs/node/pull/39337
|
||||
// Eventually, remove this delay when engines is updated.
|
||||
// See https://github.com/vercel/next.js/blob/1bcc923439f495a1717421e06af7e64c6003072c/packages/next/package.json#L249-L251
|
||||
const FIXED_VERSION = "16.5.0";
|
||||
const DELAY_MS = 1000;
|
||||
let _promise;
|
||||
function delayOnce(ms) {
|
||||
if (!_promise) {
|
||||
_promise = new Promise((resolve)=>{
|
||||
setTimeout(resolve, ms);
|
||||
});
|
||||
}
|
||||
return _promise;
|
||||
}
|
||||
function maybeDelay() {
|
||||
const isAppleM1 = process.arch === "arm64" && process.platform === "darwin";
|
||||
if (isAppleM1 && semver.lt(process.version, FIXED_VERSION)) {
|
||||
return delayOnce(DELAY_MS);
|
||||
}
|
||||
return Promise.resolve();
|
||||
}
|
||||
export async function decodeBuffer(_buffer) {
|
||||
var ref;
|
||||
const buffer = Buffer.from(_buffer);
|
||||
const firstChunk = buffer.slice(0, 16);
|
||||
const firstChunkString = Array.from(firstChunk).map((v)=>String.fromCodePoint(v)).join("");
|
||||
const key = (ref = Object.entries(supportedFormats).find(([, { detectors }])=>detectors.some((detector)=>detector.exec(firstChunkString)))) == null ? void 0 : ref[0];
|
||||
if (!key) {
|
||||
throw Error(`Buffer has an unsupported format`);
|
||||
}
|
||||
const encoder = supportedFormats[key];
|
||||
const mod = await encoder.dec();
|
||||
const rgba = mod.decode(new Uint8Array(buffer));
|
||||
return rgba;
|
||||
}
|
||||
export async function rotate(image, numRotations) {
|
||||
image = ImageData.from(image);
|
||||
const m = await preprocessors["rotate"].instantiate();
|
||||
return await m(image.data, image.width, image.height, {
|
||||
numRotations
|
||||
});
|
||||
}
|
||||
export async function resize({ image , width , height }) {
|
||||
image = ImageData.from(image);
|
||||
const p = preprocessors["resize"];
|
||||
const m = await p.instantiate();
|
||||
await maybeDelay();
|
||||
return await m(image.data, image.width, image.height, {
|
||||
...p.defaultOptions,
|
||||
width,
|
||||
height
|
||||
});
|
||||
}
|
||||
export async function encodeJpeg(image, { quality }) {
|
||||
image = ImageData.from(image);
|
||||
const e = supportedFormats["mozjpeg"];
|
||||
const m = await e.enc();
|
||||
await maybeDelay();
|
||||
const r = await m.encode(image.data, image.width, image.height, {
|
||||
...e.defaultEncoderOptions,
|
||||
quality
|
||||
});
|
||||
return Buffer.from(r);
|
||||
}
|
||||
export async function encodeWebp(image, { quality }) {
|
||||
image = ImageData.from(image);
|
||||
const e = supportedFormats["webp"];
|
||||
const m = await e.enc();
|
||||
await maybeDelay();
|
||||
const r = await m.encode(image.data, image.width, image.height, {
|
||||
...e.defaultEncoderOptions,
|
||||
quality
|
||||
});
|
||||
return Buffer.from(r);
|
||||
}
|
||||
export async function encodeAvif(image, { quality }) {
|
||||
image = ImageData.from(image);
|
||||
const e = supportedFormats["avif"];
|
||||
const m = await e.enc();
|
||||
await maybeDelay();
|
||||
const val = e.autoOptimize.min || 62;
|
||||
const r = await m.encode(image.data, image.width, image.height, {
|
||||
...e.defaultEncoderOptions,
|
||||
// Think of cqLevel as the "amount" of quantization (0 to 62),
|
||||
// so a lower value yields higher quality (0 to 100).
|
||||
cqLevel: Math.round(val - quality / 100 * val)
|
||||
});
|
||||
return Buffer.from(r);
|
||||
}
|
||||
export async function encodePng(image) {
|
||||
image = ImageData.from(image);
|
||||
const e = supportedFormats["oxipng"];
|
||||
const m = await e.enc();
|
||||
await maybeDelay();
|
||||
const r = await m.encode(image.data, image.width, image.height, {
|
||||
...e.defaultEncoderOptions
|
||||
});
|
||||
return Buffer.from(r);
|
||||
}
|
||||
|
||||
//# sourceMappingURL=impl.js.map
|
||||
1
kitabcitab/node_modules/next/dist/esm/server/lib/squoosh/impl.js.map
generated
vendored
Normal file
1
kitabcitab/node_modules/next/dist/esm/server/lib/squoosh/impl.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
69
kitabcitab/node_modules/next/dist/esm/server/lib/squoosh/main.js
generated
vendored
Normal file
69
kitabcitab/node_modules/next/dist/esm/server/lib/squoosh/main.js
generated
vendored
Normal file
@@ -0,0 +1,69 @@
|
||||
import { Worker } from "next/dist/compiled/jest-worker";
|
||||
import * as path from "path";
|
||||
import { execOnce } from "../../../shared/lib/utils";
|
||||
import { cpus } from "os";
|
||||
const getWorker = execOnce(()=>new Worker(path.resolve(__dirname, "impl"), {
|
||||
enableWorkerThreads: true,
|
||||
// There will be at most 6 workers needed since each worker will take
|
||||
// at least 1 operation type.
|
||||
numWorkers: Math.max(1, Math.min(cpus().length - 1, 6)),
|
||||
computeWorkerKey: (method)=>method
|
||||
}));
|
||||
export async function getMetadata(buffer) {
|
||||
const worker = getWorker();
|
||||
const { width , height } = await worker.decodeBuffer(buffer);
|
||||
return {
|
||||
width,
|
||||
height
|
||||
};
|
||||
}
|
||||
export async function processBuffer(buffer, operations, encoding, quality) {
|
||||
const worker = getWorker();
|
||||
let imageData = await worker.decodeBuffer(buffer);
|
||||
for (const operation of operations){
|
||||
if (operation.type === "rotate") {
|
||||
imageData = await worker.rotate(imageData, operation.numRotations);
|
||||
} else if (operation.type === "resize") {
|
||||
const opt = {
|
||||
image: imageData,
|
||||
width: 0,
|
||||
height: 0
|
||||
};
|
||||
if (operation.width && imageData.width && imageData.width > operation.width) {
|
||||
opt.width = operation.width;
|
||||
}
|
||||
if (operation.height && imageData.height && imageData.height > operation.height) {
|
||||
opt.height = operation.height;
|
||||
}
|
||||
if (opt.width > 0 || opt.height > 0) {
|
||||
imageData = await worker.resize(opt);
|
||||
}
|
||||
}
|
||||
}
|
||||
switch(encoding){
|
||||
case "jpeg":
|
||||
return Buffer.from(await worker.encodeJpeg(imageData, {
|
||||
quality
|
||||
}));
|
||||
case "webp":
|
||||
return Buffer.from(await worker.encodeWebp(imageData, {
|
||||
quality
|
||||
}));
|
||||
case "avif":
|
||||
const avifQuality = quality - 20;
|
||||
return Buffer.from(await worker.encodeAvif(imageData, {
|
||||
quality: Math.max(avifQuality, 0)
|
||||
}));
|
||||
case "png":
|
||||
return Buffer.from(await worker.encodePng(imageData));
|
||||
default:
|
||||
throw Error(`Unsupported encoding format`);
|
||||
}
|
||||
}
|
||||
export async function decodeBuffer(buffer) {
|
||||
const worker = getWorker();
|
||||
const imageData = await worker.decodeBuffer(buffer);
|
||||
return imageData;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=main.js.map
|
||||
1
kitabcitab/node_modules/next/dist/esm/server/lib/squoosh/main.js.map
generated
vendored
Normal file
1
kitabcitab/node_modules/next/dist/esm/server/lib/squoosh/main.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../server/lib/squoosh/main.ts"],"names":["Worker","path","execOnce","cpus","getWorker","resolve","__dirname","enableWorkerThreads","numWorkers","Math","max","min","length","computeWorkerKey","method","getMetadata","buffer","worker","width","height","decodeBuffer","processBuffer","operations","encoding","quality","imageData","operation","type","rotate","numRotations","opt","image","resize","Buffer","from","encodeJpeg","encodeWebp","avifQuality","encodeAvif","encodePng","Error"],"mappings":"AAAA,SAASA,MAAM,QAAQ,gCAAgC,CAAA;AACvD,YAAYC,IAAI,MAAM,MAAM,CAAA;AAC5B,SAASC,QAAQ,QAAQ,2B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7C;CACF;AAED,OAAO,eAAepB,YAAY,CAACJ,MAAc,EAAE;IACjD,MAAMC,MAAM,GAA4Bb,SAAS,EAAE,AAAO;IAC1D,MAAMqB,SAAS,GAAG,MAAMR,MAAM,CAACG,YAAY,CAACJ,MAAM,CAAC;IACnD,OAAOS,SAAS,CAAA;CACjB"}
|
||||
38
kitabcitab/node_modules/next/dist/esm/server/lib/squoosh/mozjpeg/mozjpeg_enc.d.ts
generated
vendored
Normal file
38
kitabcitab/node_modules/next/dist/esm/server/lib/squoosh/mozjpeg/mozjpeg_enc.d.ts
generated
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
// eslint-disable-next-line no-shadow
|
||||
export const enum MozJpegColorSpace {
|
||||
GRAYSCALE = 1,
|
||||
RGB,
|
||||
YCbCr,
|
||||
}
|
||||
|
||||
export interface EncodeOptions {
|
||||
quality: number
|
||||
baseline: boolean
|
||||
arithmetic: boolean
|
||||
progressive: boolean
|
||||
optimize_coding: boolean
|
||||
smoothing: number
|
||||
color_space: MozJpegColorSpace
|
||||
quant_table: number
|
||||
trellis_multipass: boolean
|
||||
trellis_opt_zero: boolean
|
||||
trellis_opt_table: boolean
|
||||
trellis_loops: number
|
||||
auto_subsample: boolean
|
||||
chroma_subsample: number
|
||||
separate_chroma_quality: boolean
|
||||
chroma_quality: number
|
||||
}
|
||||
|
||||
export interface MozJPEGModule extends EmscriptenWasm.Module {
|
||||
encode(
|
||||
data: BufferSource,
|
||||
width: number,
|
||||
height: number,
|
||||
options: EncodeOptions
|
||||
): Uint8Array
|
||||
}
|
||||
|
||||
declare var moduleFactory: EmscriptenWasm.ModuleFactory<MozJPEGModule>
|
||||
|
||||
export default moduleFactory
|
||||
1535
kitabcitab/node_modules/next/dist/esm/server/lib/squoosh/mozjpeg/mozjpeg_node_dec.js
generated
vendored
Normal file
1535
kitabcitab/node_modules/next/dist/esm/server/lib/squoosh/mozjpeg/mozjpeg_node_dec.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1
kitabcitab/node_modules/next/dist/esm/server/lib/squoosh/mozjpeg/mozjpeg_node_dec.js.map
generated
vendored
Normal file
1
kitabcitab/node_modules/next/dist/esm/server/lib/squoosh/mozjpeg/mozjpeg_node_dec.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
1625
kitabcitab/node_modules/next/dist/esm/server/lib/squoosh/mozjpeg/mozjpeg_node_enc.js
generated
vendored
Normal file
1625
kitabcitab/node_modules/next/dist/esm/server/lib/squoosh/mozjpeg/mozjpeg_node_enc.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1
kitabcitab/node_modules/next/dist/esm/server/lib/squoosh/mozjpeg/mozjpeg_node_enc.js.map
generated
vendored
Normal file
1
kitabcitab/node_modules/next/dist/esm/server/lib/squoosh/mozjpeg/mozjpeg_node_enc.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
95
kitabcitab/node_modules/next/dist/esm/server/lib/squoosh/png/squoosh_oxipng.js
generated
vendored
Normal file
95
kitabcitab/node_modules/next/dist/esm/server/lib/squoosh/png/squoosh_oxipng.js
generated
vendored
Normal file
@@ -0,0 +1,95 @@
|
||||
let wasm;
|
||||
let cachedTextDecoder = new TextDecoder("utf-8", {
|
||||
ignoreBOM: true,
|
||||
fatal: true
|
||||
});
|
||||
cachedTextDecoder.decode();
|
||||
let cachegetUint8Memory0 = null;
|
||||
function getUint8Memory0() {
|
||||
if (cachegetUint8Memory0 === null || cachegetUint8Memory0.buffer !== wasm.memory.buffer) {
|
||||
cachegetUint8Memory0 = new Uint8Array(wasm.memory.buffer);
|
||||
}
|
||||
return cachegetUint8Memory0;
|
||||
}
|
||||
function getStringFromWasm0(ptr, len) {
|
||||
return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
|
||||
}
|
||||
let WASM_VECTOR_LEN = 0;
|
||||
function passArray8ToWasm0(arg, malloc) {
|
||||
const ptr = malloc(arg.length * 1);
|
||||
getUint8Memory0().set(arg, ptr / 1);
|
||||
WASM_VECTOR_LEN = arg.length;
|
||||
return ptr;
|
||||
}
|
||||
let cachegetInt32Memory0 = null;
|
||||
function getInt32Memory0() {
|
||||
if (cachegetInt32Memory0 === null || cachegetInt32Memory0.buffer !== wasm.memory.buffer) {
|
||||
cachegetInt32Memory0 = new Int32Array(wasm.memory.buffer);
|
||||
}
|
||||
return cachegetInt32Memory0;
|
||||
}
|
||||
function getArrayU8FromWasm0(ptr, len) {
|
||||
return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
|
||||
}
|
||||
/**
|
||||
* @param {Uint8Array} data
|
||||
* @param {number} level
|
||||
* @param {boolean} interlace
|
||||
* @returns {Uint8Array}
|
||||
*/ export function optimise(data, level, interlace) {
|
||||
try {
|
||||
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
||||
var ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
|
||||
var len0 = WASM_VECTOR_LEN;
|
||||
wasm.optimise(retptr, ptr0, len0, level, interlace);
|
||||
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
||||
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
||||
var v1 = getArrayU8FromWasm0(r0, r1).slice();
|
||||
wasm.__wbindgen_free(r0, r1 * 1);
|
||||
return v1;
|
||||
} finally{
|
||||
wasm.__wbindgen_add_to_stack_pointer(16);
|
||||
}
|
||||
}
|
||||
async function load(module, imports) {
|
||||
if (typeof Response === "function" && module instanceof Response) {
|
||||
if (typeof WebAssembly.instantiateStreaming === "function") {
|
||||
return await WebAssembly.instantiateStreaming(module, imports);
|
||||
}
|
||||
const bytes = await module.arrayBuffer();
|
||||
return await WebAssembly.instantiate(bytes, imports);
|
||||
} else {
|
||||
const instance = await WebAssembly.instantiate(module, imports);
|
||||
if (instance instanceof WebAssembly.Instance) {
|
||||
return {
|
||||
instance,
|
||||
module
|
||||
};
|
||||
} else {
|
||||
return instance;
|
||||
}
|
||||
}
|
||||
}
|
||||
async function init(input) {
|
||||
const imports = {};
|
||||
imports.wbg = {};
|
||||
imports.wbg.__wbindgen_throw = function(arg0, arg1) {
|
||||
throw new Error(getStringFromWasm0(arg0, arg1));
|
||||
};
|
||||
if (typeof input === "string" || typeof Request === "function" && input instanceof Request || typeof URL === "function" && input instanceof URL) {
|
||||
input = fetch(input);
|
||||
}
|
||||
const { instance , module } = await load(await input, imports);
|
||||
wasm = instance.exports;
|
||||
init.__wbindgen_wasm_module = module;
|
||||
return wasm;
|
||||
}
|
||||
export default init;
|
||||
// Manually remove the wasm and memory references to trigger GC
|
||||
export function cleanup() {
|
||||
wasm = null;
|
||||
cachegetUint8Memory0 = null;
|
||||
cachegetInt32Memory0 = null;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=squoosh_oxipng.js.map
|
||||
1
kitabcitab/node_modules/next/dist/esm/server/lib/squoosh/png/squoosh_oxipng.js.map
generated
vendored
Normal file
1
kitabcitab/node_modules/next/dist/esm/server/lib/squoosh/png/squoosh_oxipng.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../../server/lib/squoosh/png/squoosh_oxipng.js"],"names":["wasm","cachedTextDecoder","TextDecoder","ignoreBOM","fatal","decode","cachegetUint8Memory0","getUint8Memory0","buffer","memory","Uint8Array","getStringFromWasm0","ptr","len","subarray","WASM_VECTOR_LEN","passArray8ToWasm0","arg","malloc","length","set","cachegetInt32Memory0","getInt32Memory0","Int32Array","getArrayU8FromWasm0","optimise","data","level","interlace","retptr","__wbindgen_add_to_stack_pointer","ptr0","__wbindgen_malloc","len0","r0","r1","v1","slice","__wbindgen_free","load","module","imports","Response","WebAssembly","instantiateStreaming","bytes","arrayBuffer","instantiate","instance","Instance","init","input","wbg","__wbindgen_throw","arg0","arg1","Error","Request","URL","fetch","exports","__wbindgen_wasm_module","cleanup"],"mappings":"AAAA,IAAIA,IAAI;AAER,IAAIC,iBAAiB,GAAG,IAAIC,WAAW,CAAC,OAAO,EAAE;IAC/CC,SAAS,EAAE,IAAI;IACfC,KAAK,EAAE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_modules/next/dist/esm/server/lib/squoosh/png/squoosh_png.js
generated
vendored
Normal file
@@ -0,0 +1,144 @@
|
||||
let wasm;
|
||||
let cachedTextDecoder = new TextDecoder("utf-8", {
|
||||
ignoreBOM: true,
|
||||
fatal: true
|
||||
});
|
||||
cachedTextDecoder.decode();
|
||||
let cachegetUint8Memory0 = null;
|
||||
function getUint8Memory0() {
|
||||
if (cachegetUint8Memory0 === null || cachegetUint8Memory0.buffer !== wasm.memory.buffer) {
|
||||
cachegetUint8Memory0 = new Uint8Array(wasm.memory.buffer);
|
||||
}
|
||||
return cachegetUint8Memory0;
|
||||
}
|
||||
function getStringFromWasm0(ptr, len) {
|
||||
return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
|
||||
}
|
||||
let cachegetUint8ClampedMemory0 = null;
|
||||
function getUint8ClampedMemory0() {
|
||||
if (cachegetUint8ClampedMemory0 === null || cachegetUint8ClampedMemory0.buffer !== wasm.memory.buffer) {
|
||||
cachegetUint8ClampedMemory0 = new Uint8ClampedArray(wasm.memory.buffer);
|
||||
}
|
||||
return cachegetUint8ClampedMemory0;
|
||||
}
|
||||
function getClampedArrayU8FromWasm0(ptr, len) {
|
||||
return getUint8ClampedMemory0().subarray(ptr / 1, ptr / 1 + len);
|
||||
}
|
||||
const heap = new Array(32).fill(undefined);
|
||||
heap.push(undefined, null, true, false);
|
||||
let heap_next = heap.length;
|
||||
function addHeapObject(obj) {
|
||||
if (heap_next === heap.length) heap.push(heap.length + 1);
|
||||
const idx = heap_next;
|
||||
heap_next = heap[idx];
|
||||
heap[idx] = obj;
|
||||
return idx;
|
||||
}
|
||||
let WASM_VECTOR_LEN = 0;
|
||||
function passArray8ToWasm0(arg, malloc) {
|
||||
const ptr = malloc(arg.length * 1);
|
||||
getUint8Memory0().set(arg, ptr / 1);
|
||||
WASM_VECTOR_LEN = arg.length;
|
||||
return ptr;
|
||||
}
|
||||
let cachegetInt32Memory0 = null;
|
||||
function getInt32Memory0() {
|
||||
if (cachegetInt32Memory0 === null || cachegetInt32Memory0.buffer !== wasm.memory.buffer) {
|
||||
cachegetInt32Memory0 = new Int32Array(wasm.memory.buffer);
|
||||
}
|
||||
return cachegetInt32Memory0;
|
||||
}
|
||||
function getArrayU8FromWasm0(ptr, len) {
|
||||
return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
|
||||
}
|
||||
/**
|
||||
* @param {Uint8Array} data
|
||||
* @param {number} width
|
||||
* @param {number} height
|
||||
* @returns {Uint8Array}
|
||||
*/ export function encode(data, width, height) {
|
||||
try {
|
||||
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
||||
var ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
|
||||
var len0 = WASM_VECTOR_LEN;
|
||||
wasm.encode(retptr, ptr0, len0, width, height);
|
||||
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
||||
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
||||
var v1 = getArrayU8FromWasm0(r0, r1).slice();
|
||||
wasm.__wbindgen_free(r0, r1 * 1);
|
||||
return v1;
|
||||
} finally{
|
||||
wasm.__wbindgen_add_to_stack_pointer(16);
|
||||
}
|
||||
}
|
||||
function getObject(idx) {
|
||||
return heap[idx];
|
||||
}
|
||||
function dropObject(idx) {
|
||||
if (idx < 36) return;
|
||||
heap[idx] = heap_next;
|
||||
heap_next = idx;
|
||||
}
|
||||
function takeObject(idx) {
|
||||
const ret = getObject(idx);
|
||||
dropObject(idx);
|
||||
return ret;
|
||||
}
|
||||
/**
|
||||
* @param {Uint8Array} data
|
||||
* @returns {ImageData}
|
||||
*/ export function decode(data) {
|
||||
var ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
|
||||
var len0 = WASM_VECTOR_LEN;
|
||||
var ret = wasm.decode(ptr0, len0);
|
||||
return takeObject(ret);
|
||||
}
|
||||
async function load(module, imports) {
|
||||
if (typeof Response === "function" && module instanceof Response) {
|
||||
if (typeof WebAssembly.instantiateStreaming === "function") {
|
||||
return await WebAssembly.instantiateStreaming(module, imports);
|
||||
}
|
||||
const bytes = await module.arrayBuffer();
|
||||
return await WebAssembly.instantiate(bytes, imports);
|
||||
} else {
|
||||
const instance = await WebAssembly.instantiate(module, imports);
|
||||
if (instance instanceof WebAssembly.Instance) {
|
||||
return {
|
||||
instance,
|
||||
module
|
||||
};
|
||||
} else {
|
||||
return instance;
|
||||
}
|
||||
}
|
||||
}
|
||||
async function init(input) {
|
||||
const imports = {};
|
||||
imports.wbg = {};
|
||||
imports.wbg.__wbg_newwithownedu8clampedarrayandsh_787b2db8ea6bfd62 = function(arg0, arg1, arg2, arg3) {
|
||||
var v0 = getClampedArrayU8FromWasm0(arg0, arg1).slice();
|
||||
wasm.__wbindgen_free(arg0, arg1 * 1);
|
||||
var ret = new ImageData(v0, arg2 >>> 0, arg3 >>> 0);
|
||||
return addHeapObject(ret);
|
||||
};
|
||||
imports.wbg.__wbindgen_throw = function(arg0, arg1) {
|
||||
throw new Error(getStringFromWasm0(arg0, arg1));
|
||||
};
|
||||
if (typeof input === "string" || typeof Request === "function" && input instanceof Request || typeof URL === "function" && input instanceof URL) {
|
||||
input = fetch(input);
|
||||
}
|
||||
const { instance , module } = await load(await input, imports);
|
||||
wasm = instance.exports;
|
||||
init.__wbindgen_wasm_module = module;
|
||||
return wasm;
|
||||
}
|
||||
export default init;
|
||||
// Manually remove the wasm and memory references to trigger GC
|
||||
export function cleanup() {
|
||||
wasm = null;
|
||||
cachegetUint8ClampedMemory0 = null;
|
||||
cachegetUint8Memory0 = null;
|
||||
cachegetInt32Memory0 = null;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=squoosh_png.js.map
|
||||
1
kitabcitab/node_modules/next/dist/esm/server/lib/squoosh/png/squoosh_png.js.map
generated
vendored
Normal file
1
kitabcitab/node_modules/next/dist/esm/server/lib/squoosh/png/squoosh_png.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
95
kitabcitab/node_modules/next/dist/esm/server/lib/squoosh/resize/squoosh_resize.js
generated
vendored
Normal file
95
kitabcitab/node_modules/next/dist/esm/server/lib/squoosh/resize/squoosh_resize.js
generated
vendored
Normal file
@@ -0,0 +1,95 @@
|
||||
let wasm;
|
||||
let cachegetUint8Memory0 = null;
|
||||
function getUint8Memory0() {
|
||||
if (cachegetUint8Memory0 === null || cachegetUint8Memory0.buffer !== wasm.memory.buffer) {
|
||||
cachegetUint8Memory0 = new Uint8Array(wasm.memory.buffer);
|
||||
}
|
||||
return cachegetUint8Memory0;
|
||||
}
|
||||
let WASM_VECTOR_LEN = 0;
|
||||
function passArray8ToWasm0(arg, malloc) {
|
||||
const ptr = malloc(arg.length * 1);
|
||||
getUint8Memory0().set(arg, ptr / 1);
|
||||
WASM_VECTOR_LEN = arg.length;
|
||||
return ptr;
|
||||
}
|
||||
let cachegetInt32Memory0 = null;
|
||||
function getInt32Memory0() {
|
||||
if (cachegetInt32Memory0 === null || cachegetInt32Memory0.buffer !== wasm.memory.buffer) {
|
||||
cachegetInt32Memory0 = new Int32Array(wasm.memory.buffer);
|
||||
}
|
||||
return cachegetInt32Memory0;
|
||||
}
|
||||
let cachegetUint8ClampedMemory0 = null;
|
||||
function getUint8ClampedMemory0() {
|
||||
if (cachegetUint8ClampedMemory0 === null || cachegetUint8ClampedMemory0.buffer !== wasm.memory.buffer) {
|
||||
cachegetUint8ClampedMemory0 = new Uint8ClampedArray(wasm.memory.buffer);
|
||||
}
|
||||
return cachegetUint8ClampedMemory0;
|
||||
}
|
||||
function getClampedArrayU8FromWasm0(ptr, len) {
|
||||
return getUint8ClampedMemory0().subarray(ptr / 1, ptr / 1 + len);
|
||||
}
|
||||
/**
|
||||
* @param {Uint8Array} input_image
|
||||
* @param {number} input_width
|
||||
* @param {number} input_height
|
||||
* @param {number} output_width
|
||||
* @param {number} output_height
|
||||
* @param {number} typ_idx
|
||||
* @param {boolean} premultiply
|
||||
* @param {boolean} color_space_conversion
|
||||
* @returns {Uint8ClampedArray}
|
||||
*/ export function resize(input_image, input_width, input_height, output_width, output_height, typ_idx, premultiply, color_space_conversion) {
|
||||
try {
|
||||
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
||||
var ptr0 = passArray8ToWasm0(input_image, wasm.__wbindgen_malloc);
|
||||
var len0 = WASM_VECTOR_LEN;
|
||||
wasm.resize(retptr, ptr0, len0, input_width, input_height, output_width, output_height, typ_idx, premultiply, color_space_conversion);
|
||||
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
||||
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
||||
var v1 = getClampedArrayU8FromWasm0(r0, r1).slice();
|
||||
wasm.__wbindgen_free(r0, r1 * 1);
|
||||
return v1;
|
||||
} finally{
|
||||
wasm.__wbindgen_add_to_stack_pointer(16);
|
||||
}
|
||||
}
|
||||
async function load(module, imports) {
|
||||
if (typeof Response === "function" && module instanceof Response) {
|
||||
if (typeof WebAssembly.instantiateStreaming === "function") {
|
||||
return await WebAssembly.instantiateStreaming(module, imports);
|
||||
}
|
||||
const bytes = await module.arrayBuffer();
|
||||
return await WebAssembly.instantiate(bytes, imports);
|
||||
} else {
|
||||
const instance = await WebAssembly.instantiate(module, imports);
|
||||
if (instance instanceof WebAssembly.Instance) {
|
||||
return {
|
||||
instance,
|
||||
module
|
||||
};
|
||||
} else {
|
||||
return instance;
|
||||
}
|
||||
}
|
||||
}
|
||||
async function init(input) {
|
||||
const imports = {};
|
||||
if (typeof input === "string" || typeof Request === "function" && input instanceof Request || typeof URL === "function" && input instanceof URL) {
|
||||
input = fetch(input);
|
||||
}
|
||||
const { instance , module } = await load(await input, imports);
|
||||
wasm = instance.exports;
|
||||
init.__wbindgen_wasm_module = module;
|
||||
return wasm;
|
||||
}
|
||||
export default init;
|
||||
// Manually remove the wasm and memory references to trigger GC
|
||||
export function cleanup() {
|
||||
wasm = null;
|
||||
cachegetUint8Memory0 = null;
|
||||
cachegetInt32Memory0 = null;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=squoosh_resize.js.map
|
||||
1
kitabcitab/node_modules/next/dist/esm/server/lib/squoosh/resize/squoosh_resize.js.map
generated
vendored
Normal file
1
kitabcitab/node_modules/next/dist/esm/server/lib/squoosh/resize/squoosh_resize.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../../server/lib/squoosh/resize/squoosh_resize.js"],"names":["wasm","cachegetUint8Memory0","getUint8Memory0","buffer","memory","Uint8Array","WASM_VECTOR_LEN","passArray8ToWasm0","arg","malloc","ptr","length","set","cachegetInt32Memory0","getInt32Memory0","Int32Array","cachegetUint8ClampedMemory0","getUint8ClampedMemory0","Uint8ClampedArray","getClampedArrayU8FromWasm0","len","subarray","resize","input_image","input_width","input_height","output_width","output_height","typ_idx","premultiply","color_space_conversion","retptr","__wbindgen_add_to_stack_pointer","ptr0","__wbindgen_malloc","len0","r0","r1","v1","slice","__wbindgen_free","load","module","imports","Response","WebAssembly","instantiateStreaming","bytes","arrayBuffer","instantiate","instance","Instance","init","input","Request","URL","fetch","exports","__wbindgen_wasm_module","cleanup"],"mappings":"AAAA,IAAIA,IAAI;AAER,IAAIC,oBAAoB,GAAG,IAAI;AAC/B,SAASC,eAAe,GAAG;IACzB,IACED,oBAAoB,KAAK,IAAI,IAC7BA,oBAAoB,CAACE,MAAM,KAAKH,IAAI,CAACI,MAAM,CAACD,MAAM,EAClD;QACAF,oBAAoB,GAAG,IAAII,UAAU,CAACL,IAAI,CAACI,MAAM,CAACD,MAAM,CAAC;KAC1D;IACD,OAAOF,oBAAoB,CAAA;CAC5B;AAED,IAAIK,eAAe,GAAG,CAAC;AAEvB,SAASC,iBAAiB,CAACC,GAAG,EAAEC,MAAM,EAAE;IACtC,MAAMC,GAAG,GAAGD,MAAM,CAACD,GAAG,CAACG,MAAM,GAAG,CAAC,CAAC;IAClCT,eAAe,EAAE,CAACU,GAAG,CAACJ,GAAG,EAAEE,GAAG,GAAG,CAAC,CAAC;IACnCJ,eAAe,GAAGE,GAAG,CAACG,MAAM;IAC5B,OAA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U,IAAID,KAAK,YAAYC,OAAO,IACzD,OAAOC,GAAG,KAAK,UAAU,IAAIF,KAAK,YAAYE,GAAG,AAAC,EACnD;QACAF,KAAK,GAAGG,KAAK,CAACH,KAAK,CAAC;KACrB;IAED,MAAM,EAAEH,QAAQ,CAAA,EAAER,MAAM,CAAA,EAAE,GAAG,MAAMD,IAAI,CAAC,MAAMY,KAAK,EAAEV,OAAO,CAAC;IAE7D3C,IAAI,GAAGkD,QAAQ,CAACO,OAAO;IACvBL,IAAI,CAACM,sBAAsB,GAAGhB,MAAM;IAEpC,OAAO1C,IAAI,CAAA;CACZ;AAED,eAAeoD,IAAI,CAAA;AAEnB,+DAA+D;AAC/D,OAAO,SAASO,OAAO,GAAG;IACxB3D,IAAI,GAAG,IAAI;IACXC,oBAAoB,GAAG,IAAI;IAC3BY,oBAAoB,GAAG,IAAI;CAC5B"}
|
||||
42
kitabcitab/node_modules/next/dist/esm/server/lib/squoosh/webp/webp_enc.d.ts
generated
vendored
Normal file
42
kitabcitab/node_modules/next/dist/esm/server/lib/squoosh/webp/webp_enc.d.ts
generated
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
export interface EncodeOptions {
|
||||
quality: number
|
||||
target_size: number
|
||||
target_PSNR: number
|
||||
method: number
|
||||
sns_strength: number
|
||||
filter_strength: number
|
||||
filter_sharpness: number
|
||||
filter_type: number
|
||||
partitions: number
|
||||
segments: number
|
||||
pass: number
|
||||
show_compressed: number
|
||||
preprocessing: number
|
||||
autofilter: number
|
||||
partition_limit: number
|
||||
alpha_compression: number
|
||||
alpha_filtering: number
|
||||
alpha_quality: number
|
||||
lossless: number
|
||||
exact: number
|
||||
image_hint: number
|
||||
emulate_jpeg_size: number
|
||||
thread_level: number
|
||||
low_memory: number
|
||||
near_lossless: number
|
||||
use_delta_palette: number
|
||||
use_sharp_yuv: number
|
||||
}
|
||||
|
||||
export interface WebPModule extends EmscriptenWasm.Module {
|
||||
encode(
|
||||
data: BufferSource,
|
||||
width: number,
|
||||
height: number,
|
||||
options: EncodeOptions
|
||||
): Uint8Array
|
||||
}
|
||||
|
||||
declare var moduleFactory: EmscriptenWasm.ModuleFactory<WebPModule>
|
||||
|
||||
export default moduleFactory
|
||||
1384
kitabcitab/node_modules/next/dist/esm/server/lib/squoosh/webp/webp_node_dec.js
generated
vendored
Normal file
1384
kitabcitab/node_modules/next/dist/esm/server/lib/squoosh/webp/webp_node_dec.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1
kitabcitab/node_modules/next/dist/esm/server/lib/squoosh/webp/webp_node_dec.js.map
generated
vendored
Normal file
1
kitabcitab/node_modules/next/dist/esm/server/lib/squoosh/webp/webp_node_dec.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