inital commit

This commit is contained in:
2026-01-01 15:25:19 +05:30
commit f0ae49465a
36361 changed files with 4894111 additions and 0 deletions

10
node_modules/next/dist/build/turbopack-build/impl.d.ts generated vendored Normal file
View File

@@ -0,0 +1,10 @@
import { NextBuildContext } from '../build-context';
export declare function turbopackBuild(): Promise<{
duration: number;
buildTraceContext: undefined;
shutdownPromise: Promise<void>;
}>;
export declare function workerMain(workerData: {
buildContext: typeof NextBuildContext;
}): Promise<Awaited<ReturnType<typeof turbopackBuild>>>;
export declare function waitForShutdown(): Promise<void>;

341
node_modules/next/dist/build/turbopack-build/impl.js generated vendored Normal file
View File

@@ -0,0 +1,341 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
0 && (module.exports = {
turbopackBuild: null,
waitForShutdown: null,
workerMain: null
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
turbopackBuild: function() {
return turbopackBuild;
},
waitForShutdown: function() {
return waitForShutdown;
},
workerMain: function() {
return workerMain;
}
});
const _path = /*#__PURE__*/ _interop_require_default(require("path"));
const _turbopackwarning = require("../../lib/turbopack-warning");
const _utils = require("../../shared/lib/turbopack/utils");
const _buildcontext = require("../build-context");
const _swc = require("../swc");
const _asyncsema = require("next/dist/compiled/async-sema");
const _handleentrypoints = require("../handle-entrypoints");
const _manifestloader = require("../../shared/lib/turbopack/manifest-loader");
const _progress = require("../progress");
const _log = /*#__PURE__*/ _interop_require_wildcard(require("../output/log"));
const _fs = require("fs");
const _constants = require("../../shared/lib/constants");
const _config = /*#__PURE__*/ _interop_require_default(require("../../server/config"));
const _utils1 = require("../../export/utils");
const _storage = require("../../telemetry/storage");
const _trace = require("../../trace");
function _interop_require_default(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
function _getRequireWildcardCache(nodeInterop) {
if (typeof WeakMap !== "function") return null;
var cacheBabelInterop = new WeakMap();
var cacheNodeInterop = new WeakMap();
return (_getRequireWildcardCache = function(nodeInterop) {
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
})(nodeInterop);
}
function _interop_require_wildcard(obj, nodeInterop) {
if (!nodeInterop && obj && obj.__esModule) {
return obj;
}
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
return {
default: obj
};
}
var cache = _getRequireWildcardCache(nodeInterop);
if (cache && cache.has(obj)) {
return cache.get(obj);
}
var newObj = {
__proto__: null
};
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
for(var key in obj){
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
if (desc && (desc.get || desc.set)) {
Object.defineProperty(newObj, key, desc);
} else {
newObj[key] = obj[key];
}
}
}
newObj.default = obj;
if (cache) {
cache.set(obj, newObj);
}
return newObj;
}
const IS_TURBOPACK_BUILD = process.env.TURBOPACK && process.env.TURBOPACK_BUILD;
async function turbopackBuild() {
var _config_experimental, _config_experimental_turbo, _config_experimental1, _config_experimental_turbo1;
if (!IS_TURBOPACK_BUILD) {
throw Object.defineProperty(new Error("next build doesn't support turbopack yet"), "__NEXT_ERROR_CODE", {
value: "E122",
enumerable: false,
configurable: true
});
}
await (0, _turbopackwarning.validateTurboNextConfig)({
dir: _buildcontext.NextBuildContext.dir,
isDev: false
});
const config = _buildcontext.NextBuildContext.config;
const dir = _buildcontext.NextBuildContext.dir;
const distDir = _buildcontext.NextBuildContext.distDir;
const buildId = _buildcontext.NextBuildContext.buildId;
const encryptionKey = _buildcontext.NextBuildContext.encryptionKey;
const previewProps = _buildcontext.NextBuildContext.previewProps;
const hasRewrites = _buildcontext.NextBuildContext.hasRewrites;
const rewrites = _buildcontext.NextBuildContext.rewrites;
const appDirOnly = _buildcontext.NextBuildContext.appDirOnly;
const noMangling = _buildcontext.NextBuildContext.noMangling;
const startTime = process.hrtime();
const bindings = await (0, _swc.loadBindings)(config == null ? void 0 : (_config_experimental = config.experimental) == null ? void 0 : _config_experimental.useWasmBinary);
const dev = false;
// const supportedBrowsers = await getSupportedBrowsers(dir, dev)
const supportedBrowsers = [
'last 1 Chrome versions, last 1 Firefox versions, last 1 Safari versions, last 1 Edge versions'
];
const persistentCaching = (0, _utils.isPersistentCachingEnabled)(config);
const project = await bindings.turbo.createProject({
projectPath: dir,
rootPath: ((_config_experimental1 = config.experimental) == null ? void 0 : (_config_experimental_turbo = _config_experimental1.turbo) == null ? void 0 : _config_experimental_turbo.root) || config.outputFileTracingRoot || dir,
distDir,
nextConfig: config,
jsConfig: await (0, _utils.getTurbopackJsConfig)(dir, config),
watch: {
enable: false
},
dev,
env: process.env,
defineEnv: (0, _swc.createDefineEnv)({
isTurbopack: true,
clientRouterFilters: _buildcontext.NextBuildContext.clientRouterFilters,
config,
dev,
distDir,
fetchCacheKeyPrefix: config.experimental.fetchCacheKeyPrefix,
hasRewrites,
// Implemented separately in Turbopack, doesn't have to be passed here.
middlewareMatchers: undefined
}),
buildId,
encryptionKey,
previewProps,
browserslistQuery: supportedBrowsers.join(', '),
noMangling
}, {
persistentCaching,
memoryLimit: (_config_experimental_turbo1 = config.experimental.turbo) == null ? void 0 : _config_experimental_turbo1.memoryLimit,
dependencyTracking: persistentCaching
});
await _fs.promises.mkdir(_path.default.join(distDir, 'server'), {
recursive: true
});
await _fs.promises.mkdir(_path.default.join(distDir, 'static', buildId), {
recursive: true
});
await _fs.promises.writeFile(_path.default.join(distDir, 'package.json'), JSON.stringify({
type: 'commonjs'
}, null, 2));
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const entrypointsSubscription = project.entrypointsSubscribe();
const currentEntrypoints = {
global: {
app: undefined,
document: undefined,
error: undefined,
middleware: undefined,
instrumentation: undefined
},
app: new Map(),
page: new Map()
};
const currentEntryIssues = new Map();
const manifestLoader = new _manifestloader.TurbopackManifestLoader({
buildId,
distDir,
encryptionKey
});
const entrypointsResult = await entrypointsSubscription.next();
if (entrypointsResult.done) {
throw Object.defineProperty(new Error('Turbopack did not return any entrypoints'), "__NEXT_ERROR_CODE", {
value: "E275",
enumerable: false,
configurable: true
});
}
entrypointsSubscription.return == null ? void 0 : entrypointsSubscription.return.call(entrypointsSubscription).catch(()=>{});
const entrypoints = entrypointsResult.value;
const topLevelErrors = [];
for (const issue of entrypoints.issues){
topLevelErrors.push({
message: (0, _utils.formatIssue)(issue)
});
}
if (topLevelErrors.length > 0) {
throw Object.defineProperty(new Error(`Turbopack build failed with ${topLevelErrors.length} issues:\n${topLevelErrors.map((e)=>e.message).join('\n')}`), "__NEXT_ERROR_CODE", {
value: "E33",
enumerable: false,
configurable: true
});
}
await (0, _handleentrypoints.handleEntrypoints)({
entrypoints,
currentEntrypoints,
currentEntryIssues,
manifestLoader,
productionRewrites: rewrites,
logErrors: false
});
const progress = (0, _progress.createProgress)(currentEntrypoints.page.size + currentEntrypoints.app.size + 1, 'Building');
const promises = [];
// Concurrency will start at INITIAL_CONCURRENCY and
// slowly ramp up to CONCURRENCY by increasing the
// concurrency by 1 every time a task is completed.
const INITIAL_CONCURRENCY = 5;
const CONCURRENCY = 10;
const sema = new _asyncsema.Sema(INITIAL_CONCURRENCY);
let remainingRampup = CONCURRENCY - INITIAL_CONCURRENCY;
const enqueue = (fn)=>{
promises.push((async ()=>{
await sema.acquire();
try {
await fn();
} finally{
sema.release();
if (remainingRampup > 0) {
remainingRampup--;
sema.release();
}
progress.run();
}
})());
};
if (!appDirOnly) {
for (const [page, route] of currentEntrypoints.page){
enqueue(()=>(0, _handleentrypoints.handleRouteType)({
page,
route,
currentEntryIssues,
entrypoints: currentEntrypoints,
manifestLoader,
productionRewrites: rewrites,
logErrors: false
}));
}
}
for (const [page, route] of currentEntrypoints.app){
enqueue(()=>(0, _handleentrypoints.handleRouteType)({
page,
route,
currentEntryIssues,
entrypoints: currentEntrypoints,
manifestLoader,
productionRewrites: rewrites,
logErrors: false
}));
}
enqueue(()=>(0, _handleentrypoints.handlePagesErrorRoute)({
currentEntryIssues,
entrypoints: currentEntrypoints,
manifestLoader,
productionRewrites: rewrites,
logErrors: false
}));
await Promise.all(promises);
await manifestLoader.writeManifests({
devRewrites: undefined,
productionRewrites: rewrites,
entrypoints: currentEntrypoints
});
const errors = [];
const warnings = [];
for (const [page, entryIssues] of currentEntryIssues){
for (const issue of entryIssues.values()){
if (issue.severity !== 'warning') {
errors.push({
page,
message: (0, _utils.formatIssue)(issue)
});
} else {
if ((0, _utils.isRelevantWarning)(issue)) {
warnings.push({
page,
message: (0, _utils.formatIssue)(issue)
});
}
}
}
}
const shutdownPromise = project.shutdown();
if (warnings.length > 0) {
_log.warn(`Turbopack build collected ${warnings.length} warnings:\n${warnings.map((e)=>{
return 'Page: ' + e.page + '\n' + e.message;
}).join('\n')}`);
}
if (errors.length > 0) {
throw Object.defineProperty(new Error(`Turbopack build failed with ${errors.length} errors:\n${errors.map((e)=>{
return 'Page: ' + e.page + '\n' + e.message;
}).join('\n')}`), "__NEXT_ERROR_CODE", {
value: "E425",
enumerable: false,
configurable: true
});
}
const time = process.hrtime(startTime);
return {
duration: time[0] + time[1] / 1e9,
buildTraceContext: undefined,
shutdownPromise
};
}
let shutdownPromise;
async function workerMain(workerData) {
// setup new build context from the serialized data passed from the parent
Object.assign(_buildcontext.NextBuildContext, workerData.buildContext);
/// load the config because it's not serializable
_buildcontext.NextBuildContext.config = await (0, _config.default)(_constants.PHASE_PRODUCTION_BUILD, _buildcontext.NextBuildContext.dir);
// Matches handling in build/index.ts
// https://github.com/vercel/next.js/blob/84f347fc86f4efc4ec9f13615c215e4b9fb6f8f0/packages/next/src/build/index.ts#L815-L818
// Ensures the `config.distDir` option is matched.
if ((0, _utils1.hasCustomExportOutput)(_buildcontext.NextBuildContext.config)) {
_buildcontext.NextBuildContext.config.distDir = '.next';
}
// Clone the telemetry for worker
const telemetry = new _storage.Telemetry({
distDir: _buildcontext.NextBuildContext.config.distDir
});
(0, _trace.setGlobal)('telemetry', telemetry);
const result = await turbopackBuild();
shutdownPromise = result.shutdownPromise;
return result;
}
async function waitForShutdown() {
if (shutdownPromise) {
await shutdownPromise;
}
}
//# sourceMappingURL=impl.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1 @@
export declare function turbopackBuild(withWorker: boolean): ReturnType<typeof import('./impl').turbopackBuild>;

79
node_modules/next/dist/build/turbopack-build/index.js generated vendored Normal file
View File

@@ -0,0 +1,79 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "turbopackBuild", {
enumerable: true,
get: function() {
return turbopackBuild;
}
});
const _path = /*#__PURE__*/ _interop_require_default(require("path"));
const _utils = require("../../server/lib/utils");
const _worker = require("../../lib/worker");
const _buildcontext = require("../build-context");
function _interop_require_default(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
async function turbopackBuildWithWorker() {
const nodeOptions = (0, _utils.getParsedNodeOptionsWithoutInspect)();
try {
const worker = new _worker.Worker(_path.default.join(__dirname, 'impl.js'), {
exposedMethods: [
'workerMain',
'waitForShutdown'
],
numWorkers: 1,
maxRetries: 0,
forkOptions: {
env: {
...process.env,
NEXT_PRIVATE_BUILD_WORKER: '1',
NODE_OPTIONS: (0, _utils.formatNodeOptions)(nodeOptions)
}
}
});
const { nextBuildSpan, ...prunedBuildContext } = _buildcontext.NextBuildContext;
const result = await worker.workerMain({
buildContext: prunedBuildContext
});
// destroy worker when Turbopack has shutdown so it's not sticking around using memory
// We need to wait for shutdown to make sure persistent cache is flushed
result.shutdownPromise = worker.waitForShutdown().then(()=>{
worker.end();
});
return result;
} catch (err) {
// When the error is a serialized `Error` object we need to recreate the `Error` instance
// in order to keep the consistent error reporting behavior.
if (err.type === 'Error') {
const error = Object.defineProperty(new Error(err.message), "__NEXT_ERROR_CODE", {
value: "E394",
enumerable: false,
configurable: true
});
if (err.name) {
error.name = err.name;
}
if (err.cause) {
error.cause = err.cause;
}
error.message = err.message;
error.stack = err.stack;
throw error;
}
throw err;
}
}
function turbopackBuild(withWorker) {
if (withWorker) {
return turbopackBuildWithWorker();
} else {
const build = require('./impl').turbopackBuild;
return build();
}
}
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../src/build/turbopack-build/index.ts"],"sourcesContent":["import path from 'path'\nimport {\n formatNodeOptions,\n getParsedNodeOptionsWithoutInspect,\n} from '../../server/lib/utils'\nimport { Worker } from '../../lib/worker'\nimport { NextBuildContext } from '../build-context'\n\nasync function turbopackBuildWithWorker() {\n const nodeOptions = getParsedNodeOptionsWithoutInspect()\n\n try {\n const worker = new Worker(path.join(__dirname, 'impl.js'), {\n exposedMethods: ['workerMain', 'waitForShutdown'],\n numWorkers: 1,\n maxRetries: 0,\n forkOptions: {\n env: {\n ...process.env,\n NEXT_PRIVATE_BUILD_WORKER: '1',\n NODE_OPTIONS: formatNodeOptions(nodeOptions),\n },\n },\n }) as Worker & typeof import('./impl')\n const { nextBuildSpan, ...prunedBuildContext } = NextBuildContext\n const result = await worker.workerMain({\n buildContext: prunedBuildContext,\n })\n\n // destroy worker when Turbopack has shutdown so it's not sticking around using memory\n // We need to wait for shutdown to make sure persistent cache is flushed\n result.shutdownPromise = worker.waitForShutdown().then(() => {\n worker.end()\n })\n\n return result\n } catch (err: any) {\n // When the error is a serialized `Error` object we need to recreate the `Error` instance\n // in order to keep the consistent error reporting behavior.\n if (err.type === 'Error') {\n const error = new Error(err.message)\n if (err.name) {\n error.name = err.name\n }\n if (err.cause) {\n error.cause = err.cause\n }\n error.message = err.message\n error.stack = err.stack\n throw error\n }\n throw err\n }\n}\n\nexport function turbopackBuild(\n withWorker: boolean\n): ReturnType<typeof import('./impl').turbopackBuild> {\n if (withWorker) {\n return turbopackBuildWithWorker()\n } else {\n const build = (require('./impl') as typeof import('./impl')).turbopackBuild\n return build()\n }\n}\n"],"names":["turbopackBuild","turbopackBuildWithWorker","nodeOptions","getParsedNodeOptionsWithoutInspect","worker","Worker","path","join","__dirname","exposedMethods","numWorkers","maxRetries","forkOptions","env","process","NEXT_PRIVATE_BUILD_WORKER","NODE_OPTIONS","formatNodeOptions","nextBuildSpan","prunedBuildContext","NextBuildContext","result","workerMain","buildContext","shutdownPromise","waitForShutdown","then","end","err","type","error","Error","message","name","cause","stack","withWorker","build","require"],"mappings":";;;;+BAuDgBA;;;eAAAA;;;6DAvDC;uBAIV;wBACgB;8BACU;;;;;;AAEjC,eAAeC;IACb,MAAMC,cAAcC,IAAAA,yCAAkC;IAEtD,IAAI;QACF,MAAMC,SAAS,IAAIC,cAAM,CAACC,aAAI,CAACC,IAAI,CAACC,WAAW,YAAY;YACzDC,gBAAgB;gBAAC;gBAAc;aAAkB;YACjDC,YAAY;YACZC,YAAY;YACZC,aAAa;gBACXC,KAAK;oBACH,GAAGC,QAAQD,GAAG;oBACdE,2BAA2B;oBAC3BC,cAAcC,IAAAA,wBAAiB,EAACf;gBAClC;YACF;QACF;QACA,MAAM,EAAEgB,aAAa,EAAE,GAAGC,oBAAoB,GAAGC,8BAAgB;QACjE,MAAMC,SAAS,MAAMjB,OAAOkB,UAAU,CAAC;YACrCC,cAAcJ;QAChB;QAEA,sFAAsF;QACtF,wEAAwE;QACxEE,OAAOG,eAAe,GAAGpB,OAAOqB,eAAe,GAAGC,IAAI,CAAC;YACrDtB,OAAOuB,GAAG;QACZ;QAEA,OAAON;IACT,EAAE,OAAOO,KAAU;QACjB,yFAAyF;QACzF,4DAA4D;QAC5D,IAAIA,IAAIC,IAAI,KAAK,SAAS;YACxB,MAAMC,QAAQ,qBAAsB,CAAtB,IAAIC,MAAMH,IAAII,OAAO,GAArB,qBAAA;uBAAA;4BAAA;8BAAA;YAAqB;YACnC,IAAIJ,IAAIK,IAAI,EAAE;gBACZH,MAAMG,IAAI,GAAGL,IAAIK,IAAI;YACvB;YACA,IAAIL,IAAIM,KAAK,EAAE;gBACbJ,MAAMI,KAAK,GAAGN,IAAIM,KAAK;YACzB;YACAJ,MAAME,OAAO,GAAGJ,IAAII,OAAO;YAC3BF,MAAMK,KAAK,GAAGP,IAAIO,KAAK;YACvB,MAAML;QACR;QACA,MAAMF;IACR;AACF;AAEO,SAAS5B,eACdoC,UAAmB;IAEnB,IAAIA,YAAY;QACd,OAAOnC;IACT,OAAO;QACL,MAAMoC,QAAQ,AAACC,QAAQ,UAAsCtC,cAAc;QAC3E,OAAOqC;IACT;AACF"}