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