next 15.2.0-canary.28 → 15.2.0-canary.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of next might be problematic. Click here for more details.
- package/dist/bin/next +1 -1
- package/dist/build/index.js +2 -2
- package/dist/build/swc/index.js +1 -1
- package/dist/build/webpack/plugins/define-env-plugin.js +2 -1
- package/dist/build/webpack/plugins/define-env-plugin.js.map +1 -1
- package/dist/build/webpack/plugins/slow-module-detection-plugin.d.ts +12 -0
- package/dist/build/webpack/plugins/slow-module-detection-plugin.js +187 -0
- package/dist/build/webpack/plugins/slow-module-detection-plugin.js.map +1 -0
- package/dist/build/webpack-config.js +19 -4
- package/dist/build/webpack-config.js.map +1 -1
- package/dist/client/app-bootstrap.js +1 -1
- package/dist/client/components/errors/stitched-error.js +3 -3
- package/dist/client/components/errors/stitched-error.js.map +1 -1
- package/dist/client/components/react-dev-overlay/_experimental/app/react-dev-overlay.js +3 -3
- package/dist/client/components/react-dev-overlay/_experimental/app/react-dev-overlay.js.map +1 -1
- package/dist/client/components/react-dev-overlay/_experimental/internal/components/errors/dev-tools-indicator/dev-tools-indicator.d.ts +2 -2
- package/dist/client/components/react-dev-overlay/_experimental/internal/components/errors/dev-tools-indicator/dev-tools-indicator.js +273 -144
- package/dist/client/components/react-dev-overlay/_experimental/internal/components/errors/dev-tools-indicator/dev-tools-indicator.js.map +1 -1
- package/dist/client/components/react-dev-overlay/_experimental/internal/components/errors/dev-tools-indicator/dev-tools-indicator.stories.js +4 -4
- package/dist/client/components/react-dev-overlay/_experimental/internal/components/errors/dev-tools-indicator/dev-tools-indicator.stories.js.map +1 -1
- package/dist/client/components/react-dev-overlay/_experimental/internal/components/errors/dev-tools-indicator/internal/next-logo.d.ts +3 -3
- package/dist/client/components/react-dev-overlay/_experimental/internal/components/errors/dev-tools-indicator/internal/next-logo.js +9 -14
- package/dist/client/components/react-dev-overlay/_experimental/internal/components/errors/dev-tools-indicator/internal/next-logo.js.map +1 -1
- package/dist/client/components/react-dev-overlay/_experimental/internal/components/errors/dev-tools-indicator/styles.js +1 -1
- package/dist/client/components/react-dev-overlay/_experimental/internal/components/errors/dev-tools-indicator/styles.js.map +1 -1
- package/dist/client/components/react-dev-overlay/_experimental/internal/components/errors/error-overlay/error-overlay.js +1 -3
- package/dist/client/components/react-dev-overlay/_experimental/internal/components/errors/error-overlay/error-overlay.js.map +1 -1
- package/dist/client/components/react-dev-overlay/_experimental/internal/components/errors/error-overlay-footer/error-feedback/error-feedback.d.ts +2 -1
- package/dist/client/components/react-dev-overlay/_experimental/internal/components/errors/error-overlay-footer/error-feedback/error-feedback.js +2 -2
- package/dist/client/components/react-dev-overlay/_experimental/internal/components/errors/error-overlay-footer/error-feedback/error-feedback.js.map +1 -1
- package/dist/client/components/react-dev-overlay/_experimental/internal/components/errors/error-overlay-footer/error-overlay-footer.js +2 -1
- package/dist/client/components/react-dev-overlay/_experimental/internal/components/errors/error-overlay-footer/error-overlay-footer.js.map +1 -1
- package/dist/client/components/react-dev-overlay/_experimental/internal/container/errors.d.ts +1 -4
- package/dist/client/components/react-dev-overlay/_experimental/internal/container/errors.js +2 -3
- package/dist/client/components/react-dev-overlay/_experimental/internal/container/errors.js.map +1 -1
- package/dist/client/components/react-dev-overlay/_experimental/internal/container/errors.stories.js +111 -86
- package/dist/client/components/react-dev-overlay/_experimental/internal/container/errors.stories.js.map +1 -1
- package/dist/client/components/react-dev-overlay/_experimental/internal/container/runtime-error/use-error-hook.d.ts +4 -3
- package/dist/client/components/react-dev-overlay/_experimental/internal/container/runtime-error/use-error-hook.js +8 -2
- package/dist/client/components/react-dev-overlay/_experimental/internal/container/runtime-error/use-error-hook.js.map +1 -1
- package/dist/client/components/react-dev-overlay/_experimental/internal/helpers/merge-refs.d.ts +14 -0
- package/dist/client/components/react-dev-overlay/_experimental/internal/helpers/merge-refs.js +49 -0
- package/dist/client/components/react-dev-overlay/_experimental/internal/helpers/merge-refs.js.map +1 -0
- package/dist/client/components/react-dev-overlay/_experimental/internal/styles/base.js +8 -2
- package/dist/client/components/react-dev-overlay/_experimental/internal/styles/base.js.map +1 -1
- package/dist/client/components/react-dev-overlay/_experimental/pages/react-dev-overlay.js +3 -3
- package/dist/client/components/react-dev-overlay/_experimental/pages/react-dev-overlay.js.map +1 -1
- package/dist/client/components/react-dev-overlay/internal/styles/Base.js +8 -2
- package/dist/client/components/react-dev-overlay/internal/styles/Base.js.map +1 -1
- package/dist/client/index.js +1 -1
- package/dist/compiled/next-server/app-page-experimental.runtime.dev.js +2 -2
- package/dist/compiled/next-server/app-page-experimental.runtime.dev.js.map +1 -1
- package/dist/compiled/next-server/app-page.runtime.dev.js +2 -2
- package/dist/compiled/next-server/app-page.runtime.dev.js.map +1 -1
- package/dist/compiled/next-server/pages-turbo.runtime.prod.js +2 -2
- package/dist/compiled/next-server/pages-turbo.runtime.prod.js.map +1 -1
- package/dist/compiled/next-server/server.runtime.prod.js +1 -1
- package/dist/compiled/next-server/server.runtime.prod.js.map +1 -1
- package/dist/esm/build/index.js +2 -2
- package/dist/esm/build/swc/index.js +1 -1
- package/dist/esm/build/webpack/plugins/define-env-plugin.js +2 -1
- package/dist/esm/build/webpack/plugins/define-env-plugin.js.map +1 -1
- package/dist/esm/build/webpack/plugins/slow-module-detection-plugin.js +177 -0
- package/dist/esm/build/webpack/plugins/slow-module-detection-plugin.js.map +1 -0
- package/dist/esm/build/webpack-config.js +19 -4
- package/dist/esm/build/webpack-config.js.map +1 -1
- package/dist/esm/client/app-bootstrap.js +1 -1
- package/dist/esm/client/components/errors/stitched-error.js +3 -3
- package/dist/esm/client/components/errors/stitched-error.js.map +1 -1
- package/dist/esm/client/components/react-dev-overlay/_experimental/app/react-dev-overlay.js +3 -3
- package/dist/esm/client/components/react-dev-overlay/_experimental/app/react-dev-overlay.js.map +1 -1
- package/dist/esm/client/components/react-dev-overlay/_experimental/internal/components/errors/dev-tools-indicator/dev-tools-indicator.js +274 -146
- package/dist/esm/client/components/react-dev-overlay/_experimental/internal/components/errors/dev-tools-indicator/dev-tools-indicator.js.map +1 -1
- package/dist/esm/client/components/react-dev-overlay/_experimental/internal/components/errors/dev-tools-indicator/dev-tools-indicator.stories.js +4 -4
- package/dist/esm/client/components/react-dev-overlay/_experimental/internal/components/errors/dev-tools-indicator/dev-tools-indicator.stories.js.map +1 -1
- package/dist/esm/client/components/react-dev-overlay/_experimental/internal/components/errors/dev-tools-indicator/internal/next-logo.js +9 -15
- package/dist/esm/client/components/react-dev-overlay/_experimental/internal/components/errors/dev-tools-indicator/internal/next-logo.js.map +1 -1
- package/dist/esm/client/components/react-dev-overlay/_experimental/internal/components/errors/dev-tools-indicator/styles.js +1 -1
- package/dist/esm/client/components/react-dev-overlay/_experimental/internal/components/errors/dev-tools-indicator/styles.js.map +1 -1
- package/dist/esm/client/components/react-dev-overlay/_experimental/internal/components/errors/error-overlay/error-overlay.js +1 -3
- package/dist/esm/client/components/react-dev-overlay/_experimental/internal/components/errors/error-overlay/error-overlay.js.map +1 -1
- package/dist/esm/client/components/react-dev-overlay/_experimental/internal/components/errors/error-overlay-footer/error-feedback/error-feedback.js +2 -2
- package/dist/esm/client/components/react-dev-overlay/_experimental/internal/components/errors/error-overlay-footer/error-feedback/error-feedback.js.map +1 -1
- package/dist/esm/client/components/react-dev-overlay/_experimental/internal/components/errors/error-overlay-footer/error-overlay-footer.js +2 -1
- package/dist/esm/client/components/react-dev-overlay/_experimental/internal/components/errors/error-overlay-footer/error-overlay-footer.js.map +1 -1
- package/dist/esm/client/components/react-dev-overlay/_experimental/internal/container/errors.js +2 -3
- package/dist/esm/client/components/react-dev-overlay/_experimental/internal/container/errors.js.map +1 -1
- package/dist/esm/client/components/react-dev-overlay/_experimental/internal/container/errors.stories.js +111 -86
- package/dist/esm/client/components/react-dev-overlay/_experimental/internal/container/errors.stories.js.map +1 -1
- package/dist/esm/client/components/react-dev-overlay/_experimental/internal/container/runtime-error/use-error-hook.js +8 -2
- package/dist/esm/client/components/react-dev-overlay/_experimental/internal/container/runtime-error/use-error-hook.js.map +1 -1
- package/dist/esm/client/components/react-dev-overlay/_experimental/internal/helpers/merge-refs.js +33 -0
- package/dist/esm/client/components/react-dev-overlay/_experimental/internal/helpers/merge-refs.js.map +1 -0
- package/dist/esm/client/components/react-dev-overlay/_experimental/internal/styles/base.js +8 -2
- package/dist/esm/client/components/react-dev-overlay/_experimental/internal/styles/base.js.map +1 -1
- package/dist/esm/client/components/react-dev-overlay/_experimental/pages/react-dev-overlay.js +3 -3
- package/dist/esm/client/components/react-dev-overlay/_experimental/pages/react-dev-overlay.js.map +1 -1
- package/dist/esm/client/components/react-dev-overlay/internal/styles/Base.js +8 -2
- package/dist/esm/client/components/react-dev-overlay/internal/styles/Base.js.map +1 -1
- package/dist/esm/client/index.js +1 -1
- package/dist/esm/export/worker.js +9 -1
- package/dist/esm/export/worker.js.map +1 -1
- package/dist/esm/lib/turbopack-warning.js +2 -1
- package/dist/esm/lib/turbopack-warning.js.map +1 -1
- package/dist/esm/server/base-server.js +4 -4
- package/dist/esm/server/base-server.js.map +1 -1
- package/dist/esm/server/config-schema.js +4 -1
- package/dist/esm/server/config-schema.js.map +1 -1
- package/dist/esm/server/config-shared.js +2 -1
- package/dist/esm/server/config-shared.js.map +1 -1
- package/dist/esm/server/config.js +1 -1
- package/dist/esm/server/dev/hot-reloader-turbopack.js +1 -1
- package/dist/esm/server/dev/hot-reloader-webpack.js +1 -1
- package/dist/esm/server/lib/app-info-log.js +1 -1
- package/dist/esm/server/lib/start-server.js +1 -1
- package/dist/esm/server/server-utils.js +22 -19
- package/dist/esm/server/server-utils.js.map +1 -1
- package/dist/esm/server/web-server.js +2 -2
- package/dist/esm/server/web-server.js.map +1 -1
- package/dist/export/worker.js +9 -1
- package/dist/export/worker.js.map +1 -1
- package/dist/lib/turbopack-warning.js +2 -1
- package/dist/lib/turbopack-warning.js.map +1 -1
- package/dist/server/base-server.js +4 -4
- package/dist/server/base-server.js.map +1 -1
- package/dist/server/config-schema.js +4 -1
- package/dist/server/config-schema.js.map +1 -1
- package/dist/server/config-shared.d.ts +11 -0
- package/dist/server/config-shared.js +2 -1
- package/dist/server/config-shared.js.map +1 -1
- package/dist/server/config.js +1 -1
- package/dist/server/dev/hot-reloader-turbopack.js +1 -1
- package/dist/server/dev/hot-reloader-webpack.js +1 -1
- package/dist/server/lib/app-info-log.js +1 -1
- package/dist/server/lib/start-server.js +1 -1
- package/dist/server/server-utils.d.ts +4 -4
- package/dist/server/server-utils.js +22 -19
- package/dist/server/server-utils.js.map +1 -1
- package/dist/server/web-server.js +2 -2
- package/dist/server/web-server.js.map +1 -1
- package/dist/telemetry/anonymous-meta.js +1 -1
- package/dist/telemetry/events/session-stopped.js +2 -2
- package/dist/telemetry/events/version.js +2 -2
- package/package.json +15 -15
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../src/client/components/react-dev-overlay/internal/styles/Base.tsx"],"sourcesContent":["import * as React from 'react'\nimport { noop as css } from '../helpers/noop-template'\n\nexport function Base() {\n return (\n <style>\n {css`\n :host {\n --size-gap-half: 4px;\n --size-gap: 8px;\n --size-gap-double: 16px;\n --size-gap-triple: 24px;\n --size-gap-quad: 32px;\n\n --size-font-small: 14px;\n --size-font: 16px;\n --size-font-big: 20px;\n --size-font-bigger: 24px;\n\n --color-background: white;\n --color-font: #757575;\n --color-backdrop: rgba(17, 17, 17, 0.2);\n --color-border-shadow: rgba(0, 0, 0, 0.145);\n\n --color-title-color: #1f1f1f;\n --color-stack-h6: #222;\n --color-stack-headline: #666;\n --color-stack-subline: #999;\n --color-stack-notes: #777;\n\n --color-accents-1: #808080;\n --color-accents-2: #222222;\n --color-accents-3: #404040;\n\n --color-text-color-red-1: #ff5555;\n --color-text-background-red-1: #fff9f9;\n\n --font-stack-monospace: 'SFMono-Regular', Consolas, 'Liberation Mono',\n Menlo, Courier, monospace;\n --font-stack-sans: -apple-system, 'Source Sans Pro', sans-serif;\n\n --color-ansi-selection: rgba(95, 126, 151, 0.48);\n --color-ansi-bg: #111111;\n --color-ansi-fg: #cccccc;\n\n --color-ansi-white: #777777;\n --color-ansi-black: #141414;\n --color-ansi-blue: #00aaff;\n --color-ansi-cyan: #88ddff;\n --color-ansi-green: #98ec65;\n --color-ansi-magenta: #aa88ff;\n --color-ansi-red: #ff5555;\n --color-ansi-yellow: #ffcc33;\n --color-ansi-bright-white: #ffffff;\n --color-ansi-bright-black: #777777;\n --color-ansi-bright-blue: #33bbff;\n --color-ansi-bright-cyan: #bbecff;\n --color-ansi-bright-green: #b6f292;\n --color-ansi-bright-magenta: #cebbff;\n --color-ansi-bright-red: #ff8888;\n --color-ansi-bright-yellow: #ffd966;\n }\n\n @media (prefers-color-scheme: dark) {\n :host {\n --color-background: rgb(28, 28, 30);\n --color-font: white;\n --color-backdrop: rgb(44, 44, 46);\n --color-border-shadow: rgba(255, 255, 255, 0.145);\n\n --color-title-color: #fafafa;\n --color-stack-h6: rgb(200, 200, 204);\n --color-stack-headline: rgb(99, 99, 102);\n --color-stack-notes: #a9a9a9;\n --color-stack-subline: rgb(121, 121, 121);\n\n --color-accents-3: rgb(118, 118, 118);\n\n --color-text-background-red-1: #2a1e1e;\n }\n }\n\n .mono {\n font-family: var(--font-stack-monospace);\n }\n\n h1,\n h2,\n h3,\n h4,\n h5,\n h6 {\n margin-bottom: var(--size-gap);\n font-weight: 500;\n line-height: 1.5;\n }\n `}\n </style>\n )\n}\n"],"names":["React","noop","css","Base","style"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/client/components/react-dev-overlay/internal/styles/Base.tsx"],"sourcesContent":["import * as React from 'react'\nimport { noop as css } from '../helpers/noop-template'\n\nexport function Base() {\n return (\n <style>\n {css`\n :host {\n ${\n // Although the style applied to the shadow host is isolated,\n // the element that attached the shadow host (i.e. `nextjs-portal`)\n // is still affected by the parent's style (e.g. `body`). This may\n // occur style conflicts like `display: flex`, with other children\n // elements therefore give the shadow host an absolute position.\n 'position: absolute;'\n }\n\n --size-gap-half: 4px;\n --size-gap: 8px;\n --size-gap-double: 16px;\n --size-gap-triple: 24px;\n --size-gap-quad: 32px;\n\n --size-font-small: 14px;\n --size-font: 16px;\n --size-font-big: 20px;\n --size-font-bigger: 24px;\n\n --color-background: white;\n --color-font: #757575;\n --color-backdrop: rgba(17, 17, 17, 0.2);\n --color-border-shadow: rgba(0, 0, 0, 0.145);\n\n --color-title-color: #1f1f1f;\n --color-stack-h6: #222;\n --color-stack-headline: #666;\n --color-stack-subline: #999;\n --color-stack-notes: #777;\n\n --color-accents-1: #808080;\n --color-accents-2: #222222;\n --color-accents-3: #404040;\n\n --color-text-color-red-1: #ff5555;\n --color-text-background-red-1: #fff9f9;\n\n --font-stack-monospace: 'SFMono-Regular', Consolas, 'Liberation Mono',\n Menlo, Courier, monospace;\n --font-stack-sans: -apple-system, 'Source Sans Pro', sans-serif;\n\n --color-ansi-selection: rgba(95, 126, 151, 0.48);\n --color-ansi-bg: #111111;\n --color-ansi-fg: #cccccc;\n\n --color-ansi-white: #777777;\n --color-ansi-black: #141414;\n --color-ansi-blue: #00aaff;\n --color-ansi-cyan: #88ddff;\n --color-ansi-green: #98ec65;\n --color-ansi-magenta: #aa88ff;\n --color-ansi-red: #ff5555;\n --color-ansi-yellow: #ffcc33;\n --color-ansi-bright-white: #ffffff;\n --color-ansi-bright-black: #777777;\n --color-ansi-bright-blue: #33bbff;\n --color-ansi-bright-cyan: #bbecff;\n --color-ansi-bright-green: #b6f292;\n --color-ansi-bright-magenta: #cebbff;\n --color-ansi-bright-red: #ff8888;\n --color-ansi-bright-yellow: #ffd966;\n }\n\n @media (prefers-color-scheme: dark) {\n :host {\n --color-background: rgb(28, 28, 30);\n --color-font: white;\n --color-backdrop: rgb(44, 44, 46);\n --color-border-shadow: rgba(255, 255, 255, 0.145);\n\n --color-title-color: #fafafa;\n --color-stack-h6: rgb(200, 200, 204);\n --color-stack-headline: rgb(99, 99, 102);\n --color-stack-notes: #a9a9a9;\n --color-stack-subline: rgb(121, 121, 121);\n\n --color-accents-3: rgb(118, 118, 118);\n\n --color-text-background-red-1: #2a1e1e;\n }\n }\n\n .mono {\n font-family: var(--font-stack-monospace);\n }\n\n h1,\n h2,\n h3,\n h4,\n h5,\n h6 {\n margin-bottom: var(--size-gap);\n font-weight: 500;\n line-height: 1.5;\n }\n `}\n </style>\n )\n}\n"],"names":["React","noop","css","Base","style"],"mappings":";;;;;;;;;;;;AAAA,YAAYA,WAAW,QAAO;AAC9B,SAASC,QAAQC,GAAG,QAAQ,2BAA0B;AAEtD,OAAO,SAASC;IACd,qBACE,KAACC;kBACEF,uBAGK,6DAA6D;QAC7D,mEAAmE;QACnE,kEAAkE;QAClE,kEAAkE;QAClE,gEAAgE;QAChE;;AA8FZ"}
|
package/dist/esm/client/index.js
CHANGED
|
@@ -27,7 +27,7 @@ import { onRecoverableError } from './react-client-callbacks/on-recoverable-erro
|
|
|
27
27
|
import tracer from './tracing/tracer';
|
|
28
28
|
import reportToSocket from './tracing/report-to-socket';
|
|
29
29
|
import { isNextRouterError } from './components/is-next-router-error';
|
|
30
|
-
export const version = "15.2.0-canary.
|
|
30
|
+
export const version = "15.2.0-canary.29";
|
|
31
31
|
export let router;
|
|
32
32
|
export const emitter = mitt();
|
|
33
33
|
const looseToArray = (input)=>[].slice.call(input);
|
|
@@ -290,7 +290,15 @@ export async function exportPages(input) {
|
|
|
290
290
|
} else {
|
|
291
291
|
console.info(`Failed to build ${pageKey} (attempt ${attempt + 1} of ${maxAttempts}). Retrying again shortly.`);
|
|
292
292
|
}
|
|
293
|
-
|
|
293
|
+
// Exponential backoff with random jitter to avoid thundering herd on retries
|
|
294
|
+
const baseDelay = 500 // 500ms
|
|
295
|
+
;
|
|
296
|
+
const maxDelay = 2000 // 2 seconds
|
|
297
|
+
;
|
|
298
|
+
const delay = Math.min(baseDelay * Math.pow(2, attempt), maxDelay);
|
|
299
|
+
const jitter = Math.random() * 0.3 * delay // Add up to 30% random jitter
|
|
300
|
+
;
|
|
301
|
+
await new Promise((r)=>setTimeout(r, delay + jitter));
|
|
294
302
|
}
|
|
295
303
|
}
|
|
296
304
|
attempt++;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/export/worker.ts"],"sourcesContent":["import type {\n ExportPagesInput,\n ExportPageInput,\n ExportPageResult,\n ExportRouteResult,\n WorkerRenderOpts,\n ExportPagesResult,\n} from './types'\n\nimport '../server/node-environment'\n\nprocess.env.NEXT_IS_EXPORT_WORKER = 'true'\n\nimport { extname, join, dirname, sep } from 'path'\nimport fs from 'fs/promises'\nimport { loadComponents } from '../server/load-components'\nimport { isDynamicRoute } from '../shared/lib/router/utils/is-dynamic'\nimport { normalizePagePath } from '../shared/lib/page-path/normalize-page-path'\nimport { normalizeLocalePath } from '../shared/lib/i18n/normalize-locale-path'\nimport { trace } from '../trace'\nimport { setHttpClientAndAgentOptions } from '../server/setup-http-agent-env'\nimport isError from '../lib/is-error'\nimport { addRequestMeta } from '../server/request-meta'\nimport { normalizeAppPath } from '../shared/lib/router/utils/app-paths'\n\nimport { createRequestResponseMocks } from '../server/lib/mock-request'\nimport { isAppRouteRoute } from '../lib/is-app-route-route'\nimport { hasNextSupport } from '../server/ci-info'\nimport { exportAppRoute } from './routes/app-route'\nimport { exportAppPage, prospectiveRenderAppPage } from './routes/app-page'\nimport { exportPagesPage } from './routes/pages'\nimport { getParams } from './helpers/get-params'\nimport { createIncrementalCache } from './helpers/create-incremental-cache'\nimport { isPostpone } from '../server/lib/router-utils/is-postpone'\nimport { isDynamicUsageError } from './helpers/is-dynamic-usage-error'\nimport { isBailoutToCSRError } from '../shared/lib/lazy-dynamic/bailout-to-csr'\nimport {\n turborepoTraceAccess,\n TurborepoAccessTraceResult,\n} from '../build/turborepo-access-trace'\nimport type { Params } from '../server/request/params'\nimport {\n getFallbackRouteParams,\n type FallbackRouteParams,\n} from '../server/request/fallback-params'\nimport { needsExperimentalReact } from '../lib/needs-experimental-react'\nimport type { AppRouteRouteModule } from '../server/route-modules/app-route/module.compiled'\nimport { isStaticGenBailoutError } from '../client/components/static-generation-bailout'\nimport type { PagesRenderContext, PagesSharedContext } from '../server/render'\nimport type { AppSharedContext } from '../server/app-render/app-render'\nimport { MultiFileWriter } from '../lib/multi-file-writer'\n\nconst envConfig = require('../shared/lib/runtime-config.external')\n\n;(globalThis as any).__NEXT_DATA__ = {\n nextExport: true,\n}\n\nclass TimeoutError extends Error {\n code = 'NEXT_EXPORT_TIMEOUT_ERROR'\n}\n\nclass ExportPageError extends Error {\n code = 'NEXT_EXPORT_PAGE_ERROR'\n}\n\nasync function exportPageImpl(\n input: ExportPageInput,\n fileWriter: MultiFileWriter\n): Promise<ExportRouteResult | undefined> {\n const {\n path,\n pathMap,\n distDir,\n pagesDataDir,\n buildExport = false,\n serverRuntimeConfig,\n subFolders = false,\n optimizeCss,\n disableOptimizedLoading,\n debugOutput = false,\n enableExperimentalReact,\n ampValidatorPath,\n trailingSlash,\n sriEnabled,\n } = input\n\n if (enableExperimentalReact) {\n process.env.__NEXT_EXPERIMENTAL_REACT = 'true'\n }\n\n const {\n page,\n\n // The parameters that are currently unknown.\n _fallbackRouteParams = [],\n\n // Check if this is an `app/` page.\n _isAppDir: isAppDir = false,\n\n // Check if this should error when dynamic usage is detected.\n _isDynamicError: isDynamicError = false,\n\n // If this page supports partial prerendering, then we need to pass that to\n // the renderOpts.\n _isRoutePPREnabled: isRoutePPREnabled,\n\n // If this is a prospective render, we don't actually want to persist the\n // result, we just want to use it to error the build if there's a problem.\n _isProspectiveRender: isProspectiveRender = false,\n\n // Pull the original query out.\n query: originalQuery = {},\n } = pathMap\n\n const fallbackRouteParams: FallbackRouteParams | null =\n getFallbackRouteParams(_fallbackRouteParams)\n\n let query = { ...originalQuery }\n const pathname = normalizeAppPath(page)\n const isDynamic = isDynamicRoute(page)\n const outDir = isAppDir ? join(distDir, 'server/app') : input.outDir\n\n const filePath = normalizePagePath(path)\n const ampPath = `${filePath}.amp`\n let renderAmpPath = ampPath\n\n let updatedPath = pathMap._ssgPath || path\n let locale = pathMap._locale || input.renderOpts.locale\n\n if (input.renderOpts.locale) {\n const localePathResult = normalizeLocalePath(path, input.renderOpts.locales)\n\n if (localePathResult.detectedLocale) {\n updatedPath = localePathResult.pathname\n locale = localePathResult.detectedLocale\n\n if (locale === input.renderOpts.defaultLocale) {\n renderAmpPath = `${normalizePagePath(updatedPath)}.amp`\n }\n }\n }\n\n // We need to show a warning if they try to provide query values\n // for an auto-exported page since they won't be available\n const hasOrigQueryValues = Object.keys(originalQuery).length > 0\n\n // Check if the page is a specified dynamic route\n const { pathname: nonLocalizedPath } = normalizeLocalePath(\n path,\n input.renderOpts.locales\n )\n\n let params: Params | undefined\n\n if (isDynamic && page !== nonLocalizedPath) {\n const normalizedPage = isAppDir ? normalizeAppPath(page) : page\n\n params = getParams(normalizedPage, updatedPath)\n }\n\n const { req, res } = createRequestResponseMocks({ url: updatedPath })\n\n // If this is a status code page, then set the response code.\n for (const statusCode of [404, 500]) {\n if (\n [\n `/${statusCode}`,\n `/${statusCode}.html`,\n `/${statusCode}/index.html`,\n ].some((p) => p === updatedPath || `/${locale}${p}` === updatedPath)\n ) {\n res.statusCode = statusCode\n }\n }\n\n // Ensure that the URL has a trailing slash if it's configured.\n if (trailingSlash && !req.url?.endsWith('/')) {\n req.url += '/'\n }\n\n if (\n locale &&\n buildExport &&\n input.renderOpts.domainLocales &&\n input.renderOpts.domainLocales.some(\n (dl) => dl.defaultLocale === locale || dl.locales?.includes(locale || '')\n )\n ) {\n addRequestMeta(req, 'isLocaleDomain', true)\n }\n\n envConfig.setConfig({\n serverRuntimeConfig,\n publicRuntimeConfig: input.renderOpts.runtimeConfig,\n })\n\n const getHtmlFilename = (p: string) =>\n subFolders ? `${p}${sep}index.html` : `${p}.html`\n\n let htmlFilename = getHtmlFilename(filePath)\n\n // dynamic routes can provide invalid extensions e.g. /blog/[...slug] returns an\n // extension of `.slug]`\n const pageExt = isDynamic || isAppDir ? '' : extname(page)\n const pathExt = isDynamic || isAppDir ? '' : extname(path)\n\n // force output 404.html for backwards compat\n if (path === '/404.html') {\n htmlFilename = path\n }\n // Make sure page isn't a folder with a dot in the name e.g. `v1.2`\n else if (pageExt !== pathExt && pathExt !== '') {\n const isBuiltinPaths = ['/500', '/404'].some(\n (p) => p === path || p === path + '.html'\n )\n // If the ssg path has .html extension, and it's not builtin paths, use it directly\n // Otherwise, use that as the filename instead\n const isHtmlExtPath = !isBuiltinPaths && path.endsWith('.html')\n htmlFilename = isHtmlExtPath ? getHtmlFilename(path) : path\n } else if (path === '/') {\n // If the path is the root, just use index.html\n htmlFilename = 'index.html'\n }\n\n const baseDir = join(outDir, dirname(htmlFilename))\n let htmlFilepath = join(outDir, htmlFilename)\n\n await fs.mkdir(baseDir, { recursive: true })\n\n const components = await loadComponents({\n distDir,\n page,\n isAppPath: isAppDir,\n isDev: false,\n sriEnabled,\n })\n\n // Handle App Routes.\n if (isAppDir && isAppRouteRoute(page)) {\n return exportAppRoute(\n req,\n res,\n params,\n page,\n components.routeModule as AppRouteRouteModule,\n input.renderOpts.incrementalCache,\n input.renderOpts.cacheLifeProfiles,\n htmlFilepath,\n fileWriter,\n input.renderOpts.experimental,\n input.buildId\n )\n }\n\n const renderOpts: WorkerRenderOpts = {\n ...components,\n ...input.renderOpts,\n ampPath: renderAmpPath,\n params,\n optimizeCss,\n disableOptimizedLoading,\n locale,\n supportsDynamicResponse: false,\n experimental: {\n ...input.renderOpts.experimental,\n isRoutePPREnabled,\n },\n }\n\n if (hasNextSupport) {\n renderOpts.isRevalidate = true\n }\n\n // Handle App Pages\n if (isAppDir) {\n const sharedContext: AppSharedContext = {\n buildId: input.buildId,\n }\n\n // If this is a prospective render, don't return any metrics or revalidate\n // timings as we aren't persisting this render (it was only to error).\n if (isProspectiveRender) {\n return prospectiveRenderAppPage(\n req,\n res,\n page,\n pathname,\n query,\n fallbackRouteParams,\n renderOpts,\n sharedContext\n )\n }\n\n return exportAppPage(\n req,\n res,\n page,\n path,\n pathname,\n query,\n fallbackRouteParams,\n renderOpts,\n htmlFilepath,\n debugOutput,\n isDynamicError,\n fileWriter,\n sharedContext\n )\n }\n\n const sharedContext: PagesSharedContext = {\n buildId: input.buildId,\n deploymentId: input.renderOpts.deploymentId,\n customServer: undefined,\n }\n\n const renderContext: PagesRenderContext = {\n isFallback: pathMap._pagesFallback ?? false,\n isDraftMode: false,\n developmentNotFoundSourcePage: undefined,\n }\n\n return exportPagesPage(\n req,\n res,\n path,\n page,\n query,\n params,\n htmlFilepath,\n htmlFilename,\n ampPath,\n subFolders,\n outDir,\n ampValidatorPath,\n pagesDataDir,\n buildExport,\n isDynamic,\n sharedContext,\n renderContext,\n hasOrigQueryValues,\n renderOpts,\n components,\n fileWriter\n )\n}\n\nexport async function exportPages(\n input: ExportPagesInput\n): Promise<ExportPagesResult> {\n const {\n exportPathMap,\n paths,\n dir,\n distDir,\n outDir,\n cacheHandler,\n cacheMaxMemorySize,\n fetchCacheKeyPrefix,\n pagesDataDir,\n renderOpts,\n nextConfig,\n options,\n } = input\n\n // If the fetch cache was enabled, we need to create an incremental\n // cache instance for this page.\n const incrementalCache = await createIncrementalCache({\n cacheHandler,\n cacheMaxMemorySize,\n fetchCacheKeyPrefix,\n distDir,\n dir,\n // skip writing to disk in minimal mode for now, pending some\n // changes to better support it\n flushToDisk: !hasNextSupport,\n cacheHandlers: nextConfig.experimental.cacheHandlers,\n })\n\n renderOpts.incrementalCache = incrementalCache\n\n const maxConcurrency =\n nextConfig.experimental.staticGenerationMaxConcurrency ?? 8\n const results: ExportPagesResult = []\n\n const exportPageWithRetry = async (path: string, maxAttempts: number) => {\n const pathMap = exportPathMap[path]\n const { page } = exportPathMap[path]\n const pageKey = page !== path ? `${page}: ${path}` : path\n let attempt = 0\n let result\n\n while (attempt < maxAttempts) {\n try {\n result = await Promise.race<ExportPageResult | undefined>([\n exportPage({\n path,\n pathMap,\n distDir,\n outDir,\n pagesDataDir,\n renderOpts,\n ampValidatorPath:\n nextConfig.experimental.amp?.validator || undefined,\n trailingSlash: nextConfig.trailingSlash,\n serverRuntimeConfig: nextConfig.serverRuntimeConfig,\n subFolders: nextConfig.trailingSlash && !options.buildExport,\n buildExport: options.buildExport,\n optimizeCss: nextConfig.experimental.optimizeCss,\n disableOptimizedLoading:\n nextConfig.experimental.disableOptimizedLoading,\n parentSpanId: input.parentSpanId,\n httpAgentOptions: nextConfig.httpAgentOptions,\n debugOutput: options.debugOutput,\n enableExperimentalReact: needsExperimentalReact(nextConfig),\n sriEnabled: Boolean(nextConfig.experimental.sri?.algorithm),\n buildId: input.buildId,\n }),\n // If exporting the page takes longer than the timeout, reject the promise.\n new Promise((_, reject) => {\n setTimeout(() => {\n reject(new TimeoutError())\n }, nextConfig.staticPageGenerationTimeout * 1000)\n }),\n ])\n\n // If there was an error in the export, throw it immediately. In the catch block, we might retry the export,\n // or immediately fail the build, depending on user configuration. We might also continue on and attempt other pages.\n if (result && 'error' in result) {\n throw new ExportPageError()\n }\n\n // If the export succeeds, break out of the retry loop\n break\n } catch (err) {\n // The only error that should be caught here is an ExportError, as `exportPage` doesn't throw and instead returns an object with an `error` property.\n // This is an overly cautious check to ensure that we don't accidentally catch an unexpected error.\n if (!(err instanceof ExportPageError || err instanceof TimeoutError)) {\n throw err\n }\n\n if (err instanceof TimeoutError) {\n // If the export times out, we will restart the worker up to 3 times.\n maxAttempts = 3\n }\n\n // We've reached the maximum number of attempts\n if (attempt >= maxAttempts - 1) {\n // Log a message if we've reached the maximum number of attempts.\n // We only care to do this if maxAttempts was configured.\n if (maxAttempts > 1) {\n console.info(\n `Failed to build ${pageKey} after ${maxAttempts} attempts.`\n )\n }\n // If prerenderEarlyExit is enabled, we'll exit the build immediately.\n if (nextConfig.experimental.prerenderEarlyExit) {\n console.error(\n `Export encountered an error on ${pageKey}, exiting the build.`\n )\n process.exit(1)\n } else {\n // Otherwise, this is a no-op. The build will continue, and a summary of failed pages will be displayed at the end.\n }\n } else {\n // Otherwise, we have more attempts to make. Wait before retrying\n if (err instanceof TimeoutError) {\n console.info(\n `Failed to build ${pageKey} (attempt ${attempt + 1} of ${maxAttempts}) because it took more than ${nextConfig.staticPageGenerationTimeout} seconds. Retrying again shortly.`\n )\n } else {\n console.info(\n `Failed to build ${pageKey} (attempt ${attempt + 1} of ${maxAttempts}). Retrying again shortly.`\n )\n }\n await new Promise((r) => setTimeout(r, Math.random() * 500))\n }\n }\n\n attempt++\n }\n\n return { result, path, pageKey }\n }\n\n for (let i = 0; i < paths.length; i += maxConcurrency) {\n const subset = paths.slice(i, i + maxConcurrency)\n\n const subsetResults = await Promise.all(\n subset.map((path) =>\n exportPageWithRetry(\n path,\n nextConfig.experimental.staticGenerationRetryCount ?? 1\n )\n )\n )\n\n results.push(...subsetResults)\n }\n\n return results\n}\n\nasync function exportPage(\n input: ExportPageInput\n): Promise<ExportPageResult | undefined> {\n trace('export-page', input.parentSpanId).setAttribute('path', input.path)\n\n // Configure the http agent.\n setHttpClientAndAgentOptions({\n httpAgentOptions: input.httpAgentOptions,\n })\n\n const fileWriter = new MultiFileWriter({\n writeFile: (filePath, data) => fs.writeFile(filePath, data),\n mkdir: (dir) => fs.mkdir(dir, { recursive: true }),\n })\n\n const exportPageSpan = trace('export-page-worker', input.parentSpanId)\n\n const start = Date.now()\n\n const turborepoAccessTraceResult = new TurborepoAccessTraceResult()\n\n // Export the page.\n let result: ExportRouteResult | undefined\n try {\n result = await exportPageSpan.traceAsyncFn(() =>\n turborepoTraceAccess(\n () => exportPageImpl(input, fileWriter),\n turborepoAccessTraceResult\n )\n )\n\n // Wait for all the files to flush to disk.\n await fileWriter.wait()\n\n // If there was no result, then we can exit early.\n if (!result) return\n\n // If there was an error, then we can exit early.\n if ('error' in result) {\n return { error: result.error, duration: Date.now() - start }\n }\n } catch (err) {\n console.error(\n `Error occurred prerendering page \"${input.path}\". Read more: https://nextjs.org/docs/messages/prerender-error`\n )\n\n // bailoutToCSRError errors should not leak to the user as they are not actionable; they're\n // a framework signal\n if (!isBailoutToCSRError(err)) {\n // A static generation bailout error is a framework signal to fail static generation but\n // and will encode a reason in the error message. If there is a message, we'll print it.\n // Otherwise there's nothing to show as we don't want to leak an error internal error stack to the user.\n if (isStaticGenBailoutError(err)) {\n if (err.message) {\n console.error(`Error: ${err.message}`)\n }\n } else if (isError(err) && err.stack) {\n console.error(err.stack)\n } else {\n console.error(err)\n }\n }\n\n return { error: true, duration: Date.now() - start }\n }\n\n // Notify the parent process that we processed a page (used by the progress activity indicator)\n process.send?.([3, { type: 'activity' }])\n\n // Otherwise we can return the result.\n return {\n duration: Date.now() - start,\n ampValidations: result.ampValidations,\n revalidate: result.revalidate,\n metadata: result.metadata,\n ssgNotFound: result.ssgNotFound,\n hasEmptyPrelude: result.hasEmptyPrelude,\n hasPostponed: result.hasPostponed,\n turborepoAccessTraceResult: turborepoAccessTraceResult.serialize(),\n fetchMetrics: result.fetchMetrics,\n }\n}\n\nprocess.on('unhandledRejection', (err: unknown) => {\n // if it's a postpone error, it'll be handled later\n // when the postponed promise is actually awaited.\n if (isPostpone(err)) {\n return\n }\n\n // we don't want to log these errors\n if (isDynamicUsageError(err)) {\n return\n }\n\n console.error(err)\n})\n\nprocess.on('rejectionHandled', () => {\n // It is ok to await a Promise late in Next.js as it allows for better\n // prefetching patterns to avoid waterfalls. We ignore logging these.\n // We should've already errored in anyway unhandledRejection.\n})\n\nconst FATAL_UNHANDLED_NEXT_API_EXIT_CODE = 78\n\nprocess.on('uncaughtException', (err) => {\n if (isDynamicUsageError(err)) {\n console.error(\n 'A Next.js API that uses exceptions to signal framework behavior was uncaught. This suggests improper usage of a Next.js API. The original error is printed below and the build will now exit.'\n )\n console.error(err)\n process.exit(FATAL_UNHANDLED_NEXT_API_EXIT_CODE)\n } else {\n console.error(err)\n }\n})\n"],"names":["process","env","NEXT_IS_EXPORT_WORKER","extname","join","dirname","sep","fs","loadComponents","isDynamicRoute","normalizePagePath","normalizeLocalePath","trace","setHttpClientAndAgentOptions","isError","addRequestMeta","normalizeAppPath","createRequestResponseMocks","isAppRouteRoute","hasNextSupport","exportAppRoute","exportAppPage","prospectiveRenderAppPage","exportPagesPage","getParams","createIncrementalCache","isPostpone","isDynamicUsageError","isBailoutToCSRError","turborepoTraceAccess","TurborepoAccessTraceResult","getFallbackRouteParams","needsExperimentalReact","isStaticGenBailoutError","MultiFileWriter","envConfig","require","globalThis","__NEXT_DATA__","nextExport","TimeoutError","Error","code","ExportPageError","exportPageImpl","input","fileWriter","req","path","pathMap","distDir","pagesDataDir","buildExport","serverRuntimeConfig","subFolders","optimizeCss","disableOptimizedLoading","debugOutput","enableExperimentalReact","ampValidatorPath","trailingSlash","sriEnabled","__NEXT_EXPERIMENTAL_REACT","page","_fallbackRouteParams","_isAppDir","isAppDir","_isDynamicError","isDynamicError","_isRoutePPREnabled","isRoutePPREnabled","_isProspectiveRender","isProspectiveRender","query","originalQuery","fallbackRouteParams","pathname","isDynamic","outDir","filePath","ampPath","renderAmpPath","updatedPath","_ssgPath","locale","_locale","renderOpts","localePathResult","locales","detectedLocale","defaultLocale","hasOrigQueryValues","Object","keys","length","nonLocalizedPath","params","normalizedPage","res","url","statusCode","some","p","endsWith","domainLocales","dl","includes","setConfig","publicRuntimeConfig","runtimeConfig","getHtmlFilename","htmlFilename","pageExt","pathExt","isBuiltinPaths","isHtmlExtPath","baseDir","htmlFilepath","mkdir","recursive","components","isAppPath","isDev","routeModule","incrementalCache","cacheLifeProfiles","experimental","buildId","supportsDynamicResponse","isRevalidate","sharedContext","deploymentId","customServer","undefined","renderContext","isFallback","_pagesFallback","isDraftMode","developmentNotFoundSourcePage","exportPages","exportPathMap","paths","dir","cacheHandler","cacheMaxMemorySize","fetchCacheKeyPrefix","nextConfig","options","flushToDisk","cacheHandlers","maxConcurrency","staticGenerationMaxConcurrency","results","exportPageWithRetry","maxAttempts","pageKey","attempt","result","Promise","race","exportPage","amp","validator","parentSpanId","httpAgentOptions","Boolean","sri","algorithm","_","reject","setTimeout","staticPageGenerationTimeout","err","console","info","prerenderEarlyExit","error","exit","r","Math","random","i","subset","slice","subsetResults","all","map","staticGenerationRetryCount","push","setAttribute","writeFile","data","exportPageSpan","start","Date","now","turborepoAccessTraceResult","traceAsyncFn","wait","duration","message","stack","send","type","ampValidations","revalidate","metadata","ssgNotFound","hasEmptyPrelude","hasPostponed","serialize","fetchMetrics","on","FATAL_UNHANDLED_NEXT_API_EXIT_CODE"],"mappings":"AASA,OAAO,6BAA4B;AAEnCA,QAAQC,GAAG,CAACC,qBAAqB,GAAG;AAEpC,SAASC,OAAO,EAAEC,IAAI,EAAEC,OAAO,EAAEC,GAAG,QAAQ,OAAM;AAClD,OAAOC,QAAQ,cAAa;AAC5B,SAASC,cAAc,QAAQ,4BAA2B;AAC1D,SAASC,cAAc,QAAQ,wCAAuC;AACtE,SAASC,iBAAiB,QAAQ,8CAA6C;AAC/E,SAASC,mBAAmB,QAAQ,2CAA0C;AAC9E,SAASC,KAAK,QAAQ,WAAU;AAChC,SAASC,4BAA4B,QAAQ,iCAAgC;AAC7E,OAAOC,aAAa,kBAAiB;AACrC,SAASC,cAAc,QAAQ,yBAAwB;AACvD,SAASC,gBAAgB,QAAQ,uCAAsC;AAEvE,SAASC,0BAA0B,QAAQ,6BAA4B;AACvE,SAASC,eAAe,QAAQ,4BAA2B;AAC3D,SAASC,cAAc,QAAQ,oBAAmB;AAClD,SAASC,cAAc,QAAQ,qBAAoB;AACnD,SAASC,aAAa,EAAEC,wBAAwB,QAAQ,oBAAmB;AAC3E,SAASC,eAAe,QAAQ,iBAAgB;AAChD,SAASC,SAAS,QAAQ,uBAAsB;AAChD,SAASC,sBAAsB,QAAQ,qCAAoC;AAC3E,SAASC,UAAU,QAAQ,yCAAwC;AACnE,SAASC,mBAAmB,QAAQ,mCAAkC;AACtE,SAASC,mBAAmB,QAAQ,4CAA2C;AAC/E,SACEC,oBAAoB,EACpBC,0BAA0B,QACrB,kCAAiC;AAExC,SACEC,sBAAsB,QAEjB,oCAAmC;AAC1C,SAASC,sBAAsB,QAAQ,kCAA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+F;IAC/FjM,QAAQ0M,IAAI,oBAAZ1M,QAAQ0M,IAAI,MAAZ1M,SAAe;QAAC;QAAG;YAAE2M,MAAM;QAAW;KAAE;IAExC,sCAAsC;IACtC,OAAO;QACLJ,UAAUL,KAAKC,GAAG,KAAKF;QACvBW,gBAAgB/C,OAAO+C,cAAc;QACrCC,YAAYhD,OAAOgD,UAAU;QAC7BC,UAAUjD,OAAOiD,QAAQ;QACzBC,aAAalD,OAAOkD,WAAW;QAC/BC,iBAAiBnD,OAAOmD,eAAe;QACvCC,cAAcpD,OAAOoD,YAAY;QACjCb,4BAA4BA,2BAA2Bc,SAAS;QAChEC,cAActD,OAAOsD,YAAY;IACnC;AACF;AAEAnN,QAAQoN,EAAE,CAAC,sBAAsB,CAACxC;IAChC,mDAAmD;IACnD,kDAAkD;IAClD,IAAIlJ,WAAWkJ,MAAM;QACnB;IACF;IAEA,oCAAoC;IACpC,IAAIjJ,oBAAoBiJ,MAAM;QAC5B;IACF;IAEAC,QAAQG,KAAK,CAACJ;AAChB;AAEA5K,QAAQoN,EAAE,CAAC,oBAAoB;AAC7B,sEAAsE;AACtE,qEAAqE;AACrE,6DAA6D;AAC/D;AAEA,MAAMC,qCAAqC;AAE3CrN,QAAQoN,EAAE,CAAC,qBAAqB,CAACxC;IAC/B,IAAIjJ,oBAAoBiJ,MAAM;QAC5BC,QAAQG,KAAK,CACX;QAEFH,QAAQG,KAAK,CAACJ;QACd5K,QAAQiL,IAAI,CAACoC;IACf,OAAO;QACLxC,QAAQG,KAAK,CAACJ;IAChB;AACF"}
|
|
1
|
+
{"version":3,"sources":["../../src/export/worker.ts"],"sourcesContent":["import type {\n ExportPagesInput,\n ExportPageInput,\n ExportPageResult,\n ExportRouteResult,\n WorkerRenderOpts,\n ExportPagesResult,\n} from './types'\n\nimport '../server/node-environment'\n\nprocess.env.NEXT_IS_EXPORT_WORKER = 'true'\n\nimport { extname, join, dirname, sep } from 'path'\nimport fs from 'fs/promises'\nimport { loadComponents } from '../server/load-components'\nimport { isDynamicRoute } from '../shared/lib/router/utils/is-dynamic'\nimport { normalizePagePath } from '../shared/lib/page-path/normalize-page-path'\nimport { normalizeLocalePath } from '../shared/lib/i18n/normalize-locale-path'\nimport { trace } from '../trace'\nimport { setHttpClientAndAgentOptions } from '../server/setup-http-agent-env'\nimport isError from '../lib/is-error'\nimport { addRequestMeta } from '../server/request-meta'\nimport { normalizeAppPath } from '../shared/lib/router/utils/app-paths'\n\nimport { createRequestResponseMocks } from '../server/lib/mock-request'\nimport { isAppRouteRoute } from '../lib/is-app-route-route'\nimport { hasNextSupport } from '../server/ci-info'\nimport { exportAppRoute } from './routes/app-route'\nimport { exportAppPage, prospectiveRenderAppPage } from './routes/app-page'\nimport { exportPagesPage } from './routes/pages'\nimport { getParams } from './helpers/get-params'\nimport { createIncrementalCache } from './helpers/create-incremental-cache'\nimport { isPostpone } from '../server/lib/router-utils/is-postpone'\nimport { isDynamicUsageError } from './helpers/is-dynamic-usage-error'\nimport { isBailoutToCSRError } from '../shared/lib/lazy-dynamic/bailout-to-csr'\nimport {\n turborepoTraceAccess,\n TurborepoAccessTraceResult,\n} from '../build/turborepo-access-trace'\nimport type { Params } from '../server/request/params'\nimport {\n getFallbackRouteParams,\n type FallbackRouteParams,\n} from '../server/request/fallback-params'\nimport { needsExperimentalReact } from '../lib/needs-experimental-react'\nimport type { AppRouteRouteModule } from '../server/route-modules/app-route/module.compiled'\nimport { isStaticGenBailoutError } from '../client/components/static-generation-bailout'\nimport type { PagesRenderContext, PagesSharedContext } from '../server/render'\nimport type { AppSharedContext } from '../server/app-render/app-render'\nimport { MultiFileWriter } from '../lib/multi-file-writer'\n\nconst envConfig = require('../shared/lib/runtime-config.external')\n\n;(globalThis as any).__NEXT_DATA__ = {\n nextExport: true,\n}\n\nclass TimeoutError extends Error {\n code = 'NEXT_EXPORT_TIMEOUT_ERROR'\n}\n\nclass ExportPageError extends Error {\n code = 'NEXT_EXPORT_PAGE_ERROR'\n}\n\nasync function exportPageImpl(\n input: ExportPageInput,\n fileWriter: MultiFileWriter\n): Promise<ExportRouteResult | undefined> {\n const {\n path,\n pathMap,\n distDir,\n pagesDataDir,\n buildExport = false,\n serverRuntimeConfig,\n subFolders = false,\n optimizeCss,\n disableOptimizedLoading,\n debugOutput = false,\n enableExperimentalReact,\n ampValidatorPath,\n trailingSlash,\n sriEnabled,\n } = input\n\n if (enableExperimentalReact) {\n process.env.__NEXT_EXPERIMENTAL_REACT = 'true'\n }\n\n const {\n page,\n\n // The parameters that are currently unknown.\n _fallbackRouteParams = [],\n\n // Check if this is an `app/` page.\n _isAppDir: isAppDir = false,\n\n // Check if this should error when dynamic usage is detected.\n _isDynamicError: isDynamicError = false,\n\n // If this page supports partial prerendering, then we need to pass that to\n // the renderOpts.\n _isRoutePPREnabled: isRoutePPREnabled,\n\n // If this is a prospective render, we don't actually want to persist the\n // result, we just want to use it to error the build if there's a problem.\n _isProspectiveRender: isProspectiveRender = false,\n\n // Pull the original query out.\n query: originalQuery = {},\n } = pathMap\n\n const fallbackRouteParams: FallbackRouteParams | null =\n getFallbackRouteParams(_fallbackRouteParams)\n\n let query = { ...originalQuery }\n const pathname = normalizeAppPath(page)\n const isDynamic = isDynamicRoute(page)\n const outDir = isAppDir ? join(distDir, 'server/app') : input.outDir\n\n const filePath = normalizePagePath(path)\n const ampPath = `${filePath}.amp`\n let renderAmpPath = ampPath\n\n let updatedPath = pathMap._ssgPath || path\n let locale = pathMap._locale || input.renderOpts.locale\n\n if (input.renderOpts.locale) {\n const localePathResult = normalizeLocalePath(path, input.renderOpts.locales)\n\n if (localePathResult.detectedLocale) {\n updatedPath = localePathResult.pathname\n locale = localePathResult.detectedLocale\n\n if (locale === input.renderOpts.defaultLocale) {\n renderAmpPath = `${normalizePagePath(updatedPath)}.amp`\n }\n }\n }\n\n // We need to show a warning if they try to provide query values\n // for an auto-exported page since they won't be available\n const hasOrigQueryValues = Object.keys(originalQuery).length > 0\n\n // Check if the page is a specified dynamic route\n const { pathname: nonLocalizedPath } = normalizeLocalePath(\n path,\n input.renderOpts.locales\n )\n\n let params: Params | undefined\n\n if (isDynamic && page !== nonLocalizedPath) {\n const normalizedPage = isAppDir ? normalizeAppPath(page) : page\n\n params = getParams(normalizedPage, updatedPath)\n }\n\n const { req, res } = createRequestResponseMocks({ url: updatedPath })\n\n // If this is a status code page, then set the response code.\n for (const statusCode of [404, 500]) {\n if (\n [\n `/${statusCode}`,\n `/${statusCode}.html`,\n `/${statusCode}/index.html`,\n ].some((p) => p === updatedPath || `/${locale}${p}` === updatedPath)\n ) {\n res.statusCode = statusCode\n }\n }\n\n // Ensure that the URL has a trailing slash if it's configured.\n if (trailingSlash && !req.url?.endsWith('/')) {\n req.url += '/'\n }\n\n if (\n locale &&\n buildExport &&\n input.renderOpts.domainLocales &&\n input.renderOpts.domainLocales.some(\n (dl) => dl.defaultLocale === locale || dl.locales?.includes(locale || '')\n )\n ) {\n addRequestMeta(req, 'isLocaleDomain', true)\n }\n\n envConfig.setConfig({\n serverRuntimeConfig,\n publicRuntimeConfig: input.renderOpts.runtimeConfig,\n })\n\n const getHtmlFilename = (p: string) =>\n subFolders ? `${p}${sep}index.html` : `${p}.html`\n\n let htmlFilename = getHtmlFilename(filePath)\n\n // dynamic routes can provide invalid extensions e.g. /blog/[...slug] returns an\n // extension of `.slug]`\n const pageExt = isDynamic || isAppDir ? '' : extname(page)\n const pathExt = isDynamic || isAppDir ? '' : extname(path)\n\n // force output 404.html for backwards compat\n if (path === '/404.html') {\n htmlFilename = path\n }\n // Make sure page isn't a folder with a dot in the name e.g. `v1.2`\n else if (pageExt !== pathExt && pathExt !== '') {\n const isBuiltinPaths = ['/500', '/404'].some(\n (p) => p === path || p === path + '.html'\n )\n // If the ssg path has .html extension, and it's not builtin paths, use it directly\n // Otherwise, use that as the filename instead\n const isHtmlExtPath = !isBuiltinPaths && path.endsWith('.html')\n htmlFilename = isHtmlExtPath ? getHtmlFilename(path) : path\n } else if (path === '/') {\n // If the path is the root, just use index.html\n htmlFilename = 'index.html'\n }\n\n const baseDir = join(outDir, dirname(htmlFilename))\n let htmlFilepath = join(outDir, htmlFilename)\n\n await fs.mkdir(baseDir, { recursive: true })\n\n const components = await loadComponents({\n distDir,\n page,\n isAppPath: isAppDir,\n isDev: false,\n sriEnabled,\n })\n\n // Handle App Routes.\n if (isAppDir && isAppRouteRoute(page)) {\n return exportAppRoute(\n req,\n res,\n params,\n page,\n components.routeModule as AppRouteRouteModule,\n input.renderOpts.incrementalCache,\n input.renderOpts.cacheLifeProfiles,\n htmlFilepath,\n fileWriter,\n input.renderOpts.experimental,\n input.buildId\n )\n }\n\n const renderOpts: WorkerRenderOpts = {\n ...components,\n ...input.renderOpts,\n ampPath: renderAmpPath,\n params,\n optimizeCss,\n disableOptimizedLoading,\n locale,\n supportsDynamicResponse: false,\n experimental: {\n ...input.renderOpts.experimental,\n isRoutePPREnabled,\n },\n }\n\n if (hasNextSupport) {\n renderOpts.isRevalidate = true\n }\n\n // Handle App Pages\n if (isAppDir) {\n const sharedContext: AppSharedContext = {\n buildId: input.buildId,\n }\n\n // If this is a prospective render, don't return any metrics or revalidate\n // timings as we aren't persisting this render (it was only to error).\n if (isProspectiveRender) {\n return prospectiveRenderAppPage(\n req,\n res,\n page,\n pathname,\n query,\n fallbackRouteParams,\n renderOpts,\n sharedContext\n )\n }\n\n return exportAppPage(\n req,\n res,\n page,\n path,\n pathname,\n query,\n fallbackRouteParams,\n renderOpts,\n htmlFilepath,\n debugOutput,\n isDynamicError,\n fileWriter,\n sharedContext\n )\n }\n\n const sharedContext: PagesSharedContext = {\n buildId: input.buildId,\n deploymentId: input.renderOpts.deploymentId,\n customServer: undefined,\n }\n\n const renderContext: PagesRenderContext = {\n isFallback: pathMap._pagesFallback ?? false,\n isDraftMode: false,\n developmentNotFoundSourcePage: undefined,\n }\n\n return exportPagesPage(\n req,\n res,\n path,\n page,\n query,\n params,\n htmlFilepath,\n htmlFilename,\n ampPath,\n subFolders,\n outDir,\n ampValidatorPath,\n pagesDataDir,\n buildExport,\n isDynamic,\n sharedContext,\n renderContext,\n hasOrigQueryValues,\n renderOpts,\n components,\n fileWriter\n )\n}\n\nexport async function exportPages(\n input: ExportPagesInput\n): Promise<ExportPagesResult> {\n const {\n exportPathMap,\n paths,\n dir,\n distDir,\n outDir,\n cacheHandler,\n cacheMaxMemorySize,\n fetchCacheKeyPrefix,\n pagesDataDir,\n renderOpts,\n nextConfig,\n options,\n } = input\n\n // If the fetch cache was enabled, we need to create an incremental\n // cache instance for this page.\n const incrementalCache = await createIncrementalCache({\n cacheHandler,\n cacheMaxMemorySize,\n fetchCacheKeyPrefix,\n distDir,\n dir,\n // skip writing to disk in minimal mode for now, pending some\n // changes to better support it\n flushToDisk: !hasNextSupport,\n cacheHandlers: nextConfig.experimental.cacheHandlers,\n })\n\n renderOpts.incrementalCache = incrementalCache\n\n const maxConcurrency =\n nextConfig.experimental.staticGenerationMaxConcurrency ?? 8\n const results: ExportPagesResult = []\n\n const exportPageWithRetry = async (path: string, maxAttempts: number) => {\n const pathMap = exportPathMap[path]\n const { page } = exportPathMap[path]\n const pageKey = page !== path ? `${page}: ${path}` : path\n let attempt = 0\n let result\n\n while (attempt < maxAttempts) {\n try {\n result = await Promise.race<ExportPageResult | undefined>([\n exportPage({\n path,\n pathMap,\n distDir,\n outDir,\n pagesDataDir,\n renderOpts,\n ampValidatorPath:\n nextConfig.experimental.amp?.validator || undefined,\n trailingSlash: nextConfig.trailingSlash,\n serverRuntimeConfig: nextConfig.serverRuntimeConfig,\n subFolders: nextConfig.trailingSlash && !options.buildExport,\n buildExport: options.buildExport,\n optimizeCss: nextConfig.experimental.optimizeCss,\n disableOptimizedLoading:\n nextConfig.experimental.disableOptimizedLoading,\n parentSpanId: input.parentSpanId,\n httpAgentOptions: nextConfig.httpAgentOptions,\n debugOutput: options.debugOutput,\n enableExperimentalReact: needsExperimentalReact(nextConfig),\n sriEnabled: Boolean(nextConfig.experimental.sri?.algorithm),\n buildId: input.buildId,\n }),\n // If exporting the page takes longer than the timeout, reject the promise.\n new Promise((_, reject) => {\n setTimeout(() => {\n reject(new TimeoutError())\n }, nextConfig.staticPageGenerationTimeout * 1000)\n }),\n ])\n\n // If there was an error in the export, throw it immediately. In the catch block, we might retry the export,\n // or immediately fail the build, depending on user configuration. We might also continue on and attempt other pages.\n if (result && 'error' in result) {\n throw new ExportPageError()\n }\n\n // If the export succeeds, break out of the retry loop\n break\n } catch (err) {\n // The only error that should be caught here is an ExportError, as `exportPage` doesn't throw and instead returns an object with an `error` property.\n // This is an overly cautious check to ensure that we don't accidentally catch an unexpected error.\n if (!(err instanceof ExportPageError || err instanceof TimeoutError)) {\n throw err\n }\n\n if (err instanceof TimeoutError) {\n // If the export times out, we will restart the worker up to 3 times.\n maxAttempts = 3\n }\n\n // We've reached the maximum number of attempts\n if (attempt >= maxAttempts - 1) {\n // Log a message if we've reached the maximum number of attempts.\n // We only care to do this if maxAttempts was configured.\n if (maxAttempts > 1) {\n console.info(\n `Failed to build ${pageKey} after ${maxAttempts} attempts.`\n )\n }\n // If prerenderEarlyExit is enabled, we'll exit the build immediately.\n if (nextConfig.experimental.prerenderEarlyExit) {\n console.error(\n `Export encountered an error on ${pageKey}, exiting the build.`\n )\n process.exit(1)\n } else {\n // Otherwise, this is a no-op. The build will continue, and a summary of failed pages will be displayed at the end.\n }\n } else {\n // Otherwise, we have more attempts to make. Wait before retrying\n if (err instanceof TimeoutError) {\n console.info(\n `Failed to build ${pageKey} (attempt ${attempt + 1} of ${maxAttempts}) because it took more than ${nextConfig.staticPageGenerationTimeout} seconds. Retrying again shortly.`\n )\n } else {\n console.info(\n `Failed to build ${pageKey} (attempt ${attempt + 1} of ${maxAttempts}). Retrying again shortly.`\n )\n }\n\n // Exponential backoff with random jitter to avoid thundering herd on retries\n const baseDelay = 500 // 500ms\n const maxDelay = 2000 // 2 seconds\n const delay = Math.min(baseDelay * Math.pow(2, attempt), maxDelay)\n const jitter = Math.random() * 0.3 * delay // Add up to 30% random jitter\n await new Promise((r) => setTimeout(r, delay + jitter))\n }\n }\n\n attempt++\n }\n\n return { result, path, pageKey }\n }\n\n for (let i = 0; i < paths.length; i += maxConcurrency) {\n const subset = paths.slice(i, i + maxConcurrency)\n\n const subsetResults = await Promise.all(\n subset.map((path) =>\n exportPageWithRetry(\n path,\n nextConfig.experimental.staticGenerationRetryCount ?? 1\n )\n )\n )\n\n results.push(...subsetResults)\n }\n\n return results\n}\n\nasync function exportPage(\n input: ExportPageInput\n): Promise<ExportPageResult | undefined> {\n trace('export-page', input.parentSpanId).setAttribute('path', input.path)\n\n // Configure the http agent.\n setHttpClientAndAgentOptions({\n httpAgentOptions: input.httpAgentOptions,\n })\n\n const fileWriter = new MultiFileWriter({\n writeFile: (filePath, data) => fs.writeFile(filePath, data),\n mkdir: (dir) => fs.mkdir(dir, { recursive: true }),\n })\n\n const exportPageSpan = trace('export-page-worker', input.parentSpanId)\n\n const start = Date.now()\n\n const turborepoAccessTraceResult = new TurborepoAccessTraceResult()\n\n // Export the page.\n let result: ExportRouteResult | undefined\n try {\n result = await exportPageSpan.traceAsyncFn(() =>\n turborepoTraceAccess(\n () => exportPageImpl(input, fileWriter),\n turborepoAccessTraceResult\n )\n )\n\n // Wait for all the files to flush to disk.\n await fileWriter.wait()\n\n // If there was no result, then we can exit early.\n if (!result) return\n\n // If there was an error, then we can exit early.\n if ('error' in result) {\n return { error: result.error, duration: Date.now() - start }\n }\n } catch (err) {\n console.error(\n `Error occurred prerendering page \"${input.path}\". Read more: https://nextjs.org/docs/messages/prerender-error`\n )\n\n // bailoutToCSRError errors should not leak to the user as they are not actionable; they're\n // a framework signal\n if (!isBailoutToCSRError(err)) {\n // A static generation bailout error is a framework signal to fail static generation but\n // and will encode a reason in the error message. If there is a message, we'll print it.\n // Otherwise there's nothing to show as we don't want to leak an error internal error stack to the user.\n if (isStaticGenBailoutError(err)) {\n if (err.message) {\n console.error(`Error: ${err.message}`)\n }\n } else if (isError(err) && err.stack) {\n console.error(err.stack)\n } else {\n console.error(err)\n }\n }\n\n return { error: true, duration: Date.now() - start }\n }\n\n // Notify the parent process that we processed a page (used by the progress activity indicator)\n process.send?.([3, { type: 'activity' }])\n\n // Otherwise we can return the result.\n return {\n duration: Date.now() - start,\n ampValidations: result.ampValidations,\n revalidate: result.revalidate,\n metadata: result.metadata,\n ssgNotFound: result.ssgNotFound,\n hasEmptyPrelude: result.hasEmptyPrelude,\n hasPostponed: result.hasPostponed,\n turborepoAccessTraceResult: turborepoAccessTraceResult.serialize(),\n fetchMetrics: result.fetchMetrics,\n }\n}\n\nprocess.on('unhandledRejection', (err: unknown) => {\n // if it's a postpone error, it'll be handled later\n // when the postponed promise is actually awaited.\n if (isPostpone(err)) {\n return\n }\n\n // we don't want to log these errors\n if (isDynamicUsageError(err)) {\n return\n }\n\n console.error(err)\n})\n\nprocess.on('rejectionHandled', () => {\n // It is ok to await a Promise late in Next.js as it allows for better\n // prefetching patterns to avoid waterfalls. We ignore logging these.\n // We should've already errored in anyway unhandledRejection.\n})\n\nconst FATAL_UNHANDLED_NEXT_API_EXIT_CODE = 78\n\nprocess.on('uncaughtException', (err) => {\n if (isDynamicUsageError(err)) {\n console.error(\n 'A Next.js API that uses exceptions to signal framework behavior was uncaught. This suggests improper usage of a Next.js API. The original error is printed below and the build will now exit.'\n )\n console.error(err)\n process.exit(FATAL_UNHANDLED_NEXT_API_EXIT_CODE)\n } else {\n console.error(err)\n }\n})\n"],"names":["process","env","NEXT_IS_EXPORT_WORKER","extname","join","dirname","sep","fs","loadComponents","isDynamicRoute","normalizePagePath","normalizeLocalePath","trace","setHttpClientAndAgentOptions","isError","addRequestMeta","normalizeAppPath","createRequestResponseMocks","isAppRouteRoute","hasNextSupport","exportAppRoute","exportAppPage","prospectiveRenderAppPage","exportPagesPage","getParams","createIncrementalCache","isPostpone","isDynamicUsageError","isBailoutToCSRError","turborepoTraceAccess","TurborepoAccessTraceResult","getFallbackRouteParams","needsExperimentalReact","isStaticGenBailoutError","MultiFileWriter","envConfig","require","globalThis","__NEXT_DATA__","nextExport","TimeoutError","Error","code","ExportPageError","exportPageImpl","input","fileWriter","req","path","pathMap","distDir","pagesDataDir","buildExport","serverRuntimeConfig","subFolders","optimizeCss","disableOptimizedLoading","debugOutput","enableExperimentalReact","ampValidatorPath","trailingSlash","sriEnabled","__NEXT_EXPERIMENTAL_REACT","page","_fallbackRouteParams","_isAppDir","isAppDir","_isDynamicError","isDynamicError","_isRoutePPREnabled","isRoutePPREnabled","_isProspectiveRender","isProspectiveRender","query","originalQuery","fallbackRouteParams","pathname","isDynamic","outDir","filePath","ampPath","renderAmpPath","updatedPath","_ssgPath","locale","_locale","renderOpts","localePathResult","locales","detectedLocale","defaultLocale","hasOrigQueryValues","Object","keys","length","nonLocalizedPath","params","normalizedPage","res","url","statusCode","some","p","endsWith","domainLocales","dl","includes","setConfig","publicRuntimeConfig","runtimeConfig","getHtmlFilename","htmlFilename","pageExt","pathExt","isBuiltinPaths","isHtmlExtPath","baseDir","htmlFilepath","mkdir","recursive","components","isAppPath","isDev","routeModule","incrementalCache","cacheLifeProfiles","experimental","buildId","supportsDynamicResponse","isRevalidate","sharedContext","deploymentId","customServer","undefined","renderContext","isFallback","_pagesFallback","isDraftMode","developmentNotFoundSourcePage","exportPages","exportPathMap","paths","dir","cacheHandler","cacheMaxMemorySize","fetchCacheKeyPrefix","nextConfig","options","flushToDisk","cacheHandlers","maxConcurrency","staticGenerationMaxConcurrency","results","exportPageWithRetry","maxAttempts","pageKey","attempt","result","Promise","race","exportPage","amp","validator","parentSpanId","httpAgentOptions","Boolean","sri","algorithm","_","reject","setTimeout","staticPageGenerationTimeout","err","console","info","prerenderEarlyExit","error","exit","baseDelay","maxDelay","delay","Math","min","pow","jitter","random","r","i","subset","slice","subsetResults","all","map","staticGenerationRetryCount","push","setAttribute","writeFile","data","exportPageSpan","start","Date","now","turborepoAccessTraceResult","traceAsyncFn","wait","duration","message","stack","send","type","ampValidations","revalidate","metadata","ssgNotFound","hasEmptyPrelude","hasPostponed","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AAKC,GAAG,KAAKF;QAAM;IACrD;IAEA,+FAA+F;IAC/FvM,QAAQgN,IAAI,oBAAZhN,QAAQgN,IAAI,MAAZhN,SAAe;QAAC;QAAG;YAAEiN,MAAM;QAAW;KAAE;IAExC,sCAAsC;IACtC,OAAO;QACLJ,UAAUL,KAAKC,GAAG,KAAKF;QACvBW,gBAAgBrD,OAAOqD,cAAc;QACrCC,YAAYtD,OAAOsD,UAAU;QAC7BC,UAAUvD,OAAOuD,QAAQ;QACzBC,aAAaxD,OAAOwD,WAAW;QAC/BC,iBAAiBzD,OAAOyD,eAAe;QACvCC,cAAc1D,OAAO0D,YAAY;QACjCb,4BAA4BA,2BAA2Bc,SAAS;QAChEC,cAAc5D,OAAO4D,YAAY;IACnC;AACF;AAEAzN,QAAQ0N,EAAE,CAAC,sBAAsB,CAAC9C;IAChC,mDAAmD;IACnD,kDAAkD;IAClD,IAAIlJ,WAAWkJ,MAAM;QACnB;IACF;IAEA,oCAAoC;IACpC,IAAIjJ,oBAAoBiJ,MAAM;QAC5B;IACF;IAEAC,QAAQG,KAAK,CAACJ;AAChB;AAEA5K,QAAQ0N,EAAE,CAAC,oBAAoB;AAC7B,sEAAsE;AACtE,qEAAqE;AACrE,6DAA6D;AAC/D;AAEA,MAAMC,qCAAqC;AAE3C3N,QAAQ0N,EAAE,CAAC,qBAAqB,CAAC9C;IAC/B,IAAIjJ,oBAAoBiJ,MAAM;QAC5BC,QAAQG,KAAK,CACX;QAEFH,QAAQG,KAAK,CAACJ;QACd5K,QAAQiL,IAAI,CAAC0C;IACf,OAAO;QACL9C,QAAQG,KAAK,CAACJ;IAChB;AACF"}
|
|
@@ -34,7 +34,8 @@ const unsupportedTurbopackNextConfigOptions = [
|
|
|
34
34
|
// This is used to force swc-loader to run regardless of finding Babel.
|
|
35
35
|
'experimental.forceSwcTransforms',
|
|
36
36
|
'experimental.fullySpecified',
|
|
37
|
-
'experimental.urlImports'
|
|
37
|
+
'experimental.urlImports',
|
|
38
|
+
'experimental.slowModuleDetection'
|
|
38
39
|
];
|
|
39
40
|
// The following will need to be supported by `next build --turbopack`
|
|
40
41
|
const unsupportedProductionSpecificTurbopackNextConfigOptions = [];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/lib/turbopack-warning.ts"],"sourcesContent":["import type { NextConfig } from '../server/config-shared'\nimport path from 'path'\nimport loadConfig from '../server/config'\nimport * as Log from '../build/output/log'\nimport {\n PHASE_DEVELOPMENT_SERVER,\n PHASE_PRODUCTION_BUILD,\n} from '../shared/lib/constants'\n\nconst unsupportedTurbopackNextConfigOptions = [\n // is this supported?\n // 'amp',\n // 'experimental.amp',\n\n // Left to be implemented (priority)\n // 'experimental.clientRouterFilter',\n // 'experimental.optimizePackageImports',\n // 'compiler.emotion',\n // 'compiler.reactRemoveProperties',\n // 'compiler.relay',\n // 'compiler.removeConsole',\n // 'compiler.styledComponents',\n 'experimental.fetchCacheKeyPrefix',\n\n // Left to be implemented\n // 'excludeDefaultMomentLocales',\n // 'experimental.optimizeServerReact',\n 'experimental.clientRouterFilterAllowedRate',\n // 'experimental.serverMinification',\n // 'experimental.serverSourceMaps',\n\n 'experimental.allowedRevalidateHeaderKeys',\n 'experimental.extensionAlias',\n 'experimental.fallbackNodePolyfills',\n\n 'experimental.sri.algorithm',\n 'experimental.swcTraceProfiling',\n 'experimental.typedRoutes',\n\n // Left to be implemented (Might not be needed for Turbopack)\n 'experimental.craCompat',\n 'experimental.disablePostcssPresetEnv',\n 'experimental.esmExternals',\n // This is used to force swc-loader to run regardless of finding Babel.\n 'experimental.forceSwcTransforms',\n 'experimental.fullySpecified',\n 'experimental.urlImports',\n]\n\n// The following will need to be supported by `next build --turbopack`\nconst unsupportedProductionSpecificTurbopackNextConfigOptions: string[] = [\n // TODO: Support disabling sourcemaps, currently they're always enabled.\n // 'productionBrowserSourceMaps',\n]\n\n// check for babelrc, swc plugins\nexport async function validateTurboNextConfig({\n dir,\n isDev,\n}: {\n dir: string\n isDev?: boolean\n}) {\n const { getPkgManager } =\n require('../lib/helpers/get-pkg-manager') as typeof import('../lib/helpers/get-pkg-manager')\n const { getBabelConfigFile } =\n require('../build/get-babel-config-file') as typeof import('../build/get-babel-config-file')\n const { defaultConfig } =\n require('../server/config-shared') as typeof import('../server/config-shared')\n const { bold, cyan, red, underline } =\n require('../lib/picocolors') as typeof import('../lib/picocolors')\n const { interopDefault } =\n require('../lib/interop-default') as typeof import('../lib/interop-default')\n\n let unsupportedParts = ''\n let babelrc = await getBabelConfigFile(dir)\n if (babelrc) babelrc = path.basename(babelrc)\n\n let hasWebpackConfig = false\n let hasTurboConfig = false\n\n let unsupportedConfig: string[] = []\n let rawNextConfig: NextConfig = {}\n\n const phase = isDev ? PHASE_DEVELOPMENT_SERVER : PHASE_PRODUCTION_BUILD\n try {\n rawNextConfig = interopDefault(\n await loadConfig(phase, dir, {\n rawConfig: true,\n })\n ) as NextConfig\n\n if (typeof rawNextConfig === 'function') {\n rawNextConfig = (rawNextConfig as any)(phase, {\n defaultConfig,\n })\n }\n\n const flattenKeys = (obj: any, prefix: string = ''): string[] => {\n let keys: string[] = []\n\n for (const key in obj) {\n if (typeof obj?.[key] === 'undefined') {\n continue\n }\n\n const pre = prefix.length ? `${prefix}.` : ''\n\n if (\n typeof obj[key] === 'object' &&\n !Array.isArray(obj[key]) &&\n obj[key] !== null\n ) {\n keys = keys.concat(flattenKeys(obj[key], pre + key))\n } else {\n keys.push(pre + key)\n }\n }\n\n return keys\n }\n\n const getDeepValue = (obj: any, keys: string | string[]): any => {\n if (typeof keys === 'string') {\n keys = keys.split('.')\n }\n if (keys.length === 1) {\n return obj?.[keys?.[0]]\n }\n return getDeepValue(obj?.[keys?.[0]], keys.slice(1))\n }\n\n const customKeys = flattenKeys(rawNextConfig)\n\n let unsupportedKeys = isDev\n ? unsupportedTurbopackNextConfigOptions\n : [\n ...unsupportedTurbopackNextConfigOptions,\n ...unsupportedProductionSpecificTurbopackNextConfigOptions,\n ]\n\n for (const key of customKeys) {\n if (key.startsWith('webpack') && rawNextConfig.webpack) {\n hasWebpackConfig = true\n }\n if (key.startsWith('experimental.turbo')) {\n hasTurboConfig = true\n }\n\n let isUnsupported =\n unsupportedKeys.some(\n (unsupportedKey) =>\n // Either the key matches (or is a more specific subkey) of\n // unsupportedKey, or the key is the path to a specific subkey.\n // | key | unsupportedKey |\n // |---------|----------------|\n // | foo | foo |\n // | foo.bar | foo |\n // | foo | foo.bar |\n key.startsWith(unsupportedKey) ||\n unsupportedKey.startsWith(`${key}.`)\n ) &&\n getDeepValue(rawNextConfig, key) !== getDeepValue(defaultConfig, key)\n\n if (isUnsupported) {\n unsupportedConfig.push(key)\n }\n }\n } catch (e) {\n Log.error('Unexpected error occurred while checking config', e)\n }\n\n const feedbackMessage = `Learn more about Next.js and Turbopack: ${underline(\n 'https://nextjs.org/docs/architecture/turbopack'\n )}\\n`\n\n if (hasWebpackConfig && !hasTurboConfig) {\n Log.warn(\n `Webpack is configured while Turbopack is not, which may cause problems.`\n )\n Log.warn(\n `See instructions if you need to configure Turbopack:\\n https://nextjs.org/docs/app/api-reference/next-config-js/turbo\\n`\n )\n }\n\n if (babelrc) {\n unsupportedParts += `Babel detected (${cyan(\n babelrc\n )})\\n Babel is not yet supported. To use Turbopack at the moment,\\n you'll need to remove your usage of Babel.`\n }\n\n if (\n unsupportedConfig.length === 1 &&\n unsupportedConfig[0] === 'experimental.optimizePackageImports'\n ) {\n Log.warn(\n `'experimental.optimizePackageImports' is not yet supported by Turbopack and will be ignored.`\n )\n } else if (unsupportedConfig.length) {\n unsupportedParts += `\\n\\n- Unsupported Next.js configuration option(s) (${cyan(\n 'next.config.js'\n )})\\n To use Turbopack, remove the following configuration options:\\n${unsupportedConfig\n .map((name) => ` - ${red(name)}\\n`)\n .join('')}`\n }\n\n if (unsupportedParts) {\n const pkgManager = getPkgManager(dir)\n\n Log.error(\n `You are using configuration and/or tools that are not yet\\nsupported by Next.js with Turbopack:\\n${unsupportedParts}\\n\nIf you cannot make the changes above, but still want to try out\\nNext.js with Turbopack, create the Next.js playground app\\nby running the following commands:\n\n ${bold(\n cyan(\n `${\n pkgManager === 'npm'\n ? 'npx create-next-app'\n : `${pkgManager} create next-app`\n } --example with-turbopack with-turbopack-app`\n )\n )}\\n cd with-turbopack-app\\n ${pkgManager} run dev\n `\n )\n\n Log.warn(feedbackMessage)\n\n process.exit(1)\n }\n\n return rawNextConfig\n}\n"],"names":["path","loadConfig","Log","PHASE_DEVELOPMENT_SERVER","PHASE_PRODUCTION_BUILD","unsupportedTurbopackNextConfigOptions","unsupportedProductionSpecificTurbopackNextConfigOptions","validateTurboNextConfig","dir","isDev","getPkgManager","require","getBabelConfigFile","defaultConfig","bold","cyan","red","underline","interopDefault","unsupportedParts","babelrc","basename","hasWebpackConfig","hasTurboConfig","unsupportedConfig","rawNextConfig","phase","rawConfig","flattenKeys","obj","prefix","keys","key","pre","length","Array","isArray","concat","push","getDeepValue","split","slice","customKeys","unsupportedKeys","startsWith","webpack","isUnsupported","some","unsupportedKey","e","error","feedbackMessage","warn","map","name","join","pkgManager","process","exit"],"mappings":"AACA,OAAOA,UAAU,OAAM;AACvB,OAAOC,gBAAgB,mBAAkB;AACzC,YAAYC,SAAS,sBAAqB;AAC1C,SACEC,wBAAwB,EACxBC,sBAAsB,QACjB,0BAAyB;AAEhC,MAAMC,wCAAwC;IAC5C,qBAAqB;IACrB,SAAS;IACT,sBAAsB;IAEtB,oCAAoC;IACpC,qCAAqC;IACrC,yCAAyC;IACzC,sBAAsB;IACtB,oCAAoC;IACpC,oBAAoB;IACpB,4BAA4B;IAC5B,+BAA+B;IAC/B;IAEA,yBAAyB;IACzB,iCAAiC;IACjC,sCAAsC;IACtC;IACA,qCAAqC;IACrC,mCAAmC;IAEnC;IACA;IACA;IAEA;IACA;IACA;IAEA,6DAA6D;IAC7D;IACA;IACA;IACA,uEAAuE;IACvE;IACA;IACA;CACD;AAED,sEAAsE;AACtE,MAAMC,0DAAoE,EAGzE;AAED,iCAAiC;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IkD,IAAI,CACN,CAAC,wHAAwH,CAAC;IAE9H;IAEA,IAAIhC,SAAS;QACXD,oBAAoB,CAAC,gBAAgB,EAAEJ,KACrCK,SACA,8GAA8G,CAAC;IACnH;IAEA,IACEI,kBAAkBU,MAAM,KAAK,KAC7BV,iBAAiB,CAAC,EAAE,KAAK,uCACzB;QACAtB,IAAIkD,IAAI,CACN,CAAC,4FAA4F,CAAC;IAElG,OAAO,IAAI5B,kBAAkBU,MAAM,EAAE;QACnCf,oBAAoB,CAAC,mDAAmD,EAAEJ,KACxE,kBACA,oEAAoE,EAAES,kBACrE6B,GAAG,CAAC,CAACC,OAAS,CAAC,MAAM,EAAEtC,IAAIsC,MAAM,EAAE,CAAC,EACpCC,IAAI,CAAC,KAAK;IACf;IAEA,IAAIpC,kBAAkB;QACpB,MAAMqC,aAAa9C,cAAcF;QAEjCN,IAAIgD,KAAK,CACP,CAAC,iGAAiG,EAAE/B,iBAAiB;;;EAGzH,EAAEL,KACAC,KACE,GACEyC,eAAe,QACX,wBACA,GAAGA,WAAW,gBAAgB,CAAC,CACpC,4CAA4C,CAAC,GAEhD,6BAA6B,EAAEA,WAAW;QACtC,CAAC;QAGLtD,IAAIkD,IAAI,CAACD;QAETM,QAAQC,IAAI,CAAC;IACf;IAEA,OAAOjC;AACT"}
|
|
1
|
+
{"version":3,"sources":["../../src/lib/turbopack-warning.ts"],"sourcesContent":["import type { NextConfig } from '../server/config-shared'\nimport path from 'path'\nimport loadConfig from '../server/config'\nimport * as Log from '../build/output/log'\nimport {\n PHASE_DEVELOPMENT_SERVER,\n PHASE_PRODUCTION_BUILD,\n} from '../shared/lib/constants'\n\nconst unsupportedTurbopackNextConfigOptions = [\n // is this supported?\n // 'amp',\n // 'experimental.amp',\n\n // Left to be implemented (priority)\n // 'experimental.clientRouterFilter',\n // 'experimental.optimizePackageImports',\n // 'compiler.emotion',\n // 'compiler.reactRemoveProperties',\n // 'compiler.relay',\n // 'compiler.removeConsole',\n // 'compiler.styledComponents',\n 'experimental.fetchCacheKeyPrefix',\n\n // Left to be implemented\n // 'excludeDefaultMomentLocales',\n // 'experimental.optimizeServerReact',\n 'experimental.clientRouterFilterAllowedRate',\n // 'experimental.serverMinification',\n // 'experimental.serverSourceMaps',\n\n 'experimental.allowedRevalidateHeaderKeys',\n 'experimental.extensionAlias',\n 'experimental.fallbackNodePolyfills',\n\n 'experimental.sri.algorithm',\n 'experimental.swcTraceProfiling',\n 'experimental.typedRoutes',\n\n // Left to be implemented (Might not be needed for Turbopack)\n 'experimental.craCompat',\n 'experimental.disablePostcssPresetEnv',\n 'experimental.esmExternals',\n // This is used to force swc-loader to run regardless of finding Babel.\n 'experimental.forceSwcTransforms',\n 'experimental.fullySpecified',\n 'experimental.urlImports',\n 'experimental.slowModuleDetection',\n]\n\n// The following will need to be supported by `next build --turbopack`\nconst unsupportedProductionSpecificTurbopackNextConfigOptions: string[] = [\n // TODO: Support disabling sourcemaps, currently they're always enabled.\n // 'productionBrowserSourceMaps',\n]\n\n// check for babelrc, swc plugins\nexport async function validateTurboNextConfig({\n dir,\n isDev,\n}: {\n dir: string\n isDev?: boolean\n}) {\n const { getPkgManager } =\n require('../lib/helpers/get-pkg-manager') as typeof import('../lib/helpers/get-pkg-manager')\n const { getBabelConfigFile } =\n require('../build/get-babel-config-file') as typeof import('../build/get-babel-config-file')\n const { defaultConfig } =\n require('../server/config-shared') as typeof import('../server/config-shared')\n const { bold, cyan, red, underline } =\n require('../lib/picocolors') as typeof import('../lib/picocolors')\n const { interopDefault } =\n require('../lib/interop-default') as typeof import('../lib/interop-default')\n\n let unsupportedParts = ''\n let babelrc = await getBabelConfigFile(dir)\n if (babelrc) babelrc = path.basename(babelrc)\n\n let hasWebpackConfig = false\n let hasTurboConfig = false\n\n let unsupportedConfig: string[] = []\n let rawNextConfig: NextConfig = {}\n\n const phase = isDev ? PHASE_DEVELOPMENT_SERVER : PHASE_PRODUCTION_BUILD\n try {\n rawNextConfig = interopDefault(\n await loadConfig(phase, dir, {\n rawConfig: true,\n })\n ) as NextConfig\n\n if (typeof rawNextConfig === 'function') {\n rawNextConfig = (rawNextConfig as any)(phase, {\n defaultConfig,\n })\n }\n\n const flattenKeys = (obj: any, prefix: string = ''): string[] => {\n let keys: string[] = []\n\n for (const key in obj) {\n if (typeof obj?.[key] === 'undefined') {\n continue\n }\n\n const pre = prefix.length ? `${prefix}.` : ''\n\n if (\n typeof obj[key] === 'object' &&\n !Array.isArray(obj[key]) &&\n obj[key] !== null\n ) {\n keys = keys.concat(flattenKeys(obj[key], pre + key))\n } else {\n keys.push(pre + key)\n }\n }\n\n return keys\n }\n\n const getDeepValue = (obj: any, keys: string | string[]): any => {\n if (typeof keys === 'string') {\n keys = keys.split('.')\n }\n if (keys.length === 1) {\n return obj?.[keys?.[0]]\n }\n return getDeepValue(obj?.[keys?.[0]], keys.slice(1))\n }\n\n const customKeys = flattenKeys(rawNextConfig)\n\n let unsupportedKeys = isDev\n ? unsupportedTurbopackNextConfigOptions\n : [\n ...unsupportedTurbopackNextConfigOptions,\n ...unsupportedProductionSpecificTurbopackNextConfigOptions,\n ]\n\n for (const key of customKeys) {\n if (key.startsWith('webpack') && rawNextConfig.webpack) {\n hasWebpackConfig = true\n }\n if (key.startsWith('experimental.turbo')) {\n hasTurboConfig = true\n }\n\n let isUnsupported =\n unsupportedKeys.some(\n (unsupportedKey) =>\n // Either the key matches (or is a more specific subkey) of\n // unsupportedKey, or the key is the path to a specific subkey.\n // | key | unsupportedKey |\n // |---------|----------------|\n // | foo | foo |\n // | foo.bar | foo |\n // | foo | foo.bar |\n key.startsWith(unsupportedKey) ||\n unsupportedKey.startsWith(`${key}.`)\n ) &&\n getDeepValue(rawNextConfig, key) !== getDeepValue(defaultConfig, key)\n\n if (isUnsupported) {\n unsupportedConfig.push(key)\n }\n }\n } catch (e) {\n Log.error('Unexpected error occurred while checking config', e)\n }\n\n const feedbackMessage = `Learn more about Next.js and Turbopack: ${underline(\n 'https://nextjs.org/docs/architecture/turbopack'\n )}\\n`\n\n if (hasWebpackConfig && !hasTurboConfig) {\n Log.warn(\n `Webpack is configured while Turbopack is not, which may cause problems.`\n )\n Log.warn(\n `See instructions if you need to configure Turbopack:\\n https://nextjs.org/docs/app/api-reference/next-config-js/turbo\\n`\n )\n }\n\n if (babelrc) {\n unsupportedParts += `Babel detected (${cyan(\n babelrc\n )})\\n Babel is not yet supported. To use Turbopack at the moment,\\n you'll need to remove your usage of Babel.`\n }\n\n if (\n unsupportedConfig.length === 1 &&\n unsupportedConfig[0] === 'experimental.optimizePackageImports'\n ) {\n Log.warn(\n `'experimental.optimizePackageImports' is not yet supported by Turbopack and will be ignored.`\n )\n } else if (unsupportedConfig.length) {\n unsupportedParts += `\\n\\n- Unsupported Next.js configuration option(s) (${cyan(\n 'next.config.js'\n )})\\n To use Turbopack, remove the following configuration options:\\n${unsupportedConfig\n .map((name) => ` - ${red(name)}\\n`)\n .join('')}`\n }\n\n if (unsupportedParts) {\n const pkgManager = getPkgManager(dir)\n\n Log.error(\n `You are using configuration and/or tools that are not yet\\nsupported by Next.js with Turbopack:\\n${unsupportedParts}\\n\nIf you cannot make the changes above, but still want to try out\\nNext.js with Turbopack, create the Next.js playground app\\nby running the following commands:\n\n ${bold(\n cyan(\n `${\n pkgManager === 'npm'\n ? 'npx create-next-app'\n : `${pkgManager} create next-app`\n } --example with-turbopack with-turbopack-app`\n )\n )}\\n cd with-turbopack-app\\n ${pkgManager} run dev\n `\n )\n\n Log.warn(feedbackMessage)\n\n process.exit(1)\n }\n\n return rawNextConfig\n}\n"],"names":["path","loadConfig","Log","PHASE_DEVELOPMENT_SERVER","PHASE_PRODUCTION_BUILD","unsupportedTurbopackNextConfigOptions","unsupportedProductionSpecificTurbopackNextConfigOptions","validateTurboNextConfig","dir","isDev","getPkgManager","require","getBabelConfigFile","defaultConfig","bold","cyan","red","underline","interopDefault","unsupportedParts","babelrc","basename","hasWebpackConfig","hasTurboConfig","unsupportedConfig","rawNextConfig","phase","rawConfig","flattenKeys","obj","prefix","keys","key","pre","length","Array","isArray","concat","push","getDeepValue","split","slice","customKeys","unsupportedKeys","startsWith","webpack","isUnsupported","some","unsupportedKey","e","error","feedbackMessage","warn","map","name","join","pkgManager","process","exit"],"mappings":"AACA,OAAOA,UAAU,OAAM;AACvB,OAAOC,gBAAgB,mBAAkB;AACzC,YAAYC,SAAS,sBAAqB;AAC1C,SACEC,wBAAwB,EACxBC,sBAAsB,QACjB,0BAAyB;AAEhC,MAAMC,wCAAwC;IAC5C,qBAAqB;IACrB,SAAS;IACT,sBAAsB;IAEtB,oCAAoC;IACpC,qCAAqC;IACrC,yCAAyC;IACzC,sBAAsB;IACtB,oCAAoC;IACpC,oBAAoB;IACpB,4BAA4B;IAC5B,+BAA+B;IAC/B;IAEA,yBAAyB;IACzB,iCAAiC;IACjC,sCAAsC;IACtC;IACA,qCAAqC;IACrC,mCAAmC;IAEnC;IACA;IACA;IAEA;IACA;IACA;IAEA,6DAA6D;IAC7D;IACA;IACA;IACA,uEAAuE;IACvE;IACA;IACA;IACA;CACD;AAED,sEAAsE;AACtE,MAAMC,0DAAoE,EAGzE;AAED,iCAAiC;AACjC,OAAO,eAAeC,wBAAwB,EAC5CC,GAAG,EACHC,KAAK,EAIN;IACC,MAAM,EAAEC,aAAa,EAAE,GACrBC,QAAQ;IACV,MAAM,EAAEC,kBAAkB,EAAE,GAC1BD,QAAQ;IACV,MAAM,EAAEE,aAAa,EAAE,GACrBF,QAAQ;IACV,MAAM,EAAEG,IAAI,EAAEC,IAAI,EAAEC,GAAG,EAAEC,SAAS,EAAE,GAClCN,QAAQ;IACV,MAAM,EAAEO,cAAc,EAAE,GACtBP,QAAQ;IAEV,IAAIQ,mBAAmB;IACvB,IAAIC,UAAU,MAAMR,mBAAmBJ;IACvC,IAAIY,SAASA,UAAUpB,KAAKqB,QAAQ,CAACD;IAErC,IAAIE,mBAAmB;IACvB,IAAIC,iBAAiB;IAErB,IAAIC,oBAA8B,EAAE;IACpC,IAAIC,gBAA4B,CAAC;I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IAAIgD,KAAK,CACP,CAAC,iGAAiG,EAAE/B,iBAAiB;;;EAGzH,EAAEL,KACAC,KACE,GACEyC,eAAe,QACX,wBACA,GAAGA,WAAW,gBAAgB,CAAC,CACpC,4CAA4C,CAAC,GAEhD,6BAA6B,EAAEA,WAAW;QACtC,CAAC;QAGLtD,IAAIkD,IAAI,CAACD;QAETM,QAAQC,IAAI,CAAC;IACf;IAEA,OAAOjC;AACT"}
|
|
@@ -639,10 +639,10 @@ export default class Server {
|
|
|
639
639
|
params = paramsResult.params;
|
|
640
640
|
}
|
|
641
641
|
const routeMatchesHeader = req.headers['x-now-route-matches'];
|
|
642
|
-
if (typeof routeMatchesHeader === 'string' && routeMatchesHeader && isDynamicRoute(matchedPath) && !paramsResult.hasValidParams) {
|
|
642
|
+
if (typeof routeMatchesHeader === 'string' && routeMatchesHeader && isDynamicRoute(matchedPath) && (Object.keys(params).length === 0 || !paramsResult.hasValidParams)) {
|
|
643
643
|
const routeMatches = utils.getParamsFromRouteMatches(routeMatchesHeader);
|
|
644
644
|
if (routeMatches) {
|
|
645
|
-
paramsResult = utils.normalizeDynamicRouteParams(routeMatches
|
|
645
|
+
paramsResult = utils.normalizeDynamicRouteParams(routeMatches);
|
|
646
646
|
if (paramsResult.hasValidParams) {
|
|
647
647
|
params = paramsResult.params;
|
|
648
648
|
}
|
|
@@ -651,7 +651,7 @@ export default class Server {
|
|
|
651
651
|
// handle the actual dynamic route name being requested
|
|
652
652
|
if (utils.defaultRouteMatches && normalizedUrlPath === srcPathname && !paramsResult.hasValidParams && !utils.normalizeDynamicRouteParams({
|
|
653
653
|
...params
|
|
654
|
-
}
|
|
654
|
+
}).hasValidParams) {
|
|
655
655
|
params = utils.defaultRouteMatches;
|
|
656
656
|
// Mark that the default route matches were set on the request
|
|
657
657
|
// during routing.
|
|
@@ -664,7 +664,7 @@ export default class Server {
|
|
|
664
664
|
}
|
|
665
665
|
if (pageIsDynamic || didRewrite) {
|
|
666
666
|
var _utils_defaultRouteRegex;
|
|
667
|
-
utils.normalizeVercelUrl(req,
|
|
667
|
+
utils.normalizeVercelUrl(req, [
|
|
668
668
|
...rewriteParamKeys,
|
|
669
669
|
...Object.keys(((_utils_defaultRouteRegex = utils.defaultRouteRegex) == null ? void 0 : _utils_defaultRouteRegex.groups) || {})
|
|
670
670
|
]);
|