@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,2397 +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
- safeDecode
7
- } from "./chunk-JRPJM2XY.js";
8
- import {
9
- dynamicCallsFromSource,
10
- nextCompatEnabled,
11
- pnextDynamicImportNames,
12
- rewriteLiteralDynamicCalls
13
- } from "./chunk-CCATPVTW.js";
14
- import {
15
- clientReferenceId,
16
- dynamicCallFacts,
17
- scanFacts,
18
- ssrClientReference
19
- } from "./chunk-NQE46AZN.js";
20
- import {
21
- cssModuleScopePath,
22
- ensureDir,
23
- listFiles,
24
- listFilesSync,
25
- readDirListing,
26
- readText,
27
- toPosixPath,
28
- withDirCache
29
- } from "./chunk-2HFY3DQT.js";
30
- import {
31
- alwaysClientEntryReasons,
32
- classifyRouteDependencies,
33
- extraBoundaryConventionNames,
34
- extraPageExtensions,
35
- getBundlerExtensions,
36
- getCssExtensions,
37
- resolveImport,
38
- resolveModuleAlias,
39
- resolvePackageSpecifier,
40
- sourceClientEntryReasons,
41
- sourceUsesRegisteredRequestApi
42
- } from "./chunk-4P5CMIYT.js";
43
-
44
- // ../node_modules/.bun/@wular+pnext@0.1.5+62547eec5a2188e3/node_modules/@wular/pnext/src/routing/routes.ts
45
- import path4 from "node:path";
46
- import { existsSync as existsSync3 } from "node:fs";
47
-
48
- // ../node_modules/.bun/@wular+pnext@0.1.5+62547eec5a2188e3/node_modules/@wular/pnext/src/resolve/source-text.ts
49
- import { readFileSync } from "node:fs";
50
- import { readFile } from "node:fs/promises";
51
- var disabled = process.env.PNEXT_SRC_CACHE === "0";
52
- var contents = /* @__PURE__ */ new Map();
53
- var inflight = /* @__PURE__ */ new Map();
54
- var scoped = false;
55
- var reads = 0;
56
- var hits = 0;
57
- function readSourceSync(file) {
58
- if (!scoped) return readFileSync(file, "utf8");
59
- const cached = contents.get(file);
60
- if (cached !== void 0) {
61
- hits += 1;
62
- return cached;
63
- }
64
- reads += 1;
65
- const source = readFileSync(file, "utf8");
66
- contents.set(file, source);
67
- return source;
68
- }
69
- async function readSourceText(file) {
70
- if (!scoped) return readFile(file, "utf8");
71
- const cached = contents.get(file);
72
- if (cached !== void 0) {
73
- hits += 1;
74
- return cached;
75
- }
76
- const pending = inflight.get(file);
77
- if (pending) {
78
- hits += 1;
79
- return pending;
80
- }
81
- reads += 1;
82
- const read = (async () => {
83
- try {
84
- const source = await readFile(file, "utf8");
85
- contents.set(file, source);
86
- return source;
87
- } finally {
88
- inflight.delete(file);
89
- }
90
- })();
91
- inflight.set(file, read);
92
- return read;
93
- }
94
-
95
- // ../node_modules/.bun/@wular+pnext@0.1.5+62547eec5a2188e3/node_modules/@wular/pnext/src/css/build.ts
96
- import { existsSync as existsSync2, readFileSync as readFileSync3 } from "node:fs";
97
- import { readFile as readFile2, rename, writeFile as writeFile2 } from "node:fs/promises";
98
- import path2 from "node:path";
99
-
100
- // ../node_modules/.bun/@wular+pnext@0.1.5+62547eec5a2188e3/node_modules/@wular/pnext/src/utils/asset-hash.ts
101
- import { createHash } from "node:crypto";
102
- function assetContentHash(bytes) {
103
- return createHash("sha256").update(bytes).digest("hex").slice(0, 16);
104
- }
105
- function hashedAssetName(name, bytes) {
106
- const hash = assetContentHash(bytes);
107
- const dot = name.lastIndexOf(".");
108
- return dot <= 0 ? `${name}-${hash}` : `${name.slice(0, dot)}-${hash}${name.slice(dot)}`;
109
- }
110
-
111
- // ../node_modules/.bun/@wular+pnext@0.1.5+62547eec5a2188e3/node_modules/@wular/pnext/src/css/postcss.ts
112
- import { createHash as createHash2 } from "node:crypto";
113
- import { createRequire } from "node:module";
114
- import {
115
- existsSync,
116
- mkdirSync,
117
- readFileSync as readFileSync2,
118
- realpathSync,
119
- renameSync,
120
- statSync,
121
- writeFileSync
122
- } from "node:fs";
123
- import { writeFile } from "node:fs/promises";
124
- import path from "node:path";
125
- import { pathToFileURL } from "node:url";
126
- var tailwindScannerPatch = Symbol.for("pnext.tailwind-scanner-v1");
127
-
128
- // ../node_modules/.bun/@wular+pnext@0.1.5+62547eec5a2188e3/node_modules/@wular/pnext/src/css/build.ts
129
- var cssRuntimeRegistered = false;
130
- function globalCssSources(config) {
131
- return globalCssSourcesForPaths(config.root, config.appPath, config.workspaceRoot);
132
- }
133
- var globalCssSourceCache = /* @__PURE__ */ new Map();
134
- var globalCssStore;
135
- function globalCssSourcesForPaths(root, appPath, workspaceRoot) {
136
- const key = `${root}\0${appPath}\0${workspaceRoot ?? ""}`;
137
- const cached = globalCssSourceCache.get(key);
138
- if (cached) return cached;
139
- const stored = globalCssStore?.load(key);
140
- if (stored) {
141
- globalCssSourceCache.set(key, stored);
142
- return stored;
143
- }
144
- const sources = /* @__PURE__ */ new Set();
145
- const visited = /* @__PURE__ */ new Set();
146
- const missing = /* @__PURE__ */ new Set();
147
- collectGlobalCssSources(
148
- root,
149
- rootLayoutFile(appPath, missing),
150
- sources,
151
- visited,
152
- missing,
153
- workspaceRoot
154
- );
155
- const resolved = [...sources].map((file) => path2.resolve(file));
156
- globalCssSourceCache.set(key, resolved);
157
- globalCssStore?.save(key, resolved, [...visited], [...missing]);
158
- return resolved;
159
- }
160
- function collectGlobalCssSources(root, file, sources, visited, missing, workspaceRoot) {
161
- const resolvedFile = path2.resolve(file);
162
- if (visited.has(resolvedFile)) return;
163
- if (!existsSync2(resolvedFile)) {
164
- missing?.add(resolvedFile);
165
- return;
166
- }
167
- visited.add(resolvedFile);
168
- for (const specifier of moduleSpecifiers(readFileSync3(resolvedFile, "utf8"))) {
169
- const resolved = resolveImport(root, resolvedFile, specifier, workspaceRoot);
170
- if (!resolved) continue;
171
- if (isCssFile(resolved)) {
172
- sources.add(resolved);
173
- } else {
174
- collectGlobalCssSources(root, resolved, sources, visited, missing, workspaceRoot);
175
- }
176
- }
177
- }
178
- function rootLayoutFile(appPath, missing) {
179
- for (const extension of ["tsx", "ts", "jsx", "js", "mjs", ...extraPageExtensions()]) {
180
- const file = path2.join(appPath, `layout.${extension}`);
181
- if (existsSync2(file)) return file;
182
- missing?.add(file);
183
- }
184
- return path2.join(appPath, "layout.tsx");
185
- }
186
- function globalCssHref(config) {
187
- return globalCssSources(config).length > 0 ? assetHref(config, "global.css") : void 0;
188
- }
189
- var emittedAssets = /* @__PURE__ */ new Map();
190
- function recordEmittedAsset(outPath, logical, emitted) {
191
- const names = emittedAssets.get(outPath) ?? /* @__PURE__ */ new Map();
192
- names.set(logical, emitted);
193
- emittedAssets.set(outPath, names);
194
- }
195
- function publishEmittedAssets(outPath, names) {
196
- if (!names) return;
197
- for (const [logical, emitted] of Object.entries(names))
198
- recordEmittedAsset(outPath, logical, emitted);
199
- }
200
- function emittedAssetName(config, name) {
201
- if (!config?.outPath) return name;
202
- return emittedAssets.get(config.outPath)?.get(name) ?? name;
203
- }
204
- function assetPathname(config, name) {
205
- const emitted = emittedAssetName(config, name);
206
- return nextCompatEnabled(config ?? {}) ? `/_next/static/${emitted}` : `/assets/${emitted}`;
207
- }
208
- function assetHref(config, name) {
209
- return withAssetPrefix(config, assetPathname(config, name));
210
- }
211
- function routeCssAssetNames(route) {
212
- if (route.cssImports.length === 0) return [];
213
- return route.cssAssets?.length ? route.cssAssets : [`${route.id}.css`];
214
- }
215
- function routeCssHref(route, config) {
216
- const assets = routeCssAssetNames(route);
217
- if (assets.length === 0) return void 0;
218
- return assets.map((asset) => assetHref(config, asset));
219
- }
220
- async function emitFontCssStylesheet(config, routeId2, fontCss, baseAsset, options) {
221
- const outDir = path2.join(config.outPath, options.dev ? "cache" : "public", "assets");
222
- await ensureDir(outDir);
223
- const baseFile = baseAsset ? path2.join(outDir, baseAsset) : void 0;
224
- const baseCss = baseFile && existsSync2(baseFile) ? await readFile2(baseFile, "utf8") : "";
225
- const contents2 = [fontCss, baseCss].filter(Boolean).join("\n");
226
- const logicalName = baseAsset ? baseAsset.replace(/-[0-9a-f]{16}(?=\.css$)/, "") : `${routeId2}.css`;
227
- const name = hashedAssetName(logicalName, contents2);
228
- const file = path2.join(outDir, name);
229
- if (!existsSync2(file) || await readFile2(file, "utf8") !== contents2)
230
- await writeFile2(file, contents2);
231
- return name;
232
- }
233
- function withAssetPrefix(config, href) {
234
- const prefix = config?.assetPrefix;
235
- if (!prefix) return href;
236
- return `${prefix.replace(/\/$/, "")}${href}`;
237
- }
238
- function moduleSpecifiers(source) {
239
- const specifiers = [];
240
- const pattern = /(?:import|export)\s+(?:[^'";]+?\s+from\s+)?['"]([^'"]+)['"]/g;
241
- let match;
242
- while (match = pattern.exec(source)) {
243
- if (match[1]) specifiers.push(match[1]);
244
- }
245
- return specifiers;
246
- }
247
- function cssFileExtensions() {
248
- return [".css", ...getCssExtensions().extraCssExtensions()];
249
- }
250
- function isCssFile(file) {
251
- return cssFileExtensions().some((extension) => file.endsWith(extension));
252
- }
253
- function registerCssRuntime() {
254
- if (cssRuntimeRegistered) return;
255
- cssRuntimeRegistered = true;
256
- Bun.plugin({
257
- name: "pnext-css-runtime",
258
- setup(plugin) {
259
- plugin.onLoad(
260
- { filter: /\.(?:css|scss|sass)$/ },
261
- async ({ path: file }) => isCssModuleFile(file) ? {
262
- exports: { default: await cssModuleMapping(file) },
263
- loader: "object"
264
- } : {
265
- contents: "export default undefined;",
266
- loader: "js"
267
- }
268
- );
269
- }
270
- });
271
- }
272
- function isCssModuleFile(file) {
273
- return /\.module\.(?:css|scss|sass)$/.test(file);
274
- }
275
- var CSS_CONFIG_AT_RULES = /* @__PURE__ */ new Set(["source", "plugin", "config"]);
276
- function hoistCssImports(source) {
277
- if (!/@(?:source|plugin|config)\b/.test(source)) return source;
278
- const imports = [];
279
- const others = [];
280
- let charset = "";
281
- let sawDirective = false;
282
- let hoist = false;
283
- let index = 0;
284
- while (index < source.length) {
285
- const code = source.charCodeAt(index);
286
- if (code === 32 || code === 9 || code === 10 || code === 13 || code === 12) {
287
- index += 1;
288
- continue;
289
- }
290
- const char = source[index];
291
- if (char === "/" && source[index + 1] === "*") {
292
- const end2 = source.indexOf("*/", index + 2);
293
- if (end2 === -1) break;
294
- others.push(source.slice(index, end2 + 2));
295
- index = end2 + 2;
296
- continue;
297
- }
298
- const name = char === "@" ? /^@([\w-]+)/.exec(source.slice(index))?.[1] : void 0;
299
- if (!name) break;
300
- if (name !== "import" && name !== "charset" && !CSS_CONFIG_AT_RULES.has(name)) break;
301
- const end = statementEnd(source, index);
302
- if (end === -1) break;
303
- const statement = source.slice(index, end);
304
- if (name === "charset") charset ||= statement;
305
- else if (name === "import") {
306
- imports.push(statement);
307
- if (sawDirective) hoist = true;
308
- } else {
309
- others.push(statement);
310
- sawDirective = true;
311
- }
312
- index = end;
313
- }
314
- if (!hoist) return source;
315
- return `${[charset, ...imports, ...others].filter(Boolean).join("\n")}
316
- ${source.slice(index)}`;
317
- }
318
- function statementEnd(source, start) {
319
- for (let index = start; index < source.length; index += 1) {
320
- const char = source[index];
321
- if (char === ";") return index + 1;
322
- if (char === "{" || char === "}") return -1;
323
- if (char === '"' || char === "'") {
324
- index = skipString(source, index);
325
- if (index === -1) return -1;
326
- }
327
- }
328
- return -1;
329
- }
330
- function skipString(source, start) {
331
- const quote = source[start];
332
- for (let index = start + 1; index < source.length; index += 1) {
333
- const char = source[index];
334
- if (char === "\\") index += 1;
335
- else if (char === quote) return index;
336
- }
337
- return -1;
338
- }
339
- async function cssModuleMapping(file) {
340
- const compatMapping = getCssExtensions().resolveCssModule(file);
341
- if (compatMapping) return compatMapping;
342
- const source = await readText(file);
343
- const classNames = cssClassNames(source);
344
- return Object.fromEntries(
345
- [...classNames].map((className) => [className, cssModuleClassName(file, className)])
346
- );
347
- }
348
- function cssClassNames(source) {
349
- const classNames = /* @__PURE__ */ new Set();
350
- const classPattern = /(^|[^\\])\.(-?[_a-zA-Z][\w-]*)/g;
351
- let match;
352
- while (match = classPattern.exec(source)) {
353
- if (match[2]) classNames.add(match[2]);
354
- }
355
- return classNames;
356
- }
357
- function cssModuleClassName(file, className) {
358
- const base = path2.basename(file).replace(/\.module\.css$/, "").replace(/[^_a-zA-Z0-9]/g, "_");
359
- const hash = pathHash(cssModuleScopePath(file));
360
- return `${base}_${className}_${hash}`;
361
- }
362
- function pathHash(file) {
363
- let hash = 5381;
364
- for (const char of file) hash = (hash << 5) + hash ^ char.charCodeAt(0);
365
- return (hash >>> 0).toString(36).slice(0, 5);
366
- }
367
-
368
- // ../node_modules/.bun/@wular+pnext@0.1.5+62547eec5a2188e3/node_modules/@wular/pnext/src/routing/slots.ts
369
- import path3 from "node:path";
370
- var pageExtensions = ["tsx", "ts", "jsx", "js", "mjs"];
371
- var interceptionMarkers = ["(..)(..)", "(...)", "(..)", "(.)"];
372
- var interceptionLevels = {
373
- "(.)": 0,
374
- "(..)": 1,
375
- "(..)(..)": 2,
376
- "(...)": Number.POSITIVE_INFINITY
377
- };
378
- function interceptionMarkerOf(segment) {
379
- return interceptionMarkers.find(
380
- (marker) => segment.startsWith(marker) && segment.length > marker.length
381
- );
382
- }
383
- function interceptionMarkerLevels(marker) {
384
- return interceptionLevels[marker];
385
- }
386
- function isSlotSegment(name) {
387
- return name.startsWith("@");
388
- }
389
- function isGroupSegment(name) {
390
- return name.startsWith("(") && name.endsWith(")") && !interceptionMarkerOf(name);
391
- }
392
- function slotConventionFile(dir, base) {
393
- const { files } = readDirListing(dir);
394
- for (const extension of pageExtensions) {
395
- if (files.has(`${base}.${extension}`)) return path3.join(dir, `${base}.${extension}`);
396
- }
397
- return void 0;
398
- }
399
- function childDirectories(dir) {
400
- return readDirListing(dir).dirs;
401
- }
402
- function slotDirectoriesIn(dir) {
403
- return childDirectories(dir).filter(isSlotSegment).map((name) => path3.join(dir, name));
404
- }
405
- function consumedSegments(appPath, dir) {
406
- const relative = path3.relative(appPath, dir);
407
- if (relative.startsWith("..")) return 0;
408
- let consumed = 0;
409
- for (const name of relative.split(path3.sep).filter(Boolean)) {
410
- if (isGroupSegment(name) || isSlotSegment(name)) continue;
411
- const marker = interceptionMarkerOf(name);
412
- const bare = marker ? name.slice(marker.length) : name;
413
- if (/^\[\[?\.\.\./.test(bare)) return Number.POSITIVE_INFINITY;
414
- consumed += 1;
415
- }
416
- return consumed;
417
- }
418
- function matchSegments(dir, segments, options = {}, params = {}, dirs = []) {
419
- const children = childDirectories(dir);
420
- const groups = children.filter(isGroupSegment);
421
- if (segments.length === 0) {
422
- const page = slotConventionFile(dir, "page");
423
- if (page) return { file: page, dirs, params };
424
- for (const group of groups) {
425
- const match = matchSegments(path3.join(dir, group), [], options, params, [...dirs, group]);
426
- if (match) return match;
427
- }
428
- for (const name of children) {
429
- const param = optionalCatchAllName(bareName(name, options));
430
- if (!param) continue;
431
- const match = matchSegments(path3.join(dir, name), [], options, { ...params, [param]: [] }, [
432
- ...dirs,
433
- name
434
- ]);
435
- if (match) return match;
436
- }
437
- if (options.markersAsSegments && (slotConventionFile(dir, "layout") || children.some(isSlotSegment))) {
438
- return { dirs, params };
439
- }
440
- return null;
441
- }
442
- const [head, ...rest] = segments;
443
- for (const name of children) {
444
- if (bareName(name, options) !== head) continue;
445
- const match = matchSegments(path3.join(dir, name), rest, options, params, [...dirs, name]);
446
- if (match) return match;
447
- }
448
- for (const group of groups) {
449
- const match = matchSegments(path3.join(dir, group), segments, options, params, [...dirs, group]);
450
- if (match) return match;
451
- }
452
- for (const name of children) {
453
- const param = dynamicParamName(bareName(name, options));
454
- if (!param) continue;
455
- const match = matchSegments(
456
- path3.join(dir, name),
457
- rest,
458
- options,
459
- { ...params, [param]: safeDecode(head) },
460
- [...dirs, name]
461
- );
462
- if (match) return match;
463
- }
464
- for (const name of children) {
465
- const bare = bareName(name, options);
466
- const param = catchAllName(bare) ?? optionalCatchAllName(bare);
467
- if (!param) continue;
468
- const match = matchSegments(
469
- path3.join(dir, name),
470
- [],
471
- options,
472
- { ...params, [param]: segments.map(safeDecode) },
473
- [...dirs, name]
474
- );
475
- if (match) return match;
476
- }
477
- return null;
478
- }
479
- function bareName(name, options) {
480
- if (isSlotSegment(name)) return "\0";
481
- const marker = interceptionMarkerOf(name);
482
- if (!marker) return name;
483
- return options.markersAsSegments ? name.slice(marker.length) : "\0";
484
- }
485
- function dynamicParamName(name) {
486
- const match = /^\[([^\].]+)\]$/.exec(name);
487
- return match?.[1];
488
- }
489
- function catchAllName(name) {
490
- const match = /^\[\.\.\.([^\]]+)\]$/.exec(name);
491
- return match?.[1];
492
- }
493
- function optionalCatchAllName(name) {
494
- const match = /^\[\[\.\.\.([^\]]+)\]\]$/.exec(name);
495
- return match?.[1];
496
- }
497
- function childrenDefaultFile(dir, segments) {
498
- let current = dir;
499
- let best = slotConventionFile(current, "default");
500
- for (const segment of segments) {
501
- const next = childSegmentDir(current, segment);
502
- if (!next) break;
503
- current = next;
504
- best = slotConventionFile(current, "default") ?? best;
505
- }
506
- return best;
507
- }
508
- function childSegmentDir(dir, segment) {
509
- const children = childDirectories(dir);
510
- if (children.includes(segment)) return path3.join(dir, segment);
511
- for (const group of children.filter(isGroupSegment)) {
512
- const nested = childSegmentDir(path3.join(dir, group), segment);
513
- if (nested) return nested;
514
- }
515
- const dynamic = children.find((name) => dynamicParamName(name));
516
- if (dynamic) return path3.join(dir, dynamic);
517
- return void 0;
518
- }
519
- function slotInterceptorUnits(appPath, slotDir) {
520
- const owner = routeTokensForDir(appPath, path3.dirname(slotDir));
521
- if (!owner) return [];
522
- const units = [];
523
- collectInterceptorUnits(slotDir, owner, [], units);
524
- return units;
525
- }
526
- function collectInterceptorUnits(dir, owner, inner, units) {
527
- for (const name of childDirectories(dir)) {
528
- const child = path3.join(dir, name);
529
- if (isSlotSegment(name) || isGroupSegment(name)) {
530
- collectInterceptorUnits(child, owner, inner, units);
531
- continue;
532
- }
533
- const marker = interceptionMarkerOf(name);
534
- if (marker) {
535
- const bare = name.slice(marker.length);
536
- const levels = interceptionLevels[marker];
537
- const context = [...owner, ...inner];
538
- const kept = levels === Number.POSITIVE_INFINITY ? [] : context.slice(0, Math.max(0, context.length - levels));
539
- const target = [...kept, segmentToken(bare)];
540
- units.push({
541
- dir: child,
542
- targetSegments: target.map((token) => token.route),
543
- targetPattern: target.map((token) => token.pattern).join("/"),
544
- params: target.filter((token) => token.param).map((token) => ({ name: token.param, catchAll: Boolean(token.catchAll) })),
545
- catchAllTail: Boolean(target[target.length - 1]?.catchAll)
546
- });
547
- continue;
548
- }
549
- collectInterceptorUnits(child, owner, [...inner, segmentToken(name)], units);
550
- }
551
- }
552
- function routeTokensForDir(appPath, dir) {
553
- const relative = path3.relative(appPath, dir);
554
- if (relative.startsWith("..")) return void 0;
555
- let tokens = [];
556
- for (const name of toPosixPath(relative).split("/").filter(Boolean)) {
557
- if (isGroupSegment(name) || isSlotSegment(name)) continue;
558
- const marker = interceptionMarkerOf(name);
559
- if (marker) {
560
- const levels = interceptionLevels[marker];
561
- tokens = levels === Number.POSITIVE_INFINITY ? [] : tokens.slice(0, Math.max(0, tokens.length - levels));
562
- tokens.push(segmentToken(name.slice(marker.length)));
563
- continue;
564
- }
565
- tokens.push(segmentToken(name));
566
- }
567
- return tokens;
568
- }
569
- function segmentToken(name) {
570
- const optional = optionalCatchAllName(name);
571
- if (optional) return { route: `:${optional}*`, pattern: "(.*)", param: optional, catchAll: true };
572
- const catchAll = catchAllName(name);
573
- if (catchAll) return { route: `:${catchAll}*`, pattern: "(.*)", param: catchAll, catchAll: true };
574
- const param = dynamicParamName(name);
575
- if (param) return { route: `:${param}`, pattern: "([^/]+)", param };
576
- return { route: name, pattern: escapeRegex(name) };
577
- }
578
- function matchSlotInterceptor(appPath, slotDir, pathname) {
579
- const segments = pathnameSegments(pathname);
580
- const markerOwner = markerOwnerTokens(appPath, slotDir);
581
- if (markerOwner) {
582
- const params = matchTargetTokens(markerOwner, pathname);
583
- if (params) {
584
- const rest = markerOwner.at(-1)?.catchAll ? [] : segments.slice(markerOwner.length);
585
- const inner = matchSegments(slotDir, rest, { markersAsSegments: true }, params, []);
586
- if (inner) return inner;
587
- }
588
- }
589
- const units = slotInterceptorUnits(appPath, slotDir).sort(
590
- (a, b) => Number(a.catchAllTail) - Number(b.catchAllTail) || b.targetSegments.length - a.targetSegments.length || a.params.length - b.params.length
591
- );
592
- for (const unit of units) {
593
- const regex = new RegExp(`^/${unit.targetPattern}(?:/(.*))?$`);
594
- const match = regex.exec(pathname.replace(/\/+$/, "") || "/");
595
- if (!match) continue;
596
- const params = {};
597
- unit.params.forEach((param, index) => {
598
- const value = match[index + 1] ?? "";
599
- params[param.name] = param.catchAll ? value.split("/").filter(Boolean).map(safeDecode) : safeDecode(value);
600
- });
601
- const rest = unit.catchAllTail ? [] : segments.slice(unit.targetSegments.length);
602
- const inner = matchSegments(unit.dir, rest, { markersAsSegments: true }, params, []);
603
- if (inner) {
604
- return {
605
- file: inner.file,
606
- dirs: [path3.basename(unit.dir), ...inner.dirs],
607
- params: inner.params
608
- };
609
- }
610
- }
611
- return null;
612
- }
613
- function markerOwnerTokens(appPath, slotDir) {
614
- const relative = path3.relative(appPath, slotDir);
615
- if (relative.startsWith("..")) return null;
616
- const segments = toPosixPath(relative).split("/").filter(Boolean);
617
- const markerIndex = segments.findIndex((segment) => Boolean(interceptionMarkerOf(segment)));
618
- if (markerIndex === -1) return null;
619
- return routeTokensForDir(appPath, path3.join(appPath, ...segments.slice(0, markerIndex + 1))) ?? null;
620
- }
621
- function matchTargetTokens(tokens, pathname) {
622
- const pattern = tokens.map((token) => token.pattern).join("/");
623
- const regex = new RegExp(`^/${pattern}(?:/.*)?$`);
624
- const match = regex.exec(pathname.replace(/\/+$/, "") || "/");
625
- if (!match) return null;
626
- const params = {};
627
- tokens.filter((token) => token.param).forEach((token, index) => {
628
- const value = match[index + 1] ?? "";
629
- params[token.param] = token.catchAll ? value.split("/").filter(Boolean).map(safeDecode) : safeDecode(value);
630
- });
631
- return params;
632
- }
633
- function pathnameSegments(pathname) {
634
- return pathname.split("?")[0].split("/").filter(Boolean);
635
- }
636
- function escapeRegex(value) {
637
- return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
638
- }
639
-
640
- // ../node_modules/.bun/@wular+pnext@0.1.5+62547eec5a2188e3/node_modules/@wular/pnext/src/routing/routes.ts
641
- var BASE_PAGE_EXTENSIONS = ["tsx", "ts", "jsx", "js", "mjs"];
642
- var BASE_ROUTE_HANDLER_EXTENSIONS = ["ts", "tsx", "js", "mjs"];
643
- function pageExtensions2() {
644
- return [.../* @__PURE__ */ new Set([...BASE_PAGE_EXTENSIONS, ...extraPageExtensions()])];
645
- }
646
- function routeHandlerExtensions() {
647
- return BASE_ROUTE_HANDLER_EXTENSIONS;
648
- }
649
- function allFileExtensions() {
650
- return [.../* @__PURE__ */ new Set([...pageExtensions2(), ...routeHandlerExtensions()])];
651
- }
652
- var componentConventions = ["loading", "error", "not-found"];
653
- function boundaryConventions() {
654
- return [...componentConventions, ...extraBoundaryConventionNames()];
655
- }
656
- var globalErrorBase = "global-error";
657
- var memoPageFile;
658
- var memoRouteFilePattern;
659
- var memoDefaultConventionPattern;
660
- var memoMetadataCodeFilePattern;
661
- var memoPageOrRouteTrailing;
662
- var memoSlotConventionPattern;
663
- var memoExtensionsKey;
664
- function freshMemos() {
665
- const key = extraPageExtensions().join(",");
666
- if (key === memoExtensionsKey) return;
667
- memoExtensionsKey = key;
668
- memoPageFile = void 0;
669
- memoRouteFilePattern = void 0;
670
- memoDefaultConventionPattern = void 0;
671
- memoMetadataCodeFilePattern = void 0;
672
- memoPageOrRouteTrailing = void 0;
673
- memoSlotConventionPattern = void 0;
674
- }
675
- function pageFile() {
676
- freshMemos();
677
- return memoPageFile ??= extensionRegex("page", pageExtensions2());
678
- }
679
- function routeFilePattern() {
680
- freshMemos();
681
- return memoRouteFilePattern ??= extensionRegex("route", routeHandlerExtensions());
682
- }
683
- function defaultConventionPattern() {
684
- freshMemos();
685
- return memoDefaultConventionPattern ??= extensionRegex("default", pageExtensions2());
686
- }
687
- function metadataCodeFilePattern() {
688
- freshMemos();
689
- return memoMetadataCodeFilePattern ??= new RegExp(
690
- `(^|/)(robots|sitemap|manifest|icon\\d*|apple-icon\\d*|opengraph-image\\d*|twitter-image\\d*)\\.(${allFileExtensions().join(
691
- "|"
692
- )})$`
693
- );
694
- }
695
- function pageOrRouteTrailing() {
696
- freshMemos();
697
- return memoPageOrRouteTrailing ??= new RegExp(
698
- `/?(page|route|layout|template|loading|error|not-found|forbidden|unauthorized|default|global-error)\\.(${allFileExtensions().join(
699
- "|"
700
- )})$`
701
- );
702
- }
703
- function slotConventionPattern() {
704
- freshMemos();
705
- return memoSlotConventionPattern ??= new RegExp(
706
- `(^|/)(page|layout|template|loading|error|default|not-found)\\.(${pageExtensions2().join("|")})$`
707
- );
708
- }
709
- function extensionRegex(base, extensions) {
710
- return new RegExp(`(^|/)${escapeRegex2(base)}\\.(${extensions.join("|")})$`);
711
- }
712
- function conventionFileName(dir, base) {
713
- const { files } = readDirListing(dir);
714
- for (const extension of pageExtensions2()) {
715
- if (files.has(`${base}.${extension}`)) return path4.join(dir, `${base}.${extension}`);
716
- }
717
- return void 0;
718
- }
719
- function createScanContext(appPath, globalCss, workspaceRoot) {
720
- const root = rootFromAppPath(appPath);
721
- let memo;
722
- return {
723
- root,
724
- workspaceRoot,
725
- appPath,
726
- sources: /* @__PURE__ */ new Map(),
727
- edges: /* @__PURE__ */ new Map(),
728
- requestImportUsage: /* @__PURE__ */ new Map(),
729
- exists: /* @__PURE__ */ new Map(),
730
- useClient: /* @__PURE__ */ new Map(),
731
- usesLink: /* @__PURE__ */ new Map(),
732
- usesNavigation: /* @__PURE__ */ new Map(),
733
- entryReasons: /* @__PURE__ */ new Map(),
734
- globalCssImports: globalCss ?? (() => memo ??= new Set(globalCssSourcesForPaths(root, appPath, workspaceRoot)))
735
- };
736
- }
737
- function fileExists(context, file) {
738
- let hit = context.exists.get(file);
739
- if (hit === void 0) {
740
- hit = existsSync3(file);
741
- context.exists.set(file, hit);
742
- }
743
- return hit;
744
- }
745
- var routeHandlerMethods = ["GET", "HEAD", "POST", "PUT", "PATCH", "DELETE", "OPTIONS"];
746
- var deferredFields = [
747
- "mode",
748
- "hasStaticParams",
749
- "usesRequest",
750
- "handlerUsesRevalidationApi",
751
- "dynamicErrorApi",
752
- "client",
753
- "clientReferences",
754
- "cssImports",
755
- "sourceFiles",
756
- "serverActionFile",
757
- "stream",
758
- "maxDuration",
759
- "ppr",
760
- "segmentConfig",
761
- "needsRouterEntry",
762
- "clientEntryReasons"
763
- ];
764
- var resolvedRoutes = /* @__PURE__ */ new WeakSet();
765
- var factsVersion = 0;
766
- function routeFactsVersion() {
767
- return factsVersion;
768
- }
769
- function routeFactsResolved(route) {
770
- return resolvedRoutes.has(route);
771
- }
772
- function materializeRouteFacts(routes, onRoute) {
773
- for (const route of routes) {
774
- void route.sourceFiles;
775
- onRoute?.(route);
776
- }
777
- return routes;
778
- }
779
- async function materializeRouteFactsPaced(routes, pause) {
780
- for (const route of routes) {
781
- await pause();
782
- void route.sourceFiles;
783
- }
784
- return routes;
785
- }
786
- var factsStore;
787
- function setRouteFactsStore(store) {
788
- factsStore = store;
789
- }
790
- function withDeferredFacts(appPath, base, compute) {
791
- const entry = base;
792
- let facts;
793
- const overrides = /* @__PURE__ */ new Map();
794
- for (const field of deferredFields) {
795
- Object.defineProperty(entry, field, {
796
- enumerable: true,
797
- configurable: true,
798
- get() {
799
- if (overrides.has(field)) return overrides.get(field);
800
- if (!facts) {
801
- const key = `${appPath}\0${base.kind}:${base.id}`;
802
- const stored = factsStore?.load(key);
803
- facts = stored ?? withDirCache(compute);
804
- if (!stored) factsStore?.save(key, facts);
805
- resolvedRoutes.add(entry);
806
- factsVersion += 1;
807
- }
808
- return facts[field];
809
- },
810
- set(value) {
811
- overrides.set(field, value);
812
- }
813
- });
814
- }
815
- return entry;
816
- }
817
- async function scanRoutes(appPath, workspaceRoot) {
818
- const files = await listFiles(appPath);
819
- return withDirCache(() => buildRouteTable(appPath, files, workspaceRoot));
820
- }
821
- function buildRouteTable(appPath, files, workspaceRoot) {
822
- const context = createScanContext(appPath, void 0, workspaceRoot);
823
- const routes = [];
824
- const slotPageFiles = [];
825
- const defaultPageFiles = [];
826
- const table = { parallelRoutes: false };
827
- for (const file of files) {
828
- const relative = toPosixPath(path4.relative(appPath, file));
829
- const routeFile = path4.join(appPath, relative);
830
- if (defaultConventionPattern().test(relative) && !relative.split("/").some((segment) => segment.startsWith("@"))) {
831
- defaultPageFiles.push({ file, relative });
832
- }
833
- if (isPrivateAppPath(relative)) continue;
834
- if (!pageFile().test(relative) && !routeFilePattern().test(relative)) {
835
- if (!metadataCodeFilePattern().test(relative)) continue;
836
- const source = readSource(context, file);
837
- const metadataParts = dynamicMetadataRouteParts(relative, source);
838
- if (!metadataParts) continue;
839
- routes.push(
840
- withDeferredFacts(
841
- appPath,
842
- {
843
- id: `metadata-${routeId(metadataParts.route)}`,
844
- kind: "handler",
845
- route: metadataParts.route,
846
- pattern: metadataParts.pattern,
847
- file,
848
- params: metadataParts.params,
849
- catchAll: metadataParts.catchAll,
850
- ...metadataParts.catchAllOptional ? { catchAllOptional: true } : {},
851
- metadataRoute: metadataParts.metadataRoute
852
- },
853
- () => metadataRouteFacts(context, routeFile, metadataParts)
854
- )
855
- );
856
- continue;
857
- }
858
- if (relative.split("/").some((segment) => segment.startsWith("@"))) {
859
- if (pageFile().test(relative)) slotPageFiles.push({ file, relative });
860
- continue;
861
- }
862
- const kind = pageFile().test(relative) ? "page" : "handler";
863
- const routeDir = relative.replace(pageOrRouteTrailing(), "");
864
- const parts = routeParts(routeDir);
865
- const conventions = conventionPaths(appPath, routeFile, kind);
866
- const templatePaths = conventions.templateFiles.filter((item) => existsSync3(item));
867
- const extraBoundaries = new Set(extraBoundaryConventionNames());
868
- const forbiddenPaths = kind === "page" && extraBoundaries.has("forbidden") ? findConventionFiles(appPath, routeFile, "forbidden").filter((item) => existsSync3(item)) : [];
869
- const unauthorizedPaths = kind === "page" && extraBoundaries.has("unauthorized") ? findConventionFiles(appPath, routeFile, "unauthorized").filter((item) => existsSync3(item)) : [];
870
- const interception = parts.interception;
871
- routes.push(
872
- withDeferredFacts(
873
- appPath,
874
- {
875
- id: interception ? `intercept-${sanitizeIdPart(routeDir)}` : routeId(parts.route || "/"),
876
- kind,
877
- route: parts.route,
878
- pattern: parts.pattern,
879
- file,
880
- params: parts.params,
881
- catchAll: parts.catchAll,
882
- ...parts.catchAllOptional ? { catchAllOptional: true } : {},
883
- ...templatePaths.length > 0 ? { templateFiles: templatePaths } : {},
884
- ...forbiddenPaths.length > 0 ? { forbiddenFiles: forbiddenPaths } : {},
885
- ...unauthorizedPaths.length > 0 ? { unauthorizedFiles: unauthorizedPaths } : {},
886
- ...conventions.slotDirs.length > 0 ? { slotDirs: conventions.slotDirs } : {},
887
- ...interception ? { interception } : {}
888
- },
889
- () => pageOrHandlerFacts(context, { kind, routeFile, parts, conventions, table })
890
- )
891
- );
892
- }
893
- appendSlotDerivedRoutes(context, routes, slotPageFiles, table);
894
- appendDefaultDerivedRoutes(context, routes, defaultPageFiles, table);
895
- table.parallelRoutes = routes.some((route) => route.slotDirs?.length || route.interception);
896
- return routes.sort((a, b) => routeRank(a).localeCompare(routeRank(b)));
897
- }
898
- function conventionPaths(appPath, routeFile, kind) {
899
- if (kind !== "page") {
900
- return { layoutFiles: [], templateFiles: [], specialFiles: [], slotDirs: [], slotFiles: [] };
901
- }
902
- const slotDirs = chainSlotDirs(appPath, routeFile);
903
- return {
904
- layoutFiles: findLayouts(appPath, routeFile),
905
- templateFiles: findConventionFiles(appPath, routeFile, "template"),
906
- specialFiles: boundaryConventions().flatMap(
907
- (name) => findConventionFiles(appPath, routeFile, name)
908
- ),
909
- slotDirs,
910
- slotFiles: slotTreeFiles(slotDirs)
911
- };
912
- }
913
- function metadataRouteFacts(context, routeFile, parts) {
914
- const source = readSource(context, routeFile);
915
- const sourceFiles = collectSourceFiles(context, [routeFile]);
916
- const dependency = routeDependencyClassification(context, "handler", sourceFiles);
917
- const usesRequest = metadataRouteUsesRequest(source) || usesRevalidationApis(source) || dependency.usesRequest === true || usesRequestImportDataForFiles(
918
- context,
919
- sourceFiles.filter((file) => !isAssetFile(file))
920
- );
921
- const segmentConfig = segmentConfigFromEntries(
922
- context.appPath,
923
- [{ file: routeFile, source }],
924
- parts
925
- );
926
- return {
927
- mode: inferRouteMode(parts, usesRequest, segmentConfig),
928
- hasStaticParams: Boolean(parts.metadataRoute.generatedParam),
929
- usesRequest,
930
- client: false,
931
- clientReferences: [],
932
- cssImports: [],
933
- sourceFiles,
934
- maxDuration: maxDurationFromSources([source]),
935
- ...segmentConfig ? { segmentConfig } : {}
936
- };
937
- }
938
- function pageOrHandlerFacts(context, options) {
939
- const { appPath } = context;
940
- const { kind, routeFile, parts, conventions, table } = options;
941
- const { layoutFiles, templateFiles, specialFiles, slotFiles } = conventions;
942
- const source = readScanSource(context, routeFile);
943
- const layoutSources = [...layoutFiles, ...templateFiles, ...specialFiles].filter((item) => existsSync3(item)).map((item) => readScanSource(context, item));
944
- const entryFiles = [routeFile, ...layoutFiles, ...templateFiles, ...specialFiles, ...slotFiles];
945
- const sourceFiles = collectSourceFiles(context, entryFiles);
946
- const dependency = routeDependencyClassification(context, kind, sourceFiles);
947
- const handlerUsesRevalidationApi = kind === "handler" && usesRevalidationApis(source);
948
- const usesRequest = kind === "handler" ? routeHandlerUsesRequest(source) || handlerUsesRevalidationApi || dependency.usesRequest === true : [source, ...layoutSources].some(usesRequestData) || dependency.usesRequest === true;
949
- const existingLayoutFiles = layoutFiles.filter((item) => existsSync3(item));
950
- const configEntries = [
951
- { file: routeFile, source },
952
- ...[...existingLayoutFiles].reverse().map((item) => ({
953
- file: item,
954
- source: readScanSource(context, item)
955
- }))
956
- ];
957
- const segmentConfig = segmentConfigFromEntries(appPath, configEntries, parts);
958
- if (segmentConfig?.dynamicParamsFalse?.length) {
959
- const allDynamicParams = [...parts.params, ...parts.catchAll ? [parts.catchAll] : []];
960
- const coveredParams = /* @__PURE__ */ new Set();
961
- for (const entry of configEntries) {
962
- if (!hasStaticParamsExport(entry.source)) continue;
963
- const covered = paramOfOwnSegment(appPath, entry.file, allDynamicParams);
964
- if (covered) coveredParams.add(covered);
965
- }
966
- if (allDynamicParams.some((param) => !coveredParams.has(param))) {
967
- delete segmentConfig.dynamicParamsFalse;
968
- } else if (hasStaticParamsExport(source)) {
969
- segmentConfig.strictDynamicParams = true;
970
- }
971
- }
972
- const hasStaticParams = hasStaticParamsExport(source) || kind === "page" && existingLayoutFiles.map((item) => readScanSource(context, item)).some(hasStaticParamsExport);
973
- const dynamicErrorApi = segmentConfig?.dynamic === "error" && parts.params.length === 0 && !parts.catchAll && !hasStaticParams ? dynamicApiLabel(kind === "handler" ? [source] : [source, ...layoutSources], kind) : void 0;
974
- const ppr = kind === "page" && usesRequest && parts.params.length === 0 && !parts.catchAll && exportsExperimentalPpr([source, ...layoutSources]);
975
- const directClient = kind === "page" && hasUseClientDirective(routeFile, source);
976
- const clientReferences = kind === "page" ? collectClientReferences(
977
- context,
978
- directClient ? [...layoutFiles, ...templateFiles, ...specialFiles, ...slotFiles] : entryFiles
979
- ) : [];
980
- const client = directClient || clientReferences.some(
981
- (reference) => reference.file === routeFile && reference.exportName === "default"
982
- );
983
- const stream = kind === "page" ? routeStreamMetadata({ context, layoutFiles, templateFiles, specialFiles }) : void 0;
984
- const cssImports = kind === "page" ? collectCssImports(
985
- context,
986
- cssEntryOrder({ routeFile, layoutFiles, templateFiles, specialFiles, slotFiles }),
987
- { route: true }
988
- ) : [];
989
- if (kind === "page") attachLazyReferenceCss(context, clientReferences);
990
- const interception = parts.interception;
991
- return {
992
- mode: interception ? "dynamic" : inferRouteMode(parts, usesRequest, segmentConfig),
993
- hasStaticParams: interception ? false : hasStaticParams,
994
- usesRequest,
995
- ...handlerUsesRevalidationApi ? { handlerUsesRevalidationApi: true } : {},
996
- ...dynamicErrorApi ? { dynamicErrorApi } : {},
997
- client,
998
- clientReferences,
999
- cssImports,
1000
- sourceFiles,
1001
- ...kind === "page" ? serverActionFileFact(context, sourceFiles) : {},
1002
- ...stream ? { stream } : {},
1003
- maxDuration: maxDurationFromSources([source, ...layoutSources]),
1004
- ppr: interception ? false : ppr,
1005
- ...segmentConfig ? { segmentConfig } : {},
1006
- ...routerEntryFact(context, {
1007
- kind,
1008
- client,
1009
- clientReferences,
1010
- sourceFiles,
1011
- // Only slot-derived interception entries carry a slotDir.
1012
- slotInterceptor: false,
1013
- table
1014
- })
1015
- };
1016
- }
1017
- function routerEntryFact(context, options) {
1018
- if (options.kind !== "page") return {};
1019
- const reasons = [];
1020
- if (options.table.parallelRoutes && !options.slotInterceptor) reasons.push("parallel-routes");
1021
- reasons.push(...alwaysClientEntryReasons());
1022
- if (!options.client && options.clientReferences.length === 0) {
1023
- if (routeUsesLinkComponent(context, options.sourceFiles)) reasons.push("link");
1024
- } else if (routeUsesNavigation(context, options.sourceFiles)) {
1025
- reasons.push("router-api");
1026
- }
1027
- reasons.push(...routeClientEntryReasons(context, options.sourceFiles));
1028
- if (reasons.length === 0) return {};
1029
- return { needsRouterEntry: true, clientEntryReasons: [...new Set(reasons)] };
1030
- }
1031
- function addClientEntryReason(route, reason) {
1032
- const reasons = route.clientEntryReasons ?? [];
1033
- if (!reasons.includes(reason)) route.clientEntryReasons = [...reasons, reason];
1034
- route.needsRouterEntry = true;
1035
- }
1036
- function routeStreamMetadata(options) {
1037
- const existingSpecialFiles = options.specialFiles.filter((item) => existsSync3(item));
1038
- const hasLoadingBoundary = existingSpecialFiles.some(
1039
- (file) => /(^|[/\\])loading\.[^.]+$/.test(file)
1040
- );
1041
- const ancestorClientReferences = collectClientReferences(options.context, [
1042
- ...options.layoutFiles,
1043
- ...options.templateFiles
1044
- ]);
1045
- return {
1046
- ...hasLoadingBoundary ? { hasLoadingBoundary } : {},
1047
- ...ancestorClientReferences.length > 0 ? { ancestorClientReferences: ancestorClientReferences.map((reference) => reference.id) } : {}
1048
- };
1049
- }
1050
- function hasStaticParamsExport(source) {
1051
- const searchable = stripCommentsAndStrings(source);
1052
- return /\bexport\s+(?:async\s+)?function\s+(?:params|generateStaticParams)\b/.test(searchable) || /\bexport\s+const\s+(?:params|generateStaticParams)\b/.test(searchable);
1053
- }
1054
- function chainSlotDirs(appPath, routeFilePath) {
1055
- const dirs = [];
1056
- let dir = path4.dirname(routeFilePath);
1057
- while (dir.startsWith(appPath)) {
1058
- dirs.push(...slotDirectoriesIn(dir));
1059
- if (dir === appPath) break;
1060
- dir = path4.dirname(dir);
1061
- }
1062
- return dirs.reverse();
1063
- }
1064
- function slotTreeFiles(slotDirs) {
1065
- const files = [];
1066
- const pattern = slotConventionPattern();
1067
- for (const dir of slotDirs) {
1068
- for (const file of listFilesSync(dir)) {
1069
- if (pattern.test(toPosixPath(file))) files.push(file);
1070
- }
1071
- }
1072
- return files;
1073
- }
1074
- function appendSlotDerivedRoutes(context, routes, slotPages, table) {
1075
- const appPath = context.appPath;
1076
- const patterns = new Set(routes.filter((route) => !route.interception).map((route) => route.pattern));
1077
- const interceptionKeys = new Set(
1078
- routes.filter((route) => route.interception).map((route) => `${route.pattern}#${route.interception.base}`)
1079
- );
1080
- const candidates = slotPages.map(({ file, relative }) => {
1081
- const segments = relative.split("/");
1082
- const slotIndex = segments.findIndex(isSlotSegment);
1083
- const slotDir = path4.join(appPath, ...segments.slice(0, slotIndex + 1));
1084
- return {
1085
- file,
1086
- relative,
1087
- slotDir,
1088
- ownerDir: path4.dirname(slotDir),
1089
- parts: routeParts(relative.replace(pageOrRouteTrailing(), "")),
1090
- innerNames: segments.slice(slotIndex + 1, -1).filter((name) => !isSlotSegment(name) && !isGroupSegment(name))
1091
- };
1092
- }).sort((a, b) => b.ownerDir.length - a.ownerDir.length);
1093
- for (const candidate of candidates) {
1094
- const { parts } = candidate;
1095
- if (parts.interception) {
1096
- const key = `${parts.pattern}#${parts.interception.base}`;
1097
- if (interceptionKeys.has(key)) continue;
1098
- interceptionKeys.add(key);
1099
- routes.push(
1100
- withDeferredFacts(
1101
- appPath,
1102
- {
1103
- id: `intercept-${sanitizeIdPart(candidate.relative.replace(pageOrRouteTrailing(), ""))}`,
1104
- kind: "page",
1105
- route: parts.route,
1106
- pattern: parts.pattern,
1107
- file: candidate.file,
1108
- params: parts.params,
1109
- catchAll: parts.catchAll,
1110
- ...parts.catchAllOptional ? { catchAllOptional: true } : {},
1111
- interception: { ...parts.interception, slotDir: candidate.slotDir }
1112
- },
1113
- () => ({
1114
- ...emptyDerivedFacts,
1115
- ...routerEntryFact(context, {
1116
- kind: "page",
1117
- client: false,
1118
- clientReferences: [],
1119
- sourceFiles: [],
1120
- slotInterceptor: true,
1121
- table
1122
- })
1123
- })
1124
- )
1125
- );
1126
- continue;
1127
- }
1128
- if (patterns.has(parts.pattern)) continue;
1129
- patterns.add(parts.pattern);
1130
- const childrenDefault = childrenDefaultFile(candidate.ownerDir, candidate.innerNames);
1131
- const anchor = childrenDefault ?? slotConventionFile(path4.join(candidate.ownerDir, "@children"), "page") ?? slotConventionFile(candidate.ownerDir, "page") ?? candidate.file;
1132
- const layoutFiles = findLayouts(appPath, anchor);
1133
- const templateFiles = findConventionFiles(appPath, anchor, "template");
1134
- const specialFiles = boundaryConventions().flatMap(
1135
- (name) => findConventionFiles(appPath, anchor, name)
1136
- );
1137
- const slotDirs = chainSlotDirs(appPath, anchor);
1138
- const slotFiles = slotTreeFiles(slotDirs);
1139
- const extraBoundaries = new Set(extraBoundaryConventionNames());
1140
- const forbiddenPaths = extraBoundaries.has("forbidden") ? findConventionFiles(appPath, anchor, "forbidden").filter((item) => existsSync3(item)) : [];
1141
- const unauthorizedPaths = extraBoundaries.has("unauthorized") ? findConventionFiles(appPath, anchor, "unauthorized").filter((item) => existsSync3(item)) : [];
1142
- const templatePaths = templateFiles.filter((item) => existsSync3(item));
1143
- routes.push(
1144
- withDeferredFacts(
1145
- appPath,
1146
- {
1147
- id: `slot-${routeId(parts.route || "/")}`,
1148
- kind: "page",
1149
- route: parts.route,
1150
- pattern: parts.pattern,
1151
- file: anchor,
1152
- params: parts.params,
1153
- catchAll: parts.catchAll,
1154
- ...parts.catchAllOptional ? { catchAllOptional: true } : {},
1155
- ...templatePaths.length > 0 ? { templateFiles: templatePaths } : {},
1156
- ...slotDirs.length > 0 ? { slotDirs } : {},
1157
- synthetic: true,
1158
- syntheticSlotDir: candidate.slotDir,
1159
- ...childrenDefault ? { childrenDefault } : {},
1160
- ...forbiddenPaths.length > 0 ? { forbiddenFiles: forbiddenPaths } : {},
1161
- ...unauthorizedPaths.length > 0 ? { unauthorizedFiles: unauthorizedPaths } : {}
1162
- },
1163
- () => derivedRouteFacts(context, {
1164
- leadFiles: childrenDefault ? [childrenDefault] : [],
1165
- layoutFiles,
1166
- templateFiles,
1167
- specialFiles,
1168
- slotFiles,
1169
- clientFile: childrenDefault,
1170
- table
1171
- })
1172
- )
1173
- );
1174
- }
1175
- }
1176
- var emptyDerivedFacts = {
1177
- mode: "dynamic",
1178
- hasStaticParams: false,
1179
- usesRequest: true,
1180
- client: false,
1181
- clientReferences: [],
1182
- cssImports: [],
1183
- sourceFiles: []
1184
- };
1185
- function derivedRouteFacts(context, options) {
1186
- const { leadFiles, layoutFiles, templateFiles, specialFiles, slotFiles } = options;
1187
- const entryFiles = [...leadFiles, ...layoutFiles, ...templateFiles, ...specialFiles, ...slotFiles];
1188
- const sourceFiles = collectSourceFiles(context, entryFiles);
1189
- const clientReferences = collectClientReferences(context, entryFiles);
1190
- const cssImports = collectCssImports(
1191
- context,
1192
- cssEntryOrder({
1193
- ...options.leadIsRouteFile ? { routeFile: leadFiles[0] } : { leadFiles },
1194
- layoutFiles,
1195
- templateFiles,
1196
- specialFiles,
1197
- slotFiles
1198
- }),
1199
- { route: true }
1200
- );
1201
- attachLazyReferenceCss(context, clientReferences);
1202
- const client = options.clientFile ? isClientModule(context, options.clientFile) : false;
1203
- return {
1204
- ...emptyDerivedFacts,
1205
- client,
1206
- clientReferences,
1207
- cssImports,
1208
- sourceFiles,
1209
- ...routerEntryFact(context, {
1210
- kind: "page",
1211
- client,
1212
- clientReferences,
1213
- sourceFiles,
1214
- slotInterceptor: false,
1215
- table: options.table
1216
- })
1217
- };
1218
- }
1219
- function appendDefaultDerivedRoutes(context, routes, defaultPages, table) {
1220
- const appPath = context.appPath;
1221
- const patterns = new Set(routes.filter((route) => !route.interception).map((route) => route.pattern));
1222
- for (const { file, relative } of defaultPages) {
1223
- const dir = path4.dirname(file);
1224
- if (conventionFileName(dir, "page")) continue;
1225
- const parts = routeParts(relative.replace(pageOrRouteTrailing(), ""));
1226
- if (parts.interception) continue;
1227
- if (patterns.has(parts.pattern)) continue;
1228
- patterns.add(parts.pattern);
1229
- const layoutFiles = findLayouts(appPath, file);
1230
- const templateFiles = findConventionFiles(appPath, file, "template");
1231
- const specialFiles = boundaryConventions().flatMap(
1232
- (name) => findConventionFiles(appPath, file, name)
1233
- );
1234
- const slotDirs = chainSlotDirs(appPath, file);
1235
- const slotFiles = slotTreeFiles(slotDirs);
1236
- const extraBoundaries = new Set(extraBoundaryConventionNames());
1237
- const forbiddenPaths = extraBoundaries.has("forbidden") ? findConventionFiles(appPath, file, "forbidden").filter((item) => existsSync3(item)) : [];
1238
- const unauthorizedPaths = extraBoundaries.has("unauthorized") ? findConventionFiles(appPath, file, "unauthorized").filter((item) => existsSync3(item)) : [];
1239
- const templatePaths = templateFiles.filter((item) => existsSync3(item));
1240
- routes.push(
1241
- withDeferredFacts(
1242
- appPath,
1243
- {
1244
- id: `default-${routeId(parts.route || "/")}`,
1245
- kind: "page",
1246
- route: parts.route,
1247
- pattern: parts.pattern,
1248
- file,
1249
- params: parts.params,
1250
- catchAll: parts.catchAll,
1251
- ...parts.catchAllOptional ? { catchAllOptional: true } : {},
1252
- ...templatePaths.length > 0 ? { templateFiles: templatePaths } : {},
1253
- ...slotDirs.length > 0 ? { slotDirs } : {},
1254
- ...forbiddenPaths.length > 0 ? { forbiddenFiles: forbiddenPaths } : {},
1255
- ...unauthorizedPaths.length > 0 ? { unauthorizedFiles: unauthorizedPaths } : {}
1256
- },
1257
- () => derivedRouteFacts(context, {
1258
- leadFiles: [file],
1259
- leadIsRouteFile: true,
1260
- layoutFiles,
1261
- templateFiles,
1262
- specialFiles,
1263
- slotFiles,
1264
- clientFile: file,
1265
- table
1266
- })
1267
- )
1268
- );
1269
- }
1270
- }
1271
- function findLayouts(appPath, routeFilePath) {
1272
- return findConventionFiles(appPath, routeFilePath, "layout");
1273
- }
1274
- async function collectNotFoundCss(appPath) {
1275
- const notFoundFile = conventionFileName(appPath, "not-found");
1276
- if (!notFoundFile) return [];
1277
- return collectFileCss(appPath, [notFoundFile]);
1278
- }
1279
- async function collectFileCss(appPath, files, options = {}) {
1280
- const existing = files.filter((file) => existsSync3(file));
1281
- if (existing.length === 0) return [];
1282
- const context = createScanContext(
1283
- appPath,
1284
- options.includeGlobalCss ? () => /* @__PURE__ */ new Set() : void 0
1285
- );
1286
- return collectCssImports(context, existing);
1287
- }
1288
- function findConventionFiles(appPath, routeFilePath, name) {
1289
- const base = conventionBase(name);
1290
- const files = [];
1291
- let dir = path4.dirname(routeFilePath);
1292
- while (dir.startsWith(appPath)) {
1293
- files.push(conventionFileName(dir, base) ?? path4.join(dir, `${base}.tsx`));
1294
- if (dir === appPath) break;
1295
- dir = path4.dirname(dir);
1296
- }
1297
- return files.reverse();
1298
- }
1299
- function conventionBase(name) {
1300
- const match = new RegExp(`\\.(${pageExtensions2().join("|")})$`).exec(name);
1301
- return match ? name.slice(0, -match[0].length) : name;
1302
- }
1303
- function findGlobalError(appPath) {
1304
- return conventionFileName(appPath, globalErrorBase);
1305
- }
1306
- function matchRoute(routes, pathname) {
1307
- const normalized = normalizePathname(pathname);
1308
- for (const route of routes) {
1309
- if (route.interception) continue;
1310
- const match = routeRegex(route).exec(normalized);
1311
- if (!match) continue;
1312
- return { route, params: routeMatchParams(route, match) };
1313
- }
1314
- return null;
1315
- }
1316
- function normalizePathname(pathname) {
1317
- return pathname.length > 1 ? pathname.replace(/\/+$/, "") || "/" : pathname;
1318
- }
1319
- function routeMatchParams(route, match) {
1320
- const params = {};
1321
- route.params.forEach((name, index) => {
1322
- const decoded = safeDecode(match[index + 1] ?? "");
1323
- params[name] = decoded === `[${name}]` ? encodeURIComponent(decoded) : decoded;
1324
- });
1325
- if (route.catchAll) {
1326
- params[route.catchAll] = (match[route.params.length + 1] ?? "").split("/").filter(Boolean).map(safeDecode);
1327
- }
1328
- return params;
1329
- }
1330
- function matchInterception(routes, pathname, fromPath) {
1331
- if (!fromPath) return null;
1332
- const target = normalizePathname(pathname);
1333
- const from = normalizePathname(fromPath);
1334
- if (target === from) return null;
1335
- let best = null;
1336
- let bestDepth = -1;
1337
- for (const route of routes) {
1338
- const interception = route.interception;
1339
- if (!interception) continue;
1340
- const match = routeRegex(route).exec(target);
1341
- if (!match) continue;
1342
- const basePattern = interception.basePattern ? `/${interception.basePattern}` : "";
1343
- if (!new RegExp(`^${basePattern}(?:/.*)?$`).test(from)) continue;
1344
- const depth = interception.base.split("/").filter(Boolean).length;
1345
- if (depth <= bestDepth) continue;
1346
- bestDepth = depth;
1347
- best = { route, params: routeMatchParams(route, match) };
1348
- }
1349
- return best;
1350
- }
1351
- function selectRouteForRequest(routes, pathname, nav) {
1352
- const target = normalizePathname(pathname);
1353
- if (nav) {
1354
- const intercepted = matchInterception(routes, target, nav.children);
1355
- if (intercepted) {
1356
- if (!intercepted.route.interception?.slotDir) {
1357
- return {
1358
- route: intercepted.route,
1359
- params: intercepted.params,
1360
- childrenPath: target,
1361
- targetPath: target
1362
- };
1363
- }
1364
- const host = hostMatch(routes, nav.children);
1365
- if (host) return { ...host, targetPath: target };
1366
- }
1367
- }
1368
- const matched = matchRoute(routes, target);
1369
- if (!matched) return null;
1370
- if (nav && matched.route.synthetic && nav.children) {
1371
- const primary = matchRoute(
1372
- routes.filter((route) => !route.synthetic),
1373
- target
1374
- );
1375
- const syntheticOwner = matched.route.syntheticSlotDir ? path4.dirname(matched.route.syntheticSlotDir) : void 0;
1376
- const primaryFromOwner = primary && syntheticOwner ? path4.relative(syntheticOwner, primary.route.file) : void 0;
1377
- if (primary && primaryFromOwner !== void 0 && primaryFromOwner !== ".." && !primaryFromOwner.startsWith(`..${path4.sep}`)) {
1378
- return {
1379
- route: primary.route,
1380
- params: primary.params,
1381
- childrenPath: target,
1382
- targetPath: target
1383
- };
1384
- }
1385
- const host = hostMatch(routes, nav.children);
1386
- if (host && host.route !== matched.route && matched.route.syntheticSlotDir && host.route.slotDirs?.includes(matched.route.syntheticSlotDir)) {
1387
- return { ...host, targetPath: target };
1388
- }
1389
- }
1390
- return {
1391
- route: matched.route,
1392
- params: matched.params,
1393
- childrenPath: target,
1394
- targetPath: target
1395
- };
1396
- }
1397
- function parseNavState(request) {
1398
- if (!request.headers.get("x-pnext-soft-nav")) return void 0;
1399
- const raw = request.headers.get("x-pnext-nav-state");
1400
- if (!raw) return {};
1401
- try {
1402
- const parsed = JSON.parse(decodeURIComponent(raw));
1403
- if (parsed && typeof parsed === "object") return parsed;
1404
- } catch {
1405
- }
1406
- return {};
1407
- }
1408
- function hostMatch(routes, fromPath) {
1409
- if (!fromPath) return null;
1410
- const from = normalizePathname(fromPath);
1411
- const host = matchRoute(routes, from);
1412
- if (host?.route.kind !== "page") return null;
1413
- return { route: host.route, params: host.params, childrenPath: from, targetPath: from };
1414
- }
1415
- var routeRegexCache = /* @__PURE__ */ new WeakMap();
1416
- function routeRegex(route) {
1417
- let regex = routeRegexCache.get(route);
1418
- if (!regex) {
1419
- regex = new RegExp(`^${route.pattern}$`);
1420
- routeRegexCache.set(route, regex);
1421
- }
1422
- return regex;
1423
- }
1424
- function segmentTokenOf(bare) {
1425
- const optionalCatchAllMatch = /^\[\[\.\.\.([^\]]+)\]\]$/.exec(bare);
1426
- if (optionalCatchAllMatch?.[1]) {
1427
- const name = optionalCatchAllMatch[1];
1428
- return { route: `:${name}*`, catchAll: name, catchAllOptional: true };
1429
- }
1430
- const catchAllMatch = /^\[\.\.\.([^\]]+)\]$/.exec(bare);
1431
- if (catchAllMatch?.[1]) {
1432
- return { route: `:${catchAllMatch[1]}*`, pattern: "(.*)", catchAll: catchAllMatch[1] };
1433
- }
1434
- const paramMatch = /^\[([^\]]+)\]$/.exec(bare);
1435
- if (paramMatch?.[1]) {
1436
- return { route: `:${paramMatch[1]}`, pattern: "([^/]+)", param: paramMatch[1] };
1437
- }
1438
- const literal = decodeLiteralSegment(bare);
1439
- return { route: literal, pattern: escapeRegex2(literal) };
1440
- }
1441
- function isPrivateAppPath(relative) {
1442
- const segments = relative.split("/");
1443
- return segments.slice(0, -1).some((segment) => segment.startsWith("_") && !isGroupSegment(segment) && !isSlotSegment(segment));
1444
- }
1445
- function decodeLiteralSegment(segment) {
1446
- return segment.replace(/%5[Ff]/g, "_");
1447
- }
1448
- function routeParts(routeDir) {
1449
- const segments = routeDir.split("/").filter(Boolean);
1450
- let tokens = [];
1451
- let interception;
1452
- for (const segment of segments) {
1453
- if (isGroupSegment(segment) || isSlotSegment(segment)) continue;
1454
- const marker = interceptionMarkerOf(segment);
1455
- let bare = segment;
1456
- if (marker) {
1457
- bare = segment.slice(marker.length);
1458
- const base = tokens.slice();
1459
- const levels = interceptionMarkerLevels(marker);
1460
- tokens = levels === Number.POSITIVE_INFINITY ? [] : tokens.slice(0, Math.max(0, tokens.length - levels));
1461
- interception = {
1462
- marker,
1463
- base: `/${base.map((token) => token.route).join("/")}`.replace(/\/$/, "") || "/",
1464
- basePattern: base.map((token) => token.pattern ?? "(.*)").join("/")
1465
- };
1466
- }
1467
- tokens.push(segmentTokenOf(bare));
1468
- }
1469
- const params = tokens.filter((token) => token.param).map((token) => token.param);
1470
- const catchAllToken = tokens.find((token) => token.catchAll);
1471
- const routeSegments = tokens.map((token) => token.route);
1472
- const patternSegments = tokens.filter((token) => !token.catchAllOptional).map((token) => token.pattern);
1473
- const route = `/${routeSegments.join("/")}`.replace(/\/$/, "") || "/";
1474
- let pattern;
1475
- if (catchAllToken?.catchAllOptional) {
1476
- const prefix = patternSegments.length > 0 ? `/${patternSegments.join("/")}` : "";
1477
- pattern = `${prefix}(?:/(.*))?`;
1478
- if (pattern === "(?:/(.*))?") pattern = "/?(?:(.*))?";
1479
- } else {
1480
- pattern = route === "/" ? "/" : `/${patternSegments.join("/")}`;
1481
- }
1482
- return {
1483
- route,
1484
- pattern,
1485
- params,
1486
- catchAll: catchAllToken?.catchAll,
1487
- catchAllOptional: Boolean(catchAllToken?.catchAllOptional),
1488
- interception
1489
- };
1490
- }
1491
- function dynamicMetadataRouteParts(relative, source) {
1492
- const name = path4.basename(relative);
1493
- const dir = path4.dirname(relative) === "." ? "" : path4.dirname(relative);
1494
- const root = dir === "";
1495
- const extension = path4.extname(name);
1496
- const base = name.slice(0, -extension.length);
1497
- const kind = dynamicMetadataKind(base, root);
1498
- if (!kind) return void 0;
1499
- const prefix = routeParts(dir);
1500
- const generatedParam = metadataGeneratedParam(kind, source);
1501
- const final = dynamicMetadataFinalSegment(kind, base, dir, Boolean(generatedParam));
1502
- return {
1503
- ...appendRouteParts(prefix, final.route, final.pattern, generatedParam ? [generatedParam] : []),
1504
- metadataRoute: {
1505
- kind,
1506
- ...generatedParam ? { generatedParam } : {}
1507
- }
1508
- };
1509
- }
1510
- function dynamicMetadataKind(base, root) {
1511
- if (base === "robots") return root ? "robots" : void 0;
1512
- if (base === "sitemap") return "sitemap";
1513
- if (base === "manifest") return root ? "manifest" : void 0;
1514
- if (/^icon\d*$/.test(base)) return "icon";
1515
- if (/^apple-icon\d*$/.test(base)) return "apple-icon";
1516
- if (/^opengraph-image\d*$/.test(base)) return "opengraph-image";
1517
- if (/^twitter-image\d*$/.test(base)) return "twitter-image";
1518
- return void 0;
1519
- }
1520
- function metadataGeneratedParam(kind, source) {
1521
- if (kind === "sitemap" && /\bexport\s+(?:async\s+)?function\s+generateSitemaps\b/.test(source)) {
1522
- return "__metadata_id__";
1523
- }
1524
- if (metadataImageKind(kind) && /\bexport\s+(?:async\s+)?function\s+generateImageMetadata\b/.test(source)) {
1525
- return "__metadata_id__";
1526
- }
1527
- return void 0;
1528
- }
1529
- function dynamicMetadataFinalSegment(kind, base, relativeDir, generated) {
1530
- if (kind === "robots") return { route: "robots.txt", pattern: "robots\\.txt" };
1531
- if (kind === "manifest")
1532
- return { route: "manifest.webmanifest", pattern: "manifest\\.webmanifest" };
1533
- if (kind === "sitemap") {
1534
- return generated ? { route: "sitemap/:id.xml", pattern: "sitemap/([^/]+)\\.xml" } : { route: "sitemap.xml", pattern: "sitemap\\.xml" };
1535
- }
1536
- const suffix = metadataRouteSuffix(relativeDir);
1537
- const imageBase = suffix ? `${base}-${suffix}` : base;
1538
- return generated ? { route: `${imageBase}/:id`, pattern: `${escapeRegex2(imageBase)}/([^/]+)` } : { route: imageBase, pattern: escapeRegex2(imageBase) };
1539
- }
1540
- function appendRouteParts(parts, route, pattern, params) {
1541
- const prefixRoute = parts.route === "/" ? "" : parts.route;
1542
- const prefixPattern = parts.pattern === "/" ? "" : parts.pattern;
1543
- return {
1544
- ...parts,
1545
- route: `${prefixRoute}/${route}`.replace(/\/$/, "") || "/",
1546
- pattern: `${prefixPattern}/${pattern}`,
1547
- params: [...parts.params, ...params]
1548
- };
1549
- }
1550
- function metadataImageKind(kind) {
1551
- return kind === "icon" || kind === "apple-icon" || kind === "opengraph-image" || kind === "twitter-image";
1552
- }
1553
- function metadataRouteUsesRequest(source) {
1554
- return routeHandlerUsesRequest(source);
1555
- }
1556
- function metadataRouteSuffix(relativeDir) {
1557
- if (!relativeDir) return "";
1558
- const segments = relativeDir.split("/").filter(Boolean);
1559
- if (!segments.some((segment) => isGroupSegment(segment) || isSlotSegment(segment))) return "";
1560
- return djb2Hash(`/${relativeDir}`).toString(36).slice(0, 6);
1561
- }
1562
- function djb2Hash(value) {
1563
- let hash = 5381;
1564
- for (let i = 0; i < value.length; i++) {
1565
- hash = (hash << 5) + hash + value.charCodeAt(i) & 4294967295;
1566
- }
1567
- return hash >>> 0;
1568
- }
1569
- function inferRouteMode(parts, usesRequest, config) {
1570
- if (config?.dynamic === "force-dynamic") return "dynamic";
1571
- if (config?.revalidate === 0) return "dynamic";
1572
- if (config?.fetchCache === "force-no-store") return "dynamic";
1573
- if (config?.dynamic === "force-static") return "static";
1574
- if (config?.dynamic === "error") return "static";
1575
- if (usesRequest) return "dynamic";
1576
- if (parts.params.length > 0 || parts.catchAll) return "dynamic";
1577
- return "static";
1578
- }
1579
- function parseSegmentConfig(source) {
1580
- const searchable = stripComments(source);
1581
- const parsed = {};
1582
- const dynamicMatch = /^\s*export\s+const\s+dynamic\s*=\s*['"](auto|force-dynamic|error|force-static)['"]/m.exec(
1583
- searchable
1584
- );
1585
- if (dynamicMatch) parsed.dynamic = dynamicMatch[1];
1586
- const revalidateMatch = /^\s*export\s+const\s+revalidate\s*=\s*(\d+|false)\s*;?\s*$/m.exec(
1587
- searchable
1588
- );
1589
- if (revalidateMatch) {
1590
- parsed.revalidate = revalidateMatch[1] === "false" ? false : Number(revalidateMatch[1]);
1591
- } else {
1592
- const invalid = /^\s*export\s+const\s+revalidate\s*=\s*(['"]([^'"]*)['"]|-\d+)/m.exec(
1593
- searchable
1594
- );
1595
- if (invalid) parsed.invalidRevalidate = invalid[2] ?? invalid[1];
1596
- }
1597
- const fetchCacheMatch = /^\s*export\s+const\s+fetchCache\s*=\s*['"](auto|default-cache|only-cache|force-cache|force-no-store|default-no-store|only-no-store)['"]/m.exec(
1598
- searchable
1599
- );
1600
- if (fetchCacheMatch) parsed.fetchCache = fetchCacheMatch[1];
1601
- const dynamicParamsMatch = /^\s*export\s+const\s+dynamicParams\s*=\s*(true|false)/m.exec(
1602
- searchable
1603
- );
1604
- if (dynamicParamsMatch) parsed.dynamicParams = dynamicParamsMatch[1] === "true";
1605
- const runtimeMatch = /^\s*export\s+const\s+runtime\s*=\s*['"](edge|nodejs)['"]/m.exec(searchable);
1606
- if (runtimeMatch) parsed.runtime = runtimeMatch[1];
1607
- const prefetchMatch = /^\s*export\s+const\s+prefetch\s*=\s*['"](allow-runtime|partial|unstable_eager)['"]/m.exec(
1608
- searchable
1609
- );
1610
- if (prefetchMatch) parsed.prefetch = prefetchMatch[1];
1611
- const instantMatch = /^\s*export\s+const\s+unstable_instant\s*=\s*(true|false|\{)/m.exec(
1612
- searchable
1613
- );
1614
- if (instantMatch) parsed.unstableInstant = instantMatch[1] !== "false";
1615
- return parsed;
1616
- }
1617
- function segmentConfigFromEntries(appPath, entries, parts) {
1618
- const config = {};
1619
- let lowestRevalidate;
1620
- let sawRevalidateFalse = false;
1621
- const dynamicParamsByName = /* @__PURE__ */ new Map();
1622
- const allParams = [...parts.params, ...parts.catchAll ? [parts.catchAll] : []];
1623
- for (const entry of entries) {
1624
- const parsed = parseSegmentConfig(entry.source);
1625
- if (parsed.invalidRevalidate !== void 0) {
1626
- throw new Error(
1627
- `Invalid revalidate value "${parsed.invalidRevalidate}" on "${parts.route || "/"}", must be a non-negative number or false`
1628
- );
1629
- }
1630
- if (parsed.dynamic) {
1631
- if (parsed.dynamic === "force-dynamic") config.dynamic = "force-dynamic";
1632
- else if (!config.dynamic) config.dynamic = parsed.dynamic;
1633
- }
1634
- if (parsed.revalidate !== void 0) {
1635
- if (parsed.revalidate === false) sawRevalidateFalse = true;
1636
- else {
1637
- lowestRevalidate = lowestRevalidate === void 0 ? parsed.revalidate : Math.min(lowestRevalidate, parsed.revalidate);
1638
- }
1639
- }
1640
- if (parsed.fetchCache && !config.fetchCache) config.fetchCache = parsed.fetchCache;
1641
- if (parsed.runtime && !config.runtime) config.runtime = parsed.runtime;
1642
- if (parsed.prefetch && !config.prefetch) config.prefetch = parsed.prefetch;
1643
- if (parsed.unstableInstant !== void 0 && config.unstableInstant === void 0) {
1644
- config.unstableInstant = parsed.unstableInstant;
1645
- }
1646
- if (parsed.dynamicParams !== void 0) {
1647
- const param = paramOfOwnSegment(appPath, entry.file, allParams);
1648
- if (param !== void 0 && !dynamicParamsByName.has(param)) {
1649
- dynamicParamsByName.set(param, parsed.dynamicParams);
1650
- }
1651
- }
1652
- }
1653
- if (lowestRevalidate !== void 0) config.revalidate = lowestRevalidate;
1654
- else if (sawRevalidateFalse) config.revalidate = false;
1655
- const governed = allParams.filter((param) => dynamicParamsByName.get(param) === false);
1656
- if (governed.length > 0) config.dynamicParamsFalse = governed;
1657
- return Object.keys(config).length > 0 ? config : void 0;
1658
- }
1659
- function paramOfOwnSegment(appPath, file, params) {
1660
- const segments = toPosixPath(path4.relative(appPath, path4.dirname(file))).split("/");
1661
- const own = segments[segments.length - 1];
1662
- return params.find(
1663
- (param) => own === `[${param}]` || own === `[...${param}]` || own === `[[...${param}]]`
1664
- );
1665
- }
1666
- function hasUseClientDirective(file, source) {
1667
- return scanFacts(file, source).useClient;
1668
- }
1669
- function serverActionFileFact(context, sourceFiles) {
1670
- for (const file of sourceFiles) {
1671
- if (!fileExists(context, file) || isAssetFile(file)) continue;
1672
- if (scanFacts(file, readSource(context, file)).useServer) return { serverActionFile: file };
1673
- }
1674
- return {};
1675
- }
1676
- function serverActionsUnsupportedMessage(offender) {
1677
- const file = offender.root ? toPosixPath(path4.relative(offender.root, offender.file)) : offender.file;
1678
- const reach = offender.route ? `, reachable from the route ${offender.route}` : "";
1679
- return [
1680
- `Server actions need next compat, and this app is pure core.`,
1681
- ``,
1682
- ` ${file} has a 'use server' directive${reach}.`,
1683
- ``,
1684
- `pnext will not build this app: core has no server-action registry and no`,
1685
- `dispatch endpoint, so the action could only render as a form that submits`,
1686
- `nowhere.`,
1687
- ``,
1688
- `Fix it one of two ways:`,
1689
- ` 1. Enable compat in pnext.config.ts:`,
1690
- ` export default { compat: { next: true } }`,
1691
- ` 2. Or delete the 'use server' directive from ${file}, if those exports are`,
1692
- ` only ever called on the server (in core the directive does nothing).`
1693
- ].join("\n");
1694
- }
1695
- function assertNoServerActionsWithoutCompat(routes, compatEnabled, root) {
1696
- if (compatEnabled) return;
1697
- const offender = routes.find((route) => route.serverActionFile);
1698
- if (!offender) return;
1699
- throw new Error(
1700
- serverActionsUnsupportedMessage({
1701
- file: offender.serverActionFile,
1702
- route: offender.route,
1703
- root
1704
- })
1705
- );
1706
- }
1707
- function isClientModule(context, file) {
1708
- const key = path4.resolve(file);
1709
- let client = context.useClient.get(key);
1710
- if (client === void 0) {
1711
- client = hasUseClientDirective(file, readSource(context, file));
1712
- context.useClient.set(key, client);
1713
- }
1714
- return client;
1715
- }
1716
- function collectClientReferences(context, entryFiles) {
1717
- const references = /* @__PURE__ */ new Map();
1718
- const visited = /* @__PURE__ */ new Set();
1719
- for (const file of entryFiles) {
1720
- if (fileExists(context, file)) {
1721
- if (!isClientModule(context, file) && defaultReexportsClientModule(context, file)) {
1722
- addClientReference(references, clientReference(file, "default"));
1723
- }
1724
- }
1725
- collectFromFile(context, file, references, visited);
1726
- }
1727
- const collected = [...references.values()];
1728
- const hasRenderedReference = collected.some((reference) => !reference.sideEffect);
1729
- const filtered = hasRenderedReference ? collected : collected.filter((reference) => !reference.sideEffect);
1730
- return filtered.sort((a, b) => a.id.localeCompare(b.id));
1731
- }
1732
- function defaultReexportsClientModule(context, file, visited = /* @__PURE__ */ new Set()) {
1733
- const key = path4.resolve(file);
1734
- if (visited.has(key)) return false;
1735
- visited.add(key);
1736
- const source = readSource(context, file);
1737
- const specifiers = [];
1738
- for (const edge of scanFacts(file, source).imports) {
1739
- if (edge.reexport && edge.exports.includes("default")) specifiers.push(edge.specifier);
1740
- }
1741
- const defaultExpr = /export\s+default\s+([A-Za-z_$][\w$]*)(\s*\.\s*default)?\s*;?/.exec(source);
1742
- if (defaultExpr) {
1743
- const binding = defaultExpr[1];
1744
- const namespaced = Boolean(defaultExpr[2]);
1745
- const importBinding = namespaced ? new RegExp(`import\\s*\\*\\s*as\\s+${binding}\\s+from\\s+['"]([^'"]+)['"]`).exec(source) : new RegExp(`import\\s+${binding}\\s+from\\s+['"]([^'"]+)['"]`).exec(source);
1746
- if (importBinding?.[1]) specifiers.push(importBinding[1]);
1747
- }
1748
- for (const specifier of specifiers) {
1749
- const resolved = resolveModuleEdge(context, file, specifier);
1750
- if (!resolved || !fileExists(context, resolved)) continue;
1751
- if (isClientModule(context, resolved)) return true;
1752
- if (defaultReexportsClientModule(context, resolved, visited)) return true;
1753
- }
1754
- return false;
1755
- }
1756
- function collectFromFile(context, file, references, visited, withinClientBoundary = false) {
1757
- const visitKey = `${file}\0${withinClientBoundary ? "client" : "server"}`;
1758
- if (visited.has(visitKey) || !fileExists(context, file)) return;
1759
- visited.add(visitKey);
1760
- const clientFile = isClientModule(context, file);
1761
- if (clientFile) {
1762
- addClientReference(references, clientReference(file, "default"));
1763
- }
1764
- const nestedClientBoundary = withinClientBoundary || clientFile;
1765
- const imports = [...moduleEdges(context, file)];
1766
- if (!nestedClientBoundary) imports.push(...publishedClientImports(context, file));
1767
- for (const imported of imports) {
1768
- if (isClientModule(context, imported.file)) {
1769
- if (imported.star) {
1770
- const importedSource = readSource(context, imported.file);
1771
- for (const exportName of scanFacts(imported.file, importedSource).exportNames) {
1772
- if (exportName !== "default") {
1773
- addClientReference(references, clientReference(imported.file, exportName));
1774
- }
1775
- }
1776
- continue;
1777
- }
1778
- if (imported.exports.includes("*")) {
1779
- throw new Error(
1780
- `${file} namespace-imports Client Component module ${imported.file}. Import the client component by default or named export instead.`
1781
- );
1782
- }
1783
- if (imported.exports.length === 0) {
1784
- addClientReference(references, {
1785
- ...clientReference(imported.file, "*side-effect*"),
1786
- sideEffect: true
1787
- });
1788
- continue;
1789
- }
1790
- for (const exportName of imported.exports) {
1791
- addClientReference(references, {
1792
- ...clientReference(imported.file, exportName),
1793
- dynamic: imported.dynamic
1794
- });
1795
- }
1796
- continue;
1797
- }
1798
- if (imported.dynamic?.load === "visible") {
1799
- console.warn(
1800
- `${file} uses dynamic({ load: 'visible' }) for ${imported.file}, but the target is a Server Component. It will render on the server instead of loading on visibility.`
1801
- );
1802
- }
1803
- collectFromFile(context, imported.file, references, visited, nestedClientBoundary);
1804
- }
1805
- }
1806
- function addClientReference(references, reference) {
1807
- const existing = references.get(reference.id);
1808
- if (!existing) {
1809
- references.set(reference.id, reference);
1810
- return;
1811
- }
1812
- if (!reference.dynamic) references.set(reference.id, reference);
1813
- }
1814
- function cssEntryOrder(options) {
1815
- return [
1816
- ...options.leadFiles ?? [],
1817
- ...options.layoutFiles,
1818
- ...options.templateFiles,
1819
- ...options.routeFile ? [options.routeFile] : [],
1820
- ...options.specialFiles,
1821
- ...options.slotFiles
1822
- ];
1823
- }
1824
- function collectCssImports(context, entryFiles, options = {}) {
1825
- const imports = /* @__PURE__ */ new Set();
1826
- const visited = /* @__PURE__ */ new Set();
1827
- for (const file of entryFiles) {
1828
- collectCssFromFile(context, file, imports, visited);
1829
- }
1830
- if (!options.route || !getCssExtensions().deferRootNotFoundCss()) return [...imports];
1831
- const rootNotFound = entryFiles.find(
1832
- (file) => path4.dirname(file) === context.appPath && /^not-found\.[^.]+$/.test(path4.basename(file))
1833
- );
1834
- if (!rootNotFound) return [...imports];
1835
- const rootNotFoundImports = /* @__PURE__ */ new Set();
1836
- collectCssFromFile(context, rootNotFound, rootNotFoundImports, /* @__PURE__ */ new Set());
1837
- if (rootNotFoundImports.size === 0) return [...imports];
1838
- const matchedImports = /* @__PURE__ */ new Set();
1839
- for (const file of entryFiles) {
1840
- if (file === rootNotFound) continue;
1841
- collectCssFromFile(context, file, matchedImports, /* @__PURE__ */ new Set());
1842
- }
1843
- return [...imports].filter((file) => !rootNotFoundImports.has(file) || matchedImports.has(file));
1844
- }
1845
- function collectSourceFiles(context, entryFiles) {
1846
- const files = /* @__PURE__ */ new Set();
1847
- const visited = /* @__PURE__ */ new Set();
1848
- for (const file of entryFiles) {
1849
- collectSourceFile(context, file, files, visited);
1850
- }
1851
- return [...files].sort();
1852
- }
1853
- function collectSourceFile(context, file, files, visited) {
1854
- if (visited.has(file) || !fileExists(context, file)) return;
1855
- visited.add(file);
1856
- files.add(file);
1857
- if (isAssetFile(file)) return;
1858
- for (const imported of moduleEdges(context, file)) {
1859
- collectSourceFile(context, imported.file, files, visited);
1860
- }
1861
- }
1862
- function collectCssFromFile(context, file, imports, visited) {
1863
- if (visited.has(file) || !fileExists(context, file)) return;
1864
- visited.add(file);
1865
- if (isCssFile2(file)) {
1866
- if (!context.globalCssImports().has(path4.resolve(file))) imports.add(file);
1867
- return;
1868
- }
1869
- const clientFile = isClientModule(context, file);
1870
- for (const imported of moduleEdges(context, file)) {
1871
- if (isCssFile2(imported.file)) {
1872
- if (!context.globalCssImports().has(path4.resolve(imported.file))) imports.add(imported.file);
1873
- continue;
1874
- }
1875
- if (!clientFile && isLazyClientEdge(context, imported)) continue;
1876
- collectCssFromFile(context, imported.file, imports, visited);
1877
- }
1878
- }
1879
- function isLazyClientEdge(context, edge) {
1880
- if (!edge.dynamic || ssrClientReference({ dynamic: edge.dynamic })) return false;
1881
- return isClientModule(context, edge.file);
1882
- }
1883
- function attachLazyReferenceCss(context, references) {
1884
- for (const reference of references) {
1885
- if (ssrClientReference(reference)) continue;
1886
- const css = collectCssImports(context, [reference.file]);
1887
- if (css.length > 0) reference.cssImports = css;
1888
- }
1889
- }
1890
- function readScanSource(context, file, visited = /* @__PURE__ */ new Set()) {
1891
- const key = path4.resolve(file);
1892
- if (visited.has(key)) return "";
1893
- visited.add(key);
1894
- const source = readSource(context, file);
1895
- const parts = [source];
1896
- for (const edge of scanFacts(file, source).imports) {
1897
- if (!edge.reexport || !edge.specifier.startsWith(".")) continue;
1898
- const resolved = resolveModuleEdge(context, file, edge.specifier);
1899
- if (!resolved || !existsSync3(resolved)) continue;
1900
- parts.push(readScanSource(context, resolved, visited));
1901
- }
1902
- return parts.join("\n");
1903
- }
1904
- function readSource(context, file) {
1905
- const key = path4.resolve(file);
1906
- let source = context.sources.get(key);
1907
- if (source === void 0) {
1908
- source = rewriteLiteralDynamicCalls(readSourceSync(key), file);
1909
- context.sources.set(key, source);
1910
- }
1911
- return source;
1912
- }
1913
- var linkSpecifiers = /* @__PURE__ */ new Set(["next/link", "@wular/pnext/link"]);
1914
- var navigationSpecifiers = /* @__PURE__ */ new Set([
1915
- ...linkSpecifiers,
1916
- "next/form",
1917
- "next/navigation",
1918
- "next/router",
1919
- "@wular/pnext/navigation",
1920
- "@wular/pnext/navigation/client"
1921
- ]);
1922
- var rootNavigationExports = /* @__PURE__ */ new Set([
1923
- "*",
1924
- "default",
1925
- "Link",
1926
- "permanentRedirect",
1927
- "redirect",
1928
- "useLinkStatus",
1929
- "useParams",
1930
- "usePathname",
1931
- "useRoute",
1932
- "useRouter",
1933
- "useSearchParams"
1934
- ]);
1935
- function importReachesNavigation(edge) {
1936
- if (navigationSpecifiers.has(edge.specifier)) return true;
1937
- if (edge.specifier !== "@wular/pnext") return false;
1938
- return edge.exports.length === 0 || edge.exports.some((name) => rootNavigationExports.has(name));
1939
- }
1940
- function routeUsesLinkComponent(context, files) {
1941
- for (const file of files) {
1942
- if (!fileExists(context, file) || isAssetFile(file)) continue;
1943
- const key = path4.resolve(file);
1944
- let uses = context.usesLink.get(key);
1945
- if (uses === void 0) {
1946
- const facts = scanFacts(file, readSource(context, file));
1947
- uses = facts.imports.some((edge) => linkSpecifiers.has(edge.specifier));
1948
- context.usesLink.set(key, uses);
1949
- }
1950
- if (uses) return true;
1951
- }
1952
- return false;
1953
- }
1954
- function routeUsesNavigation(context, files) {
1955
- for (const file of files) {
1956
- if (!fileExists(context, file) || isAssetFile(file)) continue;
1957
- const key = path4.resolve(file);
1958
- let uses = context.usesNavigation.get(key);
1959
- if (uses === void 0) {
1960
- const facts = scanFacts(file, readSource(context, file));
1961
- uses = facts.imports.some(importReachesNavigation);
1962
- context.usesNavigation.set(key, uses);
1963
- }
1964
- if (uses) return true;
1965
- }
1966
- return false;
1967
- }
1968
- function routeClientEntryReasons(context, files) {
1969
- const reasons = [];
1970
- for (const file of files) {
1971
- if (!fileExists(context, file) || isAssetFile(file)) continue;
1972
- const key = path4.resolve(file);
1973
- let fileReasons = context.entryReasons.get(key);
1974
- if (fileReasons === void 0) {
1975
- fileReasons = sourceClientEntryReasons(readSource(context, file));
1976
- context.entryReasons.set(key, fileReasons);
1977
- }
1978
- reasons.push(...fileReasons);
1979
- }
1980
- return reasons;
1981
- }
1982
- function usesRequestImportDataForFiles(context, files) {
1983
- for (const file of files) {
1984
- const key = path4.resolve(file);
1985
- let usesRequestImport = context.requestImportUsage.get(key);
1986
- if (usesRequestImport === void 0) {
1987
- usesRequestImport = sourceUsesRegisteredRequestApi(readSource(context, file));
1988
- context.requestImportUsage.set(key, usesRequestImport);
1989
- }
1990
- if (usesRequestImport) return true;
1991
- }
1992
- return false;
1993
- }
1994
- function routeDependencyClassification(context, kind, files) {
1995
- const sources = files.filter((file) => !isAssetFile(file)).map((file) => ({ file, source: readSource(context, file) }));
1996
- return classifyRouteDependencies({ kind, files: sources });
1997
- }
1998
- function moduleEdges(context, file) {
1999
- const key = path4.resolve(file);
2000
- let edges = context.edges.get(key);
2001
- if (!edges) {
2002
- edges = moduleEdgesFromSource(context, file, readSource(context, file));
2003
- context.edges.set(key, edges);
2004
- }
2005
- return edges;
2006
- }
2007
- function resolveModuleEdge(context, file, specifier) {
2008
- return resolveModuleAlias(specifier) ?? resolveImport(context.root, file, specifier, context.workspaceRoot) ?? getBundlerExtensions().resolveRouteDependency(context.root, file, specifier) ?? getCssExtensions().resolveCssDependency(context.root, file, specifier);
2009
- }
2010
- function publishedClientImports(context, file) {
2011
- const source = readSource(context, file);
2012
- const found = [];
2013
- for (const edge of scanFacts(file, source).imports) {
2014
- if (resolveModuleEdge(context, file, edge.specifier)) continue;
2015
- found.push(...publishedClientEdges(context, file, edge.specifier, edge.exports));
2016
- }
2017
- return found;
2018
- }
2019
- function publishedClientEdges(context, file, specifier, requested) {
2020
- const cacheKey = `${file}\0${specifier}\0${requested.join(",")}`;
2021
- const cached = context.edges.get(cacheKey);
2022
- if (cached) return cached;
2023
- const entry = resolvePublishedEdge(context, file, specifier, "import");
2024
- const edges = entry ? publishedClientExports(context, entry, requested, /* @__PURE__ */ new Set()) : [];
2025
- context.edges.set(cacheKey, edges);
2026
- return edges;
2027
- }
2028
- function resolvePublishedEdge(context, file, specifier, kind) {
2029
- return resolveModuleEdge(context, file, specifier) ?? resolvePackageSpecifier(context.root, file, specifier, [kind, "default"]);
2030
- }
2031
- function publishedClientExports(context, file, requested, visiting) {
2032
- const key = path4.resolve(file);
2033
- if (visiting.has(key) || !fileExists(context, key)) return [];
2034
- visiting.add(key);
2035
- const source = readSource(context, key);
2036
- if (hasUseClientDirective(key, source)) {
2037
- visiting.delete(key);
2038
- const names = [...scanFacts(key, source).exportNames, ...commonJsRouteExportNames(source)];
2039
- const exports = requested.filter((name) => names.includes(name));
2040
- return exports.length > 0 ? [{ file: key, exports }] : [];
2041
- }
2042
- const facts = scanFacts(key, source);
2043
- const found = [];
2044
- for (const edge of facts.imports) {
2045
- if (!edge.reexport) continue;
2046
- const map = { ...esmReexportMap(source, edge.specifier), ...edge.exportMap };
2047
- const next = edge.star ? requested.filter((name) => name !== "default") : requested.map((name) => map[name]).filter((name) => Boolean(name));
2048
- const target = resolvePublishedEdge(context, key, edge.specifier, "import");
2049
- if (target && next.length > 0) {
2050
- found.push(...publishedClientExports(context, target, next, visiting));
2051
- }
2052
- }
2053
- for (const edge of facts.requires) {
2054
- const map = commonJsRequireReexportMap(source, edge.specifier);
2055
- const next = map.star ? requested : requested.map((name) => map.names[name]).filter((name) => Boolean(name));
2056
- const target = resolvePublishedEdge(context, key, edge.specifier, "require");
2057
- if (target && next.length > 0) {
2058
- found.push(...publishedClientExports(context, target, next, visiting));
2059
- }
2060
- }
2061
- visiting.delete(key);
2062
- return found;
2063
- }
2064
- function moduleEdgesFromSource(context, file, source) {
2065
- const dynamicNames = pnextDynamicImportNames(source, file);
2066
- assertSupportedDynamicCalls(file, source, dynamicNames);
2067
- const ordered = [];
2068
- const facts = scanFacts(file, source);
2069
- for (const edge of facts.imports) {
2070
- const resolved = resolveModuleEdge(context, file, edge.specifier);
2071
- if (!resolved) continue;
2072
- ordered.push({
2073
- file: resolved,
2074
- exports: [...edge.exports],
2075
- index: edge.index,
2076
- ...edge.star ? { star: true } : {}
2077
- });
2078
- }
2079
- ordered.sort((a, b) => a.index - b.index);
2080
- const imports = ordered.map(({ index: _index, ...edge }) => edge);
2081
- for (const imported of dynamicImportEdgesFromSource(context, file, source, dynamicNames))
2082
- imports.push(imported);
2083
- return imports;
2084
- }
2085
- function esmReexportMap(source, specifier) {
2086
- const escaped = escapeRegex2(specifier);
2087
- const names = {};
2088
- const pattern = new RegExp(`\\bexport\\s*\\{([^}]*)\\}\\s*from\\s*["']${escaped}["']`, "g");
2089
- for (const clause of source.matchAll(pattern)) {
2090
- for (const item of (clause[1] ?? "").split(",")) {
2091
- const parts = item.trim().split(/\s+as\s+/);
2092
- const imported = parts[0]?.trim();
2093
- const exported = (parts[1] ?? parts[0])?.trim();
2094
- if (imported && exported && /^[$\w]+$/.test(imported) && /^[$\w]+$/.test(exported)) {
2095
- names[exported] = imported;
2096
- }
2097
- }
2098
- }
2099
- return names;
2100
- }
2101
- function commonJsRequireReexportMap(source, specifier) {
2102
- const escaped = escapeRegex2(specifier);
2103
- const names = {};
2104
- const direct = new RegExp(
2105
- `exports\\.([A-Za-z_$][\\w$]*)\\s*=\\s*require\\(\\s*["']${escaped}["']\\s*\\)\\.([A-Za-z_$][\\w$]*)`,
2106
- "g"
2107
- );
2108
- for (const match of source.matchAll(direct)) {
2109
- names[match[1]] = match[2];
2110
- }
2111
- const binding = new RegExp(
2112
- `(?:const|let|var)\\s+([A-Za-z_$][\\w$]*)\\s*=\\s*require\\(\\s*["']${escaped}["']\\s*\\)`
2113
- ).exec(source)?.[1];
2114
- if (binding) {
2115
- const local = escapeRegex2(binding);
2116
- const assignment = new RegExp(
2117
- `exports\\.([A-Za-z_$][\\w$]*)\\s*=\\s*${local}\\.([A-Za-z_$][\\w$]*)`,
2118
- "g"
2119
- );
2120
- for (const match of source.matchAll(assignment)) {
2121
- names[match[1]] = match[2];
2122
- }
2123
- const getter = new RegExp(
2124
- `Object\\.defineProperty\\(\\s*exports\\s*,\\s*["']([A-Za-z_$][\\w$]*)["'](?:(?!Object\\.defineProperty)[\\s\\S]){0,300}?return\\s+${local}\\.([A-Za-z_$][\\w$]*)`,
2125
- "g"
2126
- );
2127
- for (const match of source.matchAll(getter)) {
2128
- names[match[1]] = match[2];
2129
- }
2130
- const helper = new RegExp(
2131
- `(?:^|[,\\{])\\s*([A-Za-z_$][\\w$]*)\\s*:\\s*\\(\\s*\\)\\s*=>\\s*${local}\\.([A-Za-z_$][\\w$]*)`,
2132
- "g"
2133
- );
2134
- for (const match of source.matchAll(helper)) {
2135
- names[match[1]] = match[2];
2136
- }
2137
- }
2138
- const star = new RegExp(
2139
- `module\\.exports\\s*=\\s*(?:require\\(\\s*["']${escaped}["']\\s*\\)|${binding ?? "(?!)"})(?=\\s*(?:;|$))`,
2140
- "m"
2141
- ).test(source);
2142
- return { names, star };
2143
- }
2144
- function commonJsRouteExportNames(source) {
2145
- return [
2146
- .../* @__PURE__ */ new Set([
2147
- ...[...source.matchAll(/\bexports\.([A-Za-z_$][\w$]*)\s*=/g)].map((match) => match[1]),
2148
- ...[
2149
- ...source.matchAll(
2150
- /\bObject\.defineProperty\(\s*exports\s*,\s*["']([A-Za-z_$][\w$]*)["']/g
2151
- )
2152
- ].map((match) => match[1])
2153
- ])
2154
- ].filter((name) => name !== "__esModule");
2155
- }
2156
- function assertSupportedDynamicCalls(file, source, dynamicNames) {
2157
- for (const call of dynamicCallsFromSource(source, dynamicNames)) {
2158
- if (!/\bimport\s*\(/.test(call.source)) {
2159
- throw new Error(
2160
- `${file} uses dynamic() without a literal import. PNext supports dynamic('./module') or dynamic(() => import('./module')).`
2161
- );
2162
- }
2163
- if (!/\bimport\s*\(\s*['"][^'"]+['"]\s*\)/.test(call.source)) {
2164
- throw new Error(
2165
- `${file} uses a non-literal dynamic import. PNext supports dynamic('./module') or dynamic(() => import('./module')).`
2166
- );
2167
- }
2168
- }
2169
- }
2170
- function dynamicImportEdgesFromSource(context, file, source, dynamicNames) {
2171
- const imports = [];
2172
- if (dynamicNames.size === 0) return imports;
2173
- const optionObjects = dynamicOptionObjects(source);
2174
- for (const fact of dynamicCallFacts(source, file)) {
2175
- if (!dynamicNames.has(fact.name)) continue;
2176
- const resolved = resolveModuleEdge(context, file, fact.specifier);
2177
- if (!resolved) continue;
2178
- imports.push({
2179
- file: resolved,
2180
- exports: [fact.exportName],
2181
- dynamic: dynamicOptionsForFact(source, fact, optionObjects)
2182
- });
2183
- }
2184
- return imports;
2185
- }
2186
- function dynamicOptionObjects(source) {
2187
- const options = /* @__PURE__ */ new Map();
2188
- const pattern = /const\s+([A-Za-z_$][\w$]*)\s*=\s*({[\s\S]*?})\s*(?:as\s+const\s*)?;/g;
2189
- let match;
2190
- while (match = pattern.exec(source)) {
2191
- const [, name, objectSource] = match;
2192
- if (name && objectSource) options.set(name, dynamicOptionsFromSource(objectSource));
2193
- }
2194
- return options;
2195
- }
2196
- function dynamicOptionsForFact(source, fact, optionObjects) {
2197
- if (fact.optionsStart === void 0 || fact.optionsEnd === void 0) return {};
2198
- const options = source.slice(fact.optionsStart, fact.optionsEnd);
2199
- if (/^[A-Za-z_$][\w$]*$/.test(options)) return optionObjects.get(options) ?? {};
2200
- return dynamicOptionsFromSource(options);
2201
- }
2202
- function dynamicOptionsFromSource(source) {
2203
- if (!source) return {};
2204
- return {
2205
- ...dynamicLoadFromSource(source),
2206
- ...dynamicRootMarginFromSource(source),
2207
- ...dynamicSsrFromSource(source),
2208
- ...dynamicThresholdFromSource(source)
2209
- };
2210
- }
2211
- function dynamicLoadFromSource(source) {
2212
- const match = /\bload\s*:\s*['"](render|visible)['"]/.exec(source);
2213
- return match?.[1] === "render" || match?.[1] === "visible" ? { load: match[1] } : {};
2214
- }
2215
- function dynamicRootMarginFromSource(source) {
2216
- const match = /\brootMargin\s*:\s*['"]([^'"]+)['"]/.exec(source);
2217
- return match?.[1] ? { rootMargin: match[1] } : {};
2218
- }
2219
- function dynamicSsrFromSource(source) {
2220
- const match = /\bssr\s*:\s*(true|false)\b/.exec(source);
2221
- return match?.[1] ? { ssr: match[1] === "true" } : {};
2222
- }
2223
- function dynamicThresholdFromSource(source) {
2224
- const numberMatch = /\bthreshold\s*:\s*(-?\d+(?:\.\d+)?)/.exec(source);
2225
- if (numberMatch?.[1]) return { threshold: Number(numberMatch[1]) };
2226
- const arrayMatch = /\bthreshold\s*:\s*\[([^\]]*)\]/.exec(source);
2227
- if (!arrayMatch?.[1]) return {};
2228
- const threshold = arrayMatch[1].split(",").map((value) => Number(value.trim())).filter(Number.isFinite);
2229
- return threshold.length > 0 ? { threshold } : {};
2230
- }
2231
- function isCssFile2(file) {
2232
- return file.endsWith(".css") || getCssExtensions().extraCssExtensions().some((ext) => file.endsWith(ext));
2233
- }
2234
- function isAssetFile(file) {
2235
- return /\.(css|svg|png|jpe?g|gif|webp|ico|woff2?)$/.test(file) || getCssExtensions().extraCssExtensions().some((ext) => file.endsWith(ext));
2236
- }
2237
- function exportsExperimentalPpr(sources) {
2238
- return sources.some(
2239
- (source) => /\bexport\s+const\s+experimental_ppr\s*=\s*true\b/.test(stripComments(source))
2240
- );
2241
- }
2242
- function usesRequestData(source) {
2243
- const searchable = stripJsxText(stripCommentsAndStrings(source));
2244
- return /\b(?:request|searchParams)\b/.test(searchable) || sourceUsesRegisteredRequestApi(source);
2245
- }
2246
- function stripJsxText(source) {
2247
- return source.replace(
2248
- />([^<>(){}=;\n]*)</g,
2249
- (_match, text) => `>${" ".repeat(text.length)}<`
2250
- );
2251
- }
2252
- function dynamicApiLabel(sources, kind) {
2253
- const joined = sources.map(stripCommentsAndStrings).join("\n");
2254
- if (/\bconnection\s*\(/.test(joined)) return "`connection()`";
2255
- if (/\bcookies\s*\(/.test(joined)) return "`cookies()`";
2256
- if (/\bheaders\s*\(/.test(joined)) return "`headers()`";
2257
- if (/\bdraftMode\s*\(/.test(joined)) return "`draftMode()`";
2258
- if (kind === "handler") {
2259
- if (/\.formData\b/.test(joined)) return "`request.formData`";
2260
- if (/\bnextUrl\b/.test(joined)) return "`nextUrl.toString`";
2261
- if (/\brequest\.url\b|\breq\.url\b/.test(joined)) return "`request.url`";
2262
- } else if (/\bsearchParams\b/.test(joined)) {
2263
- return "`await searchParams`, `searchParams.then`, or similar";
2264
- }
2265
- return void 0;
2266
- }
2267
- function maxDurationFromSources(sources) {
2268
- const durations = sources.map((source) => /\bexport\s+const\s+maxDuration\s*=\s*(\d+)\b/.exec(source)?.[1]).filter((value) => Boolean(value)).map((value) => Number(value));
2269
- return durations.length > 0 ? Math.max(...durations) : void 0;
2270
- }
2271
- function usesRevalidationApis(source) {
2272
- return /\b(?:revalidatePath|revalidateTag|updateTag|expirePath|expireTag|unstable_expirePath|unstable_expireTag)\s*\(/.test(
2273
- stripCommentsAndStrings(source)
2274
- );
2275
- }
2276
- var DESTRUCTURED_PARAM = "<destructured>";
2277
- function routeHandlerUsesRequest(source) {
2278
- const withoutComments = stripComments(source);
2279
- const searchable = stripCommentsAndStrings(source);
2280
- if (sourceUsesRegisteredRequestApi(source)) return true;
2281
- for (const method of routeHandlerMethods) {
2282
- for (const params of exportedFunctionParams(withoutComments, method)) {
2283
- const name = firstParameterName(params);
2284
- if (name === DESTRUCTURED_PARAM) return true;
2285
- if (name && referencesName(searchable, name) > 1) return true;
2286
- }
2287
- }
2288
- return false;
2289
- }
2290
- function exportedFunctionParams(source, method) {
2291
- const params = [];
2292
- const functionPattern = new RegExp(
2293
- `\\bexport\\s+(?:async\\s+)?function\\s+${method}\\s*\\(([^)]*)\\)`,
2294
- "g"
2295
- );
2296
- let match;
2297
- while (match = functionPattern.exec(source)) {
2298
- params.push(match[1] ?? "");
2299
- }
2300
- const arrowPattern = new RegExp(
2301
- `\\bexport\\s+const\\s+${method}\\s*(?::[^=]+)?=\\s*(?:async\\s*)?(?:\\(([^)]*)\\)|([A-Za-z_$][\\w$]*))\\s*=>`,
2302
- "g"
2303
- );
2304
- while (match = arrowPattern.exec(source)) {
2305
- params.push(match[1] ?? match[2] ?? "");
2306
- }
2307
- return params;
2308
- }
2309
- function firstParameterName(params) {
2310
- const first = params.split(",")[0]?.trim();
2311
- if (!first) return void 0;
2312
- if (first.startsWith("{") || first.startsWith("[")) return DESTRUCTURED_PARAM;
2313
- const name = /^\.{3}\s*([A-Za-z_$][\w$]*)/.exec(first)?.[1] ?? /^([A-Za-z_$][\w$]*)/.exec(first)?.[1];
2314
- return name;
2315
- }
2316
- function referencesName(source, name) {
2317
- const pattern = new RegExp(`\\b${escapeRegex2(name)}\\b`, "g");
2318
- return [...source.matchAll(pattern)].length;
2319
- }
2320
- function stripCommentsAndStrings(source) {
2321
- return stripComments(source).replace(/(['"`])(?:\\[\s\S]|(?!\1)[^\\])*\1/g, "");
2322
- }
2323
- function stripComments(source) {
2324
- return source.replace(/\/\*[\s\S]*?\*\//g, "").replace(/(^|[^:])\/\/.*$/gm, "$1");
2325
- }
2326
- function rootFromAppPath(appPath) {
2327
- const normalized = toPosixPath(appPath);
2328
- return normalized.endsWith("/src/app") ? path4.dirname(path4.dirname(appPath)) : path4.dirname(appPath);
2329
- }
2330
- function clientReference(file, exportName) {
2331
- return {
2332
- id: `c-${clientReferenceId(file, exportName)}`,
2333
- file,
2334
- exportName
2335
- };
2336
- }
2337
- function routeId(route) {
2338
- if (route === "/") return "index";
2339
- return route.split("/").filter(Boolean).map((segment) => {
2340
- if (segment.startsWith(":") && segment.endsWith("*"))
2341
- return `catchall-${sanitizeIdPart(segment.slice(1, -1))}`;
2342
- if (segment.startsWith(":")) return `param-${sanitizeIdPart(segment.slice(1))}`;
2343
- return sanitizeIdPart(segment);
2344
- }).join("-");
2345
- }
2346
- function sanitizeIdPart(value) {
2347
- return value.replace(/[^a-zA-Z0-9_-]+/g, "-").replace(/^-+|-+$/g, "") || "route";
2348
- }
2349
- function routeRank(route) {
2350
- const spec = route.route.split("/").filter(Boolean).map((segment) => segment.startsWith(":") ? segment.endsWith("*") ? "2" : "1" : "0").join("");
2351
- return `${spec}:${route.synthetic ? 1 : 0}:${route.route}`;
2352
- }
2353
- function escapeRegex2(value) {
2354
- return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
2355
- }
2356
-
2357
- export {
2358
- readSourceSync,
2359
- readSourceText,
2360
- isSlotSegment,
2361
- isGroupSegment,
2362
- slotConventionFile,
2363
- slotDirectoriesIn,
2364
- consumedSegments,
2365
- matchSegments,
2366
- matchSlotInterceptor,
2367
- pathnameSegments,
2368
- routeFactsVersion,
2369
- routeFactsResolved,
2370
- materializeRouteFacts,
2371
- materializeRouteFactsPaced,
2372
- setRouteFactsStore,
2373
- scanRoutes,
2374
- addClientEntryReason,
2375
- findLayouts,
2376
- collectNotFoundCss,
2377
- collectFileCss,
2378
- findConventionFiles,
2379
- findGlobalError,
2380
- matchRoute,
2381
- normalizePathname,
2382
- matchInterception,
2383
- selectRouteForRequest,
2384
- parseNavState,
2385
- serverActionsUnsupportedMessage,
2386
- assertNoServerActionsWithoutCompat,
2387
- globalCssHref,
2388
- publishEmittedAssets,
2389
- emittedAssetName,
2390
- assetHref,
2391
- routeCssAssetNames,
2392
- routeCssHref,
2393
- emitFontCssStylesheet,
2394
- withAssetPrefix,
2395
- registerCssRuntime,
2396
- hoistCssImports
2397
- };