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,43 @@
import path from "path";
import { IncrementalCache } from "../../server/lib/incremental-cache";
import { hasNextSupport } from "../../telemetry/ci-info";
import { nodeFs } from "../../server/lib/node-fs-methods";
import { interopDefault } from "../../lib/interop-default";
import { formatDynamicImportPath } from "../../lib/format-dynamic-import-path";
export async function createIncrementalCache({ cacheHandler, cacheMaxMemorySize, fetchCacheKeyPrefix, distDir, dir, enabledDirectories, experimental, flushToDisk }) {
// Custom cache handler overrides.
let CacheHandler;
if (cacheHandler) {
CacheHandler = interopDefault(await import(formatDynamicImportPath(dir, cacheHandler)).then((mod)=>mod.default || mod));
}
const incrementalCache = new IncrementalCache({
dev: false,
requestHeaders: {},
flushToDisk,
fetchCache: true,
maxMemoryCacheSize: cacheMaxMemorySize,
fetchCacheKeyPrefix,
getPrerenderManifest: ()=>({
version: 4,
routes: {},
dynamicRoutes: {},
preview: {
previewModeEncryptionKey: "",
previewModeId: "",
previewModeSigningKey: ""
},
notFoundRoutes: []
}),
fs: nodeFs,
pagesDir: enabledDirectories.pages,
appDir: enabledDirectories.app,
serverDistDir: path.join(distDir, "server"),
CurCacheHandler: CacheHandler,
minimalMode: hasNextSupport,
experimental
});
globalThis.__incrementalCache = incrementalCache;
return incrementalCache;
}
//# sourceMappingURL=create-incremental-cache.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../src/export/helpers/create-incremental-cache.ts"],"names":["path","IncrementalCache","hasNextSupport","nodeFs","interopDefault","formatDynamicImportPath","createIncrementalCache","cacheHandler","cacheMaxMemorySize","fetchCacheKeyPrefix","distDir","dir","enabledDirectories","experimental","flushToDisk","CacheHandler","then","mod","default","incrementalCache","dev","requestHeaders","fetchCache","maxMemoryCacheSize","getPrerenderManifest","version","routes","dynamicRoutes","preview","previewModeEncryptionKey","previewModeId","previewModeSigningKey","notFoundRoutes","fs","pagesDir","pages","appDir","app","serverDistDir","join","CurCacheHandler","minimalMode","globalThis","__incrementalCache"],"mappings":"AAEA,OAAOA,UAAU,OAAM;AACvB,SAASC,gBAAgB,QAAQ,qCAAoC;AACrE,SAASC,cAAc,QAAQ,0BAAyB;AACxD,SAASC,MAAM,QAAQ,mCAAkC;AACzD,SAASC,cAAc,QAAQ,4BAA2B;AAC1D,SAASC,uBAAuB,QAAQ,uCAAsC;AAE9E,OAAO,eAAeC,uBAAuB,EAC3CC,YAAY,EACZC,kBAAkB,EAClBC,mBAAmB,EACnBC,OAAO,EACPC,GAAG,EACHC,kBAAkB,EAClBC,YAAY,EACZC,WAAW,EAUZ;IACC,kCAAkC;IAClC,IAAIC;IACJ,IAAIR,cAAc;QAChBQ,eAAeX,eACb,MAAM,MAAM,CAACC,wBAAwBM,KAAKJ,eAAeS,IAAI,CAC3D,CAACC,MAAQA,IAAIC,OAAO,IAAID;IAG9B;IAEA,MAAME,mBAAmB,IAAIlB,iBAAiB;QAC5CmB,KAAK;QACLC,gBAAgB,CAAC;QACjBP;QACAQ,YAAY;QACZC,oBAAoBf;QACpBC;QACAe,sBAAsB,IAAO,CAAA;gBAC3BC,SAAS;gBACTC,QAAQ,CAAC;gBACTC,eAAe,CAAC;gBAChBC,SAAS;oBACPC,0BAA0B;oBAC1BC,eAAe;oBACfC,uBAAuB;gBACzB;gBACAC,gBAAgB,EAAE;YACpB,CAAA;QACAC,IAAI9B;QACJ+B,UAAUtB,mBAAmBuB,KAAK;QAClCC,QAAQxB,mBAAmByB,GAAG;QAC9BC,eAAetC,KAAKuC,IAAI,CAAC7B,SAAS;QAClC8B,iBAAiBzB;QACjB0B,aAAavC;QACbW;IACF;IAEE6B,WAAmBC,kBAAkB,GAAGxB;IAE1C,OAAOA;AACT"}

View File

@ -0,0 +1,27 @@
import { getRouteMatcher } from "../../shared/lib/router/utils/route-matcher";
import { getRouteRegex } from "../../shared/lib/router/utils/route-regex";
// The last page and matcher that this function handled.
let last = null;
/**
* Gets the params for the provided page.
* @param page the page that contains dynamic path parameters
* @param pathname the pathname to match
* @returns the matches that were found, throws otherwise
*/ export function getParams(page, pathname) {
// Because this is often called on the output of `getStaticPaths` or similar
// where the `page` here doesn't change, this will "remember" the last page
// it created the RegExp for. If it matches, it'll just re-use it.
let matcher;
if ((last == null ? void 0 : last.page) === page) {
matcher = last.matcher;
} else {
matcher = getRouteMatcher(getRouteRegex(page));
}
const params = matcher(pathname);
if (!params) {
throw new Error(`The provided export path '${pathname}' doesn't match the '${page}' page.\nRead more: https://nextjs.org/docs/messages/export-path-mismatch`);
}
return params;
}
//# sourceMappingURL=get-params.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../src/export/helpers/get-params.ts"],"names":["getRouteMatcher","getRouteRegex","last","getParams","page","pathname","matcher","params","Error"],"mappings":"AAAA,SAEEA,eAAe,QACV,8CAA6C;AACpD,SAASC,aAAa,QAAQ,4CAA2C;AAEzE,wDAAwD;AACxD,IAAIC,OAGO;AAEX;;;;;CAKC,GACD,OAAO,SAASC,UAAUC,IAAY,EAAEC,QAAgB;IACtD,4EAA4E;IAC5E,2EAA2E;IAC3E,kEAAkE;IAClE,IAAIC;IACJ,IAAIJ,CAAAA,wBAAAA,KAAME,IAAI,MAAKA,MAAM;QACvBE,UAAUJ,KAAKI,OAAO;IACxB,OAAO;QACLA,UAAUN,gBAAgBC,cAAcG;IAC1C;IAEA,MAAMG,SAASD,QAAQD;IACvB,IAAI,CAACE,QAAQ;QACX,MAAM,IAAIC,MACR,CAAC,0BAA0B,EAAEH,SAAS,qBAAqB,EAAED,KAAK,yEAAyE,CAAC;IAEhJ;IAEA,OAAOG;AACT"}

View File

@ -0,0 +1,6 @@
import { isDynamicServerError } from "../../client/components/hooks-server-context";
import { isBailoutToCSRError } from "../../shared/lib/lazy-dynamic/bailout-to-csr";
import { isNavigationSignalError } from "./is-navigation-signal-error";
export const isDynamicUsageError = (err)=>isDynamicServerError(err) || isBailoutToCSRError(err) || isNavigationSignalError(err);
//# sourceMappingURL=is-dynamic-usage-error.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../src/export/helpers/is-dynamic-usage-error.ts"],"names":["isDynamicServerError","isBailoutToCSRError","isNavigationSignalError","isDynamicUsageError","err"],"mappings":"AAAA,SAASA,oBAAoB,QAAQ,+CAA8C;AACnF,SAASC,mBAAmB,QAAQ,+CAA8C;AAClF,SAASC,uBAAuB,QAAQ,+BAA8B;AAEtE,OAAO,MAAMC,sBAAsB,CAACC,MAClCJ,qBAAqBI,QACrBH,oBAAoBG,QACpBF,wBAAwBE,KAAI"}

View File

@ -0,0 +1,9 @@
import { isNotFoundError } from "../../client/components/not-found";
import { isRedirectError } from "../../client/components/redirect";
/**
* Returns true if the error is a navigation signal error. These errors are
* thrown by user code to perform navigation operations and interrupt the React
* render.
*/ export const isNavigationSignalError = (err)=>isNotFoundError(err) || isRedirectError(err);
//# sourceMappingURL=is-navigation-signal-error.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../src/export/helpers/is-navigation-signal-error.ts"],"names":["isNotFoundError","isRedirectError","isNavigationSignalError","err"],"mappings":"AAAA,SAASA,eAAe,QAAQ,oCAAmC;AACnE,SAASC,eAAe,QAAQ,mCAAkC;AAElE;;;;CAIC,GACD,OAAO,MAAMC,0BAA0B,CAACC,MACtCH,gBAAgBG,QAAQF,gBAAgBE,KAAI"}