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

View File

@@ -0,0 +1,12 @@
import type { webpack } from 'next/dist/compiled/webpack/webpack';
export type EdgeAppRouteLoaderQuery = {
absolutePagePath: string;
page: string;
appDirLoader: string;
preferredRegion: string | string[] | undefined;
nextConfig: string;
middlewareConfig: string;
cacheHandlers: string;
};
declare const EdgeAppRouteLoader: webpack.LoaderDefinitionFunction<EdgeAppRouteLoaderQuery>;
export default EdgeAppRouteLoader;

View File

@@ -0,0 +1,54 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "default", {
enumerable: true,
get: function() {
return _default;
}
});
const _getmodulebuildinfo = require("../get-module-build-info");
const _stringifyrequest = require("../../stringify-request");
const _constants = require("../../../../lib/constants");
const _loadentrypoint = require("../../../load-entrypoint");
const _ismetadataroute = require("../../../../lib/metadata/is-metadata-route");
const EdgeAppRouteLoader = async function() {
const { page, absolutePagePath, preferredRegion, appDirLoader: appDirLoaderBase64 = '', middlewareConfig: middlewareConfigBase64 = '', nextConfig: nextConfigBase64, cacheHandlers: cacheHandlersStringified } = this.getOptions();
const appDirLoader = Buffer.from(appDirLoaderBase64, 'base64').toString();
const middlewareConfig = JSON.parse(Buffer.from(middlewareConfigBase64, 'base64').toString());
const cacheHandlers = JSON.parse(cacheHandlersStringified || '{}');
if (!cacheHandlers.default) {
cacheHandlers.default = require.resolve('../../../../server/lib/cache-handlers/default');
}
// Ensure we only run this loader for as a module.
if (!this._module) throw Object.defineProperty(new Error('This loader is only usable as a module'), "__NEXT_ERROR_CODE", {
value: "E433",
enumerable: false,
configurable: true
});
const buildInfo = (0, _getmodulebuildinfo.getModuleBuildInfo)(this._module);
buildInfo.nextEdgeSSR = {
isServerComponent: !(0, _ismetadataroute.isMetadataRoute)(page),
page: page,
isAppDir: true
};
buildInfo.route = {
page,
absolutePagePath,
preferredRegion,
middlewareConfig
};
const stringifiedPagePath = (0, _stringifyrequest.stringifyRequest)(this, absolutePagePath);
const modulePath = `${appDirLoader}${stringifiedPagePath.substring(1, stringifiedPagePath.length - 1)}?${_constants.WEBPACK_RESOURCE_QUERIES.edgeSSREntry}`;
const stringifiedConfig = Buffer.from(nextConfigBase64 || '', 'base64').toString();
return await (0, _loadentrypoint.loadEntrypoint)('edge-app-route', {
VAR_USERLAND: modulePath,
VAR_PAGE: page
}, {
nextConfig: stringifiedConfig
});
};
const _default = EdgeAppRouteLoader;
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../../src/build/webpack/loaders/next-edge-app-route-loader/index.ts"],"sourcesContent":["import { getModuleBuildInfo } from '../get-module-build-info'\nimport { stringifyRequest } from '../../stringify-request'\nimport type { webpack } from 'next/dist/compiled/webpack/webpack'\nimport { WEBPACK_RESOURCE_QUERIES } from '../../../../lib/constants'\nimport type { MiddlewareConfig } from '../../../analysis/get-page-static-info'\nimport { loadEntrypoint } from '../../../load-entrypoint'\nimport { isMetadataRoute } from '../../../../lib/metadata/is-metadata-route'\n\nexport type EdgeAppRouteLoaderQuery = {\n absolutePagePath: string\n page: string\n appDirLoader: string\n preferredRegion: string | string[] | undefined\n nextConfig: string\n middlewareConfig: string\n cacheHandlers: string\n}\n\nconst EdgeAppRouteLoader: webpack.LoaderDefinitionFunction<EdgeAppRouteLoaderQuery> =\n async function (this) {\n const {\n page,\n absolutePagePath,\n preferredRegion,\n appDirLoader: appDirLoaderBase64 = '',\n middlewareConfig: middlewareConfigBase64 = '',\n nextConfig: nextConfigBase64,\n cacheHandlers: cacheHandlersStringified,\n } = this.getOptions()\n\n const appDirLoader = Buffer.from(appDirLoaderBase64, 'base64').toString()\n const middlewareConfig: MiddlewareConfig = JSON.parse(\n Buffer.from(middlewareConfigBase64, 'base64').toString()\n )\n\n const cacheHandlers = JSON.parse(cacheHandlersStringified || '{}')\n\n if (!cacheHandlers.default) {\n cacheHandlers.default = require.resolve(\n '../../../../server/lib/cache-handlers/default'\n )\n }\n\n // Ensure we only run this loader for as a module.\n if (!this._module) throw new Error('This loader is only usable as a module')\n\n const buildInfo = getModuleBuildInfo(this._module)\n\n buildInfo.nextEdgeSSR = {\n isServerComponent: !isMetadataRoute(page), // Needed for 'use cache'.\n page: page,\n isAppDir: true,\n }\n buildInfo.route = {\n page,\n absolutePagePath,\n preferredRegion,\n middlewareConfig,\n }\n\n const stringifiedPagePath = stringifyRequest(this, absolutePagePath)\n const modulePath = `${appDirLoader}${stringifiedPagePath.substring(\n 1,\n stringifiedPagePath.length - 1\n )}?${WEBPACK_RESOURCE_QUERIES.edgeSSREntry}`\n\n const stringifiedConfig = Buffer.from(\n nextConfigBase64 || '',\n 'base64'\n ).toString()\n\n return await loadEntrypoint(\n 'edge-app-route',\n {\n VAR_USERLAND: modulePath,\n VAR_PAGE: page,\n },\n {\n nextConfig: stringifiedConfig,\n }\n )\n }\n\nexport default EdgeAppRouteLoader\n"],"names":["EdgeAppRouteLoader","page","absolutePagePath","preferredRegion","appDirLoader","appDirLoaderBase64","middlewareConfig","middlewareConfigBase64","nextConfig","nextConfigBase64","cacheHandlers","cacheHandlersStringified","getOptions","Buffer","from","toString","JSON","parse","default","require","resolve","_module","Error","buildInfo","getModuleBuildInfo","nextEdgeSSR","isServerComponent","isMetadataRoute","isAppDir","route","stringifiedPagePath","stringifyRequest","modulePath","substring","length","WEBPACK_RESOURCE_QUERIES","edgeSSREntry","stringifiedConfig","loadEntrypoint","VAR_USERLAND","VAR_PAGE"],"mappings":";;;;+BAmFA;;;eAAA;;;oCAnFmC;kCACF;2BAEQ;gCAEV;iCACC;AAYhC,MAAMA,qBACJ;IACE,MAAM,EACJC,IAAI,EACJC,gBAAgB,EAChBC,eAAe,EACfC,cAAcC,qBAAqB,EAAE,EACrCC,kBAAkBC,yBAAyB,EAAE,EAC7CC,YAAYC,gBAAgB,EAC5BC,eAAeC,wBAAwB,EACxC,GAAG,IAAI,CAACC,UAAU;IAEnB,MAAMR,eAAeS,OA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