Patching next13.3.0

This commit is contained in:
DrMint 2023-04-09 16:32:17 +02:00
parent 5be25c656f
commit d19b815275
3 changed files with 517 additions and 92 deletions

504
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -2,6 +2,7 @@
"name": "accords-library.com",
"private": true,
"scripts": {
"postinstall": "patch-package",
"dev": "next dev -p 12499",
"precommit": "npm run fetch-local-data && npm run icu-to-ts && npm run unused-exports && npm run prettier && npm run eslint && npm run tsc && echo ALL PRECOMMIT CHECKS PASSED SUCCESSFULLY, LET\\'S FUCKING GO!",
"unused-exports": "ts-unused-exports ./tsconfig.json --excludePathsFromReport='src/pages;tailwind.config.ts;src/graphql/generated.ts;src/shared/meilisearch-graphql-typings/generated.ts'",
@ -36,6 +37,7 @@
"meilisearch": "^0.32.3",
"next": "^13.3.0",
"nodemailer": "^6.9.1",
"patch-package": "^6.5.1",
"rc-slider": "^10.1.1",
"react": "^18.2.0",
"react-dom": "18.2.0",

103
patches/next+13.3.0.patch Normal file
View File

@ -0,0 +1,103 @@
diff --git a/node_modules/next/dist/server/dev/static-paths-worker.js b/node_modules/next/dist/server/dev/static-paths-worker.js
index 3ecbb7d..e466fb8 100644
--- a/node_modules/next/dist/server/dev/static-paths-worker.js
+++ b/node_modules/next/dist/server/dev/static-paths-worker.js
@@ -53,10 +53,16 @@ function _interopRequireWildcard(obj) {
if (process.env.NEXT_PREBUNDLED_REACT) {
(0, _requireHook).overrideBuiltInReactPackages();
}
+let workerWasUsed = false;
// expose AsyncLocalStorage on globalThis for react usage
const { AsyncLocalStorage } = require("async_hooks");
globalThis.AsyncLocalStorage = AsyncLocalStorage;
async function loadStaticPaths({ distDir , pathname , config , httpAgentOptions , enableUndici , locales , defaultLocale , isAppPath , originalAppPath , isrFlushToDisk , fetchCacheKeyPrefix , maxMemoryCacheSize , requestHeaders , incrementalCacheHandlerPath }) {
+ // we only want to use each worker once to prevent any invalid
+ // caches
+ if (workerWasUsed) {
+ process.exit(1);
+ }
// update work memory runtime-config
require("../../shared/lib/runtime-config").setConfig(config);
(0, _config).setHttpClientAndAgentOptions({
@@ -76,49 +82,42 @@ async function loadStaticPaths({ distDir , pathname , config , httpAgentOptions
// only be called for SSG pages with getStaticPaths
throw new Error(`Invariant: failed to load page with getStaticPaths for ${pathname}`);
}
- try {
- if (isAppPath) {
- var ref;
- const userland = (ref = components.ComponentMod.routeModule) == null ? void 0 : ref.userland;
- const generateParams = userland ? [
- {
- config: {
- revalidate: userland.revalidate,
- dynamic: userland.dynamic,
- dynamicParams: userland.dynamicParams
- },
- generateStaticParams: userland.generateStaticParams,
- segmentPath: pathname
+ workerWasUsed = true;
+ if (isAppPath) {
+ var ref;
+ const userland = (ref = components.ComponentMod.routeModule) == null ? void 0 : ref.userland;
+ const generateParams = userland ? [
+ {
+ config: {
+ revalidate: userland.revalidate,
+ dynamic: userland.dynamic,
+ dynamicParams: userland.dynamicParams
},
- ] : await (0, _utils).collectGenerateParams(components.ComponentMod.tree);
- return await (0, _utils).buildAppStaticPaths({
- page: pathname,
- generateParams,
- configFileName: config.configFileName,
- distDir,
- requestHeaders,
- incrementalCacheHandlerPath,
- serverHooks: serverHooks,
- staticGenerationAsyncStorage: _staticGenerationAsyncStorage.staticGenerationAsyncStorage,
- isrFlushToDisk,
- fetchCacheKeyPrefix,
- maxMemoryCacheSize
- });
- }
- return await (0, _utils).buildStaticPaths({
+ generateStaticParams: userland.generateStaticParams,
+ segmentPath: pathname
+ },
+ ] : await (0, _utils).collectGenerateParams(components.ComponentMod.tree);
+ return (0, _utils).buildAppStaticPaths({
page: pathname,
- getStaticPaths: components.getStaticPaths,
+ generateParams,
configFileName: config.configFileName,
- locales,
- defaultLocale
- });
- } finally{
- setTimeout(()=>{
- // we only want to use each worker once to prevent any invalid
- // caches
- process.exit(1);
+ distDir,
+ requestHeaders,
+ incrementalCacheHandlerPath,
+ serverHooks: serverHooks,
+ staticGenerationAsyncStorage: _staticGenerationAsyncStorage.staticGenerationAsyncStorage,
+ isrFlushToDisk,
+ fetchCacheKeyPrefix,
+ maxMemoryCacheSize
});
}
+ return (0, _utils).buildStaticPaths({
+ page: pathname,
+ getStaticPaths: components.getStaticPaths,
+ configFileName: config.configFileName,
+ locales,
+ defaultLocale
+ });
}
//# sourceMappingURL=static-paths-worker.js.map
\ No newline at end of file