/home/techb158/balavpn.abdallabala.com/node_modules/next/dist/esm/build
NameSizeModeActions
adapter/-0777rm
analysis/-0777rm
babel/-0777rm
manifests/-0777rm
next-config-ts/-0777rm
output/-0777rm
polyfills/-0777rm
segment-config/-0777rm
static-paths/-0777rm
swc/-0777rm
templates/-0777rm
turbopack-build/-0777rm
turborepo-access-trace/-0777rm
webpack/-0777rm
webpack-build/-0777rm
webpack-config-rules/-0777rm
after-production-compile.js16220666editdlrm
after-production-compile.js.map31390666editdlrm
build-context.js13530666editdlrm
build-context.js.map40560666editdlrm
collect-build-traces.js215980666editdlrm
collect-build-traces.js.map353920666editdlrm
compiler.js28840666editdlrm
compiler.js.map47860666editdlrm
create-compiler-aliases.js245640666editdlrm
create-compiler-aliases.js.map399610666editdlrm
define-env.js143350666editdlrm
define-env.js.map231660666editdlrm
deployment-id.js2180666editdlrm
deployment-id.js.map5060666editdlrm
duration-to-string.js5440666editdlrm
duration-to-string.js.map10840666editdlrm
entries.js362600666editdlrm
entries.js.map616600666editdlrm
generate-build-id.js7940666editdlrm
generate-build-id.js.map11980666editdlrm
get-babel-config-file.js6220666editdlrm
get-babel-config-file.js.map11000666editdlrm
get-babel-loader-config.js29370666editdlrm
get-babel-loader-config.js.map48850666editdlrm
handle-entrypoints.js45710666editdlrm
handle-entrypoints.js.map70760666editdlrm
handle-externals.js136230666editdlrm
handle-externals.js.map216530666editdlrm
index.js1472390666editdlrm
index.js.map2255750666editdlrm
is-writeable.js2620666editdlrm
is-writeable.js.map6350666editdlrm
load-entrypoint.js17000666editdlrm
load-entrypoint.js.map30980666editdlrm
load-jsconfig.js34510666editdlrm
load-jsconfig.js.map65080666editdlrm
next-dir-paths.js3010666editdlrm
next-dir-paths.js.map6810666editdlrm
normalize-catchall-routes.js41950666editdlrm
normalize-catchall-routes.js.map66430666editdlrm
page-extensions-type.js610666editdlrm
page-extensions-type.js.map1800666editdlrm
preview-key-utils.js34080666editdlrm
preview-key-utils.js.map59660666editdlrm
progress.js29490666editdlrm
progress.js.map45880666editdlrm
rendering-mode.js6180666editdlrm
rendering-mode.js.map7110666editdlrm
spinner.js28690666editdlrm
spinner.js.map49330666editdlrm
type-check.js52780666editdlrm
type-check.js.map92510666editdlrm
utils.js538060666editdlrm
utils.js.map953930666editdlrm
webpack-config.js1084980666editdlrm
webpack-config.js.map1582060666editdlrm
worker.js2060666editdlrm
worker.js.map4810666editdlrm
write-build-id.js3310666editdlrm
write-build-id.js.map7430666editdlrm
Edit: /home/techb158/balavpn.abdallabala.com/node_modules/next/dist/esm/build/preview-key-utils.js (3408B)
import path from 'path'; import fs from 'fs'; import crypto from 'crypto'; import { getStorageDirectory } from '../server/cache-dir'; const CONFIG_FILE = '.previewinfo'; const PREVIEW_ID = 'previewModeId'; const PREVIEW_SIGNING_KEY = 'previewModeSigningKey'; const PREVIEW_ENCRYPTION_KEY = 'previewModeEncryptionKey'; const PREVIEW_EXPIRE_AT = 'expireAt'; const EXPIRATION = 1000 * 60 * 60 * 24 * 14 // 14 days ; async function writeCache(distDir, config) { const cacheBaseDir = getStorageDirectory(distDir); if (!cacheBaseDir) return; const configPath = path.join(cacheBaseDir, CONFIG_FILE); if (!fs.existsSync(cacheBaseDir)) { await fs.promises.mkdir(cacheBaseDir, { recursive: true }); } await fs.promises.writeFile(configPath, JSON.stringify({ [PREVIEW_ID]: config.previewModeId, [PREVIEW_SIGNING_KEY]: config.previewModeSigningKey, [PREVIEW_ENCRYPTION_KEY]: config.previewModeEncryptionKey, [PREVIEW_EXPIRE_AT]: Date.now() + EXPIRATION })); } function generateConfig() { return { previewModeId: crypto.randomBytes(16).toString('hex'), previewModeSigningKey: crypto.randomBytes(32).toString('hex'), previewModeEncryptionKey: crypto.randomBytes(32).toString('hex') }; } // This utility is used to get a key for the cache directory. If the // key is not present, it will generate a new one and store it in the // cache directory inside dist. // The key will also expire after a certain amount of time. Once it // expires, a new one will be generated. export async function generatePreviewKeys({ distDir, isBuild }) { const cacheBaseDir = getStorageDirectory(distDir); if (!cacheBaseDir) { // There's no persistent storage available. We generate a new config. // This also covers development time. return generateConfig(); } const configPath = path.join(cacheBaseDir, CONFIG_FILE); async function tryReadCachedConfig() { if (!fs.existsSync(configPath)) return false; try { const config = JSON.parse(await fs.promises.readFile(configPath, 'utf8')); if (!config) return false; if (typeof config[PREVIEW_ID] !== 'string' || typeof config[PREVIEW_ENCRYPTION_KEY] !== 'string' || typeof config[PREVIEW_SIGNING_KEY] !== 'string' || typeof config[PREVIEW_EXPIRE_AT] !== 'number') { return false; } // For build time, we need to rotate the key if it's expired. Otherwise // (next start) we have to keep the key as it is so the runtime key matches // the build time key. if (isBuild && config[PREVIEW_EXPIRE_AT] < Date.now()) { return false; } return { previewModeId: config[PREVIEW_ID], previewModeSigningKey: config[PREVIEW_SIGNING_KEY], previewModeEncryptionKey: config[PREVIEW_ENCRYPTION_KEY] }; } catch (e) { // Broken config file. We should generate a new key and overwrite it. return false; } } const maybeValidConfig = await tryReadCachedConfig(); if (maybeValidConfig !== false) { return maybeValidConfig; } const config = generateConfig(); await writeCache(distDir, config); return config; } //# sourceMappingURL=preview-key-utils.js.map