main repo

This commit is contained in:
Basilosaurusrex
2025-11-24 18:09:40 +01:00
parent b636ee5e70
commit f027651f9b
34146 changed files with 4436636 additions and 0 deletions

View File

@@ -0,0 +1,15 @@
// This file must be bundled in the app's client layer, it shouldn't be directly
// imported by the server.
import { callServer } from "next/dist/client/app-call-server";
// A noop wrapper to let the Flight client create the server reference.
// See also: https://github.com/facebook/react/pull/26632
export function createServerReference(id) {
// Since we're using the Edge build of Flight client for SSR [1], here we need to
// also use the same Edge build to create the reference. For the client bundle,
// we use the default and let Webpack to resolve it to the correct version.
// 1: https://github.com/vercel/next.js/blob/16eb80b0b0be13f04a6407943664b5efd8f3d7d0/packages/next/src/server/app-render/use-flight-response.tsx#L24-L26
const { createServerReference: createServerReferenceImpl } = !!process.env.NEXT_RUNTIME ? require("react-server-dom-webpack/client.edge") : require("react-server-dom-webpack/client");
return createServerReferenceImpl(id, callServer);
}
//# sourceMappingURL=action-client-wrapper.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../../src/build/webpack/loaders/next-flight-loader/action-client-wrapper.ts"],"names":["callServer","createServerReference","id","createServerReferenceImpl","process","env","NEXT_RUNTIME","require"],"mappings":"AAAA,gFAAgF;AAChF,0BAA0B;AAE1B,SAASA,UAAU,QAAQ,mCAAkC;AAE7D,uEAAuE;AACvE,yDAAyD;AACzD,OAAO,SAASC,sBAAsBC,EAAU;IAC9C,iFAAiF;IACjF,+EAA+E;IAC/E,2EAA2E;IAC3E,yJAAyJ;IACzJ,MAAM,EAAED,uBAAuBE,yBAAyB,EAAE,GACxD,CAAC,CAACC,QAAQC,GAAG,CAACC,YAAY,GAEtBC,QAAQ,0CAERA,QAAQ;IAGd,OAAOJ,0BAA0BD,IAAIF;AACvC"}

View File

@@ -0,0 +1,43 @@
const SERVER_REFERENCE_TAG = Symbol.for("react.server.reference");
export function createActionProxy(id, bound, action, originalAction) {
function bindImpl(_, ...boundArgs) {
const currentAction = this;
const newAction = async function(...args) {
if (originalAction) {
return originalAction(newAction.$$bound.concat(args));
} else {
// In this case we're calling the user-defined action directly.
return currentAction(...newAction.$$bound, ...args);
}
};
for (const key of [
"$$typeof",
"$$id",
"$$FORM_ACTION"
]){
// @ts-ignore
newAction[key] = currentAction[key];
}
// Rebind args
newAction.$$bound = (currentAction.$$bound || []).concat(boundArgs);
// Assign bind method
newAction.bind = bindImpl.bind(newAction);
return newAction;
}
Object.defineProperties(action, {
$$typeof: {
value: SERVER_REFERENCE_TAG
},
$$id: {
value: id
},
$$bound: {
value: bound
},
bind: {
value: bindImpl
}
});
}
//# sourceMappingURL=action-proxy.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../../src/build/webpack/loaders/next-flight-loader/action-proxy.ts"],"names":["SERVER_REFERENCE_TAG","Symbol","for","createActionProxy","id","bound","action","originalAction","bindImpl","_","boundArgs","currentAction","newAction","args","$$bound","concat","key","bind","Object","defineProperties","$$typeof","value","$$id"],"mappings":"AAAA,MAAMA,uBAAuBC,OAAOC,GAAG,CAAC;AAExC,OAAO,SAASC,kBACdC,EAAU,EACVC,KAAmB,EACnBC,MAAW,EACXC,cAAoB;IAEpB,SAASC,SAAoBC,CAAM,EAAE,GAAGC,SAAgB;QACtD,MAAMC,gBAAgB,IAAI;QAE1B,MAAMC,YAAY,eAAgB,GAAGC,IAAW;YAC9C,IAAIN,gBAAgB;gBAClB,OAAOA,eAAeK,UAAUE,OAAO,CAACC,MAAM,CAACF;YACjD,OAAO;gBACL,+DAA+D;gBAC/D,OAAOF,iBAAiBC,UAAUE,OAAO,KAAKD;YAChD;QACF;QAEA,KAAK,MAAMG,OAAO;YAAC;YAAY;YAAQ;SAAgB,CAAE;YACvD,aAAa;YACbJ,SAAS,CAACI,IAAI,GAAGL,aAAa,CAACK,IAAI;QACrC;QAEA,cAAc;QACdJ,UAAUE,OAAO,GAAG,AAACH,CAAAA,cAAcG,OAAO,IAAI,EAAE,AAAD,EAAGC,MAAM,CAACL;QAEzD,qBAAqB;QACrBE,UAAUK,IAAI,GAAGT,SAASS,IAAI,CAACL;QAE/B,OAAOA;IACT;IAEAM,OAAOC,gBAAgB,CAACb,QAAQ;QAC9Bc,UAAU;YACRC,OAAOrB;QACT;QACAsB,MAAM;YACJD,OAAOjB;QACT;QACAU,SAAS;YACPO,OAAOhB;QACT;QACAY,MAAM;YACJI,OAAOb;QACT;IACF;AACF"}

View File

@@ -0,0 +1,13 @@
// This function ensures that all the exported values are valid server actions,
// during the runtime. By definition all actions are required to be async
// functions, but here we can only check that they are functions.
export function ensureServerEntryExports(actions) {
for(let i = 0; i < actions.length; i++){
const action = actions[i];
if (typeof action !== "function") {
throw new Error(`A "use server" file can only export async functions, found ${typeof action}.`);
}
}
}
//# sourceMappingURL=action-validate.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../../src/build/webpack/loaders/next-flight-loader/action-validate.ts"],"names":["ensureServerEntryExports","actions","i","length","action","Error"],"mappings":"AAAA,+EAA+E;AAC/E,yEAAyE;AACzE,iEAAiE;AACjE,OAAO,SAASA,yBAAyBC,OAAc;IACrD,IAAK,IAAIC,IAAI,GAAGA,IAAID,QAAQE,MAAM,EAAED,IAAK;QACvC,MAAME,SAASH,OAAO,CAACC,EAAE;QACzB,IAAI,OAAOE,WAAW,YAAY;YAChC,MAAM,IAAIC,MACR,CAAC,2DAA2D,EAAE,OAAOD,OAAO,CAAC,CAAC;QAElF;IACF;AACF"}

View File

@@ -0,0 +1,82 @@
import { RSC_MOD_REF_PROXY_ALIAS } from "../../../../lib/constants";
import { RSC_MODULE_TYPES } from "../../../../shared/lib/constants";
import { warnOnce } from "../../../../shared/lib/utils/warn-once";
import { getRSCModuleInformation } from "../../../analysis/get-page-static-info";
import { getModuleBuildInfo } from "../get-module-build-info";
const noopHeadPath = require.resolve("next/dist/client/components/noop-head");
// For edge runtime it will be aliased to esm version by webpack
const MODULE_PROXY_PATH = "next/dist/build/webpack/loaders/next-flight-loader/module-proxy";
export default function transformSource(source, sourceMap) {
var _buildInfo_rsc, _buildInfo_rsc1;
// Avoid buffer to be consumed
if (typeof source !== "string") {
throw new Error("Expected source to have been transformed to a string.");
}
// Assign the RSC meta information to buildInfo.
// Exclude next internal files which are not marked as client files
const buildInfo = getModuleBuildInfo(this._module);
buildInfo.rsc = getRSCModuleInformation(source, true);
// A client boundary.
if (((_buildInfo_rsc = buildInfo.rsc) == null ? void 0 : _buildInfo_rsc.type) === RSC_MODULE_TYPES.client) {
var _this__module_parser, _this__module;
const sourceType = (_this__module = this._module) == null ? void 0 : (_this__module_parser = _this__module.parser) == null ? void 0 : _this__module_parser.sourceType;
const detectedClientEntryType = buildInfo.rsc.clientEntryType;
const clientRefs = buildInfo.rsc.clientRefs;
// It's tricky to detect the type of a client boundary, but we should always
// use the `module` type when we can, to support `export *` and `export from`
// syntax in other modules that import this client boundary.
let assumedSourceType = sourceType;
if (assumedSourceType === "auto" && detectedClientEntryType === "auto") {
if (clientRefs.length === 0 || clientRefs.length === 1 && clientRefs[0] === "") {
// If there's zero export detected in the client boundary, and it's the
// `auto` type, we can safely assume it's a CJS module because it doesn't
// have ESM exports.
assumedSourceType = "commonjs";
} else if (!clientRefs.includes("*")) {
// Otherwise, we assume it's an ESM module.
assumedSourceType = "module";
}
}
if (assumedSourceType === "module") {
if (clientRefs.includes("*")) {
this.callback(new Error(`It's currently unsupported to use "export *" in a client boundary. Please use named exports instead.`));
return;
}
let esmSource = `\
import { createProxy } from "${MODULE_PROXY_PATH}"
const proxy = createProxy(String.raw\`${this.resourcePath}\`)
// Accessing the __esModule property and exporting $$typeof are required here.
// The __esModule getter forces the proxy target to create the default export
// and the $$typeof value is for rendering logic to determine if the module
// is a client boundary.
const { __esModule, $$typeof } = proxy;
const __default__ = proxy.default;
`;
let cnt = 0;
for (const ref of clientRefs){
if (ref === "") {
esmSource += `\nexports[''] = proxy[''];`;
} else if (ref === "default") {
esmSource += `
export { __esModule, $$typeof };
export default __default__;`;
} else {
esmSource += `
const e${cnt} = proxy["${ref}"];
export { e${cnt++} as ${ref} };`;
}
}
this.callback(null, esmSource, sourceMap);
return;
}
}
if (((_buildInfo_rsc1 = buildInfo.rsc) == null ? void 0 : _buildInfo_rsc1.type) !== RSC_MODULE_TYPES.client) {
if (noopHeadPath === this.resourcePath) {
warnOnce(`Warning: You're using \`next/head\` inside the \`app\` directory, please migrate to the Metadata API. See https://nextjs.org/docs/app/building-your-application/upgrading/app-router-migration#step-3-migrating-nexthead for more details.`);
}
}
this.callback(null, source.replace(RSC_MOD_REF_PROXY_ALIAS, MODULE_PROXY_PATH), sourceMap);
}
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../../src/build/webpack/loaders/next-flight-loader/index.ts"],"names":["RSC_MOD_REF_PROXY_ALIAS","RSC_MODULE_TYPES","warnOnce","getRSCModuleInformation","getModuleBuildInfo","noopHeadPath","require","resolve","MODULE_PROXY_PATH","transformSource","source","sourceMap","buildInfo","Error","_module","rsc","type","client","sourceType","parser","detectedClientEntryType","clientEntryType","clientRefs","assumedSourceType","length","includes","callback","esmSource","resourcePath","cnt","ref","replace"],"mappings":"AAAA,SAASA,uBAAuB,QAAQ,4BAA2B;AACnE,SAASC,gBAAgB,QAAQ,mCAAkC;AACnE,SAASC,QAAQ,QAAQ,yCAAwC;AACjE,SAASC,uBAAuB,QAAQ,yCAAwC;AAChF,SAASC,kBAAkB,QAAQ,2BAA0B;AAE7D,MAAMC,eAAeC,QAAQC,OAAO,CAAC;AACrC,gEAAgE;AAChE,MAAMC,oBACJ;AAEF,eAAe,SAASC,gBAEtBC,MAAc,EACdC,SAAc;QAaVC,gBAiEAA;IA5EJ,8BAA8B;IAC9B,IAAI,OAAOF,WAAW,UAAU;QAC9B,MAAM,IAAIG,MAAM;IAClB;IAEA,gDAAgD;IAChD,mEAAmE;IACnE,MAAMD,YAAYR,mBAAmB,IAAI,CAACU,OAAO;IACjDF,UAAUG,GAAG,GAAGZ,wBAAwBO,QAAQ;IAEhD,qBAAqB;IACrB,IAAIE,EAAAA,iB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,QAAQ,CAAC,MAAMC,WAAWhB;YAC/B;QACF;IACF;IAEA,IAAIC,EAAAA,kBAAAA,UAAUG,GAAG,qBAAbH,gBAAeI,IAAI,MAAKf,iBAAiBgB,MAAM,EAAE;QACnD,IAAIZ,iBAAiB,IAAI,CAACuB,YAAY,EAAE;YACtC1B,SACE,CAAC,0OAA0O,CAAC;QAEhP;IACF;IAEA,IAAI,CAACwB,QAAQ,CACX,MACAhB,OAAOqB,OAAO,CAAC/B,yBAAyBQ,oBACxCG;AAEJ"}

View File

@@ -0,0 +1,5 @@
/* eslint-disable import/no-extraneous-dependencies */ import { createClientModuleProxy } from "react-server-dom-webpack/server.edge";
// Re-assign to make it typed.
export const createProxy = createClientModuleProxy;
//# sourceMappingURL=module-proxy.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../../src/build/webpack/loaders/next-flight-loader/module-proxy.ts"],"names":["createClientModuleProxy","createProxy"],"mappings":"AAAA,oDAAoD,GACpD,SAASA,uBAAuB,QAAQ,uCAAsC;AAE9E,8BAA8B;AAC9B,OAAO,MAAMC,cAAyCD,wBAAuB"}