@wular/coder 0.3.17 → 0.4.0

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