next 15.2.0-canary.70 → 15.2.0-canary.71

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.

Files changed (285) hide show
  1. package/dist/bin/next +1 -1
  2. package/dist/build/index.js +2 -2
  3. package/dist/build/swc/index.js +1 -1
  4. package/dist/build/utils.js +20 -12
  5. package/dist/build/utils.js.map +1 -1
  6. package/dist/build/webpack-config.js +2 -2
  7. package/dist/client/app-bootstrap.js +1 -1
  8. package/dist/client/components/react-dev-overlay/ui/components/errors/dev-tools-indicator/dev-tools-indicator.d.ts +2 -2
  9. package/dist/client/components/react-dev-overlay/ui/components/errors/dev-tools-indicator/dev-tools-indicator.js +8 -5
  10. package/dist/client/components/react-dev-overlay/ui/components/errors/dev-tools-indicator/dev-tools-indicator.js.map +1 -1
  11. package/dist/client/components/react-dev-overlay/ui/components/errors/dev-tools-indicator/next-logo.d.ts +1 -1
  12. package/dist/client/components/react-dev-overlay/ui/components/errors/dev-tools-indicator/next-logo.js +2 -2
  13. package/dist/client/components/react-dev-overlay/ui/components/errors/dev-tools-indicator/next-logo.js.map +1 -1
  14. package/dist/client/components/react-dev-overlay/ui/components/errors/error-overlay-bottom-stack/index.d.ts +3 -3
  15. package/dist/client/components/react-dev-overlay/ui/components/errors/error-overlay-bottom-stack/index.js +7 -18
  16. package/dist/client/components/react-dev-overlay/ui/components/errors/error-overlay-bottom-stack/index.js.map +1 -1
  17. package/dist/client/components/react-dev-overlay/ui/components/errors/error-overlay-layout/error-overlay-layout.js +1 -1
  18. package/dist/client/components/react-dev-overlay/ui/components/errors/error-overlay-layout/error-overlay-layout.js.map +1 -1
  19. package/dist/client/components/react-dev-overlay/ui/dev-overlay.d.ts +1 -1
  20. package/dist/client/components/react-dev-overlay/ui/dev-overlay.js.map +1 -1
  21. package/dist/client/index.js +1 -1
  22. package/dist/compiled/next-server/app-page-experimental.runtime.dev.js +2 -2
  23. package/dist/compiled/next-server/app-page-experimental.runtime.dev.js.map +1 -1
  24. package/dist/compiled/next-server/app-page.runtime.dev.js +2 -2
  25. package/dist/compiled/next-server/app-page.runtime.dev.js.map +1 -1
  26. package/dist/compiled/next-server/server.runtime.prod.js +2 -2
  27. package/dist/compiled/next-server/server.runtime.prod.js.map +1 -1
  28. package/dist/esm/build/index.js +2 -2
  29. package/dist/esm/build/swc/index.js +1 -1
  30. package/dist/esm/build/utils.js +20 -12
  31. package/dist/esm/build/utils.js.map +1 -1
  32. package/dist/esm/build/webpack-config.js +2 -2
  33. package/dist/esm/client/app-bootstrap.js +1 -1
  34. package/dist/esm/client/components/react-dev-overlay/ui/components/errors/dev-tools-indicator/dev-tools-indicator.js +8 -5
  35. package/dist/esm/client/components/react-dev-overlay/ui/components/errors/dev-tools-indicator/dev-tools-indicator.js.map +1 -1
  36. package/dist/esm/client/components/react-dev-overlay/ui/components/errors/dev-tools-indicator/next-logo.js +2 -2
  37. package/dist/esm/client/components/react-dev-overlay/ui/components/errors/dev-tools-indicator/next-logo.js.map +1 -1
  38. package/dist/esm/client/components/react-dev-overlay/ui/components/errors/error-overlay-bottom-stack/index.js +7 -18
  39. package/dist/esm/client/components/react-dev-overlay/ui/components/errors/error-overlay-bottom-stack/index.js.map +1 -1
  40. package/dist/esm/client/components/react-dev-overlay/ui/components/errors/error-overlay-layout/error-overlay-layout.js +1 -1
  41. package/dist/esm/client/components/react-dev-overlay/ui/components/errors/error-overlay-layout/error-overlay-layout.js.map +1 -1
  42. package/dist/esm/client/components/react-dev-overlay/ui/dev-overlay.js.map +1 -1
  43. package/dist/esm/client/index.js +1 -1
  44. package/dist/esm/export/index.js +4 -1
  45. package/dist/esm/export/index.js.map +1 -1
  46. package/dist/esm/export/worker.js +5 -2
  47. package/dist/esm/export/worker.js.map +1 -1
  48. package/dist/esm/server/base-server.js +11 -11
  49. package/dist/esm/server/base-server.js.map +1 -1
  50. package/dist/esm/server/config-shared.js +1 -1
  51. package/dist/esm/server/config-shared.js.map +1 -1
  52. package/dist/esm/server/config.js +1 -1
  53. package/dist/esm/server/dev/hot-reloader-turbopack.js +1 -1
  54. package/dist/esm/server/dev/hot-reloader-webpack.js +1 -1
  55. package/dist/esm/server/lib/app-info-log.js +1 -1
  56. package/dist/esm/server/lib/start-server.js +1 -1
  57. package/dist/export/index.js +4 -1
  58. package/dist/export/index.js.map +1 -1
  59. package/dist/export/worker.js +5 -2
  60. package/dist/export/worker.js.map +1 -1
  61. package/dist/server/base-server.js +11 -11
  62. package/dist/server/base-server.js.map +1 -1
  63. package/dist/server/config-shared.js +1 -1
  64. package/dist/server/config-shared.js.map +1 -1
  65. package/dist/server/config.js +1 -1
  66. package/dist/server/dev/hot-reloader-turbopack.js +1 -1
  67. package/dist/server/dev/hot-reloader-webpack.js +1 -1
  68. package/dist/server/lib/app-info-log.js +1 -1
  69. package/dist/server/lib/start-server.js +1 -1
  70. package/dist/telemetry/anonymous-meta.js +1 -1
  71. package/dist/telemetry/events/session-stopped.js +2 -2
  72. package/dist/telemetry/events/version.js +2 -2
  73. package/package.json +16 -16
  74. package/dist/build/analysis/get-page-static-info.test.d.ts +0 -1
  75. package/dist/build/normalize-catchall-routes.test.d.ts +0 -1
  76. package/dist/build/webpack/loaders/metadata/resolve-route-data.test.d.ts +0 -1
  77. package/dist/build/webpack/plugins/next-types-plugin/index.test.d.ts +0 -1
  78. package/dist/bundles/cssnano-simple/cssnano-preset-simple.test.d.ts +0 -1
  79. package/dist/client/components/is-next-router-error.test.d.ts +0 -1
  80. package/dist/client/components/navigation.test.d.ts +0 -1
  81. package/dist/client/components/promise-queue.test.d.ts +0 -1
  82. package/dist/client/components/react-dev-overlay/server/get-next-error-feedback-middleware.test.d.ts +0 -1
  83. package/dist/client/components/react-dev-overlay/ui/components/call-stack-frame/call-stack-frame.stories.d.ts +0 -7
  84. package/dist/client/components/react-dev-overlay/ui/components/call-stack-frame/call-stack-frame.stories.js +0 -83
  85. package/dist/client/components/react-dev-overlay/ui/components/call-stack-frame/call-stack-frame.stories.js.map +0 -1
  86. package/dist/client/components/react-dev-overlay/ui/components/code-frame/code-frame.stories.d.ts +0 -6
  87. package/dist/client/components/react-dev-overlay/ui/components/code-frame/code-frame.stories.js +0 -55
  88. package/dist/client/components/react-dev-overlay/ui/components/code-frame/code-frame.stories.js.map +0 -1
  89. package/dist/client/components/react-dev-overlay/ui/components/errors/call-stack/call-stack.stories.d.ts +0 -7
  90. package/dist/client/components/react-dev-overlay/ui/components/errors/call-stack/call-stack.stories.js +0 -106
  91. package/dist/client/components/react-dev-overlay/ui/components/errors/call-stack/call-stack.stories.js.map +0 -1
  92. package/dist/client/components/react-dev-overlay/ui/components/errors/dev-tools-indicator/dev-tools-indicator.stories.d.ts +0 -9
  93. package/dist/client/components/react-dev-overlay/ui/components/errors/dev-tools-indicator/dev-tools-indicator.stories.js +0 -135
  94. package/dist/client/components/react-dev-overlay/ui/components/errors/dev-tools-indicator/dev-tools-indicator.stories.js.map +0 -1
  95. package/dist/client/components/react-dev-overlay/ui/components/errors/dev-tools-indicator/next-logo.stories.d.ts +0 -13
  96. package/dist/client/components/react-dev-overlay/ui/components/errors/dev-tools-indicator/next-logo.stories.js +0 -129
  97. package/dist/client/components/react-dev-overlay/ui/components/errors/dev-tools-indicator/next-logo.stories.js.map +0 -1
  98. package/dist/client/components/react-dev-overlay/ui/components/errors/environment-name-label/environment-name-label.stories.d.ts +0 -8
  99. package/dist/client/components/react-dev-overlay/ui/components/errors/environment-name-label/environment-name-label.stories.js +0 -65
  100. package/dist/client/components/react-dev-overlay/ui/components/errors/environment-name-label/environment-name-label.stories.js.map +0 -1
  101. package/dist/client/components/react-dev-overlay/ui/components/errors/error-message/error-message.stories.d.ts +0 -9
  102. package/dist/client/components/react-dev-overlay/ui/components/errors/error-message/error-message.stories.js +0 -83
  103. package/dist/client/components/react-dev-overlay/ui/components/errors/error-message/error-message.stories.js.map +0 -1
  104. package/dist/client/components/react-dev-overlay/ui/components/errors/error-overlay-layout/error-overlay-layout.stories.d.ts +0 -10
  105. package/dist/client/components/react-dev-overlay/ui/components/errors/error-overlay-layout/error-overlay-layout.stories.js +0 -100
  106. package/dist/client/components/react-dev-overlay/ui/components/errors/error-overlay-layout/error-overlay-layout.stories.js.map +0 -1
  107. package/dist/client/components/react-dev-overlay/ui/components/errors/error-overlay-layout/error-overlay-layout.test.d.ts +0 -1
  108. package/dist/client/components/react-dev-overlay/ui/components/errors/error-overlay-nav/error-overlay-nav.stories.d.ts +0 -6
  109. package/dist/client/components/react-dev-overlay/ui/components/errors/error-overlay-nav/error-overlay-nav.stories.js +0 -88
  110. package/dist/client/components/react-dev-overlay/ui/components/errors/error-overlay-nav/error-overlay-nav.stories.js.map +0 -1
  111. package/dist/client/components/react-dev-overlay/ui/components/errors/error-overlay-pagination/error-overlay-pagination.stories.d.ts +0 -9
  112. package/dist/client/components/react-dev-overlay/ui/components/errors/error-overlay-pagination/error-overlay-pagination.stories.js +0 -119
  113. package/dist/client/components/react-dev-overlay/ui/components/errors/error-overlay-pagination/error-overlay-pagination.stories.js.map +0 -1
  114. package/dist/client/components/react-dev-overlay/ui/components/errors/error-overlay-toolbar/copy-stack-trace-button.stories.d.ts +0 -7
  115. package/dist/client/components/react-dev-overlay/ui/components/errors/error-overlay-toolbar/copy-stack-trace-button.stories.js +0 -58
  116. package/dist/client/components/react-dev-overlay/ui/components/errors/error-overlay-toolbar/copy-stack-trace-button.stories.js.map +0 -1
  117. package/dist/client/components/react-dev-overlay/ui/components/errors/error-overlay-toolbar/docs-link-button.stories.d.ts +0 -7
  118. package/dist/client/components/react-dev-overlay/ui/components/errors/error-overlay-toolbar/docs-link-button.stories.js +0 -56
  119. package/dist/client/components/react-dev-overlay/ui/components/errors/error-overlay-toolbar/docs-link-button.stories.js.map +0 -1
  120. package/dist/client/components/react-dev-overlay/ui/components/errors/error-overlay-toolbar/error-overlay-toolbar.stories.d.ts +0 -7
  121. package/dist/client/components/react-dev-overlay/ui/components/errors/error-overlay-toolbar/error-overlay-toolbar.stories.js +0 -60
  122. package/dist/client/components/react-dev-overlay/ui/components/errors/error-overlay-toolbar/error-overlay-toolbar.stories.js.map +0 -1
  123. package/dist/client/components/react-dev-overlay/ui/components/errors/error-overlay-toolbar/nodejs-inspector-button.stories.d.ts +0 -7
  124. package/dist/client/components/react-dev-overlay/ui/components/errors/error-overlay-toolbar/nodejs-inspector-button.stories.js +0 -56
  125. package/dist/client/components/react-dev-overlay/ui/components/errors/error-overlay-toolbar/nodejs-inspector-button.stories.js.map +0 -1
  126. package/dist/client/components/react-dev-overlay/ui/components/errors/error-type-label/error-type-label.stories.d.ts +0 -10
  127. package/dist/client/components/react-dev-overlay/ui/components/errors/error-type-label/error-type-label.stories.js +0 -83
  128. package/dist/client/components/react-dev-overlay/ui/components/errors/error-type-label/error-type-label.stories.js.map +0 -1
  129. package/dist/client/components/react-dev-overlay/ui/components/terminal/terminal.stories.d.ts +0 -7
  130. package/dist/client/components/react-dev-overlay/ui/components/terminal/terminal.stories.js +0 -56
  131. package/dist/client/components/react-dev-overlay/ui/components/terminal/terminal.stories.js.map +0 -1
  132. package/dist/client/components/react-dev-overlay/ui/components/version-staleness-info/version-staleness-info.stories.d.ts +0 -12
  133. package/dist/client/components/react-dev-overlay/ui/components/version-staleness-info/version-staleness-info.stories.js +0 -137
  134. package/dist/client/components/react-dev-overlay/ui/components/version-staleness-info/version-staleness-info.stories.js.map +0 -1
  135. package/dist/client/components/react-dev-overlay/ui/container/build-error.stories.d.ts +0 -7
  136. package/dist/client/components/react-dev-overlay/ui/container/build-error.stories.js +0 -61
  137. package/dist/client/components/react-dev-overlay/ui/container/build-error.stories.js.map +0 -1
  138. package/dist/client/components/react-dev-overlay/ui/container/errors.stories.d.ts +0 -9
  139. package/dist/client/components/react-dev-overlay/ui/container/errors.stories.js +0 -258
  140. package/dist/client/components/react-dev-overlay/ui/container/errors.stories.js.map +0 -1
  141. package/dist/client/components/react-dev-overlay/ui/container/root-layout-missing-tags-error.stories.d.ts +0 -8
  142. package/dist/client/components/react-dev-overlay/ui/container/root-layout-missing-tags-error.stories.js +0 -79
  143. package/dist/client/components/react-dev-overlay/ui/container/root-layout-missing-tags-error.stories.js.map +0 -1
  144. package/dist/client/components/react-dev-overlay/ui/container/runtime-error/component-stack-pseudo-html.stories.d.ts +0 -8
  145. package/dist/client/components/react-dev-overlay/ui/container/runtime-error/component-stack-pseudo-html.stories.js +0 -72
  146. package/dist/client/components/react-dev-overlay/ui/container/runtime-error/component-stack-pseudo-html.stories.js.map +0 -1
  147. package/dist/client/components/react-dev-overlay/ui/dev-overlay.stories.d.ts +0 -6
  148. package/dist/client/components/react-dev-overlay/ui/dev-overlay.stories.js +0 -118
  149. package/dist/client/components/react-dev-overlay/ui/dev-overlay.stories.js.map +0 -1
  150. package/dist/client/components/react-dev-overlay/ui/utils/cx.test.d.ts +0 -1
  151. package/dist/client/components/react-dev-overlay/ui/utils/parse-url-from-text.test.d.ts +0 -1
  152. package/dist/client/components/react-dev-overlay/utils/css.test.d.ts +0 -1
  153. package/dist/client/components/react-dev-overlay/utils/webpack-module-path.test.d.ts +0 -1
  154. package/dist/client/components/redirect.test.d.ts +0 -1
  155. package/dist/client/components/router-reducer/apply-router-state-patch-to-tree.test.d.ts +0 -1
  156. package/dist/client/components/router-reducer/clear-cache-node-data-for-segment-path.test.d.ts +0 -1
  157. package/dist/client/components/router-reducer/compute-changed-path.test.d.ts +0 -1
  158. package/dist/client/components/router-reducer/create-href-from-url.test.d.ts +0 -1
  159. package/dist/client/components/router-reducer/create-initial-router-state.test.d.ts +0 -1
  160. package/dist/client/components/router-reducer/create-router-cache-key.test.d.ts +0 -1
  161. package/dist/client/components/router-reducer/fill-cache-with-new-subtree-data.test.d.ts +0 -1
  162. package/dist/client/components/router-reducer/fill-lazy-items-till-leaf-with-head.test.d.ts +0 -1
  163. package/dist/client/components/router-reducer/get-segment-value.test.d.ts +0 -1
  164. package/dist/client/components/router-reducer/invalidate-cache-below-flight-segmentpath.test.d.ts +0 -1
  165. package/dist/client/components/router-reducer/invalidate-cache-by-router-state.test.d.ts +0 -1
  166. package/dist/client/components/router-reducer/is-navigating-to-new-root-layout.test.d.ts +0 -1
  167. package/dist/client/components/router-reducer/reducers/find-head-in-cache.test.d.ts +0 -1
  168. package/dist/client/components/router-reducer/should-hard-navigate.test.d.ts +0 -1
  169. package/dist/diagnostics/build-diagnostics.test.d.ts +0 -1
  170. package/dist/esm/client/components/react-dev-overlay/ui/components/call-stack-frame/call-stack-frame.stories.js +0 -51
  171. package/dist/esm/client/components/react-dev-overlay/ui/components/call-stack-frame/call-stack-frame.stories.js.map +0 -1
  172. package/dist/esm/client/components/react-dev-overlay/ui/components/code-frame/code-frame.stories.js +0 -27
  173. package/dist/esm/client/components/react-dev-overlay/ui/components/code-frame/code-frame.stories.js.map +0 -1
  174. package/dist/esm/client/components/react-dev-overlay/ui/components/errors/call-stack/call-stack.stories.js +0 -74
  175. package/dist/esm/client/components/react-dev-overlay/ui/components/errors/call-stack/call-stack.stories.js.map +0 -1
  176. package/dist/esm/client/components/react-dev-overlay/ui/components/errors/dev-tools-indicator/dev-tools-indicator.stories.js +0 -95
  177. package/dist/esm/client/components/react-dev-overlay/ui/components/errors/dev-tools-indicator/dev-tools-indicator.stories.js.map +0 -1
  178. package/dist/esm/client/components/react-dev-overlay/ui/components/errors/dev-tools-indicator/next-logo.stories.js +0 -73
  179. package/dist/esm/client/components/react-dev-overlay/ui/components/errors/dev-tools-indicator/next-logo.stories.js.map +0 -1
  180. package/dist/esm/client/components/react-dev-overlay/ui/components/errors/environment-name-label/environment-name-label.stories.js +0 -29
  181. package/dist/esm/client/components/react-dev-overlay/ui/components/errors/environment-name-label/environment-name-label.stories.js.map +0 -1
  182. package/dist/esm/client/components/react-dev-overlay/ui/components/errors/error-message/error-message.stories.js +0 -43
  183. package/dist/esm/client/components/react-dev-overlay/ui/components/errors/error-message/error-message.stories.js.map +0 -1
  184. package/dist/esm/client/components/react-dev-overlay/ui/components/errors/error-overlay-layout/error-overlay-layout.stories.js +0 -56
  185. package/dist/esm/client/components/react-dev-overlay/ui/components/errors/error-overlay-layout/error-overlay-layout.stories.js.map +0 -1
  186. package/dist/esm/client/components/react-dev-overlay/ui/components/errors/error-overlay-nav/error-overlay-nav.stories.js +0 -60
  187. package/dist/esm/client/components/react-dev-overlay/ui/components/errors/error-overlay-nav/error-overlay-nav.stories.js.map +0 -1
  188. package/dist/esm/client/components/react-dev-overlay/ui/components/errors/error-overlay-pagination/error-overlay-pagination.stories.js +0 -79
  189. package/dist/esm/client/components/react-dev-overlay/ui/components/errors/error-overlay-pagination/error-overlay-pagination.stories.js.map +0 -1
  190. package/dist/esm/client/components/react-dev-overlay/ui/components/errors/error-overlay-toolbar/copy-stack-trace-button.stories.js +0 -26
  191. package/dist/esm/client/components/react-dev-overlay/ui/components/errors/error-overlay-toolbar/copy-stack-trace-button.stories.js.map +0 -1
  192. package/dist/esm/client/components/react-dev-overlay/ui/components/errors/error-overlay-toolbar/docs-link-button.stories.js +0 -24
  193. package/dist/esm/client/components/react-dev-overlay/ui/components/errors/error-overlay-toolbar/docs-link-button.stories.js.map +0 -1
  194. package/dist/esm/client/components/react-dev-overlay/ui/components/errors/error-overlay-toolbar/error-overlay-toolbar.stories.js +0 -28
  195. package/dist/esm/client/components/react-dev-overlay/ui/components/errors/error-overlay-toolbar/error-overlay-toolbar.stories.js.map +0 -1
  196. package/dist/esm/client/components/react-dev-overlay/ui/components/errors/error-overlay-toolbar/nodejs-inspector-button.stories.js +0 -24
  197. package/dist/esm/client/components/react-dev-overlay/ui/components/errors/error-overlay-toolbar/nodejs-inspector-button.stories.js.map +0 -1
  198. package/dist/esm/client/components/react-dev-overlay/ui/components/errors/error-type-label/error-type-label.stories.js +0 -39
  199. package/dist/esm/client/components/react-dev-overlay/ui/components/errors/error-type-label/error-type-label.stories.js.map +0 -1
  200. package/dist/esm/client/components/react-dev-overlay/ui/components/terminal/terminal.stories.js +0 -24
  201. package/dist/esm/client/components/react-dev-overlay/ui/components/terminal/terminal.stories.js.map +0 -1
  202. package/dist/esm/client/components/react-dev-overlay/ui/components/version-staleness-info/version-staleness-info.stories.js +0 -85
  203. package/dist/esm/client/components/react-dev-overlay/ui/components/version-staleness-info/version-staleness-info.stories.js.map +0 -1
  204. package/dist/esm/client/components/react-dev-overlay/ui/container/build-error.stories.js +0 -29
  205. package/dist/esm/client/components/react-dev-overlay/ui/container/build-error.stories.js.map +0 -1
  206. package/dist/esm/client/components/react-dev-overlay/ui/container/errors.stories.js +0 -218
  207. package/dist/esm/client/components/react-dev-overlay/ui/container/errors.stories.js.map +0 -1
  208. package/dist/esm/client/components/react-dev-overlay/ui/container/root-layout-missing-tags-error.stories.js +0 -43
  209. package/dist/esm/client/components/react-dev-overlay/ui/container/root-layout-missing-tags-error.stories.js.map +0 -1
  210. package/dist/esm/client/components/react-dev-overlay/ui/container/runtime-error/component-stack-pseudo-html.stories.js +0 -36
  211. package/dist/esm/client/components/react-dev-overlay/ui/container/runtime-error/component-stack-pseudo-html.stories.js.map +0 -1
  212. package/dist/esm/client/components/react-dev-overlay/ui/dev-overlay.stories.js +0 -90
  213. package/dist/esm/client/components/react-dev-overlay/ui/dev-overlay.stories.js.map +0 -1
  214. package/dist/experimental/testing/server/config-testing-utils.test.d.ts +0 -1
  215. package/dist/experimental/testing/server/middleware-testing-utils.test.d.ts +0 -1
  216. package/dist/lib/batcher.test.d.ts +0 -1
  217. package/dist/lib/find-config.test.d.ts +0 -1
  218. package/dist/lib/format-server-error.test.d.ts +0 -1
  219. package/dist/lib/load-custom-routes.test.d.ts +0 -1
  220. package/dist/lib/metadata/is-metadata-route.test.d.ts +0 -1
  221. package/dist/lib/metadata/resolve-metadata.test.d.ts +0 -1
  222. package/dist/lib/metadata/resolvers/resolve-opengraph.test.d.ts +0 -1
  223. package/dist/lib/metadata/resolvers/resolve-title.test.d.ts +0 -1
  224. package/dist/lib/metadata/resolvers/resolve-url.test.d.ts +0 -1
  225. package/dist/lib/typescript/writeConfigurationDefaults.test.d.ts +0 -1
  226. package/dist/server/after/after-context.test.d.ts +0 -1
  227. package/dist/server/after/awaiter.test.d.ts +0 -1
  228. package/dist/server/app-render/action-handler.test.d.ts +0 -1
  229. package/dist/server/app-render/csrf-protection.test.d.ts +0 -1
  230. package/dist/server/app-render/postponed-state.test.d.ts +0 -1
  231. package/dist/server/app-render/types.test.d.ts +0 -1
  232. package/dist/server/base-http/web.test.d.ts +0 -1
  233. package/dist/server/config.test.d.ts +0 -1
  234. package/dist/server/dev/log-requests.test.d.ts +0 -1
  235. package/dist/server/dev/parse-version-info.test.d.ts +0 -1
  236. package/dist/server/lib/experimental/create-env-definitions.test.d.ts +0 -1
  237. package/dist/server/lib/i18n-provider.test.d.ts +0 -1
  238. package/dist/server/lib/incremental-cache/shared-revalidate-timings.test.d.ts +0 -1
  239. package/dist/server/lib/interception-routes.test.d.ts +0 -1
  240. package/dist/server/lib/mock-request.test.d.ts +0 -1
  241. package/dist/server/lib/patch-fetch.test.d.ts +0 -1
  242. package/dist/server/lib/router-utils/build-data-route.test.d.ts +0 -1
  243. package/dist/server/lib/router-utils/build-prefetch-segment-data-route.test.d.ts +0 -1
  244. package/dist/server/lib/router-utils/decode-path-params.test.d.ts +0 -1
  245. package/dist/server/lib/to-route.test.d.ts +0 -1
  246. package/dist/server/lib/utils.test.d.ts +0 -1
  247. package/dist/server/load-manifest.test.d.ts +0 -1
  248. package/dist/server/node-polyfill-crypto.test.d.ts +0 -1
  249. package/dist/server/normalizers/absolute-filename-normalizer.test.d.ts +0 -1
  250. package/dist/server/normalizers/request/base-path.test.d.ts +0 -1
  251. package/dist/server/normalizers/request/next-data.test.d.ts +0 -1
  252. package/dist/server/normalizers/request/prefetch-rsc.test.d.ts +0 -1
  253. package/dist/server/normalizers/request/prefix.test.d.ts +0 -1
  254. package/dist/server/normalizers/request/segment-prefix-rsc.test.d.ts +0 -1
  255. package/dist/server/normalizers/request/suffix.test.d.ts +0 -1
  256. package/dist/server/resume-data-cache/resume-data-cache.test.d.ts +0 -1
  257. package/dist/server/route-matcher-managers/default-route-matcher-manager.test.d.ts +0 -1
  258. package/dist/server/route-matcher-providers/app-page-route-matcher-provider.test.d.ts +0 -1
  259. package/dist/server/route-matcher-providers/app-route-route-matcher-provider.test.d.ts +0 -1
  260. package/dist/server/route-matcher-providers/dev/dev-app-page-route-matcher-provider.test.d.ts +0 -1
  261. package/dist/server/route-matcher-providers/dev/dev-app-route-route-matcher-provider.test.d.ts +0 -1
  262. package/dist/server/route-matcher-providers/dev/dev-pages-api-route-matcher-provider.test.d.ts +0 -1
  263. package/dist/server/route-matcher-providers/dev/dev-pages-route-matcher-provider.test.d.ts +0 -1
  264. package/dist/server/route-matcher-providers/dev/helpers/file-reader/batched-file-reader.test.d.ts +0 -1
  265. package/dist/server/route-matcher-providers/pages-api-route-matcher-provider.test.d.ts +0 -1
  266. package/dist/server/route-matcher-providers/pages-route-matcher-provider.test.d.ts +0 -1
  267. package/dist/server/server-utils.test.d.ts +0 -1
  268. package/dist/server/web/spec-extension/adapters/headers.test.d.ts +0 -1
  269. package/dist/server/web/spec-extension/adapters/request-cookies.test.d.ts +0 -1
  270. package/dist/server/web/utils.test.d.ts +0 -1
  271. package/dist/server/web/web-on-close.test.d.ts +0 -1
  272. package/dist/shared/lib/deep-freeze.test.d.ts +0 -1
  273. package/dist/shared/lib/get-hostname.test.d.ts +0 -1
  274. package/dist/shared/lib/normalized-asset-prefix.test.d.ts +0 -1
  275. package/dist/shared/lib/page-path/normalize-page-path.test.d.ts +0 -1
  276. package/dist/shared/lib/router/adapters.test.d.ts +0 -1
  277. package/dist/shared/lib/router/utils/app-paths.test.d.ts +0 -1
  278. package/dist/shared/lib/router/utils/is-dynamic.test.d.ts +0 -1
  279. package/dist/shared/lib/router/utils/parse-relative-url.test.d.ts +0 -1
  280. package/dist/shared/lib/router/utils/prepare-destination.test.d.ts +0 -1
  281. package/dist/shared/lib/router/utils/route-regex.test.d.ts +0 -1
  282. package/dist/shared/lib/server-reference-info.test.d.ts +0 -1
  283. package/dist/telemetry/post-telemetry-payload.test.d.ts +0 -1
  284. package/dist/trace/report/index.test.d.ts +0 -1
  285. package/dist/trace/trace.test.d.ts +0 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/export/index.ts"],"sourcesContent":["import type {\n ExportAppResult,\n ExportAppOptions,\n WorkerRenderOptsPartial,\n} from './types'\nimport { createStaticWorker, type PrerenderManifest } from '../build'\nimport type { PagesManifest } from '../build/webpack/plugins/pages-manifest-plugin'\n\nimport { bold, yellow } from '../lib/picocolors'\nimport findUp from 'next/dist/compiled/find-up'\nimport { existsSync, promises as fs } from 'fs'\n\nimport '../server/require-hook'\n\nimport { dirname, join, resolve, sep } from 'path'\nimport { formatAmpMessages } from '../build/output/index'\nimport type { AmpPageStatus } from '../build/output/index'\nimport * as Log from '../build/output/log'\nimport { RSC_SUFFIX, SSG_FALLBACK_EXPORT_ERROR } from '../lib/constants'\nimport { recursiveCopy } from '../lib/recursive-copy'\nimport {\n BUILD_ID_FILE,\n CLIENT_PUBLIC_FILES_PATH,\n CLIENT_STATIC_FILES_PATH,\n EXPORT_DETAIL,\n EXPORT_MARKER,\n NEXT_FONT_MANIFEST,\n MIDDLEWARE_MANIFEST,\n PAGES_MANIFEST,\n PHASE_EXPORT,\n PRERENDER_MANIFEST,\n SERVER_DIRECTORY,\n SERVER_REFERENCE_MANIFEST,\n APP_PATH_ROUTES_MANIFEST,\n ROUTES_MANIFEST,\n FUNCTIONS_CONFIG_MANIFEST,\n} from '../shared/lib/constants'\nimport loadConfig from '../server/config'\nimport type { ExportPathMap } from '../server/config-shared'\nimport { eventCliSession } from '../telemetry/events'\nimport { hasNextSupport } from '../server/ci-info'\nimport { Telemetry } from '../telemetry/storage'\nimport { normalizePagePath } from '../shared/lib/page-path/normalize-page-path'\nimport { denormalizePagePath } from '../shared/lib/page-path/denormalize-page-path'\nimport { loadEnvConfig } from '@next/env'\nimport { isAPIRoute } from '../lib/is-api-route'\nimport { getPagePath } from '../server/require'\nimport type { Span } from '../trace'\nimport type { MiddlewareManifest } from '../build/webpack/plugins/middleware-plugin'\nimport { isAppRouteRoute } from '../lib/is-app-route-route'\nimport { isAppPageRoute } from '../lib/is-app-page-route'\nimport isError from '../lib/is-error'\nimport { formatManifest } from '../build/manifests/formatter/format-manifest'\nimport { TurborepoAccessTraceResult } from '../build/turborepo-access-trace'\nimport { createProgress } from '../build/progress'\nimport type { DeepReadonly } from '../shared/lib/deep-readonly'\nimport { isInterceptionRouteRewrite } from '../lib/generate-interception-routes-rewrites'\nimport type { ActionManifest } from '../build/webpack/plugins/flight-client-entry-plugin'\nimport { extractInfoFromServerReferenceId } from '../shared/lib/server-reference-info'\n\nexport class ExportError extends Error {\n code = 'NEXT_EXPORT_ERROR'\n}\n\nasync function exportAppImpl(\n dir: string,\n options: Readonly<ExportAppOptions>,\n span: Span\n): Promise<ExportAppResult | null> {\n dir = resolve(dir)\n\n // attempt to load global env values so they are available in next.config.js\n span.traceChild('load-dotenv').traceFn(() => loadEnvConfig(dir, false, Log))\n\n const { enabledDirectories } = options\n\n const nextConfig =\n options.nextConfig ||\n (await span\n .traceChild('load-next-config')\n .traceAsyncFn(() => loadConfig(PHASE_EXPORT, dir)))\n\n const distDir = join(dir, nextConfig.distDir)\n const telemetry = options.buildExport ? null : new Telemetry({ distDir })\n\n if (telemetry) {\n telemetry.record(\n eventCliSession(distDir, nextConfig, {\n webpackVersion: null,\n cliCommand: 'export',\n isSrcDir: null,\n hasNowJson: !!(await findUp('now.json', { cwd: dir })),\n isCustomServer: null,\n turboFlag: false,\n pagesDir: null,\n appDir: null,\n })\n )\n }\n\n const subFolders = nextConfig.trailingSlash && !options.buildExport\n\n if (!options.silent && !options.buildExport) {\n Log.info(`using build directory: ${distDir}`)\n }\n\n const buildIdFile = join(distDir, BUILD_ID_FILE)\n\n if (!existsSync(buildIdFile)) {\n throw new ExportError(\n `Could not find a production build in the '${distDir}' directory. Try building your app with 'next build' before starting the static export. https://nextjs.org/docs/messages/next-export-no-build-id`\n )\n }\n\n const customRoutes = ['rewrites', 'redirects', 'headers'].filter(\n (config) => typeof nextConfig[config] === 'function'\n )\n\n if (!hasNextSupport && !options.buildExport && customRoutes.length > 0) {\n Log.warn(\n `rewrites, redirects, and headers are not applied when exporting your application, detected (${customRoutes.join(\n ', '\n )}). See more info here: https://nextjs.org/docs/messages/export-no-custom-routes`\n )\n }\n\n const buildId = await fs.readFile(buildIdFile, 'utf8')\n\n const pagesManifest =\n !options.pages &&\n (require(join(distDir, SERVER_DIRECTORY, PAGES_MANIFEST)) as PagesManifest)\n\n let prerenderManifest: DeepReadonly<PrerenderManifest> | undefined\n try {\n prerenderManifest = require(join(distDir, PRERENDER_MANIFEST))\n } catch {}\n\n let appRoutePathManifest: Record<string, string> | undefined\n try {\n appRoutePathManifest = require(join(distDir, APP_PATH_ROUTES_MANIFEST))\n } catch (err) {\n if (\n isError(err) &&\n (err.code === 'ENOENT' || err.code === 'MODULE_NOT_FOUND')\n ) {\n // the manifest doesn't exist which will happen when using\n // \"pages\" dir instead of \"app\" dir.\n appRoutePathManifest = undefined\n } else {\n // the manifest is malformed (invalid json)\n throw err\n }\n }\n\n const excludedPrerenderRoutes = new Set<string>()\n const pages = options.pages || Object.keys(pagesManifest)\n const defaultPathMap: ExportPathMap = {}\n\n let hasApiRoutes = false\n for (const page of pages) {\n // _document and _app are not real pages\n // _error is exported as 404.html later on\n // API Routes are Node.js functions\n\n if (isAPIRoute(page)) {\n hasApiRoutes = true\n continue\n }\n\n if (page === '/_document' || page === '/_app' || page === '/_error') {\n continue\n }\n\n // iSSG pages that are dynamic should not export templated version by\n // default. In most cases, this would never work. There is no server that\n // could run `getStaticProps`. If users make their page work lazily, they\n // can manually add it to the `exportPathMap`.\n if (prerenderManifest?.dynamicRoutes[page]) {\n excludedPrerenderRoutes.add(page)\n continue\n }\n\n defaultPathMap[page] = { page }\n }\n\n const mapAppRouteToPage = new Map<string, string>()\n if (!options.buildExport && appRoutePathManifest) {\n for (const [pageName, routePath] of Object.entries(appRoutePathManifest)) {\n mapAppRouteToPage.set(routePath, pageName)\n if (\n isAppPageRoute(pageName) &&\n !prerenderManifest?.routes[routePath] &&\n !prerenderManifest?.dynamicRoutes[routePath]\n ) {\n defaultPathMap[routePath] = {\n page: pageName,\n _isAppDir: true,\n }\n }\n }\n }\n\n // Initialize the output directory\n const outDir = options.outdir\n\n if (outDir === join(dir, 'public')) {\n throw new ExportError(\n `The 'public' directory is reserved in Next.js and can not be used as the export out directory. https://nextjs.org/docs/messages/can-not-output-to-public`\n )\n }\n\n if (outDir === join(dir, 'static')) {\n throw new ExportError(\n `The 'static' directory is reserved in Next.js and can not be used as the export out directory. https://nextjs.org/docs/messages/can-not-output-to-static`\n )\n }\n\n await fs.rm(outDir, { recursive: true, force: true })\n await fs.mkdir(join(outDir, '_next', buildId), { recursive: true })\n\n await fs.writeFile(\n join(distDir, EXPORT_DETAIL),\n formatManifest({\n version: 1,\n outDirectory: outDir,\n success: false,\n }),\n 'utf8'\n )\n\n // Copy static directory\n if (!options.buildExport && existsSync(join(dir, 'static'))) {\n if (!options.silent) {\n Log.info('Copying \"static\" directory')\n }\n await span\n .traceChild('copy-static-directory')\n .traceAsyncFn(() =>\n recursiveCopy(join(dir, 'static'), join(outDir, 'static'))\n )\n }\n\n // Copy .next/static directory\n if (\n !options.buildExport &&\n existsSync(join(distDir, CLIENT_STATIC_FILES_PATH))\n ) {\n if (!options.silent) {\n Log.info('Copying \"static build\" directory')\n }\n await span\n .traceChild('copy-next-static-directory')\n .traceAsyncFn(() =>\n recursiveCopy(\n join(distDir, CLIENT_STATIC_FILES_PATH),\n join(outDir, '_next', CLIENT_STATIC_FILES_PATH)\n )\n )\n }\n\n // Get the exportPathMap from the config file\n if (typeof nextConfig.exportPathMap !== 'function') {\n nextConfig.exportPathMap = async (defaultMap) => {\n return defaultMap\n }\n }\n\n const {\n i18n,\n images: { loader = 'default', unoptimized },\n } = nextConfig\n\n if (i18n && !options.buildExport) {\n throw new ExportError(\n `i18n support is not compatible with next export. See here for more info on deploying: https://nextjs.org/docs/messages/export-no-custom-routes`\n )\n }\n\n if (!options.buildExport) {\n const { isNextImageImported } = await span\n .traceChild('is-next-image-imported')\n .traceAsyncFn(() =>\n fs\n .readFile(join(distDir, EXPORT_MARKER), 'utf8')\n .then((text) => JSON.parse(text))\n .catch(() => ({}))\n )\n\n if (\n isNextImageImported &&\n loader === 'default' &&\n !unoptimized &&\n !hasNextSupport\n ) {\n throw new ExportError(\n `Image Optimization using the default loader is not compatible with export.\n Possible solutions:\n - Use \\`next start\\` to run a server, which includes the Image Optimization API.\n - Configure \\`images.unoptimized = true\\` in \\`next.config.js\\` to disable the Image Optimization API.\n Read more: https://nextjs.org/docs/messages/export-image-api`\n )\n }\n }\n\n let serverActionsManifest: ActionManifest | undefined\n if (enabledDirectories.app) {\n serverActionsManifest = require(\n join(distDir, SERVER_DIRECTORY, SERVER_REFERENCE_MANIFEST + '.json')\n ) as ActionManifest\n\n if (nextConfig.output === 'export') {\n const routesManifest = require(join(distDir, ROUTES_MANIFEST))\n\n // We already prevent rewrites earlier in the process, however Next.js will insert rewrites\n // for interception routes so we need to check for that here.\n if (routesManifest?.rewrites?.beforeFiles?.length > 0) {\n const hasInterceptionRouteRewrite =\n routesManifest.rewrites.beforeFiles.some(isInterceptionRouteRewrite)\n\n if (hasInterceptionRouteRewrite) {\n throw new ExportError(\n `Intercepting routes are not supported with static export.\\nRead more: https://nextjs.org/docs/app/building-your-application/deploying/static-exports#unsupported-features`\n )\n }\n }\n\n const actionIds = [\n ...Object.keys(serverActionsManifest.node),\n ...Object.keys(serverActionsManifest.edge),\n ]\n\n if (\n actionIds.some(\n (actionId) =>\n extractInfoFromServerReferenceId(actionId).type === 'server-action'\n )\n ) {\n throw new ExportError(\n `Server Actions are not supported with static export.\\nRead more: https://nextjs.org/docs/app/building-your-application/deploying/static-exports#unsupported-features`\n )\n }\n }\n }\n\n // Start the rendering process\n const renderOpts: WorkerRenderOptsPartial = {\n previewProps: prerenderManifest?.preview,\n nextExport: true,\n assetPrefix: nextConfig.assetPrefix.replace(/\\/$/, ''),\n distDir,\n dev: false,\n basePath: nextConfig.basePath,\n trailingSlash: nextConfig.trailingSlash,\n canonicalBase: nextConfig.amp?.canonicalBase || '',\n ampSkipValidation: nextConfig.experimental.amp?.skipValidation || false,\n ampOptimizerConfig: nextConfig.experimental.amp?.optimizer || undefined,\n locales: i18n?.locales,\n locale: i18n?.defaultLocale,\n defaultLocale: i18n?.defaultLocale,\n domainLocales: i18n?.domains,\n disableOptimizedLoading: nextConfig.experimental.disableOptimizedLoading,\n // Exported pages do not currently support dynamic HTML.\n supportsDynamicResponse: false,\n crossOrigin: nextConfig.crossOrigin,\n optimizeCss: nextConfig.experimental.optimizeCss,\n nextConfigOutput: nextConfig.output,\n nextScriptWorkers: nextConfig.experimental.nextScriptWorkers,\n largePageDataBytes: nextConfig.experimental.largePageDataBytes,\n serverActions: nextConfig.experimental.serverActions,\n serverComponents: enabledDirectories.app,\n cacheLifeProfiles: nextConfig.experimental.cacheLife,\n nextFontManifest: require(\n join(distDir, 'server', `${NEXT_FONT_MANIFEST}.json`)\n ),\n images: nextConfig.images,\n ...(enabledDirectories.app\n ? {\n serverActionsManifest,\n }\n : {}),\n strictNextHead: nextConfig.experimental.strictNextHead ?? true,\n deploymentId: nextConfig.deploymentId,\n experimental: {\n clientTraceMetadata: nextConfig.experimental.clientTraceMetadata,\n expireTime: nextConfig.expireTime,\n dynamicIO: nextConfig.experimental.dynamicIO ?? false,\n clientSegmentCache: nextConfig.experimental.clientSegmentCache ?? false,\n inlineCss: nextConfig.experimental.inlineCss ?? false,\n authInterrupts: !!nextConfig.experimental.authInterrupts,\n streamingMetadata: !!nextConfig.experimental.streamingMetadata,\n htmlLimitedBots: nextConfig.experimental.htmlLimitedBots,\n },\n reactMaxHeadersLength: nextConfig.reactMaxHeadersLength,\n }\n\n const { publicRuntimeConfig } = nextConfig\n\n if (Object.keys(publicRuntimeConfig).length > 0) {\n renderOpts.runtimeConfig = publicRuntimeConfig\n }\n\n // We need this for server rendering the Link component.\n ;(globalThis as any).__NEXT_DATA__ = {\n nextExport: true,\n }\n\n const exportPathMap = await span\n .traceChild('run-export-path-map')\n .traceAsyncFn(async () => {\n const exportMap = await nextConfig.exportPathMap(defaultPathMap, {\n dev: false,\n dir,\n outDir,\n distDir,\n buildId,\n })\n return exportMap\n })\n\n // only add missing 404 page when `buildExport` is false\n if (!options.buildExport) {\n // only add missing /404 if not specified in `exportPathMap`\n if (!exportPathMap['/404']) {\n exportPathMap['/404'] = { page: '/_error' }\n }\n\n /**\n * exports 404.html for backwards compat\n * E.g. GitHub Pages, GitLab Pages, Cloudflare Pages, Netlify\n */\n if (!exportPathMap['/404.html']) {\n // alias /404.html to /404 to be compatible with custom 404 / _error page\n exportPathMap['/404.html'] = exportPathMap['/404']\n }\n }\n\n // make sure to prevent duplicates\n const exportPaths = [\n ...new Set(\n Object.keys(exportPathMap).map((path) =>\n denormalizePagePath(normalizePagePath(path))\n )\n ),\n ]\n\n const filteredPaths = exportPaths.filter(\n (route) =>\n exportPathMap[route]._isAppDir ||\n // Remove API routes\n !isAPIRoute(exportPathMap[route].page)\n )\n\n if (filteredPaths.length !== exportPaths.length) {\n hasApiRoutes = true\n }\n\n if (filteredPaths.length === 0) {\n return null\n }\n\n if (prerenderManifest && !options.buildExport) {\n const fallbackEnabledPages = new Set()\n\n for (const path of Object.keys(exportPathMap)) {\n const page = exportPathMap[path].page\n const prerenderInfo = prerenderManifest.dynamicRoutes[page]\n\n if (prerenderInfo && prerenderInfo.fallback !== false) {\n fallbackEnabledPages.add(page)\n }\n }\n\n if (fallbackEnabledPages.size > 0) {\n throw new ExportError(\n `Found pages with \\`fallback\\` enabled:\\n${[\n ...fallbackEnabledPages,\n ].join('\\n')}\\n${SSG_FALLBACK_EXPORT_ERROR}\\n`\n )\n }\n }\n let hasMiddleware = false\n\n if (!options.buildExport) {\n try {\n const middlewareManifest = require(\n join(distDir, SERVER_DIRECTORY, MIDDLEWARE_MANIFEST)\n ) as MiddlewareManifest\n\n const functionsConfigManifest = require(\n join(distDir, SERVER_DIRECTORY, FUNCTIONS_CONFIG_MANIFEST)\n )\n\n hasMiddleware =\n Object.keys(middlewareManifest.middleware).length > 0 ||\n Boolean(functionsConfigManifest.functions?.['/_middleware'])\n } catch {}\n\n // Warn if the user defines a path for an API page\n if (hasApiRoutes || hasMiddleware) {\n if (nextConfig.output === 'export') {\n Log.warn(\n yellow(\n `Statically exporting a Next.js application via \\`next export\\` disables API routes and middleware.`\n ) +\n `\\n` +\n yellow(\n `This command is meant for static-only hosts, and is` +\n ' ' +\n bold(`not necessary to make your application static.`)\n ) +\n `\\n` +\n yellow(\n `Pages in your application without server-side data dependencies will be automatically statically exported by \\`next build\\`, including pages powered by \\`getStaticProps\\`.`\n ) +\n `\\n` +\n yellow(\n `Learn more: https://nextjs.org/docs/messages/api-routes-static-export`\n )\n )\n }\n }\n }\n\n const pagesDataDir = options.buildExport\n ? outDir\n : join(outDir, '_next/data', buildId)\n\n const ampValidations: AmpPageStatus = {}\n\n const publicDir = join(dir, CLIENT_PUBLIC_FILES_PATH)\n // Copy public directory\n if (!options.buildExport && existsSync(publicDir)) {\n if (!options.silent) {\n Log.info('Copying \"public\" directory')\n }\n await span.traceChild('copy-public-directory').traceAsyncFn(() =>\n recursiveCopy(publicDir, outDir, {\n filter(path) {\n // Exclude paths used by pages\n return !exportPathMap[path]\n },\n })\n )\n }\n\n const failedExportAttemptsByPage: Map<string, boolean> = new Map()\n\n // Chunk filtered pages into smaller groups, and call the export worker on each group.\n // We've set a default minimum of 25 pages per chunk to ensure that even setups\n // with only a few static pages can leverage a shared incremental cache, however this\n // value can be configured.\n const minChunkSize =\n nextConfig.experimental.staticGenerationMinPagesPerWorker ?? 25\n // Calculate the number of workers needed to ensure each chunk has at least minChunkSize pages\n const numWorkers = Math.min(\n options.numWorkers,\n Math.ceil(filteredPaths.length / minChunkSize)\n )\n // Calculate the chunk size based on the number of workers\n const chunkSize = Math.ceil(filteredPaths.length / numWorkers)\n const chunks = Array.from({ length: numWorkers }, (_, i) =>\n filteredPaths.slice(i * chunkSize, (i + 1) * chunkSize)\n )\n // Distribute remaining pages\n const remainingPages = filteredPaths.slice(numWorkers * chunkSize)\n remainingPages.forEach((page, index) => {\n chunks[index % chunks.length].push(page)\n })\n\n const progress = createProgress(\n filteredPaths.length,\n options.statusMessage || 'Exporting'\n )\n\n const worker = createStaticWorker(nextConfig, progress)\n\n const results = (\n await Promise.all(\n chunks.map((paths) =>\n worker.exportPages({\n buildId,\n paths,\n exportPathMap,\n parentSpanId: span.getId(),\n pagesDataDir,\n renderOpts,\n options,\n dir,\n distDir,\n outDir,\n nextConfig,\n cacheHandler: nextConfig.cacheHandler,\n cacheMaxMemorySize: nextConfig.cacheMaxMemorySize,\n fetchCache: true,\n fetchCacheKeyPrefix: nextConfig.experimental.fetchCacheKeyPrefix,\n })\n )\n )\n ).flat()\n\n let hadValidationError = false\n\n const collector: ExportAppResult = {\n byPath: new Map(),\n byPage: new Map(),\n ssgNotFoundPaths: new Set(),\n turborepoAccessTraceResults: new Map(),\n }\n\n for (const { result, path, pageKey } of results) {\n if (!result) continue\n if ('error' in result) {\n failedExportAttemptsByPage.set(pageKey, true)\n continue\n }\n\n const { page } = exportPathMap[path]\n\n if (result.turborepoAccessTraceResult) {\n collector.turborepoAccessTraceResults?.set(\n path,\n TurborepoAccessTraceResult.fromSerialized(\n result.turborepoAccessTraceResult\n )\n )\n }\n\n // Capture any amp validations.\n if (result.ampValidations) {\n for (const validation of result.ampValidations) {\n ampValidations[validation.page] = validation.result\n hadValidationError ||= validation.result.errors.length > 0\n }\n }\n\n if (options.buildExport) {\n // Update path info by path.\n const info = collector.byPath.get(path) ?? {}\n if (typeof result.revalidate !== 'undefined') {\n info.revalidate = result.revalidate\n }\n if (typeof result.metadata !== 'undefined') {\n info.metadata = result.metadata\n }\n\n if (typeof result.hasEmptyPrelude !== 'undefined') {\n info.hasEmptyPrelude = result.hasEmptyPrelude\n }\n\n if (typeof result.hasPostponed !== 'undefined') {\n info.hasPostponed = result.hasPostponed\n }\n\n if (typeof result.fetchMetrics !== 'undefined') {\n info.fetchMetrics = result.fetchMetrics\n }\n\n collector.byPath.set(path, info)\n\n // Update not found.\n if (result.ssgNotFound === true) {\n collector.ssgNotFoundPaths.add(path)\n }\n\n // Update durations.\n const durations = collector.byPage.get(page) ?? {\n durationsByPath: new Map<string, number>(),\n }\n durations.durationsByPath.set(path, result.duration)\n collector.byPage.set(page, durations)\n }\n }\n\n // Export mode provide static outputs that are not compatible with PPR mode.\n if (!options.buildExport && nextConfig.experimental.ppr) {\n // TODO: add message\n throw new Error('Invariant: PPR cannot be enabled in export mode')\n }\n\n // copy prerendered routes to outDir\n if (!options.buildExport && prerenderManifest) {\n await Promise.all(\n Object.keys(prerenderManifest.routes).map(async (route) => {\n const { srcRoute } = prerenderManifest!.routes[route]\n const appPageName = mapAppRouteToPage.get(srcRoute || '')\n const pageName = appPageName || srcRoute || route\n const isAppPath = Boolean(appPageName)\n const isAppRouteHandler = appPageName && isAppRouteRoute(appPageName)\n\n // returning notFound: true from getStaticProps will not\n // output html/json files during the build\n if (prerenderManifest!.notFoundRoutes.includes(route)) {\n return\n }\n route = normalizePagePath(route)\n\n const pagePath = getPagePath(pageName, distDir, undefined, isAppPath)\n const distPagesDir = join(\n pagePath,\n // strip leading / and then recurse number of nested dirs\n // to place from base folder\n pageName\n .slice(1)\n .split('/')\n .map(() => '..')\n .join('/')\n )\n\n const orig = join(distPagesDir, route)\n const handlerSrc = `${orig}.body`\n const handlerDest = join(outDir, route)\n\n if (isAppRouteHandler && existsSync(handlerSrc)) {\n await fs.mkdir(dirname(handlerDest), { recursive: true })\n await fs.copyFile(handlerSrc, handlerDest)\n return\n }\n\n const htmlDest = join(\n outDir,\n `${route}${\n subFolders && route !== '/index' ? `${sep}index` : ''\n }.html`\n )\n const ampHtmlDest = join(\n outDir,\n `${route}.amp${subFolders ? `${sep}index` : ''}.html`\n )\n const jsonDest = isAppPath\n ? join(\n outDir,\n `${route}${\n subFolders && route !== '/index' ? `${sep}index` : ''\n }.txt`\n )\n : join(pagesDataDir, `${route}.json`)\n\n await fs.mkdir(dirname(htmlDest), { recursive: true })\n await fs.mkdir(dirname(jsonDest), { recursive: true })\n\n const htmlSrc = `${orig}.html`\n const jsonSrc = `${orig}${isAppPath ? RSC_SUFFIX : '.json'}`\n\n await fs.copyFile(htmlSrc, htmlDest)\n await fs.copyFile(jsonSrc, jsonDest)\n\n if (existsSync(`${orig}.amp.html`)) {\n await fs.mkdir(dirname(ampHtmlDest), { recursive: true })\n await fs.copyFile(`${orig}.amp.html`, ampHtmlDest)\n }\n })\n )\n }\n\n if (Object.keys(ampValidations).length) {\n console.log(formatAmpMessages(ampValidations))\n }\n if (hadValidationError) {\n throw new ExportError(\n `AMP Validation caused the export to fail. https://nextjs.org/docs/messages/amp-export-validation`\n )\n }\n\n if (failedExportAttemptsByPage.size > 0) {\n const failedPages = Array.from(failedExportAttemptsByPage.keys())\n throw new ExportError(\n `Export encountered errors on following paths:\\n\\t${failedPages\n .sort()\n .join('\\n\\t')}`\n )\n }\n\n await fs.writeFile(\n join(distDir, EXPORT_DETAIL),\n formatManifest({\n version: 1,\n outDirectory: outDir,\n success: true,\n }),\n 'utf8'\n )\n\n if (telemetry) {\n await telemetry.flush()\n }\n\n await worker.end()\n\n return collector\n}\n\nexport default async function exportApp(\n dir: string,\n options: ExportAppOptions,\n span: Span\n): Promise<ExportAppResult | null> {\n const nextExportSpan = span.traceChild('next-export')\n\n return nextExportSpan.traceAsyncFn(async () => {\n return await exportAppImpl(dir, options, nextExportSpan)\n })\n}\n"],"names":["createStaticWorker","bold","yellow","findUp","existsSync","promises","fs","dirname","join","resolve","sep","formatAmpMessages","Log","RSC_SUFFIX","SSG_FALLBACK_EXPORT_ERROR","recursiveCopy","BUILD_ID_FILE","CLIENT_PUBLIC_FILES_PATH","CLIENT_STATIC_FILES_PATH","EXPORT_DETAIL","EXPORT_MARKER","NEXT_FONT_MANIFEST","MIDDLEWARE_MANIFEST","PAGES_MANIFEST","PHASE_EXPORT","PRERENDER_MANIFEST","SERVER_DIRECTORY","SERVER_REFERENCE_MANIFEST","APP_PATH_ROUTES_MANIFEST","ROUTES_MANIFEST","FUNCTIONS_CONFIG_MANIFEST","loadConfig","eventCliSession","hasNextSupport","Telemetry","normalizePagePath","denormalizePagePath","loadEnvConfig","isAPIRoute","getPagePath","isAppRouteRoute","isAppPageRoute","isError","formatManifest","TurborepoAccessTraceResult","createProgress","isInterceptionRouteRewrite","extractInfoFromServerReferenceId","ExportError","Error","code","exportAppImpl","dir","options","span","nextConfig","traceChild","traceFn","enabledDirectories","traceAsyncFn","distDir","telemetry","buildExport","record","webpackVersion","cliCommand","isSrcDir","hasNowJson","cwd","isCustomServer","turboFlag","pagesDir","appDir","subFolders","trailingSlash","silent","info","buildIdFile","customRoutes","filter","config","length","warn","buildId","readFile","pagesManifest","pages","require","prerenderManifest","appRoutePathManifest","err","undefined","excludedPrerenderRoutes","Set","Object","keys","defaultPathMap","hasApiRoutes","page","dynamicRoutes","add","mapAppRouteToPage","Map","pageName","routePath","entries","set","routes","_isAppDir","outDir","outdir","rm","recursive","force","mkdir","writeFile","version","outDirectory","success","exportPathMap","defaultMap","i18n","images","loader","unoptimized","isNextImageImported","then","text","JSON","parse","catch","serverActionsManifest","app","output","routesManifest","rewrites","beforeFiles","hasInterceptionRouteRewrite","some","actionIds","node","edge","actionId","type","renderOpts","previewProps","preview","nextExport","assetPrefix","replace","dev","basePath","canonicalBase","amp","ampSkipValidation","experimental","skipValidation","ampOptimizerConfig","optimizer","locales","locale","defaultLocale","domainLocales","domains","disableOptimizedLoading","supportsDynamicResponse","crossOrigin","optimizeCss","nextConfigOutput","nextScriptWorkers","largePageDataBytes","serverActions","serverComponents","cacheLifeProfiles","cacheLife","nextFontManifest","strictNextHead","deploymentId","clientTraceMetadata","expireTime","dynamicIO","clientSegmentCache","inlineCss","authInterrupts","streamingMetadata","htmlLimitedBots","reactMaxHeadersLength","publicRuntimeConfig","runtimeConfig","globalThis","__NEXT_DATA__","exportMap","exportPaths","map","path","filteredPaths","route","fallbackEnabledPages","prerenderInfo","fallback","size","hasMiddleware","functionsConfigManifest","middlewareManifest","middleware","Boolean","functions","pagesDataDir","ampValidations","publicDir","failedExportAttemptsByPage","minChunkSize","staticGenerationMinPagesPerWorker","numWorkers","Math","min","ceil","chunkSize","chunks","Array","from","_","i","slice","remainingPages","forEach","index","push","progress","statusMessage","worker","results","Promise","all","paths","exportPages","parentSpanId","getId","cacheHandler","cacheMaxMemorySize","fetchCache","fetchCacheKeyPrefix","flat","hadValidationError","collector","byPath","byPage","ssgNotFoundPaths","turborepoAccessTraceResults","result","pageKey","turborepoAccessTraceResult","fromSerialized","validation","errors","get","revalidate","metadata","hasEmptyPrelude","hasPostponed","fetchMetrics","ssgNotFound","durations","durationsByPath","duration","ppr","srcRoute","appPageName","isAppPath","isAppRouteHandler","notFoundRoutes","includes","pagePath","distPagesDir","split","orig","handlerSrc","handlerDest","copyFile","htmlDest","ampHtmlDest","jsonDest","htmlSrc","jsonSrc","console","log","failedPages","sort","flush","end","exportApp","nextExportSpan"],"mappings":"AAKA,SAASA,kBAAkB,QAAgC,WAAU;AAGrE,SAASC,IAAI,EAAEC,MAAM,QAAQ,oBAAmB;AAChD,OAAOC,YAAY,6BAA4B;AAC/C,SAASC,UAAU,EAAEC,YAAYC,EAAE,QAAQ,KAAI;AAE/C,OAAO,yBAAwB;AAE/B,SAASC,OAAO,EAAEC,IAAI,EAAEC,OAAO,EAAEC,GAAG,QAAQ,OAAM;AAClD,SAASC,iBAAiB,QAAQ,wBAAuB;AAEzD,YAAYC,SAAS,sBAAqB;AAC1C,SAASC,UAAU,EAAEC,yBAAyB,QAAQ,mBAAkB;AACxE,SAASC,aAAa,QAAQ,wBAAuB;AACrD,SACEC,aAAa,EACbC,wBAAwB,EACxBC,wBAAwB,EACxBC,aAAa,EACbC,aAAa,EACbC,kB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BC,IAAU;IAEV,MAAM6O,iBAAiB7O,KAAKE,UAAU,CAAC;IAEvC,OAAO2O,eAAexO,YAAY,CAAC;QACjC,OAAO,MAAMR,cAAcC,KAAKC,SAAS8O;IAC3C;AACF"}
1
+ {"version":3,"sources":["../../src/export/index.ts"],"sourcesContent":["import type {\n ExportAppResult,\n ExportAppOptions,\n WorkerRenderOptsPartial,\n} from './types'\nimport { createStaticWorker, type PrerenderManifest } from '../build'\nimport type { PagesManifest } from '../build/webpack/plugins/pages-manifest-plugin'\n\nimport { bold, yellow } from '../lib/picocolors'\nimport findUp from 'next/dist/compiled/find-up'\nimport { existsSync, promises as fs } from 'fs'\n\nimport '../server/require-hook'\n\nimport { dirname, join, resolve, sep } from 'path'\nimport { formatAmpMessages } from '../build/output/index'\nimport type { AmpPageStatus } from '../build/output/index'\nimport * as Log from '../build/output/log'\nimport { RSC_SUFFIX, SSG_FALLBACK_EXPORT_ERROR } from '../lib/constants'\nimport { recursiveCopy } from '../lib/recursive-copy'\nimport {\n BUILD_ID_FILE,\n CLIENT_PUBLIC_FILES_PATH,\n CLIENT_STATIC_FILES_PATH,\n EXPORT_DETAIL,\n EXPORT_MARKER,\n NEXT_FONT_MANIFEST,\n MIDDLEWARE_MANIFEST,\n PAGES_MANIFEST,\n PHASE_EXPORT,\n PRERENDER_MANIFEST,\n SERVER_DIRECTORY,\n SERVER_REFERENCE_MANIFEST,\n APP_PATH_ROUTES_MANIFEST,\n ROUTES_MANIFEST,\n FUNCTIONS_CONFIG_MANIFEST,\n} from '../shared/lib/constants'\nimport loadConfig from '../server/config'\nimport type { ExportPathMap } from '../server/config-shared'\nimport { eventCliSession } from '../telemetry/events'\nimport { hasNextSupport } from '../server/ci-info'\nimport { Telemetry } from '../telemetry/storage'\nimport { normalizePagePath } from '../shared/lib/page-path/normalize-page-path'\nimport { denormalizePagePath } from '../shared/lib/page-path/denormalize-page-path'\nimport { loadEnvConfig } from '@next/env'\nimport { isAPIRoute } from '../lib/is-api-route'\nimport { getPagePath } from '../server/require'\nimport type { Span } from '../trace'\nimport type { MiddlewareManifest } from '../build/webpack/plugins/middleware-plugin'\nimport { isAppRouteRoute } from '../lib/is-app-route-route'\nimport { isAppPageRoute } from '../lib/is-app-page-route'\nimport isError from '../lib/is-error'\nimport { formatManifest } from '../build/manifests/formatter/format-manifest'\nimport { TurborepoAccessTraceResult } from '../build/turborepo-access-trace'\nimport { createProgress } from '../build/progress'\nimport type { DeepReadonly } from '../shared/lib/deep-readonly'\nimport { isInterceptionRouteRewrite } from '../lib/generate-interception-routes-rewrites'\nimport type { ActionManifest } from '../build/webpack/plugins/flight-client-entry-plugin'\nimport { extractInfoFromServerReferenceId } from '../shared/lib/server-reference-info'\n\nexport class ExportError extends Error {\n code = 'NEXT_EXPORT_ERROR'\n}\n\nasync function exportAppImpl(\n dir: string,\n options: Readonly<ExportAppOptions>,\n span: Span\n): Promise<ExportAppResult | null> {\n dir = resolve(dir)\n\n // attempt to load global env values so they are available in next.config.js\n span.traceChild('load-dotenv').traceFn(() => loadEnvConfig(dir, false, Log))\n\n const { enabledDirectories } = options\n\n const nextConfig =\n options.nextConfig ||\n (await span\n .traceChild('load-next-config')\n .traceAsyncFn(() => loadConfig(PHASE_EXPORT, dir)))\n\n const distDir = join(dir, nextConfig.distDir)\n const telemetry = options.buildExport ? null : new Telemetry({ distDir })\n\n if (telemetry) {\n telemetry.record(\n eventCliSession(distDir, nextConfig, {\n webpackVersion: null,\n cliCommand: 'export',\n isSrcDir: null,\n hasNowJson: !!(await findUp('now.json', { cwd: dir })),\n isCustomServer: null,\n turboFlag: false,\n pagesDir: null,\n appDir: null,\n })\n )\n }\n\n const subFolders = nextConfig.trailingSlash && !options.buildExport\n\n if (!options.silent && !options.buildExport) {\n Log.info(`using build directory: ${distDir}`)\n }\n\n const buildIdFile = join(distDir, BUILD_ID_FILE)\n\n if (!existsSync(buildIdFile)) {\n throw new ExportError(\n `Could not find a production build in the '${distDir}' directory. Try building your app with 'next build' before starting the static export. https://nextjs.org/docs/messages/next-export-no-build-id`\n )\n }\n\n const customRoutes = ['rewrites', 'redirects', 'headers'].filter(\n (config) => typeof nextConfig[config] === 'function'\n )\n\n if (!hasNextSupport && !options.buildExport && customRoutes.length > 0) {\n Log.warn(\n `rewrites, redirects, and headers are not applied when exporting your application, detected (${customRoutes.join(\n ', '\n )}). See more info here: https://nextjs.org/docs/messages/export-no-custom-routes`\n )\n }\n\n const buildId = await fs.readFile(buildIdFile, 'utf8')\n\n const pagesManifest =\n !options.pages &&\n (require(join(distDir, SERVER_DIRECTORY, PAGES_MANIFEST)) as PagesManifest)\n\n let prerenderManifest: DeepReadonly<PrerenderManifest> | undefined\n try {\n prerenderManifest = require(join(distDir, PRERENDER_MANIFEST))\n } catch {}\n\n let appRoutePathManifest: Record<string, string> | undefined\n try {\n appRoutePathManifest = require(join(distDir, APP_PATH_ROUTES_MANIFEST))\n } catch (err) {\n if (\n isError(err) &&\n (err.code === 'ENOENT' || err.code === 'MODULE_NOT_FOUND')\n ) {\n // the manifest doesn't exist which will happen when using\n // \"pages\" dir instead of \"app\" dir.\n appRoutePathManifest = undefined\n } else {\n // the manifest is malformed (invalid json)\n throw err\n }\n }\n\n const excludedPrerenderRoutes = new Set<string>()\n const pages = options.pages || Object.keys(pagesManifest)\n const defaultPathMap: ExportPathMap = {}\n\n let hasApiRoutes = false\n for (const page of pages) {\n // _document and _app are not real pages\n // _error is exported as 404.html later on\n // API Routes are Node.js functions\n\n if (isAPIRoute(page)) {\n hasApiRoutes = true\n continue\n }\n\n if (page === '/_document' || page === '/_app' || page === '/_error') {\n continue\n }\n\n // iSSG pages that are dynamic should not export templated version by\n // default. In most cases, this would never work. There is no server that\n // could run `getStaticProps`. If users make their page work lazily, they\n // can manually add it to the `exportPathMap`.\n if (prerenderManifest?.dynamicRoutes[page]) {\n excludedPrerenderRoutes.add(page)\n continue\n }\n\n defaultPathMap[page] = { page }\n }\n\n const mapAppRouteToPage = new Map<string, string>()\n if (!options.buildExport && appRoutePathManifest) {\n for (const [pageName, routePath] of Object.entries(appRoutePathManifest)) {\n mapAppRouteToPage.set(routePath, pageName)\n if (\n isAppPageRoute(pageName) &&\n !prerenderManifest?.routes[routePath] &&\n !prerenderManifest?.dynamicRoutes[routePath]\n ) {\n defaultPathMap[routePath] = {\n page: pageName,\n _isAppDir: true,\n }\n }\n }\n }\n\n // Initialize the output directory\n const outDir = options.outdir\n\n if (outDir === join(dir, 'public')) {\n throw new ExportError(\n `The 'public' directory is reserved in Next.js and can not be used as the export out directory. https://nextjs.org/docs/messages/can-not-output-to-public`\n )\n }\n\n if (outDir === join(dir, 'static')) {\n throw new ExportError(\n `The 'static' directory is reserved in Next.js and can not be used as the export out directory. https://nextjs.org/docs/messages/can-not-output-to-static`\n )\n }\n\n await fs.rm(outDir, { recursive: true, force: true })\n await fs.mkdir(join(outDir, '_next', buildId), { recursive: true })\n\n await fs.writeFile(\n join(distDir, EXPORT_DETAIL),\n formatManifest({\n version: 1,\n outDirectory: outDir,\n success: false,\n }),\n 'utf8'\n )\n\n // Copy static directory\n if (!options.buildExport && existsSync(join(dir, 'static'))) {\n if (!options.silent) {\n Log.info('Copying \"static\" directory')\n }\n await span\n .traceChild('copy-static-directory')\n .traceAsyncFn(() =>\n recursiveCopy(join(dir, 'static'), join(outDir, 'static'))\n )\n }\n\n // Copy .next/static directory\n if (\n !options.buildExport &&\n existsSync(join(distDir, CLIENT_STATIC_FILES_PATH))\n ) {\n if (!options.silent) {\n Log.info('Copying \"static build\" directory')\n }\n await span\n .traceChild('copy-next-static-directory')\n .traceAsyncFn(() =>\n recursiveCopy(\n join(distDir, CLIENT_STATIC_FILES_PATH),\n join(outDir, '_next', CLIENT_STATIC_FILES_PATH)\n )\n )\n }\n\n // Get the exportPathMap from the config file\n if (typeof nextConfig.exportPathMap !== 'function') {\n nextConfig.exportPathMap = async (defaultMap) => {\n return defaultMap\n }\n }\n\n const {\n i18n,\n images: { loader = 'default', unoptimized },\n } = nextConfig\n\n if (i18n && !options.buildExport) {\n throw new ExportError(\n `i18n support is not compatible with next export. See here for more info on deploying: https://nextjs.org/docs/messages/export-no-custom-routes`\n )\n }\n\n if (!options.buildExport) {\n const { isNextImageImported } = await span\n .traceChild('is-next-image-imported')\n .traceAsyncFn(() =>\n fs\n .readFile(join(distDir, EXPORT_MARKER), 'utf8')\n .then((text) => JSON.parse(text))\n .catch(() => ({}))\n )\n\n if (\n isNextImageImported &&\n loader === 'default' &&\n !unoptimized &&\n !hasNextSupport\n ) {\n throw new ExportError(\n `Image Optimization using the default loader is not compatible with export.\n Possible solutions:\n - Use \\`next start\\` to run a server, which includes the Image Optimization API.\n - Configure \\`images.unoptimized = true\\` in \\`next.config.js\\` to disable the Image Optimization API.\n Read more: https://nextjs.org/docs/messages/export-image-api`\n )\n }\n }\n\n let serverActionsManifest: ActionManifest | undefined\n if (enabledDirectories.app) {\n serverActionsManifest = require(\n join(distDir, SERVER_DIRECTORY, SERVER_REFERENCE_MANIFEST + '.json')\n ) as ActionManifest\n\n if (nextConfig.output === 'export') {\n const routesManifest = require(join(distDir, ROUTES_MANIFEST))\n\n // We already prevent rewrites earlier in the process, however Next.js will insert rewrites\n // for interception routes so we need to check for that here.\n if (routesManifest?.rewrites?.beforeFiles?.length > 0) {\n const hasInterceptionRouteRewrite =\n routesManifest.rewrites.beforeFiles.some(isInterceptionRouteRewrite)\n\n if (hasInterceptionRouteRewrite) {\n throw new ExportError(\n `Intercepting routes are not supported with static export.\\nRead more: https://nextjs.org/docs/app/building-your-application/deploying/static-exports#unsupported-features`\n )\n }\n }\n\n const actionIds = [\n ...Object.keys(serverActionsManifest.node),\n ...Object.keys(serverActionsManifest.edge),\n ]\n\n if (\n actionIds.some(\n (actionId) =>\n extractInfoFromServerReferenceId(actionId).type === 'server-action'\n )\n ) {\n throw new ExportError(\n `Server Actions are not supported with static export.\\nRead more: https://nextjs.org/docs/app/building-your-application/deploying/static-exports#unsupported-features`\n )\n }\n }\n }\n\n // Start the rendering process\n const renderOpts: WorkerRenderOptsPartial = {\n previewProps: prerenderManifest?.preview,\n nextExport: true,\n assetPrefix: nextConfig.assetPrefix.replace(/\\/$/, ''),\n distDir,\n dev: false,\n basePath: nextConfig.basePath,\n trailingSlash: nextConfig.trailingSlash,\n canonicalBase: nextConfig.amp?.canonicalBase || '',\n ampSkipValidation: nextConfig.experimental.amp?.skipValidation || false,\n ampOptimizerConfig: nextConfig.experimental.amp?.optimizer || undefined,\n locales: i18n?.locales,\n locale: i18n?.defaultLocale,\n defaultLocale: i18n?.defaultLocale,\n domainLocales: i18n?.domains,\n disableOptimizedLoading: nextConfig.experimental.disableOptimizedLoading,\n // Exported pages do not currently support dynamic HTML.\n supportsDynamicResponse: false,\n crossOrigin: nextConfig.crossOrigin,\n optimizeCss: nextConfig.experimental.optimizeCss,\n nextConfigOutput: nextConfig.output,\n nextScriptWorkers: nextConfig.experimental.nextScriptWorkers,\n largePageDataBytes: nextConfig.experimental.largePageDataBytes,\n serverActions: nextConfig.experimental.serverActions,\n serverComponents: enabledDirectories.app,\n cacheLifeProfiles: nextConfig.experimental.cacheLife,\n nextFontManifest: require(\n join(distDir, 'server', `${NEXT_FONT_MANIFEST}.json`)\n ),\n images: nextConfig.images,\n ...(enabledDirectories.app\n ? {\n serverActionsManifest,\n }\n : {}),\n strictNextHead: nextConfig.experimental.strictNextHead ?? true,\n deploymentId: nextConfig.deploymentId,\n experimental: {\n clientTraceMetadata: nextConfig.experimental.clientTraceMetadata,\n expireTime: nextConfig.expireTime,\n dynamicIO: nextConfig.experimental.dynamicIO ?? false,\n clientSegmentCache: nextConfig.experimental.clientSegmentCache ?? false,\n inlineCss: nextConfig.experimental.inlineCss ?? false,\n authInterrupts: !!nextConfig.experimental.authInterrupts,\n streamingMetadata:\n // Disable streaming metadata when dynamic IO is enabled.\n // FIXME: remove dynamic IO guard once we fixed the dynamic indicator case.\n // test/e2e/app-dir/dynamic-io/dynamic-io.test.ts - should not have static indicator on not-found route\n !nextConfig.experimental.dynamicIO &&\n !!nextConfig.experimental.streamingMetadata,\n htmlLimitedBots: nextConfig.experimental.htmlLimitedBots,\n },\n reactMaxHeadersLength: nextConfig.reactMaxHeadersLength,\n }\n\n const { publicRuntimeConfig } = nextConfig\n\n if (Object.keys(publicRuntimeConfig).length > 0) {\n renderOpts.runtimeConfig = publicRuntimeConfig\n }\n\n // We need this for server rendering the Link component.\n ;(globalThis as any).__NEXT_DATA__ = {\n nextExport: true,\n }\n\n const exportPathMap = await span\n .traceChild('run-export-path-map')\n .traceAsyncFn(async () => {\n const exportMap = await nextConfig.exportPathMap(defaultPathMap, {\n dev: false,\n dir,\n outDir,\n distDir,\n buildId,\n })\n return exportMap\n })\n\n // only add missing 404 page when `buildExport` is false\n if (!options.buildExport) {\n // only add missing /404 if not specified in `exportPathMap`\n if (!exportPathMap['/404']) {\n exportPathMap['/404'] = { page: '/_error' }\n }\n\n /**\n * exports 404.html for backwards compat\n * E.g. GitHub Pages, GitLab Pages, Cloudflare Pages, Netlify\n */\n if (!exportPathMap['/404.html']) {\n // alias /404.html to /404 to be compatible with custom 404 / _error page\n exportPathMap['/404.html'] = exportPathMap['/404']\n }\n }\n\n // make sure to prevent duplicates\n const exportPaths = [\n ...new Set(\n Object.keys(exportPathMap).map((path) =>\n denormalizePagePath(normalizePagePath(path))\n )\n ),\n ]\n\n const filteredPaths = exportPaths.filter(\n (route) =>\n exportPathMap[route]._isAppDir ||\n // Remove API routes\n !isAPIRoute(exportPathMap[route].page)\n )\n\n if (filteredPaths.length !== exportPaths.length) {\n hasApiRoutes = true\n }\n\n if (filteredPaths.length === 0) {\n return null\n }\n\n if (prerenderManifest && !options.buildExport) {\n const fallbackEnabledPages = new Set()\n\n for (const path of Object.keys(exportPathMap)) {\n const page = exportPathMap[path].page\n const prerenderInfo = prerenderManifest.dynamicRoutes[page]\n\n if (prerenderInfo && prerenderInfo.fallback !== false) {\n fallbackEnabledPages.add(page)\n }\n }\n\n if (fallbackEnabledPages.size > 0) {\n throw new ExportError(\n `Found pages with \\`fallback\\` enabled:\\n${[\n ...fallbackEnabledPages,\n ].join('\\n')}\\n${SSG_FALLBACK_EXPORT_ERROR}\\n`\n )\n }\n }\n let hasMiddleware = false\n\n if (!options.buildExport) {\n try {\n const middlewareManifest = require(\n join(distDir, SERVER_DIRECTORY, MIDDLEWARE_MANIFEST)\n ) as MiddlewareManifest\n\n const functionsConfigManifest = require(\n join(distDir, SERVER_DIRECTORY, FUNCTIONS_CONFIG_MANIFEST)\n )\n\n hasMiddleware =\n Object.keys(middlewareManifest.middleware).length > 0 ||\n Boolean(functionsConfigManifest.functions?.['/_middleware'])\n } catch {}\n\n // Warn if the user defines a path for an API page\n if (hasApiRoutes || hasMiddleware) {\n if (nextConfig.output === 'export') {\n Log.warn(\n yellow(\n `Statically exporting a Next.js application via \\`next export\\` disables API routes and middleware.`\n ) +\n `\\n` +\n yellow(\n `This command is meant for static-only hosts, and is` +\n ' ' +\n bold(`not necessary to make your application static.`)\n ) +\n `\\n` +\n yellow(\n `Pages in your application without server-side data dependencies will be automatically statically exported by \\`next build\\`, including pages powered by \\`getStaticProps\\`.`\n ) +\n `\\n` +\n yellow(\n `Learn more: https://nextjs.org/docs/messages/api-routes-static-export`\n )\n )\n }\n }\n }\n\n const pagesDataDir = options.buildExport\n ? outDir\n : join(outDir, '_next/data', buildId)\n\n const ampValidations: AmpPageStatus = {}\n\n const publicDir = join(dir, CLIENT_PUBLIC_FILES_PATH)\n // Copy public directory\n if (!options.buildExport && existsSync(publicDir)) {\n if (!options.silent) {\n Log.info('Copying \"public\" directory')\n }\n await span.traceChild('copy-public-directory').traceAsyncFn(() =>\n recursiveCopy(publicDir, outDir, {\n filter(path) {\n // Exclude paths used by pages\n return !exportPathMap[path]\n },\n })\n )\n }\n\n const failedExportAttemptsByPage: Map<string, boolean> = new Map()\n\n // Chunk filtered pages into smaller groups, and call the export worker on each group.\n // We've set a default minimum of 25 pages per chunk to ensure that even setups\n // with only a few static pages can leverage a shared incremental cache, however this\n // value can be configured.\n const minChunkSize =\n nextConfig.experimental.staticGenerationMinPagesPerWorker ?? 25\n // Calculate the number of workers needed to ensure each chunk has at least minChunkSize pages\n const numWorkers = Math.min(\n options.numWorkers,\n Math.ceil(filteredPaths.length / minChunkSize)\n )\n // Calculate the chunk size based on the number of workers\n const chunkSize = Math.ceil(filteredPaths.length / numWorkers)\n const chunks = Array.from({ length: numWorkers }, (_, i) =>\n filteredPaths.slice(i * chunkSize, (i + 1) * chunkSize)\n )\n // Distribute remaining pages\n const remainingPages = filteredPaths.slice(numWorkers * chunkSize)\n remainingPages.forEach((page, index) => {\n chunks[index % chunks.length].push(page)\n })\n\n const progress = createProgress(\n filteredPaths.length,\n options.statusMessage || 'Exporting'\n )\n\n const worker = createStaticWorker(nextConfig, progress)\n\n const results = (\n await Promise.all(\n chunks.map((paths) =>\n worker.exportPages({\n buildId,\n paths,\n exportPathMap,\n parentSpanId: span.getId(),\n pagesDataDir,\n renderOpts,\n options,\n dir,\n distDir,\n outDir,\n nextConfig,\n cacheHandler: nextConfig.cacheHandler,\n cacheMaxMemorySize: nextConfig.cacheMaxMemorySize,\n fetchCache: true,\n fetchCacheKeyPrefix: nextConfig.experimental.fetchCacheKeyPrefix,\n })\n )\n )\n ).flat()\n\n let hadValidationError = false\n\n const collector: ExportAppResult = {\n byPath: new Map(),\n byPage: new Map(),\n ssgNotFoundPaths: new Set(),\n turborepoAccessTraceResults: new Map(),\n }\n\n for (const { result, path, pageKey } of results) {\n if (!result) continue\n if ('error' in result) {\n failedExportAttemptsByPage.set(pageKey, true)\n continue\n }\n\n const { page } = exportPathMap[path]\n\n if (result.turborepoAccessTraceResult) {\n collector.turborepoAccessTraceResults?.set(\n path,\n TurborepoAccessTraceResult.fromSerialized(\n result.turborepoAccessTraceResult\n )\n )\n }\n\n // Capture any amp validations.\n if (result.ampValidations) {\n for (const validation of result.ampValidations) {\n ampValidations[validation.page] = validation.result\n hadValidationError ||= validation.result.errors.length > 0\n }\n }\n\n if (options.buildExport) {\n // Update path info by path.\n const info = collector.byPath.get(path) ?? {}\n if (typeof result.revalidate !== 'undefined') {\n info.revalidate = result.revalidate\n }\n if (typeof result.metadata !== 'undefined') {\n info.metadata = result.metadata\n }\n\n if (typeof result.hasEmptyPrelude !== 'undefined') {\n info.hasEmptyPrelude = result.hasEmptyPrelude\n }\n\n if (typeof result.hasPostponed !== 'undefined') {\n info.hasPostponed = result.hasPostponed\n }\n\n if (typeof result.fetchMetrics !== 'undefined') {\n info.fetchMetrics = result.fetchMetrics\n }\n\n collector.byPath.set(path, info)\n\n // Update not found.\n if (result.ssgNotFound === true) {\n collector.ssgNotFoundPaths.add(path)\n }\n\n // Update durations.\n const durations = collector.byPage.get(page) ?? {\n durationsByPath: new Map<string, number>(),\n }\n durations.durationsByPath.set(path, result.duration)\n collector.byPage.set(page, durations)\n }\n }\n\n // Export mode provide static outputs that are not compatible with PPR mode.\n if (!options.buildExport && nextConfig.experimental.ppr) {\n // TODO: add message\n throw new Error('Invariant: PPR cannot be enabled in export mode')\n }\n\n // copy prerendered routes to outDir\n if (!options.buildExport && prerenderManifest) {\n await Promise.all(\n Object.keys(prerenderManifest.routes).map(async (route) => {\n const { srcRoute } = prerenderManifest!.routes[route]\n const appPageName = mapAppRouteToPage.get(srcRoute || '')\n const pageName = appPageName || srcRoute || route\n const isAppPath = Boolean(appPageName)\n const isAppRouteHandler = appPageName && isAppRouteRoute(appPageName)\n\n // returning notFound: true from getStaticProps will not\n // output html/json files during the build\n if (prerenderManifest!.notFoundRoutes.includes(route)) {\n return\n }\n route = normalizePagePath(route)\n\n const pagePath = getPagePath(pageName, distDir, undefined, isAppPath)\n const distPagesDir = join(\n pagePath,\n // strip leading / and then recurse number of nested dirs\n // to place from base folder\n pageName\n .slice(1)\n .split('/')\n .map(() => '..')\n .join('/')\n )\n\n const orig = join(distPagesDir, route)\n const handlerSrc = `${orig}.body`\n const handlerDest = join(outDir, route)\n\n if (isAppRouteHandler && existsSync(handlerSrc)) {\n await fs.mkdir(dirname(handlerDest), { recursive: true })\n await fs.copyFile(handlerSrc, handlerDest)\n return\n }\n\n const htmlDest = join(\n outDir,\n `${route}${\n subFolders && route !== '/index' ? `${sep}index` : ''\n }.html`\n )\n const ampHtmlDest = join(\n outDir,\n `${route}.amp${subFolders ? `${sep}index` : ''}.html`\n )\n const jsonDest = isAppPath\n ? join(\n outDir,\n `${route}${\n subFolders && route !== '/index' ? `${sep}index` : ''\n }.txt`\n )\n : join(pagesDataDir, `${route}.json`)\n\n await fs.mkdir(dirname(htmlDest), { recursive: true })\n await fs.mkdir(dirname(jsonDest), { recursive: true })\n\n const htmlSrc = `${orig}.html`\n const jsonSrc = `${orig}${isAppPath ? RSC_SUFFIX : '.json'}`\n\n await fs.copyFile(htmlSrc, htmlDest)\n await fs.copyFile(jsonSrc, jsonDest)\n\n if (existsSync(`${orig}.amp.html`)) {\n await fs.mkdir(dirname(ampHtmlDest), { recursive: true })\n await fs.copyFile(`${orig}.amp.html`, ampHtmlDest)\n }\n })\n )\n }\n\n if (Object.keys(ampValidations).length) {\n console.log(formatAmpMessages(ampValidations))\n }\n if (hadValidationError) {\n throw new ExportError(\n `AMP Validation caused the export to fail. https://nextjs.org/docs/messages/amp-export-validation`\n )\n }\n\n if (failedExportAttemptsByPage.size > 0) {\n const failedPages = Array.from(failedExportAttemptsByPage.keys())\n throw new ExportError(\n `Export encountered errors on following paths:\\n\\t${failedPages\n .sort()\n .join('\\n\\t')}`\n )\n }\n\n await fs.writeFile(\n join(distDir, EXPORT_DETAIL),\n formatManifest({\n version: 1,\n outDirectory: outDir,\n success: true,\n }),\n 'utf8'\n )\n\n if (telemetry) {\n await telemetry.flush()\n }\n\n await worker.end()\n\n return collector\n}\n\nexport default async function exportApp(\n dir: string,\n options: ExportAppOptions,\n span: Span\n): Promise<ExportAppResult | null> {\n const nextExportSpan = span.traceChild('next-export')\n\n return nextExportSpan.traceAsyncFn(async () => {\n return await exportAppImpl(dir, options, nextExportSpan)\n })\n}\n"],"names":["createStaticWorker","bold","yellow","findUp","existsSync","promises","fs","dirname","join","resolve","sep","formatAmpMessages","Log","RSC_SUFFIX","SSG_FALLBACK_EXPORT_ERROR","recursiveCopy","BUILD_ID_FILE","CLIENT_PUBLIC_FILES_PATH","CLIENT_STATIC_FILES_PATH","EXPORT_DETAIL","EXPORT_MARKER","NEXT_FONT_MANIFEST","MIDDLEWARE_MANIFEST","PAGES_MANIFEST","PHASE_EXPORT","PRERENDER_MANIFEST","SERVER_DIRECTORY","SERVER_REFERENCE_MANIFEST","APP_PATH_ROUTES_MANIFEST","ROUTES_MANIFEST","FUNCTIONS_CONFIG_MANIFEST","loadConfig","eventCliSession","hasNextSupport","Telemetry","normalizePagePath","denormalizePagePath","loadEnvConfig","isAPIRoute","getPagePath","isAppRouteRoute","isAppPageRoute","isError","formatManifest","TurborepoAccessTraceResult","createProgress","isInterceptionRouteRewrite","extractInfoFromServerReferenceId","ExportError","Error","code","exportAppImpl","dir","options","span","nextConfig","traceChild","traceFn","enabledDirectories","traceAsyncFn","distDir","telemetry","buildExport","record","webpackVersion","cliCommand","isSrcDir","hasNowJson","cwd","isCustomServer","turboFlag","pagesDir","appDir","subFolders","trailingSlash","silent","info","buildIdFile","customRoutes","filter","config","length","warn","buildId","readFile","pagesManifest","pages","require","prerenderManifest","appRoutePathManifest","err","undefined","excludedPrerenderRoutes","Set","Object","keys","defaultPathMap","hasApiRoutes","page","dynamicRoutes","add","mapAppRouteToPage","Map","pageName","routePath","entries","set","routes","_isAppDir","outDir","outdir","rm","recursive","force","mkdir","writeFile","version","outDirectory","success","exportPathMap","defaultMap","i18n","images","loader","unoptimized","isNextImageImported","then","text","JSON","parse","catch","serverActionsManifest","app","output","routesManifest","rewrites","beforeFiles","hasInterceptionRouteRewrite","some","actionIds","node","edge","actionId","type","renderOpts","previewProps","preview","nextExport","assetPrefix","replace","dev","basePath","canonicalBase","amp","ampSkipValidation","experimental","skipValidation","ampOptimizerConfig","optimizer","locales","locale","defaultLocale","domainLocales","domains","disableOptimizedLoading","supportsDynamicResponse","crossOrigin","optimizeCss","nextConfigOutput","nextScriptWorkers","largePageDataBytes","serverActions","serverComponents","cacheLifeProfiles","cacheLife","nextFontManifest","strictNextHead","deploymentId","clientTraceMetadata","expireTime","dynamicIO","clientSegmentCache","inlineCss","authInterrupts","streamingMetadata","htmlLimitedBots","reactMaxHeadersLength","publicRuntimeConfig","runtimeConfig","globalThis","__NEXT_DATA__","exportMap","exportPaths","map","path","filteredPaths","route","fallbackEnabledPages","prerenderInfo","fallback","size","hasMiddleware","functionsConfigManifest","middlewareManifest","middleware","Boolean","functions","pagesDataDir","ampValidations","publicDir","failedExportAttemptsByPage","minChunkSize","staticGenerationMinPagesPerWorker","numWorkers","Math","min","ceil","chunkSize","chunks","Array","from","_","i","slice","remainingPages","forEach","index","push","progress","statusMessage","worker","results","Promise","all","paths","exportPages","parentSpanId","getId","cacheHandler","cacheMaxMemorySize","fetchCache","fetchCacheKeyPrefix","flat","hadValidationError","collector","byPath","byPage","ssgNotFoundPaths","turborepoAccessTraceResults","result","pageKey","turborepoAccessTraceResult","fromSerialized","validation","errors","get","revalidate","metadata","hasEmptyPrelude","hasPostponed","fetchMetrics","ssgNotFound","durations","durationsByPath","duration","ppr","srcRoute","appPageName","isAppPath","isAppRouteHandler","notFoundRoutes","includes","pagePath","distPagesDir","split","orig","handlerSrc","handlerDest","copyFile","htmlDest","ampHtmlDest","jsonDest","htmlSrc","jsonSrc","console","log","failedPages","sort","flush","end","exportApp","nextExportSpan"],"mappings":"AAKA,SAASA,kBAAkB,QAAgC,WAAU;AAGrE,SAASC,IAAI,EAAEC,MAAM,QAAQ,oBAAmB;AAChD,OAAOC,YAAY,6BAA4B;AAC/C,SAASC,UAAU,EAAEC,YAAYC,EAAE,QAAQ,KAAI;AAE/C,OAAO,yBAAwB;AAE/B,SAASC,OAAO,EAAEC,IAAI,EAAEC,OAAO,EAAEC,GAAG,QAAQ,OAAM;AAClD,SAASC,iBAAiB,QAAQ,wBAAuB;AAEzD,YAAYC,SAAS,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F,GAAG6G,SAAS,CAChB3G,KAAKoD,SAASzC,gBACdwB,eAAe;QACbyE,SAAS;QACTC,cAAcR;QACdS,SAAS;IACX,IACA;IAGF,IAAIzD,WAAW;QACb,MAAMA,UAAUmO,KAAK;IACvB;IAEA,MAAM1D,OAAO2D,GAAG;IAEhB,OAAO7C;AACT;AAEA,eAAe,eAAe8C,UAC5B9O,GAAW,EACXC,OAAyB,EACzBC,IAAU;IAEV,MAAM6O,iBAAiB7O,KAAKE,UAAU,CAAC;IAEvC,OAAO2O,eAAexO,YAAY,CAAC;QACjC,OAAO,MAAMR,cAAcC,KAAKC,SAAS8O;IAC3C;AACF"}
@@ -249,8 +249,11 @@ export async function exportPages(input) {
249
249
  debugOutput: options.debugOutput,
250
250
  enableExperimentalReact: needsExperimentalReact(nextConfig),
251
251
  sriEnabled: Boolean((_nextConfig_experimental_sri = nextConfig.experimental.sri) == null ? void 0 : _nextConfig_experimental_sri.algorithm),
252
- streamingMetadata: nextConfig.experimental.streamingMetadata,
253
- buildId: input.buildId
252
+ buildId: input.buildId,
253
+ streamingMetadata: // Disable streaming metadata when dynamic IO is enabled.
254
+ // FIXME: remove dynamic IO guard once we fixed the dynamic indicator case.
255
+ // test/e2e/app-dir/dynamic-io/dynamic-io.test.ts - should not have static indicator on not-found route
256
+ !nextConfig.experimental.dynamicIO && !!nextConfig.experimental.streamingMetadata
254
257
  }),
255
258
  // If exporting the page takes longer than the timeout, reject the promise.
256
259
  new Promise((_, reject)=>{
@@ -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 // During the export phase in next build, if it's using PPR we can serve streaming metadata\n // when it's available. When we're building the PPR rendering result, we don't need to rely\n // on the user agent. The result can be determined to serve streaming on infrastructure level.\n const serveStreamingMetadata = Boolean(\n isRoutePPREnabled && input.streamingMetadata\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 serveStreamingMetadata,\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 streamingMetadata: nextConfig.experimental.streamingMetadata,\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","serveStreamingMetadata","Boolean","streamingMetadata","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","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","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,Q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,QAAQG,KAAK,CACX;QAEFH,QAAQG,KAAK,CAACJ;QACd9K,QAAQmL,IAAI,CAAC0C;IACf,OAAO;QACL9C,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 // During the export phase in next build, if it's using PPR we can serve streaming metadata\n // when it's available. When we're building the PPR rendering result, we don't need to rely\n // on the user agent. The result can be determined to serve streaming on infrastructure level.\n const serveStreamingMetadata = Boolean(\n isRoutePPREnabled && input.streamingMetadata\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 serveStreamingMetadata,\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 streamingMetadata:\n // Disable streaming metadata when dynamic IO is enabled.\n // FIXME: remove dynamic IO guard once we fixed the dynamic indicator case.\n // test/e2e/app-dir/dynamic-io/dynamic-io.test.ts - should not have static indicator on not-found route\n !nextConfig.experimental.dynamicIO &&\n !!nextConfig.experimental.streamingMetadata,\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","serveStreamingMetadata","Boolean","streamingMetadata","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","sri","algorithm","dynamicIO","_","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","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,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AAKC,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;AAEA5N,QAAQ6N,EAAE,CAAC,sBAAsB,CAAC9C;IAChC,mDAAmD;IACnD,kDAAkD;IAClD,IAAIrJ,WAAWqJ,MAAM;QACnB;IACF;IAEA,oCAAoC;IACpC,IAAIpJ,oBAAoBoJ,MAAM;QAC5B;IACF;IAEAC,QAAQG,KAAK,CAACJ;AAChB;AAEA/K,QAAQ6N,EAAE,CAAC,oBAAoB;AAC7B,sEAAsE;AACtE,qEAAqE;AACrE,6DAA6D;AAC/D;AAEA,MAAMC,qCAAqC;AAE3C9N,QAAQ6N,EAAE,CAAC,qBAAqB,CAAC9C;IAC/B,IAAIpJ,oBAAoBoJ,MAAM;QAC5BC,QAAQG,KAAK,CACX;QAEFH,QAAQG,KAAK,CAACJ;QACd/K,QAAQoL,IAAI,CAAC0C;IACf,OAAO;QACL9C,QAAQG,KAAK,CAACJ;IAChB;AACF"}
@@ -338,7 +338,10 @@ export default class Server {
338
338
  clientSegmentCache: this.nextConfig.experimental.clientSegmentCache ?? false,
339
339
  inlineCss: this.nextConfig.experimental.inlineCss ?? false,
340
340
  authInterrupts: !!this.nextConfig.experimental.authInterrupts,
341
- streamingMetadata: !!this.nextConfig.experimental.streamingMetadata,
341
+ streamingMetadata: // Disable streaming metadata when dynamic IO is enabled.
342
+ // FIXME: remove dynamic IO guard once we fixed the dynamic indicator case.
343
+ // test/e2e/app-dir/dynamic-io/dynamic-io.test.ts - should not have static indicator on not-found route
344
+ !this.nextConfig.experimental.dynamicIO && !!this.nextConfig.experimental.streamingMetadata,
342
345
  htmlLimitedBots: this.nextConfig.experimental.htmlLimitedBots
343
346
  },
344
347
  onInstrumentationRequestError: this.instrumentationOnRequestError.bind(this),
@@ -1122,21 +1125,12 @@ export default class Server {
1122
1125
  hasGetStaticPaths = true;
1123
1126
  }
1124
1127
  }
1125
- const isHtmlBot = isHtmlBotRequest(req);
1126
- if (isHtmlBot) {
1127
- this.renderOpts.serveStreamingMetadata = false;
1128
- }
1129
1128
  if (hasFallback || (staticPaths == null ? void 0 : staticPaths.includes(resolvedUrlPathname)) || // this signals revalidation in deploy environments
1130
1129
  // TODO: make this more generic
1131
1130
  req.headers['x-now-route-matches']) {
1132
1131
  isSSG = true;
1133
1132
  } else if (!this.renderOpts.dev) {
1134
1133
  isSSG ||= !!prerenderManifest.routes[toRoute(pathname)];
1135
- if (isHtmlBot) {
1136
- // When it's html limited bots request, disable SSG
1137
- // and perform the full blocking & dynamic rendering.
1138
- isSSG = false;
1139
- }
1140
1134
  }
1141
1135
  // Toggle whether or not this is a Data request
1142
1136
  const isNextDataRequest = !!(getRequestMeta(req, 'isNextDataReq') || req.headers['x-nextjs-data'] && this.serverOptions.webServerConfig) && (isSSG || hasServerProps);
@@ -1205,6 +1199,11 @@ export default class Server {
1205
1199
  // within this function; the static segment data should have already been
1206
1200
  // generated, so we will always either return a static response or a 404.
1207
1201
  const segmentPrefetchHeader = getRequestMeta(req, 'segmentPrefetchRSCRequest');
1202
+ const isHtmlBot = isHtmlBotRequest(req);
1203
+ if (isHtmlBot && isRoutePPREnabled) {
1204
+ isSSG = false;
1205
+ this.renderOpts.serveStreamingMetadata = false;
1206
+ }
1208
1207
  // we need to ensure the status code if /404 is visited directly
1209
1208
  if (is404Page && !isNextDataRequest && !isRSCRequest) {
1210
1209
  res.statusCode = 404;
@@ -1351,7 +1350,8 @@ export default class Server {
1351
1350
  // make sure to only add query values from original URL
1352
1351
  query: origQuery
1353
1352
  });
1354
- const shouldWaitOnAllReady = !supportsDynamicResponse || isHtmlBot;
1353
+ const shouldWaitOnAllReady = !supportsDynamicResponse || // When html bots request PPR page, perform the full dynamic rendering.
1354
+ isHtmlBot && isRoutePPREnabled;
1355
1355
  const renderOpts = {
1356
1356
  ...components,
1357
1357
  ...opts,