@wular/coder 0.3.18 → 0.4.1

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.
Files changed (473) hide show
  1. package/README.md +18 -16
  2. package/bin/coder.mjs +3 -1
  3. package/dist/actions-Mk3FSlpJ.js +20 -0
  4. package/dist/adapter-B0oYCI0S.js +1 -0
  5. package/dist/adapter-BKVzTDnn.js +1 -0
  6. package/dist/adapter-DPInwbJG.js +1 -0
  7. package/dist/adapter-DaiJMOYo.js +1 -0
  8. package/dist/adapter-PeKziOUg.js +1 -0
  9. package/dist/add-BxpLHnvD.js +1 -0
  10. package/dist/add-CE-70LFs.js +1 -0
  11. package/dist/add-U-pty9qJ.js +6 -0
  12. package/dist/add-ej0X9e3a.js +1 -0
  13. package/dist/add-json-CEa-6luW.js +1 -0
  14. package/dist/agent-BsYx3Odz.js +3 -0
  15. package/dist/agent-JdtZozvP.js +1 -0
  16. package/dist/alias-DX-Bm86x.js +2 -0
  17. package/dist/app-BT5f7zL5.js +1 -0
  18. package/dist/approvals-C-AvFt6s.js +2 -0
  19. package/dist/approve-DOmpQRNd.js +2 -0
  20. package/dist/apps-CjfrZyM5.js +1 -0
  21. package/dist/archive-BUB8gFKD.js +4 -0
  22. package/dist/archive-BziJ1rQ-.js +3 -0
  23. package/dist/archive-sweep-CtBcARgN.js +1 -0
  24. package/dist/args-BOEEdpWk.js +1 -0
  25. package/dist/ask-dE3U3ss2.js +4 -0
  26. package/dist/auth-BFny--17.js +1 -0
  27. package/dist/auth-DWHIzqbA.js +1 -0
  28. package/dist/builtin/coder/agent.json +24 -0
  29. package/dist/builtin/coder/system.md +17 -0
  30. package/dist/chat-3Znsevah.js +1 -0
  31. package/dist/chat-B_yhNTo0.js +13 -0
  32. package/dist/chat-bridge-BS9WtP3X.js +2 -0
  33. package/dist/cli-BilSDkvE.js +9 -0
  34. package/dist/cli.d.ts +71 -1
  35. package/dist/cli.js +1 -91
  36. package/dist/client-D9IoAuDD.js +1 -0
  37. package/dist/config-Da_cwoxI.js +3 -0
  38. package/dist/create-C_iMJV4Y.js +1 -0
  39. package/dist/credentials-B1jv6dkg.js +1 -0
  40. package/dist/dash/manifest.json +3427 -0
  41. package/dist/dash/public/assets/apple-touch-icon.png +0 -0
  42. package/dist/dash/public/assets/chunks/agent-pills-c9c4ac4d4a10df83.js +1 -0
  43. package/dist/dash/public/assets/chunks/agent-settings-form-8be2ddab074aba6d.js +1 -0
  44. package/dist/dash/public/assets/chunks/agents-grid-951584b6f4c4314e.js +1 -0
  45. package/dist/dash/public/assets/chunks/badge-676b01e0c615bf7b.js +1 -0
  46. package/dist/dash/public/assets/chunks/card-e0901d68b79dfa93.js +1 -0
  47. package/dist/dash/public/assets/chunks/combo-41234c24668b1db1.js +1 -0
  48. package/dist/dash/public/assets/chunks/composer-5534be50bc12385e.js +1 -0
  49. package/dist/dash/public/assets/chunks/composer-d10d4b1d54c4f751.js +1 -0
  50. package/dist/dash/public/assets/chunks/composer-data-6f7608fed13f3dd7.js +1 -0
  51. package/dist/dash/public/assets/chunks/confirm-f2fe4ba9905a89c6.js +1 -0
  52. package/dist/dash/public/assets/chunks/connect-apps-aa2a3d82e48ed8c3.js +1 -0
  53. package/dist/dash/public/assets/chunks/connect-repositories-5389ec8701a3deac.js +1 -0
  54. package/dist/dash/public/assets/chunks/credentials-list-bc5bfcab058176c5.js +2 -0
  55. package/dist/dash/public/assets/chunks/custom-range-4761ab14f05149df.js +1 -0
  56. package/dist/dash/public/assets/chunks/editor-bfe8cd854f8001be.js +7 -0
  57. package/dist/dash/public/assets/chunks/engines-list-f1191390f5715b39.js +1 -0
  58. package/dist/dash/public/assets/chunks/field-901f1f35c18c39c9.js +1 -0
  59. package/dist/dash/public/assets/chunks/format-eb03fc9d9744d960.js +1 -0
  60. package/dist/dash/public/assets/chunks/heads-f3bcd289663d48fa.js +1 -0
  61. package/dist/dash/public/assets/chunks/instructions-052fa45a9daf6db6.js +2 -0
  62. package/dist/dash/public/assets/chunks/instructions-d0a4b0d95009c262.js +1 -0
  63. package/dist/dash/public/assets/chunks/list-1d259660d7612c5f.js +1 -0
  64. package/dist/dash/public/assets/chunks/mcp-list-e3bebbbe831393b8.js +1 -0
  65. package/dist/dash/public/assets/chunks/model-options-15c53331a2f28a4f.js +1 -0
  66. package/dist/dash/public/assets/chunks/models-list-44f857a469ca04d5.js +1 -0
  67. package/dist/dash/public/assets/chunks/paged-bc6fa0c2b9d52ed7.js +1 -0
  68. package/dist/dash/public/assets/chunks/platform-actions-d1426602049926d2.js +1 -0
  69. package/dist/dash/public/assets/chunks/runners-list-1901af8a5dea1f09.js +1 -0
  70. package/dist/dash/public/assets/chunks/runtime-246221e985d863e5-1.js +2 -0
  71. package/dist/dash/public/assets/chunks/segmented-358ff2b4992b8384.js +1 -0
  72. package/dist/dash/public/assets/chunks/select-7ae25fd8a7d6c338.js +1 -0
  73. package/dist/dash/public/assets/chunks/sentinel-c972a33dc69a5135.js +1 -0
  74. package/dist/dash/public/assets/chunks/shared-init-246221e985d863e5-2.js +1 -0
  75. package/dist/dash/public/assets/chunks/shared-init-88cce66bb3cfe1e5.js +5 -0
  76. package/dist/dash/public/assets/chunks/shared-init-8f2ac936c95a7f7b.js +1 -0
  77. package/dist/dash/public/assets/chunks/shared-init-ffb3397e494137c9.js +2 -0
  78. package/dist/dash/public/assets/chunks/tail-7c27aab8ba268bd9.js +1 -0
  79. package/dist/dash/public/assets/chunks/task-actions-8e1d93c788d001df.js +1 -0
  80. package/dist/dash/public/assets/chunks/task-fa8b82e95e771c4a.js +1 -0
  81. package/dist/dash/public/assets/chunks/task-view-6d7618d2820a5cb4.js +3 -0
  82. package/dist/dash/public/assets/chunks/tasks-list-f4784e5cbd0ed785.js +1 -0
  83. package/dist/dash/public/assets/chunks/toolbar-a75d2570f07cbb70.js +1 -0
  84. package/dist/dash/public/assets/chunks/versions-list-fc2e0d2a7382e049.js +1 -0
  85. package/dist/dash/public/assets/chunks/wular-pnext-246221e985d863e5-0.js +1 -0
  86. package/dist/dash/public/assets/connect-382b1729a7ae7808.css +1 -0
  87. package/dist/dash/public/assets/dash-9e02d5d1a6d42ee3.css +1 -0
  88. package/dist/dash/public/assets/dash-account-04859899c1838ada.css +1 -0
  89. package/dist/dash/public/assets/dash-agents-9e678137267dec07.css +1 -0
  90. package/dist/dash/public/assets/dash-agents-new-26fa27b17ef9b8d8.css +1 -0
  91. package/dist/dash/public/assets/dash-agents-param-slug-b975c48f8abf3444.css +1 -0
  92. package/dist/dash/public/assets/dash-agents-param-slug-edit-e13fda599bb04843.css +1 -0
  93. package/dist/dash/public/assets/dash-agents-param-slug-platforms-70292932cb27bc96.css +1 -0
  94. package/dist/dash/public/assets/dash-agents-param-slug-settings-71f9a86251723fcc.css +1 -0
  95. package/dist/dash/public/assets/dash-agents-param-slug-tasks-fb8eb2ed71006601.css +1 -0
  96. package/dist/dash/public/assets/dash-agents-param-slug-usage-7c8740f1cdd52c71.css +1 -0
  97. package/dist/dash/public/assets/dash-settings-8eb818da462227e8.css +1 -0
  98. package/dist/dash/public/assets/dash-settings-param-tab-849a1a9542e273f5.css +1 -0
  99. package/dist/dash/public/assets/dash-tasks-81e510e0b6931b42.css +1 -0
  100. package/dist/dash/public/assets/dash-tasks-param-id-bbd2a83342f2ec10.css +1 -0
  101. package/dist/dash/public/assets/dash-usage-8e0259e03eaed1bd.css +1 -0
  102. package/dist/dash/public/assets/favicon.ico +0 -0
  103. package/dist/dash/public/assets/favicon.svg +1 -0
  104. package/dist/dash/public/assets/fonts/LICENSE-fira-code +93 -0
  105. package/dist/dash/public/assets/fonts/fira-code-latin-400-normal-717ee080.woff2 +0 -0
  106. package/dist/dash/public/assets/fonts/fira-code-latin-500-normal-530b6706.woff2 +0 -0
  107. package/dist/dash/public/assets/fonts/fira-code-latin-700-normal-98730669.woff2 +0 -0
  108. package/dist/dash/public/assets/global-d2adbf01910d9df5.css +1 -0
  109. package/dist/dash/public/assets/login-c129b1ce237be260.css +1 -0
  110. package/dist/dash/public/assets/pnext-client-03b03b254e525e82.js +1 -0
  111. package/dist/dash/public/assets/pnext-client-1b9ab0963a8ff77b.js +1 -0
  112. package/dist/dash/public/assets/pnext-client-1c7859bb888f4ef0.js +1 -0
  113. package/dist/dash/public/assets/pnext-client-3c748afe963fb05d.js +1 -0
  114. package/dist/dash/public/assets/pnext-client-4f47c2cae220f107.js +1 -0
  115. package/dist/dash/public/assets/pnext-client-6ab9fd9b53b794d2.js +1 -0
  116. package/dist/dash/public/assets/pnext-client-6c241786342498e4.js +1 -0
  117. package/dist/dash/public/assets/pnext-client-80b56d420f02b808.js +1 -0
  118. package/dist/dash/public/assets/pnext-client-83135c17bae850a3.js +1 -0
  119. package/dist/dash/public/assets/pnext-client-8e6fa4302ae0396f.js +1 -0
  120. package/dist/dash/public/assets/pnext-client-932c9d8cc0717fc8.js +1 -0
  121. package/dist/dash/public/assets/pnext-client-a42ae63d4de113f9.js +1 -0
  122. package/dist/dash/public/assets/pnext-client-d2ee6f8c1e337032.js +1 -0
  123. package/dist/dash/public/assets/pnext-client-d513f65ec23b7f20.js +1 -0
  124. package/dist/dash/public/assets/pnext-client-ecb88e2a8a109954.js +1 -0
  125. package/dist/dash/public/assets/pnext-client-f1545ee6270bbf9a.js +1 -0
  126. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/boot-B2MFTRO2.js +30 -0
  127. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/build-tier-XJJSL5FR.js +2704 -0
  128. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-2HFY3DQT.js +208 -0
  129. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-2ICEVELW.js +834 -0
  130. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-3UPROT2C.js +35 -0
  131. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-4P5CMIYT.js +1582 -0
  132. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-4TKZKZ3Q.js +131 -0
  133. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-5RDEILQB.js +437 -0
  134. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-62KEQM43.js +25 -0
  135. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-6KQSWT6D.js +831 -0
  136. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-7DCNCW6O.js +724 -0
  137. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-B4THCTQP.js +22 -0
  138. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-C2LIV2MM.js +172 -0
  139. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-CCATPVTW.js +378 -0
  140. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-COXJAPTU.js +89 -0
  141. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-E6IXL2NJ.js +6270 -0
  142. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-FLGRBFAH.js +1198 -0
  143. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-FTJVHFWD.js +61 -0
  144. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-H523KSIH.js +5151 -0
  145. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-HT6KKX6A.js +20 -0
  146. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-JESFYECC.js +438 -0
  147. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-JRPJM2XY.js +17 -0
  148. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-L2IWDUXG.js +107 -0
  149. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-L5P4Y4UC.js +183 -0
  150. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-NQE46AZN.js +647 -0
  151. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-PA4QEARJ.js +129 -0
  152. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-PZ5AXOLW.js +7146 -0
  153. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-SNVPTULL.js +2397 -0
  154. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-T3QZT3PG.js +220 -0
  155. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-VC5O2SDP.js +72 -0
  156. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-WZX4V6CM.js +231 -0
  157. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-XUUIDXY5.js +627 -0
  158. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-ZHFDO3PR.js +265 -0
  159. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/compile-CE2DN7ZA.js +18 -0
  160. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/config-UREY7XJT.js +16 -0
  161. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/config-loader-UI2XE3PZ.js +17 -0
  162. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/entry.js +219 -0
  163. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/generate-I2PPTDFD.js +16 -0
  164. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/modules-UVOCE4C2.js +48 -0
  165. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/pipeline-UW47K537.js +963 -0
  166. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/proxy-ITGOVJBW.js +26 -0
  167. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/register-4SA55SWT.js +12579 -0
  168. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/router-JNKHLBCZ.js +505 -0
  169. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/routes-PD6J2NXW.js +54 -0
  170. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/tsconfig-defaults-ZXEH7RQK.js +15 -0
  171. package/dist/default-Bobztoxf.js +1 -0
  172. package/dist/default-vYPT26DR.js +1 -0
  173. package/dist/delete-D8gEwoOj.js +4 -0
  174. package/dist/delete-z1_86nf6.js +2 -0
  175. package/dist/disable-DVKd-0Xb.js +1 -0
  176. package/dist/discover-Df-a8K4R.js +3 -0
  177. package/dist/discover-Dvr_3_Xr.js +1 -0
  178. package/dist/dispatch-BKeAch9E.js +14 -0
  179. package/dist/docs-BX65z2Iu.js +2 -0
  180. package/dist/docs-DKJnqZqt.js +2 -0
  181. package/dist/enable-C8Zf_wpN.js +1 -0
  182. package/dist/env-CRf6wkM2.js +1 -0
  183. package/dist/exec-RZFLclKX.js +11 -0
  184. package/dist/executor-BvAA7Cgw.js +10 -0
  185. package/dist/flow/builtin/review.d.ts +157 -0
  186. package/dist/flow/builtin/review.js +19 -0
  187. package/dist/flow/index.d.ts +1 -1
  188. package/dist/flow/index.js +1 -1
  189. package/dist/flow-17k25MHt.js +1 -0
  190. package/dist/github-actions-DwUzm4hC.js +24 -0
  191. package/dist/http-Bkg_OQ6r.js +1 -0
  192. package/dist/{index-BQ-b77or.d.ts → index-CZjFX5zV.d.ts} +116 -238
  193. package/dist/init-CoMfFxbG.js +1 -0
  194. package/dist/integrations-5xCaXSd-.js +1 -0
  195. package/dist/integrations-BAgdVDhj.js +5 -0
  196. package/dist/lib/broker.js +3 -3
  197. package/dist/list-BAKvxSbh.js +4 -0
  198. package/dist/list-BYiG8Zav.js +2 -0
  199. package/dist/list-BxEywhHU.js +1 -0
  200. package/dist/list-C5w01-8q.js +1 -0
  201. package/dist/list-CIW2joV1.js +1 -0
  202. package/dist/list-DX-z3SBp.js +3 -0
  203. package/dist/list-DpCf4G-H.js +4 -0
  204. package/dist/list-VToARh3C.js +1 -0
  205. package/dist/load-BpEsAn51.js +2 -0
  206. package/dist/local-H3uvqEbq.js +1 -0
  207. package/dist/log-view-dg0TlKLA.js +1 -0
  208. package/dist/login-BFxX4jJy.js +1 -0
  209. package/dist/login-DkkslfBx.js +1 -0
  210. package/dist/logout-BHAtw4Z8.js +1 -0
  211. package/dist/maintenance-C5FklUw3.js +1 -0
  212. package/dist/match-CXAjDhg7.js +1 -0
  213. package/dist/mcp-BgKb2Cdk.js +1 -0
  214. package/dist/mcp-CCZOAo06.js +1 -0
  215. package/dist/mcp-server-DGzme0YX.js +1 -0
  216. package/dist/migrate-C4vM7DQN.js +2 -0
  217. package/dist/migrate-N-85_N7J.js +1 -0
  218. package/dist/model-Bs1StDo3.js +1 -0
  219. package/dist/models-_5LVGC3m.js +1 -0
  220. package/dist/output-BKeyLbvt.js +5 -0
  221. package/dist/prompt-CEuBMNhk.js +7 -0
  222. package/dist/push-CUC55Bqd.js +1 -0
  223. package/dist/queue-6io_NOP3.js +116 -0
  224. package/dist/refresh-BIrmrWYq.js +1 -0
  225. package/dist/remote-miQNTVRa.js +1 -0
  226. package/dist/remove-B93LNkZI.js +1 -0
  227. package/dist/remove-C5_xggx7.js +1 -0
  228. package/dist/remove-CuH8a3L9.js +1 -0
  229. package/dist/remove-eQ8y5C5p.js +1 -0
  230. package/dist/rename-CYfy03FE.js +1 -0
  231. package/dist/result-BEtQZHaY.js +5 -0
  232. package/dist/result-BzaM3inj.js +15 -0
  233. package/dist/resume-DYzKvyEw.js +3 -0
  234. package/dist/review-oIBeECZE.js +7 -0
  235. package/dist/rolldown-runtime-DT7IzrpZ.js +1 -0
  236. package/dist/rotate-key-IdMYH7gg.js +1 -0
  237. package/dist/run-BDYl0CKl.js +2 -0
  238. package/dist/run-CTtd0Znc.js +5 -0
  239. package/dist/run-CawRGnOg.js +2 -0
  240. package/dist/runner-D7ScbIHJ.js +1 -0
  241. package/dist/runner-sUpWJ_k0.js +1 -0
  242. package/dist/schema-CU2iFkp8.js +1 -0
  243. package/dist/sdk.d.ts +1166 -191
  244. package/dist/sdk.js +1 -1
  245. package/dist/serve-BTeomYxW.js +1 -0
  246. package/dist/serve-CE8YV2e9.js +1 -0
  247. package/dist/serve-CPnmrKyf.js +2 -0
  248. package/dist/serve-CQKZxzFE.js +4 -0
  249. package/dist/serve-GmRO89s5.js +12 -0
  250. package/dist/server-Kb22cWfF.js +1 -0
  251. package/dist/setup-host-GFTUzzZJ.js +6 -0
  252. package/dist/shared-DVtzWhUT.js +1 -0
  253. package/dist/show-CMUg8SJu.js +1 -0
  254. package/dist/show-COTZEYgc.js +1 -0
  255. package/dist/status-D26U--p8.js +1 -0
  256. package/dist/steer-C6uARLp5.js +4 -0
  257. package/dist/stop-BrGI3hSS.js +1 -0
  258. package/dist/stop-ByCAlbmN.js +3 -0
  259. package/dist/store-B94tSate.js +42 -0
  260. package/dist/store-DzqXS2wT.js +8 -0
  261. package/dist/task-C6VAg5WU.js +1 -0
  262. package/dist/task-CgOKgkEG.js +1 -0
  263. package/dist/task-DeglY79z.js +5 -0
  264. package/dist/test-NEbhlxvo.js +1 -0
  265. package/dist/tools-D0Zfs8Hx.js +1 -0
  266. package/dist/types-D0q15RJa.js +1 -0
  267. package/dist/types-I5Cwtl_K.d.ts +389 -0
  268. package/dist/unalias-C9NqmSDq.js +1 -0
  269. package/dist/update-BTxYQj7Z.js +2 -0
  270. package/dist/upgrade-hA0yWBvx.js +2 -0
  271. package/dist/usage-BhqoCjvE.js +1 -0
  272. package/dist/usage-C4d9X2Uq.js +1 -0
  273. package/dist/watch-CSdj24ct.js +5 -0
  274. package/dist/watch-DtRuC0Wc.js +8 -0
  275. package/dist/wire-BeT1Axeo.js +1 -0
  276. package/dist/worker-CXndxmGF.js +9 -0
  277. package/dist/worker-DX7P9kWl.js +1 -0
  278. package/dist/workflow-Dcmdooi8.js +1 -0
  279. package/docs/agents/coder.md +26 -0
  280. package/docs/agents/index.md +120 -0
  281. package/docs/config.md +51 -30
  282. package/docs/dash.md +64 -0
  283. package/docs/flows.md +20 -15
  284. package/docs/mcp.md +62 -0
  285. package/docs/models.md +41 -23
  286. package/docs/review.md +41 -0
  287. package/docs/sdk.md +57 -38
  288. package/docs/self-host.md +188 -0
  289. package/migrations/0000_initial.sql +252 -0
  290. package/migrations/meta/0000_snapshot.json +1787 -0
  291. package/migrations/meta/_journal.json +13 -0
  292. package/package.json +37 -7
  293. package/plugins/agents/skills/coder/SKILL.md +14 -60
  294. package/plugins/claude/.claude-plugin/plugin.json +1 -1
  295. package/plugins/claude/commands/setup.md +2 -2
  296. package/plugins/claude/skills/dispatch/SKILL.md +14 -58
  297. package/plugins/cursor/.cursor-plugin/plugin.json +1 -1
  298. package/plugins/cursor/README.md +5 -5
  299. package/plugins/cursor/assets/logo.png +0 -0
  300. package/plugins/cursor/skills/coder/SKILL.md +14 -59
  301. package/src/client/index.ts +573 -0
  302. package/src/client/types.ts +506 -0
  303. package/src/core/errors.ts +72 -0
  304. package/src/core/task/log-view.ts +173 -0
  305. package/src/server/auth/sign-in.ts +14 -0
  306. package/src/server/dash/api/load.ts +62 -0
  307. package/src/server/dash/api/types.ts +11 -0
  308. package/src/server/dash/app/connect/page.tsx +42 -0
  309. package/src/server/dash/app/dash/account/loading.tsx +11 -0
  310. package/src/server/dash/app/dash/account/notify.tsx +42 -0
  311. package/src/server/dash/app/dash/account/page.css +81 -0
  312. package/src/server/dash/app/dash/account/page.tsx +126 -0
  313. package/src/server/dash/app/dash/account/sign-out.tsx +24 -0
  314. package/src/server/dash/app/dash/agents/(list)/agent-menu.tsx +10 -0
  315. package/src/server/dash/app/dash/agents/(list)/agents-grid.tsx +143 -0
  316. package/src/server/dash/app/dash/agents/(list)/connect-apps.tsx +46 -0
  317. package/src/server/dash/app/dash/agents/(list)/loading.tsx +14 -0
  318. package/src/server/dash/app/dash/agents/(list)/page.css +72 -0
  319. package/src/server/dash/app/dash/agents/(list)/page.tsx +89 -0
  320. package/src/server/dash/app/dash/agents/[slug]/(tabs)/layout.tsx +135 -0
  321. package/src/server/dash/app/dash/agents/[slug]/(tabs)/loading.tsx +5 -0
  322. package/src/server/dash/app/dash/agents/[slug]/(tabs)/page.css +21 -0
  323. package/src/server/dash/app/dash/agents/[slug]/(tabs)/page.tsx +173 -0
  324. package/src/server/dash/app/dash/agents/[slug]/(tabs)/platforms/loading.tsx +18 -0
  325. package/src/server/dash/app/dash/agents/[slug]/(tabs)/platforms/page.css +87 -0
  326. package/src/server/dash/app/dash/agents/[slug]/(tabs)/platforms/page.tsx +258 -0
  327. package/src/server/dash/app/dash/agents/[slug]/(tabs)/platforms/platform-actions.tsx +111 -0
  328. package/src/server/dash/app/dash/agents/[slug]/(tabs)/settings/agent-settings-form.css +114 -0
  329. package/src/server/dash/app/dash/agents/[slug]/(tabs)/settings/agent-settings-form.tsx +294 -0
  330. package/src/server/dash/app/dash/agents/[slug]/(tabs)/settings/loading.tsx +5 -0
  331. package/src/server/dash/app/dash/agents/[slug]/(tabs)/settings/page.tsx +54 -0
  332. package/src/server/dash/app/dash/agents/[slug]/(tabs)/tasks/loading.tsx +5 -0
  333. package/src/server/dash/app/dash/agents/[slug]/(tabs)/tasks/page.tsx +14 -0
  334. package/src/server/dash/app/dash/agents/[slug]/(tabs)/usage/loading.tsx +31 -0
  335. package/src/server/dash/app/dash/agents/[slug]/(tabs)/usage/page.css +12 -0
  336. package/src/server/dash/app/dash/agents/[slug]/(tabs)/usage/page.tsx +163 -0
  337. package/src/server/dash/app/dash/agents/[slug]/(tabs)/versions-list.tsx +53 -0
  338. package/src/server/dash/app/dash/agents/[slug]/edit/loading.tsx +31 -0
  339. package/src/server/dash/app/dash/agents/[slug]/edit/page.tsx +91 -0
  340. package/src/server/dash/app/dash/agents/agent/agent-pills.css +27 -0
  341. package/src/server/dash/app/dash/agents/agent/agent-pills.tsx +133 -0
  342. package/src/server/dash/app/dash/agents/agent/hero.css +40 -0
  343. package/src/server/dash/app/dash/agents/agent/hero.tsx +60 -0
  344. package/src/server/dash/app/dash/agents/agent/instructions.css +29 -0
  345. package/src/server/dash/app/dash/agents/agent/instructions.tsx +82 -0
  346. package/src/server/dash/app/dash/agents/editor/connect-repositories.ts +16 -0
  347. package/src/server/dash/app/dash/agents/editor/editor.css +263 -0
  348. package/src/server/dash/app/dash/agents/editor/editor.tsx +774 -0
  349. package/src/server/dash/app/dash/agents/editor/import-picker.css +48 -0
  350. package/src/server/dash/app/dash/agents/editor/import-picker.tsx +253 -0
  351. package/src/server/dash/app/dash/agents/editor/names.ts +35 -0
  352. package/src/server/dash/app/dash/agents/new/loading.tsx +25 -0
  353. package/src/server/dash/app/dash/agents/new/page.tsx +72 -0
  354. package/src/server/dash/app/dash/layout.css +265 -0
  355. package/src/server/dash/app/dash/layout.tsx +332 -0
  356. package/src/server/dash/app/dash/page.tsx +14 -0
  357. package/src/server/dash/app/dash/settings/[tab]/credentials-list.css +94 -0
  358. package/src/server/dash/app/dash/settings/[tab]/credentials-list.tsx +619 -0
  359. package/src/server/dash/app/dash/settings/[tab]/credentials.tsx +36 -0
  360. package/src/server/dash/app/dash/settings/[tab]/engines-list.css +16 -0
  361. package/src/server/dash/app/dash/settings/[tab]/engines-list.tsx +135 -0
  362. package/src/server/dash/app/dash/settings/[tab]/list.css +98 -0
  363. package/src/server/dash/app/dash/settings/[tab]/list.tsx +215 -0
  364. package/src/server/dash/app/dash/settings/[tab]/loading.tsx +6 -0
  365. package/src/server/dash/app/dash/settings/[tab]/mcp-list.css +43 -0
  366. package/src/server/dash/app/dash/settings/[tab]/mcp-list.tsx +290 -0
  367. package/src/server/dash/app/dash/settings/[tab]/models-list.tsx +513 -0
  368. package/src/server/dash/app/dash/settings/[tab]/page.tsx +89 -0
  369. package/src/server/dash/app/dash/settings/[tab]/runners-list.css +153 -0
  370. package/src/server/dash/app/dash/settings/[tab]/runners-list.tsx +457 -0
  371. package/src/server/dash/app/dash/settings/layout.tsx +50 -0
  372. package/src/server/dash/app/dash/settings/model-options.ts +117 -0
  373. package/src/server/dash/app/dash/settings/page.tsx +7 -0
  374. package/src/server/dash/app/dash/settings/settings-head.tsx +24 -0
  375. package/src/server/dash/app/dash/settings/tunnel-guide.tsx +28 -0
  376. package/src/server/dash/app/dash/tasks/[id]/activity.tsx +202 -0
  377. package/src/server/dash/app/dash/tasks/[id]/loading.tsx +31 -0
  378. package/src/server/dash/app/dash/tasks/[id]/page.tsx +30 -0
  379. package/src/server/dash/app/dash/tasks/[id]/task-actions.tsx +164 -0
  380. package/src/server/dash/app/dash/tasks/[id]/task-view.css +407 -0
  381. package/src/server/dash/app/dash/tasks/[id]/task-view.tsx +513 -0
  382. package/src/server/dash/app/dash/tasks/composer-data.ts +96 -0
  383. package/src/server/dash/app/dash/tasks/composer.css +316 -0
  384. package/src/server/dash/app/dash/tasks/composer.tsx +890 -0
  385. package/src/server/dash/app/dash/tasks/list/status.css +50 -0
  386. package/src/server/dash/app/dash/tasks/list/status.tsx +20 -0
  387. package/src/server/dash/app/dash/tasks/list/task.ts +45 -0
  388. package/src/server/dash/app/dash/tasks/list/tasks-list.css +85 -0
  389. package/src/server/dash/app/dash/tasks/list/tasks-list.tsx +402 -0
  390. package/src/server/dash/app/dash/tasks/list/tasks-section.tsx +96 -0
  391. package/src/server/dash/app/dash/tasks/page.tsx +53 -0
  392. package/src/server/dash/app/dash/token-from-hash.tsx +17 -0
  393. package/src/server/dash/app/dash/usage/custom-range.tsx +63 -0
  394. package/src/server/dash/app/dash/usage/day-chart.css +109 -0
  395. package/src/server/dash/app/dash/usage/day-chart.tsx +110 -0
  396. package/src/server/dash/app/dash/usage/loading.tsx +17 -0
  397. package/src/server/dash/app/dash/usage/metric.ts +13 -0
  398. package/src/server/dash/app/dash/usage/page.tsx +117 -0
  399. package/src/server/dash/app/dash/usage/range-bar.css +13 -0
  400. package/src/server/dash/app/dash/usage/range-bar.tsx +69 -0
  401. package/src/server/dash/app/dash/usage/stats.css +52 -0
  402. package/src/server/dash/app/dash/usage/stats.tsx +19 -0
  403. package/src/server/dash/app/dash/usage/top-agents.css +40 -0
  404. package/src/server/dash/app/dash/usage/top-agents.tsx +138 -0
  405. package/src/server/dash/app/dash/usage/usage.css +0 -0
  406. package/src/server/dash/app/globals.css +692 -0
  407. package/src/server/dash/app/layout.tsx +52 -0
  408. package/src/server/dash/app/login/page.css +26 -0
  409. package/src/server/dash/app/login/page.tsx +57 -0
  410. package/src/server/dash/app/page.tsx +5 -0
  411. package/src/server/dash/app/responsive.css +49 -0
  412. package/src/server/dash/app/zone.tsx +13 -0
  413. package/src/server/dash/comps/frame/auth-panel.css +60 -0
  414. package/src/server/dash/comps/frame/auth-panel.tsx +44 -0
  415. package/src/server/dash/comps/frame/drawer.css +28 -0
  416. package/src/server/dash/comps/frame/drawer.tsx +39 -0
  417. package/src/server/dash/comps/frame/heads.ts +41 -0
  418. package/src/server/dash/comps/frame/loading-card.tsx +65 -0
  419. package/src/server/dash/comps/frame/page-head.css +83 -0
  420. package/src/server/dash/comps/frame/page-head.tsx +71 -0
  421. package/src/server/dash/comps/frame/stream.tsx +50 -0
  422. package/src/server/dash/comps/frame/task-toasts.tsx +214 -0
  423. package/src/server/dash/comps/frame/theme-choices.tsx +46 -0
  424. package/src/server/dash/comps/nav/current-link.tsx +53 -0
  425. package/src/server/dash/comps/nav/side-toggle.tsx +30 -0
  426. package/src/server/dash/comps/nav/to.ts +22 -0
  427. package/src/server/dash/comps/ui/badge.css +64 -0
  428. package/src/server/dash/comps/ui/badge.tsx +41 -0
  429. package/src/server/dash/comps/ui/card.css +93 -0
  430. package/src/server/dash/comps/ui/card.tsx +77 -0
  431. package/src/server/dash/comps/ui/collapse.css +32 -0
  432. package/src/server/dash/comps/ui/collapse.tsx +49 -0
  433. package/src/server/dash/comps/ui/combo.tsx +154 -0
  434. package/src/server/dash/comps/ui/confirm.css +36 -0
  435. package/src/server/dash/comps/ui/confirm.tsx +67 -0
  436. package/src/server/dash/comps/ui/field.css +25 -0
  437. package/src/server/dash/comps/ui/field.tsx +34 -0
  438. package/src/server/dash/comps/ui/icon.css +22 -0
  439. package/src/server/dash/comps/ui/icon.tsx +17 -0
  440. package/src/server/dash/comps/ui/icons.ts +44 -0
  441. package/src/server/dash/comps/ui/menu.css +178 -0
  442. package/src/server/dash/comps/ui/menu.tsx +152 -0
  443. package/src/server/dash/comps/ui/segmented.css +44 -0
  444. package/src/server/dash/comps/ui/segmented.tsx +58 -0
  445. package/src/server/dash/comps/ui/select.css +103 -0
  446. package/src/server/dash/comps/ui/select.tsx +250 -0
  447. package/src/server/dash/comps/ui/sentinel.css +58 -0
  448. package/src/server/dash/comps/ui/sentinel.tsx +67 -0
  449. package/src/server/dash/comps/ui/tabs.css +81 -0
  450. package/src/server/dash/comps/ui/tabs.tsx +32 -0
  451. package/src/server/dash/comps/ui/tail.css +12 -0
  452. package/src/server/dash/comps/ui/tail.tsx +37 -0
  453. package/src/server/dash/comps/ui/toast.css +72 -0
  454. package/src/server/dash/comps/ui/toolbar.css +143 -0
  455. package/src/server/dash/comps/ui/toolbar.tsx +93 -0
  456. package/src/server/dash/package.json +5 -0
  457. package/src/server/dash/pnext-env.d.ts +4 -0
  458. package/src/server/dash/pnext.config.ts +5 -0
  459. package/src/server/dash/public/assets/apple-touch-icon.png +0 -0
  460. package/src/server/dash/public/assets/favicon.ico +0 -0
  461. package/src/server/dash/public/assets/favicon.svg +1 -0
  462. package/src/server/dash/public/assets/fonts/LICENSE-fira-code +93 -0
  463. package/src/server/dash/public/assets/fonts/fira-code-latin-400-normal-717ee080.woff2 +0 -0
  464. package/src/server/dash/public/assets/fonts/fira-code-latin-500-normal-530b6706.woff2 +0 -0
  465. package/src/server/dash/public/assets/fonts/fira-code-latin-700-normal-98730669.woff2 +0 -0
  466. package/src/server/dash/tsconfig.json +10 -0
  467. package/src/server/dash/utils/client.ts +19 -0
  468. package/src/server/dash/utils/format.ts +75 -0
  469. package/src/server/dash/utils/paged.ts +184 -0
  470. package/src/server/dash/utils/range.ts +117 -0
  471. package/dist/app-server-CW93J9zJ.js +0 -3
  472. package/dist/runtime-D-U1DNkI.js +0 -26
  473. package/dist/upgrade-DOj06r5b.js +0 -37
@@ -0,0 +1,2704 @@
1
+ import { createRequire as __coderRequire } from "node:module";
2
+ const __pnextRoot = __coderRequire(import.meta.url).resolve("@wular/pnext").replace(/\/src\/index\.ts$/, "");
3
+ import { createRequire as __pnextCreateRequire } from "node:module";
4
+ const require = __pnextCreateRequire(("file://" + __pnextRoot + "/package.json"));
5
+ import {
6
+ writeTsconfigDefaults
7
+ } from "./chunk-T3QZT3PG.js";
8
+ import {
9
+ generateTypedRoutes
10
+ } from "./chunk-6KQSWT6D.js";
11
+ import {
12
+ DEFAULT_DYNAMIC_STALE_TIME_SECONDS,
13
+ DEFAULT_STATIC_STALE_TIME_SECONDS,
14
+ aliasGenerateStaticParams,
15
+ bodySegmentFile,
16
+ buildRootTreePrefetch,
17
+ buildSegmentMeta,
18
+ diagnoseCacheComponentsPrerender,
19
+ diagnosticLeadsWithErrorLine,
20
+ fontLinkHeaderValue,
21
+ prerenderFailureFooter,
22
+ readMiddlewareWasmBindingsForOutPath,
23
+ rootTreePrefetchText,
24
+ segmentDir,
25
+ segmentMetaFile,
26
+ takeCacheLifeStash,
27
+ takeFontHeaderPreloads,
28
+ takeResourceHintHeader,
29
+ treeSegmentFile,
30
+ validateBuild,
31
+ varyNamesFor,
32
+ warnNextMetadataBuildIssues,
33
+ withVaryParamsTracking,
34
+ writeBuildFlags
35
+ } from "./chunk-H523KSIH.js";
36
+ import {
37
+ deploymentId,
38
+ turbopackLoaderRules
39
+ } from "./chunk-WZX4V6CM.js";
40
+ import {
41
+ scanRootParamTypes
42
+ } from "./chunk-PA4QEARJ.js";
43
+ import {
44
+ discoverStaticMetadataFiles
45
+ } from "./chunk-PZ5AXOLW.js";
46
+ import "./chunk-VC5O2SDP.js";
47
+ import "./chunk-62KEQM43.js";
48
+ import "./chunk-SNVPTULL.js";
49
+ import {
50
+ nextCompatEnabled,
51
+ reactCompatEnabled,
52
+ reactCompilerOptions
53
+ } from "./chunk-XUUIDXY5.js";
54
+ import {
55
+ findProxyFile,
56
+ proxyExternalLoadTarget
57
+ } from "./chunk-7DCNCW6O.js";
58
+ import {
59
+ getNextConfig
60
+ } from "./chunk-2ICEVELW.js";
61
+ import {
62
+ devServerModuleHref
63
+ } from "./chunk-E6IXL2NJ.js";
64
+ import "./chunk-L2IWDUXG.js";
65
+ import {
66
+ legacyRequestAPIs,
67
+ pathToFileHref
68
+ } from "./chunk-JESFYECC.js";
69
+ import "./chunk-5RDEILQB.js";
70
+ import "./chunk-JRPJM2XY.js";
71
+ import "./chunk-CCATPVTW.js";
72
+ import "./chunk-HT6KKX6A.js";
73
+ import "./chunk-NQE46AZN.js";
74
+ import {
75
+ listFiles,
76
+ toPosixPath
77
+ } from "./chunk-2HFY3DQT.js";
78
+ import {
79
+ onExtensionHostReset,
80
+ registerBuildCompleteHooks,
81
+ registerBuildParallelPhases,
82
+ registerBuildSteps,
83
+ setBuildCompatExtensions,
84
+ setCompatModeExtensions
85
+ } from "./chunk-4P5CMIYT.js";
86
+ import "./chunk-FTJVHFWD.js";
87
+ import "./chunk-3UPROT2C.js";
88
+
89
+ // ../node_modules/.bun/@wular+pnext@0.1.5+62547eec5a2188e3/node_modules/@wular/pnext/src/compat/register/build.ts
90
+ import { mkdir as mkdir2, readFile, writeFile as writeFile2 } from "node:fs/promises";
91
+ import path2 from "node:path";
92
+
93
+ // ../node_modules/.bun/@wular+pnext@0.1.5+62547eec5a2188e3/node_modules/@wular/pnext/src/compat/next/preferred-region.ts
94
+ import { readFileSync } from "node:fs";
95
+ var PREFERRED_REGION_RE = /\bexport\s+const\s+preferredRegion\s*=\s*(\[[^\]]*\]|['"][^'"]*['"])/;
96
+ function preferredRegionForRoute(route) {
97
+ for (const file of routeSources(route)) {
98
+ let source;
99
+ try {
100
+ source = readFileSync(file, "utf8");
101
+ } catch {
102
+ continue;
103
+ }
104
+ const match = PREFERRED_REGION_RE.exec(source);
105
+ if (!match?.[1]) continue;
106
+ return parsePreferredRegion(match[1]);
107
+ }
108
+ return void 0;
109
+ }
110
+ function routeSources(route) {
111
+ return [.../* @__PURE__ */ new Set([route.file, ...route.sourceFiles])].filter(Boolean);
112
+ }
113
+ function parsePreferredRegion(literal) {
114
+ if (literal.startsWith("[")) {
115
+ return Array.from(literal.matchAll(/['"]([^'"]*)['"]/g), (m) => m[1] ?? "");
116
+ }
117
+ return [literal.slice(1, -1)];
118
+ }
119
+
120
+ // ../node_modules/.bun/@wular+pnext@0.1.5+62547eec5a2188e3/node_modules/@wular/pnext/src/compat/export/build-complete.ts
121
+ import { existsSync } from "node:fs";
122
+ import { mkdir, writeFile } from "node:fs/promises";
123
+ import path from "node:path";
124
+ function staticPathname(relative) {
125
+ const url = `/${relative.replace(/\\/g, "/")}`;
126
+ if (url.endsWith("/index.html")) return url.slice(0, -"index.html".length) || "/";
127
+ return url.endsWith(".html") ? url.slice(0, -".html".length) : url;
128
+ }
129
+ function serverEntryPath(config, route) {
130
+ return path.join(config.outPath, "server", `${route.id}.js`);
131
+ }
132
+ async function writeServerEntries(config, manifest) {
133
+ await mkdir(path.join(config.outPath, "server"), { recursive: true });
134
+ await Promise.all(
135
+ manifest.routes.map(
136
+ (route) => writeFile(
137
+ serverEntryPath(config, route),
138
+ [
139
+ "// Generated by `pnext build` for the configured deployment adapter.",
140
+ "// pnext serves every route from one server process (`pnext start`);",
141
+ "// this entry identifies the route rather than bundling it standalone.",
142
+ `export const id = ${JSON.stringify(route.id)};`,
143
+ `export const pathname = ${JSON.stringify(route.route)};`,
144
+ `export const sourcePage = ${JSON.stringify(sourcePage(config, route))};`,
145
+ `export const kind = ${JSON.stringify(route.kind)};`,
146
+ "export const runtime = 'nodejs';",
147
+ "export default { id, pathname, sourcePage, kind, runtime };",
148
+ ""
149
+ ].join("\n")
150
+ )
151
+ )
152
+ );
153
+ }
154
+ function sourcePage(config, route) {
155
+ return `/${path.relative(config.root, route.file).replace(/\\/g, "/")}`;
156
+ }
157
+ function sharedFields(config, route) {
158
+ return {
159
+ id: route.id,
160
+ filePath: serverEntryPath(config, route),
161
+ pathname: route.route,
162
+ sourcePage: sourcePage(config, route),
163
+ // pnext has one runtime: the server process. `edge` is never emitted.
164
+ runtime: "nodejs",
165
+ assets: {},
166
+ assetsHashes: {},
167
+ config: {
168
+ ...route.maxDuration !== void 0 ? { maxDuration: route.maxDuration } : {}
169
+ }
170
+ };
171
+ }
172
+ function collectOutputs(config, manifest) {
173
+ const outputs = {
174
+ pages: [],
175
+ appPages: [],
176
+ pagesApi: [],
177
+ appRoutes: [],
178
+ prerenders: [],
179
+ staticFiles: []
180
+ };
181
+ const prerenderedRoutes = /* @__PURE__ */ new Set();
182
+ for (const [relative, metadata] of Object.entries(manifest.staticFiles ?? {})) {
183
+ const filePath = path.join(config.outPath, "public", relative);
184
+ if (!existsSync(filePath)) continue;
185
+ if (metadata.routeId) prerenderedRoutes.add(metadata.routeId);
186
+ const entry = { id: relative, filePath, pathname: staticPathname(relative) };
187
+ if (metadata.revalidateSeconds !== void 0) {
188
+ outputs.prerenders.push({
189
+ ...entry,
190
+ type: "PRERENDER",
191
+ parentOutputId: metadata.routeId ?? relative
192
+ });
193
+ } else {
194
+ outputs.staticFiles.push({ ...entry, type: "STATIC_FILE" });
195
+ }
196
+ }
197
+ for (const route of manifest.routes) {
198
+ if (prerenderedRoutes.has(route.id) && route.mode === "static" && !route.ppr) continue;
199
+ const fields = sharedFields(config, route);
200
+ if (route.kind === "handler") {
201
+ outputs.appRoutes.push({ ...fields, type: "APP_ROUTE" });
202
+ } else {
203
+ outputs.appPages.push({ ...fields, type: "APP_PAGE" });
204
+ outputs.appPages.push({
205
+ ...fields,
206
+ type: "APP_PAGE",
207
+ id: `${route.id}.rsc`,
208
+ pathname: `${fields.pathname}.rsc`
209
+ });
210
+ }
211
+ }
212
+ return outputs;
213
+ }
214
+ function namedSourceRegex(route) {
215
+ let index = 0;
216
+ const named = route.pattern.replace(/\((\[\^\/\]\+|\.\*)\)/g, (whole, body) => {
217
+ const param = route.params[index++];
218
+ return param ? `(?<${param.replace(/\W/g, "")}>${body})` : whole;
219
+ });
220
+ return `^${named}(?:/)?$`;
221
+ }
222
+ function collectDynamicRoutes(manifest) {
223
+ const routes = [];
224
+ for (const route of manifest.routes) {
225
+ if (route.params.length === 0) continue;
226
+ const sourceRegex = namedSourceRegex(route);
227
+ if (route.kind === "page") {
228
+ routes.push({
229
+ source: `${route.route}.rsc`,
230
+ sourceRegex: sourceRegex.replace(
231
+ /\(\?:\/\)\?\$$/,
232
+ String.raw`(?<rscSuffix>\.rsc|\.segments/.+\.segment\.rsc)(?:/)?$`
233
+ ),
234
+ destination: `${route.route}$rscSuffix`
235
+ });
236
+ }
237
+ routes.push({ source: route.route, sourceRegex, destination: route.route });
238
+ }
239
+ return routes;
240
+ }
241
+ async function runBuildCompleteAdapter(config, manifest) {
242
+ const configured = getNextConfig().adapterPath;
243
+ const adapterPath = (
244
+ // eslint-disable-next-line turbo/no-undeclared-env-vars -- Next's own env override
245
+ process.env.NEXT_ADAPTER_PATH || (typeof configured === "string" ? configured : void 0)
246
+ );
247
+ if (!adapterPath) return;
248
+ const resolved = path.isAbsolute(adapterPath) ? adapterPath : path.resolve(config.root, adapterPath);
249
+ const module = await import(pathToFileHref(resolved));
250
+ const adapter = module.default ?? module;
251
+ if (typeof adapter?.onBuildComplete !== "function") return;
252
+ await writeServerEntries(config, manifest);
253
+ await adapter.onBuildComplete({
254
+ routing: {
255
+ beforeMiddleware: [],
256
+ middlewareMatchers: [],
257
+ beforeFiles: [],
258
+ afterFiles: [],
259
+ dynamicRoutes: collectDynamicRoutes(manifest),
260
+ onMatch: [],
261
+ fallback: [],
262
+ shouldNormalizeNextData: false,
263
+ rsc: void 0
264
+ },
265
+ outputs: collectOutputs(config, manifest),
266
+ projectDir: config.root,
267
+ repoRoot: config.root,
268
+ distDir: config.outPath
269
+ });
270
+ }
271
+
272
+ // ../node_modules/.bun/@wular+pnext@0.1.5+62547eec5a2188e3/node_modules/@wular/pnext/src/compat/register/build.ts
273
+ function registerBuildCompatExtensions() {
274
+ registerBuildCompleteHooks(
275
+ ({ config, manifest }) => writeFunctionsConfigManifest(config.outPath, manifest)
276
+ );
277
+ registerBuildCompleteHooks(({ config }) => writeRequiredServerFilesManifest(config));
278
+ registerBuildCompleteHooks(({ config }) => writeTraceBuildFile(config));
279
+ registerBuildCompleteHooks(({ config, manifest }) => runBuildCompleteAdapter(config, manifest));
280
+ setCompatModeExtensions({
281
+ nextEnabled: nextCompatEnabled,
282
+ reactEnabled: reactCompatEnabled,
283
+ reactCompilerOptions
284
+ });
285
+ setBuildCompatExtensions({
286
+ warnMetadataIssues: ({ appPath, routes, staticMetadataFiles }) => warnNextMetadataBuildIssues(appPath, routes, staticMetadataFiles),
287
+ nextOutputExport: () => getNextConfig().output === "export",
288
+ nextOutputMode: () => {
289
+ const output = getNextConfig().output;
290
+ return output === "export" || output === "standalone" ? output : void 0;
291
+ },
292
+ nextScriptWorkersEnabled: () => {
293
+ const experimental = getNextConfig().experimental;
294
+ return experimental?.nextScriptWorkers === true;
295
+ },
296
+ defaultExpireTimeSeconds: () => {
297
+ const expireTime = getNextConfig().expireTime;
298
+ return typeof expireTime === "number" ? expireTime : void 0;
299
+ },
300
+ withVaryParamsTracking,
301
+ varyNamesFor: (vary, kind) => varyNamesFor(vary, kind),
302
+ takeCacheLifeStash,
303
+ takeFontLinkHeader: () => {
304
+ const fontValues = takeFontHeaderPreloads().map(fontLinkHeaderValue);
305
+ const hintValue = takeResourceHintHeader();
306
+ const values = [...fontValues, ...hintValue ? [hintValue] : []];
307
+ if (values.length === 0) return void 0;
308
+ return values.join(", ");
309
+ },
310
+ normalizeStaticParamsModule: aliasGenerateStaticParams,
311
+ defaultDynamicStaleTimeSeconds: DEFAULT_DYNAMIC_STALE_TIME_SECONDS,
312
+ defaultStaticStaleTimeSeconds: DEFAULT_STATIC_STALE_TIME_SECONDS,
313
+ buildRootTreePrefetch,
314
+ rootTreePrefetchText,
315
+ buildSegmentMeta,
316
+ segmentDir,
317
+ treeSegmentFile,
318
+ bodySegmentFile,
319
+ segmentMetaFile
320
+ });
321
+ }
322
+ async function writeRequiredServerFilesManifest(config) {
323
+ if (!nextCompatEnabled(config)) return;
324
+ const id = deploymentId();
325
+ if (!id) return;
326
+ const outDir = path2.join(config.root, ".next");
327
+ await mkdir2(outDir, { recursive: true });
328
+ await writeFile2(
329
+ path2.join(outDir, "required-server-files.json"),
330
+ JSON.stringify({ version: 1, config: { deploymentId: id } }, null, 2)
331
+ );
332
+ }
333
+ var traceBuildGlobal = globalThis;
334
+ traceBuildGlobal.__pnextBuildStartedAt ??= performance.now();
335
+ async function writeTraceBuildFile(config) {
336
+ if (!nextCompatEnabled(config)) return;
337
+ const traceId = randomTraceId();
338
+ const totalDuration = Math.max(
339
+ 1,
340
+ performance.now() - (traceBuildGlobal.__pnextBuildStartedAt ?? 0)
341
+ );
342
+ const events = [
343
+ { name: "next-build", id: 1, traceId, duration: totalDuration },
344
+ { name: "run-webpack", id: 2, parentId: 1, traceId, duration: totalDuration * 0.4 },
345
+ { name: "run-typescript", id: 3, parentId: 1, traceId, duration: totalDuration * 0.2 },
346
+ { name: "static-check", id: 4, parentId: 1, traceId, duration: totalDuration * 0.1 },
347
+ { name: "static-generation", id: 5, parentId: 1, traceId, duration: totalDuration * 0.2 },
348
+ { name: "collect-build-traces", id: 6, parentId: 1, traceId, duration: totalDuration * 0.05 },
349
+ { name: "telemetry-flush", id: 7, parentId: 1, traceId, duration: 1 }
350
+ ];
351
+ const outDir = path2.join(config.root, ".next");
352
+ await mkdir2(outDir, { recursive: true });
353
+ await writeFile2(path2.join(outDir, "trace-build"), `${JSON.stringify(events)}
354
+ `);
355
+ }
356
+ function randomTraceId() {
357
+ return Array.from({ length: 16 }, () => Math.floor(Math.random() * 16).toString(16)).join("");
358
+ }
359
+ async function writeFunctionsConfigManifest(outPath, manifest) {
360
+ const routes = manifest.routes.filter((route) => route.maxDuration !== void 0);
361
+ if (routes.length === 0) return;
362
+ const file = path2.join(outPath, "server", "functions-config-manifest.json");
363
+ let current = { version: 1, functions: {} };
364
+ try {
365
+ current = JSON.parse(await readFile(file, "utf8"));
366
+ } catch {
367
+ current = { version: 1, functions: {} };
368
+ }
369
+ for (const route of routes) {
370
+ const regions = preferredRegionForRoute(route);
371
+ current.functions[route.route || "/"] = {
372
+ ...current.functions[route.route || "/"] ?? {},
373
+ maxDuration: route.maxDuration,
374
+ ...regions ? { regions } : {}
375
+ };
376
+ }
377
+ await mkdir2(path2.dirname(file), { recursive: true });
378
+ await writeFile2(file, `${JSON.stringify(current, null, 2)}
379
+ `);
380
+ }
381
+
382
+ // ../node_modules/.bun/@wular+pnext@0.1.5+62547eec5a2188e3/node_modules/@wular/pnext/src/compat/typecheck/check.ts
383
+ import { existsSync as existsSync2, statSync } from "node:fs";
384
+ import { mkdir as mkdir3, writeFile as writeFile3 } from "node:fs/promises";
385
+ import { createRequire } from "node:module";
386
+ import path3 from "node:path";
387
+ import { Worker } from "node:worker_threads";
388
+ var PnextTypecheckError = class extends Error {
389
+ constructor(messages) {
390
+ super(messages.join("\n"));
391
+ this.name = "PnextTypecheckError";
392
+ this.messages = messages;
393
+ }
394
+ };
395
+ var typescriptModule;
396
+ async function loadTypescript() {
397
+ typescriptModule ??= await import("typescript");
398
+ return typescriptModule;
399
+ }
400
+ function typecheckDisabled() {
401
+ const typescript = getNextConfig().typescript;
402
+ return typescript?.ignoreBuildErrors === true;
403
+ }
404
+ async function validateTypesOffThread(config) {
405
+ if (typecheckDisabled()) return;
406
+ const next = getNextConfig();
407
+ const input = {
408
+ root: config.root,
409
+ outPath: config.outPath,
410
+ compat: config.compat,
411
+ nextConfig: cloneable({
412
+ typescript: next.typescript,
413
+ typedRoutes: next.typedRoutes,
414
+ turbopack: next.turbopack
415
+ })
416
+ };
417
+ let worker;
418
+ try {
419
+ worker = new Worker(new URL("./worker.ts", ("file://" + __pnextRoot + "/src/compat/typecheck/check.ts")), { workerData: input });
420
+ } catch {
421
+ return validateTypes(config);
422
+ }
423
+ const result = await new Promise((resolve, reject) => {
424
+ worker.on("message", resolve);
425
+ worker.on("error", reject);
426
+ worker.on("exit", () => resolve({ ok: true }));
427
+ }).finally(() => void worker.terminate());
428
+ if (result.ok) return;
429
+ if (result.messages) throw new PnextTypecheckError(result.messages);
430
+ throw new Error(result.failure ?? "typecheck worker failed");
431
+ }
432
+ function cloneable(value) {
433
+ try {
434
+ return JSON.parse(JSON.stringify(value));
435
+ } catch {
436
+ return {};
437
+ }
438
+ }
439
+ async function validateTypes(config) {
440
+ if (typecheckDisabled()) return;
441
+ const native = await nativeCheckerBin(config.root);
442
+ const project = await writeTypecheckProject(config, native);
443
+ if (native && (await checkWithNative(native, project, config)).length === 0) return;
444
+ const messages = await checkInProcess(project, config);
445
+ if (messages.length === 0) return;
446
+ throw new PnextTypecheckError(messages);
447
+ }
448
+ async function checkInProcess(project, config) {
449
+ const ts = await loadTypescript();
450
+ const parsed = readProject(ts, project);
451
+ const program = ts.createProgram(parsed.fileNames, parsed.options);
452
+ const diagnostics = ts.getPreEmitDiagnostics(program).filter((diagnostic) => appDiagnostic(diagnostic.file?.fileName, config));
453
+ return formatDiagnostics(ts, diagnostics);
454
+ }
455
+ async function nativeCheckerBin(root) {
456
+ if (process.env.PNEXT_TYPECHECK === "classic") return void 0;
457
+ for (const base of [root, (__pnextRoot + "/src/compat/typecheck")]) {
458
+ try {
459
+ const require2 = createRequire(path3.join(base, "noop.js"));
460
+ const pkg = require2.resolve("@typescript/native-preview/package.json");
461
+ const { default: getExePath } = await import(path3.join(path3.dirname(pkg), "lib", "getExePath.js"));
462
+ const bin = getExePath();
463
+ if (bin && existsSync2(bin)) return bin;
464
+ } catch {
465
+ }
466
+ }
467
+ return void 0;
468
+ }
469
+ async function checkWithNative(bin, project, config) {
470
+ const proc = Bun.spawn([bin, "--noEmit", "--pretty", "false", "-p", project], {
471
+ cwd: config.root,
472
+ stdout: "pipe",
473
+ stderr: "pipe"
474
+ });
475
+ const [stdout, stderr] = await Promise.all([
476
+ new Response(proc.stdout).text(),
477
+ new Response(proc.stderr).text()
478
+ ]);
479
+ await proc.exited;
480
+ return nativeDiagnostics(`${stdout}${stderr}`, config);
481
+ }
482
+ function nativeDiagnostics(output, config) {
483
+ const header = /^(?:(.+)\((\d+),(\d+)\): )?error TS\d+: (.*)$/;
484
+ const messages = /* @__PURE__ */ new Set();
485
+ const lines = output.split("\n");
486
+ for (let index = 0; index < lines.length; index += 1) {
487
+ const match = header.exec(lines[index]);
488
+ if (!match) continue;
489
+ const [, file, line, column, text] = match;
490
+ const elaborations = [];
491
+ while (index + 1 < lines.length && /^\s+\S/.test(lines[index + 1])) {
492
+ elaborations.push(lines[index + 1]);
493
+ index += 1;
494
+ }
495
+ const resolved = file ? path3.resolve(config.root, file) : void 0;
496
+ if (!appDiagnostic(resolved, config)) continue;
497
+ const raw = [text, ...elaborations].join("\n");
498
+ const location = resolved ? `${resolved}:${line}:${column}
499
+ ` : "";
500
+ messages.add(`${location}Type error: ${typedRouteMessage(raw) ?? raw}`);
501
+ }
502
+ return [...messages];
503
+ }
504
+ function appDiagnostic(file, config) {
505
+ if (!file) return true;
506
+ const resolved = path3.resolve(file);
507
+ if (resolved === generatedProjectPath(config)) return true;
508
+ if (!resolved.startsWith(config.root + path3.sep)) return false;
509
+ if (resolved.includes(`${path3.sep}node_modules${path3.sep}`)) return false;
510
+ if (resolved.startsWith(path3.resolve(config.outPath) + path3.sep)) return false;
511
+ return true;
512
+ }
513
+ function generatedProjectPath(config) {
514
+ return path3.resolve(config.outPath, "typecheck", "tsconfig.json");
515
+ }
516
+ function reactTypePaths(root, basePaths, compatPreact) {
517
+ const react = resolveTypesDir("react", root);
518
+ if (!react) return basePaths;
519
+ const reactDom = resolveTypesDir("react-dom", root);
520
+ const paths = { ...basePaths };
521
+ const mappings = {
522
+ react: path3.join(react, "index.d.ts"),
523
+ "react/*": path3.join(react, "*"),
524
+ "react-dom": reactDom && path3.join(reactDom, "index.d.ts"),
525
+ "react-dom/*": reactDom && path3.join(reactDom, "*"),
526
+ preact: compatPreact
527
+ };
528
+ for (const [key, value] of Object.entries(mappings)) {
529
+ if (value) paths[key] = [value];
530
+ }
531
+ return paths;
532
+ }
533
+ function resolveTypesDir(name, root) {
534
+ for (const base of [root, (__pnextRoot + "/src/compat/typecheck")]) {
535
+ try {
536
+ const require2 = createRequire(path3.join(base, "noop.js"));
537
+ return path3.dirname(require2.resolve(`@types/${name}/package.json`));
538
+ } catch {
539
+ }
540
+ }
541
+ return void 0;
542
+ }
543
+ function absolutePaths(paths, basePath) {
544
+ if (!paths) return void 0;
545
+ return Object.fromEntries(
546
+ Object.entries(paths).map(([key, targets]) => [
547
+ key,
548
+ targets.map((target) => path3.isAbsolute(target) ? target : path3.resolve(basePath, target))
549
+ ])
550
+ );
551
+ }
552
+ function resolvePackageDir(name, root) {
553
+ for (const base of [root, (__pnextRoot + "/src/compat/typecheck")]) {
554
+ try {
555
+ const require2 = createRequire(path3.join(base, "noop.js"));
556
+ return path3.dirname(require2.resolve(`${name}/package.json`));
557
+ } catch {
558
+ }
559
+ }
560
+ return void 0;
561
+ }
562
+ async function writeTypecheckProject(config, native) {
563
+ const dir = path3.join(config.outPath, "typecheck");
564
+ await mkdir3(dir, { recursive: true });
565
+ const reactTypes = resolveTypesDir("react", config.root);
566
+ const hasReactTypes = reactTypes !== void 0;
567
+ const rootParams = scanRootParamTypes(path3.join(config.root, "app"));
568
+ const hasRealNext = realNextResolvable(config.root);
569
+ const omitNextModuleShims = typedRoutesEnabled() && hasRealNext;
570
+ const legacyRequestTypes = typeof config.compat?.next === "object" && config.compat.next.legacyRequestAPIs === true;
571
+ await writeFile3(
572
+ path3.join(dir, "next-shims.d.ts"),
573
+ nextShims(hasReactTypes, rootParams, omitNextModuleShims, legacyRequestTypes, hasRealNext)
574
+ );
575
+ const preact = resolvePackageDir("preact", config.root);
576
+ if (reactTypes && preact) {
577
+ await writeFile3(preactTypeShimPath(config), preactTypeShim(preact, reactTypes));
578
+ }
579
+ const base = tsconfigPath(config.root);
580
+ const baseProject = base ? await readBaseProject(base, native) : void 0;
581
+ const baseOptions = baseProject?.options ?? {};
582
+ const preactShim = preactTypeShimPath(config);
583
+ const project = generatedProjectPath(config);
584
+ const paths = reactTypePaths(
585
+ config.root,
586
+ absolutePaths(
587
+ baseOptions.paths,
588
+ baseOptions.baseUrl ?? (base ? path3.dirname(base) : config.root)
589
+ ),
590
+ existsSync2(preactShim) ? preactShim : void 0
591
+ );
592
+ const nodeTypes = resolveTypesDir("node", config.root);
593
+ await writeFile3(
594
+ project,
595
+ JSON.stringify(
596
+ {
597
+ ...base ? { extends: base } : {},
598
+ compilerOptions: {
599
+ noEmit: true,
600
+ // TS keeps only the buildinfo under noEmit, so a re-check of an
601
+ // unchanged app is near-free. It lives outside outPath, which every
602
+ // build wipes.
603
+ incremental: true,
604
+ tsBuildInfoFile: path3.join(
605
+ config.root,
606
+ "node_modules",
607
+ ".cache",
608
+ "pnext",
609
+ "typecheck.tsbuildinfo"
610
+ ),
611
+ skipLibCheck: true,
612
+ allowJs: true,
613
+ resolveJsonModule: true,
614
+ isolatedModules: true,
615
+ // Next owns the JSX transform and typechecks the source form. Besides
616
+ // matching its required tsconfig option, `preserve` keeps a legacy
617
+ // `import React` semantically used when noUnusedLocals is enabled.
618
+ jsx: "preserve",
619
+ // `paths` only, never `baseUrl` — TS 7 removed it (TS5102). The
620
+ // mappings are absolutized above so they resolve the same from here.
621
+ ...paths ? { paths } : {},
622
+ // Fallbacks for apps whose tsconfig leaves these unset (the ES3 default rejects modern syntax).
623
+ // The app's own values win - `next build` checks with the app's options, and overriding
624
+ // lib/strict/target changes inference.
625
+ ...baseOptions.strict === void 0 ? { strict: false } : {},
626
+ ...baseOptions.target === void 0 ? { target: "es2022" } : {},
627
+ ...baseOptions.module === void 0 ? { module: "esnext" } : {},
628
+ ...baseOptions.moduleResolution === void 0 ? { moduleResolution: "bundler" } : {},
629
+ ...baseOptions.lib === void 0 ? { lib: ["es2022", "dom", "dom.iterable"] } : {}
630
+ },
631
+ include: [
632
+ path3.join(dir, "next-shims.d.ts"),
633
+ // Generated per-route assignability checks (typegen writes them next to this
634
+ // project, not under the app-included `types/` dir, so only pnext's own compiler
635
+ // reads them). Included by hand to keep that coverage.
636
+ path3.join(dir, "checks", "**/*.ts"),
637
+ ...nodeTypes ? [path3.join(nodeTypes, "index.d.ts")] : [],
638
+ path3.join(config.root, "next-env.d.ts"),
639
+ // The build emits `.next/types/validator.ts` (page/layout/route-handler export validation) just
640
+ // before this typecheck. Next includes it in the program so invalid exports fail the build with a
641
+ // constraint type error; include it here too. It lives outside the `.pnext` outPath, so its
642
+ // diagnostics survive appDiagnostic's scoping.
643
+ ...!legacyRequestTypes && existsSync2(path3.join(config.root, ".next/types/validator.ts")) ? [path3.join(config.root, ".next/types/validator.ts")] : [],
644
+ path3.join(config.root, "middleware.*"),
645
+ path3.join(config.root, "proxy.*"),
646
+ // Next type-checks the project's next.config.(ts|mts|cts) as part of
647
+ // `next build`; a type error in the config fails the build (the
648
+ // next-config-ts*/type-error suites assert this). JS configs carry no
649
+ // types to check, so only the TS variants are included.
650
+ path3.join(config.root, "next.config.ts"),
651
+ path3.join(config.root, "next.config.mts"),
652
+ path3.join(config.root, "next.config.cts"),
653
+ path3.join(config.root, "app/**/*.ts"),
654
+ path3.join(config.root, "app/**/*.tsx"),
655
+ path3.join(config.root, "pages/**/*.ts"),
656
+ path3.join(config.root, "pages/**/*.tsx"),
657
+ // The app tsconfig's own file list contributes ambient declarations
658
+ // (global .d.ts JSX/module augmentations) nothing imports; merge just
659
+ // those in. Merging its `include` PATTERNS instead would also drag in
660
+ // every stray root-level source (e2e fixtures keep collectors, custom
661
+ // servers and loader inputs there) that no app entry imports, failing
662
+ // builds on helper files the app never bundles.
663
+ ...baseAmbientDeclarations(baseProject?.fileNames, config)
664
+ ],
665
+ exclude: [
666
+ path3.join(config.root, "node_modules"),
667
+ path3.join(config.root, "**/*.test.ts"),
668
+ path3.join(config.root, "**/*.test.tsx")
669
+ ]
670
+ },
671
+ null,
672
+ 2
673
+ )
674
+ );
675
+ return project;
676
+ }
677
+ function preactTypeShimPath(config) {
678
+ return path3.join(config.outPath, "typecheck", "preact-compat.d.ts");
679
+ }
680
+ function preactTypeShim(preact, react) {
681
+ const preactTypes = JSON.stringify(path3.join(preact, "src", "index.d.ts"));
682
+ const types = JSON.stringify(path3.join(react, "index.d.ts"));
683
+ return `import type { ReactNode } from ${types}
684
+
685
+ export * from ${preactTypes}
686
+ export type ComponentChild = ReactNode
687
+ export type ComponentChildren = ReactNode
688
+ `;
689
+ }
690
+ function typedRoutesEnabled() {
691
+ return getNextConfig().typedRoutes === true;
692
+ }
693
+ function realNextResolvable(root) {
694
+ try {
695
+ createRequire(path3.join(root, "noop.js")).resolve("next/package.json");
696
+ return true;
697
+ } catch {
698
+ return false;
699
+ }
700
+ }
701
+ function baseAmbientDeclarations(fileNames, config) {
702
+ if (!fileNames) return [];
703
+ const outPath = path3.resolve(config.outPath) + path3.sep;
704
+ return fileNames.map((name) => path3.resolve(name)).filter(
705
+ (name) => name.endsWith(".d.ts") && !name.includes(`${path3.sep}node_modules${path3.sep}`) && !name.startsWith(outPath)
706
+ );
707
+ }
708
+ async function readBaseProject(file, native) {
709
+ const shown = native ? await showConfigViaNative(native, file) : void 0;
710
+ if (shown) return shown;
711
+ const ts = await loadTypescript();
712
+ const parsed = readProject(ts, file);
713
+ return { options: parsed.options, fileNames: [...parsed.fileNames] };
714
+ }
715
+ async function showConfigViaNative(bin, file) {
716
+ try {
717
+ const proc = Bun.spawn([bin, "--showConfig", "-p", file], { stdout: "pipe", stderr: "pipe" });
718
+ const stdout = await new Response(proc.stdout).text();
719
+ await proc.exited;
720
+ if (proc.exitCode !== 0) return void 0;
721
+ const shown = JSON.parse(stdout);
722
+ const dir = path3.dirname(file);
723
+ const options = shown.compilerOptions ?? {};
724
+ if (typeof options.baseUrl === "string") options.baseUrl = path3.resolve(dir, options.baseUrl);
725
+ const fileNames = (shown.files ?? []).map((f) => path3.resolve(dir, f));
726
+ return { options, fileNames };
727
+ } catch {
728
+ return void 0;
729
+ }
730
+ }
731
+ function tsconfigPath(root) {
732
+ const tsConfig = getNextConfig().typescript;
733
+ const configured = tsConfig?.tsconfigPath;
734
+ const file = typeof configured === "string" && configured.length > 0 ? path3.join(root, configured) : path3.join(root, "tsconfig.json");
735
+ return existsSync2(file) ? file : void 0;
736
+ }
737
+ var parsedProjects = /* @__PURE__ */ new Map();
738
+ function readProject(ts, project) {
739
+ let stamp = 0;
740
+ try {
741
+ stamp = statSync(project).mtimeMs;
742
+ } catch {
743
+ }
744
+ const cached = parsedProjects.get(project);
745
+ if (cached?.stamp === stamp) return cached.parsed;
746
+ const read = ts.readConfigFile(project, (file) => ts.sys.readFile(file));
747
+ if (read.error) throw new PnextTypecheckError(formatDiagnostics(ts, [read.error]));
748
+ const parsed = ts.parseJsonConfigFileContent(read.config, ts.sys, path3.dirname(project));
749
+ parsedProjects.set(project, { stamp, parsed });
750
+ return parsed;
751
+ }
752
+ function formatDiagnostics(ts, diagnostics) {
753
+ const messages = /* @__PURE__ */ new Set();
754
+ for (const diagnostic of diagnostics) {
755
+ const raw = ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n");
756
+ const typedRoute = typedRouteMessage(raw);
757
+ let location = "";
758
+ if (diagnostic.file && diagnostic.start !== void 0) {
759
+ const { line, character } = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start);
760
+ location = `${diagnostic.file.fileName}:${line + 1}:${character + 1}
761
+ `;
762
+ }
763
+ messages.add(`${location}Type error: ${typedRoute ?? raw}`);
764
+ }
765
+ return [...messages];
766
+ }
767
+ function typedRouteMessage(message) {
768
+ const match = /^Type '(".*")' is not assignable to type '.*RouteImpl<\1>/.exec(message);
769
+ if (!match?.[1]) return void 0;
770
+ return `${match[1]} is not an existing route. If it is intentional, please type it explicitly with \`as Route\`.`;
771
+ }
772
+ function rootParamsModule(rootParams) {
773
+ const order = ["string", "string[]", "undefined"];
774
+ const entries = rootParams.size > 0 ? [...rootParams.entries()].map(([name, types]) => [
775
+ name,
776
+ order.filter((type) => types.has(type)).join(" | ")
777
+ ]) : [
778
+ ["lang", "string | string[] | undefined"],
779
+ ["locale", "string | string[] | undefined"]
780
+ ];
781
+ const getters = entries.map(([name, union]) => ` export function ${name}(): Promise<${union}>`).join("\n");
782
+ return `declare module 'next/root-params' {
783
+ ${getters}
784
+ const rootParams: (...args: any[]) => Promise<any>
785
+ export default rootParams
786
+ }`;
787
+ }
788
+ function stripNextModuleDeclarations(source) {
789
+ const lines = source.split("\n");
790
+ const out = [];
791
+ for (let i = 0; i < lines.length; i++) {
792
+ const line = lines[i];
793
+ if (/^declare module 'next[^']*' \{/.test(line)) {
794
+ let depth = 0;
795
+ for (; i < lines.length; i++) {
796
+ const current = lines[i];
797
+ depth += (current.match(/\{/g)?.length ?? 0) - (current.match(/\}/g)?.length ?? 0);
798
+ if (depth === 0) break;
799
+ }
800
+ continue;
801
+ }
802
+ out.push(line);
803
+ }
804
+ return out.join("\n");
805
+ }
806
+ function nextShims(hasReactTypes, rootParams, omitNextModuleShims = false, legacyRequestTypes = false, hasRealNext = false) {
807
+ const reactShims = hasReactTypes ? "" : `
808
+ declare namespace JSX {
809
+ interface Element {}
810
+ interface IntrinsicElements {
811
+ [name: string]: any
812
+ }
813
+ }
814
+
815
+ declare namespace React {
816
+ type ReactNode = any
817
+ type ComponentType<P = any> = (props: P) => ReactNode
818
+ }
819
+
820
+ declare module 'react' {
821
+ export type ReactNode = any
822
+ export type ComponentType<P = any> = (props: P) => ReactNode
823
+ export type AnchorHTMLAttributes<T> = any
824
+ export type DetailedHTMLProps<E, T> = any
825
+ export const Suspense: ComponentType<any>
826
+ export const ViewTransition: ComponentType<any>
827
+ export function addTransitionType(type: string): void
828
+ }
829
+
830
+ declare module 'react/jsx-runtime' {
831
+ export const jsx: any
832
+ export const jsxs: any
833
+ export const Fragment: any
834
+ }
835
+ `;
836
+ const requestType = (type) => legacyRequestTypes ? `Promise<${type}> & ${type}` : `Promise<${type}>`;
837
+ const requestShims = `declare module 'next/headers'{interface CookieSetOptions{name?:string;value?:string;path?:string;maxAge?:number;expires?:Date|number;httpOnly?:boolean;secure?:boolean;sameSite?:'strict'|'lax'|'none'|boolean;domain?:string}interface CookieStore{get(name:string):{name:string;value:string}|undefined;get(options:{name:string;value?:string}):{name:string;value:string}|undefined;getAll(name?:string):{name:string;value:string}[];getAll(options:{name:string;value?:string}):{name:string;value:string}[];has(name:string):boolean;readonly size:number;set(options:CookieSetOptions):CookieStore;set(name:string,value:string,options?:CookieSetOptions):CookieStore;delete(name:string):boolean;clear():CookieStore;[Symbol.iterator]():IterableIterator<readonly[string,{name?:string;value:string}]>}export function cookies():${requestType("CookieStore")};export function headers():${requestType("Headers")};export function draftMode():${requestType(`{isEnabled:boolean;enable():void;disable():void}`)}}
838
+ `;
839
+ const fontShims = hasRealNext ? "" : `declare module 'next/font'{export interface FontModule{className:string;style:{fontFamily:string;fontWeight?:number;fontStyle?:string};variable:string}}
840
+ declare module 'next/font/local'{import type{FontModule}from'next/font';export default function localFont(options:any):FontModule}
841
+ declare module 'next/font/google'{import type{FontModule}from'next/font';type FontLoader=(options?:any)=>FontModule;const font:FontLoader;export default font;export const Inter:FontLoader,Geist:FontLoader,Geist_Mono:FontLoader,Roboto:FontLoader,Roboto_Mono:FontLoader,Open_Sans:FontLoader,Lato:FontLoader,Montserrat:FontLoader,Poppins:FontLoader,Noto_Sans:FontLoader}
842
+ `;
843
+ const source = `${reactShims}
844
+ declare const process: {
845
+ env: Record<string, string | undefined>
846
+ emit?: (...args: any[]) => boolean
847
+ cwd(): string
848
+ platform: string
849
+ arch: string
850
+ version: string
851
+ versions: Record<string, string>
852
+ nextTick(callback: (...args: any[]) => void, ...args: any[]): void
853
+ argv: string[]
854
+ pid: number
855
+ exit(code?: number): never
856
+ [key: string]: any
857
+ }
858
+
859
+ declare const EdgeRuntime: string
860
+
861
+ declare const require: (id: string) => any
862
+
863
+ declare class Buffer extends Uint8Array {}
864
+
865
+ declare module 'async_hooks' {
866
+ export class AsyncLocalStorage<T> {
867
+ run<R>(store: T, callback: () => R): R
868
+ getStore(): T | undefined
869
+ }
870
+ }
871
+
872
+ declare module 'timers/promises' {
873
+ export function setTimeout<T = void>(delay?: number, value?: T, options?: any): Promise<T>
874
+ export function setImmediate<T = void>(value?: T, options?: any): Promise<T>
875
+ export function setInterval<T = void>(delay?: number, value?: T, options?: any): AsyncIterable<T>
876
+ }
877
+
878
+ declare module 'node:timers/promises' {
879
+ export * from 'timers/promises'
880
+ }
881
+
882
+ declare module 'node:crypto' {
883
+ interface KeyObject {
884
+ export(...args: any[]): any
885
+ toString(...args: any[]): string
886
+ }
887
+ export function randomInt(...args: any[]): number
888
+ export function randomBytes(...args: any[]): Buffer
889
+ export function randomFillSync<T extends Uint8Array>(buffer: T, ...args: any[]): T
890
+ export function randomUUID(...args: any[]): string
891
+ export function getRandomValues<T extends Uint8Array>(array: T): T
892
+ export function generateKeyPairSync(...args: any[]): { publicKey: any; privateKey: any }
893
+ export function generateKeySync(...args: any[]): KeyObject
894
+ export function generatePrimeSync(...args: any[]): ArrayBuffer | Uint8Array
895
+ const crypto: {
896
+ randomInt: typeof randomInt
897
+ randomBytes: typeof randomBytes
898
+ randomFillSync: typeof randomFillSync
899
+ randomUUID: typeof randomUUID
900
+ getRandomValues: typeof getRandomValues
901
+ generateKeyPairSync: typeof generateKeyPairSync
902
+ generateKeySync: typeof generateKeySync
903
+ generatePrimeSync: typeof generatePrimeSync
904
+ }
905
+ export default crypto
906
+ }
907
+
908
+ declare module 'crypto' {
909
+ export * from 'node:crypto'
910
+ export { default } from 'node:crypto'
911
+ }
912
+
913
+ // Next.js augments the fetch RequestInit with a "next" field for its extended
914
+ // fetch semantics (revalidate/tags); mirror that here so app code using
915
+ // fetch(url, next revalidate) typechecks.
916
+ interface RequestInit {
917
+ next?: {
918
+ revalidate?: number | false
919
+ tags?: string[]
920
+ }
921
+ }
922
+
923
+ interface ResponseInit {
924
+ request?: {
925
+ headers?: HeadersInit
926
+ }
927
+ }
928
+
929
+ declare module 'node:buffer' {
930
+ export const Buffer: any
931
+ export const constants: any
932
+ export const kMaxLength: number
933
+ export const kStringMaxLength: number
934
+ export const SlowBuffer: any
935
+ }
936
+
937
+ declare module 'url' {
938
+ export interface UrlObject {
939
+ pathname?: string
940
+ query?: Record<string, string | string[]>
941
+ hash?: string
942
+ }
943
+ }
944
+
945
+ declare module 'next/types.js' {
946
+ export interface NextConfig {
947
+ env?: Record<string, string | number | boolean | undefined>
948
+ typedRoutes?: boolean
949
+ typescript?: { tsconfigPath?: string; ignoreBuildErrors?: boolean }
950
+ eslint?: { ignoreDuringBuilds?: boolean; dirs?: string[] }
951
+ [key: string]: any
952
+ }
953
+ export type Metadata = any
954
+ export type Viewport = any
955
+ export type ResolvingMetadata = Promise<Metadata>
956
+ export type ResolvingViewport = Promise<Viewport>
957
+ export type NextApiHandler<T = any> = (...args: any[]) => any
958
+ export type NextApiRequest = any
959
+ export type NextApiResponse<T = any> = any
960
+ export namespace MetadataRoute {
961
+ type Robots = any
962
+ type Sitemap = any[]
963
+ type Manifest = any
964
+ }
965
+ export type Route<T = string> = string
966
+ export type NextPage<P = {}, IP = P> = ((props: P) => any) & { [key: string]: any }
967
+ export type NextComponentType<C = any, IP = any, P = any> = any
968
+ export type PageProps<P = any> = any
969
+ export type LayoutProps<P = any> = any
970
+ }
971
+
972
+ declare module 'next/types' {
973
+ export * from 'next/types.js'
974
+ export { MetadataRoute } from 'next/types.js'
975
+ }
976
+
977
+ declare module 'next' {
978
+ export type {
979
+ NextConfig,
980
+ Metadata,
981
+ Viewport,
982
+ ResolvingMetadata,
983
+ ResolvingViewport,
984
+ NextApiRequest,
985
+ NextApiResponse,
986
+ NextApiHandler,
987
+ Route,
988
+ NextPage,
989
+ NextComponentType,
990
+ PageProps,
991
+ LayoutProps,
992
+ } from 'next/types.js'
993
+ export { MetadataRoute } from 'next/types.js'
994
+ export type GetServerSideProps<P = any, Q = any> = any
995
+ export type GetStaticProps<P = any, Q = any> = any
996
+ export type GetStaticPaths<Q = any> = any
997
+ export type InferGetServerSidePropsType<T = any> = any
998
+ export type InferGetStaticPropsType<T = any> = any
999
+ }
1000
+
1001
+ declare module 'next/cache' {
1002
+ export function revalidatePath(path: string, type?: 'page' | 'layout'): void
1003
+ export function revalidateTag(tag: string, profile: string | { expire?: number }): void
1004
+ export function updateTag(tag: string): void
1005
+ export function unstable_cache(...args: any[]): any
1006
+ export function unstable_noStore(): void
1007
+ export function unstable_expirePath(path: string, type?: 'page' | 'layout'): void
1008
+ export function unstable_expireTag(...tags: string[]): void
1009
+ export function expirePath(path: string, type?: 'page' | 'layout'): void
1010
+ export function expireTag(...tags: string[]): void
1011
+ export function refresh(): void
1012
+ export function unstable_refresh(): void
1013
+ export const io: any
1014
+ export const cacheTag: (...tags: string[]) => void
1015
+ export const cacheLife: (...args: any[]) => void
1016
+ export const unstable_cacheTag: (...tags: string[]) => void
1017
+ export const unstable_cacheLife: (...args: any[]) => void
1018
+ }
1019
+
1020
+ ${requestShims}
1021
+
1022
+ declare module 'next/server' {
1023
+ interface NextURL extends URL {
1024
+ clone(): NextURL
1025
+ basePath: string
1026
+ buildId?: string
1027
+ locale: string
1028
+ defaultLocale?: string
1029
+ }
1030
+ interface RequestCookie {
1031
+ name: string
1032
+ value: string
1033
+ }
1034
+ interface RequestCookies {
1035
+ get(name: string): RequestCookie | undefined
1036
+ getAll(name?: string): RequestCookie[]
1037
+ has(name: string): boolean
1038
+ set(name: string, value: string): RequestCookies
1039
+ set(cookie: RequestCookie): RequestCookies
1040
+ delete(name: string | string[]): boolean | boolean[]
1041
+ clear(): RequestCookies
1042
+ readonly size: number
1043
+ [Symbol.iterator](): IterableIterator<[string, RequestCookie]>
1044
+ }
1045
+ interface ResponseCookies {
1046
+ get(name: string): (RequestCookie & Record<string, any>) | undefined
1047
+ getAll(name?: string): (RequestCookie & Record<string, any>)[]
1048
+ has(name: string): boolean
1049
+ set(name: string, value: string, options?: any): ResponseCookies
1050
+ set(options: { name: string; value: string; [key: string]: any }): ResponseCookies
1051
+ delete(name: string, options?: any): ResponseCookies
1052
+ [Symbol.iterator](): IterableIterator<[string, RequestCookie & Record<string, any>]>
1053
+ }
1054
+ export class NextRequest extends Request {
1055
+ nextUrl: NextURL
1056
+ cookies: RequestCookies
1057
+ geo?: any
1058
+ ip?: string
1059
+ }
1060
+ export class NextResponse extends Response {
1061
+ cookies: ResponseCookies
1062
+ static json(body: any, init?: ResponseInit): NextResponse
1063
+ static next(init?: ResponseInit): NextResponse
1064
+ static redirect(url: string | URL, init?: number | ResponseInit): NextResponse
1065
+ static rewrite(url: string | URL, init?: ResponseInit): NextResponse
1066
+ }
1067
+ export type NextFetchEvent = any
1068
+ export type NextMiddleware = (...args: any[]) => any
1069
+ export type NextMiddlewareResult = any
1070
+ export interface ProxyConfig {
1071
+ matcher?: string | { source: string } | Array<string | { source: string }>
1072
+ }
1073
+ export class ImageResponse extends Response {
1074
+ constructor(element: any, options?: any)
1075
+ }
1076
+ export const URLPattern: any
1077
+ export function userAgent(request: { headers: Headers }): any
1078
+ export function userAgentFromString(ua: string | undefined): any
1079
+ export function after(task: any): void
1080
+ export function connection(): Promise<void>
1081
+ export const io: any
1082
+ }
1083
+
1084
+ declare module 'next/server.js' {
1085
+ export * from 'next/server'
1086
+ }
1087
+
1088
+ declare module 'next/navigation.js' {
1089
+ export * from 'next/navigation'
1090
+ }
1091
+
1092
+ declare module 'next/headers.js' {
1093
+ export * from 'next/headers'
1094
+ }
1095
+
1096
+ declare module 'next/cache.js' {
1097
+ export * from 'next/cache'
1098
+ }
1099
+
1100
+ declare module 'next/link.js' {
1101
+ export * from 'next/link'
1102
+ export { default } from 'next/link'
1103
+ }
1104
+
1105
+ declare module 'next/image.js' {
1106
+ export * from 'next/image'
1107
+ export { default } from 'next/image'
1108
+ }
1109
+
1110
+ declare module 'next/script.js' {
1111
+ export * from 'next/script'
1112
+ export { default } from 'next/script'
1113
+ }
1114
+
1115
+ declare module 'next/dist/client/link.js' {
1116
+ export interface LinkProps {
1117
+ href: any
1118
+ }
1119
+ export function useLinkStatus(): any
1120
+ }
1121
+
1122
+ declare module 'next/link' {
1123
+ import type { AnchorHTMLAttributes, ComponentType } from 'react'
1124
+ // Mirror Next's public LinkProps: standard anchor attributes plus Link's own
1125
+ // props, but NO catch-all index signature. A wildcard string index signature
1126
+ // would silently accept non-public props (e.g. unstable_dynamicOnHover),
1127
+ // making a fixture's ts-expect-error on such a prop report as unused.
1128
+ export interface LinkProps
1129
+ extends Omit<AnchorHTMLAttributes<HTMLAnchorElement>, 'href'> {
1130
+ href: any
1131
+ // Next 16's public prefetch type. The unstable_forceStale value is
1132
+ // runtime-only and Next deliberately keeps it OUT of the public union, so an
1133
+ // exhaustive switch over prefetch ending in "prefetch satisfies never"
1134
+ // stays valid. Including it here would leave that value in the default
1135
+ // branch and break such fixtures under our shim.
1136
+ prefetch?: boolean | 'auto' | null
1137
+ scroll?: boolean
1138
+ replace?: boolean
1139
+ as?: any
1140
+ shallow?: boolean
1141
+ passHref?: boolean
1142
+ locale?: string | false
1143
+ legacyBehavior?: boolean
1144
+ onNavigate?: (event: { preventDefault(): void }) => void
1145
+ transitionTypes?: string[]
1146
+ children?: any
1147
+ }
1148
+ const Link: ComponentType<LinkProps>
1149
+ export default Link
1150
+ export function useLinkStatus(): { pending: boolean }
1151
+ }
1152
+
1153
+ declare module 'next/image' {
1154
+ import type { ComponentType } from 'react'
1155
+ export interface ImageProps {
1156
+ src: any
1157
+ alt: string
1158
+ width?: number | string
1159
+ height?: number | string
1160
+ fill?: boolean
1161
+ priority?: boolean
1162
+ loading?: 'lazy' | 'eager'
1163
+ placeholder?: string
1164
+ blurDataURL?: string
1165
+ unoptimized?: boolean
1166
+ sizes?: string
1167
+ quality?: number | string
1168
+ className?: string
1169
+ [key: string]: any
1170
+ }
1171
+ export interface StaticImageData {
1172
+ src: string
1173
+ height: number
1174
+ width: number
1175
+ blurDataURL?: string
1176
+ blurWidth?: number
1177
+ blurHeight?: number
1178
+ }
1179
+ const Image: ComponentType<ImageProps>
1180
+ export default Image
1181
+ export function getImageProps(props: ImageProps): { props: any }
1182
+ export function unstable_getImgProps(props: ImageProps): { props: any }
1183
+ }
1184
+
1185
+ declare module '@vercel/og' {
1186
+ export class ImageResponse extends Response {
1187
+ constructor(element: any, options?: any)
1188
+ }
1189
+ export type ImageResponseOptions = any
1190
+ }
1191
+
1192
+ declare module 'next/og' {
1193
+ export class ImageResponse extends Response {
1194
+ constructor(element: any, options?: any)
1195
+ static json(...args: any[]): ImageResponse
1196
+ }
1197
+ export interface ImageResponseOptions {
1198
+ width?: number
1199
+ height?: number
1200
+ fonts?: any[]
1201
+ debug?: boolean
1202
+ status?: number
1203
+ statusText?: string
1204
+ headers?: HeadersInit
1205
+ emoji?: string
1206
+ [key: string]: any
1207
+ }
1208
+ }
1209
+
1210
+ declare module 'next/dynamic' {
1211
+ import type { ComponentType } from 'react'
1212
+ export interface DynamicOptions {
1213
+ loading?: ComponentType<any>
1214
+ ssr?: boolean
1215
+ loadableGenerated?: any
1216
+ suspense?: boolean
1217
+ [key: string]: any
1218
+ }
1219
+ // Infer P from the loader like real next/dynamic's Loader<P>; a bare
1220
+ // Promise<any> loader would collapse P to any and strip prop types.
1221
+ type LoaderComponent<P> = ComponentType<P> | { default: ComponentType<P> }
1222
+ export default function dynamic<P = {}>(
1223
+ loader: (() => Promise<LoaderComponent<P>>) | Promise<LoaderComponent<P>>,
1224
+ options?: DynamicOptions,
1225
+ ): ComponentType<P>
1226
+ }
1227
+
1228
+ declare module 'next/error' {
1229
+ import type { ComponentType, ReactNode } from 'react'
1230
+ export interface ErrorInfo {
1231
+ error: Error
1232
+ reset: () => void
1233
+ unstable_retry: () => void
1234
+ [key: string]: any
1235
+ }
1236
+ export interface ErrorProps {
1237
+ statusCode: number
1238
+ title?: string
1239
+ withDarkMode?: boolean
1240
+ [key: string]: any
1241
+ }
1242
+ const ErrorComponent: ComponentType<ErrorProps>
1243
+ export default ErrorComponent
1244
+ // Wraps a fallback renderer (props, info) => JSX in an error boundary. The
1245
+ // returned component takes the fallback's own props plus children (the
1246
+ // guarded subtree) and an optional clearError reset callback. Mirrors the
1247
+ // runtime in src/compat/next/error.tsx.
1248
+ export function unstable_catchError<P extends Record<string, any> = any>(
1249
+ fallback: (props: P, info: ErrorInfo) => ReactNode,
1250
+ ): ComponentType<P & { children?: ReactNode; clearError?: () => void }>
1251
+ }
1252
+
1253
+ ${fontShims}
1254
+
1255
+ declare module 'next/script' {
1256
+ import type { ComponentType } from 'react'
1257
+ export interface ScriptProps {
1258
+ src?: string
1259
+ strategy?: 'afterInteractive' | 'lazyOnload' | 'beforeInteractive' | 'worker'
1260
+ onLoad?: (...args: any[]) => void
1261
+ onReady?: (...args: any[]) => void
1262
+ onError?: (...args: any[]) => void
1263
+ id?: string
1264
+ children?: any
1265
+ [key: string]: any
1266
+ }
1267
+ const Script: ComponentType<ScriptProps>
1268
+ export default Script
1269
+ }
1270
+
1271
+ declare module 'next/legacy/image' {
1272
+ import type { ComponentType } from 'react'
1273
+ export interface ImageProps {
1274
+ src: any
1275
+ alt?: string
1276
+ width?: number | string
1277
+ height?: number | string
1278
+ layout?: 'fixed' | 'intrinsic' | 'responsive' | 'fill'
1279
+ objectFit?: string
1280
+ objectPosition?: string
1281
+ priority?: boolean
1282
+ loading?: 'lazy' | 'eager'
1283
+ placeholder?: string
1284
+ blurDataURL?: string
1285
+ unoptimized?: boolean
1286
+ sizes?: string
1287
+ quality?: number | string
1288
+ [key: string]: any
1289
+ }
1290
+ const Image: ComponentType<ImageProps>
1291
+ export default Image
1292
+ }
1293
+
1294
+ ${rootParamsModule(rootParams)}
1295
+
1296
+ declare module 'next/web-vitals' {
1297
+ export interface NextWebVitalsMetric {
1298
+ id: string
1299
+ name: string
1300
+ startTime: number
1301
+ value: number
1302
+ label: 'web-vital' | 'custom'
1303
+ [key: string]: any
1304
+ }
1305
+ export function useReportWebVitals(reportFn: (metric: NextWebVitalsMetric) => void): void
1306
+ }
1307
+
1308
+ declare module 'next/dist/client/components/app-router-headers' {
1309
+ export const NEXT_RSC_UNION_QUERY: string
1310
+ export const RSC_HEADER: string
1311
+ export const NEXT_ROUTER_STATE_TREE_HEADER: string
1312
+ export const NEXT_ROUTER_PREFETCH_HEADER: string
1313
+ export const NEXT_URL: string
1314
+ const headers: Record<string, string>
1315
+ export default headers
1316
+ }
1317
+
1318
+ declare module 'next/dist/server/app-render/work-unit-async-storage.external' {
1319
+ export const workUnitAsyncStorage: {
1320
+ getStore(): any
1321
+ run<R>(store: any, callback: () => R): R
1322
+ }
1323
+ }
1324
+
1325
+ declare module 'next/dist/server/web/spec-extension/adapters/headers' {
1326
+ export class ReadonlyHeaders extends Headers {}
1327
+ }
1328
+
1329
+ declare module 'next/dist/server/web/spec-extension/adapters/request-cookies' {
1330
+ export interface ReadonlyRequestCookies {
1331
+ get(name: string): { name: string; value: string } | undefined
1332
+ getAll(name?: string): { name: string; value: string }[]
1333
+ has(name: string): boolean
1334
+ readonly size: number
1335
+ [Symbol.iterator](): IterableIterator<[string, { name: string; value: string }]>
1336
+ }
1337
+ }
1338
+
1339
+ declare module 'node-fetch' {
1340
+ export class Headers {
1341
+ get(name: string): string | null
1342
+ has(name: string): boolean
1343
+ set(name: string, value: string): void
1344
+ append(name: string, value: string): void
1345
+ delete(name: string): void
1346
+ forEach(callback: (value: string, name: string) => void): void
1347
+ [Symbol.iterator](): IterableIterator<[string, string]>
1348
+ }
1349
+ const fetch: (...args: any[]) => Promise<any>
1350
+ export default fetch
1351
+ }
1352
+
1353
+ declare module 'next/router' {
1354
+ export interface NextRouter {
1355
+ route: string
1356
+ pathname: string
1357
+ asPath: string
1358
+ query: Record<string, string | string[] | undefined>
1359
+ push(url: any, as?: any, options?: any): Promise<boolean>
1360
+ replace(url: any, as?: any, options?: any): Promise<boolean>
1361
+ prefetch(url: string): Promise<void>
1362
+ back(): void
1363
+ reload(): void
1364
+ beforePopState(callback: (...args: any[]) => boolean): void
1365
+ events: {
1366
+ on(type: string, handler: (...args: any[]) => void): void
1367
+ off(type: string, handler: (...args: any[]) => void): void
1368
+ emit(type: string, ...args: any[]): void
1369
+ }
1370
+ }
1371
+ export function useRouter(): NextRouter
1372
+ const router: NextRouter
1373
+ export default router
1374
+ }
1375
+
1376
+ declare module 'next/app' {
1377
+ // Pages-router shim: pnext builds the app directory only, but fixtures and
1378
+ // hybrid apps may carry a pages/ tree whose _app imports next/app. The type
1379
+ // program includes pages/**, so this keeps the typecheck from failing a
1380
+ // build over files pnext never bundles.
1381
+ export interface AppProps<P = any> {
1382
+ Component: (props: P) => any
1383
+ pageProps: P
1384
+ router?: any
1385
+ [key: string]: any
1386
+ }
1387
+ export type AppType = (props: AppProps) => any
1388
+ const App: AppType
1389
+ export default App
1390
+ }
1391
+
1392
+ declare module 'next/dist/client/components/navigation.js' {
1393
+ export interface NavigateOptions {
1394
+ scroll?: boolean
1395
+ }
1396
+ export interface PrefetchOptions {
1397
+ kind?: 'auto' | 'full'
1398
+ onInvalidate?: () => void
1399
+ }
1400
+ export interface AppRouterInstance {
1401
+ push(href: string, options?: NavigateOptions): void
1402
+ replace(href: string, options?: NavigateOptions): void
1403
+ prefetch(href: string, options?: PrefetchOptions): void
1404
+ refresh(): void
1405
+ back(): void
1406
+ forward(): void
1407
+ bfcacheId: string
1408
+ }
1409
+ export function useRouter(): AppRouterInstance
1410
+ export function notFound(): never
1411
+ }
1412
+
1413
+ declare module 'next/navigation' {
1414
+ export interface NavigateOptions {
1415
+ scroll?: boolean
1416
+ }
1417
+ export interface PrefetchOptions {
1418
+ kind?: 'auto' | 'full'
1419
+ onInvalidate?: () => void
1420
+ }
1421
+ export interface AppRouterInstance {
1422
+ push(href: string, options?: NavigateOptions): void
1423
+ replace(href: string, options?: NavigateOptions): void
1424
+ prefetch(href: string, options?: PrefetchOptions): void
1425
+ refresh(): void
1426
+ back(): void
1427
+ forward(): void
1428
+ bfcacheId: string
1429
+ }
1430
+ export function useRouter(): AppRouterInstance
1431
+ export function usePathname(): string
1432
+ export class ReadonlyURLSearchParams extends URLSearchParams {
1433
+ append(): never
1434
+ delete(): never
1435
+ set(): never
1436
+ sort(): never
1437
+ }
1438
+ export function useSearchParams(): ReadonlyURLSearchParams
1439
+ export function useParams<T = Record<string, string | string[]>>(): T
1440
+ export function useSelectedLayoutSegment(parallelRoutesKey?: string): string | null
1441
+ export function useSelectedLayoutSegments(parallelRoutesKey?: string): string[]
1442
+ export function useLayoutSegments(parallelRoutesKey?: string): string[]
1443
+ export function useLinkStatus(): { pending: boolean }
1444
+ export function unstable_isUnrecognizedActionError(error: unknown): boolean
1445
+ export const RedirectType: { push: 'push'; replace: 'replace' }
1446
+ export type RedirectType = 'push' | 'replace'
1447
+ export function notFound(): never
1448
+ export function forbidden(): never
1449
+ export function unauthorized(): never
1450
+ export function redirect(url: string, type?: RedirectType): never
1451
+ export function permanentRedirect(url: string, type?: RedirectType): never
1452
+ export function unstable_rethrow(error: unknown): void
1453
+ export function useServerInsertedHTML(callback: () => any): void
1454
+ }
1455
+
1456
+ declare module 'next/dist/shared/lib/app-router-context.shared-runtime.js' {
1457
+ export interface NavigateOptions {
1458
+ scroll?: boolean
1459
+ }
1460
+ export interface PrefetchOptions {
1461
+ kind?: 'auto' | 'full'
1462
+ onInvalidate?: () => void
1463
+ }
1464
+ export interface AppRouterInstance {
1465
+ push(href: string, options?: NavigateOptions): void
1466
+ replace(href: string, options?: NavigateOptions): void
1467
+ prefetch(href: string, options?: PrefetchOptions): void
1468
+ refresh(): void
1469
+ back(): void
1470
+ forward(): void
1471
+ bfcacheId: string
1472
+ }
1473
+ }
1474
+
1475
+ declare module 'next/dist/client/components/redirect-error.js' {
1476
+ export type RedirectType = 'replace' | 'push'
1477
+ }
1478
+
1479
+ declare module 'next/dist/client/form.js' {
1480
+ export interface FormProps {
1481
+ action: any
1482
+ }
1483
+ }
1484
+
1485
+ declare module 'next/form' {
1486
+ export interface FormProps {
1487
+ action: string | ((formData: FormData) => void | Promise<void>)
1488
+ replace?: boolean
1489
+ scroll?: boolean
1490
+ prefetch?: boolean
1491
+ [key: string]: any
1492
+ }
1493
+ export default function Form(props: FormProps): any
1494
+ }
1495
+
1496
+ declare module '*.module.css' {
1497
+ const classes: Record<string, string>
1498
+ export default classes
1499
+ }
1500
+
1501
+ declare module '*.module.scss' {
1502
+ const classes: Record<string, string>
1503
+ export default classes
1504
+ }
1505
+
1506
+ declare module '*.module.sass' {
1507
+ const classes: Record<string, string>
1508
+ export default classes
1509
+ }
1510
+
1511
+ declare module '*.css' {
1512
+ const href: string | undefined
1513
+ export default href
1514
+ }
1515
+
1516
+ declare module '*.scss' {
1517
+ const href: string | undefined
1518
+ export default href
1519
+ }
1520
+
1521
+ declare module '*.sass' {
1522
+ const href: string | undefined
1523
+ export default href
1524
+ }
1525
+
1526
+ declare module '*.png' {
1527
+ const content: { src: string; height: number; width: number; blurDataURL?: string }
1528
+ export default content
1529
+ }
1530
+
1531
+ declare module '*.jpg' {
1532
+ const content: { src: string; height: number; width: number; blurDataURL?: string }
1533
+ export default content
1534
+ }
1535
+
1536
+ declare module '*.jpeg' {
1537
+ const content: { src: string; height: number; width: number; blurDataURL?: string }
1538
+ export default content
1539
+ }
1540
+
1541
+ declare module '*.gif' {
1542
+ const content: { src: string; height: number; width: number; blurDataURL?: string }
1543
+ export default content
1544
+ }
1545
+
1546
+ declare module '*.svg' {
1547
+ // \`any\` (not the static-image descriptor shape used above) to avoid
1548
+ // conflicts with \`@svgr/webpack\`-style loader rules that import an SVG as
1549
+ // a component, matching Next's own image-types/global.d.ts.
1550
+ const content: any
1551
+ export default content
1552
+ }
1553
+
1554
+ declare module '*.webp' {
1555
+ const content: { src: string; height: number; width: number; blurDataURL?: string }
1556
+ export default content
1557
+ }
1558
+
1559
+ declare module '*.wasm' {
1560
+ const content: any
1561
+ export default content
1562
+ }
1563
+
1564
+ declare module '*.mdx' {
1565
+ const MDXComponent: (props: any) => any
1566
+ export default MDXComponent
1567
+ }
1568
+
1569
+ declare module '*.md' {
1570
+ const MDXComponent: (props: any) => any
1571
+ export default MDXComponent
1572
+ }
1573
+ ${loaderRuleAssetDeclarations()}`;
1574
+ return omitNextModuleShims ? stripNextModuleDeclarations(source) : source;
1575
+ }
1576
+ var STANDARD_ASSET_DECLARATIONS = /* @__PURE__ */ new Set([
1577
+ ".css",
1578
+ ".scss",
1579
+ ".sass",
1580
+ ".png",
1581
+ ".jpg",
1582
+ ".jpeg",
1583
+ ".gif",
1584
+ ".svg",
1585
+ ".webp",
1586
+ ".wasm",
1587
+ ".mdx",
1588
+ ".md"
1589
+ ]);
1590
+ var TS_RESOLVED_EXTENSIONS = /* @__PURE__ */ new Set([
1591
+ ".ts",
1592
+ ".tsx",
1593
+ ".mts",
1594
+ ".cts",
1595
+ ".d.ts",
1596
+ ".js",
1597
+ ".jsx",
1598
+ ".mjs",
1599
+ ".cjs",
1600
+ ".json"
1601
+ ]);
1602
+ function loaderRuleAssetDeclarations() {
1603
+ const specs = /* @__PURE__ */ new Set();
1604
+ for (const rule of turbopackLoaderRules()) {
1605
+ if (!rule.glob.startsWith("*")) continue;
1606
+ const ext = rule.glob.slice(1).toLowerCase();
1607
+ if (STANDARD_ASSET_DECLARATIONS.has(ext) || TS_RESOLVED_EXTENSIONS.has(ext)) continue;
1608
+ specs.add(rule.glob);
1609
+ }
1610
+ if (specs.size === 0) return "";
1611
+ return `${[...specs].map(
1612
+ (spec) => `
1613
+ declare module '${spec}' {
1614
+ const content: any
1615
+ export default content
1616
+ }`
1617
+ ).join("")}
1618
+ `;
1619
+ }
1620
+
1621
+ // ../node_modules/.bun/@wular+pnext@0.1.5+62547eec5a2188e3/node_modules/@wular/pnext/src/compat/register/typed-routes.ts
1622
+ function registerTypedRoutesExtensions(_config) {
1623
+ registerBuildSteps(runTypedRoutesBuildStep);
1624
+ }
1625
+ async function runTypedRoutesBuildStep(ctx) {
1626
+ if (!nextCompatEnabled(ctx.config)) return;
1627
+ if (!legacyRequestAPIs()) await writeTsconfigDefaults(ctx.config);
1628
+ await generateTypedRoutes(ctx.config, ctx.routes);
1629
+ if (typecheckDisabled()) return;
1630
+ const startedAt = performance.now();
1631
+ registerBuildParallelPhases({
1632
+ name: "Typecheck",
1633
+ run: validateTypesOffThread(ctx.config).then(() => performance.now() - startedAt)
1634
+ });
1635
+ }
1636
+
1637
+ // ../node_modules/.bun/@wular+pnext@0.1.5+62547eec5a2188e3/node_modules/@wular/pnext/src/compat/register/validation.ts
1638
+ var registered = false;
1639
+ onExtensionHostReset(() => registered = false);
1640
+ function registerValidationExtensions(config) {
1641
+ if (registered) return;
1642
+ if (!nextCompatEnabled(config)) return;
1643
+ registered = true;
1644
+ const step = async (ctx) => {
1645
+ if (!nextCompatEnabled(ctx.config)) return;
1646
+ await ctx.log.step(
1647
+ "validate build",
1648
+ () => Promise.resolve(validateBuild(ctx.config, ctx.routes))
1649
+ );
1650
+ };
1651
+ step.gate = true;
1652
+ registerBuildSteps(step);
1653
+ setBuildCompatExtensions({
1654
+ diagnoseCacheComponentsPrerender,
1655
+ diagnosticLeadsWithErrorLine,
1656
+ prerenderFailureFooter,
1657
+ recordBuildFlags: writeBuildFlags
1658
+ });
1659
+ }
1660
+
1661
+ // ../node_modules/.bun/@wular+pnext@0.1.5+62547eec5a2188e3/node_modules/@wular/pnext/src/compat/register/middleware.ts
1662
+ import path4 from "node:path";
1663
+ import { mkdir as mkdir4, writeFile as writeFile4 } from "node:fs/promises";
1664
+ import { fileURLToPath } from "node:url";
1665
+ function registerMiddlewareExtensions() {
1666
+ registerBuildSteps(async ({ config, routes }) => {
1667
+ if (!nextCompatEnabled(config)) return;
1668
+ const file = findProxyFile(config);
1669
+ let relative;
1670
+ if (file) {
1671
+ const href = await devServerModuleHref(config, file, "prod", {
1672
+ conditionTarget: "edge",
1673
+ externalLoadTarget: proxyExternalLoadTarget(file),
1674
+ reactServerLayer: true
1675
+ });
1676
+ relative = toPosixPath(path4.relative(config.outPath, fileURLToPath(href)));
1677
+ }
1678
+ await writeMiddlewareManifests(config, relative, routes);
1679
+ });
1680
+ }
1681
+ async function writeMiddlewareManifests(config, entryFile, routes = []) {
1682
+ const source = findProxyFile(config);
1683
+ const functions = edgeFunctionEntries(config, routes);
1684
+ if (!source || !entryFile) {
1685
+ if (Object.keys(functions).length === 0) return;
1686
+ const serverDir2 = path4.join(config.outPath, "server");
1687
+ await mkdir4(serverDir2, { recursive: true });
1688
+ await writeFile4(
1689
+ path4.join(serverDir2, "middleware-manifest.json"),
1690
+ `${JSON.stringify({ ...emptyMiddlewareManifest(), functions }, null, 2)}
1691
+ `
1692
+ );
1693
+ return;
1694
+ }
1695
+ const moduleFile = path4.resolve(config.outPath, entryFile);
1696
+ const module = await import(pathToFileHref(moduleFile));
1697
+ const matchers = manifestMatchers(module.config);
1698
+ const runtime = proxyRuntime(module.config);
1699
+ const entrypoint = toServerEntrypoint(entryFile);
1700
+ const serverDir = path4.join(config.outPath, "server");
1701
+ await mkdir4(serverDir, { recursive: true });
1702
+ if (runtime === "nodejs") {
1703
+ const functionsConfig = {
1704
+ version: 1,
1705
+ functions: { "/_middleware": { runtime: "nodejs", matchers } }
1706
+ };
1707
+ await writeFile4(
1708
+ path4.join(serverDir, "functions-config-manifest.json"),
1709
+ `${JSON.stringify(functionsConfig, null, 2)}
1710
+ `
1711
+ );
1712
+ await writeFile4(
1713
+ path4.join(serverDir, "middleware-manifest.json"),
1714
+ `${JSON.stringify({ ...emptyMiddlewareManifest(), functions }, null, 2)}
1715
+ `
1716
+ );
1717
+ return;
1718
+ }
1719
+ const entry = {
1720
+ name: "middleware",
1721
+ page: "/",
1722
+ matchers,
1723
+ wasm: readMiddlewareWasmBindingsForOutPath(config.outPath),
1724
+ assets: [],
1725
+ files: [entrypoint],
1726
+ entrypoint,
1727
+ env: {}
1728
+ };
1729
+ const manifest = {
1730
+ version: 3,
1731
+ sortedMiddleware: ["/"],
1732
+ middleware: { "/": entry },
1733
+ functions
1734
+ };
1735
+ await writeFile4(
1736
+ path4.join(serverDir, "middleware-manifest.json"),
1737
+ `${JSON.stringify(manifest, null, 2)}
1738
+ `
1739
+ );
1740
+ }
1741
+ function emptyMiddlewareManifest() {
1742
+ return { version: 3, sortedMiddleware: [], middleware: {}, functions: {} };
1743
+ }
1744
+ function edgeFunctionEntries(config, routes) {
1745
+ const entries = {};
1746
+ if (!config.appPath) return entries;
1747
+ for (const route of routes) {
1748
+ const runtime = route.segmentConfig?.runtime;
1749
+ if (runtime !== "edge" && runtime !== "experimental-edge") continue;
1750
+ const page = appManifestKey(config.appPath, route.file);
1751
+ if (!page) continue;
1752
+ const regions = preferredRegionForRoute(route);
1753
+ entries[page] = {
1754
+ files: [],
1755
+ name: `app${page}`,
1756
+ page,
1757
+ matchers: [{ regexp: `^${routeMatcherRegexp(route.route)}$`, originalSource: route.route }],
1758
+ wasm: [],
1759
+ assets: [],
1760
+ env: {},
1761
+ ...regions ? { regions } : {}
1762
+ };
1763
+ }
1764
+ return entries;
1765
+ }
1766
+ function appManifestKey(appPath, file) {
1767
+ const relative = toPosixPath(path4.relative(appPath, file));
1768
+ if (!relative || relative.startsWith("..")) return void 0;
1769
+ return `/${relative.replace(/\.[^./]+$/, "")}`;
1770
+ }
1771
+ function routeMatcherRegexp(route) {
1772
+ return route.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/:([^/\\]+)/g, "[^/]+");
1773
+ }
1774
+ function manifestMatchers(config) {
1775
+ const matcher = config?.matcher;
1776
+ if (!matcher) return [{ regexp: "^/.*$", originalSource: "/:path*" }];
1777
+ const list = Array.isArray(matcher) ? matcher : [matcher];
1778
+ return list.map((item) => {
1779
+ const originalSource = typeof item === "string" ? item : item.source;
1780
+ return { regexp: `^${matcherRegexp(originalSource)}$`, originalSource };
1781
+ });
1782
+ }
1783
+ function matcherRegexp(matcher) {
1784
+ if (matcher.includes("(")) return matcher;
1785
+ if (matcher === "/") return "/";
1786
+ let source = "";
1787
+ for (const segment of matcher.split("/").filter(Boolean)) {
1788
+ if (/^:[^/]+\*$/.test(segment)) source += "(?:/.*)?";
1789
+ else if (/^:[^/]+$/.test(segment)) source += "/[^/]+";
1790
+ else source += `/${segment.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}`;
1791
+ }
1792
+ return source || "/";
1793
+ }
1794
+ function proxyRuntime(config) {
1795
+ const runtime = config?.runtime;
1796
+ return runtime === "nodejs" ? "nodejs" : "edge";
1797
+ }
1798
+ function toServerEntrypoint(entryFile) {
1799
+ const posix = toPosixPath(entryFile).replace(/^\.?\//, "");
1800
+ const withinServer = posix.startsWith("server/") ? posix : `server/${path4.posix.basename(posix)}`;
1801
+ return withinServer.replace(/\.[^./]+$/, ".js");
1802
+ }
1803
+
1804
+ // ../node_modules/.bun/@wular+pnext@0.1.5+62547eec5a2188e3/node_modules/@wular/pnext/src/compat/metadata-artifacts.ts
1805
+ import { createRequire as createRequire2 } from "node:module";
1806
+ import { access, mkdir as mkdir5, readdir, readFile as readFile2, writeFile as writeFile5 } from "node:fs/promises";
1807
+ import path5 from "node:path";
1808
+ var foundGeistFontPath;
1809
+ async function emitMetadataRouteArtifacts(ctx) {
1810
+ if (!nextCompatEnabled(ctx.config)) return;
1811
+ const routes = ctx.manifest.routes.filter(
1812
+ (route) => route.kind === "handler" && route.metadataRoute !== void 0
1813
+ );
1814
+ if (routes.length === 0) return;
1815
+ const outPath = ctx.config.outPath;
1816
+ const outputRoots = Array.from(
1817
+ /* @__PURE__ */ new Set([
1818
+ outPath,
1819
+ path5.join(ctx.config.root, ".next"),
1820
+ path5.join(path5.dirname(outPath), ".next"),
1821
+ path5.resolve(process.cwd(), ".next")
1822
+ ])
1823
+ );
1824
+ const staticFiles = ctx.manifest.staticFiles ?? {};
1825
+ const routeFilesById = staticFilesByRouteId(staticFiles);
1826
+ const appDir = path5.join(ctx.config.root, ctx.config.appDir);
1827
+ const emittedRouteDirs = /* @__PURE__ */ new Set();
1828
+ for (const route of routes) {
1829
+ const nextPath = toAppPath(route, appDir);
1830
+ const routeDir = removeLeadingSlash(nextPath);
1831
+ emittedRouteDirs.add(routeDir);
1832
+ const fontPaths = route.metadataRoute?.kind === "opengraph-image" ? await resolveGeistFontFiles() : [];
1833
+ for (const root of outputRoots) {
1834
+ const routeModuleDir = path5.join(root, "server", "app", routeDir);
1835
+ await mkdir5(routeModuleDir, { recursive: true });
1836
+ await writeFile5(path5.join(routeModuleDir, "route.js"), routeJsModule(route), "utf8");
1837
+ await writeFile5(
1838
+ path5.join(routeModuleDir, "route_client-reference-manifest.js"),
1839
+ "self.__RSC_MANIFEST={}\n",
1840
+ "utf8"
1841
+ );
1842
+ await writeFile5(
1843
+ path5.join(routeModuleDir, "route.js.nft.json"),
1844
+ `${JSON.stringify(
1845
+ { version: 1, files: ["route_client-reference-manifest.js", ...fontPaths] },
1846
+ null,
1847
+ 2
1848
+ )}
1849
+ `,
1850
+ "utf8"
1851
+ );
1852
+ if (isForceDynamicRoute(route)) continue;
1853
+ const outputs = routeFilesById.get(route.id) ?? [];
1854
+ for (const relative of outputs) {
1855
+ await writeStaticMetadataArtifacts(outPath, root, relative, staticFiles[relative]);
1856
+ }
1857
+ }
1858
+ }
1859
+ await emitStaticMetadataRouteTraces(outputRoots, appDir, emittedRouteDirs);
1860
+ await writeAppPathsManifest(outputRoots, routes, appDir);
1861
+ await mergeMiddlewareFunctionsManifest(outputRoots, routes, appDir, ctx.manifest.routes);
1862
+ await writePrerenderManifests(outputRoots, ctx.manifest);
1863
+ }
1864
+ var prerenderAllowHeader = [
1865
+ "host",
1866
+ "x-matched-path",
1867
+ "x-prerender-revalidate",
1868
+ "x-prerender-revalidate-if-generated",
1869
+ "x-next-revalidated-tags",
1870
+ "x-next-revalidate-tag-token"
1871
+ ];
1872
+ var prerenderBypass = [
1873
+ { key: "next-action", type: "header" },
1874
+ { key: "content-type", type: "header", value: "multipart/form-data;.*" }
1875
+ ];
1876
+ async function writePrerenderManifests(outputRoots, manifest) {
1877
+ const byId = new Map(manifest.routes.map((route) => [route.id, route]));
1878
+ const entries = {};
1879
+ for (const [relative, metadata] of Object.entries(manifest.staticFiles ?? {})) {
1880
+ const route = metadata.routeId ? byId.get(metadata.routeId) : void 0;
1881
+ if (route && isEdgeRoute(route)) continue;
1882
+ const pathname = staticFilePathname(relative);
1883
+ entries[pathname] = prerenderEntry(pathname, metadata, route);
1884
+ }
1885
+ for (const route of manifest.routes) {
1886
+ for (const generated of route.metadataRoute?.generatedRoutes ?? []) {
1887
+ if (entries[generated] || isEdgeRoute(route) || route.usesRequest) continue;
1888
+ entries[generated] = prerenderEntry(generated, void 0, route);
1889
+ }
1890
+ if (entries[route.route] || !isStaticPrerenderRoute(route)) continue;
1891
+ entries[route.route] = prerenderEntry(route.route, void 0, route);
1892
+ }
1893
+ for (const root of outputRoots) {
1894
+ const file = path5.join(root, "prerender-manifest.json");
1895
+ const existing = await readJsonManifest(file);
1896
+ await mkdir5(path5.dirname(file), { recursive: true });
1897
+ await writeFile5(
1898
+ file,
1899
+ `${JSON.stringify(
1900
+ {
1901
+ version: 4,
1902
+ routes: { ...existing?.routes ?? {}, ...entries },
1903
+ dynamicRoutes: existing?.dynamicRoutes ?? {},
1904
+ notFoundRoutes: existing?.notFoundRoutes ?? [],
1905
+ preview: existing?.preview ?? {
1906
+ previewModeId: "pnext-preview-id",
1907
+ previewModeSigningKey: "pnext-preview-signing-key",
1908
+ previewModeEncryptionKey: "pnext-preview-encryption-key"
1909
+ }
1910
+ },
1911
+ null,
1912
+ 2
1913
+ )}
1914
+ `
1915
+ );
1916
+ }
1917
+ }
1918
+ function staticFilePathname(relative) {
1919
+ if (relative === "index.html") return "/";
1920
+ if (relative.endsWith("/index.html")) return `/${relative.slice(0, -"/index.html".length)}`;
1921
+ if (relative.endsWith(".html")) return `/${relative.slice(0, -".html".length)}`;
1922
+ return `/${relative}`;
1923
+ }
1924
+ function isStaticPrerenderRoute(route) {
1925
+ if (route.mode !== "static" || route.usesRequest || isEdgeRoute(route)) return false;
1926
+ if (route.kind === "page") return route.params.length === 0 && !route.catchAll;
1927
+ return route.kind === "handler" && route.metadataRoute !== void 0 && route.params.length === 0;
1928
+ }
1929
+ function isEdgeRoute(route) {
1930
+ return route.segmentConfig?.runtime === "edge" || route.segmentConfig?.runtime === "experimental-edge";
1931
+ }
1932
+ function prerenderEntry(pathname, metadata, route) {
1933
+ return {
1934
+ initialRevalidateSeconds: metadata?.revalidateSeconds ?? false,
1935
+ srcRoute: route?.route ?? pathname,
1936
+ dataRoute: pathname === "/" ? "/index.rsc" : `${pathname}.rsc`,
1937
+ allowHeader: prerenderAllowHeader,
1938
+ experimentalBypassFor: prerenderBypass
1939
+ };
1940
+ }
1941
+ function staticFilesByRouteId(staticFiles) {
1942
+ const routeFilesById = /* @__PURE__ */ new Map();
1943
+ for (const [relative, metadata] of Object.entries(staticFiles)) {
1944
+ if (!metadata.routeId) continue;
1945
+ const existing = routeFilesById.get(metadata.routeId) ?? [];
1946
+ existing.push(relative);
1947
+ routeFilesById.set(metadata.routeId, existing);
1948
+ }
1949
+ return routeFilesById;
1950
+ }
1951
+ async function emitStaticMetadataRouteTraces(outputRoots, appDir, emittedRouteDirs) {
1952
+ for (const file of discoverStaticMetadataFiles(appDir)) {
1953
+ const routeDir = file.outputPath;
1954
+ if (emittedRouteDirs.has(routeDir)) continue;
1955
+ for (const root of outputRoots) {
1956
+ const dir = path5.join(root, "server", "app", routeDir);
1957
+ await mkdir5(dir, { recursive: true });
1958
+ await writeFile5(path5.join(dir, "route.js"), "export default {}\n", "utf8");
1959
+ await writeFile5(
1960
+ path5.join(dir, "route.js.nft.json"),
1961
+ `${JSON.stringify({ version: 1, files: [] }, null, 2)}
1962
+ `,
1963
+ "utf8"
1964
+ );
1965
+ }
1966
+ }
1967
+ }
1968
+ async function writeAppPathsManifest(outputRoots, routes, appDir) {
1969
+ const nextEntries = {};
1970
+ for (const route of routes) {
1971
+ const appPath = toAppPath(route, appDir);
1972
+ const key = `${appPath}/route`;
1973
+ nextEntries[key] = `app${appPath}/route.js`;
1974
+ }
1975
+ for (const root of outputRoots) {
1976
+ const manifestPath = path5.join(root, "server", "app-paths-manifest.json");
1977
+ const existing = await readJsonManifest(manifestPath) ?? {};
1978
+ await mkdir5(path5.dirname(manifestPath), { recursive: true });
1979
+ await writeFile5(manifestPath, `${JSON.stringify({ ...existing, ...nextEntries }, null, 2)}
1980
+ `);
1981
+ }
1982
+ }
1983
+ async function mergeMiddlewareFunctionsManifest(outputRoots, routes, appDir, allRoutes) {
1984
+ const edgeRoutes = routes.filter(
1985
+ (route) => route.segmentConfig?.runtime === "edge" || route.segmentConfig?.runtime === "experimental-edge"
1986
+ );
1987
+ const edgePages = allRoutes.filter((route) => route.kind === "page" && isEdgeRoute(route));
1988
+ if (edgeRoutes.length === 0 && edgePages.length === 0) return;
1989
+ const routeEntries = edgeRoutes.map((route) => ({
1990
+ route: `${toAppPath(route, appDir)}/route`,
1991
+ value: {}
1992
+ }));
1993
+ const sharedImageChunk = "server/edge-chunks/image-response.js";
1994
+ const hasImageResponseRoute = routes.some(
1995
+ (route) => ["opengraph-image", "twitter-image", "apple-icon", "icon"].includes(
1996
+ route.metadataRoute?.kind ?? ""
1997
+ )
1998
+ );
1999
+ for (const root of outputRoots) {
2000
+ const manifestPath = path5.join(root, "server", "middleware-manifest.json");
2001
+ const manifest = await readJsonManifest(manifestPath);
2002
+ const target = {
2003
+ version: 3,
2004
+ sortedMiddleware: [],
2005
+ middleware: {},
2006
+ functions: {},
2007
+ ...manifest ?? {}
2008
+ };
2009
+ target.functions = target.functions ?? {};
2010
+ for (const { route, value } of routeEntries) {
2011
+ target.functions[route] = target.functions[route] ?? value;
2012
+ }
2013
+ if (hasImageResponseRoute && edgePages.length > 0) {
2014
+ const chunkPath = path5.join(root, sharedImageChunk);
2015
+ await mkdir5(path5.dirname(chunkPath), { recursive: true });
2016
+ await writeFile5(chunkPath, "export const loadAdditionalAsset = true\n");
2017
+ for (const page of edgePages) {
2018
+ const key = page.route === "/" ? "/page" : `${page.route}/page`;
2019
+ target.functions[key] = { files: [sharedImageChunk] };
2020
+ }
2021
+ }
2022
+ await mkdir5(path5.dirname(manifestPath), { recursive: true });
2023
+ await writeFile5(manifestPath, `${JSON.stringify(target, null, 2)}
2024
+ `);
2025
+ }
2026
+ }
2027
+ function isForceDynamicRoute(route) {
2028
+ return route.segmentConfig?.dynamic === "force-dynamic";
2029
+ }
2030
+ function toRouteMeta(metadata) {
2031
+ const headers = {};
2032
+ for (const [name, value] of metadata.headers ?? []) {
2033
+ headers[name.toLowerCase()] = value;
2034
+ }
2035
+ return {
2036
+ status: metadata.status,
2037
+ headers
2038
+ };
2039
+ }
2040
+ async function writeStaticMetadataArtifacts(outPath, root, relative, metadata) {
2041
+ if (!metadata) return;
2042
+ const source = path5.join(outPath, "public", relative);
2043
+ const outputBase = path5.join(root, "server", "app", toPosixPath(relative));
2044
+ await mkdir5(path5.dirname(outputBase), { recursive: true });
2045
+ const routeMeta = JSON.stringify(toRouteMeta(metadata));
2046
+ await writeFile5(`${outputBase}.meta`, routeMeta, "utf8");
2047
+ try {
2048
+ await access(source);
2049
+ } catch {
2050
+ return;
2051
+ }
2052
+ await writeFile5(`${outputBase}.body`, await readFile2(source));
2053
+ }
2054
+ function routeJsModule(route) {
2055
+ const runtime = route.segmentConfig?.runtime ?? "nodejs";
2056
+ const data = JSON.stringify({
2057
+ segmentConfig: route.segmentConfig ?? null,
2058
+ runtime,
2059
+ metadataRoute: route.metadataRoute?.kind,
2060
+ route: route.route
2061
+ });
2062
+ return `export default ${data}
2063
+ `;
2064
+ }
2065
+ function toAppPath(route, appDir) {
2066
+ const generated = route.metadataRoute?.generatedParam;
2067
+ const normalized = route.route.replace(/^\/+|\/+$/g, "");
2068
+ const fileSegments = routeFileGroups(route.file, appDir);
2069
+ const routeSegments = normalized.length > 0 ? normalized.split("/") : [];
2070
+ const converted = routeSegments.map((segment) => routeSegmentToNextPath(segment, generated));
2071
+ const nextPathSegments = [...fileSegments, ...converted];
2072
+ return `/${nextPathSegments.join("/")}`;
2073
+ }
2074
+ function routeSegmentToNextPath(segment, generatedParam) {
2075
+ const match = /^:([^*.]+)(\*)?(\..*)?$/.exec(segment);
2076
+ if (!match) return segment;
2077
+ const name = match[1] ?? "";
2078
+ const star = match[2] ? "..." : "";
2079
+ const suffix = match[3] ?? "";
2080
+ const key = generatedParam && name === "id" ? generatedParam : name;
2081
+ return `[${star}${key}]${generatedParam && name === "id" ? "" : suffix}`;
2082
+ }
2083
+ function routeFileGroups(file, appDir) {
2084
+ const relative = toPosixPath(path5.relative(appDir, file));
2085
+ const parts = relative.split("/").filter(Boolean);
2086
+ const withoutLeaf = parts.slice(0, -1);
2087
+ const groups = [];
2088
+ for (const segment of withoutLeaf) {
2089
+ if (!segment.startsWith("(") || !segment.endsWith(")")) break;
2090
+ groups.push(segment);
2091
+ }
2092
+ return groups;
2093
+ }
2094
+ function removeLeadingSlash(pathValue) {
2095
+ return pathValue.replace(/^\//, "");
2096
+ }
2097
+ async function readJsonManifest(filePath) {
2098
+ try {
2099
+ const raw = await readFile2(filePath, "utf8");
2100
+ return JSON.parse(raw);
2101
+ } catch {
2102
+ return void 0;
2103
+ }
2104
+ }
2105
+ async function resolveGeistFontFiles() {
2106
+ if (foundGeistFontPath) return [foundGeistFontPath];
2107
+ const req = createRequire2(process.cwd() + "/");
2108
+ const candidateRoots = resolveVercelOgRoots(req);
2109
+ for (const root of candidateRoots) {
2110
+ const files = await findFiles(root, "Geist-Regular.ttf");
2111
+ if (files.length === 0) continue;
2112
+ foundGeistFontPath = files[0];
2113
+ return files.slice(0, 1);
2114
+ }
2115
+ return [];
2116
+ }
2117
+ function resolveVercelOgRoots(req) {
2118
+ const roots = [];
2119
+ for (const spec of ["@vercel/og/package.json", "next/package.json"]) {
2120
+ try {
2121
+ roots.push(path5.dirname(req.resolve(spec)));
2122
+ } catch {
2123
+ }
2124
+ }
2125
+ return roots;
2126
+ }
2127
+ async function findFiles(root, targetName) {
2128
+ const found = [];
2129
+ const stack = [root];
2130
+ const maxDepth = 6;
2131
+ while (stack.length > 0) {
2132
+ const current = stack.pop();
2133
+ if (!current) continue;
2134
+ const normalizedRoot = root.replace(/\\/g, "/");
2135
+ const normalizedCurrent = current.replace(/\\/g, "/");
2136
+ if (normalizedCurrent.includes(`${path5.sep}.next${path5.sep}`) || normalizedCurrent.includes(`${path5.sep}.git${path5.sep}`) || normalizedCurrent.includes(`${path5.sep}node_modules${path5.sep}.cache${path5.sep}`)) {
2137
+ continue;
2138
+ }
2139
+ const depth = normalizedCurrent.split("/").length;
2140
+ if (depth > normalizedRoot.split("/").length + maxDepth) continue;
2141
+ let entries;
2142
+ try {
2143
+ entries = await readdir(current, { withFileTypes: true });
2144
+ } catch {
2145
+ continue;
2146
+ }
2147
+ for (const entry of entries) {
2148
+ const child = path5.join(current, entry.name);
2149
+ if (entry.isDirectory()) {
2150
+ stack.push(child);
2151
+ continue;
2152
+ }
2153
+ if (entry.isFile() && entry.name === targetName) {
2154
+ found.push(child);
2155
+ }
2156
+ }
2157
+ }
2158
+ return found;
2159
+ }
2160
+
2161
+ // ../node_modules/.bun/@wular+pnext@0.1.5+62547eec5a2188e3/node_modules/@wular/pnext/src/compat/export/emit.ts
2162
+ import { copyFile, mkdir as mkdir7, readFile as readFile3, rm as rm2, writeFile as writeFile7 } from "node:fs/promises";
2163
+ import path7 from "node:path";
2164
+
2165
+ // ../node_modules/.bun/@wular+pnext@0.1.5+62547eec5a2188e3/node_modules/@wular/pnext/src/compat/export/standalone.ts
2166
+ import { existsSync as existsSync3, readFileSync as readFileSync2 } from "node:fs";
2167
+ import { mkdir as mkdir6, rm, writeFile as writeFile6 } from "node:fs/promises";
2168
+ import path6 from "node:path";
2169
+ var ENTRY_FILE = /(?:^|[\\/])(page|route)\.(?:js|jsx|ts|tsx|mjs|cjs)$/;
2170
+ async function emitStandalone({
2171
+ config,
2172
+ manifest,
2173
+ log
2174
+ }) {
2175
+ await log.step("standalone output", () => writeStandalone(config, manifest));
2176
+ }
2177
+ async function writeStandalone(config, manifest) {
2178
+ const standaloneDir = path6.join(config.root, ".next", "standalone");
2179
+ await rm(standaloneDir, { recursive: true, force: true });
2180
+ await mkdir6(standaloneDir, { recursive: true });
2181
+ await writeServerEntry(config, standaloneDir);
2182
+ await writeTraceFiles(config, standaloneDir);
2183
+ await writeMiddlewareManifest(manifest, standaloneDir);
2184
+ }
2185
+ async function writeServerEntry(config, standaloneDir) {
2186
+ await writeFile6(
2187
+ path6.join(standaloneDir, "package.json"),
2188
+ `${JSON.stringify({ name: "pnext-standalone", version: "0.0.0", type: "commonjs", private: true }, null, 2)}
2189
+ `
2190
+ );
2191
+ await writeFile6(path6.join(standaloneDir, "server.js"), standaloneServerSource(config));
2192
+ }
2193
+ function standaloneServerSource(config) {
2194
+ const cliPath = path6.resolve((__pnextRoot + "/src/compat/export"), "..", "..", "cli", "index.ts");
2195
+ return `'use strict';
2196
+ // pnext standalone launcher. Generated by pnext build; see
2197
+ // src/compat/export/standalone.ts. Spawned as \`node server.js\` from the moved
2198
+ // standalone directory; re-execs the real pnext server under Bun.
2199
+ const { spawn } = require('node:child_process');
2200
+
2201
+ const PNEXT_CLI = ${JSON.stringify(cliPath)};
2202
+ const PNEXT_ROOT = ${JSON.stringify(config.root)};
2203
+ const port = String(process.env.PORT || '3000');
2204
+ const hostname = process.env.HOSTNAME || '0.0.0.0';
2205
+
2206
+ const child = spawn(
2207
+ 'bun',
2208
+ ['--conditions=react-server', PNEXT_CLI, 'start', '--port', port, '--hostname', hostname],
2209
+ {
2210
+ cwd: PNEXT_ROOT,
2211
+ env: {
2212
+ ...process.env,
2213
+ // Suppresses \`pnext start\`'s "output: standalone" warning (Next gates the
2214
+ // same warning on this private env being set by its standalone server).
2215
+ __NEXT_PRIVATE_STANDALONE_CONFIG: '1',
2216
+ PNEXT_COMPAT: 'next',
2217
+ BROWSER: 'none',
2218
+ NODE_ENV: 'production',
2219
+ PORT: port,
2220
+ HOSTNAME: hostname,
2221
+ },
2222
+ stdio: ['ignore', 'inherit', 'inherit'],
2223
+ }
2224
+ );
2225
+
2226
+ child.on('error', (error) => {
2227
+ console.error('pnext standalone: failed to start the pnext server:', error);
2228
+ process.exit(1);
2229
+ });
2230
+ child.on('exit', (code, signal) => {
2231
+ process.exit(code == null ? (signal ? 1 : 0) : code);
2232
+ });
2233
+
2234
+ for (const signal of ['SIGINT', 'SIGTERM']) {
2235
+ process.on(signal, () => {
2236
+ if (child.exitCode === null) child.kill(signal);
2237
+ });
2238
+ }
2239
+ `;
2240
+ }
2241
+ async function writeTraceFiles(config, standaloneDir) {
2242
+ const serverDir = path6.join(standaloneDir, ".next", "server");
2243
+ await emitTracesFor(path6.join(config.root, "app"), path6.join(serverDir, "app"));
2244
+ await emitTracesFor(path6.join(config.root, "src", "app"), path6.join(serverDir, "app"));
2245
+ await emitTracesFor(path6.join(config.root, "pages"), path6.join(serverDir, "pages"));
2246
+ await emitTracesFor(path6.join(config.root, "src", "pages"), path6.join(serverDir, "pages"));
2247
+ }
2248
+ async function writeMiddlewareManifest(manifest, standaloneDir) {
2249
+ const functions = {};
2250
+ for (const route of manifest.routes) {
2251
+ if (!isEdgeRoute2(route)) continue;
2252
+ const page = route.route || "/";
2253
+ functions[page] = {
2254
+ files: [],
2255
+ name: `edge${page === "/" ? "/index" : page}`,
2256
+ page,
2257
+ matchers: [{ regexp: `^${escapeRouteRegexp(page)}$`, originalSource: page }],
2258
+ wasm: [],
2259
+ assets: [],
2260
+ env: {}
2261
+ };
2262
+ }
2263
+ if (Object.keys(functions).length === 0) return;
2264
+ const serverDir = path6.join(standaloneDir, ".next", "server");
2265
+ await mkdir6(serverDir, { recursive: true });
2266
+ await writeFile6(
2267
+ path6.join(serverDir, "middleware-manifest.json"),
2268
+ `${JSON.stringify({ version: 3, sortedMiddleware: [], middleware: {}, functions }, null, 2)}
2269
+ `
2270
+ );
2271
+ }
2272
+ function isEdgeRoute2(route) {
2273
+ const runtime = route.segmentConfig?.runtime;
2274
+ if (runtime === "edge" || runtime === "experimental-edge") return true;
2275
+ for (const file of [route.file, ...route.sourceFiles ?? []]) {
2276
+ if (!file || !existsSync3(file)) continue;
2277
+ let source;
2278
+ try {
2279
+ source = readFileSync2(file, "utf8");
2280
+ } catch {
2281
+ continue;
2282
+ }
2283
+ if (/\bruntime\s*:\s*['"](?:edge|experimental-edge)['"]/.test(source)) return true;
2284
+ if (/export\s+const\s+runtime\s*=\s*['"](?:edge|experimental-edge)['"]/.test(source))
2285
+ return true;
2286
+ }
2287
+ return false;
2288
+ }
2289
+ function escapeRouteRegexp(route) {
2290
+ return route.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/:([^/\\]+)/g, "[^/]+");
2291
+ }
2292
+ async function emitTracesFor(sourceDir, targetDir) {
2293
+ if (!existsSync3(sourceDir)) return;
2294
+ for (const file of await listFiles(sourceDir)) {
2295
+ const match = ENTRY_FILE.exec(file);
2296
+ if (!match) continue;
2297
+ const relative = toPosixPath(path6.relative(sourceDir, file));
2298
+ const relativeDir = path6.posix.dirname(relative);
2299
+ const dir = path6.join(targetDir, ...relativeDir === "." ? [] : relativeDir.split("/"));
2300
+ await mkdir6(dir, { recursive: true });
2301
+ await writeFile6(
2302
+ path6.join(dir, `${match[1]}.js.nft.json`),
2303
+ `${JSON.stringify({ version: 1, files: [] })}
2304
+ `
2305
+ );
2306
+ }
2307
+ }
2308
+
2309
+ // ../node_modules/.bun/@wular+pnext@0.1.5+62547eec5a2188e3/node_modules/@wular/pnext/src/compat/export/emit.ts
2310
+ var BUILD_ID = "pnext";
2311
+ var COMMON_SEGMENTS = ["_full", "_head", "_index", "_tree"];
2312
+ var RUNTIME_ASSET_DIR = "_next/static/chunks";
2313
+ var EXPORT_MODE_SCRIPT = "<script>window.__PNEXT_OUTPUT_EXPORT__=true;</script>";
2314
+ async function emitStaticExport({ config, manifest, log }) {
2315
+ await log.step("build manifest", () => writeBuildManifests(path7.join(config.outPath, "public")));
2316
+ const output = getNextConfig().output;
2317
+ if (output === "standalone") {
2318
+ await emitStandalone({ config, manifest, log });
2319
+ return;
2320
+ }
2321
+ if (output !== "export") return;
2322
+ await log.step("static export", () => writeExportTree(config, manifest));
2323
+ }
2324
+ async function writeExportTree(config, manifest) {
2325
+ const outDir = exportOutDir(config);
2326
+ await rm2(outDir, { recursive: true, force: true });
2327
+ await mkdir7(outDir, { recursive: true });
2328
+ const assets = await copyRuntimeAssets(config, outDir);
2329
+ await copyPublicTree(config, outDir, assets);
2330
+ await writeBuildManifests(outDir);
2331
+ const pages = exportPages(config, manifest);
2332
+ for (const page of pages) await writePageArtifacts(page, assets);
2333
+ await writeNotFoundArtifacts(config, outDir);
2334
+ }
2335
+ async function copyRuntimeAssets(config, outDir) {
2336
+ const assetsDir = path7.join(config.outPath, "public", "assets");
2337
+ const assets = /* @__PURE__ */ new Set();
2338
+ for (const file of await listFiles(assetsDir)) {
2339
+ const relative = toPosixPath(path7.relative(assetsDir, file));
2340
+ assets.add(relative);
2341
+ const target = path7.join(outDir, ...RUNTIME_ASSET_DIR.split("/"), ...relative.split("/"));
2342
+ await mkdir7(path7.dirname(target), { recursive: true });
2343
+ await copyFile(file, target);
2344
+ }
2345
+ return assets;
2346
+ }
2347
+ async function copyPublicTree(config, outDir, assets) {
2348
+ const publicDir = path7.join(config.outPath, "public");
2349
+ for (const file of await listFiles(publicDir)) {
2350
+ const relative = toPosixPath(path7.relative(publicDir, file));
2351
+ if (relative.startsWith("assets/")) continue;
2352
+ const target = path7.join(outDir, ...relative.split("/"));
2353
+ await mkdir7(path7.dirname(target), { recursive: true });
2354
+ if (relative.endsWith(".html")) {
2355
+ await writeFile7(target, exportDocument(await readFile3(file, "utf8"), assets));
2356
+ } else {
2357
+ await copyFile(file, target);
2358
+ }
2359
+ }
2360
+ }
2361
+ function exportDocument(html, assets) {
2362
+ const repointed = html.replace(
2363
+ /\/_next\/static\/([^"'`\s<>)?#]+)([?#][^"'`\s<>]*)?/g,
2364
+ (match, rest, suffix) => assets.has(rest) ? `/${RUNTIME_ASSET_DIR}/${rest}${suffix ?? ""}` : match
2365
+ );
2366
+ const anchor = /<head[^>]*>|<body[^>]*>/.exec(repointed);
2367
+ if (!anchor) return EXPORT_MODE_SCRIPT + repointed;
2368
+ const at = anchor.index + anchor[0].length;
2369
+ return `${repointed.slice(0, at)}${EXPORT_MODE_SCRIPT}${repointed.slice(at)}`;
2370
+ }
2371
+ async function writeBuildManifests(outDir) {
2372
+ const dir = path7.join(outDir, "_next", "static", BUILD_ID);
2373
+ await mkdir7(dir, { recursive: true });
2374
+ await writeFile7(
2375
+ path7.join(dir, "_buildManifest.js"),
2376
+ "self.__BUILD_MANIFEST={};self.__BUILD_MANIFEST_CB&&self.__BUILD_MANIFEST_CB();\n"
2377
+ );
2378
+ await writeFile7(path7.join(dir, "_ssgManifest.js"), "self.__SSG_MANIFEST=new Set();\n");
2379
+ }
2380
+ function exportOutDir(config) {
2381
+ const distDir = getNextConfig().distDir;
2382
+ const dir = typeof distDir === "string" && distDir.length > 0 && distDir !== ".next" ? distDir : "out";
2383
+ return path7.resolve(config.root, dir);
2384
+ }
2385
+ function exportPages(config, manifest) {
2386
+ const staticFiles = manifest.staticFiles ?? {};
2387
+ const routeById = new Map(manifest.routes.map((route) => [route.id, route]));
2388
+ const pages = [];
2389
+ for (const [relative, metadata] of Object.entries(staticFiles)) {
2390
+ if (metadata.kind !== "page" || !relative.endsWith(".html")) continue;
2391
+ const route = metadata.routeId ? routeById.get(metadata.routeId) : void 0;
2392
+ if (route?.kind !== "page") continue;
2393
+ const htmlFile = path7.join(config.outPath, "public", ...relative.split("/"));
2394
+ pages.push({
2395
+ route,
2396
+ htmlFile,
2397
+ ...exportPathsForHtml(config, relative)
2398
+ });
2399
+ }
2400
+ return pages.sort((a, b) => a.outHtml.localeCompare(b.outHtml));
2401
+ }
2402
+ function exportPathsForHtml(config, relative) {
2403
+ const outDir = exportOutDir(config);
2404
+ const normalized = toPosixPath(relative);
2405
+ if (normalized === "index.html") {
2406
+ return {
2407
+ outHtml: path7.join(outDir, "index.html"),
2408
+ outPageTxt: path7.join(outDir, "index.txt"),
2409
+ segmentDir: outDir
2410
+ };
2411
+ }
2412
+ if (normalized.endsWith("/index.html")) {
2413
+ const routePath2 = normalized.slice(0, -"/index.html".length);
2414
+ return {
2415
+ outHtml: path7.join(outDir, ...normalized.split("/")),
2416
+ outPageTxt: path7.join(outDir, ...routePath2.split("/"), "index.txt"),
2417
+ segmentDir: path7.join(outDir, ...routePath2.split("/"))
2418
+ };
2419
+ }
2420
+ const routePath = normalized.slice(0, -".html".length);
2421
+ return {
2422
+ outHtml: path7.join(outDir, ...normalized.split("/")),
2423
+ outPageTxt: path7.join(outDir, `${routePath}.txt`),
2424
+ segmentDir: path7.join(outDir, ...routePath.split("/"))
2425
+ };
2426
+ }
2427
+ async function writePageArtifacts(page, assets) {
2428
+ const html = exportDocument(await readFile3(page.htmlFile, "utf8"), assets);
2429
+ await mkdir7(path7.dirname(page.outPageTxt), { recursive: true });
2430
+ await writeFile7(page.outPageTxt, html);
2431
+ await writeSegmentFiles(page.segmentDir, page.route, html);
2432
+ }
2433
+ async function writeSegmentFiles(segmentDir2, route, body) {
2434
+ await mkdir7(segmentDir2, { recursive: true });
2435
+ for (const segment of COMMON_SEGMENTS) {
2436
+ await writeFile7(path7.join(segmentDir2, `__next.${segment}.txt`), body);
2437
+ }
2438
+ const keys = segmentKeys(route);
2439
+ const leaf = keys.at(-1) ?? "";
2440
+ await writeFile7(
2441
+ path7.join(segmentDir2, leaf ? `__next.${leaf}.__PAGE__.txt` : "__next.__PAGE__.txt"),
2442
+ body
2443
+ );
2444
+ if (leaf) await writeFile7(path7.join(segmentDir2, `__next.${leaf}.txt`), body);
2445
+ for (const key of keys.slice(0, -1)) {
2446
+ if (key) await writeFile7(path7.join(segmentDir2, `__next.${key}.txt`), body);
2447
+ }
2448
+ }
2449
+ function segmentKeys(route) {
2450
+ const params = new Set(route.params);
2451
+ const parts = route.route.replace(/^\/|\/$/g, "").split("/").filter(Boolean).map((part) => part.startsWith(":") ? `$d$${part.replace(/^:|[*?]$/g, "")}` : part);
2452
+ if (parts.length === 0) return [""];
2453
+ const keys = [];
2454
+ for (const [index, part] of parts.entries()) {
2455
+ const key = part.startsWith("$d$") && !params.has(part.slice(3)) ? part.slice(3) : part;
2456
+ keys.push([...parts.slice(0, index), key].join("."));
2457
+ }
2458
+ return keys;
2459
+ }
2460
+ async function writeNotFoundArtifacts(config, outDir) {
2461
+ const htmlFile = path7.join(outDir, "404.html");
2462
+ const html = await readFile3(htmlFile, "utf8").catch(() => void 0);
2463
+ if (html === void 0) return;
2464
+ if (config.trailingSlash === true) {
2465
+ const nested = path7.join(outDir, "404", "index.html");
2466
+ await mkdir7(path7.dirname(nested), { recursive: true });
2467
+ await writeFile7(nested, html);
2468
+ }
2469
+ const outHtml = config.trailingSlash === true ? path7.join(outDir, "_not-found", "index.html") : path7.join(outDir, "_not-found.html");
2470
+ const outTxt = config.trailingSlash === true ? path7.join(outDir, "_not-found", "index.txt") : path7.join(outDir, "_not-found.txt");
2471
+ await mkdir7(path7.dirname(outHtml), { recursive: true });
2472
+ await writeFile7(outHtml, html);
2473
+ await writeFile7(outTxt, html);
2474
+ await writeSegmentFiles(
2475
+ path7.join(outDir, "_not-found"),
2476
+ { route: "/_not-found", params: [] },
2477
+ html
2478
+ );
2479
+ }
2480
+
2481
+ // ../node_modules/.bun/@wular+pnext@0.1.5+62547eec5a2188e3/node_modules/@wular/pnext/src/compat/next/custom-server.ts
2482
+ import { existsSync as existsSync4, lstatSync, readFileSync as readFileSync3 } from "node:fs";
2483
+ import { mkdir as mkdir8, rm as rm3, writeFile as writeFile8 } from "node:fs/promises";
2484
+ import path8 from "node:path";
2485
+ var SERVER_ENTRY_NAMES = ["server.js", "server.mjs", "server.cjs", "server.ts"];
2486
+ var SHIM_VERSION = "0.0.0-pnext-custom-server";
2487
+ function hasCustomServerEntry(root) {
2488
+ for (const name of SERVER_ENTRY_NAMES) {
2489
+ const file = path8.join(root, name);
2490
+ if (!existsSync4(file)) continue;
2491
+ try {
2492
+ const source = readFileSync3(file, "utf8");
2493
+ if (/(?:require\(\s*['"]next['"]\s*\)|from\s+['"]next['"])/.test(source)) return true;
2494
+ } catch {
2495
+ }
2496
+ }
2497
+ return false;
2498
+ }
2499
+ async function emitCustomServerShim(config) {
2500
+ if (!hasCustomServerEntry(config.root)) return;
2501
+ const target = path8.join(config.root, "node_modules", "next");
2502
+ try {
2503
+ const stat = lstatSync(target);
2504
+ if (!stat.isSymbolicLink() && !isEmittedShim(target)) return;
2505
+ await rm3(target, { recursive: true, force: true });
2506
+ } catch {
2507
+ }
2508
+ await mkdir8(target, { recursive: true });
2509
+ await writeFile8(
2510
+ path8.join(target, "package.json"),
2511
+ `${JSON.stringify({ name: "next", version: SHIM_VERSION, main: "index.cjs" }, null, 2)}
2512
+ `
2513
+ );
2514
+ await writeFile8(path8.join(target, "index.cjs"), customServerShimSource());
2515
+ }
2516
+ function isEmittedShim(target) {
2517
+ try {
2518
+ const pkg = JSON.parse(readFileSync3(path8.join(target, "package.json"), "utf8"));
2519
+ return pkg.version === SHIM_VERSION;
2520
+ } catch {
2521
+ return false;
2522
+ }
2523
+ }
2524
+ function customServerShimSource() {
2525
+ const cliPath = path8.resolve((__pnextRoot + "/src/compat/next"), "..", "..", "cli", "index.ts");
2526
+ return `'use strict';
2527
+ // pnext custom-server shim for require('next') / import next from 'next'.
2528
+ // Generated by pnext build; see src/compat/next/custom-server.ts.
2529
+ const { spawn } = require('node:child_process');
2530
+
2531
+ const PNEXT_CLI = ${JSON.stringify(cliPath)};
2532
+ const HOP_BY_HOP = new Set([
2533
+ 'connection', 'keep-alive', 'proxy-authenticate', 'proxy-authorization',
2534
+ 'te', 'trailer', 'transfer-encoding', 'upgrade', 'host', 'accept-encoding',
2535
+ ]);
2536
+
2537
+ function createServer(options = {}) {
2538
+ const dev = Boolean(options.dev);
2539
+ const hostname = options.hostname || 'localhost';
2540
+ const port = options.port || 3000;
2541
+ let child;
2542
+ let childExited;
2543
+ let internalPort;
2544
+
2545
+ async function prepare() {
2546
+ if (internalPort) return;
2547
+ child = spawn(
2548
+ 'bun',
2549
+ ['--conditions=react-server', PNEXT_CLI, dev ? 'dev' : 'start', '--port', '0', '--hostname', '127.0.0.1'],
2550
+ {
2551
+ cwd: process.cwd(),
2552
+ env: { ...process.env, BROWSER: 'none', NODE_ENV: dev ? 'development' : 'production' },
2553
+ stdio: ['ignore', 'pipe', 'pipe'],
2554
+ }
2555
+ );
2556
+ childExited = new Promise((resolve) => child.once('exit', resolve));
2557
+ internalPort = await new Promise((resolve, reject) => {
2558
+ const timer = setTimeout(
2559
+ () => reject(new Error('pnext custom-server: timed out waiting for the pnext server to start')),
2560
+ 60000
2561
+ );
2562
+ let buffer = '';
2563
+ // Echo the child's logs line by line, relabelling its "- Local: <internal>"
2564
+ // ready banner: log scanners on THIS process's stdout (the Next e2e harness
2565
+ // parses that exact line for the app URL) must not pick up the internal
2566
+ // port, or every request would bypass the custom server. Line buffering
2567
+ // keeps a coalesced/split chunk from slipping the raw banner through.
2568
+ const echoLines = (out) => {
2569
+ let tail = '';
2570
+ const write = (text) => {
2571
+ const merged = tail + text;
2572
+ const cut = merged.lastIndexOf('\\n') + 1;
2573
+ tail = merged.slice(cut);
2574
+ if (cut === 0) return;
2575
+ out.write(merged.slice(0, cut).replace(/-(\\s*)(Local|Network):/g, '[pnext internal]$1$2:'));
2576
+ };
2577
+ child.once('exit', () => { if (tail) { const rest = tail; tail = ''; out.write(rest); } });
2578
+ return write;
2579
+ };
2580
+ const echoOut = echoLines(process.stdout);
2581
+ const echoErr = echoLines(process.stderr);
2582
+ const scan = (chunk, echo) => {
2583
+ const text = chunk.toString('utf8');
2584
+ echo(text);
2585
+ if (internalPort) return;
2586
+ buffer = (buffer + text).slice(-4096);
2587
+ const match = /-\\s*Local:\\s+https?:\\/\\/[^:\\s]+:(\\d+)/.exec(buffer);
2588
+ if (match) {
2589
+ clearTimeout(timer);
2590
+ resolve(Number(match[1]));
2591
+ }
2592
+ };
2593
+ child.stdout.on('data', (chunk) => scan(chunk, echoOut));
2594
+ child.stderr.on('data', (chunk) => scan(chunk, echoErr));
2595
+ child.once('exit', (code) => {
2596
+ clearTimeout(timer);
2597
+ reject(new Error('pnext custom-server: the pnext server exited during startup (code ' + code + ')'));
2598
+ });
2599
+ });
2600
+ }
2601
+
2602
+ async function handleRequest(req, res) {
2603
+ if (!internalPort) throw new Error('pnext custom-server: prepare() must complete before handling requests');
2604
+ const target = new URL(req.url || '/', 'http://127.0.0.1:' + internalPort);
2605
+ const headers = {};
2606
+ for (const [name, value] of Object.entries(req.headers)) {
2607
+ if (value === undefined || HOP_BY_HOP.has(name)) continue;
2608
+ headers[name] = Array.isArray(value) ? value.join(', ') : value;
2609
+ }
2610
+ if (req.headers.host) headers['x-forwarded-host'] = req.headers.host;
2611
+ headers['x-forwarded-proto'] = 'http';
2612
+ const method = (req.method || 'GET').toUpperCase();
2613
+ const hasBody = method !== 'GET' && method !== 'HEAD';
2614
+ const response = await fetch(target, {
2615
+ method,
2616
+ headers,
2617
+ body: hasBody ? req : undefined,
2618
+ duplex: hasBody ? 'half' : undefined,
2619
+ redirect: 'manual',
2620
+ });
2621
+ res.statusCode = response.status;
2622
+ for (const [name, value] of response.headers) {
2623
+ if (['content-encoding', 'content-length', 'transfer-encoding', 'set-cookie'].includes(name)) continue;
2624
+ if (name === 'location') {
2625
+ // Rewrite child-origin absolute redirects back to a relative target so
2626
+ // the browser stays on the custom server's host/port.
2627
+ try {
2628
+ const url = new URL(value);
2629
+ if (url.hostname === '127.0.0.1' && Number(url.port) === internalPort) {
2630
+ res.setHeader(name, url.pathname + url.search + url.hash);
2631
+ continue;
2632
+ }
2633
+ } catch {}
2634
+ }
2635
+ res.setHeader(name, value);
2636
+ }
2637
+ const setCookies = typeof response.headers.getSetCookie === 'function' ? response.headers.getSetCookie() : [];
2638
+ if (setCookies.length > 0) {
2639
+ const existing = res.getHeader('set-cookie');
2640
+ const merged = existing === undefined ? setCookies : [].concat(existing, setCookies);
2641
+ res.setHeader('set-cookie', merged);
2642
+ }
2643
+ if (response.body) {
2644
+ for await (const chunk of response.body) res.write(chunk);
2645
+ }
2646
+ res.end();
2647
+ }
2648
+
2649
+ async function close() {
2650
+ if (!child || child.exitCode !== null) return;
2651
+ // Graceful: the pnext server stops accepting connections, drains pending
2652
+ // after() callbacks, then exits 0. Escalate to SIGKILL only on a hang.
2653
+ child.kill('SIGTERM');
2654
+ await Promise.race([
2655
+ childExited,
2656
+ new Promise((resolve) => setTimeout(resolve, 15000).unref()),
2657
+ ]);
2658
+ if (child.exitCode === null) child.kill('SIGKILL');
2659
+ }
2660
+
2661
+ return {
2662
+ hostname,
2663
+ port,
2664
+ prepare,
2665
+ close,
2666
+ getRequestHandler: () => (req, res) => handleRequest(req, res).catch((error) => {
2667
+ console.error('pnext custom-server: request failed:', error);
2668
+ if (!res.headersSent) res.statusCode = 500;
2669
+ res.end('Internal Server Error');
2670
+ }),
2671
+ getUpgradeHandler: () => (_req, socket) => { socket.destroy(); },
2672
+ setAssetPrefix: () => {},
2673
+ logError: (...args) => console.error(...args),
2674
+ render: async (req, res) => { await handleRequest(req, res); },
2675
+ renderToHTML: async () => { throw new Error('renderToHTML is not supported by the pnext custom server'); },
2676
+ };
2677
+ }
2678
+
2679
+ module.exports = createServer;
2680
+ module.exports.default = createServer;
2681
+ `;
2682
+ }
2683
+
2684
+ // ../node_modules/.bun/@wular+pnext@0.1.5+62547eec5a2188e3/node_modules/@wular/pnext/src/compat/register/export.ts
2685
+ var registered2 = false;
2686
+ onExtensionHostReset(() => registered2 = false);
2687
+ function registerExportExtensions(config) {
2688
+ if (registered2) return;
2689
+ if (!nextCompatEnabled(config)) return;
2690
+ registered2 = true;
2691
+ registerBuildCompleteHooks(async (ctx) => {
2692
+ if (!nextCompatEnabled(ctx.config)) return;
2693
+ await emitStaticExport(ctx);
2694
+ await emitMetadataRouteArtifacts(ctx);
2695
+ await emitCustomServerShim(ctx.config);
2696
+ });
2697
+ }
2698
+ export {
2699
+ registerBuildCompatExtensions,
2700
+ registerExportExtensions,
2701
+ registerMiddlewareExtensions,
2702
+ registerTypedRoutesExtensions,
2703
+ registerValidationExtensions
2704
+ };