@builtbyfriends/bwf 0.0.0-stage → 1.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (448) hide show
  1. package/AGENTS_TEMPLATE.md +4 -0
  2. package/LICENSE +22 -0
  3. package/README.md +48 -2
  4. package/dist/account-cmd-Cj0I2_bJ.mjs +45 -0
  5. package/dist/agents-BLiMq9E1.mjs +113 -0
  6. package/dist/application-analysis-C9Ck2Yeg.mjs +1498 -0
  7. package/dist/application-routing-DbR-W5lG.mjs +25 -0
  8. package/dist/atomic-write-DA6eD1Kp.mjs +17 -0
  9. package/dist/auth-BKsUmWbT.d.mts +77 -0
  10. package/dist/auth-DkvoW5hB.mjs +33 -0
  11. package/dist/auth-aKyIWkdS.mjs +1 -0
  12. package/dist/auth-client-6-Ft9i9T.d.mts +5 -0
  13. package/dist/auth-client-DwCdwKbw.mjs +5 -0
  14. package/dist/auth-client-react-CJdeErvM.mjs +5 -0
  15. package/dist/auth-client-react-DvQLe5Zb.d.mts +5 -0
  16. package/dist/auth-link-D-DddkCQ.mjs +26 -0
  17. package/dist/auth-migrations-DDeifS3v.mjs +206 -0
  18. package/dist/auth-router-tWzIwf8f.mjs +66 -0
  19. package/dist/auth-xnkmpZUl.mjs +311 -0
  20. package/dist/base64-ikl9yBy3.mjs +15 -0
  21. package/dist/better-auth-shared-Br6TNaYJ.mjs +473 -0
  22. package/dist/better-auth-shared-CsBNvPOU.d.mts +56 -0
  23. package/dist/build-cmd-BnZezraT.mjs +153 -0
  24. package/dist/build-output-dir-Clj_unKN.mjs +402 -0
  25. package/dist/cancel-deploy-DKAj5U1Z.mjs +57 -0
  26. package/dist/cf-access-Bhz9wX6p.mjs +131 -0
  27. package/dist/cf-access-CUP5L08W.mjs +67 -0
  28. package/dist/cf-build-output-DA6uJomQ.mjs +1 -0
  29. package/dist/cf-build-output-DNQTwMNU.mjs +438 -0
  30. package/dist/cf-command-values-2kOtxMo1.mjs +26 -0
  31. package/dist/cf-config-migrate-COOCi4Ge.mjs +330 -0
  32. package/dist/cf-worker-settings-CIh4t_yG.mjs +41 -0
  33. package/dist/cli/cli.d.mts +1 -0
  34. package/dist/cli/cli.mjs +88 -0
  35. package/dist/cli/cloudflare-operation-process.d.mts +1 -0
  36. package/dist/cli/cloudflare-operation-process.mjs +1284 -0
  37. package/dist/cli/env-schema-probe.d.mts +43 -0
  38. package/dist/cli/env-schema-probe.mjs +165 -0
  39. package/dist/cli-main-HeXRQml6.mjs +1846 -0
  40. package/dist/client-D3D5RM5h.mjs +940 -0
  41. package/dist/client-VF2Nzc7Z.mjs +1 -0
  42. package/dist/cloudflare-auth-jb-1e43r.mjs +152 -0
  43. package/dist/cloudflare-cmd-B62t8Fm-.mjs +59 -0
  44. package/dist/cloudflare-config-i8yanry0.mjs +186 -0
  45. package/dist/cloudflare-connect-x7IsYghw.mjs +55 -0
  46. package/dist/cloudflare-operations-BeK7bhnP.mjs +627 -0
  47. package/dist/cloudflare-operations-C3Uu0Emj.mjs +1 -0
  48. package/dist/cloudflare-process-Cc6oiJqk.mjs +309 -0
  49. package/dist/cloudflare-user-output-CqONaAbP.mjs +19 -0
  50. package/dist/collect-8i0wU63d.mjs +1 -0
  51. package/dist/collect-C6Blu9yw.mjs +48 -0
  52. package/dist/config-CN_RFRkS.mjs +86 -0
  53. package/dist/config-D5G-Tx6o.mjs +1 -0
  54. package/dist/config-DOaFIK3w.mjs +88 -0
  55. package/dist/config-entry.d.mts +202 -0
  56. package/dist/config-entry.mjs +6 -0
  57. package/dist/config-tNx0HlFv.mjs +516 -0
  58. package/dist/connect-hLPNppu3.mjs +84 -0
  59. package/dist/create-project-B35ux-LA.mjs +126 -0
  60. package/dist/create-project-tJ1KwNss.mjs +1 -0
  61. package/dist/database-provider-DkZo4VwN.mjs +5 -0
  62. package/dist/database-provider.d.mts +25 -0
  63. package/dist/database-provider.mjs +1 -0
  64. package/dist/db-BH_md90k.mjs +1735 -0
  65. package/dist/delete-BSKI7V23.mjs +65 -0
  66. package/dist/deploy-C8KHBNsh.mjs +6512 -0
  67. package/dist/deploy-DCZBr7Ey.mjs +2 -0
  68. package/dist/deploy.d.mts +31 -0
  69. package/dist/deploy.mjs +118 -0
  70. package/dist/dev-inbox-I0nqTCdf.mjs +216 -0
  71. package/dist/discover-DJPmQcL5.mjs +36 -0
  72. package/dist/discover-EVuydEoM.mjs +1 -0
  73. package/dist/dist-B6eN80gc.mjs +1612 -0
  74. package/dist/dist-Cp4b1_T9.mjs +1 -0
  75. package/dist/dist-DMYe8CZJ.mjs +48 -0
  76. package/dist/dist-STQXl8ck.mjs +1878 -0
  77. package/dist/domain-C4ZhEiFG.mjs +149 -0
  78. package/dist/dotenv-4NdUCXbB.mjs +156 -0
  79. package/dist/drizzle-DqVFXtlc.mjs +306 -0
  80. package/dist/drizzle-Ds5P0n-S.mjs +1 -0
  81. package/dist/edge.d.mts +2 -0
  82. package/dist/edge.mjs +1 -0
  83. package/dist/email-B3TWga7x.mjs +742 -0
  84. package/dist/email-C_ATvNIG.mjs +2865 -0
  85. package/dist/email-cloudflare-DuAc9zny.mjs +854 -0
  86. package/dist/email-protocol-CZ0bAkI8.mjs +81 -0
  87. package/dist/env-CTAo8ifZ.mjs +73 -0
  88. package/dist/env-DUyTzroe.mjs +88 -0
  89. package/dist/env-Dl4Wggec.mjs +71 -0
  90. package/dist/env-helpers-BX0APszT.mjs +135 -0
  91. package/dist/env-helpers-U56xuFgL.d.mts +20 -0
  92. package/dist/env-mask-BsHxq3R8.mjs +46 -0
  93. package/dist/env-public-Cw_xPi1D.d.mts +119 -0
  94. package/dist/env-raw-Bo6TtrHU.mjs +41 -0
  95. package/dist/env-types-Bg-dTh8u.mjs +56 -0
  96. package/dist/env-validation-BufZConV.mjs +488 -0
  97. package/dist/env-validation-DPqDo4DU.mjs +1 -0
  98. package/dist/fetch-CBgyyhzm.d.mts +87 -0
  99. package/dist/fetch-error-DmlRM6e4.mjs +264 -0
  100. package/dist/fetch-stream-2GUN3YN1.mjs +102 -0
  101. package/dist/fetch-stream-bUXynOyZ.d.mts +32 -0
  102. package/dist/fetch-tpPiSK10.mjs +25 -0
  103. package/dist/gen-dc13IRXh.mjs +509 -0
  104. package/dist/gen-kQqhFyOP.mjs +1 -0
  105. package/dist/generate-BgtlYpKg.mjs +1 -0
  106. package/dist/generate-Da9mWKzU.mjs +80 -0
  107. package/dist/generated-wrangler-config-CoDaaFsA.mjs +17 -0
  108. package/dist/git-metadata-Cukp5kV5.mjs +82 -0
  109. package/dist/github-cmd-DT5Onu6E.mjs +690 -0
  110. package/dist/handler-CJ7DiiRF.mjs +161 -0
  111. package/dist/handler-CVsIfRv7.d.mts +279 -0
  112. package/dist/help-Bpv6Qeqn.mjs +1946 -0
  113. package/dist/help-CfZ4Bsw5.mjs +1 -0
  114. package/dist/inbound-CqubE-9T.d.mts +311 -0
  115. package/dist/inbound-lHugZPuK.mjs +509 -0
  116. package/dist/index.d.mts +64 -0
  117. package/dist/index.mjs +4163 -0
  118. package/dist/info-CLQoCenb.mjs +109 -0
  119. package/dist/init-DRUR0j8C.mjs +2486 -0
  120. package/dist/limits-CMmYT2l8.d.mts +16 -0
  121. package/dist/limits-D27Lp6FP.mjs +46 -0
  122. package/dist/link-DinwJnon.mjs +52 -0
  123. package/dist/list-B84t4BhW.mjs +130 -0
  124. package/dist/live-Dui0-aj_.d.mts +105 -0
  125. package/dist/live-saC8barp.mjs +410 -0
  126. package/dist/load-user-env-g0ahkZcj.mjs +34 -0
  127. package/dist/local-d1-C3EeOV7-.mjs +103 -0
  128. package/dist/log-JDnPc0cF.mjs +23 -0
  129. package/dist/login-Bl5lH8nH.mjs +87 -0
  130. package/dist/login-DoI7AsbY.mjs +1 -0
  131. package/dist/logs-CaT2N2f7.mjs +129 -0
  132. package/dist/migrate-CbGscX-V.mjs +125 -0
  133. package/dist/migrate-Ce3JKLVs.mjs +1 -0
  134. package/dist/migration-handler-22qiuWPq.mjs +469 -0
  135. package/dist/migration-handler-Bb2BJh6g.d.mts +38 -0
  136. package/dist/mime-BMUN_QKG.mjs +1004 -0
  137. package/dist/mysql-migration-sql-CNuBSqdx.mjs +239 -0
  138. package/dist/neon-CJzQSycr.mjs +52 -0
  139. package/dist/node-tfv-3v0V.mjs +64 -0
  140. package/dist/operator-ai-logging-Ay7M4KWw.mjs +121 -0
  141. package/dist/operator-args-BFg32YyY.mjs +722 -0
  142. package/dist/operator-auth-DdYZYEkO.mjs +47 -0
  143. package/dist/operator-client-DBujdELO.mjs +82 -0
  144. package/dist/operator-cmd-C73WWJBl.mjs +443 -0
  145. package/dist/operator-cmd-CdZytuAF.mjs +1 -0
  146. package/dist/output-Bb34lF0w.mjs +173 -0
  147. package/dist/output-CVolXKC1.mjs +1 -0
  148. package/dist/package-DO4d3Qz5.mjs +1444 -0
  149. package/dist/package-json-DvS6IFRv.mjs +43 -0
  150. package/dist/pg-DoyPxa_X.mjs +15 -0
  151. package/dist/picocolors-D1NxSLw-.mjs +71 -0
  152. package/dist/plan-BHNt1QhK.mjs +1 -0
  153. package/dist/plan-DX4_-OM5.mjs +58 -0
  154. package/dist/platform-args-NI_vfWvD.mjs +538 -0
  155. package/dist/platform-args-ZC1-A1N9.mjs +1 -0
  156. package/dist/platform-auth-config-d-lY5-aY.mjs +371 -0
  157. package/dist/platform-auth-protection-Dhw7lUCk.mjs +231 -0
  158. package/dist/platform-auth-recovery-DaCc0tlx.mjs +309 -0
  159. package/dist/platform-cmd-5Ry-C9im.mjs +193 -0
  160. package/dist/platform-cmd-5oZq91lI.mjs +1 -0
  161. package/dist/platform-discovery-Bxg9aZXU.mjs +40 -0
  162. package/dist/platform-domain-DLVdGvGG.mjs +256 -0
  163. package/dist/platform-lifecycle-CUgjipXO.mjs +1 -0
  164. package/dist/platform-lifecycle-fRt5VMls.mjs +8928 -0
  165. package/dist/platform-management-5hEsRfR2.mjs +1 -0
  166. package/dist/platform-management-Djh1hzLP.mjs +1607 -0
  167. package/dist/platform-plans-config-CkbUKFpm.mjs +447 -0
  168. package/dist/platform-recovery-Cghx7FCR.mjs +96 -0
  169. package/dist/platform-registry-x1m9HBxf.mjs +450 -0
  170. package/dist/platform-runtime-logs-kkoiYFpF.mjs +72 -0
  171. package/dist/platform-setup-SfwCwnZg.mjs +306 -0
  172. package/dist/prepare-B9mB47T5.mjs +84 -0
  173. package/dist/prepare-DNIq07so.mjs +13 -0
  174. package/dist/prepare-LHkyJqxi.mjs +1 -0
  175. package/dist/project-CC7eN00D.mjs +141 -0
  176. package/dist/project-DcSd4BeI.mjs +1 -0
  177. package/dist/project-cmd-DTF19-fC.mjs +109 -0
  178. package/dist/project-paths-iXHKRTTQ.mjs +159 -0
  179. package/dist/project-slug-BUy0lmyR.mjs +1 -0
  180. package/dist/project-slug-CO6ci9XG.mjs +7 -0
  181. package/dist/project-team-CvdLhDF2.mjs +129 -0
  182. package/dist/project-token-CwZdUEGu.mjs +70 -0
  183. package/dist/project-tsconfig-P9X952KG.mjs +98 -0
  184. package/dist/project-zero-trust-CKDoPdN1.mjs +64 -0
  185. package/dist/providers-Cd3c7wi0.mjs +64 -0
  186. package/dist/providers-Df69hb_X.d.mts +5 -0
  187. package/dist/provision-DGlFJ3T9.mjs +1 -0
  188. package/dist/provision-mYVLuQiy.mjs +1814 -0
  189. package/dist/queues-Bc3FsBQT.d.mts +5 -0
  190. package/dist/r2-conditions-DSLmkiR5.mjs +60 -0
  191. package/dist/requests-DNhfyF3l.mjs +52 -0
  192. package/dist/resolve-project-BCsAMDRA.mjs +47 -0
  193. package/dist/resolve-project-DhU9_lIo.mjs +1 -0
  194. package/dist/resource-name-DlJ9QXzg.mjs +10 -0
  195. package/dist/response-HmNjB30w.mjs +29 -0
  196. package/dist/rollback-BvCHol52.mjs +150 -0
  197. package/dist/rolldown-runtime-uD8oG6U2.mjs +24 -0
  198. package/dist/route-types-CRWhr93D.mjs +592 -0
  199. package/dist/route-url-BIDZT78M.mjs +58 -0
  200. package/dist/route-url-Bla3Upsy.d.mts +42 -0
  201. package/dist/routes-stub.d.mts +24 -0
  202. package/dist/routes-stub.mjs +1 -0
  203. package/dist/routing-assets-CSheDWWM.mjs +54 -0
  204. package/dist/rpc-DcByS_q0.d.mts +39 -0
  205. package/dist/rpc-DtxIN9Tv.mjs +19 -0
  206. package/dist/runner-CPerdjIl.mjs +163 -0
  207. package/dist/runner-CUNtS5x7.mjs +1 -0
  208. package/dist/runner-mysql-7aA5hGoM.mjs +145 -0
  209. package/dist/runner-mysql-DrMKw203.mjs +1 -0
  210. package/dist/runner-pg-2pjltt0t.mjs +1 -0
  211. package/dist/runner-pg-mYc75KfH.mjs +61 -0
  212. package/dist/runtime/ai.d.mts +50 -0
  213. package/dist/runtime/ai.mjs +455 -0
  214. package/dist/runtime/auth-client-react.d.mts +2 -0
  215. package/dist/runtime/auth-client-react.mjs +1 -0
  216. package/dist/runtime/auth-client.d.mts +2 -0
  217. package/dist/runtime/auth-client.mjs +1 -0
  218. package/dist/runtime/auth.d.mts +2 -0
  219. package/dist/runtime/auth.mjs +1 -0
  220. package/dist/runtime/better-auth-mysql.d.mts +5 -0
  221. package/dist/runtime/better-auth-mysql.mjs +21 -0
  222. package/dist/runtime/better-auth-pg.d.mts +5 -0
  223. package/dist/runtime/better-auth-pg.mjs +21 -0
  224. package/dist/runtime/better-auth.d.mts +6 -0
  225. package/dist/runtime/better-auth.mjs +22 -0
  226. package/dist/runtime/client-react.d.mts +5 -0
  227. package/dist/runtime/client-react.mjs +5 -0
  228. package/dist/runtime/client.d.mts +5 -0
  229. package/dist/runtime/client.mjs +5 -0
  230. package/dist/runtime/db-mysql.d.mts +2 -0
  231. package/dist/runtime/db-mysql.mjs +1 -0
  232. package/dist/runtime/db-pg.d.mts +2 -0
  233. package/dist/runtime/db-pg.mjs +1 -0
  234. package/dist/runtime/db.d.mts +17 -0
  235. package/dist/runtime/db.mjs +36 -0
  236. package/dist/runtime/drizzle-arktype.d.mts +1 -0
  237. package/dist/runtime/drizzle-arktype.mjs +2 -0
  238. package/dist/runtime/drizzle-valibot.d.mts +1 -0
  239. package/dist/runtime/drizzle-valibot.mjs +2 -0
  240. package/dist/runtime/drizzle-zod.d.mts +1 -0
  241. package/dist/runtime/drizzle-zod.mjs +2 -0
  242. package/dist/runtime/durable.d.mts +64 -0
  243. package/dist/runtime/durable.mjs +165 -0
  244. package/dist/runtime/email/testing.d.mts +108 -0
  245. package/dist/runtime/email/testing.mjs +268 -0
  246. package/dist/runtime/email-protocol.d.mts +25 -0
  247. package/dist/runtime/email-protocol.mjs +1 -0
  248. package/dist/runtime/email.d.mts +26 -0
  249. package/dist/runtime/email.mjs +524 -0
  250. package/dist/runtime/env-public-client.d.mts +19 -0
  251. package/dist/runtime/env-public-client.mjs +55 -0
  252. package/dist/runtime/env-public.d.mts +4 -0
  253. package/dist/runtime/env-public.mjs +277 -0
  254. package/dist/runtime/env.d.mts +12 -0
  255. package/dist/runtime/env.mjs +1 -0
  256. package/dist/runtime/fetch-server.d.mts +6 -0
  257. package/dist/runtime/fetch-server.mjs +29 -0
  258. package/dist/runtime/fetch-stream.d.mts +3 -0
  259. package/dist/runtime/fetch-stream.mjs +3 -0
  260. package/dist/runtime/fetch.d.mts +2 -0
  261. package/dist/runtime/fetch.mjs +3 -0
  262. package/dist/runtime/handler.d.mts +3 -0
  263. package/dist/runtime/handler.mjs +1 -0
  264. package/dist/runtime/kv.d.mts +45 -0
  265. package/dist/runtime/kv.mjs +103 -0
  266. package/dist/runtime/limits.d.mts +2 -0
  267. package/dist/runtime/limits.mjs +1 -0
  268. package/dist/runtime/live-client.d.mts +40 -0
  269. package/dist/runtime/live-client.mjs +282 -0
  270. package/dist/runtime/live-server.d.mts +11 -0
  271. package/dist/runtime/live-server.mjs +419 -0
  272. package/dist/runtime/live.d.mts +3 -0
  273. package/dist/runtime/live.mjs +1 -0
  274. package/dist/runtime/log.d.mts +24 -0
  275. package/dist/runtime/log.mjs +57 -0
  276. package/dist/runtime/migration-handler-mysql.d.mts +2 -0
  277. package/dist/runtime/migration-handler-mysql.mjs +111 -0
  278. package/dist/runtime/migration-handler-pg.d.mts +2 -0
  279. package/dist/runtime/migration-handler-pg.mjs +94 -0
  280. package/dist/runtime/migration-handler.d.mts +2 -0
  281. package/dist/runtime/migration-handler.mjs +1 -0
  282. package/dist/runtime/procedure.d.mts +27 -0
  283. package/dist/runtime/procedure.mjs +36 -0
  284. package/dist/runtime/procedures.d.mts +24 -0
  285. package/dist/runtime/procedures.mjs +56 -0
  286. package/dist/runtime/queues.d.mts +2 -0
  287. package/dist/runtime/queues.mjs +8 -0
  288. package/dist/runtime/remote/binding-handler.d.mts +11 -0
  289. package/dist/runtime/remote/binding-handler.mjs +227 -0
  290. package/dist/runtime/remote/index.d.mts +12 -0
  291. package/dist/runtime/remote/index.mjs +467 -0
  292. package/dist/runtime/response.d.mts +11 -0
  293. package/dist/runtime/response.mjs +1 -0
  294. package/dist/runtime/route-url.d.mts +2 -0
  295. package/dist/runtime/route-url.mjs +1 -0
  296. package/dist/runtime/routing.d.mts +53 -0
  297. package/dist/runtime/routing.mjs +425 -0
  298. package/dist/runtime/rpc-react.d.mts +16 -0
  299. package/dist/runtime/rpc-react.mjs +50 -0
  300. package/dist/runtime/rpc.d.mts +2 -0
  301. package/dist/runtime/rpc.mjs +1 -0
  302. package/dist/runtime/sandbox-container.d.mts +3 -0
  303. package/dist/runtime/sandbox-container.mjs +1 -0
  304. package/dist/runtime/sandbox.d.mts +5 -0
  305. package/dist/runtime/sandbox.mjs +196 -0
  306. package/dist/runtime/schema-d1.d.mts +1 -0
  307. package/dist/runtime/schema-d1.mjs +2 -0
  308. package/dist/runtime/schema-mysql.d.mts +1 -0
  309. package/dist/runtime/schema-mysql.mjs +2 -0
  310. package/dist/runtime/schema-pg.d.mts +1 -0
  311. package/dist/runtime/schema-pg.mjs +2 -0
  312. package/dist/runtime/seed.d.mts +34 -0
  313. package/dist/runtime/seed.mjs +5 -0
  314. package/dist/runtime/sse-client.d.mts +31 -0
  315. package/dist/runtime/sse-client.mjs +42 -0
  316. package/dist/runtime/sse.d.mts +32 -0
  317. package/dist/runtime/sse.mjs +1 -0
  318. package/dist/runtime/storage.d.mts +4 -0
  319. package/dist/runtime/storage.mjs +13 -0
  320. package/dist/runtime/validator.d.mts +2 -0
  321. package/dist/runtime/validator.mjs +1 -0
  322. package/dist/runtime/ws-server.d.mts +26 -0
  323. package/dist/runtime/ws-server.mjs +297 -0
  324. package/dist/runtime/ws.d.mts +2 -0
  325. package/dist/runtime/ws.mjs +108 -0
  326. package/dist/sandbox-CWDjoEG2.d.mts +50 -0
  327. package/dist/sandbox-container-BqamdFCx.d.mts +73 -0
  328. package/dist/sandbox-container-d1AHLpgn.mjs +291 -0
  329. package/dist/secret-DCF9RXTc.mjs +146 -0
  330. package/dist/skills-Dr3AjuBF.mjs +63 -0
  331. package/dist/sqlite-validation-CLJXXN93.mjs +24 -0
  332. package/dist/sse-CxR30yMF.mjs +174 -0
  333. package/dist/standard-schema-CuDawHOC.d.mts +40 -0
  334. package/dist/static-asset-marker-mWMX2dLa.mjs +38 -0
  335. package/dist/subcommand-prompt-B9yUo--u.mjs +370 -0
  336. package/dist/terminal-log-text-DNsWJREL.mjs +31 -0
  337. package/dist/types-D7-4tBu7.d.mts +1 -0
  338. package/dist/untrusted-env-lL7RkYiC.mjs +50 -0
  339. package/dist/validate-B-zsjhiz.mjs +162 -0
  340. package/dist/validate-DbqGdPPY.mjs +1 -0
  341. package/dist/validator-8-NZs2Xr.mjs +168 -0
  342. package/dist/version-metadata-DsSoNsKJ.mjs +23 -0
  343. package/dist/wrangler-DU784Dkf.mjs +1452 -0
  344. package/dist/wrangler-Rr9_76DQ.mjs +1 -0
  345. package/dist/ws-Q_osq9VK.d.mts +137 -0
  346. package/dist/yarn-pnp-DgWbE7z5.mjs +91 -0
  347. package/docs/guide/ai.md +273 -0
  348. package/docs/guide/app-types.md +101 -0
  349. package/docs/guide/auth.md +255 -0
  350. package/docs/guide/database/d1.md +86 -0
  351. package/docs/guide/database/mysql.md +72 -0
  352. package/docs/guide/database/postgresql.md +94 -0
  353. package/docs/guide/database.md +454 -0
  354. package/docs/guide/deployment.md +124 -0
  355. package/docs/guide/durable-state.md +192 -0
  356. package/docs/guide/edge/headers.md +47 -0
  357. package/docs/guide/edge/redirects.md +85 -0
  358. package/docs/guide/edge/rewrites.md +119 -0
  359. package/docs/guide/edge/static-assets.md +94 -0
  360. package/docs/guide/email/domains.md +119 -0
  361. package/docs/guide/email/receiving.md +142 -0
  362. package/docs/guide/email/sending.md +262 -0
  363. package/docs/guide/email.md +23 -0
  364. package/docs/guide/env-vars.md +115 -0
  365. package/docs/guide/index.md +37 -0
  366. package/docs/guide/jobs.md +80 -0
  367. package/docs/guide/kv.md +100 -0
  368. package/docs/guide/live.md +181 -0
  369. package/docs/guide/platform/administration/access.md +165 -0
  370. package/docs/guide/platform/administration/connected-apps.md +84 -0
  371. package/docs/guide/platform/administration/email.md +169 -0
  372. package/docs/guide/platform/administration/operations.md +100 -0
  373. package/docs/guide/platform/administration/plans.md +156 -0
  374. package/docs/guide/platform/administration/projects.md +74 -0
  375. package/docs/guide/platform/administration/zero-trust.md +205 -0
  376. package/docs/guide/platform/development/local.md +122 -0
  377. package/docs/guide/platform/development/runtime.md +115 -0
  378. package/docs/guide/platform/development/schema-ci.md +44 -0
  379. package/docs/guide/platform/installation/ci.md +62 -0
  380. package/docs/guide/platform/installation/credentials.md +140 -0
  381. package/docs/guide/platform/installation/domains.md +120 -0
  382. package/docs/guide/platform/installation/first-deployment.md +95 -0
  383. package/docs/guide/platform/installation/maintenance.md +250 -0
  384. package/docs/guide/platform/installation/prerequisites.md +176 -0
  385. package/docs/guide/platform/installation/setup.md +300 -0
  386. package/docs/guide/platform/installation/uninstall.md +110 -0
  387. package/docs/guide/platform-administration.md +19 -0
  388. package/docs/guide/platform-development.md +16 -0
  389. package/docs/guide/procedures.md +48 -0
  390. package/docs/guide/project-collaboration.md +99 -0
  391. package/docs/guide/queues.md +149 -0
  392. package/docs/guide/quickstart.md +129 -0
  393. package/docs/guide/remote-dev.md +67 -0
  394. package/docs/guide/sandboxes.md +134 -0
  395. package/docs/guide/self-hosted-platform.md +45 -0
  396. package/docs/guide/server-routing.md +283 -0
  397. package/docs/guide/sse.md +174 -0
  398. package/docs/guide/storage.md +82 -0
  399. package/docs/guide/testing.md +64 -0
  400. package/docs/guide/type-safety.md +270 -0
  401. package/docs/guide/typed-fetch.md +98 -0
  402. package/docs/guide/websockets.md +230 -0
  403. package/docs/index.md +102 -0
  404. package/docs/integrations/agents.md +38 -0
  405. package/docs/integrations/cloudflare.md +241 -0
  406. package/docs/integrations/hono.md +127 -0
  407. package/docs/reference/api/auth.md +195 -0
  408. package/docs/reference/api/client.md +90 -0
  409. package/docs/reference/api/database.md +118 -0
  410. package/docs/reference/api/deploy.md +63 -0
  411. package/docs/reference/api/durable.md +47 -0
  412. package/docs/reference/api/env.md +51 -0
  413. package/docs/reference/api/handlers.md +189 -0
  414. package/docs/reference/api/plugin.md +40 -0
  415. package/docs/reference/api/resources.md +116 -0
  416. package/docs/reference/api/rewrites.md +111 -0
  417. package/docs/reference/api/types.md +126 -0
  418. package/docs/reference/api.md +71 -0
  419. package/docs/reference/cli/auth.md +87 -0
  420. package/docs/reference/cli/database.md +159 -0
  421. package/docs/reference/cli/deploy.md +117 -0
  422. package/docs/reference/cli/domains.md +42 -0
  423. package/docs/reference/cli/email.md +145 -0
  424. package/docs/reference/cli/generate.md +113 -0
  425. package/docs/reference/cli/github.md +181 -0
  426. package/docs/reference/cli/platform-config.md +93 -0
  427. package/docs/reference/cli/platform-email.md +81 -0
  428. package/docs/reference/cli/platform-installation.md +166 -0
  429. package/docs/reference/cli/platform-operations.md +90 -0
  430. package/docs/reference/cli/platform-users.md +159 -0
  431. package/docs/reference/cli/platform-zero-trust.md +60 -0
  432. package/docs/reference/cli/platform.md +78 -0
  433. package/docs/reference/cli/project.md +208 -0
  434. package/docs/reference/cli/secrets.md +79 -0
  435. package/docs/reference/cli/setup.md +88 -0
  436. package/docs/reference/cli.md +115 -0
  437. package/docs/reference/config.md +478 -0
  438. package/docs/reference/resource-inference.md +72 -0
  439. package/docs/reference/structure.md +138 -0
  440. package/package.json +389 -3
  441. package/sandbox.Dockerfile +4 -0
  442. package/schema.json +353 -0
  443. package/skills/bwf/SKILL.md +100 -0
  444. package/skills/migrate-vite-cloudflare-to-bwf/SKILL.md +53 -0
  445. package/templates/assets/bwf.svg +5 -0
  446. package/templates/assets/icons.svg +49 -0
  447. package/templates/assets/react.svg +1 -0
  448. package/templates/assets/stack.svg +35 -0
@@ -0,0 +1,2865 @@
1
+ import { n as __toESM, t as __commonJSMin } from "./rolldown-runtime-uD8oG6U2.mjs";
2
+ import { a as join } from "./dist-DMYe8CZJ.mjs";
3
+ import * as nativeFs from "fs";
4
+ import { readdir, readdirSync, realpath, realpathSync, stat, statSync } from "fs";
5
+ import { basename, dirname, isAbsolute, normalize, posix, relative, resolve, sep } from "path";
6
+ import { fileURLToPath } from "url";
7
+ import { createRequire } from "module";
8
+ // ../../node_modules/.pnpm/fdir@6.5.0_picomatch@4.0.7/node_modules/fdir/dist/index.mjs
9
+ var __require = /* @__PURE__ */ createRequire(import.meta.url);
10
+ function cleanPath(path) {
11
+ let normalized = normalize(path);
12
+ if (normalized.length > 1 && normalized[normalized.length - 1] === sep) normalized = normalized.substring(0, normalized.length - 1);
13
+ return normalized;
14
+ }
15
+ const SLASHES_REGEX = /[\\/]/g;
16
+ function convertSlashes(path, separator) {
17
+ return path.replace(SLASHES_REGEX, separator);
18
+ }
19
+ const WINDOWS_ROOT_DIR_REGEX = /^[a-z]:[\\/]$/i;
20
+ function isRootDirectory(path) {
21
+ return path === "/" || WINDOWS_ROOT_DIR_REGEX.test(path);
22
+ }
23
+ function normalizePath(path, options) {
24
+ const { resolvePaths, normalizePath: normalizePath$1, pathSeparator } = options;
25
+ const pathNeedsCleaning = process.platform === "win32" && path.includes("/") || path.startsWith(".");
26
+ if (resolvePaths) path = resolve(path);
27
+ if (normalizePath$1 || pathNeedsCleaning) path = cleanPath(path);
28
+ if (path === ".") return "";
29
+ return convertSlashes(path[path.length - 1] !== pathSeparator ? path + pathSeparator : path, pathSeparator);
30
+ }
31
+ function joinPathWithBasePath(filename, directoryPath) {
32
+ return directoryPath + filename;
33
+ }
34
+ function joinPathWithRelativePath(root, options) {
35
+ return function(filename, directoryPath) {
36
+ if (directoryPath.startsWith(root)) return directoryPath.slice(root.length) + filename;
37
+ else return convertSlashes(relative(root, directoryPath), options.pathSeparator) + options.pathSeparator + filename;
38
+ };
39
+ }
40
+ function joinPath(filename) {
41
+ return filename;
42
+ }
43
+ function joinDirectoryPath(filename, directoryPath, separator) {
44
+ return directoryPath + filename + separator;
45
+ }
46
+ function build$7(root, options) {
47
+ const { relativePaths, includeBasePath } = options;
48
+ return relativePaths && root ? joinPathWithRelativePath(root, options) : includeBasePath ? joinPathWithBasePath : joinPath;
49
+ }
50
+ function pushDirectoryWithRelativePath(root) {
51
+ return function(directoryPath, paths) {
52
+ paths.push(directoryPath.substring(root.length) || ".");
53
+ };
54
+ }
55
+ function pushDirectoryFilterWithRelativePath(root) {
56
+ return function(directoryPath, paths, filters) {
57
+ const relativePath = directoryPath.substring(root.length) || ".";
58
+ if (filters.every((filter) => filter(relativePath, true))) paths.push(relativePath);
59
+ };
60
+ }
61
+ const pushDirectory = (directoryPath, paths) => {
62
+ paths.push(directoryPath || ".");
63
+ };
64
+ const pushDirectoryFilter = (directoryPath, paths, filters) => {
65
+ const path = directoryPath || ".";
66
+ if (filters.every((filter) => filter(path, true))) paths.push(path);
67
+ };
68
+ const empty$2 = () => {};
69
+ function build$6(root, options) {
70
+ const { includeDirs, filters, relativePaths } = options;
71
+ if (!includeDirs) return empty$2;
72
+ if (relativePaths) return filters && filters.length ? pushDirectoryFilterWithRelativePath(root) : pushDirectoryWithRelativePath(root);
73
+ return filters && filters.length ? pushDirectoryFilter : pushDirectory;
74
+ }
75
+ const pushFileFilterAndCount = (filename, _paths, counts, filters) => {
76
+ if (filters.every((filter) => filter(filename, false))) counts.files++;
77
+ };
78
+ const pushFileFilter = (filename, paths, _counts, filters) => {
79
+ if (filters.every((filter) => filter(filename, false))) paths.push(filename);
80
+ };
81
+ const pushFileCount = (_filename, _paths, counts, _filters) => {
82
+ counts.files++;
83
+ };
84
+ const pushFile = (filename, paths) => {
85
+ paths.push(filename);
86
+ };
87
+ const empty$1 = () => {};
88
+ function build$5(options) {
89
+ const { excludeFiles, filters, onlyCounts } = options;
90
+ if (excludeFiles) return empty$1;
91
+ if (filters && filters.length) return onlyCounts ? pushFileFilterAndCount : pushFileFilter;
92
+ else if (onlyCounts) return pushFileCount;
93
+ else return pushFile;
94
+ }
95
+ const getArray = (paths) => {
96
+ return paths;
97
+ };
98
+ const getArrayGroup = () => {
99
+ return [""].slice(0, 0);
100
+ };
101
+ function build$4(options) {
102
+ return options.group ? getArrayGroup : getArray;
103
+ }
104
+ const groupFiles = (groups, directory, files) => {
105
+ groups.push({
106
+ directory,
107
+ files,
108
+ dir: directory
109
+ });
110
+ };
111
+ const empty = () => {};
112
+ function build$3(options) {
113
+ return options.group ? groupFiles : empty;
114
+ }
115
+ const resolveSymlinksAsync = function(path, state, callback$1) {
116
+ const { queue, fs, options: { suppressErrors } } = state;
117
+ queue.enqueue();
118
+ fs.realpath(path, (error, resolvedPath) => {
119
+ if (error) return queue.dequeue(suppressErrors ? null : error, state);
120
+ fs.stat(resolvedPath, (error$1, stat) => {
121
+ if (error$1) return queue.dequeue(suppressErrors ? null : error$1, state);
122
+ if (stat.isDirectory() && isRecursive(path, resolvedPath, state)) return queue.dequeue(null, state);
123
+ callback$1(stat, resolvedPath);
124
+ queue.dequeue(null, state);
125
+ });
126
+ });
127
+ };
128
+ const resolveSymlinks = function(path, state, callback$1) {
129
+ const { queue, fs, options: { suppressErrors } } = state;
130
+ queue.enqueue();
131
+ try {
132
+ const resolvedPath = fs.realpathSync(path);
133
+ const stat = fs.statSync(resolvedPath);
134
+ if (stat.isDirectory() && isRecursive(path, resolvedPath, state)) return;
135
+ callback$1(stat, resolvedPath);
136
+ } catch (e) {
137
+ if (!suppressErrors) throw e;
138
+ }
139
+ };
140
+ function build$2(options, isSynchronous) {
141
+ if (!options.resolveSymlinks || options.excludeSymlinks) return null;
142
+ return isSynchronous ? resolveSymlinks : resolveSymlinksAsync;
143
+ }
144
+ function isRecursive(path, resolved, state) {
145
+ if (state.options.useRealPaths) return isRecursiveUsingRealPaths(resolved, state);
146
+ let parent = dirname(path);
147
+ let depth = 1;
148
+ while (parent !== state.root && depth < 2) {
149
+ const resolvedPath = state.symlinks.get(parent);
150
+ if (!!resolvedPath && (resolvedPath === resolved || resolvedPath.startsWith(resolved) || resolved.startsWith(resolvedPath))) depth++;
151
+ else parent = dirname(parent);
152
+ }
153
+ state.symlinks.set(path, resolved);
154
+ return depth > 1;
155
+ }
156
+ function isRecursiveUsingRealPaths(resolved, state) {
157
+ return state.visited.includes(resolved + state.options.pathSeparator);
158
+ }
159
+ const onlyCountsSync = (state) => {
160
+ return state.counts;
161
+ };
162
+ const groupsSync = (state) => {
163
+ return state.groups;
164
+ };
165
+ const defaultSync = (state) => {
166
+ return state.paths;
167
+ };
168
+ const limitFilesSync = (state) => {
169
+ return state.paths.slice(0, state.options.maxFiles);
170
+ };
171
+ const onlyCountsAsync = (state, error, callback$1) => {
172
+ report(error, callback$1, state.counts, state.options.suppressErrors);
173
+ return null;
174
+ };
175
+ const defaultAsync = (state, error, callback$1) => {
176
+ report(error, callback$1, state.paths, state.options.suppressErrors);
177
+ return null;
178
+ };
179
+ const limitFilesAsync = (state, error, callback$1) => {
180
+ report(error, callback$1, state.paths.slice(0, state.options.maxFiles), state.options.suppressErrors);
181
+ return null;
182
+ };
183
+ const groupsAsync = (state, error, callback$1) => {
184
+ report(error, callback$1, state.groups, state.options.suppressErrors);
185
+ return null;
186
+ };
187
+ function report(error, callback$1, output, suppressErrors) {
188
+ if (error && !suppressErrors) callback$1(error, output);
189
+ else callback$1(null, output);
190
+ }
191
+ function build$1(options, isSynchronous) {
192
+ const { onlyCounts, group, maxFiles } = options;
193
+ if (onlyCounts) return isSynchronous ? onlyCountsSync : onlyCountsAsync;
194
+ else if (group) return isSynchronous ? groupsSync : groupsAsync;
195
+ else if (maxFiles) return isSynchronous ? limitFilesSync : limitFilesAsync;
196
+ else return isSynchronous ? defaultSync : defaultAsync;
197
+ }
198
+ const readdirOpts = { withFileTypes: true };
199
+ const walkAsync = (state, crawlPath, directoryPath, currentDepth, callback$1) => {
200
+ state.queue.enqueue();
201
+ if (currentDepth < 0) return state.queue.dequeue(null, state);
202
+ const { fs } = state;
203
+ state.visited.push(crawlPath);
204
+ state.counts.directories++;
205
+ fs.readdir(crawlPath || ".", readdirOpts, (error, entries = []) => {
206
+ callback$1(entries, directoryPath, currentDepth);
207
+ state.queue.dequeue(state.options.suppressErrors ? null : error, state);
208
+ });
209
+ };
210
+ const walkSync = (state, crawlPath, directoryPath, currentDepth, callback$1) => {
211
+ const { fs } = state;
212
+ if (currentDepth < 0) return;
213
+ state.visited.push(crawlPath);
214
+ state.counts.directories++;
215
+ let entries = [];
216
+ try {
217
+ entries = fs.readdirSync(crawlPath || ".", readdirOpts);
218
+ } catch (e) {
219
+ if (!state.options.suppressErrors) throw e;
220
+ }
221
+ callback$1(entries, directoryPath, currentDepth);
222
+ };
223
+ function build(isSynchronous) {
224
+ return isSynchronous ? walkSync : walkAsync;
225
+ }
226
+ /**
227
+ * This is a custom stateless queue to track concurrent async fs calls.
228
+ * It increments a counter whenever a call is queued and decrements it
229
+ * as soon as it completes. When the counter hits 0, it calls onQueueEmpty.
230
+ */
231
+ var Queue = class {
232
+ count = 0;
233
+ constructor(onQueueEmpty) {
234
+ this.onQueueEmpty = onQueueEmpty;
235
+ }
236
+ enqueue() {
237
+ this.count++;
238
+ return this.count;
239
+ }
240
+ dequeue(error, output) {
241
+ if (this.onQueueEmpty && (--this.count <= 0 || error)) {
242
+ this.onQueueEmpty(error, output);
243
+ if (error) {
244
+ output.controller.abort();
245
+ this.onQueueEmpty = void 0;
246
+ }
247
+ }
248
+ }
249
+ };
250
+ var Counter = class {
251
+ _files = 0;
252
+ _directories = 0;
253
+ set files(num) {
254
+ this._files = num;
255
+ }
256
+ get files() {
257
+ return this._files;
258
+ }
259
+ set directories(num) {
260
+ this._directories = num;
261
+ }
262
+ get directories() {
263
+ return this._directories;
264
+ }
265
+ /**
266
+ * @deprecated use `directories` instead
267
+ */
268
+ /* c8 ignore next 3 */
269
+ get dirs() {
270
+ return this._directories;
271
+ }
272
+ };
273
+ /**
274
+ * AbortController is not supported on Node 14 so we use this until we can drop
275
+ * support for Node 14.
276
+ */
277
+ var Aborter = class {
278
+ aborted = false;
279
+ abort() {
280
+ this.aborted = true;
281
+ }
282
+ };
283
+ var Walker = class {
284
+ root;
285
+ isSynchronous;
286
+ state;
287
+ joinPath;
288
+ pushDirectory;
289
+ pushFile;
290
+ getArray;
291
+ groupFiles;
292
+ resolveSymlink;
293
+ walkDirectory;
294
+ callbackInvoker;
295
+ constructor(root, options, callback$1) {
296
+ this.isSynchronous = !callback$1;
297
+ this.callbackInvoker = build$1(options, this.isSynchronous);
298
+ this.root = normalizePath(root, options);
299
+ this.state = {
300
+ root: isRootDirectory(this.root) ? this.root : this.root.slice(0, -1),
301
+ paths: [""].slice(0, 0),
302
+ groups: [],
303
+ counts: new Counter(),
304
+ options,
305
+ queue: new Queue((error, state) => this.callbackInvoker(state, error, callback$1)),
306
+ symlinks: /* @__PURE__ */ new Map(),
307
+ visited: [""].slice(0, 0),
308
+ controller: new Aborter(),
309
+ fs: options.fs || nativeFs
310
+ };
311
+ this.joinPath = build$7(this.root, options);
312
+ this.pushDirectory = build$6(this.root, options);
313
+ this.pushFile = build$5(options);
314
+ this.getArray = build$4(options);
315
+ this.groupFiles = build$3(options);
316
+ this.resolveSymlink = build$2(options, this.isSynchronous);
317
+ this.walkDirectory = build(this.isSynchronous);
318
+ }
319
+ start() {
320
+ this.pushDirectory(this.root, this.state.paths, this.state.options.filters);
321
+ this.walkDirectory(this.state, this.root, this.root, this.state.options.maxDepth, this.walk);
322
+ return this.isSynchronous ? this.callbackInvoker(this.state, null) : null;
323
+ }
324
+ walk = (entries, directoryPath, depth) => {
325
+ const { paths, options: { filters, resolveSymlinks: resolveSymlinks$1, excludeSymlinks, exclude, maxFiles, signal, useRealPaths, pathSeparator }, controller } = this.state;
326
+ if (controller.aborted || signal && signal.aborted || maxFiles && paths.length > maxFiles) return;
327
+ const files = this.getArray(this.state.paths);
328
+ for (let i = 0; i < entries.length; ++i) {
329
+ const entry = entries[i];
330
+ if (entry.isFile() || entry.isSymbolicLink() && !resolveSymlinks$1 && !excludeSymlinks) {
331
+ const filename = this.joinPath(entry.name, directoryPath);
332
+ this.pushFile(filename, files, this.state.counts, filters);
333
+ } else if (entry.isDirectory()) {
334
+ let path = joinDirectoryPath(entry.name, directoryPath, this.state.options.pathSeparator);
335
+ if (exclude && exclude(entry.name, path)) continue;
336
+ this.pushDirectory(path, paths, filters);
337
+ this.walkDirectory(this.state, path, path, depth - 1, this.walk);
338
+ } else if (this.resolveSymlink && entry.isSymbolicLink()) {
339
+ let path = joinPathWithBasePath(entry.name, directoryPath);
340
+ this.resolveSymlink(path, this.state, (stat, resolvedPath) => {
341
+ if (stat.isDirectory()) {
342
+ resolvedPath = normalizePath(resolvedPath, this.state.options);
343
+ if (exclude && exclude(entry.name, useRealPaths ? resolvedPath : path + pathSeparator)) return;
344
+ this.walkDirectory(this.state, resolvedPath, useRealPaths ? resolvedPath : path + pathSeparator, depth - 1, this.walk);
345
+ } else {
346
+ resolvedPath = useRealPaths ? resolvedPath : path;
347
+ const filename = basename(resolvedPath);
348
+ const directoryPath$1 = normalizePath(dirname(resolvedPath), this.state.options);
349
+ resolvedPath = this.joinPath(filename, directoryPath$1);
350
+ this.pushFile(resolvedPath, files, this.state.counts, filters);
351
+ }
352
+ });
353
+ }
354
+ }
355
+ this.groupFiles(this.state.groups, directoryPath, files);
356
+ };
357
+ };
358
+ function promise(root, options) {
359
+ return new Promise((resolve$1, reject) => {
360
+ callback(root, options, (err, output) => {
361
+ if (err) return reject(err);
362
+ resolve$1(output);
363
+ });
364
+ });
365
+ }
366
+ function callback(root, options, callback$1) {
367
+ new Walker(root, options, callback$1).start();
368
+ }
369
+ function sync(root, options) {
370
+ return new Walker(root, options).start();
371
+ }
372
+ var APIBuilder = class {
373
+ constructor(root, options) {
374
+ this.root = root;
375
+ this.options = options;
376
+ }
377
+ withPromise() {
378
+ return promise(this.root, this.options);
379
+ }
380
+ withCallback(cb) {
381
+ callback(this.root, this.options, cb);
382
+ }
383
+ sync() {
384
+ return sync(this.root, this.options);
385
+ }
386
+ };
387
+ let pm = null;
388
+ /* c8 ignore next 6 */
389
+ try {
390
+ __require.resolve("picomatch");
391
+ pm = __require("picomatch");
392
+ } catch {}
393
+ var Builder = class {
394
+ globCache = {};
395
+ options = {
396
+ maxDepth: Infinity,
397
+ suppressErrors: true,
398
+ pathSeparator: sep,
399
+ filters: []
400
+ };
401
+ globFunction;
402
+ constructor(options) {
403
+ this.options = {
404
+ ...this.options,
405
+ ...options
406
+ };
407
+ this.globFunction = this.options.globFunction;
408
+ }
409
+ group() {
410
+ this.options.group = true;
411
+ return this;
412
+ }
413
+ withPathSeparator(separator) {
414
+ this.options.pathSeparator = separator;
415
+ return this;
416
+ }
417
+ withBasePath() {
418
+ this.options.includeBasePath = true;
419
+ return this;
420
+ }
421
+ withRelativePaths() {
422
+ this.options.relativePaths = true;
423
+ return this;
424
+ }
425
+ withDirs() {
426
+ this.options.includeDirs = true;
427
+ return this;
428
+ }
429
+ withMaxDepth(depth) {
430
+ this.options.maxDepth = depth;
431
+ return this;
432
+ }
433
+ withMaxFiles(limit) {
434
+ this.options.maxFiles = limit;
435
+ return this;
436
+ }
437
+ withFullPaths() {
438
+ this.options.resolvePaths = true;
439
+ this.options.includeBasePath = true;
440
+ return this;
441
+ }
442
+ withErrors() {
443
+ this.options.suppressErrors = false;
444
+ return this;
445
+ }
446
+ withSymlinks({ resolvePaths = true } = {}) {
447
+ this.options.resolveSymlinks = true;
448
+ this.options.useRealPaths = resolvePaths;
449
+ return this.withFullPaths();
450
+ }
451
+ withAbortSignal(signal) {
452
+ this.options.signal = signal;
453
+ return this;
454
+ }
455
+ normalize() {
456
+ this.options.normalizePath = true;
457
+ return this;
458
+ }
459
+ filter(predicate) {
460
+ this.options.filters.push(predicate);
461
+ return this;
462
+ }
463
+ onlyDirs() {
464
+ this.options.excludeFiles = true;
465
+ this.options.includeDirs = true;
466
+ return this;
467
+ }
468
+ exclude(predicate) {
469
+ this.options.exclude = predicate;
470
+ return this;
471
+ }
472
+ onlyCounts() {
473
+ this.options.onlyCounts = true;
474
+ return this;
475
+ }
476
+ crawl(root) {
477
+ return new APIBuilder(root || ".", this.options);
478
+ }
479
+ withGlobFunction(fn) {
480
+ this.globFunction = fn;
481
+ return this;
482
+ }
483
+ /**
484
+ * @deprecated Pass options using the constructor instead:
485
+ * ```ts
486
+ * new fdir(options).crawl("/path/to/root");
487
+ * ```
488
+ * This method will be removed in v7.0
489
+ */
490
+ /* c8 ignore next 4 */
491
+ crawlWithOptions(root, options) {
492
+ this.options = {
493
+ ...this.options,
494
+ ...options
495
+ };
496
+ return new APIBuilder(root || ".", this.options);
497
+ }
498
+ glob(...patterns) {
499
+ if (this.globFunction) return this.globWithOptions(patterns);
500
+ return this.globWithOptions(patterns, ...[{ dot: true }]);
501
+ }
502
+ globWithOptions(patterns, ...options) {
503
+ const globFn = this.globFunction || pm;
504
+ /* c8 ignore next 5 */
505
+ if (!globFn) throw new Error("Please specify a glob function to use glob matching.");
506
+ var isMatch = this.globCache[patterns.join("\0")];
507
+ if (!isMatch) {
508
+ isMatch = globFn(patterns, ...options);
509
+ this.globCache[patterns.join("\0")] = isMatch;
510
+ }
511
+ this.options.filters.push((path) => isMatch(path));
512
+ return this;
513
+ }
514
+ };
515
+ // ../../node_modules/.pnpm/picomatch@4.0.7/node_modules/picomatch/lib/constants.js
516
+ var require_constants = /* @__PURE__ */ __commonJSMin(((exports, module) => {
517
+ const WIN_SLASH = "\\\\/";
518
+ const WIN_NO_SLASH = `[^${WIN_SLASH}]`;
519
+ const DEFAULT_MAX_EXTGLOB_RECURSION = 0;
520
+ /**
521
+ * Posix glob regex
522
+ */
523
+ const DOT_LITERAL = "\\.";
524
+ const PLUS_LITERAL = "\\+";
525
+ const QMARK_LITERAL = "\\?";
526
+ const SLASH_LITERAL = "\\/";
527
+ const ONE_CHAR = "(?=.)";
528
+ const QMARK = "[^/]";
529
+ const END_ANCHOR = `(?:${SLASH_LITERAL}|$)`;
530
+ const START_ANCHOR = `(?:^|${SLASH_LITERAL})`;
531
+ const DOTS_SLASH = `${DOT_LITERAL}{1,2}${END_ANCHOR}`;
532
+ const POSIX_CHARS = {
533
+ DOT_LITERAL,
534
+ PLUS_LITERAL,
535
+ QMARK_LITERAL,
536
+ SLASH_LITERAL,
537
+ ONE_CHAR,
538
+ QMARK,
539
+ END_ANCHOR,
540
+ DOTS_SLASH,
541
+ NO_DOT: `(?!${DOT_LITERAL})`,
542
+ NO_DOTS: `(?!${START_ANCHOR}${DOTS_SLASH})`,
543
+ NO_DOT_SLASH: `(?!${DOT_LITERAL}{0,1}${END_ANCHOR})`,
544
+ NO_DOTS_SLASH: `(?!${DOTS_SLASH})`,
545
+ QMARK_NO_DOT: `[^.${SLASH_LITERAL}]`,
546
+ STAR: `${QMARK}*?`,
547
+ START_ANCHOR,
548
+ SEP: "/"
549
+ };
550
+ /**
551
+ * Windows glob regex
552
+ */
553
+ const WINDOWS_CHARS = {
554
+ ...POSIX_CHARS,
555
+ SLASH_LITERAL: `[${WIN_SLASH}]`,
556
+ QMARK: WIN_NO_SLASH,
557
+ STAR: `${WIN_NO_SLASH}*?`,
558
+ DOTS_SLASH: `${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$)`,
559
+ NO_DOT: `(?!${DOT_LITERAL})`,
560
+ NO_DOTS: `(?!(?:^|[${WIN_SLASH}])${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
561
+ NO_DOT_SLASH: `(?!${DOT_LITERAL}{0,1}(?:[${WIN_SLASH}]|$))`,
562
+ NO_DOTS_SLASH: `(?!${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
563
+ QMARK_NO_DOT: `[^.${WIN_SLASH}]`,
564
+ START_ANCHOR: `(?:^|[${WIN_SLASH}])`,
565
+ END_ANCHOR: `(?:[${WIN_SLASH}]|$)`,
566
+ SEP: "\\"
567
+ };
568
+ module.exports = {
569
+ DEFAULT_MAX_EXTGLOB_RECURSION,
570
+ MAX_LENGTH: 65536,
571
+ POSIX_REGEX_SOURCE: {
572
+ __proto__: null,
573
+ alnum: "a-zA-Z0-9",
574
+ alpha: "a-zA-Z",
575
+ ascii: "\\x00-\\x7F",
576
+ blank: " \\t",
577
+ cntrl: "\\x00-\\x1F\\x7F",
578
+ digit: "0-9",
579
+ graph: "\\x21-\\x7E",
580
+ lower: "a-z",
581
+ print: "\\x20-\\x7E ",
582
+ punct: "\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",
583
+ space: " \\t\\r\\n\\v\\f",
584
+ upper: "A-Z",
585
+ word: "A-Za-z0-9_",
586
+ xdigit: "A-Fa-f0-9"
587
+ },
588
+ REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g,
589
+ REGEX_NON_SPECIAL_CHARS: /^[^@![\].,$*+?^{}()|\\/]+/,
590
+ REGEX_SPECIAL_CHARS: /[-*+?.^${}(|)[\]]/,
591
+ REGEX_SPECIAL_CHARS_BACKREF: /(\\?)((\W)(\3*))/g,
592
+ REGEX_SPECIAL_CHARS_GLOBAL: /([-*+?.^${}(|)[\]])/g,
593
+ REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g,
594
+ REPLACEMENTS: {
595
+ __proto__: null,
596
+ "***": "*",
597
+ "**/**": "**",
598
+ "**/**/**": "**"
599
+ },
600
+ CHAR_0: 48,
601
+ CHAR_9: 57,
602
+ CHAR_UPPERCASE_A: 65,
603
+ CHAR_LOWERCASE_A: 97,
604
+ CHAR_UPPERCASE_Z: 90,
605
+ CHAR_LOWERCASE_Z: 122,
606
+ CHAR_LEFT_PARENTHESES: 40,
607
+ CHAR_RIGHT_PARENTHESES: 41,
608
+ CHAR_ASTERISK: 42,
609
+ CHAR_AMPERSAND: 38,
610
+ CHAR_AT: 64,
611
+ CHAR_BACKWARD_SLASH: 92,
612
+ CHAR_CARRIAGE_RETURN: 13,
613
+ CHAR_CIRCUMFLEX_ACCENT: 94,
614
+ CHAR_COLON: 58,
615
+ CHAR_COMMA: 44,
616
+ CHAR_DOT: 46,
617
+ CHAR_DOUBLE_QUOTE: 34,
618
+ CHAR_EQUAL: 61,
619
+ CHAR_EXCLAMATION_MARK: 33,
620
+ CHAR_FORM_FEED: 12,
621
+ CHAR_FORWARD_SLASH: 47,
622
+ CHAR_GRAVE_ACCENT: 96,
623
+ CHAR_HASH: 35,
624
+ CHAR_HYPHEN_MINUS: 45,
625
+ CHAR_LEFT_ANGLE_BRACKET: 60,
626
+ CHAR_LEFT_CURLY_BRACE: 123,
627
+ CHAR_LEFT_SQUARE_BRACKET: 91,
628
+ CHAR_LINE_FEED: 10,
629
+ CHAR_NO_BREAK_SPACE: 160,
630
+ CHAR_PERCENT: 37,
631
+ CHAR_PLUS: 43,
632
+ CHAR_QUESTION_MARK: 63,
633
+ CHAR_RIGHT_ANGLE_BRACKET: 62,
634
+ CHAR_RIGHT_CURLY_BRACE: 125,
635
+ CHAR_RIGHT_SQUARE_BRACKET: 93,
636
+ CHAR_SEMICOLON: 59,
637
+ CHAR_SINGLE_QUOTE: 39,
638
+ CHAR_SPACE: 32,
639
+ CHAR_TAB: 9,
640
+ CHAR_UNDERSCORE: 95,
641
+ CHAR_VERTICAL_LINE: 124,
642
+ CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279,
643
+ /**
644
+ * Create EXTGLOB_CHARS
645
+ */
646
+ extglobChars(chars) {
647
+ return {
648
+ "!": {
649
+ type: "negate",
650
+ open: "(?:(?!(?:",
651
+ close: `))${chars.STAR})`
652
+ },
653
+ "?": {
654
+ type: "qmark",
655
+ open: "(?:",
656
+ close: ")?"
657
+ },
658
+ "+": {
659
+ type: "plus",
660
+ open: "(?:",
661
+ close: ")+"
662
+ },
663
+ "*": {
664
+ type: "star",
665
+ open: "(?:",
666
+ close: ")*"
667
+ },
668
+ "@": {
669
+ type: "at",
670
+ open: "(?:",
671
+ close: ")"
672
+ }
673
+ };
674
+ },
675
+ /**
676
+ * Create GLOB_CHARS
677
+ */
678
+ globChars(win32) {
679
+ return win32 === true ? WINDOWS_CHARS : POSIX_CHARS;
680
+ }
681
+ };
682
+ }));
683
+ // ../../node_modules/.pnpm/picomatch@4.0.7/node_modules/picomatch/lib/utils.js
684
+ var require_utils = /* @__PURE__ */ __commonJSMin(((exports) => {
685
+ const { REGEX_BACKSLASH, REGEX_REMOVE_BACKSLASH, REGEX_SPECIAL_CHARS, REGEX_SPECIAL_CHARS_GLOBAL } = require_constants();
686
+ exports.isObject = (val) => val !== null && typeof val === "object" && !Array.isArray(val);
687
+ exports.hasRegexChars = (str) => REGEX_SPECIAL_CHARS.test(str);
688
+ exports.isRegexChar = (str) => str.length === 1 && exports.hasRegexChars(str);
689
+ exports.escapeRegex = (str) => str.replace(REGEX_SPECIAL_CHARS_GLOBAL, "\\$1");
690
+ exports.toPosixSlashes = (str) => str.replace(REGEX_BACKSLASH, "/");
691
+ exports.isWindows = () => {
692
+ if (typeof navigator !== "undefined" && navigator.platform) {
693
+ const platform = navigator.platform.toLowerCase();
694
+ return platform === "win32" || platform === "windows";
695
+ }
696
+ if (typeof process !== "undefined" && process.platform) return process.platform === "win32";
697
+ return false;
698
+ };
699
+ exports.removeBackslashes = (str) => {
700
+ return str.replace(REGEX_REMOVE_BACKSLASH, (match) => {
701
+ return match === "\\" ? "" : match;
702
+ });
703
+ };
704
+ exports.escapeLast = (input, char, lastIdx) => {
705
+ const idx = input.lastIndexOf(char, lastIdx);
706
+ if (idx === -1) return input;
707
+ if (input[idx - 1] === "\\") return exports.escapeLast(input, char, idx - 1);
708
+ return `${input.slice(0, idx)}\\${input.slice(idx)}`;
709
+ };
710
+ exports.removePrefix = (input, state = {}) => {
711
+ let output = input;
712
+ if (output.startsWith("./")) {
713
+ output = output.slice(2);
714
+ state.prefix = "./";
715
+ }
716
+ return output;
717
+ };
718
+ exports.wrapOutput = (input, state = {}, options = {}) => {
719
+ let output = `${options.contains ? "" : "^"}(?:${input})${options.contains ? "" : "$"}`;
720
+ if (state.negated === true) output = `(?:^(?!${output}).*$)`;
721
+ return output;
722
+ };
723
+ exports.basename = (path, { windows } = {}) => {
724
+ const segs = path.split(windows ? /[\\/]/ : "/");
725
+ const last = segs[segs.length - 1];
726
+ if (last === "") return segs[segs.length - 2];
727
+ return last;
728
+ };
729
+ }));
730
+ // ../../node_modules/.pnpm/picomatch@4.0.7/node_modules/picomatch/lib/scan.js
731
+ var require_scan = /* @__PURE__ */ __commonJSMin(((exports, module) => {
732
+ const utils = require_utils();
733
+ const { CHAR_ASTERISK, CHAR_AT, CHAR_BACKWARD_SLASH, CHAR_COMMA, CHAR_DOT, CHAR_EXCLAMATION_MARK, CHAR_FORWARD_SLASH, CHAR_LEFT_CURLY_BRACE, CHAR_LEFT_PARENTHESES, CHAR_LEFT_SQUARE_BRACKET, CHAR_PLUS, CHAR_QUESTION_MARK, CHAR_RIGHT_CURLY_BRACE, CHAR_RIGHT_PARENTHESES, CHAR_RIGHT_SQUARE_BRACKET } = require_constants();
734
+ const isPathSeparator = (code) => {
735
+ return code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH;
736
+ };
737
+ const depth = (token) => {
738
+ if (token.isPrefix !== true) token.depth = token.isGlobstar ? Infinity : 1;
739
+ };
740
+ /**
741
+ * Quickly scans a glob pattern and returns an object with a handful of
742
+ * useful properties, like `isGlob`, `path` (the leading non-glob, if it exists),
743
+ * `glob` (the actual pattern), `negated` (true if the path starts with `!` but not
744
+ * with `!(`) and `negatedExtglob` (true if the path starts with `!(`).
745
+ *
746
+ * ```js
747
+ * const pm = require('picomatch');
748
+ * console.log(pm.scan('foo/bar/*.js'));
749
+ * { isGlob: true, input: 'foo/bar/*.js', base: 'foo/bar', glob: '*.js' }
750
+ * ```
751
+ * @param {String} `str`
752
+ * @param {Object} `options`
753
+ * @return {Object} Returns an object with tokens and regex source string.
754
+ * @api public
755
+ */
756
+ const scan = (input, options) => {
757
+ const opts = options || {};
758
+ const length = input.length - 1;
759
+ const scanToEnd = opts.parts === true || opts.tokens === true || opts.scanToEnd === true;
760
+ const slashes = [];
761
+ const tokens = [];
762
+ const parts = [];
763
+ let str = input;
764
+ let index = -1;
765
+ let start = 0;
766
+ let lastIndex = 0;
767
+ let isBrace = false;
768
+ let isBracket = false;
769
+ let isGlob = false;
770
+ let isExtglob = false;
771
+ let isGlobstar = false;
772
+ let braceEscaped = false;
773
+ let backslashes = false;
774
+ let negated = false;
775
+ let negatedExtglob = false;
776
+ let finished = false;
777
+ let braces = 0;
778
+ let prev;
779
+ let code;
780
+ let token = {
781
+ value: "",
782
+ depth: 0,
783
+ isGlob: false
784
+ };
785
+ const eos = () => index >= length;
786
+ const peek = () => str.charCodeAt(index + 1);
787
+ const advance = () => {
788
+ prev = code;
789
+ return str.charCodeAt(++index);
790
+ };
791
+ while (index < length) {
792
+ code = advance();
793
+ let next;
794
+ if (code === CHAR_BACKWARD_SLASH) {
795
+ backslashes = token.backslashes = true;
796
+ code = advance();
797
+ if (code === CHAR_LEFT_CURLY_BRACE) braceEscaped = true;
798
+ continue;
799
+ }
800
+ if (braceEscaped === true || code === CHAR_LEFT_CURLY_BRACE) {
801
+ braces++;
802
+ while (eos() !== true && (code = advance())) {
803
+ if (code === CHAR_BACKWARD_SLASH) {
804
+ backslashes = token.backslashes = true;
805
+ advance();
806
+ continue;
807
+ }
808
+ if (code === CHAR_LEFT_CURLY_BRACE) {
809
+ braces++;
810
+ continue;
811
+ }
812
+ if (braceEscaped !== true && code === CHAR_DOT && (code = advance()) === CHAR_DOT) {
813
+ isBrace = token.isBrace = true;
814
+ isGlob = token.isGlob = true;
815
+ finished = true;
816
+ if (scanToEnd === true) continue;
817
+ break;
818
+ }
819
+ if (braceEscaped !== true && code === CHAR_COMMA) {
820
+ isBrace = token.isBrace = true;
821
+ isGlob = token.isGlob = true;
822
+ finished = true;
823
+ if (scanToEnd === true) continue;
824
+ break;
825
+ }
826
+ if (code === CHAR_RIGHT_CURLY_BRACE) {
827
+ braces--;
828
+ if (braces === 0) {
829
+ braceEscaped = false;
830
+ isBrace = token.isBrace = true;
831
+ finished = true;
832
+ break;
833
+ }
834
+ }
835
+ }
836
+ if (scanToEnd === true) continue;
837
+ break;
838
+ }
839
+ if (code === CHAR_FORWARD_SLASH) {
840
+ slashes.push(index);
841
+ tokens.push(token);
842
+ token = {
843
+ value: "",
844
+ depth: 0,
845
+ isGlob: false
846
+ };
847
+ if (finished === true) continue;
848
+ if (prev === CHAR_DOT && index === start + 1) {
849
+ start += 2;
850
+ continue;
851
+ }
852
+ lastIndex = index + 1;
853
+ continue;
854
+ }
855
+ if (opts.noext !== true) {
856
+ if ((code === CHAR_PLUS || code === CHAR_AT || code === CHAR_ASTERISK || code === CHAR_QUESTION_MARK || code === CHAR_EXCLAMATION_MARK) === true && peek() === CHAR_LEFT_PARENTHESES) {
857
+ isGlob = token.isGlob = true;
858
+ isExtglob = token.isExtglob = true;
859
+ finished = true;
860
+ if (code === CHAR_EXCLAMATION_MARK && index === start) negatedExtglob = true;
861
+ if (scanToEnd === true) {
862
+ let parens = 0;
863
+ while (eos() !== true && (code = advance())) {
864
+ if (code === CHAR_BACKWARD_SLASH) {
865
+ backslashes = token.backslashes = true;
866
+ advance();
867
+ continue;
868
+ }
869
+ if (code === CHAR_LEFT_PARENTHESES) {
870
+ parens++;
871
+ continue;
872
+ }
873
+ if (code === CHAR_RIGHT_PARENTHESES && --parens === 0) {
874
+ finished = true;
875
+ break;
876
+ }
877
+ }
878
+ continue;
879
+ }
880
+ break;
881
+ }
882
+ }
883
+ if (code === CHAR_ASTERISK) {
884
+ if (prev === CHAR_ASTERISK) isGlobstar = token.isGlobstar = true;
885
+ isGlob = token.isGlob = true;
886
+ finished = true;
887
+ if (scanToEnd === true) continue;
888
+ break;
889
+ }
890
+ if (code === CHAR_QUESTION_MARK) {
891
+ isGlob = token.isGlob = true;
892
+ finished = true;
893
+ if (scanToEnd === true) continue;
894
+ break;
895
+ }
896
+ if (code === CHAR_LEFT_SQUARE_BRACKET) {
897
+ while (eos() !== true && (next = advance())) {
898
+ if (next === CHAR_BACKWARD_SLASH) {
899
+ backslashes = token.backslashes = true;
900
+ advance();
901
+ continue;
902
+ }
903
+ if (next === CHAR_RIGHT_SQUARE_BRACKET) {
904
+ isBracket = token.isBracket = true;
905
+ isGlob = token.isGlob = true;
906
+ finished = true;
907
+ break;
908
+ }
909
+ }
910
+ if (scanToEnd === true) continue;
911
+ break;
912
+ }
913
+ if (opts.nonegate !== true && code === CHAR_EXCLAMATION_MARK && index === start) {
914
+ negated = token.negated = true;
915
+ start++;
916
+ continue;
917
+ }
918
+ if (opts.noparen !== true && code === CHAR_LEFT_PARENTHESES) {
919
+ isGlob = token.isGlob = true;
920
+ if (scanToEnd === true) {
921
+ let parens = 1;
922
+ while (eos() !== true && (code = advance())) {
923
+ if (code === CHAR_BACKWARD_SLASH) {
924
+ backslashes = token.backslashes = true;
925
+ advance();
926
+ continue;
927
+ }
928
+ if (code === CHAR_LEFT_PARENTHESES) {
929
+ parens++;
930
+ continue;
931
+ }
932
+ if (code === CHAR_RIGHT_PARENTHESES && --parens === 0) {
933
+ finished = true;
934
+ break;
935
+ }
936
+ }
937
+ continue;
938
+ }
939
+ break;
940
+ }
941
+ if (isGlob === true) {
942
+ finished = true;
943
+ if (scanToEnd === true) continue;
944
+ break;
945
+ }
946
+ }
947
+ if (opts.noext === true) {
948
+ isExtglob = false;
949
+ isGlob = false;
950
+ }
951
+ let base = str;
952
+ let prefix = "";
953
+ let glob = "";
954
+ if (start > 0) {
955
+ prefix = str.slice(0, start);
956
+ str = str.slice(start);
957
+ lastIndex -= start;
958
+ }
959
+ if (base && isGlob === true && lastIndex > 0) {
960
+ base = str.slice(0, lastIndex);
961
+ glob = str.slice(lastIndex);
962
+ } else if (isGlob === true) {
963
+ base = "";
964
+ glob = str;
965
+ } else base = str;
966
+ if (base && base !== "" && base !== "/" && base !== str) {
967
+ if (isPathSeparator(base.charCodeAt(base.length - 1))) base = base.slice(0, -1);
968
+ }
969
+ if (opts.unescape === true) {
970
+ if (glob) glob = utils.removeBackslashes(glob);
971
+ if (base && backslashes === true) base = utils.removeBackslashes(base);
972
+ }
973
+ const state = {
974
+ prefix,
975
+ input,
976
+ start,
977
+ base,
978
+ glob,
979
+ isBrace,
980
+ isBracket,
981
+ isGlob,
982
+ isExtglob,
983
+ isGlobstar,
984
+ negated,
985
+ negatedExtglob
986
+ };
987
+ if (opts.tokens === true) {
988
+ state.maxDepth = 0;
989
+ if (!isPathSeparator(code)) tokens.push(token);
990
+ state.tokens = tokens;
991
+ }
992
+ if (opts.parts === true || opts.tokens === true) {
993
+ let prevIndex;
994
+ for (let idx = 0; idx < slashes.length; idx++) {
995
+ const n = prevIndex !== void 0 ? prevIndex + 1 : start;
996
+ const i = slashes[idx];
997
+ const value = input.slice(n, i);
998
+ if (opts.tokens) {
999
+ if (idx === 0 && start !== 0) {
1000
+ tokens[idx].isPrefix = true;
1001
+ tokens[idx].value = prefix;
1002
+ } else tokens[idx].value = value;
1003
+ depth(tokens[idx]);
1004
+ state.maxDepth += tokens[idx].depth;
1005
+ }
1006
+ if (i >= start) {
1007
+ parts.push(value);
1008
+ prevIndex = i;
1009
+ }
1010
+ }
1011
+ const n = prevIndex !== void 0 ? prevIndex + 1 : start;
1012
+ const value = input.slice(n);
1013
+ parts.push(value);
1014
+ if (opts.tokens && prevIndex && prevIndex + 1 < input.length) {
1015
+ tokens[tokens.length - 1].value = value;
1016
+ depth(tokens[tokens.length - 1]);
1017
+ state.maxDepth += tokens[tokens.length - 1].depth;
1018
+ }
1019
+ state.slashes = slashes;
1020
+ state.parts = parts;
1021
+ }
1022
+ return state;
1023
+ };
1024
+ module.exports = scan;
1025
+ }));
1026
+ // ../../node_modules/.pnpm/picomatch@4.0.7/node_modules/picomatch/lib/parse.js
1027
+ var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1028
+ const constants = require_constants();
1029
+ const utils = require_utils();
1030
+ /**
1031
+ * Constants
1032
+ */
1033
+ const { MAX_LENGTH, POSIX_REGEX_SOURCE, REGEX_NON_SPECIAL_CHARS, REGEX_SPECIAL_CHARS_BACKREF, REPLACEMENTS } = constants;
1034
+ /**
1035
+ * Helpers
1036
+ */
1037
+ const expandRange = (args, options) => {
1038
+ if (typeof options.expandRange === "function") return options.expandRange(...args, options);
1039
+ args.sort();
1040
+ const value = `[${args.join("-")}]`;
1041
+ try {
1042
+ new RegExp(value);
1043
+ } catch (ex) {
1044
+ return args.map((v) => utils.escapeRegex(v)).join("..");
1045
+ }
1046
+ return value;
1047
+ };
1048
+ /**
1049
+ * Create the message for a syntax error
1050
+ */
1051
+ const syntaxError = (type, char) => {
1052
+ return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`;
1053
+ };
1054
+ const splitTopLevel = (input) => {
1055
+ const parts = [];
1056
+ let bracket = 0;
1057
+ let paren = 0;
1058
+ let quote = 0;
1059
+ let value = "";
1060
+ let escaped = false;
1061
+ for (const ch of input) {
1062
+ if (escaped === true) {
1063
+ value += ch;
1064
+ escaped = false;
1065
+ continue;
1066
+ }
1067
+ if (ch === "\\") {
1068
+ value += ch;
1069
+ escaped = true;
1070
+ continue;
1071
+ }
1072
+ if (ch === "\"") {
1073
+ quote = quote === 1 ? 0 : 1;
1074
+ value += ch;
1075
+ continue;
1076
+ }
1077
+ if (quote === 0) {
1078
+ if (ch === "[") bracket++;
1079
+ else if (ch === "]" && bracket > 0) bracket--;
1080
+ else if (bracket === 0) {
1081
+ if (ch === "(") paren++;
1082
+ else if (ch === ")" && paren > 0) paren--;
1083
+ else if (ch === "|" && paren === 0) {
1084
+ parts.push(value);
1085
+ value = "";
1086
+ continue;
1087
+ }
1088
+ }
1089
+ }
1090
+ value += ch;
1091
+ }
1092
+ parts.push(value);
1093
+ return parts;
1094
+ };
1095
+ const isPlainBranch = (branch) => {
1096
+ let escaped = false;
1097
+ for (const ch of branch) {
1098
+ if (escaped === true) {
1099
+ escaped = false;
1100
+ continue;
1101
+ }
1102
+ if (ch === "\\") {
1103
+ escaped = true;
1104
+ continue;
1105
+ }
1106
+ if (/[?*+@!()[\]{}]/.test(ch)) return false;
1107
+ }
1108
+ return true;
1109
+ };
1110
+ const normalizeSimpleBranch = (branch) => {
1111
+ let value = branch.trim();
1112
+ let changed = true;
1113
+ while (changed === true) {
1114
+ changed = false;
1115
+ if (/^@\([^\\()[\]{}|]+\)$/.test(value)) {
1116
+ value = value.slice(2, -1);
1117
+ changed = true;
1118
+ }
1119
+ }
1120
+ if (!isPlainBranch(value)) return;
1121
+ return value.replace(/\\(.)/g, "$1");
1122
+ };
1123
+ const hasRepeatedCharPrefixOverlap = (branches) => {
1124
+ const values = branches.map(normalizeSimpleBranch).filter(Boolean);
1125
+ for (let i = 0; i < values.length; i++) for (let j = i + 1; j < values.length; j++) {
1126
+ const a = values[i];
1127
+ const b = values[j];
1128
+ const char = a[0];
1129
+ if (!char || a !== char.repeat(a.length) || b !== char.repeat(b.length)) continue;
1130
+ if (a === b || a.startsWith(b) || b.startsWith(a)) return true;
1131
+ }
1132
+ return false;
1133
+ };
1134
+ const parseRepeatedExtglob = (pattern, requireEnd = true) => {
1135
+ if (pattern[0] !== "+" && pattern[0] !== "*" || pattern[1] !== "(") return;
1136
+ let bracket = 0;
1137
+ let paren = 0;
1138
+ let quote = 0;
1139
+ let escaped = false;
1140
+ for (let i = 1; i < pattern.length; i++) {
1141
+ const ch = pattern[i];
1142
+ if (escaped === true) {
1143
+ escaped = false;
1144
+ continue;
1145
+ }
1146
+ if (ch === "\\") {
1147
+ escaped = true;
1148
+ continue;
1149
+ }
1150
+ if (ch === "\"") {
1151
+ quote = quote === 1 ? 0 : 1;
1152
+ continue;
1153
+ }
1154
+ if (quote === 1) continue;
1155
+ if (ch === "[") {
1156
+ bracket++;
1157
+ continue;
1158
+ }
1159
+ if (ch === "]" && bracket > 0) {
1160
+ bracket--;
1161
+ continue;
1162
+ }
1163
+ if (bracket > 0) continue;
1164
+ if (ch === "(") {
1165
+ paren++;
1166
+ continue;
1167
+ }
1168
+ if (ch === ")") {
1169
+ paren--;
1170
+ if (paren === 0) {
1171
+ if (requireEnd === true && i !== pattern.length - 1) return;
1172
+ return {
1173
+ type: pattern[0],
1174
+ body: pattern.slice(2, i),
1175
+ end: i
1176
+ };
1177
+ }
1178
+ }
1179
+ }
1180
+ };
1181
+ const buildCharClassStar = (chars) => {
1182
+ return `${chars.length === 1 ? utils.escapeRegex(chars[0]) : `[${chars.map((ch) => utils.escapeRegex(ch)).join("")}]`}*`;
1183
+ };
1184
+ const getStarExtglobSequenceChars = (pattern) => {
1185
+ let index = 0;
1186
+ const chars = [];
1187
+ while (index < pattern.length) {
1188
+ const match = parseRepeatedExtglob(pattern.slice(index), false);
1189
+ if (!match || match.type !== "*") return;
1190
+ const branches = splitTopLevel(match.body).map((branch) => branch.trim());
1191
+ if (branches.length !== 1) return;
1192
+ const branch = normalizeSimpleBranch(branches[0]);
1193
+ if (!branch || branch.length !== 1) return;
1194
+ chars.push(branch);
1195
+ index += match.end + 1;
1196
+ }
1197
+ if (chars.length < 1) return;
1198
+ return chars;
1199
+ };
1200
+ const repeatedExtglobRecursion = (pattern) => {
1201
+ let depth = 0;
1202
+ let value = pattern.trim();
1203
+ let match = parseRepeatedExtglob(value);
1204
+ while (match) {
1205
+ depth++;
1206
+ value = match.body.trim();
1207
+ match = parseRepeatedExtglob(value);
1208
+ }
1209
+ return depth;
1210
+ };
1211
+ const analyzeRepeatedExtglob = (body, options) => {
1212
+ if (options.maxExtglobRecursion === false) return { risky: false };
1213
+ const max = typeof options.maxExtglobRecursion === "number" ? options.maxExtglobRecursion : constants.DEFAULT_MAX_EXTGLOB_RECURSION;
1214
+ const branches = splitTopLevel(body).map((branch) => branch.trim());
1215
+ if (branches.length > 1) {
1216
+ if (branches.some((branch) => branch === "") || branches.some((branch) => /^[*?]+$/.test(branch)) || hasRepeatedCharPrefixOverlap(branches)) return { risky: true };
1217
+ }
1218
+ const safeChars = [];
1219
+ let sawStarSequence = false;
1220
+ let combinable = true;
1221
+ for (const branch of branches) {
1222
+ const chars = getStarExtglobSequenceChars(branch);
1223
+ if (chars) {
1224
+ sawStarSequence = true;
1225
+ safeChars.push(...chars);
1226
+ continue;
1227
+ }
1228
+ const literal = normalizeSimpleBranch(branch);
1229
+ if (literal && literal.length === 1) {
1230
+ safeChars.push(literal);
1231
+ continue;
1232
+ }
1233
+ combinable = false;
1234
+ if (repeatedExtglobRecursion(branch) > max) return { risky: true };
1235
+ }
1236
+ if (sawStarSequence) return combinable ? {
1237
+ risky: true,
1238
+ safeOutput: buildCharClassStar([...new Set(safeChars)])
1239
+ } : { risky: true };
1240
+ return { risky: false };
1241
+ };
1242
+ /**
1243
+ * Parse the given input string.
1244
+ * @param {String} input
1245
+ * @param {Object} options
1246
+ * @return {Object}
1247
+ */
1248
+ const parse = (input, options) => {
1249
+ if (typeof input !== "string") throw new TypeError("Expected a string");
1250
+ input = REPLACEMENTS[input] || input;
1251
+ const opts = { ...options };
1252
+ const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
1253
+ let len = input.length;
1254
+ if (len > max) throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
1255
+ const bos = {
1256
+ type: "bos",
1257
+ value: "",
1258
+ output: opts.prepend || ""
1259
+ };
1260
+ const tokens = [bos];
1261
+ const capture = opts.capture ? "" : "?:";
1262
+ const PLATFORM_CHARS = constants.globChars(opts.windows);
1263
+ const EXTGLOB_CHARS = constants.extglobChars(PLATFORM_CHARS);
1264
+ const { DOT_LITERAL, PLUS_LITERAL, SLASH_LITERAL, ONE_CHAR, DOTS_SLASH, NO_DOT, NO_DOT_SLASH, NO_DOTS_SLASH, QMARK, QMARK_NO_DOT, STAR, START_ANCHOR } = PLATFORM_CHARS;
1265
+ const globstar = (opts) => {
1266
+ return `(${capture}(?:(?!${START_ANCHOR}${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
1267
+ };
1268
+ const nodot = opts.dot ? "" : NO_DOT;
1269
+ const qmarkNoDot = opts.dot ? QMARK : QMARK_NO_DOT;
1270
+ let star = opts.bash === true ? globstar(opts) : STAR;
1271
+ if (opts.capture) star = `(${star})`;
1272
+ if (typeof opts.noext === "boolean") opts.noextglob = opts.noext;
1273
+ const state = {
1274
+ input,
1275
+ index: -1,
1276
+ start: 0,
1277
+ dot: opts.dot === true,
1278
+ consumed: "",
1279
+ output: "",
1280
+ prefix: "",
1281
+ backtrack: false,
1282
+ negated: false,
1283
+ brackets: 0,
1284
+ braces: 0,
1285
+ parens: 0,
1286
+ quotes: 0,
1287
+ globstar: false,
1288
+ tokens
1289
+ };
1290
+ input = utils.removePrefix(input, state);
1291
+ len = input.length;
1292
+ const extglobs = [];
1293
+ const braces = [];
1294
+ const stack = [];
1295
+ let prev = bos;
1296
+ let value;
1297
+ /**
1298
+ * Tokenizing helpers
1299
+ */
1300
+ const eos = () => state.index === len - 1;
1301
+ const peek = state.peek = (n = 1) => input[state.index + n];
1302
+ const advance = state.advance = () => input[++state.index] || "";
1303
+ const remaining = () => input.slice(state.index + 1);
1304
+ const consume = (value = "", num = 0) => {
1305
+ state.consumed += value;
1306
+ state.index += num;
1307
+ };
1308
+ const append = (token) => {
1309
+ state.output += token.output != null ? token.output : token.value;
1310
+ consume(token.value);
1311
+ };
1312
+ const negate = () => {
1313
+ let count = 1;
1314
+ while (peek() === "!" && (peek(2) !== "(" || peek(3) === "?")) {
1315
+ advance();
1316
+ state.start++;
1317
+ count++;
1318
+ }
1319
+ if (count % 2 === 0) return false;
1320
+ state.negated = true;
1321
+ state.start++;
1322
+ return true;
1323
+ };
1324
+ const increment = (type) => {
1325
+ state[type]++;
1326
+ stack.push(type);
1327
+ };
1328
+ const decrement = (type) => {
1329
+ state[type]--;
1330
+ stack.pop();
1331
+ };
1332
+ /**
1333
+ * Push tokens onto the tokens array. This helper speeds up
1334
+ * tokenizing by 1) helping us avoid backtracking as much as possible,
1335
+ * and 2) helping us avoid creating extra tokens when consecutive
1336
+ * characters are plain text. This improves performance and simplifies
1337
+ * lookbehinds.
1338
+ */
1339
+ const push = (tok) => {
1340
+ if (prev.type === "globstar") {
1341
+ const isBrace = state.braces > 0 && (tok.type === "comma" || tok.type === "brace");
1342
+ const isExtglob = tok.extglob === true || extglobs.length && (tok.type === "pipe" || tok.type === "paren");
1343
+ if (tok.type !== "slash" && tok.type !== "paren" && !isBrace && !isExtglob) {
1344
+ state.output = state.output.slice(0, -prev.output.length);
1345
+ prev.type = "star";
1346
+ prev.value = "*";
1347
+ prev.output = star;
1348
+ state.output += prev.output;
1349
+ }
1350
+ }
1351
+ if (extglobs.length && tok.type !== "paren") extglobs[extglobs.length - 1].inner += tok.value;
1352
+ if (tok.value || tok.output) append(tok);
1353
+ if (prev && prev.type === "text" && tok.type === "text") {
1354
+ prev.output = (prev.output || prev.value) + tok.value;
1355
+ prev.value += tok.value;
1356
+ return;
1357
+ }
1358
+ tok.prev = prev;
1359
+ tokens.push(tok);
1360
+ prev = tok;
1361
+ };
1362
+ const extglobOpen = (type, value) => {
1363
+ const token = {
1364
+ ...EXTGLOB_CHARS[value],
1365
+ conditions: 1,
1366
+ inner: ""
1367
+ };
1368
+ token.prev = prev;
1369
+ token.parens = state.parens;
1370
+ token.output = state.output;
1371
+ token.startIndex = state.index;
1372
+ token.tokensIndex = tokens.length;
1373
+ const output = (opts.capture ? "(" : "") + token.open;
1374
+ increment("parens");
1375
+ push({
1376
+ type,
1377
+ value,
1378
+ output: state.output ? "" : ONE_CHAR
1379
+ });
1380
+ push({
1381
+ type: "paren",
1382
+ extglob: true,
1383
+ value: advance(),
1384
+ output
1385
+ });
1386
+ extglobs.push(token);
1387
+ };
1388
+ const extglobClose = (token) => {
1389
+ const literal = input.slice(token.startIndex, state.index + 1);
1390
+ const body = input.slice(token.startIndex + 2, state.index);
1391
+ const analysis = analyzeRepeatedExtglob(body, opts);
1392
+ if ((token.type === "plus" || token.type === "star") && analysis.risky) {
1393
+ const safeOutput = analysis.safeOutput ? (token.output ? "" : ONE_CHAR) + (opts.capture ? `(${analysis.safeOutput})` : analysis.safeOutput) : void 0;
1394
+ const open = tokens[token.tokensIndex];
1395
+ open.type = "text";
1396
+ open.value = literal;
1397
+ open.output = safeOutput || utils.escapeRegex(literal);
1398
+ for (let i = token.tokensIndex + 1; i < tokens.length; i++) {
1399
+ tokens[i].value = "";
1400
+ tokens[i].output = "";
1401
+ delete tokens[i].suffix;
1402
+ }
1403
+ state.output = token.output + open.output;
1404
+ state.backtrack = true;
1405
+ push({
1406
+ type: "paren",
1407
+ extglob: true,
1408
+ value,
1409
+ output: ""
1410
+ });
1411
+ decrement("parens");
1412
+ return;
1413
+ }
1414
+ let output = token.close + (opts.capture ? ")" : "");
1415
+ let rest;
1416
+ if (token.type === "negate") {
1417
+ let extglobStar = star;
1418
+ if (token.inner && token.inner.length > 1 && token.inner.includes("/")) extglobStar = globstar(opts);
1419
+ if (extglobStar !== star || eos() || /^\)+$/.test(remaining())) output = token.close = `)$))${extglobStar}`;
1420
+ if (token.inner.includes("*") && (rest = remaining()) && /^\.[^\\/.]+$/.test(rest)) output = token.close = `)${parse(rest, {
1421
+ ...options,
1422
+ fastpaths: false
1423
+ }).output})${extglobStar})`;
1424
+ if (token.prev.type === "bos") state.negatedExtglob = true;
1425
+ }
1426
+ push({
1427
+ type: "paren",
1428
+ extglob: true,
1429
+ value,
1430
+ output
1431
+ });
1432
+ decrement("parens");
1433
+ };
1434
+ /**
1435
+ * Fast paths
1436
+ */
1437
+ if (opts.fastpaths !== false && !/(^[*!]|[/()[\]{}"])/.test(input)) {
1438
+ let backslashes = false;
1439
+ let output = input.replace(REGEX_SPECIAL_CHARS_BACKREF, (m, esc, chars, first, rest, index) => {
1440
+ if (first === "\\") {
1441
+ backslashes = true;
1442
+ return m;
1443
+ }
1444
+ if (first === "?") {
1445
+ if (esc) return esc + first + (rest ? QMARK.repeat(rest.length) : "");
1446
+ if (index === 0) return qmarkNoDot + (rest ? QMARK.repeat(rest.length) : "");
1447
+ return QMARK.repeat(chars.length);
1448
+ }
1449
+ if (first === ".") return DOT_LITERAL.repeat(chars.length);
1450
+ if (first === "*") {
1451
+ if (esc) return esc + first + (rest ? star : "");
1452
+ return star;
1453
+ }
1454
+ return esc ? m : `\\${m}`;
1455
+ });
1456
+ if (backslashes === true) {
1457
+ if (opts.unescape === true) output = output.replace(/\\/g, "");
1458
+ else output = output.replace(/\\+/g, (m) => {
1459
+ return m.length % 2 === 0 ? "\\\\" : m ? "\\" : "";
1460
+ });
1461
+ }
1462
+ if (output === input && opts.contains === true) {
1463
+ state.output = input;
1464
+ return state;
1465
+ }
1466
+ state.output = utils.wrapOutput(output, state, options);
1467
+ return state;
1468
+ }
1469
+ /**
1470
+ * Tokenize input until we reach end-of-string
1471
+ */
1472
+ while (!eos()) {
1473
+ value = advance();
1474
+ if (value === "\0") continue;
1475
+ /**
1476
+ * Escaped characters
1477
+ */
1478
+ if (value === "\\") {
1479
+ const next = peek();
1480
+ if (next === "/" && opts.bash !== true) continue;
1481
+ if (next === "." || next === ";") continue;
1482
+ if (!next) {
1483
+ value += "\\";
1484
+ push({
1485
+ type: "text",
1486
+ value
1487
+ });
1488
+ continue;
1489
+ }
1490
+ const match = /^\\+/.exec(remaining());
1491
+ let slashes = 0;
1492
+ if (match && match[0].length > 2) {
1493
+ slashes = match[0].length;
1494
+ state.index += slashes;
1495
+ if (slashes % 2 !== 0) value += "\\";
1496
+ }
1497
+ if (opts.unescape === true) value = advance();
1498
+ else value += advance();
1499
+ if (state.brackets === 0) {
1500
+ push({
1501
+ type: "text",
1502
+ value
1503
+ });
1504
+ continue;
1505
+ }
1506
+ }
1507
+ /**
1508
+ * If we're inside a regex character class, continue
1509
+ * until we reach the closing bracket.
1510
+ */
1511
+ if (state.brackets > 0 && (value !== "]" || prev.value === "[" || prev.value === "[^")) {
1512
+ if (opts.posix !== false && value === ":") {
1513
+ const inner = prev.value.slice(1);
1514
+ if (inner.includes("[")) {
1515
+ prev.posix = true;
1516
+ if (inner.includes(":")) {
1517
+ const idx = prev.value.lastIndexOf("[");
1518
+ const pre = prev.value.slice(0, idx);
1519
+ const rest = prev.value.slice(idx + 2);
1520
+ const posix = POSIX_REGEX_SOURCE[rest];
1521
+ if (posix) {
1522
+ prev.value = pre + posix;
1523
+ state.backtrack = true;
1524
+ advance();
1525
+ if (!bos.output && tokens.indexOf(prev) === 1) bos.output = ONE_CHAR;
1526
+ continue;
1527
+ }
1528
+ }
1529
+ }
1530
+ }
1531
+ if (value === "[" && peek() !== ":" || value === "-" && peek() === "]") value = `\\${value}`;
1532
+ if (value === "]" && (prev.value === "[" || prev.value === "[^")) value = `\\${value}`;
1533
+ if (opts.posix === true && value === "!" && prev.value === "[") value = "^";
1534
+ prev.value += value;
1535
+ append({ value });
1536
+ continue;
1537
+ }
1538
+ /**
1539
+ * If we're inside a quoted string, continue
1540
+ * until we reach the closing double quote.
1541
+ */
1542
+ if (state.quotes === 1 && value !== "\"") {
1543
+ value = utils.escapeRegex(value);
1544
+ prev.value += value;
1545
+ append({ value });
1546
+ continue;
1547
+ }
1548
+ /**
1549
+ * Double quotes
1550
+ */
1551
+ if (value === "\"") {
1552
+ state.quotes = state.quotes === 1 ? 0 : 1;
1553
+ if (opts.keepQuotes === true) push({
1554
+ type: "text",
1555
+ value
1556
+ });
1557
+ continue;
1558
+ }
1559
+ /**
1560
+ * Parentheses
1561
+ */
1562
+ if (value === "(") {
1563
+ increment("parens");
1564
+ push({
1565
+ type: "paren",
1566
+ value
1567
+ });
1568
+ continue;
1569
+ }
1570
+ if (value === ")") {
1571
+ if (state.parens === 0 && opts.strictBrackets === true) throw new SyntaxError(syntaxError("opening", "("));
1572
+ const extglob = extglobs[extglobs.length - 1];
1573
+ if (extglob && state.parens === extglob.parens + 1) {
1574
+ extglobClose(extglobs.pop());
1575
+ continue;
1576
+ }
1577
+ push({
1578
+ type: "paren",
1579
+ value,
1580
+ output: state.parens ? ")" : "\\)"
1581
+ });
1582
+ decrement("parens");
1583
+ continue;
1584
+ }
1585
+ /**
1586
+ * Square brackets
1587
+ */
1588
+ if (value === "[") {
1589
+ if (opts.nobracket === true || !remaining().includes("]")) {
1590
+ if (opts.nobracket !== true && opts.strictBrackets === true) throw new SyntaxError(syntaxError("closing", "]"));
1591
+ value = `\\${value}`;
1592
+ } else increment("brackets");
1593
+ push({
1594
+ type: "bracket",
1595
+ value
1596
+ });
1597
+ continue;
1598
+ }
1599
+ if (value === "]") {
1600
+ if (opts.nobracket === true || prev && prev.type === "bracket" && prev.value.length === 1) {
1601
+ push({
1602
+ type: "text",
1603
+ value,
1604
+ output: `\\${value}`
1605
+ });
1606
+ continue;
1607
+ }
1608
+ if (state.brackets === 0) {
1609
+ if (opts.strictBrackets === true) throw new SyntaxError(syntaxError("opening", "["));
1610
+ push({
1611
+ type: "text",
1612
+ value,
1613
+ output: `\\${value}`
1614
+ });
1615
+ continue;
1616
+ }
1617
+ decrement("brackets");
1618
+ const prevValue = prev.value.slice(1);
1619
+ if (prev.posix !== true && prevValue[0] === "^" && !prevValue.includes("/")) value = `/${value}`;
1620
+ prev.value += value;
1621
+ append({ value });
1622
+ if (opts.literalBrackets === false || utils.hasRegexChars(prevValue)) continue;
1623
+ const escaped = utils.escapeRegex(prev.value);
1624
+ state.output = state.output.slice(0, -prev.value.length);
1625
+ if (opts.literalBrackets === true) {
1626
+ state.output += escaped;
1627
+ prev.value = escaped;
1628
+ continue;
1629
+ }
1630
+ prev.value = `(${capture}${escaped}|${prev.value})`;
1631
+ state.output += prev.value;
1632
+ continue;
1633
+ }
1634
+ /**
1635
+ * Braces
1636
+ */
1637
+ if (value === "{" && opts.nobrace !== true) {
1638
+ increment("braces");
1639
+ const open = {
1640
+ type: "brace",
1641
+ value,
1642
+ output: "(",
1643
+ outputIndex: state.output.length,
1644
+ tokensIndex: state.tokens.length
1645
+ };
1646
+ braces.push(open);
1647
+ push(open);
1648
+ continue;
1649
+ }
1650
+ if (value === "}") {
1651
+ const brace = braces[braces.length - 1];
1652
+ if (opts.nobrace === true || !brace) {
1653
+ push({
1654
+ type: "text",
1655
+ value,
1656
+ output: value
1657
+ });
1658
+ continue;
1659
+ }
1660
+ let output = ")";
1661
+ if (brace.dots === true) {
1662
+ const arr = tokens.slice();
1663
+ const range = [];
1664
+ for (let i = arr.length - 1; i >= 0; i--) {
1665
+ tokens.pop();
1666
+ if (arr[i].type === "brace") break;
1667
+ if (arr[i].type !== "dots") range.unshift(arr[i].value);
1668
+ }
1669
+ output = expandRange(range, opts);
1670
+ state.backtrack = true;
1671
+ }
1672
+ if (brace.comma !== true && brace.dots !== true) {
1673
+ const out = state.output.slice(0, brace.outputIndex);
1674
+ const toks = state.tokens.slice(brace.tokensIndex);
1675
+ brace.value = brace.output = "\\{";
1676
+ value = output = "\\}";
1677
+ state.output = out;
1678
+ for (const t of toks) state.output += t.output || t.value;
1679
+ }
1680
+ push({
1681
+ type: "brace",
1682
+ value,
1683
+ output
1684
+ });
1685
+ decrement("braces");
1686
+ braces.pop();
1687
+ continue;
1688
+ }
1689
+ /**
1690
+ * Pipes
1691
+ */
1692
+ if (value === "|") {
1693
+ if (extglobs.length > 0) extglobs[extglobs.length - 1].conditions++;
1694
+ push({
1695
+ type: "text",
1696
+ value
1697
+ });
1698
+ continue;
1699
+ }
1700
+ /**
1701
+ * Commas
1702
+ */
1703
+ if (value === ",") {
1704
+ let output = value;
1705
+ const brace = braces[braces.length - 1];
1706
+ if (brace && stack[stack.length - 1] === "braces") {
1707
+ brace.comma = true;
1708
+ output = "|";
1709
+ }
1710
+ push({
1711
+ type: "comma",
1712
+ value,
1713
+ output
1714
+ });
1715
+ continue;
1716
+ }
1717
+ /**
1718
+ * Slashes
1719
+ */
1720
+ if (value === "/") {
1721
+ if (prev.type === "dot" && state.index === state.start + 1) {
1722
+ state.start = state.index + 1;
1723
+ state.consumed = "";
1724
+ state.output = "";
1725
+ tokens.pop();
1726
+ prev = bos;
1727
+ continue;
1728
+ }
1729
+ push({
1730
+ type: "slash",
1731
+ value,
1732
+ output: SLASH_LITERAL
1733
+ });
1734
+ continue;
1735
+ }
1736
+ /**
1737
+ * Dots
1738
+ */
1739
+ if (value === ".") {
1740
+ if (state.braces > 0 && prev.type === "dot") {
1741
+ if (prev.value === ".") prev.output = DOT_LITERAL;
1742
+ const brace = braces[braces.length - 1];
1743
+ prev.type = "dots";
1744
+ prev.output += value;
1745
+ prev.value += value;
1746
+ brace.dots = true;
1747
+ continue;
1748
+ }
1749
+ if (state.braces + state.parens === 0 && prev.type !== "bos" && prev.type !== "slash") {
1750
+ push({
1751
+ type: "text",
1752
+ value,
1753
+ output: DOT_LITERAL
1754
+ });
1755
+ continue;
1756
+ }
1757
+ push({
1758
+ type: "dot",
1759
+ value,
1760
+ output: DOT_LITERAL
1761
+ });
1762
+ continue;
1763
+ }
1764
+ /**
1765
+ * Question marks
1766
+ */
1767
+ if (value === "?") {
1768
+ if (!(prev && prev.value === "(") && opts.noextglob !== true && peek() === "(" && peek(2) !== "?") {
1769
+ extglobOpen("qmark", value);
1770
+ continue;
1771
+ }
1772
+ if (prev && prev.type === "paren") {
1773
+ const next = peek();
1774
+ let output = value;
1775
+ if (prev.value === "(" && !/[!=<:]/.test(next) || next === "<" && !/<([!=]|\w+>)/.test(remaining())) output = `\\${value}`;
1776
+ push({
1777
+ type: "text",
1778
+ value,
1779
+ output
1780
+ });
1781
+ continue;
1782
+ }
1783
+ if (opts.dot !== true && (prev.type === "slash" || prev.type === "bos")) {
1784
+ push({
1785
+ type: "qmark",
1786
+ value,
1787
+ output: QMARK_NO_DOT
1788
+ });
1789
+ continue;
1790
+ }
1791
+ push({
1792
+ type: "qmark",
1793
+ value,
1794
+ output: QMARK
1795
+ });
1796
+ continue;
1797
+ }
1798
+ /**
1799
+ * Exclamation
1800
+ */
1801
+ if (value === "!") {
1802
+ if (opts.noextglob !== true && peek() === "(") {
1803
+ if (peek(2) !== "?" || !/[!=<:]/.test(peek(3))) {
1804
+ extglobOpen("negate", value);
1805
+ continue;
1806
+ }
1807
+ }
1808
+ if (opts.nonegate !== true && state.index === 0) {
1809
+ negate();
1810
+ continue;
1811
+ }
1812
+ }
1813
+ /**
1814
+ * Plus
1815
+ */
1816
+ if (value === "+") {
1817
+ if (opts.noextglob !== true && peek() === "(" && peek(2) !== "?") {
1818
+ extglobOpen("plus", value);
1819
+ continue;
1820
+ }
1821
+ if (prev && prev.value === "(" || opts.regex === false) {
1822
+ push({
1823
+ type: "plus",
1824
+ value,
1825
+ output: PLUS_LITERAL
1826
+ });
1827
+ continue;
1828
+ }
1829
+ if (prev && (prev.type === "bracket" || prev.type === "paren" || prev.type === "brace") || state.parens > 0) {
1830
+ push({
1831
+ type: "plus",
1832
+ value
1833
+ });
1834
+ continue;
1835
+ }
1836
+ push({
1837
+ type: "plus",
1838
+ value: PLUS_LITERAL
1839
+ });
1840
+ continue;
1841
+ }
1842
+ /**
1843
+ * Plain text
1844
+ */
1845
+ if (value === "@") {
1846
+ if (opts.noextglob !== true && peek() === "(" && peek(2) !== "?") {
1847
+ push({
1848
+ type: "at",
1849
+ extglob: true,
1850
+ value,
1851
+ output: ""
1852
+ });
1853
+ continue;
1854
+ }
1855
+ push({
1856
+ type: "text",
1857
+ value
1858
+ });
1859
+ continue;
1860
+ }
1861
+ /**
1862
+ * Plain text
1863
+ */
1864
+ if (value !== "*") {
1865
+ if (value === "$" || value === "^") value = `\\${value}`;
1866
+ const match = REGEX_NON_SPECIAL_CHARS.exec(remaining());
1867
+ if (match) {
1868
+ value += match[0];
1869
+ state.index += match[0].length;
1870
+ }
1871
+ push({
1872
+ type: "text",
1873
+ value
1874
+ });
1875
+ continue;
1876
+ }
1877
+ /**
1878
+ * Stars
1879
+ */
1880
+ if (prev && (prev.type === "globstar" || prev.star === true)) {
1881
+ prev.type = "star";
1882
+ prev.star = true;
1883
+ prev.value += value;
1884
+ prev.output = star;
1885
+ state.backtrack = true;
1886
+ state.globstar = true;
1887
+ consume(value);
1888
+ continue;
1889
+ }
1890
+ let rest = remaining();
1891
+ if (opts.noextglob !== true && /^\([^?]/.test(rest)) {
1892
+ extglobOpen("star", value);
1893
+ continue;
1894
+ }
1895
+ if (prev.type === "star") {
1896
+ if (opts.noglobstar === true) {
1897
+ consume(value);
1898
+ continue;
1899
+ }
1900
+ const prior = prev.prev;
1901
+ const before = prior.prev;
1902
+ const isStart = prior.type === "slash" || prior.type === "bos";
1903
+ const afterStar = before && (before.type === "star" || before.type === "globstar");
1904
+ if (opts.bash === true && (!isStart || rest[0] && rest[0] !== "/")) {
1905
+ push({
1906
+ type: "star",
1907
+ value,
1908
+ output: ""
1909
+ });
1910
+ continue;
1911
+ }
1912
+ const isBrace = state.braces > 0 && (prior.type === "comma" || prior.type === "brace");
1913
+ const isExtglob = extglobs.length && (prior.type === "pipe" || prior.type === "paren");
1914
+ if (!isStart && prior.type !== "paren" && !isBrace && !isExtglob) {
1915
+ push({
1916
+ type: "star",
1917
+ value,
1918
+ output: ""
1919
+ });
1920
+ continue;
1921
+ }
1922
+ while (rest.slice(0, 3) === "/**") {
1923
+ const after = input[state.index + 4];
1924
+ if (after && after !== "/") break;
1925
+ rest = rest.slice(3);
1926
+ consume("/**", 3);
1927
+ }
1928
+ const isEnd = eos() || state.parens > 0 && rest === ")".repeat(state.parens) && !extglobs.some((extglob) => extglob.type === "negate");
1929
+ if (prior.type === "bos" && eos()) {
1930
+ prev.type = "globstar";
1931
+ prev.value += value;
1932
+ prev.output = globstar(opts);
1933
+ state.output = prev.output;
1934
+ state.globstar = true;
1935
+ consume(value);
1936
+ continue;
1937
+ }
1938
+ if (prior.type === "slash" && prior.prev.type !== "bos" && !afterStar && isEnd) {
1939
+ state.output = state.output.slice(0, -(prior.output + prev.output).length);
1940
+ prior.output = `(?:${prior.output}`;
1941
+ prev.type = "globstar";
1942
+ prev.output = globstar(opts) + (opts.strictSlashes ? ")" : "|$)");
1943
+ prev.value += value;
1944
+ state.globstar = true;
1945
+ state.output += prior.output + prev.output;
1946
+ consume(value);
1947
+ continue;
1948
+ }
1949
+ if (prior.type === "slash" && prior.prev.type !== "bos" && rest[0] === "/") {
1950
+ const end = rest[1] !== void 0 ? "|$" : "";
1951
+ state.output = state.output.slice(0, -(prior.output + prev.output).length);
1952
+ prior.output = `(?:${prior.output}`;
1953
+ prev.type = "globstar";
1954
+ prev.output = `${globstar(opts)}${SLASH_LITERAL}|${SLASH_LITERAL}${end})`;
1955
+ prev.value += value;
1956
+ state.output += prior.output + prev.output;
1957
+ state.globstar = true;
1958
+ consume(value + advance());
1959
+ push({
1960
+ type: "slash",
1961
+ value: "/",
1962
+ output: ""
1963
+ });
1964
+ continue;
1965
+ }
1966
+ if (prior.type === "bos" && rest[0] === "/") {
1967
+ prev.type = "globstar";
1968
+ prev.value += value;
1969
+ prev.output = `(?:^|${SLASH_LITERAL}|${globstar(opts)}${SLASH_LITERAL})`;
1970
+ state.output = prev.output;
1971
+ state.globstar = true;
1972
+ consume(value + advance());
1973
+ push({
1974
+ type: "slash",
1975
+ value: "/",
1976
+ output: ""
1977
+ });
1978
+ continue;
1979
+ }
1980
+ state.output = state.output.slice(0, -prev.output.length);
1981
+ prev.type = "globstar";
1982
+ prev.output = globstar(opts);
1983
+ prev.value += value;
1984
+ state.output += prev.output;
1985
+ state.globstar = true;
1986
+ consume(value);
1987
+ continue;
1988
+ }
1989
+ const token = {
1990
+ type: "star",
1991
+ value,
1992
+ output: star
1993
+ };
1994
+ if (opts.bash === true) {
1995
+ token.output = ".*?";
1996
+ if (prev.type === "bos" || prev.type === "slash") token.output = nodot + token.output;
1997
+ push(token);
1998
+ continue;
1999
+ }
2000
+ if (prev && (prev.type === "bracket" || prev.type === "paren") && opts.regex === true) {
2001
+ token.output = value;
2002
+ push(token);
2003
+ continue;
2004
+ }
2005
+ if (state.index === state.start || prev.type === "slash" || prev.type === "dot") {
2006
+ if (prev.type === "dot") {
2007
+ state.output += NO_DOT_SLASH;
2008
+ prev.output += NO_DOT_SLASH;
2009
+ } else if (opts.dot === true) {
2010
+ state.output += NO_DOTS_SLASH;
2011
+ prev.output += NO_DOTS_SLASH;
2012
+ } else {
2013
+ state.output += nodot;
2014
+ prev.output += nodot;
2015
+ }
2016
+ if (peek() !== "*") {
2017
+ state.output += ONE_CHAR;
2018
+ prev.output += ONE_CHAR;
2019
+ }
2020
+ }
2021
+ push(token);
2022
+ }
2023
+ while (state.brackets > 0) {
2024
+ if (opts.strictBrackets === true) throw new SyntaxError(syntaxError("closing", "]"));
2025
+ state.output = utils.escapeLast(state.output, "[");
2026
+ decrement("brackets");
2027
+ }
2028
+ while (state.parens > 0) {
2029
+ if (opts.strictBrackets === true) throw new SyntaxError(syntaxError("closing", ")"));
2030
+ state.output = utils.escapeLast(state.output, "(");
2031
+ decrement("parens");
2032
+ }
2033
+ while (state.braces > 0) {
2034
+ if (opts.strictBrackets === true) throw new SyntaxError(syntaxError("closing", "}"));
2035
+ state.output = utils.escapeLast(state.output, "{");
2036
+ decrement("braces");
2037
+ }
2038
+ if (opts.strictSlashes !== true && (prev.type === "star" || prev.type === "bracket")) push({
2039
+ type: "maybe_slash",
2040
+ value: "",
2041
+ output: `${SLASH_LITERAL}?`
2042
+ });
2043
+ if (state.backtrack === true) {
2044
+ state.output = "";
2045
+ for (const token of state.tokens) {
2046
+ state.output += token.output != null ? token.output : token.value;
2047
+ if (token.suffix) state.output += token.suffix;
2048
+ }
2049
+ }
2050
+ return state;
2051
+ };
2052
+ /**
2053
+ * Fast paths for creating regular expressions for common glob patterns.
2054
+ * This can significantly speed up processing and has very little downside
2055
+ * impact when none of the fast paths match.
2056
+ */
2057
+ parse.fastpaths = (input, options) => {
2058
+ const opts = { ...options };
2059
+ const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
2060
+ const len = input.length;
2061
+ if (len > max) throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
2062
+ input = REPLACEMENTS[input] || input;
2063
+ const { DOT_LITERAL, SLASH_LITERAL, ONE_CHAR, DOTS_SLASH, NO_DOT, NO_DOTS, NO_DOTS_SLASH, STAR, START_ANCHOR } = constants.globChars(opts.windows);
2064
+ const nodot = opts.dot ? NO_DOTS : NO_DOT;
2065
+ const slashDot = opts.dot ? NO_DOTS_SLASH : NO_DOT;
2066
+ const capture = opts.capture ? "" : "?:";
2067
+ const state = {
2068
+ negated: false,
2069
+ prefix: ""
2070
+ };
2071
+ let star = opts.bash === true ? ".*?" : STAR;
2072
+ if (opts.capture) star = `(${star})`;
2073
+ const globstar = (opts) => {
2074
+ if (opts.noglobstar === true) return star;
2075
+ return `(${capture}(?:(?!${START_ANCHOR}${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
2076
+ };
2077
+ const create = (str) => {
2078
+ switch (str) {
2079
+ case "*": return `${nodot}${ONE_CHAR}${star}`;
2080
+ case ".*": return `${DOT_LITERAL}${ONE_CHAR}${star}`;
2081
+ case "*.*": return `${nodot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
2082
+ case "*/*": return `${nodot}${star}${SLASH_LITERAL}${ONE_CHAR}${slashDot}${star}`;
2083
+ case "**": return nodot + globstar(opts);
2084
+ case "**/*": return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${ONE_CHAR}${star}`;
2085
+ case "**/*.*": return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
2086
+ case "**/.*": return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${DOT_LITERAL}${ONE_CHAR}${star}`;
2087
+ default: {
2088
+ const match = /^(.*?)\.(\w+)$/.exec(str);
2089
+ if (!match) return;
2090
+ const source = create(match[1]);
2091
+ if (!source) return;
2092
+ return source + DOT_LITERAL + match[2];
2093
+ }
2094
+ }
2095
+ };
2096
+ let source = create(utils.removePrefix(input, state));
2097
+ if (source && opts.strictSlashes !== true) source += `${SLASH_LITERAL}?`;
2098
+ return source;
2099
+ };
2100
+ module.exports = parse;
2101
+ }));
2102
+ // ../../node_modules/.pnpm/picomatch@4.0.7/node_modules/picomatch/lib/picomatch.js
2103
+ var require_picomatch$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2104
+ const scan = require_scan();
2105
+ const parse = require_parse();
2106
+ const utils = require_utils();
2107
+ const constants = require_constants();
2108
+ const isObject = (val) => val && typeof val === "object" && !Array.isArray(val);
2109
+ /**
2110
+ * Creates a matcher function from one or more glob patterns. The
2111
+ * returned function takes a string to match as its first argument,
2112
+ * and returns true if the string is a match. The returned matcher
2113
+ * function also takes a boolean as the second argument that, when true,
2114
+ * returns an object with additional information.
2115
+ *
2116
+ * ```js
2117
+ * const picomatch = require('picomatch');
2118
+ * // picomatch(glob[, options]);
2119
+ *
2120
+ * const isMatch = picomatch('*.!(*a)');
2121
+ * console.log(isMatch('a.a')); //=> false
2122
+ * console.log(isMatch('a.b')); //=> true
2123
+ *
2124
+ * // For environments without `node.js`, `picomatch/posix` provides you a dependency-free matcher, without automatic OS detection.
2125
+ * const picomatch = require('picomatch/posix');
2126
+ * // the same API, defaulting to posix paths
2127
+ * const isMatch = picomatch('a/*');
2128
+ * console.log(isMatch('a\\b')); //=> false
2129
+ * console.log(isMatch('a/b')); //=> true
2130
+ *
2131
+ * // you can still configure the matcher function to accept windows paths
2132
+ * const isMatch = picomatch('a/*', { options: windows });
2133
+ * console.log(isMatch('a\\b')); //=> true
2134
+ * console.log(isMatch('a/b')); //=> true
2135
+ * ```
2136
+ * @name picomatch
2137
+ * @param {String|Array} `globs` One or more glob patterns.
2138
+ * @param {Object=} `options`
2139
+ * @return {Function=} Returns a matcher function.
2140
+ * @api public
2141
+ */
2142
+ const picomatch = (glob, options, returnState = false) => {
2143
+ if (Array.isArray(glob)) {
2144
+ const fns = glob.map((input) => picomatch(input, options, returnState));
2145
+ const arrayMatcher = (str) => {
2146
+ for (const isMatch of fns) {
2147
+ const state = isMatch(str);
2148
+ if (state) return state;
2149
+ }
2150
+ return false;
2151
+ };
2152
+ return arrayMatcher;
2153
+ }
2154
+ const isState = isObject(glob) && glob.tokens && glob.input;
2155
+ if (glob === "" || typeof glob !== "string" && !isState) throw new TypeError("Expected pattern to be a non-empty string");
2156
+ const opts = options || {};
2157
+ const posix = opts.windows;
2158
+ const regex = isState ? picomatch.compileRe(glob, options) : picomatch.makeRe(glob, options, false, true);
2159
+ const state = regex.state;
2160
+ delete regex.state;
2161
+ let isIgnored = () => false;
2162
+ if (opts.ignore) {
2163
+ const ignoreOpts = {
2164
+ ...options,
2165
+ ignore: null,
2166
+ onMatch: null,
2167
+ onResult: null
2168
+ };
2169
+ isIgnored = picomatch(opts.ignore, ignoreOpts, returnState);
2170
+ }
2171
+ const matcher = (input, returnObject = false) => {
2172
+ const { isMatch, match, output } = picomatch.test(input, regex, options, {
2173
+ glob,
2174
+ posix
2175
+ });
2176
+ const result = {
2177
+ glob,
2178
+ state,
2179
+ regex,
2180
+ posix,
2181
+ input,
2182
+ output,
2183
+ match,
2184
+ isMatch
2185
+ };
2186
+ if (typeof opts.onResult === "function") opts.onResult(result);
2187
+ if (isMatch === false) {
2188
+ result.isMatch = false;
2189
+ return returnObject ? result : false;
2190
+ }
2191
+ if (isIgnored(input)) {
2192
+ if (typeof opts.onIgnore === "function") opts.onIgnore(result);
2193
+ result.isMatch = false;
2194
+ return returnObject ? result : false;
2195
+ }
2196
+ if (typeof opts.onMatch === "function") opts.onMatch(result);
2197
+ return returnObject ? result : true;
2198
+ };
2199
+ if (returnState) matcher.state = state;
2200
+ return matcher;
2201
+ };
2202
+ /**
2203
+ * Test `input` with the given `regex`. This is used by the main
2204
+ * `picomatch()` function to test the input string.
2205
+ *
2206
+ * ```js
2207
+ * const picomatch = require('picomatch');
2208
+ * // picomatch.test(input, regex[, options]);
2209
+ *
2210
+ * console.log(picomatch.test('foo/bar', /^(?:([^/]*?)\/([^/]*?))$/));
2211
+ * // { isMatch: true, match: [ 'foo/', 'foo', 'bar' ], output: 'foo/bar' }
2212
+ * ```
2213
+ * @param {String} `input` String to test.
2214
+ * @param {RegExp} `regex`
2215
+ * @return {Object} Returns an object with matching info.
2216
+ * @api public
2217
+ */
2218
+ picomatch.test = (input, regex, options, { glob, posix } = {}) => {
2219
+ if (typeof input !== "string") throw new TypeError("Expected input to be a string");
2220
+ if (input === "") return {
2221
+ isMatch: false,
2222
+ output: ""
2223
+ };
2224
+ const opts = options || {};
2225
+ const format = opts.format || (posix ? utils.toPosixSlashes : null);
2226
+ let match = input === glob;
2227
+ let output = match && format ? format(input) : input;
2228
+ if (match === false) {
2229
+ output = format ? format(input) : input;
2230
+ match = output === glob;
2231
+ }
2232
+ if (match === false || opts.capture === true) {
2233
+ if (opts.matchBase === true || opts.basename === true) match = picomatch.matchBase(input, regex, options, posix);
2234
+ else match = regex.exec(output);
2235
+ }
2236
+ return {
2237
+ isMatch: Boolean(match),
2238
+ match,
2239
+ output
2240
+ };
2241
+ };
2242
+ /**
2243
+ * Match the basename of a filepath.
2244
+ *
2245
+ * ```js
2246
+ * const picomatch = require('picomatch');
2247
+ * // picomatch.matchBase(input, glob[, options]);
2248
+ * console.log(picomatch.matchBase('foo/bar.js', '*.js'); // true
2249
+ * ```
2250
+ * @param {String} `input` String to test.
2251
+ * @param {RegExp|String} `glob` Glob pattern or regex created by [.makeRe](#makeRe).
2252
+ * @return {Boolean}
2253
+ * @api public
2254
+ */
2255
+ picomatch.matchBase = (input, glob, options, posix = options && options.windows) => {
2256
+ return (glob instanceof RegExp ? glob : picomatch.makeRe(glob, options)).test(utils.basename(input, { windows: posix }));
2257
+ };
2258
+ /**
2259
+ * Returns true if **any** of the given glob `patterns` match the specified `string`.
2260
+ *
2261
+ * ```js
2262
+ * const picomatch = require('picomatch');
2263
+ * // picomatch.isMatch(string, patterns[, options]);
2264
+ *
2265
+ * console.log(picomatch.isMatch('a.a', ['b.*', '*.a'])); //=> true
2266
+ * console.log(picomatch.isMatch('a.a', 'b.*')); //=> false
2267
+ * ```
2268
+ * @param {String|Array} str The string to test.
2269
+ * @param {String|Array} patterns One or more glob patterns to use for matching.
2270
+ * @param {Object} [options] See available [options](#options).
2271
+ * @return {Boolean} Returns true if any patterns match `str`
2272
+ * @api public
2273
+ */
2274
+ picomatch.isMatch = (str, patterns, options) => picomatch(patterns, options)(str);
2275
+ /**
2276
+ * Parse a glob pattern to create the source string for a regular
2277
+ * expression.
2278
+ *
2279
+ * ```js
2280
+ * const picomatch = require('picomatch');
2281
+ * const result = picomatch.parse(pattern[, options]);
2282
+ * ```
2283
+ * @param {String} `pattern`
2284
+ * @param {Object} `options`
2285
+ * @return {Object} Returns an object with useful properties and output to be used as a regex source string.
2286
+ * @api public
2287
+ */
2288
+ picomatch.parse = (pattern, options) => {
2289
+ if (Array.isArray(pattern)) return pattern.map((p) => picomatch.parse(p, options));
2290
+ return parse(pattern, {
2291
+ ...options,
2292
+ fastpaths: false
2293
+ });
2294
+ };
2295
+ /**
2296
+ * Scan a glob pattern to separate the pattern into segments.
2297
+ *
2298
+ * ```js
2299
+ * const picomatch = require('picomatch');
2300
+ * // picomatch.scan(input[, options]);
2301
+ *
2302
+ * const result = picomatch.scan('!./foo/*.js');
2303
+ * console.log(result);
2304
+ * { prefix: '!./',
2305
+ * input: '!./foo/*.js',
2306
+ * start: 3,
2307
+ * base: 'foo',
2308
+ * glob: '*.js',
2309
+ * isBrace: false,
2310
+ * isBracket: false,
2311
+ * isGlob: true,
2312
+ * isExtglob: false,
2313
+ * isGlobstar: false,
2314
+ * negated: true }
2315
+ * ```
2316
+ * @param {String} `input` Glob pattern to scan.
2317
+ * @param {Object} `options`
2318
+ * @return {Object} Returns an object with
2319
+ * @api public
2320
+ */
2321
+ picomatch.scan = (input, options) => scan(input, options);
2322
+ /**
2323
+ * Compile a regular expression from the `state` object returned by the
2324
+ * [parse()](#parse) method.
2325
+ *
2326
+ * ```js
2327
+ * const picomatch = require('picomatch');
2328
+ * const state = picomatch.parse('*.js');
2329
+ * // picomatch.compileRe(state[, options]);
2330
+ *
2331
+ * console.log(picomatch.compileRe(state));
2332
+ * //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
2333
+ * ```
2334
+ * @param {Object} `state`
2335
+ * @param {Object} `options`
2336
+ * @param {Boolean} `returnOutput` Intended for implementors, this argument allows you to return the raw output from the parser.
2337
+ * @param {Boolean} `returnState` Adds the state to a `state` property on the returned regex. Useful for implementors and debugging.
2338
+ * @return {RegExp}
2339
+ * @api public
2340
+ */
2341
+ picomatch.compileRe = (state, options, returnOutput = false, returnState = false) => {
2342
+ if (returnOutput === true) return state.output;
2343
+ const opts = options || {};
2344
+ const prepend = opts.contains ? "" : "^";
2345
+ const append = opts.contains ? "" : "$";
2346
+ let source = `${prepend}(?:${state.output})${append}`;
2347
+ if (state && state.negated === true) source = `^(?!${source}).*$`;
2348
+ const regex = picomatch.toRegex(source, options);
2349
+ if (returnState === true) regex.state = state;
2350
+ return regex;
2351
+ };
2352
+ /**
2353
+ * Create a regular expression from a parsed glob pattern.
2354
+ *
2355
+ * ```js
2356
+ * const picomatch = require('picomatch');
2357
+ * // picomatch.makeRe(state[, options]);
2358
+ *
2359
+ * const result = picomatch.makeRe('*.js');
2360
+ * console.log(result);
2361
+ * //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
2362
+ * ```
2363
+ * @param {String} `state` The object returned from the `.parse` method.
2364
+ * @param {Object} `options`
2365
+ * @param {Boolean} `returnOutput` Implementors may use this argument to return the compiled output, instead of a regular expression. This is not exposed on the options to prevent end-users from mutating the result.
2366
+ * @param {Boolean} `returnState` Implementors may use this argument to return the state from the parsed glob with the returned regular expression.
2367
+ * @return {RegExp} Returns a regex created from the given pattern.
2368
+ * @api public
2369
+ */
2370
+ picomatch.makeRe = (input, options = {}, returnOutput = false, returnState = false) => {
2371
+ if (!input || typeof input !== "string") throw new TypeError("Expected a non-empty string");
2372
+ let parsed = {
2373
+ negated: false,
2374
+ fastpaths: true
2375
+ };
2376
+ if (options.fastpaths !== false && (input[0] === "." || input[0] === "*")) parsed.output = parse.fastpaths(input, options);
2377
+ if (!parsed.output) parsed = parse(input, options);
2378
+ return picomatch.compileRe(parsed, options, returnOutput, returnState);
2379
+ };
2380
+ /**
2381
+ * Create a regular expression from the given regex source string.
2382
+ *
2383
+ * ```js
2384
+ * const picomatch = require('picomatch');
2385
+ * // picomatch.toRegex(source[, options]);
2386
+ *
2387
+ * const { output } = picomatch.parse('*.js');
2388
+ * console.log(picomatch.toRegex(output));
2389
+ * //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
2390
+ * ```
2391
+ * @param {String} `source` Regular expression source string.
2392
+ * @param {Object} `options`
2393
+ * @return {RegExp}
2394
+ * @api public
2395
+ */
2396
+ picomatch.toRegex = (source, options) => {
2397
+ try {
2398
+ const opts = options || {};
2399
+ return new RegExp(source, opts.flags || (opts.nocase ? "i" : ""));
2400
+ } catch (err) {
2401
+ if (options && options.debug === true) throw err;
2402
+ return /$^/;
2403
+ }
2404
+ };
2405
+ /**
2406
+ * Picomatch constants.
2407
+ * @return {Object}
2408
+ */
2409
+ picomatch.constants = constants;
2410
+ /**
2411
+ * Expose "picomatch"
2412
+ */
2413
+ module.exports = picomatch;
2414
+ }));
2415
+ // ../../node_modules/.pnpm/tinyglobby@0.2.17/node_modules/tinyglobby/dist/index.mjs
2416
+ var import_picomatch = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exports, module) => {
2417
+ const pico = require_picomatch$1();
2418
+ const utils = require_utils();
2419
+ function picomatch(glob, options, returnState = false) {
2420
+ if (options && (options.windows === null || options.windows === void 0)) options = {
2421
+ ...options,
2422
+ windows: utils.isWindows()
2423
+ };
2424
+ return pico(glob, options, returnState);
2425
+ }
2426
+ Object.assign(picomatch, pico);
2427
+ module.exports = picomatch;
2428
+ })))(), 1);
2429
+ const isReadonlyArray = Array.isArray;
2430
+ const BACKSLASHES = /\\/g;
2431
+ const DRIVE_RELATIVE_PATH = /^[A-Za-z]:$/;
2432
+ const isWin = process.platform === "win32";
2433
+ const ONLY_PARENT_DIRECTORIES = /^(\/?\.\.)+$/;
2434
+ function getPartialMatcher(patterns, options = {}) {
2435
+ const patternsCount = patterns.length;
2436
+ const patternsParts = Array(patternsCount);
2437
+ const matchers = Array(patternsCount);
2438
+ let i, j;
2439
+ for (i = 0; i < patternsCount; i++) {
2440
+ const parts = splitPattern(patterns[i]);
2441
+ patternsParts[i] = parts;
2442
+ const partsCount = parts.length;
2443
+ const partMatchers = Array(partsCount);
2444
+ for (j = 0; j < partsCount; j++) partMatchers[j] = (0, import_picomatch.default)(parts[j], options);
2445
+ matchers[i] = partMatchers;
2446
+ }
2447
+ return (input) => {
2448
+ const inputParts = input.split("/");
2449
+ if (inputParts[0] === ".." && ONLY_PARENT_DIRECTORIES.test(input)) return true;
2450
+ for (i = 0; i < patternsCount; i++) {
2451
+ const patternParts = patternsParts[i];
2452
+ const matcher = matchers[i];
2453
+ const inputPatternCount = inputParts.length;
2454
+ const minParts = Math.min(inputPatternCount, patternParts.length);
2455
+ j = 0;
2456
+ while (j < minParts) {
2457
+ const part = patternParts[j];
2458
+ if (part.includes("/")) return true;
2459
+ if (!matcher[j](inputParts[j])) break;
2460
+ if (!options.noglobstar && part === "**") return true;
2461
+ j++;
2462
+ }
2463
+ if (j === inputPatternCount) return true;
2464
+ }
2465
+ return false;
2466
+ };
2467
+ }
2468
+ /* node:coverage ignore next 2 */
2469
+ const WIN32_ROOT_DIR = /^[A-Z]:\/$/i;
2470
+ const isRoot = isWin ? (p) => WIN32_ROOT_DIR.test(p) : (p) => p === "/";
2471
+ function buildFormat(cwd, root, absolute) {
2472
+ if (cwd === root || root.startsWith(`${cwd}/`)) {
2473
+ if (absolute) {
2474
+ const start = cwd.length + +!isRoot(cwd);
2475
+ return (p, isDir) => p.slice(start, isDir ? -1 : void 0) || ".";
2476
+ }
2477
+ const prefix = root.slice(cwd.length + 1);
2478
+ if (prefix) return (p, isDir) => {
2479
+ if (p === ".") return prefix;
2480
+ const result = `${prefix}/${p}`;
2481
+ return isDir ? result.slice(0, -1) : result;
2482
+ };
2483
+ return (p, isDir) => isDir && p !== "." ? p.slice(0, -1) : p;
2484
+ }
2485
+ if (absolute) return (p) => posix.relative(cwd, p) || ".";
2486
+ return (p) => posix.relative(cwd, `${root}/${p}`) || ".";
2487
+ }
2488
+ function buildRelative(cwd, root) {
2489
+ if (root.startsWith(`${cwd}/`)) {
2490
+ const prefix = root.slice(cwd.length + 1);
2491
+ return (p) => `${prefix}/${p}`;
2492
+ }
2493
+ return (p) => {
2494
+ const result = posix.relative(cwd, `${root}/${p}`);
2495
+ return p[p.length - 1] === "/" && result !== "" ? `${result}/` : result || ".";
2496
+ };
2497
+ }
2498
+ function ensureNonDriveRelativePath(path) {
2499
+ return path.replace(DRIVE_RELATIVE_PATH, (match) => `${match}/`);
2500
+ }
2501
+ const splitPatternOptions = { parts: true };
2502
+ function splitPattern(path) {
2503
+ var _result$parts;
2504
+ const result = import_picomatch.default.scan(path, splitPatternOptions);
2505
+ return ((_result$parts = result.parts) === null || _result$parts === void 0 ? void 0 : _result$parts.length) ? result.parts : [path];
2506
+ }
2507
+ const POSIX_UNESCAPED_GLOB_SYMBOLS = /(?<!\\)([()[\]{}*?|]|^!|[!+@](?=\()|\\(?![()[\]{}!*+?@|]))/g;
2508
+ const WIN32_UNESCAPED_GLOB_SYMBOLS = /(?<!\\)([()[\]{}]|^!|[!+@](?=\())/g;
2509
+ const escapePosixPath = (path) => path.replace(POSIX_UNESCAPED_GLOB_SYMBOLS, "\\$&");
2510
+ const escapeWin32Path = (path) => path.replace(WIN32_UNESCAPED_GLOB_SYMBOLS, "\\$&");
2511
+ /**
2512
+ * Escapes a path's special characters depending on the platform.
2513
+ * @see {@link https://superchupu.dev/tinyglobby/documentation#escapePath}
2514
+ */
2515
+ /* node:coverage ignore next */
2516
+ const escapePath = isWin ? escapeWin32Path : escapePosixPath;
2517
+ /**
2518
+ * Checks if a pattern has dynamic parts.
2519
+ *
2520
+ * Has a few minor differences with [`fast-glob`](https://github.com/mrmlnc/fast-glob) for better accuracy:
2521
+ *
2522
+ * - Doesn't necessarily return `false` on patterns that include `\`.
2523
+ * - Returns `true` if the pattern includes parentheses, regardless of them representing one single pattern or not.
2524
+ * - Returns `true` for unfinished glob extensions i.e. `(h`, `+(h`.
2525
+ * - Returns `true` for unfinished brace expansions as long as they include `,` or `..`.
2526
+ *
2527
+ * @see {@link https://superchupu.dev/tinyglobby/documentation#isDynamicPattern}
2528
+ */
2529
+ function isDynamicPattern(pattern, options) {
2530
+ if ((options === null || options === void 0 ? void 0 : options.caseSensitiveMatch) === false) return true;
2531
+ const scan = import_picomatch.default.scan(pattern);
2532
+ return scan.isGlob || scan.negated;
2533
+ }
2534
+ function log(...tasks) {
2535
+ console.log(`[tinyglobby ${(/* @__PURE__ */ new Date()).toLocaleTimeString("es")}]`, ...tasks);
2536
+ }
2537
+ function ensureStringArray(value) {
2538
+ return typeof value === "string" ? [value] : value !== null && value !== void 0 ? value : [];
2539
+ }
2540
+ const PARENT_DIRECTORY = /^(\/?\.\.)+/;
2541
+ const ESCAPING_BACKSLASHES = /\\(?=[()[\]{}!*+?@|])/g;
2542
+ function normalizePattern(pattern, opts, props, isIgnore) {
2543
+ var _PARENT_DIRECTORY$exe;
2544
+ const cwd = opts.cwd;
2545
+ let result = pattern;
2546
+ if (pattern[pattern.length - 1] === "/") result = pattern.slice(0, -1);
2547
+ if (result[result.length - 1] !== "*" && opts.expandDirectories) result += "/**";
2548
+ const escapedCwd = escapePath(cwd);
2549
+ result = isAbsolute(result.replace(ESCAPING_BACKSLASHES, "")) ? posix.relative(escapedCwd, result) : posix.normalize(result);
2550
+ const parentDir = (_PARENT_DIRECTORY$exe = PARENT_DIRECTORY.exec(result)) === null || _PARENT_DIRECTORY$exe === void 0 ? void 0 : _PARENT_DIRECTORY$exe[0];
2551
+ const parts = splitPattern(result);
2552
+ if (parentDir) {
2553
+ const n = (parentDir.length + 1) / 3;
2554
+ let i = 0;
2555
+ const cwdParts = escapedCwd.split("/");
2556
+ while (i < n && parts[i + n] === cwdParts[cwdParts.length + i - n]) {
2557
+ result = result.slice(0, (n - i - 1) * 3) + result.slice((n - i) * 3 + parts[i + n].length + 1) || ".";
2558
+ i++;
2559
+ }
2560
+ const potentialRoot = posix.join(cwd, parentDir.slice(i * 3));
2561
+ if (potentialRoot[0] !== "." && props.root.length > potentialRoot.length) {
2562
+ props.root = ensureNonDriveRelativePath(potentialRoot);
2563
+ props.depthOffset = -n + i;
2564
+ }
2565
+ }
2566
+ if (!isIgnore && props.depthOffset >= 0) {
2567
+ var _props$commonPath;
2568
+ (_props$commonPath = props.commonPath) !== null && _props$commonPath !== void 0 || (props.commonPath = parts);
2569
+ const newCommonPath = [];
2570
+ const length = Math.min(props.commonPath.length, parts.length);
2571
+ for (let i = 0; i < length; i++) {
2572
+ const part = parts[i];
2573
+ if (part === "**" && !parts[i + 1]) {
2574
+ newCommonPath.pop();
2575
+ break;
2576
+ }
2577
+ if (i === parts.length - 1 || part !== props.commonPath[i] || isDynamicPattern(part)) break;
2578
+ newCommonPath.push(part);
2579
+ }
2580
+ props.depthOffset = newCommonPath.length;
2581
+ props.commonPath = newCommonPath;
2582
+ props.root = ensureNonDriveRelativePath(newCommonPath.length > 0 ? posix.join(cwd, ...newCommonPath) : cwd);
2583
+ }
2584
+ return result;
2585
+ }
2586
+ function processPatterns(options, patterns, props) {
2587
+ const matchPatterns = [];
2588
+ const ignorePatterns = [];
2589
+ for (const pattern of options.ignore) {
2590
+ if (!pattern) continue;
2591
+ if (pattern[0] !== "!" || pattern[1] === "(") ignorePatterns.push(normalizePattern(pattern, options, props, true));
2592
+ }
2593
+ for (const pattern of patterns) {
2594
+ if (!pattern) continue;
2595
+ if (pattern[0] !== "!" || pattern[1] === "(") matchPatterns.push(normalizePattern(pattern, options, props, false));
2596
+ else if (pattern[1] !== "!" || pattern[2] === "(") ignorePatterns.push(normalizePattern(pattern.slice(1), options, props, true));
2597
+ }
2598
+ return {
2599
+ match: matchPatterns,
2600
+ ignore: ignorePatterns
2601
+ };
2602
+ }
2603
+ function buildCrawler(options, patterns) {
2604
+ const cwd = options.cwd;
2605
+ const props = {
2606
+ root: cwd,
2607
+ depthOffset: 0
2608
+ };
2609
+ const processed = processPatterns(options, patterns, props);
2610
+ if (options.debug) log("internal processing patterns:", processed);
2611
+ const { absolute, caseSensitiveMatch, debug, dot, followSymbolicLinks, onlyDirectories } = options;
2612
+ const root = props.root.replace(BACKSLASHES, "");
2613
+ const matchOptions = {
2614
+ dot,
2615
+ nobrace: options.braceExpansion === false,
2616
+ nocase: !caseSensitiveMatch,
2617
+ noextglob: options.extglob === false,
2618
+ noglobstar: options.globstar === false,
2619
+ posix: true
2620
+ };
2621
+ const matcher = (0, import_picomatch.default)(processed.match, matchOptions);
2622
+ const ignore = (0, import_picomatch.default)(processed.ignore, matchOptions);
2623
+ const partialMatcher = getPartialMatcher(processed.match, matchOptions);
2624
+ const format = buildFormat(cwd, root, absolute);
2625
+ const excludeFormatter = absolute ? format : buildFormat(cwd, root, true);
2626
+ const excludePredicate = (_, p) => {
2627
+ const relativePath = excludeFormatter(p, true);
2628
+ return relativePath !== "." && !partialMatcher(relativePath) || ignore(relativePath);
2629
+ };
2630
+ let maxDepth;
2631
+ if (options.deep !== void 0) maxDepth = Math.round(options.deep - props.depthOffset);
2632
+ const crawler = new Builder({
2633
+ filters: [debug ? (p, isDirectory) => {
2634
+ const path = format(p, isDirectory);
2635
+ const matches = matcher(path) && !ignore(path);
2636
+ if (matches) log(`matched ${path}`);
2637
+ return matches;
2638
+ } : (p, isDirectory) => {
2639
+ const path = format(p, isDirectory);
2640
+ return matcher(path) && !ignore(path);
2641
+ }],
2642
+ exclude: debug ? (_, p) => {
2643
+ const skipped = excludePredicate(_, p);
2644
+ log(`${skipped ? "skipped" : "crawling"} ${p}`);
2645
+ return skipped;
2646
+ } : excludePredicate,
2647
+ fs: options.fs,
2648
+ pathSeparator: "/",
2649
+ relativePaths: !absolute,
2650
+ resolvePaths: absolute,
2651
+ includeBasePath: absolute,
2652
+ resolveSymlinks: followSymbolicLinks,
2653
+ excludeSymlinks: !followSymbolicLinks,
2654
+ excludeFiles: onlyDirectories,
2655
+ includeDirs: onlyDirectories || !options.onlyFiles,
2656
+ maxDepth,
2657
+ signal: options.signal
2658
+ }).crawl(root);
2659
+ if (options.debug) log("internal properties:", {
2660
+ ...props,
2661
+ root
2662
+ });
2663
+ return [crawler, cwd !== root && !absolute && buildRelative(cwd, root)];
2664
+ }
2665
+ function formatPaths(paths, mapper) {
2666
+ if (mapper) for (let i = paths.length - 1; i >= 0; i--) paths[i] = mapper(paths[i]);
2667
+ return paths;
2668
+ }
2669
+ const defaultOptions = {
2670
+ caseSensitiveMatch: true,
2671
+ debug: !!process.env.TINYGLOBBY_DEBUG,
2672
+ expandDirectories: true,
2673
+ followSymbolicLinks: true,
2674
+ onlyFiles: true
2675
+ };
2676
+ function getOptions(options) {
2677
+ const opts = Object.assign({}, options);
2678
+ for (const key in defaultOptions) if (opts[key] === void 0) Object.assign(opts, { [key]: defaultOptions[key] });
2679
+ opts.cwd = (opts.cwd instanceof URL ? fileURLToPath(opts.cwd) : resolve(opts.cwd || process.cwd())).replace(BACKSLASHES, "/");
2680
+ opts.ignore = ensureStringArray(opts.ignore);
2681
+ opts.fs && (opts.fs = {
2682
+ readdir: opts.fs.readdir || readdir,
2683
+ readdirSync: opts.fs.readdirSync || readdirSync,
2684
+ realpath: opts.fs.realpath || realpath,
2685
+ realpathSync: opts.fs.realpathSync || realpathSync,
2686
+ stat: opts.fs.stat || stat,
2687
+ statSync: opts.fs.statSync || statSync
2688
+ });
2689
+ if (opts.debug) log("globbing with options:", opts);
2690
+ return opts;
2691
+ }
2692
+ function getCrawler(globInput, inputOptions = {}) {
2693
+ var _ref;
2694
+ if (globInput && (inputOptions === null || inputOptions === void 0 ? void 0 : inputOptions.patterns)) throw new Error("Cannot pass patterns as both an argument and an option");
2695
+ const isModern = isReadonlyArray(globInput) || typeof globInput === "string";
2696
+ const patterns = ensureStringArray((_ref = isModern ? globInput : globInput.patterns) !== null && _ref !== void 0 ? _ref : "**/*");
2697
+ const options = getOptions(isModern ? inputOptions : globInput);
2698
+ return patterns.length > 0 ? buildCrawler(options, patterns) : [];
2699
+ }
2700
+ function globSync(globInput, options) {
2701
+ const [crawler, relative] = getCrawler(globInput, options);
2702
+ return crawler ? formatPaths(crawler.sync(), relative) : [];
2703
+ }
2704
+ // src/router/email.ts
2705
+ /**
2706
+ * Scan `email/` for inbound email handlers.
2707
+ *
2708
+ * The `email/` directory sits at the source root alongside `crons/` and
2709
+ * `queues/` — non-HTTP handlers all live at the top level, since each is
2710
+ * wired into a separate worker export (`scheduled`, `queue`, `email`).
2711
+ *
2712
+ * email/<local-part>.ts per-recipient handler matched against the
2713
+ * local-part of the To address
2714
+ * email/<local-part>+[tag].ts same, with a `+suffix` capture exposed as
2715
+ * `info.params.<tag>`
2716
+ * email/[name].ts dynamic local-part — captures the whole
2717
+ * local-part as `info.params.<name>`
2718
+ * email/[name]+[tag].ts dynamic + tag
2719
+ * email/_default.ts fallback when no per-address pattern matches
2720
+ *
2721
+ * Match precedence (most specific wins):
2722
+ * static + tag → static → dynamic + tag → dynamic → _default
2723
+ * Within a kind a literal tag beats a captured tag (`support+vip` before
2724
+ * `support+[tag]`, `[user]+vip` before `[user]+[tag]`); the same shape sorts
2725
+ * alphabetically. See `compareEmailRoutes`.
2726
+ *
2727
+ * Local-part matching is case-insensitive: the compiled patterns carry the `i`
2728
+ * flag and run against the recipient in its original case, so a captured tag
2729
+ * such as a ticket id keeps the case it arrived with. Nested folders are
2730
+ * intentionally ignored — the recipient address is a single string, not a path.
2731
+ */
2732
+ const EMAIL_EXTENSIONS = [
2733
+ "ts",
2734
+ "mts",
2735
+ "js",
2736
+ "mjs"
2737
+ ];
2738
+ const PARAM_RE = /^\[([a-z][a-z0-9]*)\]$/;
2739
+ const LITERAL_RE = /^[a-z0-9._-]+$/;
2740
+ function compileSegment(part) {
2741
+ const param = PARAM_RE.exec(part);
2742
+ if (param) return {
2743
+ kind: "param",
2744
+ name: param[1]
2745
+ };
2746
+ if (!LITERAL_RE.test(part)) return null;
2747
+ return {
2748
+ kind: "literal",
2749
+ value: part
2750
+ };
2751
+ }
2752
+ function escapeLiteral(value) {
2753
+ return value.replace(/\./g, "\\.");
2754
+ }
2755
+ function segmentRegex(s) {
2756
+ return s.kind === "literal" ? escapeLiteral(s.value) : "([^+@]+)";
2757
+ }
2758
+ function patternKind(prefix, tag) {
2759
+ const prefixDynamic = prefix.kind === "param";
2760
+ if (tag) return prefixDynamic ? "dynamic-tag" : "static-tag";
2761
+ return prefixDynamic ? "dynamic" : "static";
2762
+ }
2763
+ /**
2764
+ * Compile a basename like `support`, `support+[ticket]`, `[user]`, or
2765
+ * `[user]+[tag]` into a match pattern, or return `null` if the basename
2766
+ * uses characters or shapes outside the supported grammar.
2767
+ */
2768
+ function compileEmailPattern(basename) {
2769
+ const parts = basename.toLowerCase().split("+");
2770
+ if (parts.length > 2) return null;
2771
+ const prefix = compileSegment(parts[0] ?? "");
2772
+ if (!prefix) return null;
2773
+ let tag;
2774
+ if (parts.length === 2) {
2775
+ const compiled = compileSegment(parts[1] ?? "");
2776
+ if (!compiled) return null;
2777
+ tag = compiled;
2778
+ }
2779
+ const paramNames = [];
2780
+ if (prefix.kind === "param") paramNames.push(prefix.name);
2781
+ if (tag?.kind === "param") paramNames.push(tag.name);
2782
+ if (new Set(paramNames).size !== paramNames.length) {
2783
+ const dupes = paramNames.filter((n, i) => paramNames.indexOf(n) !== i);
2784
+ throw new Error(`email handler "${basename}" has duplicate param names: ${dupes.join(", ")}. Each [name] segment must be unique within a single handler filename.`);
2785
+ }
2786
+ const segments = [segmentRegex(prefix)];
2787
+ if (tag) segments.push("\\+", segmentRegex(tag));
2788
+ return {
2789
+ kind: patternKind(prefix, tag),
2790
+ regexSource: `^${segments.join("")}$`,
2791
+ paramNames
2792
+ };
2793
+ }
2794
+ /**
2795
+ * Kind order: most specific first. static-tag beats static (more
2796
+ * constraints), dynamic-tag beats dynamic. Matches the precedence list in
2797
+ * the file header.
2798
+ */
2799
+ const DISPATCH_ORDER = {
2800
+ "static-tag": 0,
2801
+ static: 1,
2802
+ "dynamic-tag": 2,
2803
+ dynamic: 3
2804
+ };
2805
+ /**
2806
+ * The ONE dispatch comparator. The generated `__emailHandler` and the
2807
+ * `createInboundTestHarness` route table both return on the first pattern
2808
+ * that matches, so whatever sorts first owns every address it matches.
2809
+ *
2810
+ * 1. kind, per `DISPATCH_ORDER`
2811
+ * 2. fewer captures first — `support+vip` and `support+[tag]` are both
2812
+ * `static-tag` and both match `support+vip@`; the literal tag must be
2813
+ * tried first or the exact handler is dead code. Same for
2814
+ * `[user]+vip` over `[user]+[tag]`.
2815
+ * 3. alphabetical, so the table is deterministic across filesystems.
2816
+ *
2817
+ * Two patterns with the same regex source share a kind and a capture count,
2818
+ * so the collision check below can still name the alphabetically-first one.
2819
+ */
2820
+ function compareEmailRoutes(a, b) {
2821
+ const kind = DISPATCH_ORDER[a.pattern.kind] - DISPATCH_ORDER[b.pattern.kind];
2822
+ if (kind !== 0) return kind;
2823
+ const captures = a.pattern.paramNames.length - b.pattern.paramNames.length;
2824
+ if (captures !== 0) return captures;
2825
+ return a.address.localeCompare(b.address);
2826
+ }
2827
+ function parseEmailFiles(files) {
2828
+ const addresses = [];
2829
+ let defaultHandler;
2830
+ for (const filePath of files) {
2831
+ if (filePath.includes("/")) continue;
2832
+ const basename = filePath.replace(/\.[^.]+$/, "");
2833
+ if (basename === "_default") {
2834
+ if (defaultHandler !== void 0) throw new Error(`email handler "${filePath}" is a second default handler next to "${defaultHandler}" — keep exactly one email/_default.* file.`);
2835
+ defaultHandler = filePath;
2836
+ continue;
2837
+ }
2838
+ if (basename.startsWith("_")) continue;
2839
+ const pattern = compileEmailPattern(basename);
2840
+ if (!pattern) continue;
2841
+ addresses.push({
2842
+ address: basename.toLowerCase(),
2843
+ filePath,
2844
+ pattern
2845
+ });
2846
+ }
2847
+ addresses.sort(compareEmailRoutes);
2848
+ const seenRegex = /* @__PURE__ */ new Map();
2849
+ for (const def of addresses) {
2850
+ const prior = seenRegex.get(def.pattern.regexSource);
2851
+ if (prior !== void 0) throw new Error(`email handler "${def.filePath}" matches the same address shape as "${prior}" (both compile to ${def.pattern.regexSource}). Rename one of them — only the alphabetically-first would ever fire.`);
2852
+ seenRegex.set(def.pattern.regexSource, def.filePath);
2853
+ }
2854
+ return {
2855
+ addresses,
2856
+ defaultHandler
2857
+ };
2858
+ }
2859
+ function scanEmailHandlersSync(root, emailDir = "email") {
2860
+ return parseEmailFiles(globSync(`*.{${EMAIL_EXTENSIONS.join(",")}}`, { cwd: join(root, emailDir) }));
2861
+ }
2862
+ function hasEmailHandlers(scan) {
2863
+ return scan.addresses.length > 0 || Boolean(scan.defaultHandler);
2864
+ }
2865
+ export { globSync as a, scanEmailHandlersSync as i, compileEmailPattern as n, hasEmailHandlers as r, compareEmailRoutes as t };