Initial boiler plate project

This commit is contained in:
2024-09-24 03:52:46 +00:00
parent 6120b2d6c3
commit 154b93e267
10034 changed files with 2079352 additions and 2 deletions

View File

@ -0,0 +1 @@
export declare function createServerReference(id: string): any;

View File

@ -0,0 +1,23 @@
// This file must be bundled in the app's client layer, it shouldn't be directly
// imported by the server.
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "createServerReference", {
enumerable: true,
get: function() {
return createServerReference;
}
});
const _appcallserver = require("next/dist/client/app-call-server");
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, _appcallserver.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":["createServerReference","id","createServerReferenceImpl","process","env","NEXT_RUNTIME","require","callServer"],"mappings":"AAAA,gFAAgF;AAChF,0BAA0B;;;;;+BAMVA;;;eAAAA;;;+BAJW;AAIpB,SAASA,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,IAAIM,yBAAU;AACjD"}

View File

@ -0,0 +1 @@
export declare function ensureServerEntryExports(actions: any[]): void;

View File

@ -0,0 +1,23 @@
// 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.
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "ensureServerEntryExports", {
enumerable: true,
get: function() {
return ensureServerEntryExports;
}
});
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}.\nRead more: https://nextjs.org/docs/messages/invalid-use-server-value`);
}
}
}
//# 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;;;;;+BACjDA;;;eAAAA;;;AAAT,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,uEAAuE,CAAC;QAExJ;IACF;AACF"}

View File

@ -0,0 +1,5 @@
import type { webpack } from 'next/dist/compiled/webpack/webpack';
type SourceType = 'auto' | 'commonjs' | 'module';
export declare function getAssumedSourceType(mod: webpack.Module, sourceType: SourceType): SourceType;
export default function transformSource(this: any, source: string, sourceMap: any): void;
export {};

View File

@ -0,0 +1,120 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
0 && (module.exports = {
default: null,
getAssumedSourceType: null
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
default: function() {
return transformSource;
},
getAssumedSourceType: function() {
return getAssumedSourceType;
}
});
const _constants = require("../../../../lib/constants");
const _constants1 = require("../../../../shared/lib/constants");
const _warnonce = require("../../../../shared/lib/utils/warn-once");
const _getpagestaticinfo = require("../../../analysis/get-page-static-info");
const _utils = require("../../utils");
const _getmodulebuildinfo = require("../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";
function getAssumedSourceType(mod, sourceType) {
var _buildInfo_rsc, _buildInfo_rsc1;
const buildInfo = (0, _getmodulebuildinfo.getModuleBuildInfo)(mod);
const detectedClientEntryType = buildInfo == null ? void 0 : (_buildInfo_rsc = buildInfo.rsc) == null ? void 0 : _buildInfo_rsc.clientEntryType;
const clientRefs = (buildInfo == null ? void 0 : (_buildInfo_rsc1 = buildInfo.rsc) == null ? void 0 : _buildInfo_rsc1.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";
}
}
return assumedSourceType;
}
function transformSource(source, sourceMap) {
var _this__module_matchResource, _this__module, _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 = (0, _getmodulebuildinfo.getModuleBuildInfo)(this._module);
buildInfo.rsc = (0, _getpagestaticinfo.getRSCModuleInformation)(source, true);
// Resource key is the unique identifier for the resource. When RSC renders
// a client module, that key is used to identify that module across all compiler
// layers.
//
// Usually it's the module's file path + the export name (e.g. `foo.js#bar`).
// But with Barrel Optimizations, one file can be splitted into multiple modules,
// so when you import `foo.js#bar` and `foo.js#baz`, they are actually different
// "foo.js" being created by the Barrel Loader (one only exports `bar`, the other
// only exports `baz`).
//
// Because of that, we must add another query param to the resource key to
// differentiate them.
let resourceKey = this.resourcePath;
if ((_this__module = this._module) == null ? void 0 : (_this__module_matchResource = _this__module.matchResource) == null ? void 0 : _this__module_matchResource.startsWith(_constants1.BARREL_OPTIMIZATION_PREFIX)) {
resourceKey = (0, _utils.formatBarrelOptimizedResource)(resourceKey, this._module.matchResource);
}
// A client boundary.
if (((_buildInfo_rsc = buildInfo.rsc) == null ? void 0 : _buildInfo_rsc.type) === _constants1.RSC_MODULE_TYPES.client) {
var _this__module_parser, _this__module1;
const assumedSourceType = getAssumedSourceType(this._module, (_this__module1 = this._module) == null ? void 0 : (_this__module_parser = _this__module1.parser) == null ? void 0 : _this__module_parser.sourceType);
const clientRefs = buildInfo.rsc.clientRefs;
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}"
`;
let cnt = 0;
for (const ref of clientRefs){
if (ref === "") {
esmSource += `\nexports[''] = createProxy(String.raw\`${resourceKey}#\`);`;
} else if (ref === "default") {
esmSource += `\
export default createProxy(String.raw\`${resourceKey}#default\`);
`;
} else {
esmSource += `
const e${cnt} = createProxy(String.raw\`${resourceKey}#${ref}\`);
export { e${cnt++} as ${ref} };`;
}
}
this.callback(null, esmSource, sourceMap);
return;
}
}
if (((_buildInfo_rsc1 = buildInfo.rsc) == null ? void 0 : _buildInfo_rsc1.type) !== _constants1.RSC_MODULE_TYPES.client) {
if (noopHeadPath === this.resourcePath) {
(0, _warnonce.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.`);
}
}
const replacedSource = source.replace(_constants.RSC_MOD_REF_PROXY_ALIAS, MODULE_PROXY_PATH);
this.callback(null, replacedSource, sourceMap);
}
//# sourceMappingURL=index.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../../../src/build/webpack/loaders/next-flight-loader/index.ts"],"names":["transformSource","getAssumedSourceType","noopHeadPath","require","resolve","MODULE_PROXY_PATH","mod","sourceType","buildInfo","getModuleBuildInfo","detectedClientEntryType","rsc","clientEntryType","clientRefs","assumedSourceType","length","includes","source","sourceMap","Error","_module","getRSCModuleInformation","resourceKey","resourcePath","matchResource","startsWith","BARREL_OPTIMIZATION_PREFIX","formatBarrelOptimizedResource","type","RSC_MODULE_TYPES","client","parser","callback","esmSource","cnt","ref","warnOnce","replacedSource","replace","RSC_MOD_REF_PROXY_ALIAS"],"mappings":";;;;;;;;;;;;;;;IA8CA,OAyFC;eAzFuBA;;IA7BRC,oBAAoB;eAApBA;;;2BAhBwB;4BAIjC;0BACkB;mCACe;uBACM;oCACX;AAEnC,MAAMC,eAAeC,QAAQC,OAAO,CAAC;AACrC,gEAAgE;AAChE,MAAMC,oBACJ;AAGK,SAASJ,qBACdK,GAAmB,EACnBC,UAAsB;QAGUC,gBACbA;IAFnB,MAAMA,YAAYC,IAAAA,sCAAkB,EAACH;IACrC,MAAMI,0BAA0BF,8BAAAA,iBAAAA,UAAWG,GAAG,qBAAdH,eAAgBI,eAAe;IAC/D,MAAMC,aAAaL,CAAAA,8BAAAA,kBAAAA,UAAWG,GAAG,qBAAdH,gBAAgBK,UAAU,KAAI,EAAE;IAEnD,4EAA4E;IAC5E,6EAA6E;IAC7E,4DAA4D;IAC5D,IAAIC,oBAAoBP;IACxB,IAAIO,sBAAsB,UAAUJ,4BAA4B,QAAQ;QACtE,IACEG,WAAWE,MAAM,KAAK,KACrBF,WAAWE,MAAM,KAAK,KAAKF,UAAU,CAAC,EAAE,KAAK,IAC9C;YACA,uEAAuE;YACvE,yEAAyE;YACzE,oBAAoB;YACpBC,oBAAoB;QACtB,OAAO,IAAI,CAACD,WAAWG,Q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;YAEA,IAAIc,YAAY,CAAC;6BACM,EAAE5B,kBAAkB;AACjD,CAAC;YACK,IAAI6B,MAAM;YACV,KAAK,MAAMC,OAAOtB,WAAY;gBAC5B,IAAIsB,QAAQ,IAAI;oBACdF,aAAa,CAAC,wCAAwC,EAAEX,YAAY,KAAK,CAAC;gBAC5E,OAAO,IAAIa,QAAQ,WAAW;oBAC5BF,aAAa,CAAC;uCACe,EAAEX,YAAY;AACrD,CAAC;gBACO,OAAO;oBACLW,aAAa,CAAC;OACjB,EAAEC,IAAI,2BAA2B,EAAEZ,YAAY,CAAC,EAAEa,IAAI;UACnD,EAAED,MAAM,IAAI,EAAEC,IAAI,GAAG,CAAC;gBACxB;YACF;YAEA,IAAI,CAACH,QAAQ,CAAC,MAAMC,WAAWf;YAC/B;QACF;IACF;IAEA,IAAIV,EAAAA,kBAAAA,UAAUG,GAAG,qBAAbH,gBAAeoB,IAAI,MAAKC,4BAAgB,CAACC,MAAM,EAAE;QACnD,IAAI5B,iBAAiB,IAAI,CAACqB,YAAY,EAAE;YACtCa,IAAAA,kBAAQ,EACN,CAAC,0OAA0O,CAAC;QAEhP;IACF;IAEA,MAAMC,iBAAiBpB,OAAOqB,OAAO,CACnCC,kCAAuB,EACvBlC;IAEF,IAAI,CAAC2B,QAAQ,CAAC,MAAMK,gBAAgBnB;AACtC"}

View File

@ -0,0 +1 @@
export declare const createProxy: (moduleId: string) => any;

View File

@ -0,0 +1,14 @@
/* eslint-disable import/no-extraneous-dependencies */ "use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "createProxy", {
enumerable: true,
get: function() {
return createProxy;
}
});
const _serveredge = require("react-server-dom-webpack/server.edge");
const createProxy = _serveredge.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":["createProxy","createClientModuleProxy"],"mappings":"AAAA,oDAAoD;;;;+BAIvCA;;;eAAAA;;;4BAH2B;AAGjC,MAAMA,cAAyCC,mCAAuB"}

View File

@ -0,0 +1 @@
export declare function registerServerReference(id: string, action: any): any;

View File

@ -0,0 +1,16 @@
/* eslint-disable import/no-extraneous-dependencies */ "use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "registerServerReference", {
enumerable: true,
get: function() {
return registerServerReference;
}
});
const _serveredge = require("react-server-dom-webpack/server.edge");
function registerServerReference(id, action) {
return (0, _serveredge.registerServerReference)(action, id, null);
}
//# sourceMappingURL=server-reference.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../../../src/build/webpack/loaders/next-flight-loader/server-reference.ts"],"names":["registerServerReference","id","action","flightRegisterServerReference"],"mappings":"AAAA,oDAAoD;;;;+BAGpCA;;;eAAAA;;;4BAFyD;AAElE,SAASA,wBAAwBC,EAAU,EAAEC,MAAW;IAC7D,OAAOC,IAAAA,mCAA6B,EAACD,QAAQD,IAAI;AACnD"}