@wular/coder 0.4.1 → 0.4.3

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 (378) hide show
  1. package/README.md +69 -70
  2. package/dist/actions-FzDNxMFf.js +20 -0
  3. package/dist/{adapter-BKVzTDnn.js → adapter-7SEiVsmp.js} +1 -1
  4. package/dist/{adapter-B0oYCI0S.js → adapter-BLEfUqoQ.js} +1 -1
  5. package/dist/{adapter-DPInwbJG.js → adapter-H4GlcKQz.js} +1 -1
  6. package/dist/{add-CE-70LFs.js → add-B50dIJGd.js} +1 -1
  7. package/dist/{add-BxpLHnvD.js → add-D7X3gxap.js} +1 -1
  8. package/dist/{add-ej0X9e3a.js → add-DOEUHIe7.js} +1 -1
  9. package/dist/{add-U-pty9qJ.js → add-QExQhTzi.js} +1 -1
  10. package/dist/{add-json-CEa-6luW.js → add-json-Ck4KIZrT.js} +1 -1
  11. package/dist/{agent-JdtZozvP.js → agent-BPtnEf1q.js} +1 -1
  12. package/dist/{agent-BsYx3Odz.js → agent-BlQ_dNNm.js} +2 -2
  13. package/dist/{alias-DX-Bm86x.js → alias-BwQBovke.js} +1 -1
  14. package/dist/{app-BT5f7zL5.js → app-y6BYm2eH.js} +1 -1
  15. package/dist/{approvals-C-AvFt6s.js → approvals-Cc9cq5T1.js} +2 -2
  16. package/dist/{approve-DOmpQRNd.js → approve-oO9k2fnK.js} +2 -2
  17. package/dist/{apps-CjfrZyM5.js → apps-CU2YalX8.js} +1 -1
  18. package/dist/{archive-BziJ1rQ-.js → archive-C5c_HQS1.js} +2 -2
  19. package/dist/{archive-BUB8gFKD.js → archive-CemlWlVY.js} +2 -2
  20. package/dist/archive-sweep-ehg-fWIt.js +1 -0
  21. package/dist/{args-BOEEdpWk.js → args-DcBCtXhz.js} +1 -1
  22. package/dist/{ask-dE3U3ss2.js → ask-Chu7Twu_.js} +2 -2
  23. package/dist/auth-BOyXPOtu.js +1 -0
  24. package/dist/auth-XbqKSbcD.js +1 -0
  25. package/dist/{chat-bridge-BS9WtP3X.js → chat-bridge-DXgZItGP.js} +1 -1
  26. package/dist/{chat-B_yhNTo0.js → chat-cknlIhVh.js} +1 -1
  27. package/dist/{cli-BilSDkvE.js → cli-B1ObVrL4.js} +5 -5
  28. package/dist/cli.d.ts +1 -1
  29. package/dist/cli.js +1 -1
  30. package/dist/{client-D9IoAuDD.js → client-31YzOj-i.js} +1 -1
  31. package/dist/{config-Da_cwoxI.js → config-DAE_qHYA.js} +1 -1
  32. package/dist/{create-C_iMJV4Y.js → create-CM8B8JxD.js} +1 -1
  33. package/dist/credentials-BXD4Qptk.js +1 -0
  34. package/dist/dash/manifest.json +934 -1014
  35. package/dist/dash/public/assets/chunks/{agent-pills-c9c4ac4d4a10df83.js → agent-pills-b6a6da91c9559d9f.js} +1 -1
  36. package/dist/dash/public/assets/chunks/{agent-settings-form-8be2ddab074aba6d.js → agent-settings-form-b615c677046cd6f2.js} +1 -1
  37. package/dist/dash/public/assets/chunks/agents-grid-f2e7b4ff9e11b6e3.js +1 -0
  38. package/dist/dash/public/assets/chunks/{badge-676b01e0c615bf7b.js → badge-215c7b2631dafc69.js} +1 -1
  39. package/dist/dash/public/assets/chunks/{card-e0901d68b79dfa93.js → card-e86dcc81326d2b14.js} +1 -1
  40. package/dist/dash/public/assets/chunks/{combo-41234c24668b1db1.js → combo-09e246dc9a517fa8.js} +1 -1
  41. package/dist/dash/public/assets/chunks/composer-417166b029f48c47.js +1 -0
  42. package/dist/dash/public/assets/chunks/composer-645ae8fa97a35280.js +1 -0
  43. package/dist/dash/public/assets/chunks/{confirm-f2fe4ba9905a89c6.js → confirm-5ae484241ad888fd.js} +1 -1
  44. package/dist/dash/public/assets/chunks/{connect-apps-aa2a3d82e48ed8c3.js → connect-apps-4147c45f45fde2b1.js} +1 -1
  45. package/dist/dash/public/assets/chunks/{connect-repositories-5389ec8701a3deac.js → connect-repositories-77591110836bdf03.js} +1 -1
  46. package/dist/dash/public/assets/chunks/credentials-list-e005a0783ec93465.js +2 -0
  47. package/dist/dash/public/assets/chunks/{custom-range-4761ab14f05149df.js → custom-range-463e119af4681c61.js} +1 -1
  48. package/dist/dash/public/assets/chunks/{editor-bfe8cd854f8001be.js → editor-804b84f4fe6539cd.js} +4 -4
  49. package/dist/dash/public/assets/chunks/{engines-list-f1191390f5715b39.js → engines-list-ceab51f13c690e8c.js} +1 -1
  50. package/dist/dash/public/assets/chunks/{field-901f1f35c18c39c9.js → field-aa0a4b98a976781e.js} +1 -1
  51. package/dist/dash/public/assets/chunks/filter-91144ac2eec6297f.js +1 -0
  52. package/dist/dash/public/assets/chunks/format-105c706345987fb2.js +1 -0
  53. package/dist/dash/public/assets/chunks/heads-a42817b32d2d7f08.js +1 -0
  54. package/dist/dash/public/assets/chunks/{instructions-052fa45a9daf6db6.js → instructions-3a1dcaff2d868aa5.js} +1 -1
  55. package/dist/dash/public/assets/chunks/instructions-6c6f981fffaa31e4.js +1 -0
  56. package/dist/dash/public/assets/chunks/{list-1d259660d7612c5f.js → list-7270361464fc3c04.js} +1 -1
  57. package/dist/dash/public/assets/chunks/{mcp-list-e3bebbbe831393b8.js → mcp-list-2e715d48666b54ad.js} +1 -1
  58. package/dist/dash/public/assets/chunks/{models-list-44f857a469ca04d5.js → models-list-d3c40f94c761a6e5.js} +1 -1
  59. package/dist/dash/public/assets/chunks/paged-3ddb6077bef42752.js +1 -0
  60. package/dist/dash/public/assets/chunks/{platform-actions-d1426602049926d2.js → platform-actions-271ec3b99a64280b.js} +1 -1
  61. package/dist/dash/public/assets/chunks/runners-list-767e49c7d0ec833a.js +1 -0
  62. package/dist/dash/public/assets/chunks/{segmented-358ff2b4992b8384.js → segmented-de4386ccaac7304d.js} +1 -1
  63. package/dist/dash/public/assets/chunks/{select-7ae25fd8a7d6c338.js → select-a90307706cffa6e0.js} +1 -1
  64. package/dist/dash/public/assets/chunks/{sentinel-c972a33dc69a5135.js → sentinel-b5e032b38604dfd3.js} +1 -1
  65. package/dist/dash/public/assets/chunks/shared-init-7f81ae7bc8c82438.js +2 -0
  66. package/dist/dash/public/assets/chunks/shared-init-933c7f9ee85be766.js +5 -0
  67. package/dist/dash/public/assets/chunks/{tail-7c27aab8ba268bd9.js → tail-4891e727ee526792.js} +1 -1
  68. package/dist/dash/public/assets/chunks/task-actions-ce854925a2dc78fd.js +1 -0
  69. package/dist/dash/public/assets/chunks/task-ddfddeaf07fb684c.js +1 -0
  70. package/dist/dash/public/assets/chunks/task-view-c37dcee08f21a279.js +5 -0
  71. package/dist/dash/public/assets/chunks/tasks-list-baef587999f322d8.js +1 -0
  72. package/dist/dash/public/assets/chunks/{toolbar-a75d2570f07cbb70.js → toolbar-8d98313606ad8a2d.js} +1 -1
  73. package/dist/dash/public/assets/chunks/{versions-list-fc2e0d2a7382e049.js → versions-list-532690efd9f1b0ea.js} +1 -1
  74. package/dist/dash/public/assets/dash-49ca85b59ac65c20.css +1 -0
  75. package/dist/dash/public/assets/dash-account-edc56e85dbaaabe0.css +1 -0
  76. package/dist/dash/public/assets/dash-agents-edba57b67e4005d0.css +1 -0
  77. package/dist/dash/public/assets/dash-agents-new-fe22253fbada2fbf.css +1 -0
  78. package/dist/dash/public/assets/dash-agents-param-slug-adf52e9dacb2d825.css +1 -0
  79. package/dist/dash/public/assets/dash-agents-param-slug-edit-a2937a347689ef29.css +1 -0
  80. package/dist/dash/public/assets/dash-agents-param-slug-platforms-265ba13db32a460d.css +1 -0
  81. package/dist/dash/public/assets/dash-agents-param-slug-settings-8afc52eb0372bc4b.css +1 -0
  82. package/dist/dash/public/assets/dash-agents-param-slug-tasks-6193e646be68dbd2.css +1 -0
  83. package/dist/dash/public/assets/dash-agents-param-slug-usage-ceadb3a1c911c402.css +1 -0
  84. package/dist/dash/public/assets/dash-settings-cf1997cd7f72e518.css +1 -0
  85. package/dist/dash/public/assets/dash-settings-param-tab-b44dac8e79a560e6.css +1 -0
  86. package/dist/dash/public/assets/dash-tasks-916c7100a8058aa3.css +1 -0
  87. package/dist/dash/public/assets/dash-tasks-param-id-194a6ffc20e872f2.css +1 -0
  88. package/dist/dash/public/assets/dash-usage-40940b289f85e0b6.css +1 -0
  89. package/dist/dash/public/assets/pnext-client-13aee92bef5c9e3f.js +1 -0
  90. package/dist/dash/public/assets/pnext-client-1f2686b2044f0df6.js +1 -0
  91. package/dist/dash/public/assets/pnext-client-26130234ebad7067.js +1 -0
  92. package/dist/dash/public/assets/pnext-client-311e35b0076bf406.js +1 -0
  93. package/dist/dash/public/assets/pnext-client-4ade1bf75c9c3d87.js +1 -0
  94. package/dist/dash/public/assets/pnext-client-61cd31b687ede1da.js +1 -0
  95. package/dist/dash/public/assets/pnext-client-61db65dc4223217a.js +1 -0
  96. package/dist/dash/public/assets/pnext-client-6ea656e7705e3f2a.js +1 -0
  97. package/dist/dash/public/assets/pnext-client-7fd0f793f0322cb9.js +1 -0
  98. package/dist/dash/public/assets/pnext-client-88159c0840fcfa4a.js +1 -0
  99. package/dist/dash/public/assets/pnext-client-b03f0c47c066b4f3.js +1 -0
  100. package/dist/dash/public/assets/{pnext-client-1b9ab0963a8ff77b.js → pnext-client-d6478835f543f901.js} +1 -1
  101. package/dist/dash/public/assets/pnext-client-dadb8359021ed590.js +1 -0
  102. package/dist/dash/public/assets/pnext-client-de07532d6aaebf2c.js +1 -0
  103. package/dist/dash/public/assets/pnext-client-f87a31890c8ff224.js +1 -0
  104. package/dist/dash/public/assets/pnext-client-ffe1c123a8e2a350.js +1 -0
  105. package/dist/dash/server/bundle-0.1.6-b29ec45cb963d47f/entry.js +2 -0
  106. package/dist/{default-vYPT26DR.js → default-BMvUMTFp.js} +1 -1
  107. package/dist/default-B_nKaX0-.js +1 -0
  108. package/dist/{delete-D8gEwoOj.js → delete-Bjteibld.js} +2 -2
  109. package/dist/{delete-z1_86nf6.js → delete-riCIKZwj.js} +2 -2
  110. package/dist/{disable-DVKd-0Xb.js → disable-DQC56YFy.js} +1 -1
  111. package/dist/{discover-Dvr_3_Xr.js → discover-Qanr5TEO.js} +1 -1
  112. package/dist/{discover-Df-a8K4R.js → discover-lgTYwoQp.js} +2 -2
  113. package/dist/dispatch-BsW_1m7e.js +14 -0
  114. package/dist/{docs-DKJnqZqt.js → docs-DFs7lOJp.js} +1 -1
  115. package/dist/{docs-BX65z2Iu.js → docs-DKROso-4.js} +2 -2
  116. package/dist/{enable-C8Zf_wpN.js → enable-D2DqZvcU.js} +1 -1
  117. package/dist/{env-CRf6wkM2.js → env-YRY3I60r.js} +1 -1
  118. package/dist/exec-DuUkLMqg.js +11 -0
  119. package/dist/executor-vMppVLB6.js +10 -0
  120. package/dist/flow/builtin/review.js +1 -1
  121. package/dist/flow/index.d.ts +1 -1
  122. package/dist/flow/index.js +1 -1
  123. package/dist/{flow-17k25MHt.js → flow-DmERAnR8.js} +1 -1
  124. package/dist/{github-actions-DwUzm4hC.js → github-actions-C_NkHVJq.js} +1 -1
  125. package/dist/http-D01Udu4u.js +1 -0
  126. package/dist/{index-CZjFX5zV.d.ts → index-B1L4zXZH.d.ts} +2 -1
  127. package/dist/{init-CoMfFxbG.js → init-Bd6JHzBc.js} +1 -1
  128. package/dist/integrations-B2CavXR1.js +5 -0
  129. package/dist/integrations-D1Dwy1kt.js +1 -0
  130. package/dist/lib/broker.js +2 -2
  131. package/dist/{list-DX-z3SBp.js → list-4Uo-0v9s.js} +1 -1
  132. package/dist/{list-BAKvxSbh.js → list-B0ujEZhd.js} +3 -3
  133. package/dist/{list-BYiG8Zav.js → list-B5oa1Bhy.js} +2 -2
  134. package/dist/{list-BxEywhHU.js → list-BjE_l6la.js} +1 -1
  135. package/dist/{list-VToARh3C.js → list-Ck9ibCs1.js} +1 -1
  136. package/dist/{list-CIW2joV1.js → list-DhgK4Zc4.js} +1 -1
  137. package/dist/{list-DpCf4G-H.js → list-KvL7AUhD.js} +2 -2
  138. package/dist/{list-C5w01-8q.js → list-byYLBl1U.js} +1 -1
  139. package/dist/{load-BpEsAn51.js → load-SnZd7xG1.js} +1 -1
  140. package/dist/{local-H3uvqEbq.js → local-BRy1EUq2.js} +1 -1
  141. package/dist/log-view-DeJstSkw.js +3 -0
  142. package/dist/{login-DkkslfBx.js → login-C-ahtDKV.js} +1 -1
  143. package/dist/{login-BFxX4jJy.js → login-zpwke8g1.js} +1 -1
  144. package/dist/{logout-BHAtw4Z8.js → logout-CI6Kf-T6.js} +1 -1
  145. package/dist/{maintenance-C5FklUw3.js → maintenance-BAzr9Jlr.js} +1 -1
  146. package/dist/{match-CXAjDhg7.js → match-DxV1d49D.js} +1 -1
  147. package/dist/{mcp-BgKb2Cdk.js → mcp-CmcL1MCG.js} +1 -1
  148. package/dist/{mcp-CCZOAo06.js → mcp-mhXwtGQT.js} +1 -1
  149. package/dist/{migrate-N-85_N7J.js → migrate-Czh3TEK5.js} +1 -1
  150. package/dist/{migrate-C4vM7DQN.js → migrate-w7KfzUAR.js} +1 -1
  151. package/dist/{model-Bs1StDo3.js → model-JRoTH9QK.js} +1 -1
  152. package/dist/models-C-S7HqSb.js +1 -0
  153. package/dist/{prompt-CEuBMNhk.js → prompt-CMXmt2l9.js} +4 -4
  154. package/dist/{push-CUC55Bqd.js → push-B8BhTyZs.js} +1 -1
  155. package/dist/queue-CirjEskI.js +117 -0
  156. package/dist/refresh-Bmy2r1Ee.js +1 -0
  157. package/dist/{remote-miQNTVRa.js → remote-CxFnEjZl.js} +1 -1
  158. package/dist/{remove-B93LNkZI.js → remove-C15WLaXT.js} +1 -1
  159. package/dist/{remove-C5_xggx7.js → remove-CTZYjjSr.js} +1 -1
  160. package/dist/{remove-eQ8y5C5p.js → remove-CTl-H0f0.js} +1 -1
  161. package/dist/{remove-CuH8a3L9.js → remove-DX2FVo5b.js} +1 -1
  162. package/dist/rename-D1g4TnHQ.js +1 -0
  163. package/dist/{result-BEtQZHaY.js → result-D49VN8PM.js} +3 -3
  164. package/dist/result-DGWyUHYU.js +18 -0
  165. package/dist/{resume-DYzKvyEw.js → resume-ywzc7z6A.js} +2 -2
  166. package/dist/{review-oIBeECZE.js → review-ZC0xG8XY.js} +2 -2
  167. package/dist/{rotate-key-IdMYH7gg.js → rotate-key-Bf8_99ck.js} +1 -1
  168. package/dist/{run-CTtd0Znc.js → run-D7SJ-ieT.js} +2 -2
  169. package/dist/run-DoRQSC_K.js +2 -0
  170. package/dist/{run-CawRGnOg.js → run-ukCf2Mdy.js} +1 -1
  171. package/dist/runner-D-REfOUe.js +1 -0
  172. package/dist/{runner-sUpWJ_k0.js → runner-wDYhkVsM.js} +1 -1
  173. package/dist/schema-DoNO0dPh.js +1 -0
  174. package/dist/sdk.d.ts +4 -2
  175. package/dist/sdk.js +1 -1
  176. package/dist/serve-BJ_Mbm2m.js +8 -0
  177. package/dist/{serve-CPnmrKyf.js → serve-C1MMhM1F.js} +2 -2
  178. package/dist/{serve-GmRO89s5.js → serve-DtrOHaoS.js} +2 -2
  179. package/dist/{serve-CE8YV2e9.js → serve-P9pFkEnE.js} +1 -1
  180. package/dist/{serve-BTeomYxW.js → serve-yjSw0B1a.js} +1 -1
  181. package/dist/{server-Kb22cWfF.js → server-DDWTnmbx.js} +1 -1
  182. package/dist/{setup-host-GFTUzzZJ.js → setup-host-L6Rnn5Cz.js} +1 -1
  183. package/dist/{shared-DVtzWhUT.js → shared-XsUX_ZZb.js} +1 -1
  184. package/dist/{show-COTZEYgc.js → show-CU-jqJ90.js} +1 -1
  185. package/dist/{show-CMUg8SJu.js → show-DVJmB2u-.js} +1 -1
  186. package/dist/{status-D26U--p8.js → status-CBydR7LE.js} +1 -1
  187. package/dist/{steer-C6uARLp5.js → steer-Cm_sHZqs.js} +2 -2
  188. package/dist/{stop-BrGI3hSS.js → stop-DJS7DAPJ.js} +1 -1
  189. package/dist/{stop-ByCAlbmN.js → stop-TrebIIuv.js} +2 -2
  190. package/dist/store-BrNMqJgk.js +42 -0
  191. package/dist/store-j8icrG0v.js +19 -0
  192. package/dist/task-C8lmcNsf.js +1 -0
  193. package/dist/{task-DeglY79z.js → task-CpUI19o2.js} +4 -4
  194. package/dist/task-CvSqiwxo.js +1 -0
  195. package/dist/{test-NEbhlxvo.js → test-CDKz4jY_.js} +1 -1
  196. package/dist/{tools-D0Zfs8Hx.js → tools-DBFeoosk.js} +1 -1
  197. package/dist/{types-I5Cwtl_K.d.ts → types-DMGBYB_K.d.ts} +3 -1
  198. package/dist/{unalias-C9NqmSDq.js → unalias-BfQFBnuK.js} +1 -1
  199. package/dist/{update-BTxYQj7Z.js → update-C4FFOie8.js} +1 -1
  200. package/dist/{upgrade-hA0yWBvx.js → upgrade-DLJqMnUQ.js} +2 -2
  201. package/dist/{usage-BhqoCjvE.js → usage-CSh-xwQ2.js} +1 -1
  202. package/dist/{usage-C4d9X2Uq.js → usage-D8mc4qXK.js} +1 -1
  203. package/dist/{watch-DtRuC0Wc.js → watch-CQu-tJKZ.js} +2 -2
  204. package/dist/{watch-CSdj24ct.js → watch-DmwaEvoi.js} +2 -2
  205. package/dist/{wire-BeT1Axeo.js → wire-DzGLZ3-O.js} +1 -1
  206. package/dist/worker-BLKTMLqa.js +1 -0
  207. package/dist/worker-nHemduM_.js +9 -0
  208. package/dist/{workflow-Dcmdooi8.js → workflow-IrouAus_.js} +1 -1
  209. package/docs/cli.md +145 -0
  210. package/docs/mcp.md +1 -1
  211. package/migrations/0000_initial.sql +8 -0
  212. package/migrations/meta/0000_snapshot.json +75 -1
  213. package/migrations/meta/_journal.json +1 -1
  214. package/package.json +3 -2
  215. package/plugins/agents/skills/coder/SKILL.md +1 -0
  216. package/plugins/claude/.claude-plugin/plugin.json +1 -1
  217. package/plugins/claude/skills/dispatch/SKILL.md +1 -1
  218. package/plugins/cursor/.cursor-plugin/plugin.json +1 -1
  219. package/plugins/cursor/skills/coder/SKILL.md +1 -0
  220. package/src/client/index.ts +10 -2
  221. package/src/client/types.ts +18 -0
  222. package/src/core/defaults.ts +36 -0
  223. package/src/core/task/log-view.ts +120 -6
  224. package/src/server/dash/app/dash/agents/(list)/agent-menu.tsx +4 -0
  225. package/src/server/dash/app/dash/agents/(list)/agents-grid.tsx +18 -35
  226. package/src/server/dash/app/dash/agents/(list)/loading.tsx +7 -1
  227. package/src/server/dash/app/dash/agents/[slug]/(tabs)/layout.tsx +2 -1
  228. package/src/server/dash/app/dash/layout.css +58 -1
  229. package/src/server/dash/app/dash/layout.tsx +29 -7
  230. package/src/server/dash/app/dash/settings/[tab]/credentials-list.tsx +20 -13
  231. package/src/server/dash/app/dash/settings/[tab]/page.tsx +1 -1
  232. package/src/server/dash/app/dash/settings/[tab]/runners-list.tsx +13 -12
  233. package/src/server/dash/app/dash/tasks/[id]/activity.tsx +49 -4
  234. package/src/server/dash/app/dash/tasks/[id]/task-actions.tsx +43 -6
  235. package/src/server/dash/app/dash/tasks/[id]/task-view.css +52 -31
  236. package/src/server/dash/app/dash/tasks/[id]/task-view.tsx +143 -51
  237. package/src/server/dash/app/dash/tasks/composer.css +4 -0
  238. package/src/server/dash/app/dash/tasks/composer.tsx +6 -5
  239. package/src/server/dash/app/dash/tasks/list/task.ts +29 -1
  240. package/src/server/dash/app/dash/tasks/list/tasks-list.css +20 -7
  241. package/src/server/dash/app/dash/tasks/list/tasks-list.tsx +256 -109
  242. package/src/server/dash/app/dash/tasks/list/tasks-section.tsx +9 -13
  243. package/src/server/dash/app/dash/tasks/page.tsx +3 -35
  244. package/src/server/dash/comps/frame/loading-card.tsx +4 -3
  245. package/src/server/dash/comps/frame/page-head.css +10 -0
  246. package/src/server/dash/comps/frame/page-head.tsx +3 -2
  247. package/src/server/dash/comps/frame/task-toasts.tsx +196 -50
  248. package/src/server/dash/comps/nav/side-toggle.tsx +16 -5
  249. package/src/server/dash/comps/ui/card.css +1 -0
  250. package/src/server/dash/comps/ui/filter.css +64 -0
  251. package/src/server/dash/comps/ui/filter.tsx +336 -0
  252. package/src/server/dash/comps/ui/icons.ts +2 -0
  253. package/src/server/dash/comps/ui/menu.tsx +9 -1
  254. package/src/server/dash/comps/ui/select.tsx +2 -2
  255. package/src/server/dash/comps/ui/toast.css +3 -2
  256. package/src/server/dash/comps/ui/toolbar.css +14 -0
  257. package/src/server/dash/utils/client.ts +21 -0
  258. package/src/server/dash/utils/format.ts +12 -4
  259. package/src/server/dash/utils/paged.ts +14 -6
  260. package/dist/actions-Mk3FSlpJ.js +0 -20
  261. package/dist/archive-sweep-CtBcARgN.js +0 -1
  262. package/dist/auth-BFny--17.js +0 -1
  263. package/dist/auth-DWHIzqbA.js +0 -1
  264. package/dist/credentials-B1jv6dkg.js +0 -1
  265. package/dist/dash/public/assets/chunks/agents-grid-951584b6f4c4314e.js +0 -1
  266. package/dist/dash/public/assets/chunks/composer-5534be50bc12385e.js +0 -1
  267. package/dist/dash/public/assets/chunks/composer-d10d4b1d54c4f751.js +0 -1
  268. package/dist/dash/public/assets/chunks/credentials-list-bc5bfcab058176c5.js +0 -2
  269. package/dist/dash/public/assets/chunks/format-eb03fc9d9744d960.js +0 -1
  270. package/dist/dash/public/assets/chunks/heads-f3bcd289663d48fa.js +0 -1
  271. package/dist/dash/public/assets/chunks/instructions-d0a4b0d95009c262.js +0 -1
  272. package/dist/dash/public/assets/chunks/paged-bc6fa0c2b9d52ed7.js +0 -1
  273. package/dist/dash/public/assets/chunks/runners-list-1901af8a5dea1f09.js +0 -1
  274. package/dist/dash/public/assets/chunks/shared-init-88cce66bb3cfe1e5.js +0 -5
  275. package/dist/dash/public/assets/chunks/shared-init-ffb3397e494137c9.js +0 -2
  276. package/dist/dash/public/assets/chunks/task-actions-8e1d93c788d001df.js +0 -1
  277. package/dist/dash/public/assets/chunks/task-fa8b82e95e771c4a.js +0 -1
  278. package/dist/dash/public/assets/chunks/task-view-6d7618d2820a5cb4.js +0 -3
  279. package/dist/dash/public/assets/chunks/tasks-list-f4784e5cbd0ed785.js +0 -1
  280. package/dist/dash/public/assets/dash-9e02d5d1a6d42ee3.css +0 -1
  281. package/dist/dash/public/assets/dash-account-04859899c1838ada.css +0 -1
  282. package/dist/dash/public/assets/dash-agents-9e678137267dec07.css +0 -1
  283. package/dist/dash/public/assets/dash-agents-new-26fa27b17ef9b8d8.css +0 -1
  284. package/dist/dash/public/assets/dash-agents-param-slug-b975c48f8abf3444.css +0 -1
  285. package/dist/dash/public/assets/dash-agents-param-slug-edit-e13fda599bb04843.css +0 -1
  286. package/dist/dash/public/assets/dash-agents-param-slug-platforms-70292932cb27bc96.css +0 -1
  287. package/dist/dash/public/assets/dash-agents-param-slug-settings-71f9a86251723fcc.css +0 -1
  288. package/dist/dash/public/assets/dash-agents-param-slug-tasks-fb8eb2ed71006601.css +0 -1
  289. package/dist/dash/public/assets/dash-agents-param-slug-usage-7c8740f1cdd52c71.css +0 -1
  290. package/dist/dash/public/assets/dash-settings-8eb818da462227e8.css +0 -1
  291. package/dist/dash/public/assets/dash-settings-param-tab-849a1a9542e273f5.css +0 -1
  292. package/dist/dash/public/assets/dash-tasks-81e510e0b6931b42.css +0 -1
  293. package/dist/dash/public/assets/dash-tasks-param-id-bbd2a83342f2ec10.css +0 -1
  294. package/dist/dash/public/assets/dash-usage-8e0259e03eaed1bd.css +0 -1
  295. package/dist/dash/public/assets/pnext-client-03b03b254e525e82.js +0 -1
  296. package/dist/dash/public/assets/pnext-client-1c7859bb888f4ef0.js +0 -1
  297. package/dist/dash/public/assets/pnext-client-3c748afe963fb05d.js +0 -1
  298. package/dist/dash/public/assets/pnext-client-4f47c2cae220f107.js +0 -1
  299. package/dist/dash/public/assets/pnext-client-6ab9fd9b53b794d2.js +0 -1
  300. package/dist/dash/public/assets/pnext-client-6c241786342498e4.js +0 -1
  301. package/dist/dash/public/assets/pnext-client-80b56d420f02b808.js +0 -1
  302. package/dist/dash/public/assets/pnext-client-83135c17bae850a3.js +0 -1
  303. package/dist/dash/public/assets/pnext-client-8e6fa4302ae0396f.js +0 -1
  304. package/dist/dash/public/assets/pnext-client-932c9d8cc0717fc8.js +0 -1
  305. package/dist/dash/public/assets/pnext-client-a42ae63d4de113f9.js +0 -1
  306. package/dist/dash/public/assets/pnext-client-d2ee6f8c1e337032.js +0 -1
  307. package/dist/dash/public/assets/pnext-client-d513f65ec23b7f20.js +0 -1
  308. package/dist/dash/public/assets/pnext-client-ecb88e2a8a109954.js +0 -1
  309. package/dist/dash/public/assets/pnext-client-f1545ee6270bbf9a.js +0 -1
  310. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/boot-B2MFTRO2.js +0 -30
  311. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/build-tier-XJJSL5FR.js +0 -2704
  312. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-2HFY3DQT.js +0 -208
  313. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-2ICEVELW.js +0 -834
  314. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-3UPROT2C.js +0 -35
  315. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-4P5CMIYT.js +0 -1582
  316. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-4TKZKZ3Q.js +0 -131
  317. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-5RDEILQB.js +0 -437
  318. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-62KEQM43.js +0 -25
  319. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-6KQSWT6D.js +0 -831
  320. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-7DCNCW6O.js +0 -724
  321. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-B4THCTQP.js +0 -22
  322. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-C2LIV2MM.js +0 -172
  323. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-CCATPVTW.js +0 -378
  324. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-COXJAPTU.js +0 -89
  325. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-E6IXL2NJ.js +0 -6270
  326. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-FLGRBFAH.js +0 -1198
  327. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-FTJVHFWD.js +0 -61
  328. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-H523KSIH.js +0 -5151
  329. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-HT6KKX6A.js +0 -20
  330. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-JESFYECC.js +0 -438
  331. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-JRPJM2XY.js +0 -17
  332. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-L2IWDUXG.js +0 -107
  333. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-L5P4Y4UC.js +0 -183
  334. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-NQE46AZN.js +0 -647
  335. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-PA4QEARJ.js +0 -129
  336. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-PZ5AXOLW.js +0 -7146
  337. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-SNVPTULL.js +0 -2397
  338. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-T3QZT3PG.js +0 -220
  339. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-VC5O2SDP.js +0 -72
  340. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-WZX4V6CM.js +0 -231
  341. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-XUUIDXY5.js +0 -627
  342. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/chunk-ZHFDO3PR.js +0 -265
  343. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/compile-CE2DN7ZA.js +0 -18
  344. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/config-UREY7XJT.js +0 -16
  345. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/config-loader-UI2XE3PZ.js +0 -17
  346. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/entry.js +0 -219
  347. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/generate-I2PPTDFD.js +0 -16
  348. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/modules-UVOCE4C2.js +0 -48
  349. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/pipeline-UW47K537.js +0 -963
  350. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/proxy-ITGOVJBW.js +0 -26
  351. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/register-4SA55SWT.js +0 -12579
  352. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/router-JNKHLBCZ.js +0 -505
  353. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/routes-PD6J2NXW.js +0 -54
  354. package/dist/dash/server/bundle-0.1.5-1508b6c99c0d1e68/tsconfig-defaults-ZXEH7RQK.js +0 -15
  355. package/dist/default-Bobztoxf.js +0 -1
  356. package/dist/dispatch-BKeAch9E.js +0 -14
  357. package/dist/exec-RZFLclKX.js +0 -11
  358. package/dist/executor-BvAA7Cgw.js +0 -10
  359. package/dist/http-Bkg_OQ6r.js +0 -1
  360. package/dist/integrations-5xCaXSd-.js +0 -1
  361. package/dist/integrations-BAgdVDhj.js +0 -5
  362. package/dist/log-view-dg0TlKLA.js +0 -1
  363. package/dist/models-_5LVGC3m.js +0 -1
  364. package/dist/queue-6io_NOP3.js +0 -116
  365. package/dist/refresh-BIrmrWYq.js +0 -1
  366. package/dist/rename-CYfy03FE.js +0 -1
  367. package/dist/result-BzaM3inj.js +0 -15
  368. package/dist/run-BDYl0CKl.js +0 -2
  369. package/dist/runner-D7ScbIHJ.js +0 -1
  370. package/dist/schema-CU2iFkp8.js +0 -1
  371. package/dist/serve-CQKZxzFE.js +0 -4
  372. package/dist/store-B94tSate.js +0 -42
  373. package/dist/store-DzqXS2wT.js +0 -8
  374. package/dist/task-C6VAg5WU.js +0 -1
  375. package/dist/task-CgOKgkEG.js +0 -1
  376. package/dist/worker-CXndxmGF.js +0 -9
  377. package/dist/worker-DX7P9kWl.js +0 -1
  378. package/src/server/dash/app/dash/token-from-hash.tsx +0 -17
@@ -1,963 +0,0 @@
1
- import { createRequire as __coderRequire } from "node:module";
2
- const __pnextRoot = __coderRequire(import.meta.url).resolve("@wular/pnext").replace(/\/src\/index\.ts$/, "");
3
- import { createRequire as __pnextCreateRequire } from "node:module";
4
- const require = __pnextCreateRequire(("file://" + __pnextRoot + "/package.json"));
5
- import {
6
- handleRouteModule,
7
- routeParamsFromPath
8
- } from "./chunk-C2LIV2MM.js";
9
- import {
10
- isPprShellUpgradeEligible,
11
- metadataRouteHandlerModule,
12
- renderGlobalNotFoundResponse,
13
- renderPageResponse,
14
- renderPageWithStatus,
15
- runWithCacheScope
16
- } from "./chunk-PZ5AXOLW.js";
17
- import {
18
- setRequestRuntime
19
- } from "./chunk-VC5O2SDP.js";
20
- import {
21
- abortUpstreamFetchOnDisconnect,
22
- bootstrapCompat
23
- } from "./chunk-COXJAPTU.js";
24
- import {
25
- markErrorLogged
26
- } from "./chunk-62KEQM43.js";
27
- import {
28
- normalizePathname,
29
- parseNavState,
30
- publishEmittedAssets,
31
- selectRouteForRequest
32
- } from "./chunk-SNVPTULL.js";
33
- import {
34
- applyProxyResponse,
35
- createProxyRunner
36
- } from "./chunk-7DCNCW6O.js";
37
- import {
38
- canonicalTrailingSlashPath,
39
- importModuleOnce,
40
- malformedUrlResponse,
41
- registerServerRuntime,
42
- serverBundleTargetForRuntime,
43
- trailingSlashRedirect
44
- } from "./chunk-E6IXL2NJ.js";
45
- import "./chunk-L2IWDUXG.js";
46
- import {
47
- flushWorkUnit,
48
- flushWorkUnitOnClose,
49
- getWorkUnit,
50
- loadConfig,
51
- pathToFileHref,
52
- runWithWorkUnit,
53
- setPhase,
54
- setWorkUnitRoute
55
- } from "./chunk-JESFYECC.js";
56
- import "./chunk-5RDEILQB.js";
57
- import "./chunk-JRPJM2XY.js";
58
- import {
59
- getRenderSpanExtensions
60
- } from "./chunk-CCATPVTW.js";
61
- import "./chunk-HT6KKX6A.js";
62
- import "./chunk-NQE46AZN.js";
63
- import {
64
- resolveManifest
65
- } from "./chunk-2HFY3DQT.js";
66
- import {
67
- finalizeResponse,
68
- getAssetExtensions,
69
- getProxyExtensions,
70
- getRenderExtensions,
71
- getRequestExtensions,
72
- reportRequestError,
73
- runInitHooks,
74
- setRequestExtensions,
75
- withRouteRuntime
76
- } from "./chunk-4P5CMIYT.js";
77
- import {
78
- stopEsbuildService
79
- } from "./chunk-FTJVHFWD.js";
80
- import "./chunk-3UPROT2C.js";
81
-
82
- // ../node_modules/.bun/@wular+pnext@0.1.5+62547eec5a2188e3/node_modules/@wular/pnext/src/cli/serve/pipeline.ts
83
- import { existsSync } from "node:fs";
84
- import { mkdir, readFile, writeFile } from "node:fs/promises";
85
- import { stat } from "node:fs/promises";
86
- import path2 from "node:path";
87
- import { constants as zlibConstants, createGzip, gzipSync } from "node:zlib";
88
- import { Readable } from "node:stream";
89
-
90
- // ../node_modules/.bun/@wular+pnext@0.1.5+62547eec5a2188e3/node_modules/@wular/pnext/src/routing/forwarded.ts
91
- var FORWARDED_HOST = "x-forwarded-host";
92
- var FORWARDED_PORT = "x-forwarded-port";
93
- var FORWARDED_PROTO = "x-forwarded-proto";
94
- var FORWARDED_FOR = "x-forwarded-for";
95
- function withForwardedHeaders(request, peer) {
96
- const headers = request.headers;
97
- const hasHost = headers.has(FORWARDED_HOST);
98
- const hasPort = headers.has(FORWARDED_PORT);
99
- const hasProto = headers.has(FORWARDED_PROTO);
100
- const hasFor = headers.has(FORWARDED_FOR);
101
- if (hasHost && hasPort && hasProto && (hasFor || !peer)) return request;
102
- let url;
103
- try {
104
- url = new URL(request.url);
105
- } catch {
106
- return request;
107
- }
108
- const host = headers.get("host") ?? url.host;
109
- const proto = url.protocol.replace(":", "");
110
- const port = url.port;
111
- const next = new Headers(headers);
112
- if (!hasHost) next.set(FORWARDED_HOST, host);
113
- if (!hasPort) next.set(FORWARDED_PORT, port);
114
- if (!hasProto) next.set(FORWARDED_PROTO, proto);
115
- if (!hasFor && peer) {
116
- const address = peer.requestIP(request)?.address;
117
- if (address) next.set(FORWARDED_FOR, address);
118
- }
119
- return new Request(request, { headers: next });
120
- }
121
-
122
- // ../node_modules/.bun/@wular+pnext@0.1.5+62547eec5a2188e3/node_modules/@wular/pnext/src/utils/content-type.ts
123
- import path from "node:path";
124
- var contentTypes = {
125
- ".avif": "image/avif",
126
- ".bmp": "image/bmp",
127
- ".css": "text/css; charset=utf-8",
128
- ".eot": "application/vnd.ms-fontobject",
129
- ".gif": "image/gif",
130
- ".htm": "text/html; charset=utf-8",
131
- ".html": "text/html; charset=utf-8",
132
- ".ico": "image/x-icon",
133
- ".jpeg": "image/jpeg",
134
- ".jpg": "image/jpeg",
135
- ".js": "text/javascript; charset=utf-8",
136
- ".json": "application/json; charset=utf-8",
137
- ".mjs": "text/javascript; charset=utf-8",
138
- ".otf": "font/otf",
139
- ".png": "image/png",
140
- ".svg": "image/svg+xml",
141
- ".tif": "image/tiff",
142
- ".tiff": "image/tiff",
143
- ".ttf": "font/ttf",
144
- ".wasm": "application/wasm",
145
- ".webp": "image/webp",
146
- ".woff": "font/woff",
147
- ".woff2": "font/woff2"
148
- };
149
- function contentType(file) {
150
- return contentTypes[path.extname(file).toLowerCase()] ?? "application/octet-stream";
151
- }
152
-
153
- // ../node_modules/.bun/@wular+pnext@0.1.5+62547eec5a2188e3/node_modules/@wular/pnext/src/cli/serve/pipeline.ts
154
- async function moduleHrefForRoute(config, route) {
155
- const { devServerModuleHref } = await import("./modules-UVOCE4C2.js");
156
- return devServerModuleHref(config, route.file, "build", {
157
- conditionTarget: serverBundleTargetForRuntime(route.segmentConfig?.runtime)
158
- });
159
- }
160
- async function createRequestHandler(options = {}) {
161
- const config = options.config ?? await loadConfig(options.root, { serve: true });
162
- await bootstrapCompat(config);
163
- const manifestPath = path2.join(config.outPath, "manifest.json");
164
- const manifest = resolveManifest(
165
- options.manifest ?? JSON.parse(await readFile(manifestPath, "utf8")),
166
- config.outPath,
167
- config.root
168
- );
169
- const persistManifest = async () => {
170
- const stored = JSON.parse(await readFile(manifestPath, "utf8"));
171
- stored.staticFiles = manifest.staticFiles;
172
- await writeFile(manifestPath, `${JSON.stringify(stored, null, 2)}
173
- `);
174
- };
175
- runInitHooks(config);
176
- publishEmittedAssets(config.outPath, manifest.assetNames);
177
- setRequestRuntime({ config, routes: manifest.routes, dev: false });
178
- const proxyRunner = createProxyRunner(config, {
179
- compiledModuleHref: manifest.proxyModule ? pathToFileHref(path2.resolve(config.outPath, manifest.proxyModule)) : void 0
180
- });
181
- const routesById = new Map(manifest.routes.map((route) => [route.id, route]));
182
- const nextCompat = Boolean(config.compat?.next);
183
- const regenerating = /* @__PURE__ */ new Map();
184
- async function regenerateStaticFile(pathname, file, relative, metadata, reason) {
185
- if (!metadata.routeId) return;
186
- const route = routesById.get(metadata.routeId);
187
- if (!route) return;
188
- await runWithWorkUnit("render", async () => {
189
- const url = new URL(`http://pnext.local${pathname}`);
190
- const params = routeParamsFromPath(route, pathname);
191
- const fetchCache = route.segmentConfig?.fetchCache;
192
- try {
193
- if (route.kind === "handler") {
194
- setWorkUnitRoute("route-handler", "isr", { revalidateReason: reason });
195
- setPhase("handler");
196
- registerServerRuntime(config, route.sourceFiles);
197
- const href = compatModuleMode(config) ? await moduleHrefForRoute(config, route) : pathToFileHref(route.file);
198
- const module = await importModuleOnce(href);
199
- const rendered = await getRenderExtensions().collectRenderMeta(
200
- () => withRouteRuntime(
201
- route.segmentConfig?.runtime,
202
- () => runWithCacheScope(
203
- () => handleRouteModule(module, new Request(url), params, { routeFile: route.file })
204
- )
205
- ),
206
- { fetchCache, blockingStaleFetches: true, route: pathname, handler: true }
207
- );
208
- if (rendered.value.status >= 500) return;
209
- await writeFile(file, new Uint8Array(await rendered.value.arrayBuffer()));
210
- manifest.staticFiles[relative] = {
211
- ...metadata,
212
- status: rendered.value.status,
213
- headers: [...rendered.value.headers.entries()],
214
- ...rendered.tags.length > 0 ? { tags: rendered.tags } : {}
215
- };
216
- } else {
217
- setWorkUnitRoute("html", "isr", { revalidateReason: reason });
218
- setPhase("render");
219
- const rendered = await getRenderExtensions().collectRenderMeta(
220
- () => withRouteRuntime(
221
- route.segmentConfig?.runtime,
222
- () => renderPageWithStatus({
223
- config,
224
- route,
225
- params,
226
- url,
227
- ...route.usesRequest ? { request: new Request(url) } : {},
228
- staticMetadataFiles: manifest.staticMetadataFiles,
229
- staticModuleMetadata: manifest.staticModuleMetadata,
230
- staticRouteMetadata: manifest.staticRouteMetadata
231
- })
232
- ),
233
- { fetchCache, blockingStaleFetches: true, route: pathname }
234
- );
235
- if (rendered.value.status >= 500) return;
236
- await writeFile(file, rendered.value.html);
237
- manifest.staticFiles[relative] = {
238
- ...metadata,
239
- status: rendered.value.status,
240
- ...rendered.tags.length > 0 ? { tags: rendered.tags } : {}
241
- };
242
- }
243
- } catch (error) {
244
- const unit = getWorkUnit();
245
- await reportRequestError(
246
- error,
247
- { method: "GET", url: url.href, headers: new Headers() },
248
- {
249
- phase: unit?.phase,
250
- routeKind: unit?.routeKind,
251
- ...unit?.responseHints ?? {}
252
- }
253
- );
254
- throw error;
255
- }
256
- });
257
- }
258
- function runRegeneration(pathname, file, relative, metadata, reason) {
259
- const existing = regenerating.get(file);
260
- if (existing) return existing;
261
- const task = regenerateStaticFile(pathname, file, relative, metadata, reason).catch((error) => {
262
- console.warn(`pnext start: background revalidate failed for ${pathname}:`, error);
263
- }).finally(() => {
264
- regenerating.delete(file);
265
- });
266
- regenerating.set(file, task);
267
- return task;
268
- }
269
- function scheduleRegen(pathname, file, relative, metadata) {
270
- void runRegeneration(pathname, file, relative, metadata, "stale");
271
- }
272
- setRequestExtensions({
273
- onDemandRevalidatePath: async (pathname) => {
274
- const built = await builtFileInfo(config.outPath, pathname, manifest.staticFiles);
275
- if (!built?.metadata) return;
276
- await runRegeneration(pathname, built.file, built.relative, built.metadata, "on-demand");
277
- }
278
- });
279
- async function renderNotFound(request) {
280
- const built = await maybeBuiltFile(
281
- config.outPath,
282
- "/404",
283
- manifest.staticFiles,
284
- request.method,
285
- request.headers,
286
- nextCompat
287
- );
288
- if (built) {
289
- setWorkUnitRoute("html", "static");
290
- const headers = new Headers(built.headers);
291
- headers.set("x-nextjs-cache", "HIT");
292
- if (!hasBuildCapturedCacheControl(manifest.staticFiles?.["404.html"])) {
293
- headers.delete("cache-control");
294
- }
295
- headers.delete("content-length");
296
- return compressResponse(new Response(built.body, { status: 404, headers }), request);
297
- }
298
- return compressResponse(
299
- await renderGlobalNotFoundResponse({
300
- config,
301
- url: new URL(request.url),
302
- request,
303
- staticMetadataFiles: manifest.staticMetadataFiles,
304
- staticModuleMetadata: manifest.staticModuleMetadata,
305
- staticRouteMetadata: manifest.staticRouteMetadata
306
- }),
307
- request
308
- );
309
- }
310
- stopEsbuildService();
311
- return function handleRequest(request, server) {
312
- return runWithWorkUnit("render", async () => {
313
- const unit = getWorkUnit();
314
- try {
315
- const raw = await handle(request, server);
316
- const finalized = await finalizeResponse(
317
- raw,
318
- { method: request.method, url: new URL(request.url), headers: request.headers },
319
- {
320
- routeKind: unit?.routeKind ?? "html",
321
- routeMode: unit?.routeMode,
322
- hints: unit?.responseHints
323
- }
324
- );
325
- const response = maybeCloseNodeFetchConnection(finalized, request);
326
- abortUpstreamFetchOnDisconnect(response.body, request.signal);
327
- return flushWorkUnitOnClose(response, unit, request.signal);
328
- } catch (error) {
329
- await reportRequestError(
330
- error,
331
- { method: request.method, url: request.url, headers: request.headers },
332
- { phase: unit?.phase, routeKind: unit?.routeKind }
333
- );
334
- if (markErrorLogged(error)) {
335
- console.error(`pnext start: request failed for ${request.url}:`, error);
336
- }
337
- flushWorkUnit(unit);
338
- return new Response("Internal Server Error", { status: 500 });
339
- }
340
- });
341
- };
342
- async function handle(request, server) {
343
- const badRequest = malformedUrlResponse(request);
344
- if (badRequest) return badRequest;
345
- request = withForwardedHeaders(request, server);
346
- const requestedUrl = new URL(request.url);
347
- const assetStripped = stripAssetPrefix(request, config.assetPrefix);
348
- if (assetStripped) request = assetStripped;
349
- if (config.basePath && !assetStripped) {
350
- const stripped = stripBasePath(request, config.basePath);
351
- if (!stripped) {
352
- const answered = await runOutsideBasePathInterceptors(request, config);
353
- if (answered instanceof Response) return answered;
354
- const rewritten2 = answered && stripBasePath(answered.request, config.basePath);
355
- if (!rewritten2) return await renderNotFound(request);
356
- request = rewritten2;
357
- } else {
358
- request = stripped;
359
- }
360
- }
361
- const skipProxyNormalize = getProxyExtensions().skipUrlNormalize();
362
- if (nextCompat && !skipProxyNormalize) {
363
- request = normalizeDataRequest(request, config) ?? request;
364
- }
365
- const bypassToken = getRequestExtensions().revalidateBypassToken();
366
- const revalidateBypass = Boolean(
367
- bypassToken && request.headers.get("x-prerender-revalidate") === bypassToken
368
- );
369
- const canonicalUrl = new URL(request.url);
370
- const canonicalHeaders = request.headers;
371
- let proxyResponse;
372
- const proxyResult = revalidateBypass ? void 0 : await proxyRunner(request);
373
- if (proxyResult instanceof Response) return proxyResult;
374
- if (proxyResult) {
375
- request = proxyResult.request;
376
- proxyResponse = proxyResult.response;
377
- }
378
- if (nextCompat && skipProxyNormalize) {
379
- request = normalizeDataRequest(request, config) ?? request;
380
- }
381
- for (const interceptor of getRequestExtensions().interceptors) {
382
- const result = await interceptor(request, { config });
383
- if (result instanceof Response)
384
- return applyProxyResponse(compressResponse(result, request), proxyResponse);
385
- if (result) request = result.request;
386
- }
387
- let url = new URL(request.url);
388
- const rewritten = url.href !== canonicalUrl.href;
389
- const canonicalRequestUrl = new URL(canonicalUrl);
390
- canonicalRequestUrl.search = url.search;
391
- const canonicalRequest = canonicalRequestUrl.href === request.url ? request : new Request(canonicalRequestUrl, { headers: canonicalHeaders });
392
- const method = request.method.toUpperCase();
393
- const canonicalRedirect = trailingSlashRedirect(config, requestedUrl, method);
394
- if (canonicalRedirect) return applyProxyResponse(canonicalRedirect, proxyResponse);
395
- const nav = parseNavState(request);
396
- const selection = selectRouteForRequest(manifest.routes, url.pathname, nav);
397
- const softDynamic = Boolean(
398
- nav && selection?.route.kind === "page" && (selection.route.slotDirs?.length || selection.route.synthetic || selection.route.interception || selection.childrenPath !== normalizePathname(url.pathname))
399
- );
400
- const pprDocumentResume = selection?.route.kind === "page" && selection.route.ppr;
401
- const draftBypass = hasDraftBypassCookie(request.headers);
402
- const built = method === "GET" || method === "HEAD" ? await builtFileInfo(config.outPath, url.pathname, manifest.staticFiles, nextCompat) : null;
403
- const hardStaticStale = built !== null && // Content-hashed build assets are immutable and are never route outputs, so a
404
- // revalidatePath/revalidateTag must not mark them stale. Without this,
405
- // revalidatePath('/', 'layout') - whose pattern matches EVERY path - would flag the client entry
406
- // script as stale, drop it from static serving, and leave the browser without the router
407
- // runtime, silently downgrading every soft navigation to a hard one.
408
- !isImmutableAssetFile(built.relative) && getRequestExtensions().staticStaleness(
409
- url.pathname,
410
- built.mtimeMs,
411
- built.metadata?.tags ?? []
412
- );
413
- const staleReason = built ? getRequestExtensions().staticStalenessReason(
414
- url.pathname,
415
- built.mtimeMs,
416
- built.metadata?.tags ?? []
417
- ) ?? "on-demand" : void 0;
418
- const softStale = staleReason === "soft";
419
- const staleOnDemand = hardStaticStale && !softStale;
420
- const hardExpired = built?.metadata?.expireSeconds !== void 0 && isHtmlPageFile(built.file) && Date.now() - built.mtimeMs >= built.metadata.expireSeconds * 1e3;
421
- const builtIsPageHtml = built !== null && isHtmlPageFile(built.file);
422
- if (built && !staleOnDemand && !(softDynamic && builtIsPageHtml) && !(pprDocumentResume && builtIsPageHtml) && !hardExpired && !revalidateBypass) {
423
- const servedBuilt = built;
424
- const metadata = built.metadata;
425
- const route = metadata?.routeId ? routesById.get(metadata.routeId) : void 0;
426
- if (route?.segmentConfig?.runtime === "edge" || route?.segmentConfig?.runtime === "experimental-edge") {
427
- withRouteRuntime(route.segmentConfig.runtime, () => void 0);
428
- }
429
- const staticFile = await maybeBuiltFile(
430
- config.outPath,
431
- url.pathname,
432
- manifest.staticFiles,
433
- request.method,
434
- request.headers,
435
- nextCompat
436
- );
437
- if (staticFile && !(draftBypass && isHtmlResponse(staticFile))) {
438
- const staticMode = servedBuilt.metadata?.revalidateSeconds !== void 0 ? "isr" : "static";
439
- setWorkUnitRoute(
440
- isHtmlResponse(staticFile) ? "html" : "static-asset",
441
- staticMode,
442
- servedBuilt.metadata?.revalidateSeconds !== void 0 ? { revalidateSeconds: servedBuilt.metadata.revalidateSeconds } : void 0
443
- );
444
- if (isHtmlResponse(staticFile) && !hasBuildCapturedCacheControl(servedBuilt.metadata)) {
445
- staticFile.headers.delete("cache-control");
446
- }
447
- if (servedBuilt.metadata) {
448
- const servedTtl = servedBuilt.metadata.revalidateSeconds;
449
- const expired = softStale || servedTtl !== void 0 && Date.now() - servedBuilt.mtimeMs >= servedTtl * 1e3;
450
- if (expired) {
451
- scheduleRegen(
452
- url.pathname,
453
- servedBuilt.file,
454
- servedBuilt.relative,
455
- servedBuilt.metadata
456
- );
457
- staticFile.headers.set("x-nextjs-cache", "STALE");
458
- } else {
459
- staticFile.headers.set("x-nextjs-cache", "HIT");
460
- }
461
- }
462
- return applyProxyResponse(compressResponse(staticFile, request), proxyResponse);
463
- }
464
- }
465
- if (url.pathname.startsWith("/_next/static/") && !built) {
466
- setWorkUnitRoute("static-asset");
467
- return applyProxyResponse(
468
- new Response("Not Found", {
469
- status: 404,
470
- headers: {
471
- "cache-control": "private, no-cache, no-store, max-age=0, must-revalidate",
472
- "content-type": "text/plain;charset=utf-8"
473
- }
474
- }),
475
- proxyResponse
476
- );
477
- }
478
- const stalePage = built && (staleOnDemand || hardExpired) && isHtmlPageFile(built.file) ? built.file : null;
479
- const matched = selection;
480
- if (!matched) {
481
- return applyProxyResponse(await renderNotFound(canonicalRequest), proxyResponse);
482
- }
483
- if (matched.route.kind === "handler") {
484
- setWorkUnitRoute(
485
- "route-handler",
486
- staleOnDemand ? "isr" : routeModeOf(matched.route),
487
- responseHintsFor(matched.route, staleReason)
488
- );
489
- setPhase("handler");
490
- const renderedHandler = await getRenderExtensions().collectRenderMeta(
491
- () => handleRoute(config, matched.route, canonicalRequest, matched.params),
492
- {
493
- fetchCache: matched.route.segmentConfig?.fetchCache,
494
- refreshFetches: staleOnDemand,
495
- route: url.pathname,
496
- handler: true
497
- }
498
- );
499
- const handlerResponse = renderedHandler.value;
500
- if (built && staleOnDemand && !stalePage && method === "GET" && handlerResponse.status === 200) {
501
- try {
502
- await writeFile(built.file, new Uint8Array(await handlerResponse.clone().arrayBuffer()));
503
- handlerResponse.headers.set("x-nextjs-cache", "MISS");
504
- } catch {
505
- }
506
- }
507
- if (!built && matched.route.hasStaticParams && // force-dynamic / revalidate 0 opt the handler out of static output:
508
- // every request must re-run it (generateSitemaps + force-dynamic must
509
- // produce a fresh sitemap per request — dynamic-in-generate-params).
510
- matched.route.segmentConfig?.dynamic !== "force-dynamic" && matched.route.segmentConfig?.revalidate !== 0 && method === "GET" && handlerResponse.status < 500) {
511
- const file = lazyStaticHandlerPath(config.outPath, url.pathname);
512
- try {
513
- if (!file) throw new Error("unsafe path");
514
- await mkdir(path2.dirname(file), { recursive: true });
515
- await writeFile(file, new Uint8Array(await handlerResponse.clone().arrayBuffer()));
516
- const relative = path2.relative(path2.join(config.outPath, "public"), file).split(path2.sep).join("/");
517
- const routeRevalidate = matched.route.segmentConfig?.revalidate;
518
- const revalidateSeconds = typeof routeRevalidate === "number" && routeRevalidate > 0 ? renderedHandler.revalidateSeconds === void 0 ? routeRevalidate : Math.min(routeRevalidate, renderedHandler.revalidateSeconds) : renderedHandler.revalidateSeconds;
519
- manifest.staticFiles ??= {};
520
- manifest.staticFiles[relative] = {
521
- status: handlerResponse.status,
522
- headers: [...handlerResponse.headers.entries()],
523
- routeId: matched.route.id,
524
- ...revalidateSeconds !== void 0 ? { revalidateSeconds } : {},
525
- ...renderedHandler.tags.length > 0 ? { tags: renderedHandler.tags } : {}
526
- };
527
- await persistManifest();
528
- handlerResponse.headers.set("x-nextjs-cache", "MISS");
529
- } catch {
530
- }
531
- }
532
- return applyProxyResponse(handlerResponse, proxyResponse);
533
- }
534
- if (matched.route.segmentConfig?.dynamic === "error" && matched.route.usesRequest) {
535
- return applyProxyResponse(
536
- new Response(
537
- `Page with dynamic = "error" encountered dynamic data method on ${url.pathname}`,
538
- { status: 500 }
539
- ),
540
- proxyResponse
541
- );
542
- }
543
- if (!dynamicParamsAllowed(matched.route, matched.params)) {
544
- return applyProxyResponse(await renderNotFound(canonicalRequest), proxyResponse);
545
- }
546
- const forceStaticRoute = matched.route.segmentConfig?.dynamic === "force-static";
547
- const renderUrl = forceStaticRoute ? new URL(canonicalUrl.pathname, canonicalUrl.origin) : canonicalRequestUrl;
548
- const renderRequest = forceStaticRoute ? new Request(renderUrl) : method === "POST" ? new Request(canonicalRequest.url, { headers: canonicalRequest.headers }) : canonicalRequest;
549
- const pageRevalidateReason = stalePage ? staleReason : hardExpired ? "on-demand" : void 0;
550
- setWorkUnitRoute(
551
- "html",
552
- pageRevalidateReason ? "isr" : routeModeOf(matched.route),
553
- responseHintsFor(matched.route, pageRevalidateReason)
554
- );
555
- const renderMatchedPage = () => withRouteRuntime(
556
- matched.route.segmentConfig?.runtime,
557
- () => renderPageResponse({
558
- config,
559
- route: matched.route,
560
- params: matched.params,
561
- url: renderUrl,
562
- request: renderRequest,
563
- staticMetadataFiles: manifest.staticMetadataFiles,
564
- staticModuleMetadata: manifest.staticModuleMetadata,
565
- staticRouteMetadata: manifest.staticRouteMetadata,
566
- ...nav || rewritten ? {
567
- nav: {
568
- ...nav ? { soft: true, state: nav } : {},
569
- childrenPath: matched.childrenPath,
570
- targetPath: matched.targetPath
571
- }
572
- } : {}
573
- })
574
- );
575
- const renderedPage = await getRenderExtensions().collectRenderMeta(renderMatchedPage, {
576
- fetchCache: matched.route.segmentConfig?.fetchCache,
577
- refreshFetches: Boolean(stalePage),
578
- route: url.pathname
579
- });
580
- const renderRevalidateSeconds = renderedPage.revalidateSeconds ?? (typeof matched.route.segmentConfig?.revalidate === "number" ? matched.route.segmentConfig.revalidate : void 0);
581
- const renderWasDynamic = matched.route.mode === "dynamic" || matched.route.usesRequest || renderedPage.noStore === true;
582
- if (renderRevalidateSeconds !== void 0 && renderRevalidateSeconds > 0 && !renderWasDynamic) {
583
- setWorkUnitRoute("html", "isr", {
584
- ...getWorkUnit()?.responseHints ?? {},
585
- revalidateSeconds: renderRevalidateSeconds
586
- });
587
- }
588
- const pageResponse = renderedPage.value;
589
- if (matched.route.linkHeader && !pageResponse.headers.has("link")) {
590
- pageResponse.headers.set("link", matched.route.linkHeader);
591
- }
592
- const cacheLifeHeaders = cacheLifeResponseHeaders(matched.route.cacheLife);
593
- if (cacheLifeHeaders.length > 0 && matched.route.kind === "page") {
594
- for (const [key, value] of cacheLifeHeaders) {
595
- if (key === "cache-control" && pageResponse.headers.has("cache-control")) continue;
596
- pageResponse.headers.set(key, value);
597
- }
598
- }
599
- const lazyStaticCapable = matched.route.kind === "page" && // A request that can promote a fallback shell into a more specific route
600
- // shell must keep re-entering the renderer: caching its first (still
601
- // un-upgraded) render on disk would serve every later request as a HIT
602
- // and the upgraded shell would never reach the client.
603
- !isPprShellUpgradeEligible(config, matched.route, url) && (forceStaticRoute || !matched.route.usesRequest && // Next never statically caches `runtime = 'edge'` pages (they are
604
- // excluded from build prerendering too — see build.ts); their data
605
- // stability comes from the fetch cache alone.
606
- matched.route.segmentConfig?.runtime !== "edge" && (matched.route.hasStaticParams || matched.route.mode === "static"));
607
- if (!stalePage && !built && !nav && !draftBypass && lazyStaticCapable && !renderedPage.noStore && method === "GET" && url.search === "" && pageResponse.status === 200 && (pageResponse.headers.get("content-type") ?? "").includes("text/html")) {
608
- try {
609
- const file = lazyStaticHtmlPath(config.outPath, url.pathname);
610
- if (!file) throw new Error("unsafe path");
611
- await mkdir(path2.dirname(file), { recursive: true });
612
- await writeFile(file, await pageResponse.clone().text());
613
- const relative = path2.relative(path2.join(config.outPath, "public"), file).split(path2.sep).join("/");
614
- manifest.staticFiles ??= {};
615
- manifest.staticFiles[relative] = {
616
- status: 200,
617
- // Persist the cacheLife SWR headers (and the route's prerendered
618
- // Link header) so later static HITs (served by maybeBuiltFile
619
- // straight off disk) re-emit them without a render.
620
- headers: [
621
- ...matched.route.linkHeader ? [["link", matched.route.linkHeader]] : [],
622
- ...cacheLifeHeaders
623
- ],
624
- routeId: matched.route.id,
625
- kind: "page",
626
- ...renderedPage.revalidateSeconds !== void 0 ? { revalidateSeconds: renderedPage.revalidateSeconds } : {},
627
- ...matched.route.cacheLife?.expireSeconds !== void 0 ? { expireSeconds: matched.route.cacheLife.expireSeconds } : {},
628
- ...matched.route.cacheLife?.staleSeconds !== void 0 ? { staleSeconds: matched.route.cacheLife.staleSeconds } : {},
629
- ...renderedPage.tags.length > 0 ? { tags: renderedPage.tags } : {}
630
- };
631
- pageResponse.headers.set("x-nextjs-cache", "MISS");
632
- } catch {
633
- }
634
- }
635
- if (stalePage && !nav && !softDynamic && !draftBypass && method === "GET" && pageResponse.status === 200 && (pageResponse.headers.get("content-type") ?? "").includes("text/html")) {
636
- try {
637
- await writeFile(stalePage, await pageResponse.clone().text());
638
- pageResponse.headers.set("x-nextjs-cache", "MISS");
639
- } catch {
640
- }
641
- }
642
- if (revalidateBypass) {
643
- if (built && method === "GET" && pageResponse.status === 200 && (pageResponse.headers.get("content-type") ?? "").includes("text/html")) {
644
- try {
645
- await writeFile(built.file, await pageResponse.clone().text());
646
- } catch {
647
- }
648
- }
649
- pageResponse.headers.set("x-nextjs-cache", "REVALIDATED");
650
- }
651
- return applyProxyResponse(compressResponse(pageResponse, request), proxyResponse);
652
- }
653
- }
654
- function normalizeDataRequest(request, config) {
655
- const method = request.method.toUpperCase();
656
- if (method !== "GET" && method !== "HEAD") return null;
657
- const url = new URL(request.url);
658
- const match = /^\/_next\/data\/[^/]+(\/.+)\.json$/.exec(url.pathname);
659
- if (!match) return null;
660
- const page = match[1] === "/index" ? "/" : match[1];
661
- url.pathname = canonicalTrailingSlashPath(page, Boolean(config.trailingSlash));
662
- const headers = new Headers(request.headers);
663
- headers.set("x-nextjs-data", "1");
664
- return new Request(url, { method, headers });
665
- }
666
- async function runOutsideBasePathInterceptors(request, config) {
667
- for (const interceptor of getRequestExtensions().outsideBasePathInterceptors) {
668
- const result = await interceptor(request, { config, outsideBasePath: true });
669
- if (result) return result;
670
- }
671
- return void 0;
672
- }
673
- function stripBasePath(request, basePath) {
674
- const url = new URL(request.url);
675
- const { pathname } = url;
676
- if (pathname !== basePath && !pathname.startsWith(`${basePath}/`)) return null;
677
- url.pathname = pathname.slice(basePath.length) || "/";
678
- return new Request(url, request);
679
- }
680
- function stripAssetPrefix(request, assetPrefix) {
681
- if (!assetPrefix) return null;
682
- let prefixValue = assetPrefix;
683
- if (/^[a-z][a-z0-9+.-]*:\/\//i.test(assetPrefix)) {
684
- prefixValue = new URL(assetPrefix).pathname;
685
- }
686
- const prefix = `/${prefixValue.replace(/^\/+|\/+$/g, "")}`;
687
- if (prefix === "/") return null;
688
- const url = new URL(request.url);
689
- const { pathname } = url;
690
- if (!pathname.startsWith(`${prefix}/assets/`) && !pathname.startsWith(`${prefix}/_next/static/`)) {
691
- return null;
692
- }
693
- url.pathname = pathname.slice(prefix.length);
694
- return new Request(url, request);
695
- }
696
- function maybeCloseNodeFetchConnection(response, request) {
697
- const userAgent = request.headers.get("user-agent") ?? "";
698
- if (!userAgent.includes("node-fetch")) return response;
699
- response.headers.set("connection", "close");
700
- return response;
701
- }
702
- function compatModuleMode(config) {
703
- return Boolean(config.compat?.next || config.compat?.react || config.compat?.reactCompiler);
704
- }
705
- async function handleRoute(config, route, request, params) {
706
- return withRouteRuntime(route.segmentConfig?.runtime, async () => {
707
- registerServerRuntime(config, route.sourceFiles);
708
- const spans = getRenderSpanExtensions();
709
- const module = await spans.withFindPageComponentsSpan(route.route, async () => {
710
- const href = compatModuleMode(config) ? await moduleHrefForRoute(config, route) : new URL(`file://${route.file}`).href;
711
- const imported = await importModuleOnce(href);
712
- return metadataRouteHandlerModule(imported, route) ?? imported;
713
- });
714
- return spans.withRouteHandlerSpan(
715
- route.route,
716
- () => runWithCacheScope(
717
- () => handleRouteModule(module, request, params, { routeFile: route.file })
718
- )
719
- );
720
- });
721
- }
722
- function hasDraftBypassCookie(headers) {
723
- return /(?:^|;\s*)__prerender_bypass=/.test(headers.get("cookie") ?? "");
724
- }
725
- function isHtmlResponse(response) {
726
- return (response.headers.get("content-type") ?? "").includes("text/html");
727
- }
728
- function routeModeOf(route) {
729
- if (route.segmentConfig?.dynamic === "force-dynamic") return "dynamic";
730
- const revalidate = route.segmentConfig?.revalidate;
731
- if (typeof revalidate === "number" && revalidate > 0) return "isr";
732
- return route.mode === "static" ? "static" : "dynamic";
733
- }
734
- function responseHintsFor(route, revalidateReason) {
735
- const runtime = route.segmentConfig?.runtime;
736
- const revalidate = route.segmentConfig?.revalidate;
737
- if (!revalidateReason && !runtime && typeof revalidate !== "number") return void 0;
738
- return {
739
- ...revalidateReason ? { revalidateReason } : {},
740
- ...runtime ? { runtime } : {},
741
- ...typeof revalidate === "number" && revalidate > 0 ? { revalidateSeconds: revalidate } : {}
742
- };
743
- }
744
- function hasBuildCapturedCacheControl(metadata) {
745
- return (metadata?.headers ?? []).some(([key]) => key.toLowerCase() === "cache-control");
746
- }
747
- async function builtFileInfo(outPath, pathname, staticFiles = {}, nextStaticFallback = false) {
748
- const file = await firstFile(
749
- path2.join(outPath, "public"),
750
- builtFileCandidates(outPath, pathname, nextStaticFallback)
751
- );
752
- if (!file) return null;
753
- const publicPath = path2.join(outPath, "public");
754
- const fileStat = await stat(file);
755
- const relative = path2.relative(publicPath, file).split(path2.sep).join("/");
756
- return { file, relative, mtimeMs: fileStat.mtimeMs, metadata: staticFiles[relative] };
757
- }
758
- function builtFileCandidates(outPath, pathname, nextStaticFallback = false) {
759
- const publicPath = path2.join(outPath, "public");
760
- const trimmed = pathname.replace(/^\/+/, "");
761
- if (pathname === "/") return [path2.join(publicPath, "index.html")];
762
- const candidates = [
763
- path2.join(publicPath, trimmed, "index.html"),
764
- path2.join(publicPath, trimmed),
765
- path2.join(publicPath, `${trimmed.replace(/\/+$/, "")}.html`)
766
- ];
767
- try {
768
- const decoded = decodeURIComponent(trimmed);
769
- if (decoded !== trimmed && !decoded.split("/").some((seg) => seg === ".." || seg === "")) {
770
- candidates.push(
771
- path2.join(publicPath, decoded, "index.html"),
772
- path2.join(publicPath, `${decoded.replace(/\/+$/, "")}.html`)
773
- );
774
- }
775
- } catch {
776
- }
777
- if (nextStaticFallback && trimmed.startsWith("_next/static/")) {
778
- const asset = trimmed.slice("_next/static/".length);
779
- candidates.push(path2.join(publicPath, "assets", asset));
780
- }
781
- return candidates;
782
- }
783
- function lazyStaticHtmlPath(outPath, pathname) {
784
- const publicPath = path2.join(outPath, "public");
785
- const file = pathname === "/" ? path2.join(publicPath, "index.html") : path2.join(publicPath, pathname.replace(/^\/+|\/+$/g, ""), "index.html");
786
- const relative = path2.relative(publicPath, file);
787
- if (relative.startsWith("..") || path2.isAbsolute(relative)) return null;
788
- return file;
789
- }
790
- function lazyStaticHandlerPath(outPath, pathname) {
791
- if (pathname === "/") return null;
792
- const publicPath = path2.join(outPath, "public");
793
- const file = path2.join(publicPath, pathname.replace(/^\/+|\/+$/g, ""));
794
- const relative = path2.relative(publicPath, file);
795
- if (relative.startsWith("..") || path2.isAbsolute(relative)) return null;
796
- return file;
797
- }
798
- function isHtmlPageFile(file) {
799
- return file.endsWith(".html");
800
- }
801
- function cacheLifeResponseHeaders(life) {
802
- if (!life) return [];
803
- const headers = [];
804
- const { revalidateSeconds, expireSeconds, staleSeconds } = life;
805
- if (revalidateSeconds !== void 0 && expireSeconds !== void 0) {
806
- const swr = Math.max(0, expireSeconds - revalidateSeconds);
807
- headers.push(["cache-control", `s-maxage=${revalidateSeconds}, stale-while-revalidate=${swr}`]);
808
- }
809
- if (staleSeconds !== void 0) headers.push(["x-nextjs-stale-time", String(staleSeconds)]);
810
- return headers;
811
- }
812
- function isImmutableAssetFile(relative) {
813
- return relative.startsWith("assets/") || relative.startsWith("_next/static/");
814
- }
815
- function dynamicParamsAllowed(route, params) {
816
- const governed = route.segmentConfig?.dynamicParamsFalse;
817
- if (!governed?.length) return true;
818
- const allowed = route.prerenderedParams ?? [];
819
- const required = route.segmentConfig?.strictDynamicParams ? [...route.params, ...route.catchAll ? [route.catchAll] : []] : governed;
820
- return allowed.some((set) => required.every((param) => paramValueEqual(set[param], params[param])));
821
- }
822
- function paramValueEqual(a, b) {
823
- if (a === void 0 || b === void 0) return false;
824
- const join = (value) => Array.isArray(value) ? value.join("/") : value;
825
- return join(a) === join(b);
826
- }
827
- async function maybeBuiltFile(outPath, pathname, staticFiles = {}, method = "GET", requestHeaders, nextStaticFallback = false) {
828
- const normalizedMethod = method.toUpperCase();
829
- if (normalizedMethod !== "GET" && normalizedMethod !== "HEAD") return null;
830
- const publicPath = path2.join(outPath, "public");
831
- const file = await firstFile(
832
- publicPath,
833
- builtFileCandidates(outPath, pathname, nextStaticFallback)
834
- );
835
- if (!file) return null;
836
- const relative = path2.relative(publicPath, file).split(path2.sep).join("/");
837
- const metadata = staticFiles[relative];
838
- const headers = new Headers(metadata?.headers);
839
- if (!headers.has("content-type")) headers.set("content-type", contentType(file));
840
- const fileStat = await stat(file);
841
- const variant = requestHeaders?.get("rsc") === "1" ? "-rsc" : "";
842
- const etag = `W/"${fileStat.size.toString(16)}-${Math.trunc(fileStat.mtimeMs).toString(16)}${variant}"`;
843
- if (!headers.has("cache-control")) {
844
- headers.set("cache-control", immutableAssetPath(relative) ? immutableCacheControl : "no-cache");
845
- headers.set("etag", etag);
846
- if (requestHeaders?.get("if-none-match") === etag) {
847
- return new Response(null, { status: 304, headers });
848
- }
849
- }
850
- const raw = await readFile(file);
851
- let body = raw;
852
- if (compressibleContentType(headers.get("content-type") ?? "") && raw.length > 1024 && acceptsGzip(requestHeaders)) {
853
- const zipped = cachedGzip(`${file}:${etag}`, raw);
854
- if (zipped.length < raw.length) {
855
- body = zipped;
856
- headers.set("content-encoding", "gzip");
857
- headers.append("vary", "accept-encoding");
858
- }
859
- }
860
- return new Response(normalizedMethod === "HEAD" ? null : body, {
861
- status: metadata?.status ?? 200,
862
- headers
863
- });
864
- }
865
- function appendVaryToken(headers, token) {
866
- const existing = headers.get("vary");
867
- if (!existing) {
868
- headers.set("vary", token);
869
- return;
870
- }
871
- const tokens = existing.split(",").map((part) => part.trim().toLowerCase());
872
- if (tokens.includes(token.toLowerCase()) || tokens.includes("*")) return;
873
- headers.set("vary", `${existing}, ${token}`);
874
- }
875
- function compressResponse(response, request) {
876
- if (!response.body || response.status === 304 || response.status === 204) return response;
877
- if (response.headers.get("content-encoding")) return response;
878
- if (!compressibleContentType(response.headers.get("content-type") ?? "")) return response;
879
- const headers = new Headers(response.headers);
880
- appendVaryToken(headers, "accept-encoding");
881
- if (!acceptsGzip(request.headers)) {
882
- return new Response(response.body, { status: response.status, headers });
883
- }
884
- const knownLength = Number(headers.get("content-length"));
885
- if (Number.isFinite(knownLength) && knownLength <= 1024) {
886
- return new Response(response.body, { status: response.status, headers });
887
- }
888
- headers.set("content-encoding", "gzip");
889
- headers.delete("content-length");
890
- return new Response(streamingGzip(response.body), {
891
- status: response.status,
892
- headers
893
- });
894
- }
895
- function streamingGzip(body) {
896
- const gzip = createGzip();
897
- const reader = body.getReader();
898
- void (async () => {
899
- try {
900
- for (; ; ) {
901
- const { done, value } = await reader.read();
902
- if (done) break;
903
- gzip.write(value);
904
- await new Promise((resolve) => gzip.flush(zlibConstants.Z_SYNC_FLUSH, resolve));
905
- }
906
- gzip.end();
907
- } catch (error) {
908
- gzip.destroy(error);
909
- reader.cancel(error).catch(() => void 0);
910
- }
911
- })();
912
- return Readable.toWeb(gzip);
913
- }
914
- function compressibleContentType(type) {
915
- return /^(text\/|application\/(javascript|json|manifest|xml)|image\/svg)/.test(type);
916
- }
917
- function acceptsGzip(requestHeaders) {
918
- return requestHeaders?.get("accept-encoding")?.includes("gzip") ?? false;
919
- }
920
- var gzipCache = /* @__PURE__ */ new Map();
921
- var gzipCacheLimit = 512;
922
- function cachedGzip(key, body) {
923
- const cached = gzipCache.get(key);
924
- if (cached) return cached;
925
- const zipped = gzipSync(body, { level: 6 });
926
- if (gzipCache.size >= gzipCacheLimit) {
927
- const oldest = gzipCache.keys().next().value;
928
- if (oldest !== void 0) gzipCache.delete(oldest);
929
- }
930
- gzipCache.set(key, zipped);
931
- return zipped;
932
- }
933
- var immutableCacheControl = "public, max-age=31536000, immutable";
934
- function immutableAssetPath(relativePath) {
935
- return immutableAssetPrefixes().some((prefix) => relativePath.startsWith(prefix));
936
- }
937
- function immutableAssetPrefixes() {
938
- return [
939
- "assets/",
940
- "_next/static/",
941
- ...getAssetExtensions().staticAssetPublicPrefixes().map((prefix) => prefix.replace(/^\/+/, ""))
942
- ];
943
- }
944
- async function firstFile(root, files) {
945
- for (const file of files) {
946
- if (!isInside(root, file)) continue;
947
- if (!existsSync(file)) continue;
948
- if ((await stat(file)).isFile()) return file;
949
- }
950
- return null;
951
- }
952
- function isInside(root, file) {
953
- const relative = path2.relative(root, file);
954
- return relative === "" || !relative.startsWith("..") && !path2.isAbsolute(relative);
955
- }
956
- export {
957
- compressResponse,
958
- createRequestHandler,
959
- immutableAssetPath,
960
- immutableAssetPrefixes,
961
- immutableCacheControl,
962
- maybeBuiltFile
963
- };