@jerryan/just-bash 3.6.1 → 3.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (328) hide show
  1. package/CHANGELOG.md +79 -0
  2. package/README.md +15 -5
  3. package/dist/AGENTS.md +2 -2
  4. package/dist/Bash.d.ts +4 -2
  5. package/dist/bin/chunks/{awk2-KO7ZE3P7.js → awk2-NTRVFXRA.js} +1 -1
  6. package/dist/bin/chunks/chmod-GX5SYTRL.js +3 -0
  7. package/dist/bin/chunks/chunk-2NJJXU4K.js +27 -0
  8. package/dist/bin/{shell/chunks/chunk-ZMGLTHSU.js → chunks/chunk-3ROYEBJI.js} +1 -1
  9. package/dist/bin/chunks/chunk-6FGMEZZP.js +20 -0
  10. package/dist/bin/chunks/chunk-6JUPBMCR.js +13 -0
  11. package/dist/bin/{shell/chunks/chunk-3DWQCLNP.js → chunks/chunk-7WBCA2BB.js} +1 -1
  12. package/dist/bin/chunks/{chunk-LE2XKKGQ.js → chunk-ABP4OLJV.js} +1 -1
  13. package/dist/bin/{shell/chunks/chunk-7PUOS2OO.js → chunks/chunk-ANX7U57Q.js} +1 -1
  14. package/dist/bin/chunks/{chunk-B2GCIQI2.js → chunk-BB5VTPMQ.js} +1 -1
  15. package/dist/bin/chunks/chunk-CN4JKMTR.js +8 -0
  16. package/dist/bin/chunks/{chunk-WFHYGSLJ.js → chunk-CNVNOT67.js} +1 -1
  17. package/dist/bin/{shell/chunks/chunk-6ESRNSO7.js → chunks/chunk-DRPHNXG7.js} +1 -1
  18. package/dist/bin/chunks/chunk-F2PYTUMR.js +9 -0
  19. package/dist/bin/{shell/chunks/chunk-OXLC2WWX.js → chunks/chunk-H7PD6FLC.js} +10 -10
  20. package/dist/bin/chunks/chunk-HWK7KFGB.js +3 -0
  21. package/dist/bin/{shell/chunks/chunk-QYZN33JA.js → chunks/chunk-IOKQFPM6.js} +1 -1
  22. package/dist/bin/chunks/{chunk-M7SIPZZZ.js → chunk-KMYJMEON.js} +1 -1
  23. package/dist/bin/chunks/chunk-KNTDFP7X.js +12 -0
  24. package/dist/bin/{shell/chunks/chunk-RPUFEP5O.js → chunks/chunk-M3Z5NZXT.js} +1 -1
  25. package/dist/bin/chunks/chunk-MBREBDZQ.js +3 -0
  26. package/dist/bin/{shell/chunks/chunk-L345YZ6R.js → chunks/chunk-MF3GVFLC.js} +1 -1
  27. package/dist/bin/{shell/chunks/chunk-YCOJCFGU.js → chunks/chunk-MPFNZYEA.js} +1 -1
  28. package/dist/bin/chunks/chunk-OHFB3M3X.js +3 -0
  29. package/dist/bin/{shell/chunks/chunk-F3UDTTI7.js → chunks/chunk-ONF4KUYV.js} +1 -1
  30. package/dist/bin/chunks/chunk-PPVF2N6C.js +3 -0
  31. package/dist/bin/chunks/{chunk-V2XF3TTW.js → chunk-PRVPFKTC.js} +1 -1
  32. package/dist/bin/{shell/chunks/chunk-7VWOECJ3.js → chunks/chunk-PTUQEN6I.js} +1 -1
  33. package/dist/bin/chunks/{chunk-R2J5MJOM.js → chunk-QFOXSCOD.js} +1 -1
  34. package/dist/bin/{shell/chunks/chunk-6TUILMPB.js → chunks/chunk-QFTZKD5O.js} +1 -1
  35. package/dist/bin/chunks/{chunk-HQ63MFHG.js → chunk-QJWFCA7P.js} +1 -1
  36. package/dist/bin/chunks/chunk-RTN6X652.js +11 -0
  37. package/dist/bin/chunks/{chunk-67XYNGRV.js → chunk-T6OIISUC.js} +1 -1
  38. package/dist/bin/{shell/chunks/chunk-JELR4642.js → chunks/chunk-U5JLGI56.js} +13 -13
  39. package/dist/bin/chunks/{chunk-7PPAWLUI.js → chunk-V4S4A7M6.js} +1 -1
  40. package/dist/bin/{shell/chunks/chunk-DZAFUADN.js → chunks/chunk-VPSBWWXM.js} +1 -1
  41. package/dist/bin/chunks/{chunk-GA5TPRMF.js → chunk-YXPSX3SI.js} +11 -11
  42. package/dist/bin/chunks/{chunk-472JZJ2D.js → chunk-ZVG47PYA.js} +1 -1
  43. package/dist/bin/chunks/cp-YLP7ULVT.js +3 -0
  44. package/dist/bin/{shell/chunks/diff-YXZZCUSQ.js → chunks/diff-JSJ56EOK.js} +1 -1
  45. package/dist/bin/chunks/du-DH76GZJ3.js +3 -0
  46. package/dist/bin/chunks/{expr-NNMDHOCN.js → expr-PQEPO5TE.js} +1 -1
  47. package/dist/bin/chunks/{file-4T64QNLS.js → file-JA7QI2YT.js} +1 -1
  48. package/dist/bin/chunks/find-MHC4QV6H.js +3 -0
  49. package/dist/bin/chunks/flag-coverage-2H5CPEM6.js +3 -0
  50. package/dist/bin/chunks/{grep-CVU5V66H.js → grep-VXWNMIDD.js} +1 -1
  51. package/dist/bin/chunks/gzip-UQZL4R74.js +3 -0
  52. package/dist/bin/chunks/{jq-V7OTAVU5.js → jq-YS4PR46D.js} +1 -1
  53. package/dist/bin/chunks/js-exec-T3SAB2B6.js +1651 -0
  54. package/dist/bin/chunks/ln-XVC53673.js +3 -0
  55. package/dist/bin/chunks/ls-5Z45FV4U.js +3 -0
  56. package/dist/bin/chunks/mkdir-YJ3SOVRP.js +3 -0
  57. package/dist/bin/chunks/mv-EOOP2TO3.js +3 -0
  58. package/dist/bin/chunks/python3-3ERN3L6S.js +23 -0
  59. package/dist/bin/chunks/readlink-EJ3IKLWW.js +3 -0
  60. package/dist/bin/chunks/rg-WHVR3YDT.js +3 -0
  61. package/dist/bin/chunks/rm-B4LVIG7A.js +3 -0
  62. package/dist/bin/chunks/rmdir-PRNISPBA.js +3 -0
  63. package/dist/bin/{shell/chunks/sed-4LVDFHIJ.js → chunks/sed-SY63U2YX.js} +1 -1
  64. package/dist/bin/{shell/chunks/sleep-MOJQBZMY.js → chunks/sleep-DVFE2GSF.js} +1 -1
  65. package/dist/bin/chunks/split-HIFKSV2A.js +3 -0
  66. package/dist/bin/chunks/sqlite3-KNN6V2W6.js +3 -0
  67. package/dist/bin/{shell/chunks/tar-7HGZIMZD.js → chunks/tar-7XOP7VOX.js} +1 -1
  68. package/dist/bin/chunks/{timeout-RQOWSWYG.js → timeout-YGFHQJKX.js} +1 -1
  69. package/dist/bin/chunks/worker.js +120 -109
  70. package/dist/bin/chunks/{xan-WW53ETXT.js → xan-RMH6JEXM.js} +1 -1
  71. package/dist/bin/chunks/{yq-MYZOS2WN.js → yq-CWBZMGUV.js} +1 -1
  72. package/dist/bin/just-bash.js +355 -350
  73. package/dist/bin/shell/chunks/{awk2-KO7ZE3P7.js → awk2-NTRVFXRA.js} +1 -1
  74. package/dist/bin/shell/chunks/chmod-GX5SYTRL.js +3 -0
  75. package/dist/bin/shell/chunks/chunk-2NJJXU4K.js +27 -0
  76. package/dist/bin/{chunks/chunk-ZMGLTHSU.js → shell/chunks/chunk-3ROYEBJI.js} +1 -1
  77. package/dist/bin/shell/chunks/chunk-6FGMEZZP.js +20 -0
  78. package/dist/bin/shell/chunks/chunk-6JUPBMCR.js +13 -0
  79. package/dist/bin/{chunks/chunk-3DWQCLNP.js → shell/chunks/chunk-7WBCA2BB.js} +1 -1
  80. package/dist/bin/shell/chunks/{chunk-LE2XKKGQ.js → chunk-ABP4OLJV.js} +1 -1
  81. package/dist/bin/{chunks/chunk-7PUOS2OO.js → shell/chunks/chunk-ANX7U57Q.js} +1 -1
  82. package/dist/bin/shell/chunks/{chunk-B2GCIQI2.js → chunk-BB5VTPMQ.js} +1 -1
  83. package/dist/bin/shell/chunks/chunk-CN4JKMTR.js +8 -0
  84. package/dist/bin/shell/chunks/{chunk-WFHYGSLJ.js → chunk-CNVNOT67.js} +1 -1
  85. package/dist/bin/{chunks/chunk-6ESRNSO7.js → shell/chunks/chunk-DRPHNXG7.js} +1 -1
  86. package/dist/bin/shell/chunks/chunk-F2PYTUMR.js +9 -0
  87. package/dist/bin/{chunks/chunk-OXLC2WWX.js → shell/chunks/chunk-H7PD6FLC.js} +10 -10
  88. package/dist/bin/shell/chunks/chunk-HWK7KFGB.js +3 -0
  89. package/dist/bin/{chunks/chunk-QYZN33JA.js → shell/chunks/chunk-IOKQFPM6.js} +1 -1
  90. package/dist/bin/shell/chunks/{chunk-M7SIPZZZ.js → chunk-KMYJMEON.js} +1 -1
  91. package/dist/bin/shell/chunks/chunk-KNTDFP7X.js +12 -0
  92. package/dist/bin/{chunks/chunk-RPUFEP5O.js → shell/chunks/chunk-M3Z5NZXT.js} +1 -1
  93. package/dist/bin/shell/chunks/chunk-MBREBDZQ.js +3 -0
  94. package/dist/bin/{chunks/chunk-L345YZ6R.js → shell/chunks/chunk-MF3GVFLC.js} +1 -1
  95. package/dist/bin/{chunks/chunk-YCOJCFGU.js → shell/chunks/chunk-MPFNZYEA.js} +1 -1
  96. package/dist/bin/shell/chunks/chunk-OHFB3M3X.js +3 -0
  97. package/dist/bin/{chunks/chunk-F3UDTTI7.js → shell/chunks/chunk-ONF4KUYV.js} +1 -1
  98. package/dist/bin/shell/chunks/chunk-PPVF2N6C.js +3 -0
  99. package/dist/bin/shell/chunks/{chunk-V2XF3TTW.js → chunk-PRVPFKTC.js} +1 -1
  100. package/dist/bin/{chunks/chunk-7VWOECJ3.js → shell/chunks/chunk-PTUQEN6I.js} +1 -1
  101. package/dist/bin/shell/chunks/{chunk-R2J5MJOM.js → chunk-QFOXSCOD.js} +1 -1
  102. package/dist/bin/{chunks/chunk-6TUILMPB.js → shell/chunks/chunk-QFTZKD5O.js} +1 -1
  103. package/dist/bin/shell/chunks/{chunk-HQ63MFHG.js → chunk-QJWFCA7P.js} +1 -1
  104. package/dist/bin/shell/chunks/chunk-RTN6X652.js +11 -0
  105. package/dist/bin/shell/chunks/{chunk-67XYNGRV.js → chunk-T6OIISUC.js} +1 -1
  106. package/dist/bin/{chunks/chunk-JELR4642.js → shell/chunks/chunk-U5JLGI56.js} +13 -13
  107. package/dist/bin/shell/chunks/{chunk-7PPAWLUI.js → chunk-V4S4A7M6.js} +1 -1
  108. package/dist/bin/{chunks/chunk-DZAFUADN.js → shell/chunks/chunk-VPSBWWXM.js} +1 -1
  109. package/dist/bin/shell/chunks/{chunk-GA5TPRMF.js → chunk-YXPSX3SI.js} +11 -11
  110. package/dist/bin/shell/chunks/{chunk-472JZJ2D.js → chunk-ZVG47PYA.js} +1 -1
  111. package/dist/bin/shell/chunks/cp-YLP7ULVT.js +3 -0
  112. package/dist/bin/{chunks/diff-YXZZCUSQ.js → shell/chunks/diff-JSJ56EOK.js} +1 -1
  113. package/dist/bin/shell/chunks/du-DH76GZJ3.js +3 -0
  114. package/dist/bin/shell/chunks/{expr-NNMDHOCN.js → expr-PQEPO5TE.js} +1 -1
  115. package/dist/bin/shell/chunks/{file-4T64QNLS.js → file-JA7QI2YT.js} +1 -1
  116. package/dist/bin/shell/chunks/find-MHC4QV6H.js +3 -0
  117. package/dist/bin/shell/chunks/flag-coverage-2H5CPEM6.js +3 -0
  118. package/dist/bin/shell/chunks/{grep-CVU5V66H.js → grep-VXWNMIDD.js} +1 -1
  119. package/dist/bin/shell/chunks/gzip-UQZL4R74.js +3 -0
  120. package/dist/bin/shell/chunks/{jq-V7OTAVU5.js → jq-YS4PR46D.js} +1 -1
  121. package/dist/bin/shell/chunks/js-exec-T3SAB2B6.js +1651 -0
  122. package/dist/bin/shell/chunks/ln-XVC53673.js +3 -0
  123. package/dist/bin/shell/chunks/ls-5Z45FV4U.js +3 -0
  124. package/dist/bin/shell/chunks/mkdir-YJ3SOVRP.js +3 -0
  125. package/dist/bin/shell/chunks/mv-EOOP2TO3.js +3 -0
  126. package/dist/bin/shell/chunks/python3-3ERN3L6S.js +23 -0
  127. package/dist/bin/shell/chunks/readlink-EJ3IKLWW.js +3 -0
  128. package/dist/bin/shell/chunks/rg-WHVR3YDT.js +3 -0
  129. package/dist/bin/shell/chunks/rm-B4LVIG7A.js +3 -0
  130. package/dist/bin/shell/chunks/rmdir-PRNISPBA.js +3 -0
  131. package/dist/bin/{chunks/sed-4LVDFHIJ.js → shell/chunks/sed-SY63U2YX.js} +1 -1
  132. package/dist/bin/{chunks/sleep-MOJQBZMY.js → shell/chunks/sleep-DVFE2GSF.js} +1 -1
  133. package/dist/bin/shell/chunks/split-HIFKSV2A.js +3 -0
  134. package/dist/bin/shell/chunks/sqlite3-KNN6V2W6.js +3 -0
  135. package/dist/bin/{chunks/tar-7HGZIMZD.js → shell/chunks/tar-7XOP7VOX.js} +1 -1
  136. package/dist/bin/shell/chunks/{timeout-RQOWSWYG.js → timeout-YGFHQJKX.js} +1 -1
  137. package/dist/bin/shell/chunks/{xan-WW53ETXT.js → xan-RMH6JEXM.js} +1 -1
  138. package/dist/bin/shell/chunks/{yq-MYZOS2WN.js → yq-CWBZMGUV.js} +1 -1
  139. package/dist/bin/shell/shell.js +397 -392
  140. package/dist/bundle/browser.js +693 -669
  141. package/dist/bundle/chunks/{awk2-W6BNZEJN.js → awk2-VS5QVYHU.js} +1 -1
  142. package/dist/bundle/chunks/chmod-TEY5MD2W.js +2 -0
  143. package/dist/bundle/chunks/{chunk-26GP3ACY.js → chunk-35MBA3VY.js} +1 -1
  144. package/dist/bundle/chunks/chunk-3CIDHL5V.js +11 -0
  145. package/dist/bundle/chunks/chunk-3OBCZP7T.js +12 -0
  146. package/dist/bundle/chunks/{chunk-F6XU52K3.js → chunk-45QZRGYF.js} +1 -1
  147. package/dist/bundle/chunks/chunk-4CC3OZPU.js +2 -0
  148. package/dist/bundle/chunks/{chunk-73JQKNZT.js → chunk-4KZT23KR.js} +11 -11
  149. package/dist/bundle/chunks/{chunk-PJM5C3HZ.js → chunk-5EI7WSRV.js} +10 -10
  150. package/dist/bundle/chunks/{chunk-T6DNSPYO.js → chunk-6BSOPPZH.js} +1 -1
  151. package/dist/bundle/chunks/{chunk-DAKEIWT3.js → chunk-6HO6HX7V.js} +1 -1
  152. package/dist/bundle/chunks/{chunk-XVSR5HHH.js → chunk-6QAM55HM.js} +1 -1
  153. package/dist/bundle/chunks/chunk-A257L6QO.js +7 -0
  154. package/dist/bundle/chunks/{chunk-UC76ZOWM.js → chunk-ATGOUOX2.js} +1 -1
  155. package/dist/bundle/chunks/chunk-B6OSJB22.js +26 -0
  156. package/dist/bundle/chunks/{chunk-2TSZPVPI.js → chunk-BLPYR4TN.js} +1 -1
  157. package/dist/bundle/chunks/{chunk-VJ6UXG2R.js → chunk-CH7SUFFO.js} +1 -1
  158. package/dist/bundle/chunks/{chunk-FQUVK4Q5.js → chunk-DDPD7SIB.js} +1 -1
  159. package/dist/bundle/chunks/{chunk-TLPMB3FO.js → chunk-DMWNBCXJ.js} +1 -1
  160. package/dist/bundle/chunks/{chunk-ZXFELXJH.js → chunk-FSKXIFYT.js} +1 -1
  161. package/dist/bundle/chunks/{chunk-KEMO3CBM.js → chunk-GNPLDVBD.js} +1 -1
  162. package/dist/bundle/chunks/{chunk-FZZL53S2.js → chunk-GRUZ4SBY.js} +1 -1
  163. package/dist/bundle/chunks/{chunk-RPKJJFGZ.js → chunk-HCKTU6IR.js} +1 -1
  164. package/dist/bundle/chunks/{chunk-4EDQZIAN.js → chunk-LGIJSCWH.js} +1 -1
  165. package/dist/bundle/chunks/chunk-LRFR25IP.js +8 -0
  166. package/dist/bundle/chunks/chunk-MWL2I5BV.js +19 -0
  167. package/dist/bundle/chunks/{chunk-6IA4DXG2.js → chunk-N3A4JVFJ.js} +1 -1
  168. package/dist/bundle/chunks/{chunk-PPEXVPHR.js → chunk-O452S4KX.js} +1 -1
  169. package/dist/bundle/chunks/chunk-RWQWFXMH.js +10 -0
  170. package/dist/bundle/chunks/chunk-S6DNKKUL.js +2 -0
  171. package/dist/bundle/chunks/{chunk-NBNI7G66.js → chunk-SE23TEGG.js} +1 -1
  172. package/dist/bundle/chunks/chunk-T5ZEIOJ3.js +2 -0
  173. package/dist/bundle/chunks/{chunk-ULXTDFQC.js → chunk-U57DSHID.js} +1 -1
  174. package/dist/bundle/chunks/{chunk-6DDRR56B.js → chunk-WE7BJ7YU.js} +1 -1
  175. package/dist/bundle/chunks/chunk-WXPNKIIH.js +2 -0
  176. package/dist/bundle/chunks/{chunk-5I5U6IYI.js → chunk-XQ2ZZFO6.js} +1 -1
  177. package/dist/bundle/chunks/{chunk-YFFU74KY.js → chunk-XV2V56NQ.js} +1 -1
  178. package/dist/bundle/chunks/{chunk-FIMF2TLE.js → chunk-Y6JBSHCM.js} +13 -13
  179. package/dist/bundle/chunks/cp-UR762VVT.js +2 -0
  180. package/dist/bundle/chunks/{diff-CSARC7WF.js → diff-VDB6RXHO.js} +1 -1
  181. package/dist/bundle/chunks/du-EQKH3UNA.js +2 -0
  182. package/dist/bundle/chunks/{expr-XSBELPAC.js → expr-A5XITHQD.js} +1 -1
  183. package/dist/bundle/chunks/{file-URNAD6FQ.js → file-6AYYTULJ.js} +1 -1
  184. package/dist/bundle/chunks/find-RLKBCGJR.js +2 -0
  185. package/dist/bundle/chunks/flag-coverage-UMQ3BWDP.js +2 -0
  186. package/dist/bundle/chunks/{grep-4AYF3A5J.js → grep-Q2O5EIXQ.js} +1 -1
  187. package/dist/bundle/chunks/gzip-KC5ENBD2.js +2 -0
  188. package/dist/bundle/chunks/{jq-NY7PCVMH.js → jq-UKAA3QWU.js} +1 -1
  189. package/dist/bundle/chunks/js-exec-ZQMIYQTH.js +1650 -0
  190. package/dist/bundle/chunks/ln-CEM7GDB5.js +2 -0
  191. package/dist/bundle/chunks/ls-WH5S4PPL.js +2 -0
  192. package/dist/bundle/chunks/mkdir-Z6MMWH3D.js +2 -0
  193. package/dist/bundle/chunks/mv-WE7DBLEK.js +2 -0
  194. package/dist/bundle/chunks/python3-QB7OE256.js +22 -0
  195. package/dist/bundle/chunks/readlink-JSRKXLLQ.js +2 -0
  196. package/dist/bundle/chunks/rg-JKB7DR66.js +2 -0
  197. package/dist/bundle/chunks/rm-IGPLE632.js +2 -0
  198. package/dist/bundle/chunks/rmdir-3WTXMVKI.js +2 -0
  199. package/dist/bundle/chunks/{sed-LIRH26EA.js → sed-6G32B25J.js} +1 -1
  200. package/dist/bundle/chunks/{sleep-25QUPVDK.js → sleep-PPRBTSVR.js} +1 -1
  201. package/dist/bundle/chunks/split-HUKVGJTW.js +2 -0
  202. package/dist/bundle/chunks/sqlite3-KB3MXTTM.js +2 -0
  203. package/dist/bundle/chunks/{tar-B72KU357.js → tar-LE7LAAIX.js} +1 -1
  204. package/dist/bundle/chunks/{timeout-37GM7IIL.js → timeout-C6WDYPLV.js} +1 -1
  205. package/dist/bundle/chunks/worker.js +120 -109
  206. package/dist/bundle/chunks/{xan-UIGVJCMA.js → xan-UIL24CGT.js} +1 -1
  207. package/dist/bundle/chunks/{yq-FGNXZCGX.js → yq-ZRNZKDLE.js} +1 -1
  208. package/dist/bundle/index.cjs +2677 -1101
  209. package/dist/bundle/index.js +346 -341
  210. package/dist/commands/diff/format.d.ts +46 -0
  211. package/dist/commands/js-exec/js-exec.d.ts +1 -14
  212. package/dist/commands/js-exec/run-runtime.d.ts +10 -0
  213. package/dist/commands/worker-bridge/bridge-handler.d.ts +0 -3
  214. package/dist/commands/worker-bridge/protocol.d.ts +57 -23
  215. package/dist/fs/fs-error.d.ts +43 -0
  216. package/dist/fs/interface.d.ts +13 -0
  217. package/dist/fs/mountable-fs/mountable-fs.d.ts +20 -0
  218. package/dist/fs/overlay-fs/apply.d.ts +2 -1
  219. package/dist/fs/overlay-fs/index.d.ts +0 -1
  220. package/dist/fs/overlay-fs/overlay-fs.d.ts +14 -0
  221. package/dist/fs/path-utils.d.ts +5 -0
  222. package/dist/fs/traversal.d.ts +9 -0
  223. package/dist/fs/vfs-template.d.ts +38 -15
  224. package/dist/index.d.cts +2 -1
  225. package/dist/index.d.ts +2 -1
  226. package/dist/interpreter/builtin-dispatch.d.ts +10 -0
  227. package/dist/interpreter/builtin-manifest.d.ts +273 -0
  228. package/dist/interpreter/builtins/help.d.ts +6 -0
  229. package/dist/interpreter/builtins/shopt.d.ts +3 -0
  230. package/dist/interpreter/helpers/shell-constants.d.ts +0 -20
  231. package/dist/interpreter/helpers/substitution-status.d.ts +34 -0
  232. package/dist/interpreter/interpreter.d.ts +1 -1
  233. package/dist/interpreter/types.d.ts +8 -1
  234. package/dist/limits.d.ts +2 -0
  235. package/dist/timers.d.ts +0 -9
  236. package/dist/types.d.ts +4 -3
  237. package/package.json +8 -8
  238. package/dist/bin/chunks/chmod-WYYTXGVB.js +0 -3
  239. package/dist/bin/chunks/chunk-23OI2XDJ.js +0 -20
  240. package/dist/bin/chunks/chunk-43E7AR6A.js +0 -3
  241. package/dist/bin/chunks/chunk-AI7JUA46.js +0 -13
  242. package/dist/bin/chunks/chunk-CL7IYCGG.js +0 -20
  243. package/dist/bin/chunks/chunk-GQKQEK5N.js +0 -11
  244. package/dist/bin/chunks/chunk-JHEAT7AR.js +0 -12
  245. package/dist/bin/chunks/chunk-OLEQNRKX.js +0 -8
  246. package/dist/bin/chunks/chunk-QKJAAJ7J.js +0 -3
  247. package/dist/bin/chunks/chunk-SE7JHGP3.js +0 -9
  248. package/dist/bin/chunks/chunk-WEHA3JFD.js +0 -3
  249. package/dist/bin/chunks/chunk-YQEKKZTU.js +0 -12
  250. package/dist/bin/chunks/cp-OMVKM35F.js +0 -3
  251. package/dist/bin/chunks/du-LUFPVLNW.js +0 -3
  252. package/dist/bin/chunks/find-AWH2KOY7.js +0 -3
  253. package/dist/bin/chunks/flag-coverage-FYJ2V7J4.js +0 -3
  254. package/dist/bin/chunks/gzip-FDPA6EKG.js +0 -3
  255. package/dist/bin/chunks/js-exec-5QZZCOR7.js +0 -99
  256. package/dist/bin/chunks/js-exec-worker.js +0 -4931
  257. package/dist/bin/chunks/ln-B35EKC2Q.js +0 -3
  258. package/dist/bin/chunks/ls-Q6ZZ6SQ2.js +0 -3
  259. package/dist/bin/chunks/mkdir-74BP5NTG.js +0 -3
  260. package/dist/bin/chunks/mv-76LAHXFR.js +0 -3
  261. package/dist/bin/chunks/python3-TMFYDQAP.js +0 -14
  262. package/dist/bin/chunks/readlink-EHXJNW62.js +0 -3
  263. package/dist/bin/chunks/rg-PXNKNIMY.js +0 -3
  264. package/dist/bin/chunks/rm-NLG5344W.js +0 -3
  265. package/dist/bin/chunks/rmdir-7ZIVFZJX.js +0 -3
  266. package/dist/bin/chunks/split-ZNNNHKSP.js +0 -3
  267. package/dist/bin/chunks/sqlite3-3EUPHVEZ.js +0 -3
  268. package/dist/bin/shell/chunks/chmod-WYYTXGVB.js +0 -3
  269. package/dist/bin/shell/chunks/chunk-23OI2XDJ.js +0 -20
  270. package/dist/bin/shell/chunks/chunk-43E7AR6A.js +0 -3
  271. package/dist/bin/shell/chunks/chunk-AI7JUA46.js +0 -13
  272. package/dist/bin/shell/chunks/chunk-CL7IYCGG.js +0 -20
  273. package/dist/bin/shell/chunks/chunk-GQKQEK5N.js +0 -11
  274. package/dist/bin/shell/chunks/chunk-JHEAT7AR.js +0 -12
  275. package/dist/bin/shell/chunks/chunk-OLEQNRKX.js +0 -8
  276. package/dist/bin/shell/chunks/chunk-QKJAAJ7J.js +0 -3
  277. package/dist/bin/shell/chunks/chunk-SE7JHGP3.js +0 -9
  278. package/dist/bin/shell/chunks/chunk-WEHA3JFD.js +0 -3
  279. package/dist/bin/shell/chunks/chunk-YQEKKZTU.js +0 -12
  280. package/dist/bin/shell/chunks/cp-OMVKM35F.js +0 -3
  281. package/dist/bin/shell/chunks/du-LUFPVLNW.js +0 -3
  282. package/dist/bin/shell/chunks/find-AWH2KOY7.js +0 -3
  283. package/dist/bin/shell/chunks/flag-coverage-FYJ2V7J4.js +0 -3
  284. package/dist/bin/shell/chunks/gzip-FDPA6EKG.js +0 -3
  285. package/dist/bin/shell/chunks/js-exec-5QZZCOR7.js +0 -99
  286. package/dist/bin/shell/chunks/ln-B35EKC2Q.js +0 -3
  287. package/dist/bin/shell/chunks/ls-Q6ZZ6SQ2.js +0 -3
  288. package/dist/bin/shell/chunks/mkdir-74BP5NTG.js +0 -3
  289. package/dist/bin/shell/chunks/mv-76LAHXFR.js +0 -3
  290. package/dist/bin/shell/chunks/python3-TMFYDQAP.js +0 -14
  291. package/dist/bin/shell/chunks/readlink-EHXJNW62.js +0 -3
  292. package/dist/bin/shell/chunks/rg-PXNKNIMY.js +0 -3
  293. package/dist/bin/shell/chunks/rm-NLG5344W.js +0 -3
  294. package/dist/bin/shell/chunks/rmdir-7ZIVFZJX.js +0 -3
  295. package/dist/bin/shell/chunks/split-ZNNNHKSP.js +0 -3
  296. package/dist/bin/shell/chunks/sqlite3-3EUPHVEZ.js +0 -3
  297. package/dist/bundle/chunks/chmod-WM2JFFQC.js +0 -2
  298. package/dist/bundle/chunks/chunk-7IJWBG4I.js +0 -2
  299. package/dist/bundle/chunks/chunk-FSJ6TTCC.js +0 -19
  300. package/dist/bundle/chunks/chunk-G3IRZ4FN.js +0 -8
  301. package/dist/bundle/chunks/chunk-MLIO3BK2.js +0 -7
  302. package/dist/bundle/chunks/chunk-PS2RJNZZ.js +0 -2
  303. package/dist/bundle/chunks/chunk-TBVD66LC.js +0 -10
  304. package/dist/bundle/chunks/chunk-ULXGGWAD.js +0 -11
  305. package/dist/bundle/chunks/chunk-UTKGYVUZ.js +0 -7
  306. package/dist/bundle/chunks/chunk-W2Z6LYL6.js +0 -11
  307. package/dist/bundle/chunks/chunk-WN54B5NQ.js +0 -12
  308. package/dist/bundle/chunks/chunk-YUSFCOM7.js +0 -2
  309. package/dist/bundle/chunks/cp-2KZIPZJS.js +0 -2
  310. package/dist/bundle/chunks/du-7AZCLKR6.js +0 -2
  311. package/dist/bundle/chunks/find-END3EAHV.js +0 -2
  312. package/dist/bundle/chunks/flag-coverage-XSPWRCVG.js +0 -2
  313. package/dist/bundle/chunks/gzip-RQOBR22H.js +0 -2
  314. package/dist/bundle/chunks/js-exec-57QMXJG5.js +0 -98
  315. package/dist/bundle/chunks/js-exec-worker.js +0 -4931
  316. package/dist/bundle/chunks/ln-OPY2ZVGQ.js +0 -2
  317. package/dist/bundle/chunks/ls-ZPXGZX63.js +0 -2
  318. package/dist/bundle/chunks/mkdir-WDDKK2P3.js +0 -2
  319. package/dist/bundle/chunks/mv-ZF6UBVRB.js +0 -2
  320. package/dist/bundle/chunks/python3-NNONJINM.js +0 -13
  321. package/dist/bundle/chunks/readlink-U5OM5A3M.js +0 -2
  322. package/dist/bundle/chunks/rg-NAMXBYKS.js +0 -2
  323. package/dist/bundle/chunks/rm-R2ZENNSN.js +0 -2
  324. package/dist/bundle/chunks/rmdir-YJKPQVCK.js +0 -2
  325. package/dist/bundle/chunks/split-JICLAMP6.js +0 -2
  326. package/dist/bundle/chunks/sqlite3-M4UZPXDO.js +0 -2
  327. package/dist/commands/js-exec/js-exec-worker.d.ts +0 -33
  328. package/dist/fs/overlay-fs/merge.d.ts +0 -24
@@ -0,0 +1,1651 @@
1
+ #!/usr/bin/env node
2
+ import{createRequire} from"node:module";const require=createRequire(import.meta.url);
3
+ import{a as ve}from"./chunk-3MRB66F4.js";import{a as me}from"./chunk-3PCPQIUD.js";import{c as pe,d as he}from"./chunk-PPVF2N6C.js";import{a as Se}from"./chunk-MROECM42.js";import{b as w}from"./chunk-HWI42GQO.js";import{b as Y}from"./chunk-CPKBPQ2C.js";import{a as be,b as ge}from"./chunk-OHFB3M3X.js";import{a as S,b as D}from"./chunk-PBOVSFTJ.js";import{a as T}from"./chunk-I4IRHQDW.js";import{b as ye}from"./chunk-MUFNRCMY.js";import"./chunk-DN2YCFOR.js";import{AsyncLocalStorage as et}from"node:async_hooks";import{Buffer as m}from"node:buffer";import{createRunner as tt,getHostFunctionContext as F,RunAbortedError as rt,RunBridgeLimitError as nt,RunError as st,RunTimeoutError as Oe}from"run";var _e=`
4
+ (function() {
5
+ // --- URLSearchParams ---
6
+ function URLSearchParams(init) {
7
+ this._entries = [];
8
+ if (!init) return;
9
+ if (typeof init === 'string') {
10
+ var s = init;
11
+ if (s.charAt(0) === '?') s = s.slice(1);
12
+ var pairs = s.split('&');
13
+ for (var i = 0; i < pairs.length; i++) {
14
+ var pair = pairs[i];
15
+ if (pair === '') continue;
16
+ var eq = pair.indexOf('=');
17
+ if (eq === -1) {
18
+ this._entries.push([decodeURIComponent(pair), '']);
19
+ } else {
20
+ this._entries.push([
21
+ decodeURIComponent(pair.slice(0, eq)),
22
+ decodeURIComponent(pair.slice(eq + 1))
23
+ ]);
24
+ }
25
+ }
26
+ } else if (typeof init === 'object' && init !== null) {
27
+ if (init instanceof URLSearchParams) {
28
+ this._entries = init._entries.slice();
29
+ } else {
30
+ var keys = Object.keys(init);
31
+ for (var i = 0; i < keys.length; i++) {
32
+ this._entries.push([keys[i], String(init[keys[i]])]);
33
+ }
34
+ }
35
+ }
36
+ }
37
+
38
+ URLSearchParams.prototype.append = function(name, value) {
39
+ this._entries.push([String(name), String(value)]);
40
+ };
41
+
42
+ URLSearchParams.prototype.delete = function(name) {
43
+ var n = String(name);
44
+ this._entries = this._entries.filter(function(e) { return e[0] !== n; });
45
+ };
46
+
47
+ URLSearchParams.prototype.get = function(name) {
48
+ var n = String(name);
49
+ for (var i = 0; i < this._entries.length; i++) {
50
+ if (this._entries[i][0] === n) return this._entries[i][1];
51
+ }
52
+ return null;
53
+ };
54
+
55
+ URLSearchParams.prototype.getAll = function(name) {
56
+ var n = String(name);
57
+ var result = [];
58
+ for (var i = 0; i < this._entries.length; i++) {
59
+ if (this._entries[i][0] === n) result.push(this._entries[i][1]);
60
+ }
61
+ return result;
62
+ };
63
+
64
+ URLSearchParams.prototype.has = function(name) {
65
+ var n = String(name);
66
+ for (var i = 0; i < this._entries.length; i++) {
67
+ if (this._entries[i][0] === n) return true;
68
+ }
69
+ return false;
70
+ };
71
+
72
+ URLSearchParams.prototype.set = function(name, value) {
73
+ var n = String(name);
74
+ var v = String(value);
75
+ var found = false;
76
+ var newEntries = [];
77
+ for (var i = 0; i < this._entries.length; i++) {
78
+ if (this._entries[i][0] === n) {
79
+ if (!found) {
80
+ newEntries.push([n, v]);
81
+ found = true;
82
+ }
83
+ } else {
84
+ newEntries.push(this._entries[i]);
85
+ }
86
+ }
87
+ if (!found) newEntries.push([n, v]);
88
+ this._entries = newEntries;
89
+ };
90
+
91
+ URLSearchParams.prototype.sort = function() {
92
+ this._entries.sort(function(a, b) {
93
+ if (a[0] < b[0]) return -1;
94
+ if (a[0] > b[0]) return 1;
95
+ return 0;
96
+ });
97
+ };
98
+
99
+ URLSearchParams.prototype.toString = function() {
100
+ return this._entries.map(function(e) {
101
+ return encodeURIComponent(e[0]) + '=' + encodeURIComponent(e[1]);
102
+ }).join('&');
103
+ };
104
+
105
+ URLSearchParams.prototype.forEach = function(callback, thisArg) {
106
+ for (var i = 0; i < this._entries.length; i++) {
107
+ callback.call(thisArg, this._entries[i][1], this._entries[i][0], this);
108
+ }
109
+ };
110
+
111
+ URLSearchParams.prototype.entries = function() {
112
+ var idx = 0;
113
+ var entries = this._entries;
114
+ return {
115
+ next: function() {
116
+ if (idx >= entries.length) return { done: true, value: undefined };
117
+ return { done: false, value: entries[idx++].slice() };
118
+ },
119
+ [Symbol.iterator]: function() { return this; }
120
+ };
121
+ };
122
+
123
+ URLSearchParams.prototype.keys = function() {
124
+ var idx = 0;
125
+ var entries = this._entries;
126
+ return {
127
+ next: function() {
128
+ if (idx >= entries.length) return { done: true, value: undefined };
129
+ return { done: false, value: entries[idx++][0] };
130
+ },
131
+ [Symbol.iterator]: function() { return this; }
132
+ };
133
+ };
134
+
135
+ URLSearchParams.prototype.values = function() {
136
+ var idx = 0;
137
+ var entries = this._entries;
138
+ return {
139
+ next: function() {
140
+ if (idx >= entries.length) return { done: true, value: undefined };
141
+ return { done: false, value: entries[idx++][1] };
142
+ },
143
+ [Symbol.iterator]: function() { return this; }
144
+ };
145
+ };
146
+
147
+ URLSearchParams.prototype[Symbol.iterator] = URLSearchParams.prototype.entries;
148
+
149
+ Object.defineProperty(URLSearchParams.prototype, 'size', {
150
+ get: function() { return this._entries.length; }
151
+ });
152
+
153
+ // --- URL ---
154
+ var urlRegex = /^([a-zA-Z][a-zA-Z0-9+.-]*):(?:\\/\\/(?:([^:@/?#]*)(?::([^@/?#]*))?@)?([^:/?#]*)(?::([0-9]+))?)?(\\/[^?#]*)?(?:\\?([^#]*))?(?:#(.*))?$/;
155
+
156
+ function URL(url, base) {
157
+ var input = String(url);
158
+
159
+ if (base !== undefined) {
160
+ var baseUrl = (base instanceof URL) ? base : new URL(String(base));
161
+ // Resolve relative URL against base
162
+ if (/^[a-zA-Z][a-zA-Z0-9+.-]*:/.test(input)) {
163
+ // Absolute URL - parse as-is
164
+ } else if (input.charAt(0) === '/' && input.charAt(1) === '/') {
165
+ // Protocol-relative
166
+ input = baseUrl.protocol + input;
167
+ } else if (input.charAt(0) === '/') {
168
+ // Absolute path
169
+ input = baseUrl.origin + input;
170
+ } else if (input.charAt(0) === '?' || input.charAt(0) === '#') {
171
+ // Query or hash only
172
+ var basePath = baseUrl.protocol + '//' + baseUrl.host + baseUrl.pathname;
173
+ if (input.charAt(0) === '#') {
174
+ input = basePath + baseUrl.search + input;
175
+ } else {
176
+ input = basePath + input;
177
+ }
178
+ } else {
179
+ // Relative path
180
+ var basePath = baseUrl.protocol + '//' + baseUrl.host;
181
+ var dirPath = baseUrl.pathname;
182
+ var lastSlash = dirPath.lastIndexOf('/');
183
+ if (lastSlash >= 0) dirPath = dirPath.slice(0, lastSlash + 1);
184
+ else dirPath = '/';
185
+ input = basePath + dirPath + input;
186
+ }
187
+ }
188
+
189
+ var m = urlRegex.exec(input);
190
+ if (!m) throw new TypeError("Invalid URL: " + String(url));
191
+
192
+ this.protocol = m[1].toLowerCase() + ':';
193
+ this.username = m[2] ? decodeURIComponent(m[2]) : '';
194
+ this.password = m[3] ? decodeURIComponent(m[3]) : '';
195
+ this.hostname = m[4] || '';
196
+ this.port = m[5] || '';
197
+ this.pathname = m[6] || '/';
198
+ this.hash = m[8] ? '#' + m[8] : '';
199
+
200
+ // Normalize pathname (resolve . and ..)
201
+ var parts = this.pathname.split('/');
202
+ var resolved = [];
203
+ for (var i = 0; i < parts.length; i++) {
204
+ if (parts[i] === '..') { if (resolved.length > 1) resolved.pop(); }
205
+ else if (parts[i] !== '.') resolved.push(parts[i]);
206
+ }
207
+ this.pathname = resolved.join('/') || '/';
208
+
209
+ // searchParams is live
210
+ this._searchParamsStr = m[7] || '';
211
+ this.searchParams = new URLSearchParams(this._searchParamsStr);
212
+ }
213
+
214
+ Object.defineProperty(URL.prototype, 'search', {
215
+ get: function() {
216
+ var s = this.searchParams.toString();
217
+ return s ? '?' + s : '';
218
+ },
219
+ set: function(v) {
220
+ this.searchParams = new URLSearchParams(String(v));
221
+ }
222
+ });
223
+
224
+ Object.defineProperty(URL.prototype, 'host', {
225
+ get: function() {
226
+ return this.port ? this.hostname + ':' + this.port : this.hostname;
227
+ }
228
+ });
229
+
230
+ Object.defineProperty(URL.prototype, 'origin', {
231
+ get: function() {
232
+ return this.protocol + '//' + this.host;
233
+ }
234
+ });
235
+
236
+ Object.defineProperty(URL.prototype, 'href', {
237
+ get: function() {
238
+ var auth = '';
239
+ if (this.username) {
240
+ auth = this.username;
241
+ if (this.password) auth += ':' + this.password;
242
+ auth += '@';
243
+ }
244
+ return this.protocol + '//' + auth + this.host + this.pathname + this.search + this.hash;
245
+ },
246
+ set: function(v) {
247
+ var parsed = new URL(String(v));
248
+ this.protocol = parsed.protocol;
249
+ this.username = parsed.username;
250
+ this.password = parsed.password;
251
+ this.hostname = parsed.hostname;
252
+ this.port = parsed.port;
253
+ this.pathname = parsed.pathname;
254
+ this.searchParams = parsed.searchParams;
255
+ this.hash = parsed.hash;
256
+ }
257
+ });
258
+
259
+ URL.prototype.toString = function() { return this.href; };
260
+ URL.prototype.toJSON = function() { return this.href; };
261
+
262
+ // --- Headers ---
263
+ function Headers(init) {
264
+ this._map = Object.create(null);
265
+ if (!init) return;
266
+ if (init instanceof Headers) {
267
+ var keys = Object.keys(init._map);
268
+ for (var i = 0; i < keys.length; i++) {
269
+ this._map[keys[i]] = init._map[keys[i]].slice();
270
+ }
271
+ } else if (typeof init === 'object') {
272
+ var keys = Object.keys(init);
273
+ for (var i = 0; i < keys.length; i++) {
274
+ this._map[keys[i].toLowerCase()] = [String(init[keys[i]])];
275
+ }
276
+ }
277
+ }
278
+
279
+ Headers.prototype.append = function(name, value) {
280
+ var key = String(name).toLowerCase();
281
+ if (!Object.prototype.hasOwnProperty.call(this._map, key)) this._map[key] = [];
282
+ this._map[key].push(String(value));
283
+ };
284
+
285
+ Headers.prototype.delete = function(name) {
286
+ delete this._map[String(name).toLowerCase()];
287
+ };
288
+
289
+ Headers.prototype.get = function(name) {
290
+ var vals = this._map[String(name).toLowerCase()];
291
+ return vals ? vals.join(', ') : null;
292
+ };
293
+
294
+ Headers.prototype.has = function(name) {
295
+ return Object.prototype.hasOwnProperty.call(this._map, String(name).toLowerCase());
296
+ };
297
+
298
+ Headers.prototype.set = function(name, value) {
299
+ this._map[String(name).toLowerCase()] = [String(value)];
300
+ };
301
+
302
+ Headers.prototype.forEach = function(callback, thisArg) {
303
+ var keys = Object.keys(this._map).sort();
304
+ for (var i = 0; i < keys.length; i++) {
305
+ callback.call(thisArg, this._map[keys[i]].join(', '), keys[i], this);
306
+ }
307
+ };
308
+
309
+ Headers.prototype.entries = function() {
310
+ var keys = Object.keys(this._map).sort();
311
+ var map = this._map;
312
+ var idx = 0;
313
+ return {
314
+ next: function() {
315
+ if (idx >= keys.length) return { done: true, value: undefined };
316
+ var k = keys[idx++];
317
+ return { done: false, value: [k, map[k].join(', ')] };
318
+ },
319
+ [Symbol.iterator]: function() { return this; }
320
+ };
321
+ };
322
+
323
+ Headers.prototype.keys = function() {
324
+ var keys = Object.keys(this._map).sort();
325
+ var idx = 0;
326
+ return {
327
+ next: function() {
328
+ if (idx >= keys.length) return { done: true, value: undefined };
329
+ return { done: false, value: keys[idx++] };
330
+ },
331
+ [Symbol.iterator]: function() { return this; }
332
+ };
333
+ };
334
+
335
+ Headers.prototype.values = function() {
336
+ var keys = Object.keys(this._map).sort();
337
+ var map = this._map;
338
+ var idx = 0;
339
+ return {
340
+ next: function() {
341
+ if (idx >= keys.length) return { done: true, value: undefined };
342
+ return { done: false, value: map[keys[idx++]].join(', ') };
343
+ },
344
+ [Symbol.iterator]: function() { return this; }
345
+ };
346
+ };
347
+
348
+ Headers.prototype[Symbol.iterator] = Headers.prototype.entries;
349
+
350
+ // --- Response ---
351
+ function Response(body, init) {
352
+ if (init === undefined) init = {};
353
+ this.status = init.status !== undefined ? init.status : 200;
354
+ this.statusText = init.statusText !== undefined ? init.statusText : '';
355
+ this.headers = init.headers instanceof Headers ? init.headers : new Headers(init.headers);
356
+ this.body = body !== undefined && body !== null ? String(body) : '';
357
+ this.ok = this.status >= 200 && this.status <= 299;
358
+ this.url = '';
359
+ this.redirected = false;
360
+ this.type = 'basic';
361
+ this.bodyUsed = false;
362
+ }
363
+
364
+ Response.prototype.text = function() {
365
+ this.bodyUsed = true;
366
+ return Promise.resolve(this.body);
367
+ };
368
+
369
+ Response.prototype.json = function() {
370
+ this.bodyUsed = true;
371
+ try {
372
+ return Promise.resolve(JSON.parse(this.body));
373
+ } catch (e) {
374
+ return Promise.reject(e);
375
+ }
376
+ };
377
+
378
+ Response.prototype.clone = function() {
379
+ var r = new Response(this.body, {
380
+ status: this.status,
381
+ statusText: this.statusText,
382
+ headers: new Headers(this.headers)
383
+ });
384
+ r.url = this.url;
385
+ r.redirected = this.redirected;
386
+ r.type = this.type;
387
+ return r;
388
+ };
389
+
390
+ Response.json = function(data, init) {
391
+ if (init === undefined) init = {};
392
+ var headers = init.headers instanceof Headers ? init.headers : new Headers(init.headers);
393
+ if (!headers.has('content-type')) {
394
+ headers.set('content-type', 'application/json');
395
+ }
396
+ return new Response(JSON.stringify(data), {
397
+ status: init.status !== undefined ? init.status : 200,
398
+ statusText: init.statusText || '',
399
+ headers: headers
400
+ });
401
+ };
402
+
403
+ Response.error = function() {
404
+ var r = new Response(null, { status: 0, statusText: '' });
405
+ r.type = 'error';
406
+ r.ok = false;
407
+ return r;
408
+ };
409
+
410
+ Response.redirect = function(url, status) {
411
+ if (status === undefined) status = 302;
412
+ var r = new Response(null, {
413
+ status: status,
414
+ statusText: '',
415
+ headers: new Headers({ location: String(url) })
416
+ });
417
+ r.redirected = true;
418
+ return r;
419
+ };
420
+
421
+ // --- Request ---
422
+ function Request(input, init) {
423
+ if (init === undefined) init = {};
424
+ if (input instanceof Request) {
425
+ this.url = input.url;
426
+ this.method = input.method;
427
+ this.headers = new Headers(input.headers);
428
+ this.body = input.body;
429
+ } else {
430
+ this.url = String(input);
431
+ this.method = 'GET';
432
+ this.headers = new Headers();
433
+ this.body = null;
434
+ }
435
+ if (init.method !== undefined) this.method = String(init.method).toUpperCase();
436
+ if (init.headers !== undefined) this.headers = init.headers instanceof Headers ? init.headers : new Headers(init.headers);
437
+ if (init.body !== undefined) this.body = init.body !== null ? String(init.body) : null;
438
+ }
439
+
440
+ Request.prototype.clone = function() {
441
+ return new Request(this);
442
+ };
443
+
444
+ // --- Assign to globalThis ---
445
+ globalThis.URLSearchParams = URLSearchParams;
446
+ globalThis.URL = URL;
447
+ globalThis.Headers = Headers;
448
+ globalThis.Response = Response;
449
+ globalThis.Request = Request;
450
+
451
+ // --- Wrap native fetch ---
452
+ var _nativeFetch = globalThis[Symbol.for('jb:fetch')];
453
+ globalThis.fetch = function fetch(input, init) {
454
+ try {
455
+ var url, method, headers, body;
456
+
457
+ if (input instanceof Request) {
458
+ url = input.url;
459
+ method = input.method;
460
+ headers = {};
461
+ input.headers.forEach(function(v, k) { headers[k] = v; });
462
+ body = input.body;
463
+ } else {
464
+ url = String(input);
465
+ method = undefined;
466
+ headers = undefined;
467
+ body = undefined;
468
+ }
469
+
470
+ if (init) {
471
+ if (init.method !== undefined) method = String(init.method).toUpperCase();
472
+ if (init.headers !== undefined) {
473
+ var h = init.headers instanceof Headers ? init.headers : new Headers(init.headers);
474
+ headers = {};
475
+ h.forEach(function(v, k) { headers[k] = v; });
476
+ }
477
+ if (init.body !== undefined) body = init.body !== null ? String(init.body) : undefined;
478
+ }
479
+
480
+ var opts = Object.create(null);
481
+ if (method) opts.method = method;
482
+ if (headers) opts.headers = headers;
483
+ if (body) opts.body = body;
484
+
485
+ var raw = _nativeFetch(url, opts);
486
+
487
+ var respHeaders = new Headers(raw.headers || {});
488
+ var response = new Response(raw.body, {
489
+ status: raw.status,
490
+ statusText: raw.statusText || '',
491
+ headers: respHeaders
492
+ });
493
+ response.url = raw.url || url;
494
+
495
+ return Promise.resolve(response);
496
+ } catch (e) {
497
+ return Promise.reject(new TypeError(e.message || 'fetch failed'));
498
+ }
499
+ };
500
+ })();
501
+ `;var we=`
502
+ var EventEmitter = (function() {
503
+ function EE() {
504
+ this._events = {};
505
+ this._maxListeners = 10;
506
+ }
507
+ EE.prototype.on = function(event, listener) {
508
+ if (!this._events[event]) this._events[event] = [];
509
+ this._events[event].push(listener);
510
+ return this;
511
+ };
512
+ EE.prototype.addListener = EE.prototype.on;
513
+ EE.prototype.once = function(event, listener) {
514
+ var self = this;
515
+ function wrapper() {
516
+ self.removeListener(event, wrapper);
517
+ listener.apply(this, arguments);
518
+ }
519
+ wrapper._original = listener;
520
+ return this.on(event, wrapper);
521
+ };
522
+ EE.prototype.off = function(event, listener) {
523
+ return this.removeListener(event, listener);
524
+ };
525
+ EE.prototype.removeListener = function(event, listener) {
526
+ var list = this._events[event];
527
+ if (list) {
528
+ this._events[event] = list.filter(function(fn) {
529
+ return fn !== listener && fn._original !== listener;
530
+ });
531
+ }
532
+ return this;
533
+ };
534
+ EE.prototype.removeAllListeners = function(event) {
535
+ if (event) delete this._events[event];
536
+ else this._events = {};
537
+ return this;
538
+ };
539
+ EE.prototype.emit = function(event) {
540
+ var list = this._events[event];
541
+ if (!list || list.length === 0) return false;
542
+ var args = Array.prototype.slice.call(arguments, 1);
543
+ var fns = list.slice();
544
+ for (var i = 0; i < fns.length; i++) fns[i].apply(this, args);
545
+ return true;
546
+ };
547
+ EE.prototype.listeners = function(event) {
548
+ return (this._events[event] || []).slice();
549
+ };
550
+ EE.prototype.listenerCount = function(event) {
551
+ return (this._events[event] || []).length;
552
+ };
553
+ EE.prototype.setMaxListeners = function(n) {
554
+ this._maxListeners = n;
555
+ return this;
556
+ };
557
+ EE.prototype.eventNames = function() {
558
+ return Object.keys(this._events);
559
+ };
560
+ EE.prototype.prependListener = function(event, listener) {
561
+ if (!this._events[event]) this._events[event] = [];
562
+ this._events[event].unshift(listener);
563
+ return this;
564
+ };
565
+ return EE;
566
+ })();
567
+ globalThis[Symbol.for('jb:events')] = { EventEmitter: EventEmitter };
568
+ `,xe=`
569
+ var _os = {
570
+ platform: function() { return globalThis.process.platform; },
571
+ arch: function() { return globalThis.process.arch; },
572
+ homedir: function() { return '/home/user'; },
573
+ tmpdir: function() { return '/tmp'; },
574
+ type: function() { return 'Linux'; },
575
+ hostname: function() { return 'sandbox'; },
576
+ EOL: '\\n',
577
+ cpus: function() { return []; },
578
+ totalmem: function() { return 0; },
579
+ freemem: function() { return 0; },
580
+ endianness: function() { return 'LE'; }
581
+ };
582
+ globalThis[Symbol.for('jb:os')] = _os;
583
+ `,Ee=`
584
+ var _urlMod = {
585
+ URL: globalThis.URL,
586
+ URLSearchParams: globalThis.URLSearchParams,
587
+ parse: function(urlStr) {
588
+ try {
589
+ var u = new URL(urlStr);
590
+ return {
591
+ protocol: u.protocol, host: u.host, hostname: u.hostname,
592
+ port: u.port, pathname: u.pathname, search: u.search,
593
+ hash: u.hash, href: u.href, path: u.pathname + u.search
594
+ };
595
+ } catch(e) {
596
+ return {
597
+ protocol: null, host: null, hostname: null, port: null,
598
+ pathname: urlStr, search: '', hash: '', href: urlStr, path: urlStr
599
+ };
600
+ }
601
+ },
602
+ format: function(obj) {
603
+ if (typeof obj === 'string') return obj;
604
+ if (obj instanceof URL) return obj.href;
605
+ var auth = obj.auth ? obj.auth + '@' : '';
606
+ var host = obj.host || ((obj.hostname || '') + (obj.port ? ':' + obj.port : ''));
607
+ return (obj.protocol ? obj.protocol + '//' : '') + auth + host +
608
+ (obj.pathname || '/') + (obj.search || '') + (obj.hash || '');
609
+ }
610
+ };
611
+ globalThis[Symbol.for('jb:url')] = _urlMod;
612
+ `,je=`
613
+ var _deepEqual = function(a, b) {
614
+ if (a === b) return true;
615
+ if (a === null || b === null || typeof a !== 'object' || typeof b !== 'object') return false;
616
+ if (Array.isArray(a) !== Array.isArray(b)) return false;
617
+ var ka = Object.keys(a), kb = Object.keys(b);
618
+ if (ka.length !== kb.length) return false;
619
+ for (var i = 0; i < ka.length; i++) {
620
+ if (!_deepEqual(a[ka[i]], b[ka[i]])) return false;
621
+ }
622
+ return true;
623
+ };
624
+ var _assert = function(val, msg) {
625
+ if (!val) throw new Error(msg || 'AssertionError: expected truthy value');
626
+ };
627
+ _assert.ok = _assert;
628
+ _assert.equal = function(a, b, msg) {
629
+ if (a != b) throw new Error(msg || 'AssertionError: ' + a + ' != ' + b);
630
+ };
631
+ _assert.notEqual = function(a, b, msg) {
632
+ if (a == b) throw new Error(msg || 'AssertionError: ' + a + ' == ' + b);
633
+ };
634
+ _assert.strictEqual = function(a, b, msg) {
635
+ if (a !== b) throw new Error(msg || 'AssertionError: ' + a + ' !== ' + b);
636
+ };
637
+ _assert.notStrictEqual = function(a, b, msg) {
638
+ if (a === b) throw new Error(msg || 'AssertionError: ' + a + ' === ' + b);
639
+ };
640
+ _assert.deepEqual = function(a, b, msg) {
641
+ if (!_deepEqual(a, b)) throw new Error(msg || 'AssertionError: objects not deep equal');
642
+ };
643
+ _assert.deepStrictEqual = _assert.deepEqual;
644
+ _assert.notDeepEqual = function(a, b, msg) {
645
+ if (_deepEqual(a, b)) throw new Error(msg || 'AssertionError: objects are deep equal');
646
+ };
647
+ _assert.throws = function(fn, expected, msg) {
648
+ var threw = false;
649
+ try { fn(); } catch(e) {
650
+ threw = true;
651
+ if (expected instanceof RegExp && !expected.test(e.message))
652
+ throw new Error(msg || 'AssertionError: error message did not match');
653
+ }
654
+ if (!threw) throw new Error(msg || 'AssertionError: function did not throw');
655
+ };
656
+ _assert.doesNotThrow = function(fn, msg) {
657
+ // @banned-pattern-ignore: sandbox-internal assertion helper; e.message is from user code inside QuickJS, not host details
658
+ try { fn(); } catch(e) {
659
+ throw new Error(msg || 'AssertionError: function threw: ' + e.message);
660
+ }
661
+ };
662
+ _assert.fail = function(msg) {
663
+ throw new Error(msg || 'AssertionError: assert.fail()');
664
+ };
665
+ globalThis[Symbol.for('jb:assert')] = _assert;
666
+ `,Re=`
667
+ var _util = {
668
+ format: function() {
669
+ var args = Array.prototype.slice.call(arguments);
670
+ if (args.length === 0) return '';
671
+ var fmt = args[0];
672
+ if (typeof fmt !== 'string') {
673
+ return args.map(function(a) {
674
+ return typeof a === 'string' ? a : JSON.stringify(a);
675
+ }).join(' ');
676
+ }
677
+ var i = 1;
678
+ var str = fmt.replace(/%[sdjifoO%]/g, function(m) {
679
+ if (m === '%%') return '%';
680
+ if (i >= args.length) return m;
681
+ var v = args[i++];
682
+ if (m === '%s') return String(v);
683
+ if (m === '%d') return Number(v).toString();
684
+ if (m === '%i') { var n = Number(v); return (isNaN(n) ? 'NaN' : Math.trunc(n)).toString(); }
685
+ if (m === '%j') return JSON.stringify(v);
686
+ if (m === '%f') return parseFloat(v).toString();
687
+ if (m === '%o' || m === '%O') return JSON.stringify(v);
688
+ return m;
689
+ });
690
+ while (i < args.length) {
691
+ str += ' ' + (typeof args[i] === 'string' ? args[i] : JSON.stringify(args[i]));
692
+ i++;
693
+ }
694
+ return str;
695
+ },
696
+ inspect: function(obj, opts) {
697
+ if (obj === null) return 'null';
698
+ if (obj === undefined) return 'undefined';
699
+ if (typeof obj === 'string') return "'" + obj + "'";
700
+ if (typeof obj === 'function') return '[Function: ' + (obj.name || 'anonymous') + ']';
701
+ var seen = [];
702
+ try {
703
+ return JSON.stringify(obj, function(key, val) {
704
+ if (typeof val === 'object' && val !== null) {
705
+ if (seen.indexOf(val) !== -1) return '[Circular]';
706
+ seen.push(val);
707
+ }
708
+ return val;
709
+ });
710
+ } catch(e) { return String(obj); }
711
+ },
712
+ promisify: function(fn) {
713
+ return function() {
714
+ var args = Array.prototype.slice.call(arguments);
715
+ return new Promise(function(resolve, reject) {
716
+ args.push(function(err, val) { if (err) reject(err); else resolve(val); });
717
+ fn.apply(null, args);
718
+ });
719
+ };
720
+ },
721
+ types: {
722
+ isDate: function(v) { return v instanceof Date; },
723
+ isRegExp: function(v) { return v instanceof RegExp; },
724
+ isArray: function(v) { return Array.isArray(v); },
725
+ isMap: function(v) { return typeof Map !== 'undefined' && v instanceof Map; },
726
+ isSet: function(v) { return typeof Set !== 'undefined' && v instanceof Set; }
727
+ },
728
+ inherits: function(ctor, superCtor) {
729
+ ctor.prototype = Object.create(superCtor.prototype);
730
+ ctor.prototype.constructor = ctor;
731
+ }
732
+ };
733
+ globalThis[Symbol.for('jb:util')] = _util;
734
+ `,Ae=`
735
+ function _utf8Encode(str) {
736
+ var bytes = [];
737
+ for (var i = 0; i < str.length; i++) {
738
+ var c = str.charCodeAt(i);
739
+ if (c < 0x80) {
740
+ bytes.push(c);
741
+ } else if (c < 0x800) {
742
+ bytes.push(0xC0 | (c >> 6), 0x80 | (c & 0x3F));
743
+ } else if (c >= 0xD800 && c <= 0xDBFF && i + 1 < str.length) {
744
+ var lo = str.charCodeAt(++i);
745
+ var cp = ((c - 0xD800) * 0x400) + (lo - 0xDC00) + 0x10000;
746
+ bytes.push(0xF0 | (cp >> 18), 0x80 | ((cp >> 12) & 0x3F), 0x80 | ((cp >> 6) & 0x3F), 0x80 | (cp & 0x3F));
747
+ } else {
748
+ bytes.push(0xE0 | (c >> 12), 0x80 | ((c >> 6) & 0x3F), 0x80 | (c & 0x3F));
749
+ }
750
+ }
751
+ return bytes;
752
+ }
753
+ function _utf8Decode(bytes) {
754
+ var str = '';
755
+ var i = 0;
756
+ while (i < bytes.length) {
757
+ var b = bytes[i];
758
+ if (b < 0x80) { str += String.fromCharCode(b); i++; }
759
+ else if ((b & 0xE0) === 0xC0) { str += String.fromCharCode(((b & 0x1F) << 6) | (bytes[i+1] & 0x3F)); i += 2; }
760
+ else if ((b & 0xF0) === 0xE0) { str += String.fromCharCode(((b & 0x0F) << 12) | ((bytes[i+1] & 0x3F) << 6) | (bytes[i+2] & 0x3F)); i += 3; }
761
+ else if ((b & 0xF8) === 0xF0) { var cp = ((b & 0x07) << 18) | ((bytes[i+1] & 0x3F) << 12) | ((bytes[i+2] & 0x3F) << 6) | (bytes[i+3] & 0x3F); cp -= 0x10000; str += String.fromCharCode((cp >> 10) + 0xD800, (cp & 0x3FF) + 0xDC00); i += 4; }
762
+ else { i++; }
763
+ }
764
+ return str;
765
+ }
766
+ // _utf8Encode/_utf8Decode are IIFE-local vars, available to all module shims
767
+ // IMPORTANT: round-trip tests (encode then decode) mask broken encodings
768
+ // because both sides become no-ops. Encoding tests MUST assert the encoded
769
+ // constant directly.
770
+ function _normEnc(enc) {
771
+ if (enc === undefined || enc === null) return 'utf8';
772
+ var e = String(enc).toLowerCase();
773
+ if (e === 'utf8' || e === 'utf-8') return 'utf8';
774
+ if (e === 'utf16le' || e === 'utf-16le' || e === 'ucs2' || e === 'ucs-2') return 'utf16le';
775
+ if (e === 'latin1' || e === 'binary') return 'latin1';
776
+ if (e === 'ascii') return 'ascii';
777
+ if (e === 'base64') return 'base64';
778
+ if (e === 'base64url') return 'base64url';
779
+ if (e === 'hex') return 'hex';
780
+ return undefined;
781
+ }
782
+ function _badEnc(enc) {
783
+ throw new TypeError("Unknown encoding: " + enc);
784
+ }
785
+ var _HEX = '0123456789abcdef';
786
+ function _hexEncode(bytes) {
787
+ var s = '';
788
+ for (var i = 0; i < bytes.length; i++) {
789
+ var b = bytes[i] & 0xff;
790
+ s += _HEX.charAt(b >> 4) + _HEX.charAt(b & 0x0f);
791
+ }
792
+ return s;
793
+ }
794
+ function _hexDecode(str) {
795
+ var out = [];
796
+ for (var i = 0; i + 1 < str.length; i += 2) {
797
+ var hi = _hexVal(str.charCodeAt(i));
798
+ var lo = _hexVal(str.charCodeAt(i + 1));
799
+ if (hi < 0 || lo < 0) break;
800
+ out.push((hi << 4) | lo);
801
+ }
802
+ return out;
803
+ }
804
+ function _hexVal(c) {
805
+ if (c >= 48 && c <= 57) return c - 48;
806
+ if (c >= 97 && c <= 102) return c - 87;
807
+ if (c >= 65 && c <= 70) return c - 55;
808
+ return -1;
809
+ }
810
+ function _rawEncode(str) {
811
+ var out = new Array(str.length);
812
+ for (var i = 0; i < str.length; i++) out[i] = str.charCodeAt(i) & 0xff;
813
+ return out;
814
+ }
815
+ function _latin1Decode(bytes) {
816
+ var s = '';
817
+ for (var i = 0; i < bytes.length; i++) s += String.fromCharCode(bytes[i] & 0xff);
818
+ return s;
819
+ }
820
+ function _asciiDecode(bytes) {
821
+ var s = '';
822
+ for (var i = 0; i < bytes.length; i++) s += String.fromCharCode(bytes[i] & 0x7f);
823
+ return s;
824
+ }
825
+ function _utf16leEncode(str) {
826
+ var out = new Array(str.length * 2);
827
+ for (var i = 0; i < str.length; i++) {
828
+ var c = str.charCodeAt(i);
829
+ out[i * 2] = c & 0xff;
830
+ out[i * 2 + 1] = (c >> 8) & 0xff;
831
+ }
832
+ return out;
833
+ }
834
+ function _utf16leDecode(bytes) {
835
+ var s = '';
836
+ var end = bytes.length & ~1;
837
+ for (var i = 0; i < end; i += 2) {
838
+ s += String.fromCharCode(bytes[i] | (bytes[i + 1] << 8));
839
+ }
840
+ return s;
841
+ }
842
+ var _B64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
843
+ var _B64DEC = null;
844
+ function _b64DecTable() {
845
+ if (_B64DEC) return _B64DEC;
846
+ var t = new Array(256);
847
+ for (var i = 0; i < 256; i++) t[i] = -1;
848
+ for (var j = 0; j < 64; j++) t[_B64.charCodeAt(j)] = j;
849
+ t[45] = 62;
850
+ t[95] = 63;
851
+ _B64DEC = t;
852
+ return t;
853
+ }
854
+ function _b64Encode(bytes) {
855
+ var s = '';
856
+ var i = 0, len = bytes.length;
857
+ while (i + 2 < len) {
858
+ var n = (bytes[i] << 16) | (bytes[i + 1] << 8) | bytes[i + 2];
859
+ s += _B64.charAt((n >> 18) & 63) + _B64.charAt((n >> 12) & 63)
860
+ + _B64.charAt((n >> 6) & 63) + _B64.charAt(n & 63);
861
+ i += 3;
862
+ }
863
+ var rem = len - i;
864
+ if (rem === 1) {
865
+ var n1 = bytes[i] << 16;
866
+ s += _B64.charAt((n1 >> 18) & 63) + _B64.charAt((n1 >> 12) & 63) + '==';
867
+ } else if (rem === 2) {
868
+ var n2 = (bytes[i] << 16) | (bytes[i + 1] << 8);
869
+ s += _B64.charAt((n2 >> 18) & 63) + _B64.charAt((n2 >> 12) & 63)
870
+ + _B64.charAt((n2 >> 6) & 63) + '=';
871
+ }
872
+ return s;
873
+ }
874
+ function _b64UrlEncode(bytes) {
875
+ var s = _b64Encode(bytes);
876
+ return s.replace(/=+$/, '').replace(/\\+/g, '-').replace(/\\//g, '_');
877
+ }
878
+ function _b64Decode(str) {
879
+ var t = _b64DecTable();
880
+ var out = [];
881
+ var buf = 0, bits = 0;
882
+ for (var i = 0; i < str.length; i++) {
883
+ var c = str.charCodeAt(i);
884
+ if (c === 61) break;
885
+ var v = c < 256 ? t[c] : -1;
886
+ if (v < 0) continue;
887
+ buf = (buf << 6) | v;
888
+ bits += 6;
889
+ if (bits >= 8) {
890
+ bits -= 8;
891
+ out.push((buf >> bits) & 0xff);
892
+ }
893
+ }
894
+ return out;
895
+ }
896
+
897
+ function Buffer(arg) {
898
+ if (typeof arg === 'number') {
899
+ this._data = new Uint8Array(arg);
900
+ } else if (arg instanceof ArrayBuffer) {
901
+ this._data = new Uint8Array(arg);
902
+ } else if (arg instanceof Uint8Array) {
903
+ this._data = new Uint8Array(arg);
904
+ } else if (Array.isArray(arg)) {
905
+ this._data = new Uint8Array(arg);
906
+ } else {
907
+ this._data = new Uint8Array(0);
908
+ }
909
+ this.length = this._data.length;
910
+ }
911
+ Buffer.from = function(data, encoding) {
912
+ if (typeof data === 'string') {
913
+ var enc = _normEnc(encoding);
914
+ if (enc === undefined) _badEnc(encoding);
915
+ if (enc === 'utf8') return new Buffer(_utf8Encode(data));
916
+ if (enc === 'utf16le') return new Buffer(_utf16leEncode(data));
917
+ if (enc === 'latin1') return new Buffer(_rawEncode(data));
918
+ if (enc === 'ascii') return new Buffer(_rawEncode(data));
919
+ if (enc === 'hex') return new Buffer(_hexDecode(data));
920
+ if (enc === 'base64' || enc === 'base64url') return new Buffer(_b64Decode(data));
921
+ }
922
+ if (data instanceof ArrayBuffer) {
923
+ var off = typeof encoding === 'number' ? encoding : 0;
924
+ var len = arguments.length > 2 ? arguments[2] : undefined;
925
+ var view = len === undefined ? new Uint8Array(data, off) : new Uint8Array(data, off, len);
926
+ var buf = Object.create(Buffer.prototype);
927
+ buf._data = view;
928
+ buf.length = view.length;
929
+ return buf;
930
+ }
931
+ if (data instanceof Uint8Array) return new Buffer(data);
932
+ if (Array.isArray(data)) return new Buffer(data);
933
+ if (data && data._data) return new Buffer(data._data.slice());
934
+ return new Buffer(0);
935
+ };
936
+ Buffer.alloc = function(size, fill) {
937
+ var buf = new Buffer(size);
938
+ if (fill !== undefined) {
939
+ var fillByte = typeof fill === 'number' ? fill : 0;
940
+ buf._data.fill(fillByte);
941
+ }
942
+ return buf;
943
+ };
944
+ Buffer.allocUnsafe = Buffer.alloc;
945
+ Buffer.isBuffer = function(obj) { return obj instanceof Buffer; };
946
+ Buffer.concat = function(list, totalLength) {
947
+ if (!totalLength) {
948
+ totalLength = 0;
949
+ for (var i = 0; i < list.length; i++) totalLength += list[i].length;
950
+ }
951
+ var result = new Uint8Array(totalLength);
952
+ var offset = 0;
953
+ for (var i = 0; i < list.length; i++) {
954
+ result.set(list[i]._data, offset);
955
+ offset += list[i].length;
956
+ }
957
+ return new Buffer(result);
958
+ };
959
+ Buffer.byteLength = function(value, encoding) {
960
+ if (typeof value !== 'string') {
961
+ if (value && value._data) return value._data.length;
962
+ if (value instanceof Uint8Array || value instanceof ArrayBuffer) {
963
+ return value.byteLength;
964
+ }
965
+ throw new TypeError('The "string" argument must be of type string or an instance of Buffer or ArrayBuffer. Received type ' + typeof value + ' (' + value + ')');
966
+ }
967
+ var enc = _normEnc(encoding);
968
+ if (enc === undefined) _badEnc(encoding);
969
+ if (enc === 'utf8') return _utf8Encode(value).length;
970
+ if (enc === 'utf16le') return value.length * 2;
971
+ if (enc === 'latin1' || enc === 'ascii') return value.length;
972
+ if (enc === 'hex') return (value.length / 2) | 0;
973
+ if (enc === 'base64' || enc === 'base64url') {
974
+ var clean = value.replace(/[^A-Za-z0-9+/=_-]/g, '').replace(/=+$/, '');
975
+ return Math.floor(clean.length * 3 / 4);
976
+ }
977
+ };
978
+ Buffer.prototype.toString = function(encoding, start, end) {
979
+ var bytes = this._data;
980
+ if (start !== undefined || end !== undefined) {
981
+ var len = bytes.length;
982
+ var s = start === undefined ? 0 : (start < 0 ? 0 : (start > len ? len : start | 0));
983
+ var e = end === undefined ? len : (end < 0 ? 0 : (end > len ? len : end | 0));
984
+ bytes = e <= s ? bytes.subarray(0, 0) : bytes.subarray(s, e);
985
+ }
986
+ var enc = _normEnc(encoding);
987
+ if (enc === undefined) _badEnc(encoding);
988
+ if (enc === 'utf8') return _utf8Decode(bytes);
989
+ if (enc === 'utf16le') return _utf16leDecode(bytes);
990
+ if (enc === 'latin1') return _latin1Decode(bytes);
991
+ if (enc === 'ascii') return _asciiDecode(bytes);
992
+ if (enc === 'hex') return _hexEncode(bytes);
993
+ if (enc === 'base64') return _b64Encode(bytes);
994
+ if (enc === 'base64url') return _b64UrlEncode(bytes);
995
+ };
996
+ Buffer.prototype.toJSON = function() {
997
+ return { type: 'Buffer', data: Array.from(this._data) };
998
+ };
999
+ Buffer.prototype.slice = function(start, end) {
1000
+ return new Buffer(this._data.slice(start, end));
1001
+ };
1002
+ Buffer.prototype.copy = function(target, targetStart, sourceStart, sourceEnd) {
1003
+ targetStart = targetStart || 0;
1004
+ sourceStart = sourceStart || 0;
1005
+ sourceEnd = sourceEnd || this.length;
1006
+ var sub = this._data.subarray(sourceStart, sourceEnd);
1007
+ target._data.set(sub, targetStart);
1008
+ return sub.length;
1009
+ };
1010
+ Buffer.prototype.write = function(str, offset, length, encoding) {
1011
+ if (typeof offset === 'string') { encoding = offset; offset = 0; length = undefined; }
1012
+ else if (typeof length === 'string') { encoding = length; length = undefined; }
1013
+ offset = offset | 0;
1014
+ if (offset < 0 || offset > this._data.length) {
1015
+ throw new RangeError('The value of "offset" is out of range. It must be >= 0 && <= ' + this._data.length + '. Received ' + offset);
1016
+ }
1017
+ var enc = _normEnc(encoding);
1018
+ if (enc === undefined) _badEnc(encoding);
1019
+ var bytes;
1020
+ if (enc === 'utf8') bytes = _utf8Encode(str);
1021
+ else if (enc === 'utf16le') bytes = _utf16leEncode(str);
1022
+ else if (enc === 'latin1') bytes = _rawEncode(str);
1023
+ else if (enc === 'ascii') bytes = _rawEncode(str);
1024
+ else if (enc === 'hex') bytes = _hexDecode(str);
1025
+ else bytes = _b64Decode(str);
1026
+ var max = this._data.length - offset;
1027
+ if (length !== undefined) {
1028
+ length = length | 0;
1029
+ if (length < 0 || length > this._data.length) {
1030
+ throw new RangeError('The value of "length" is out of range. It must be >= 0 && <= ' + this._data.length + '. Received ' + length);
1031
+ }
1032
+ }
1033
+ var write = Math.min(length === undefined ? max : length, bytes.length, max);
1034
+ for (var i = 0; i < write; i++) this._data[offset + i] = bytes[i];
1035
+ return write;
1036
+ };
1037
+ Buffer.prototype.fill = function(val, offset, end) {
1038
+ this._data.fill(typeof val === 'number' ? val : 0, offset, end);
1039
+ return this;
1040
+ };
1041
+ Buffer.prototype.equals = function(other) {
1042
+ if (this.length !== other.length) return false;
1043
+ for (var i = 0; i < this.length; i++) {
1044
+ if (this._data[i] !== other._data[i]) return false;
1045
+ }
1046
+ return true;
1047
+ };
1048
+ Buffer.prototype.readUInt8 = function(offset) { return this._data[offset]; };
1049
+ Buffer.prototype.writeUInt8 = function(value, offset) { this._data[offset] = value; return offset + 1; };
1050
+ globalThis[Symbol.for('jb:buffer')] = { Buffer: Buffer };
1051
+ globalThis.Buffer = Buffer;
1052
+ `,Ue=`
1053
+ var _EE = globalThis[Symbol.for('jb:events')].EventEmitter;
1054
+
1055
+ function Stream() { _EE.call(this); }
1056
+ Stream.prototype = Object.create(_EE.prototype);
1057
+ Stream.prototype.constructor = Stream;
1058
+ Stream.prototype.pipe = function(dest) {
1059
+ this.on('data', function(chunk) { dest.write(chunk); });
1060
+ this.on('end', function() { if (dest.end) dest.end(); });
1061
+ return dest;
1062
+ };
1063
+
1064
+ function Readable(opts) {
1065
+ Stream.call(this);
1066
+ this.readable = true;
1067
+ this._readableState = { ended: false, buffer: [] };
1068
+ }
1069
+ Readable.prototype = Object.create(Stream.prototype);
1070
+ Readable.prototype.constructor = Readable;
1071
+ Readable.prototype.read = function() { return null; };
1072
+ Readable.prototype.push = function(chunk) {
1073
+ if (chunk === null) { this._readableState.ended = true; this.emit('end'); return false; }
1074
+ this.emit('data', chunk);
1075
+ return true;
1076
+ };
1077
+ Readable.prototype.destroy = function() { this.emit('close'); return this; };
1078
+
1079
+ function Writable(opts) {
1080
+ Stream.call(this);
1081
+ this.writable = true;
1082
+ this._writableState = { ended: false };
1083
+ }
1084
+ Writable.prototype = Object.create(Stream.prototype);
1085
+ Writable.prototype.constructor = Writable;
1086
+ Writable.prototype.write = function(chunk) { return true; };
1087
+ Writable.prototype.end = function(chunk) {
1088
+ if (chunk) this.write(chunk);
1089
+ this._writableState.ended = true;
1090
+ this.emit('finish');
1091
+ return this;
1092
+ };
1093
+ Writable.prototype.destroy = function() { this.emit('close'); return this; };
1094
+
1095
+ function Duplex(opts) {
1096
+ Readable.call(this, opts);
1097
+ Writable.call(this, opts);
1098
+ }
1099
+ Duplex.prototype = Object.create(Readable.prototype);
1100
+ var _wKeys = Object.keys(Writable.prototype);
1101
+ for (var _wi = 0; _wi < _wKeys.length; _wi++) {
1102
+ if (!Duplex.prototype[_wKeys[_wi]]) Duplex.prototype[_wKeys[_wi]] = Writable.prototype[_wKeys[_wi]];
1103
+ }
1104
+ Duplex.prototype.constructor = Duplex;
1105
+
1106
+ function Transform(opts) { Duplex.call(this, opts); }
1107
+ Transform.prototype = Object.create(Duplex.prototype);
1108
+ Transform.prototype.constructor = Transform;
1109
+ Transform.prototype._transform = function(chunk, encoding, cb) { if (cb) cb(null, chunk); };
1110
+
1111
+ function PassThrough(opts) { Transform.call(this, opts); }
1112
+ PassThrough.prototype = Object.create(Transform.prototype);
1113
+ PassThrough.prototype.constructor = PassThrough;
1114
+
1115
+ function pipeline() {
1116
+ var streams = Array.prototype.slice.call(arguments);
1117
+ var cb = typeof streams[streams.length - 1] === 'function' ? streams.pop() : null;
1118
+ for (var i = 0; i < streams.length - 1; i++) streams[i].pipe(streams[i + 1]);
1119
+ if (cb) {
1120
+ var last = streams[streams.length - 1];
1121
+ last.on('finish', function() { cb(null); });
1122
+ last.on('error', function(e) { cb(e); });
1123
+ }
1124
+ return streams[streams.length - 1];
1125
+ }
1126
+
1127
+ globalThis[Symbol.for('jb:stream')] = {
1128
+ Stream: Stream, Readable: Readable, Writable: Writable,
1129
+ Duplex: Duplex, Transform: Transform, PassThrough: PassThrough,
1130
+ pipeline: pipeline
1131
+ };
1132
+ `,ke=`
1133
+ function StringDecoder(encoding) {
1134
+ this.encoding = (encoding || 'utf-8').toLowerCase();
1135
+ if (this.encoding === 'utf8') this.encoding = 'utf-8';
1136
+ }
1137
+ StringDecoder.prototype.write = function(buf) {
1138
+ if (typeof buf === 'string') return buf;
1139
+ var data = buf instanceof Uint8Array ? buf : (buf && buf._data ? buf._data : new Uint8Array(0));
1140
+ return _utf8Decode(data);
1141
+ };
1142
+ StringDecoder.prototype.end = function(buf) {
1143
+ if (buf) return this.write(buf);
1144
+ return '';
1145
+ };
1146
+ globalThis[Symbol.for('jb:string_decoder')] = { StringDecoder: StringDecoder };
1147
+ `,Ce=`
1148
+ var _qs = {
1149
+ parse: function(str, sep, eq) {
1150
+ sep = sep || '&'; eq = eq || '=';
1151
+ var result = Object.create(null);
1152
+ if (!str || typeof str !== 'string') return result;
1153
+ var pairs = str.split(sep);
1154
+ for (var i = 0; i < pairs.length; i++) {
1155
+ var idx = pairs[i].indexOf(eq);
1156
+ var key, val;
1157
+ if (idx >= 0) {
1158
+ key = decodeURIComponent(pairs[i].slice(0, idx).replace(/\\+/g, ' '));
1159
+ val = decodeURIComponent(pairs[i].slice(idx + 1).replace(/\\+/g, ' '));
1160
+ } else {
1161
+ key = decodeURIComponent(pairs[i].replace(/\\+/g, ' '));
1162
+ val = '';
1163
+ }
1164
+ if (result[key] !== undefined) {
1165
+ if (Array.isArray(result[key])) result[key].push(val);
1166
+ else result[key] = [result[key], val];
1167
+ } else {
1168
+ result[key] = val;
1169
+ }
1170
+ }
1171
+ return result;
1172
+ },
1173
+ stringify: function(obj, sep, eq) {
1174
+ sep = sep || '&'; eq = eq || '=';
1175
+ var pairs = [];
1176
+ var keys = Object.keys(obj);
1177
+ for (var i = 0; i < keys.length; i++) {
1178
+ var key = keys[i];
1179
+ var val = obj[key];
1180
+ if (Array.isArray(val)) {
1181
+ for (var j = 0; j < val.length; j++) {
1182
+ pairs.push(encodeURIComponent(key) + eq + encodeURIComponent(val[j]));
1183
+ }
1184
+ } else {
1185
+ pairs.push(encodeURIComponent(key) + eq + encodeURIComponent(val));
1186
+ }
1187
+ }
1188
+ return pairs.join(sep);
1189
+ },
1190
+ escape: function(str) { return encodeURIComponent(str); },
1191
+ unescape: function(str) { return decodeURIComponent(str); }
1192
+ };
1193
+ _qs.decode = _qs.parse;
1194
+ _qs.encode = _qs.stringify;
1195
+ globalThis[Symbol.for('jb:querystring')] = _qs;
1196
+ `,I=Object.assign(Object.create(null),{http:"Use fetch() for HTTP requests.",https:"Use fetch() for HTTP requests.",http2:"Use fetch() for HTTP requests.",net:"Network socket APIs are not supported.",tls:"Network socket APIs are not supported.",dgram:"Network socket APIs are not supported.",dns:"DNS APIs are not supported.",cluster:"Cluster APIs are not supported.",worker_threads:"Worker thread APIs are not supported.",vm:"VM APIs are not supported.",v8:"V8 APIs are not supported.",inspector:"Inspector APIs are not supported.",readline:"Readline APIs are not supported.",repl:"REPL APIs are not supported.",module:"Module APIs are not supported.",perf_hooks:"Performance hooks are not supported.",async_hooks:"Async hooks are not supported.",diagnostics_channel:"Diagnostics channel is not supported.",trace_events:"Trace events are not supported.",crypto:"Crypto APIs are not available in this sandbox.",zlib:"Compression APIs are not supported.",tty:"TTY APIs are not supported.",domain:"Domain APIs are not supported."});var Te=`
1197
+ (function() {
1198
+ var sep = '/';
1199
+ var delimiter = ':';
1200
+
1201
+ function normalize(p) {
1202
+ if (p === '') return '.';
1203
+ var isAbs = p.charCodeAt(0) === 47;
1204
+ var trailingSlash = p.charCodeAt(p.length - 1) === 47;
1205
+ var parts = p.split('/');
1206
+ var out = [];
1207
+ for (var i = 0; i < parts.length; i++) {
1208
+ var seg = parts[i];
1209
+ if (seg === '' || seg === '.') continue;
1210
+ if (seg === '..') {
1211
+ if (out.length > 0 && out[out.length - 1] !== '..') out.pop();
1212
+ else if (!isAbs) out.push('..');
1213
+ } else {
1214
+ out.push(seg);
1215
+ }
1216
+ }
1217
+ var result = out.join('/');
1218
+ if (isAbs) result = '/' + result;
1219
+ if (trailingSlash && result[result.length - 1] !== '/') result += '/';
1220
+ return result || (isAbs ? '/' : '.');
1221
+ }
1222
+
1223
+ function join() {
1224
+ var joined = '';
1225
+ for (var i = 0; i < arguments.length; i++) {
1226
+ var arg = arguments[i];
1227
+ if (typeof arg !== 'string') throw new TypeError('Path must be a string');
1228
+ if (arg.length > 0) {
1229
+ if (joined.length > 0) joined += '/' + arg;
1230
+ else joined = arg;
1231
+ }
1232
+ }
1233
+ if (joined.length === 0) return '.';
1234
+ return normalize(joined);
1235
+ }
1236
+
1237
+ function resolve() {
1238
+ var resolved = '';
1239
+ var resolvedAbsolute = false;
1240
+ for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {
1241
+ var path = i >= 0 ? arguments[i] : globalThis.process.cwd();
1242
+ if (typeof path !== 'string') throw new TypeError('Path must be a string');
1243
+ if (path.length === 0) continue;
1244
+ if (resolved.length > 0) resolved = path + '/' + resolved;
1245
+ else resolved = path;
1246
+ resolvedAbsolute = path.charCodeAt(0) === 47;
1247
+ }
1248
+ resolved = normalize(resolved);
1249
+ if (resolvedAbsolute) return '/' + resolved.replace(/^\\/+/, '');
1250
+ return resolved.length > 0 ? resolved : '.';
1251
+ }
1252
+
1253
+ function isAbsolute(p) {
1254
+ return typeof p === 'string' && p.length > 0 && p.charCodeAt(0) === 47;
1255
+ }
1256
+
1257
+ function dirname(p) {
1258
+ if (p.length === 0) return '.';
1259
+ var hasRoot = p.charCodeAt(0) === 47;
1260
+ var end = -1;
1261
+ for (var i = p.length - 1; i >= 1; i--) {
1262
+ if (p.charCodeAt(i) === 47) { end = i; break; }
1263
+ }
1264
+ if (end === -1) return hasRoot ? '/' : '.';
1265
+ if (hasRoot && end === 0) return '/';
1266
+ return p.slice(0, end);
1267
+ }
1268
+
1269
+ function basename(p, ext) {
1270
+ var start = 0;
1271
+ for (var i = p.length - 1; i >= 0; i--) {
1272
+ if (p.charCodeAt(i) === 47) { start = i + 1; break; }
1273
+ }
1274
+ var base = p.slice(start);
1275
+ if (ext && base.endsWith(ext)) {
1276
+ base = base.slice(0, base.length - ext.length);
1277
+ }
1278
+ return base;
1279
+ }
1280
+
1281
+ function extname(p) {
1282
+ var startDot = -1;
1283
+ var startPart = 0;
1284
+ for (var i = p.length - 1; i >= 0; i--) {
1285
+ var code = p.charCodeAt(i);
1286
+ if (code === 47) { startPart = i + 1; break; }
1287
+ if (code === 46 && startDot === -1) startDot = i;
1288
+ }
1289
+ if (startDot === -1 || startDot === startPart ||
1290
+ (startDot === startPart + 1 && p.charCodeAt(startPart) === 46)) {
1291
+ return '';
1292
+ }
1293
+ return p.slice(startDot);
1294
+ }
1295
+
1296
+ function relative(from, to) {
1297
+ if (from === to) return '';
1298
+ from = resolve(from);
1299
+ to = resolve(to);
1300
+ if (from === to) return '';
1301
+ var fromParts = from.split('/').filter(Boolean);
1302
+ var toParts = to.split('/').filter(Boolean);
1303
+ var common = 0;
1304
+ var length = Math.min(fromParts.length, toParts.length);
1305
+ for (var i = 0; i < length; i++) {
1306
+ if (fromParts[i] !== toParts[i]) break;
1307
+ common++;
1308
+ }
1309
+ var ups = [];
1310
+ for (var i = common; i < fromParts.length; i++) ups.push('..');
1311
+ return ups.concat(toParts.slice(common)).join('/') || '.';
1312
+ }
1313
+
1314
+ function parse(p) {
1315
+ var root = p.charCodeAt(0) === 47 ? '/' : '';
1316
+ var dir = dirname(p);
1317
+ var base = basename(p);
1318
+ var ext = extname(p);
1319
+ var name = ext ? base.slice(0, base.length - ext.length) : base;
1320
+ return { root: root, dir: dir, base: base, ext: ext, name: name };
1321
+ }
1322
+
1323
+ function format(obj) {
1324
+ var dir = obj.dir || obj.root || '';
1325
+ var base = obj.base || ((obj.name || '') + (obj.ext || ''));
1326
+ if (!dir) return base;
1327
+ if (dir === obj.root) return dir + base;
1328
+ return dir + '/' + base;
1329
+ }
1330
+
1331
+ var posix = { sep: sep, delimiter: delimiter, join: join, resolve: resolve, normalize: normalize, isAbsolute: isAbsolute, dirname: dirname, basename: basename, extname: extname, relative: relative, parse: parse, format: format };
1332
+ posix.posix = posix;
1333
+
1334
+ globalThis[Symbol.for('jb:path')] = posix;
1335
+ })();
1336
+ `;var N=new et,$=[],K=!1,it=256*1024*1024,Le=32*1024*1024,x=2147483647,Pe=4096,ot=64*1024,at=8*1024,Ie=()=>typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID().replaceAll("-",""):`${Date.now().toString(36)}_${Math.random().toString(36).slice(2)}`,ut=()=>`__jbHost_${Ie()}`,q=class extends Error{},lt=Ae.replace("Buffer.prototype.toString = function(encoding, start, end) {","Object.defineProperty(Buffer.prototype, 'toString', { configurable: true, writable: true, value: function(encoding, start, end) {").replace(`};
1337
+ Buffer.prototype.toJSON = function() {`,`}});
1338
+ Buffer.prototype.toJSON = function() {`),ft=_e.replace("URLSearchParams.prototype.toString = function() {","Object.defineProperty(URLSearchParams.prototype, 'toString', { configurable: true, writable: true, value: function() {").replace(` };
1339
+
1340
+ URLSearchParams.prototype.forEach`,` }});
1341
+
1342
+ URLSearchParams.prototype.forEach`).replace("URL.prototype.toString = function() { return this.href; };","Object.defineProperty(URL.prototype, 'toString', { configurable: true, writable: true, value: function() { return this.href; } });"),Fe=Object.assign(Object.create(null),{assert:["ok","equal","notEqual","strictEqual","notStrictEqual","deepEqual","deepStrictEqual","notDeepEqual","throws","doesNotThrow","fail"],buffer:["Buffer"],child_process:["exec","execSync","spawnSync"],console:["log","error","warn"],events:["EventEmitter"],fs:["readFile","readFileSync","readFileBuffer","writeFile","writeFileSync","stat","statSync","lstat","lstatSync","readdir","readdirSync","mkdir","mkdirSync","rm","rmSync","exists","existsSync","appendFile","appendFileSync","symlink","symlinkSync","readlink","readlinkSync","chmod","chmodSync","realpath","realpathSync","rename","renameSync","copyFile","copyFileSync","unlink","unlinkSync","rmdir","rmdirSync","promises"],os:["platform","arch","homedir","tmpdir","type","hostname","EOL","cpus","totalmem","freemem","endianness"],path:["join","resolve","normalize","isAbsolute","dirname","basename","extname","relative","parse","format","sep","delimiter","posix"],process:["argv","cwd","exit","env","platform","arch","versions","version"],querystring:["parse","stringify","escape","unescape","decode","encode"],stream:["Stream","Readable","Writable","Duplex","Transform","PassThrough","pipeline"],string_decoder:["StringDecoder"],url:["URL","URLSearchParams","parse","format"],util:["format","inspect","promisify","types","inherits"]}),ct=r=>r==="fs"||r==="process"||r==="console"?`globalThis.${r}`:r==="child_process"?"globalThis[Symbol.for('jb:child_process')]":`globalThis[Symbol.for('jb:${r}')]`,dt=r=>{let e=Fe[r];if(e===void 0){let n=I[r];if(n!==void 0)return`throw new Error(${JSON.stringify(`Module '${r}' is not available in the js-exec sandbox. ${n} Run 'js-exec --help' for available modules.`)});`;throw new Error(`Cannot find module '${r}'.`)}return[`const value = ${ct(r)};`,...e.map(n=>n==="default"?"":`export const ${n} = value.${n};`),"export default value;"].join(`
1343
+ `)},pt=(r,e)=>{let s=(e.startsWith("/")?e:`${r}/${e}`).split("/"),n=[];for(let o of s)!o||o==="."||(o===".."?n.pop():n.push(o));return`/${n.join("/")}`},O=(r,e)=>{if(e<=0)return"";let s=m.from(r);if(s.byteLength<=e)return r;let n=e;for(;n>0&&(s[n]&192)===128;)n--;return s.subarray(0,n).toString("utf8")},Be=r=>{if(r.length===0)return;let e=0;for(let s=0;s<r.length;s++){let n=r.charCodeAt(s)-48;if(n<0||n>9||(e=e*10+n,!Number.isSafeInteger(e)))return}return e},Me=r=>{let e=r.lastIndexOf(":");if(e<=0)return;let s=r.lastIndexOf(":",e-1);if(s<=0)return;let n=Be(r.slice(s+1,e)),o=Be(r.slice(e+1)),u=r.slice(0,s);if(!(n===void 0||o===void 0||u.length===0))return{column:o,file:u,line:n}},Q=r=>{for(let e of r.slice(0,ot).split(`
1344
+ `)){if(e.length>at)continue;let s=e.trimStart();if(!s.startsWith("at "))continue;let n=s.slice(3);if(n.endsWith(")")){let u=n.lastIndexOf(" (");if(u>0){let l=Me(n.slice(u+2,-1));if(l!==void 0)return{...l,functionName:n.slice(0,u)}}}let o=Me(n);if(o!==void 0)return o}},ht=(r,e)=>{let s=2;for(let n=0;n<r.length;n++){let o=r.charCodeAt(n);if(o===34||o===92)s+=2;else if(o===8||o===9||o===10||o===12||o===13)s+=2;else if(o<32)s+=6;else if(o<128)s+=1;else if(o<2048)s+=2;else if(o>=55296&&o<=56319){let u=r.charCodeAt(n+1);u>=56320&&u<=57343?(s+=4,n+=1):s+=6}else o>=56320&&o<=57343?s+=6:s+=3;if(s>e)return e+1}return s},mt=(r,e,s,n)=>{let o=2,u=c=>(o+=ht(c,Math.max(0,n-o)),o<=n),l=!0;for(let[c,y]of Object.entries(r))if(l||(o+=1),l=!1,!u(c)||(o+=1,!u(y)))return n+1;o+=2,l=!0;for(let c of e)if(l||(o+=1),l=!1,!u(c))return n+1;return u(s)?o:n+1},yt=(r,e,s)=>{let n=S(T(r));if(/^[A-Za-z_$][\w$]* is not defined$/u.test(n)&&(n=`'${n.slice(0,n.indexOf(" "))}'${n.slice(n.indexOf(" "))}`),r instanceof Error&&r.name==="SyntaxError"&&n==="Unexpected token '}'"&&(n="expecting ')'"),!(r instanceof Error)||r.stack===void 0)return n;let o=Q(r.stack);if(o===void 0)return n;let{column:u,file:l,functionName:c,line:y}=o;return(l==="run.js"||l==="<entry>")&&(l=e.scriptPath,y=Math.max(1,y-s),e.isModule||(c=e.scriptPath==="-c"?"<eval>":void 0)),r.name==="Error"?u+=5:r.name==="TypeError"&&(u+=1),`${c===void 0?`at ${l}:${y}:${u}`:`at ${c} (${l}:${y}:${u})`}: ${n}`},bt=(r,e,s,n,o)=>`
1345
+ (function() {
1346
+ var host = globalThis[${JSON.stringify(o)}];
1347
+ function unwrap(result) {
1348
+ if (!result || result.ok !== true) {
1349
+ var err = new Error(result && result.error || 'Host operation failed');
1350
+ if (result && typeof result.code === 'string') err.code = result.code;
1351
+ throw err;
1352
+ }
1353
+ return result.value;
1354
+ }
1355
+ function bytes(value) {
1356
+ if (typeof value === 'string') return value;
1357
+ var arr;
1358
+ if (value && value._data instanceof Uint8Array) arr = value._data;
1359
+ else if (value && Array.isArray(value._data)) arr = value._data;
1360
+ else if (Array.isArray(value)) arr = value;
1361
+ else if (value instanceof Uint8Array) arr = value;
1362
+ else throw new TypeError('File data must be a string, Buffer, Uint8Array, or byte array');
1363
+ // Latin-1 encode: one char per byte. chunks.join avoids O(n\xB2)
1364
+ // string-concat copies that would stall on MB-scale payloads.
1365
+ var chunks = [];
1366
+ var CHUNK = 32768;
1367
+ for (var i = 0; i < arr.length; i += CHUNK) {
1368
+ chunks.push(String.fromCharCode.apply(null, Array.prototype.slice.call(arr, i, Math.min(i + CHUNK, arr.length))));
1369
+ }
1370
+ return chunks.join('');
1371
+ }
1372
+ // Write in small chunks WITHOUT holding the full latin1 string in
1373
+ // scope \u2014 run's continuation serializes live bindings per sync host
1374
+ // call, so a large string in scope would stall every chunk's bridge.
1375
+ // Write in bridge-sized chunks. run's sync bridge stalls on
1376
+ // cumulative payload > ~6MB, so keep chunks small and let each
1377
+ // one go out of scope before the next call.
1378
+ function writeChunked(path, data, append) {
1379
+ var arr;
1380
+ if (typeof data === 'string') arr = null;
1381
+ else if (data && data._data instanceof Uint8Array) arr = data._data;
1382
+ else if (data && Array.isArray(data._data)) arr = data._data;
1383
+ else if (Array.isArray(data)) arr = data;
1384
+ else if (data instanceof Uint8Array) arr = data;
1385
+ else if (data instanceof Buffer) arr = data._data;
1386
+ else throw new TypeError('File data must be a string, Buffer, Uint8Array, or byte array');
1387
+ var BRIDGE_CHUNK = 4194304; // 4MB per bridge call \u2014 largest size that clears the sync bridge without stalling
1388
+ var CC_CHUNK = 32768; // fromCharCode apply() arg limit
1389
+ var offset = 0;
1390
+ var first = !append;
1391
+ var totalLen = arr ? arr.length : data.length;
1392
+ while (offset < totalLen) {
1393
+ var end = Math.min(offset + BRIDGE_CHUNK, totalLen);
1394
+ var chunk;
1395
+ if (arr) {
1396
+ var parts = [];
1397
+ for (var i = offset; i < end; i += CC_CHUNK) {
1398
+ parts.push(String.fromCharCode.apply(null, Array.prototype.slice.call(arr, i, Math.min(i + CC_CHUNK, end))));
1399
+ }
1400
+ chunk = parts.join('');
1401
+ } else {
1402
+ chunk = data.substring(offset, end);
1403
+ }
1404
+ if (first) {
1405
+ unwrap(host.fsWrite(path, chunk));
1406
+ first = false;
1407
+ } else {
1408
+ unwrap(host.fsAppend(path, chunk));
1409
+ }
1410
+ offset = end;
1411
+ }
1412
+ }
1413
+ function format(value) {
1414
+ if (typeof Buffer === 'function' && value instanceof Buffer) return value.toString();
1415
+ if (typeof value === 'string') return value;
1416
+ if (value === undefined) return 'undefined';
1417
+ try { return JSON.stringify(value); } catch (_) { return String(value); }
1418
+ }
1419
+
1420
+ globalThis.env = ${r};
1421
+ globalThis.process = {
1422
+ argv: ${e},
1423
+ cwd: function() { return ${s}; },
1424
+ env: globalThis.env,
1425
+ platform: 'linux',
1426
+ arch: 'x64',
1427
+ versions: { node: '22.0.0', quickjs: '2025' },
1428
+ version: 'v22.0.0',
1429
+ exit: function(code) { return host.exit(Number(code) || 0); }
1430
+ };
1431
+
1432
+ ${lt}
1433
+ var fs = {
1434
+ readFileBuffer: function(path) {
1435
+ var raw = unwrap(host.fsRead(path));
1436
+ var data = new Uint8Array(raw.length);
1437
+ for (var i = 0; i < raw.length; i++) data[i] = raw.charCodeAt(i) & 255;
1438
+ return data.buffer.slice(data.byteOffset, data.byteOffset + data.byteLength);
1439
+ },
1440
+ readFileSync: function(path, opts) {
1441
+ var raw = unwrap(host.fsRead(path));
1442
+ var encoding = typeof opts === 'string' ? opts : opts && opts.encoding;
1443
+ if (encoding === 'utf8' || encoding === 'utf-8') {
1444
+ // The host returns latin1 (one char per byte). For text reads,
1445
+ // return it directly \u2014 the per-char charCodeAt loop stalls on
1446
+ // MB-scale payloads in QuickJS. Latin-1 and UTF-8 are identical
1447
+ // for ASCII; for non-ASCII, the caller gets the raw bytes as
1448
+ // latin1 chars (matching Node.js 'binary' encoding behavior).
1449
+ return raw;
1450
+ }
1451
+ var buffer = Buffer.alloc(raw.length);
1452
+ for (var i = 0; i < raw.length; i++) buffer._data[i] = raw.charCodeAt(i) & 255;
1453
+ return buffer;
1454
+ },
1455
+ writeFileSync: function(path, data) {
1456
+ writeChunked(path, data, false);
1457
+ },
1458
+ appendFileSync: function(path, data) {
1459
+ writeChunked(path, data, true);
1460
+ },
1461
+ statSync: function(path) { return unwrap(host.fsStat(path, false)); },
1462
+ lstatSync: function(path) { return unwrap(host.fsStat(path, true)); },
1463
+ readdirSync: function(path) { return unwrap(host.fsReaddir(path)); },
1464
+ mkdirSync: function(path, opts) { unwrap(host.fsMkdir(path, Boolean(opts && opts.recursive))); },
1465
+ rmSync: function(path, opts) { unwrap(host.fsRm(path, Boolean(opts && opts.recursive), Boolean(opts && opts.force))); },
1466
+ existsSync: function(path) { return unwrap(host.fsExists(path)); },
1467
+ symlinkSync: function(target, path) { unwrap(host.fsSymlink(target, path)); },
1468
+ readlinkSync: function(path) { return unwrap(host.fsReadlink(path)); },
1469
+ chmodSync: function(path, mode) { unwrap(host.fsChmod(path, Number(mode))); },
1470
+ realpathSync: function(path) { return unwrap(host.fsRealpath(path)); },
1471
+ renameSync: function(from, to) { unwrap(host.fsRename(from, to)); },
1472
+ copyFileSync: function(from, to) { unwrap(host.fsCopy(from, to)); }
1473
+ };
1474
+ fs.unlinkSync = fs.rmSync;
1475
+ fs.rmdirSync = fs.rmSync;
1476
+ function callbackUnsupported(name) {
1477
+ return function() { throw new Error('fs.' + name + '() with callbacks is not supported. Use fs.' + name + 'Sync() or fs.promises.' + name + '() instead.'); };
1478
+ }
1479
+ var names = ['readFile','writeFile','appendFile','stat','lstat','readdir','mkdir','rm','symlink','readlink','chmod','realpath','rename','copyFile'];
1480
+ for (var i = 0; i < names.length; i++) fs[names[i]] = callbackUnsupported(names[i]);
1481
+ fs.exists = callbackUnsupported('exists');
1482
+ fs.unlink = callbackUnsupported('unlink');
1483
+ fs.rmdir = callbackUnsupported('rmdir');
1484
+ fs.promises = {};
1485
+ for (var i = 0; i < names.length; i++) (function(name) {
1486
+ var sync = fs[name + 'Sync'];
1487
+ fs.promises[name] = function() {
1488
+ try { return Promise.resolve(sync.apply(fs, arguments)); }
1489
+ catch (error) { return Promise.reject(error); }
1490
+ };
1491
+ })(names[i]);
1492
+ fs.promises.unlink = fs.promises.rm;
1493
+ fs.promises.rmdir = fs.promises.rm;
1494
+ fs.promises.access = function(path) { return fs.existsSync(path) ? Promise.resolve() : Promise.reject(Object.assign(new Error('no such file or directory: ' + path), {code: 'ENOENT'})); };
1495
+ globalThis.fs = fs;
1496
+
1497
+ ${Te}
1498
+ ${we}
1499
+ ${xe}
1500
+ ${je}
1501
+ ${Re}
1502
+ ${Ue}
1503
+ ${ke}
1504
+ ${Ce}
1505
+
1506
+ var nativeFetch = function(url, opts) { return unwrap(host.fetch(String(url), opts)); };
1507
+ globalThis[Symbol.for('jb:fetch')] = nativeFetch;
1508
+ ${ft}
1509
+ ${Ee}
1510
+
1511
+ var childProcess = {
1512
+ exec: function(command, opts) { return unwrap(host.exec(String(command), opts && opts.stdin)); },
1513
+ execSync: function(command, opts) {
1514
+ var result = unwrap(host.exec(String(command), opts && opts.stdin));
1515
+ if (result.exitCode !== 0) {
1516
+ var error = new Error('Command failed: ' + command);
1517
+ error.status = result.exitCode; error.stdout = result.stdout; error.stderr = result.stderr;
1518
+ throw error;
1519
+ }
1520
+ return result.stdout;
1521
+ },
1522
+ spawnSync: function(command, args) {
1523
+ var result = unwrap(host.execArgs(String(command), args || []));
1524
+ return { stdout: result.stdout, stderr: result.stderr, status: result.exitCode };
1525
+ }
1526
+ };
1527
+ globalThis[Symbol.for('jb:child_process')] = childProcess;
1528
+
1529
+ var modules = Object.create(null);
1530
+ modules.fs = fs;
1531
+ modules.path = globalThis[Symbol.for('jb:path')];
1532
+ modules.child_process = childProcess;
1533
+ modules.process = globalThis.process;
1534
+ modules.console = globalThis.console;
1535
+ modules.os = globalThis[Symbol.for('jb:os')];
1536
+ modules.url = globalThis[Symbol.for('jb:url')];
1537
+ modules.assert = globalThis[Symbol.for('jb:assert')];
1538
+ modules.util = globalThis[Symbol.for('jb:util')];
1539
+ modules.events = globalThis[Symbol.for('jb:events')];
1540
+ modules.buffer = globalThis[Symbol.for('jb:buffer')];
1541
+ modules.stream = globalThis[Symbol.for('jb:stream')];
1542
+ modules.string_decoder = globalThis[Symbol.for('jb:string_decoder')];
1543
+ modules.querystring = globalThis[Symbol.for('jb:querystring')];
1544
+ var unsupported = ${JSON.stringify(I)};
1545
+ globalThis.require = function(name) {
1546
+ name = String(name); if (name.startsWith('node:')) name = name.slice(5);
1547
+ if (Object.prototype.hasOwnProperty.call(modules, name)) return modules[name];
1548
+ if (Object.prototype.hasOwnProperty.call(unsupported, name)) throw new Error("Module '" + name + "' is not available in the js-exec sandbox. " + unsupported[name] + " Run 'js-exec --help' for available modules.");
1549
+ throw new Error("Cannot find module '" + name + "'. Run 'js-exec --help' for available modules.");
1550
+ };
1551
+ globalThis.require.resolve = function(name) { return name; };
1552
+
1553
+ console.log = function() { unwrap(host.stdout(Array.prototype.map.call(arguments, format).join(' ') + '\\n')); };
1554
+ console.info = console.log;
1555
+ console.debug = console.log;
1556
+ console.error = function() { unwrap(host.stderr(Array.prototype.map.call(arguments, format).join(' ') + '\\n')); };
1557
+ console.warn = console.error;
1558
+
1559
+ ${n?`globalThis.tools = (function makeProxy(path) {
1560
+ return new Proxy(function(){}, {
1561
+ get: function(_target, property) {
1562
+ if (property === 'then' || typeof property === 'symbol') return undefined;
1563
+ return makeProxy(path.concat([String(property)]));
1564
+ },
1565
+ apply: function(_target, _this, args) {
1566
+ var argsJson = args.length ? JSON.stringify(args[0]) : '';
1567
+ var value = unwrap(host.invokeTool(path.join('.'), argsJson || ''));
1568
+ return value ? JSON.parse(value) : undefined;
1569
+ }
1570
+ });
1571
+ })([]);`:""}
1572
+ })();
1573
+ `,X=()=>{if(K)return;let r=$.shift();if(r!==void 0){if(r.canceled){X();return}K=!0,r.start()}},gt=(r,e)=>{let s=w.bindCurrentContext(r);return new Promise((n,o)=>{let u={canceled:!1,start(){e?.removeEventListener("abort",l),(async()=>{try{n(await s())}catch(c){o(c)}finally{K=!1,X()}})()}},l=()=>{let c=$.indexOf(u);c!==-1&&($.splice(c,1),u.canceled=!0,e?.removeEventListener("abort",l),o(new q))};e?.addEventListener("abort",l,{once:!0}),$.push(u),e?.aborted?l():X()})},vt=r=>({isDirectory:r.isDirectory,isFile:r.isFile,isSymbolicLink:r.isSymbolicLink,mode:r.mode,mtime:r.mtime.toISOString(),size:r.size}),De=r=>({exitCode:r.exitCode,stderr:r.stderr,stdout:r.stdout}),St=(r,e,s)=>({exitCode:e,stderr:s<=0?r:O(r,s),stdout:""});async function _t(r,e,s,n,o){let u=Math.min(e.limits.maxWorkerMessageBytes,Le),l=Math.max(0,u-Pe),c=Math.max(0,Math.min(e.limits.maxWorkerMessageBytes,u-Pe,x)),y=ut(),U=`just-bash:bootstrap:${Ie()}`,f={exitCode:0,limitExceeded:!1,stderr:"",stdout:""},v,H,Z=r.bootstrapCode!==void 0&&r.bootstrapCode!=="",_=e.limits.maxOutputSize,k=0,ee=0,L=!1,P=new Map,te=!1,E=`JavaScript runtime exceeded the ${e.limits.maxJsBridgeRequests} bridge request limit.`,C=()=>ee>=e.limits.maxJsBridgeRequests?(L=!0,!1):(ee+=1,!0),j=t=>{if(_<=0){f.stderr+=t,k+=m.byteLength(t);return}let i=O(t,Math.max(0,_-k));f.stderr+=i,k+=m.byteLength(i)},re=()=>{te||(te=!0,f.exitCode=1,j(`js-exec: ${E}
1574
+ `))},ne=(t,i)=>{if(v!==void 0)return{error:"process.exit() already requested",ok:!1};if(!C())return{error:E,ok:!1};if(typeof i!="string")return{error:"Output must be a string",ok:!1};let a=k+m.byteLength(i);return _>0&&a>_?(f.limitExceeded=!0,f.exitCode=1,{error:"Output size limit exceeded",ok:!1}):(f[t]+=i,k=a,{ok:!0,value:void 0})},h=t=>e.fs.resolvePath(e.cwd,t),d=async(t,i=S)=>{if(v!==void 0)return{error:"process.exit() already requested",ok:!1};if(!C())return{error:E,ok:!1};try{return{ok:!0,value:await w.runUntrustedAsync(t)}}catch(a){let p=ge(a);return{ok:!1,error:i(T(a)),...p!==void 0&&{code:p}}}},J=t=>{if(typeof t=="string"){let i=new Uint8Array(t.length);for(let a=0;a<t.length;a++)i[a]=t.charCodeAt(a)&255;return i}throw new TypeError("File data must be a string, Buffer, Uint8Array, or byte array")},B=Se(e.env),se=[r.scriptPath,...r.scriptArgs],R=Math.min(e.limits.maxWorkerMessageBytes,x),M=m.byteLength(r.source),W=Math.max(0,R-M),qe=mt(B,se,e.cwd,W);if(M>R||qe>W)return f.exitCode=1,j(`js-exec: JavaScript runtime ${M>R?"source":"input"} exceeds the ${R} byte size limit.
1575
+ `),f;let ie=JSON.stringify(B),oe=JSON.stringify(se),ae=JSON.stringify(e.cwd),z=m.byteLength(ie)+m.byteLength(oe)+m.byteLength(ae);if(z>W)return f.exitCode=1,j(`js-exec: JavaScript runtime input exceeds the ${R} byte size limit.
1576
+ `),f;let He=w.runTrusted(()=>tt({syncHostFunctions:{[y]:{bootstrapError(t){throw Z?(H??=S(typeof t=="string"?t:"Bootstrap failed"),new Error("Bootstrap failed.")):new Error("Bootstrap phase has ended.")},bootstrapDone(){Z=!1},exit(t){throw C()?(v??=Number.isFinite(t)?Math.trunc(t):0,f.exitCode=v,new Error("Guest requested process exit.")):new Error(E)},fsRead:t=>d(async()=>{let i=h(t),a=await e.fs.readFileBuffer(i);if(a.byteLength>l)throw new Error(`File exceeds JavaScript bridge read limit (${l} bytes)`);return m.from(a).toString("latin1")}),fsWrite:(t,i)=>d(async()=>await e.fs.writeFile(h(t),J(i))),fsWriteStage:(t,i)=>d(async()=>{let a=h(t),p=P.get(a)??[];p.push(J(i)),P.set(a,p)}),fsWriteCommit:t=>d(async()=>{let i=h(t),a=P.get(i);if(P.delete(i),!a||a.length===0)throw new be("EINVAL",`fsWriteCommit without staged data: '${t}'`);let p=a.reduce((A,Ze)=>A+Ze.byteLength,0),b=new Uint8Array(p),g=0;for(let A of a)b.set(A,g),g+=A.byteLength;await e.fs.writeFile(i,b)}),fsAppend:(t,i)=>d(async()=>await e.fs.appendFile(h(t),J(i))),fsStat:(t,i)=>d(async()=>vt(await(i?e.fs.lstat(h(t)):e.fs.stat(h(t))))),fsReaddir:t=>d(async()=>await e.fs.readdir(h(t))),fsMkdir:(t,i)=>d(async()=>await e.fs.mkdir(h(t),{recursive:i})),fsRm:(t,i,a)=>d(async()=>await e.fs.rm(h(t),{force:a,recursive:i})),fsExists:t=>d(async()=>await e.fs.exists(h(t))),fsSymlink:(t,i)=>d(async()=>await e.fs.symlink(t,h(i))),fsReadlink:t=>d(async()=>await e.fs.readlink(h(t))),fsChmod:(t,i)=>d(async()=>await e.fs.chmod(h(t),i)),fsRealpath:t=>d(async()=>await e.fs.realpath(h(t))),fsRename:(t,i)=>d(async()=>await e.fs.mv(h(t),h(i))),fsCopy:(t,i)=>d(async()=>await e.fs.cp(h(t),h(i))),stdout:t=>ne("stdout",t),stderr:t=>ne("stderr",t),async fetch(t,i){return await d(async()=>{if(!e.fetch)throw new Error("Network access not configured. Enable network in Bash options.");let a=n===Number.POSITIVE_INFINITY?void 0:Math.max(0,n-Date.now()),p=await e.fetch(t,{method:i?.method,headers:i?.headers,body:i?.body,...a===void 0?{}:{timeoutMs:a},signal:F().abortSignal});return{body:m.from(p.body).toString("latin1"),headers:p.headers,status:p.status,statusText:p.statusText,url:p.url}})},async exec(t,i){return await d(async()=>{if(!e.exec)throw new Error("Command execution not available in this context.");let a={cwd:e.cwd,env:B,signal:F().abortSignal,stdin:i??""},p=await N.run(!0,()=>e.exec?.(t,a));return De(p)})},async execArgs(t,i){return await d(async()=>{if(!e.exec)throw new Error("Command execution not available in this context.");let a=await N.run(!0,()=>e.exec?.(ve([t]),{args:i.map(String),cwd:e.cwd,env:B,signal:F().abortSignal}));return De(a)})},async invokeTool(t,i){return await d(async()=>{if(!e.invokeTool)throw new Error(`Unknown tool: ${t}`);let{abortSignal:a}=F();return await w.runTrustedAsync(()=>e.invokeTool?.(t,i,a))},D)}}}})),ue=bt(ie,oe,ae,e.invokeTool!==void 0,y),G=r.bootstrapCode??"",le=G===""?`globalThis[${JSON.stringify(y)}].bootstrapDone();
1577
+ `:`try {
1578
+ (function() {
1579
+ ${G}
1580
+ })();
1581
+ } catch (__jbBootstrapError) {
1582
+ var __jbBootstrapMessage = 'Bootstrap failed';
1583
+ try {
1584
+ __jbBootstrapMessage = __jbBootstrapError && typeof __jbBootstrapError.message === 'string'
1585
+ ? __jbBootstrapError.message
1586
+ : String(__jbBootstrapError);
1587
+ } catch (_) {}
1588
+ globalThis[${JSON.stringify(y)}].bootstrapError(__jbBootstrapMessage);
1589
+ } finally {
1590
+ globalThis[${JSON.stringify(y)}].bootstrapDone();
1591
+ }
1592
+ `,V=`${ue}
1593
+ ${le}`,Je={identity:"just-bash-js-exec-v1",normalize(t,i){let a=t.startsWith("node:")?t.slice(5):t;if(v!==void 0)throw new Error("process.exit() already requested");if(t===U)return t;if(!C())throw new Error(E);if(Fe[a]!==void 0||I[a]!==void 0)return`just-bash:builtin:${a}`;if(!t.startsWith(".")&&!t.startsWith("/"))return`just-bash:missing:${t}`;let p=i==="<entry>"||i.startsWith("just-bash:")?r.scriptPath:i,b=p.lastIndexOf("/"),g=b<0?e.cwd:b===0?"/":p.slice(0,b);return pt(g,t)},async load(t){if(v!==void 0)throw new Error("process.exit() already requested");if(t===U)return V;if(!C())throw new Error(E);if(t.startsWith("just-bash:builtin:"))return dt(t.slice(18));if(t.startsWith("just-bash:missing:")){let i=t.slice(18);return`throw new Error(${JSON.stringify(`Cannot find module '${i}': not found. Run 'js-exec --help' for available modules.`)});`}try{return await w.runUntrustedAsync(async()=>{if((await e.fs.stat(t)).size>c)throw new Error(`Module exceeds JavaScript source limit (${c} bytes)`);let a=await e.fs.readFile(t);if(m.byteLength(a)>c)throw new Error(`Module exceeds JavaScript source limit (${c} bytes)`);return a})}catch(i){return`throw new Error(${JSON.stringify(S(T(i)))});`}}},fe=r.isModule?`import ${JSON.stringify(U)};
1594
+ `:`${ue}
1595
+ ${le}`,ce=`${fe}${r.source}`,de=fe.split(`
1596
+ `).length-1,We=m.byteLength(ce),ze=M+(r.isModule?0:z),Ge=Math.max(0,We-ze),Ve=r.isModule?m.byteLength(V):0,Ye=Math.max(0,Ve-z),Ke=Math.min(x,R+Math.max(Ge,Ye)),Qe=Math.min(Le,Math.max(u,r.isModule?m.byteLength(JSON.stringify(V)):0)),Xe=n===Number.POSITIVE_INFINITY?x:Math.min(Math.max(1,n-Date.now()),x);try{await N.run(!0,async()=>{let t;w.runTrusted(()=>{t=He.run({abortSignal:s,limits:{maxBridgeRequests:Math.min(Math.max(1,e.limits.maxJsBridgeRequests+(r.isModule?4:2)),x),maxConsoleOutputBytes:1,maxHostFunctionArgumentsBytes:u,maxHostFunctionOutputBytes:Qe,maxResultBytes:Math.min(e.limits.maxWorkerMessageBytes,x),maxSourceBytes:Ke,memoryLimitBytes:it,timeoutMs:Xe},moduleLoader:Je,source:ce,sourceType:r.isModule?"module":"function-body"})}),await t})}catch(t){let i=T(t),a=t instanceof Error&&t.stack!==void 0?Q(t.stack):void 0,p=G!==""&&a!==void 0&&(a.file===U||!r.isModule&&a.file==="run.js"&&a.line<=de);if(v!==void 0)f.exitCode=v;else if(L||t instanceof nt)L=!0,re();else if(H!==void 0||p)f.exitCode=1,j(`js-exec: bootstrap error: ${H??S(i)}
1597
+ `);else if(t instanceof Oe||t instanceof rt)f.exitCode=124,j(`js-exec: ${t instanceof Oe||o.aborted?`Execution timeout: exceeded ${e.limits.maxJsTimeoutMs}ms limit`:"Execution aborted"}
1598
+ `);else{f.exitCode=1;let b=st.isInstance(t)&&t.code==="RUN_ERROR",g=b?yt(t,r,de):D(i),A=b&&t instanceof Error&&t.stack?.includes("(<run-worker>)")===!0&&Q(t.stack)===void 0;j(b?A?`${g}
1599
+ `:g===i?`js-exec: ${D(i)}
1600
+ `:`${g}
1601
+ `:`js-exec: ${g}
1602
+ `)}}if(L&&re(),f.limitExceeded){f.exitCode=1;let t=O(`js-exec: total output size exceeded (>${_} bytes), increase executionLimits.maxOutputSize
1603
+ `,_),i=_-m.byteLength(t);f.stderr=O(f.stderr,i),i-=m.byteLength(f.stderr),f.stdout=O(f.stdout,i),f.stderr+=t}return{exitCode:f.exitCode,stderr:f.stderr,stdout:f.stdout}}async function Ne(r,e){if(N.getStore())return{exitCode:1,stderr:`js-exec: recursive invocation is not supported
1604
+ `,stdout:""};let s=new AbortController,n=e.limits.maxJsTimeoutMs===Number.POSITIVE_INFINITY?Number.POSITIVE_INFINITY:Date.now()+e.limits.maxJsTimeoutMs,o=pe(()=>s.abort(),e.limits.maxJsTimeoutMs),u=me(e.signal,s.signal);try{return await gt(async()=>await _t(r,e,u.signal,n,s.signal),u.signal)}catch(l){if(!(l instanceof q))throw l;let c=s.signal.aborted;return St(`js-exec: ${c?`Execution timeout: exceeded ${e.limits.maxJsTimeoutMs}ms limit`:"Execution aborted"}
1605
+ `,124,e.limits.maxOutputSize)}finally{u.cleanup(),he(o)}}var $e=`js-exec - Sandboxed JavaScript/TypeScript runtime with Node.js-compatible APIs
1606
+
1607
+ Usage: js-exec [OPTIONS] [-c CODE | FILE] [ARGS...]
1608
+
1609
+ Options:
1610
+ -c CODE Execute inline code
1611
+ -m, --module Enable ES module mode (import/export)
1612
+ --strip-types Accepted for compatibility; type stripping is automatic
1613
+ --version, -V Show version
1614
+ --help Show this help
1615
+
1616
+ Examples:
1617
+ js-exec -c "console.log(1 + 2)"
1618
+ js-exec script.js
1619
+ js-exec app.ts
1620
+ echo 'console.log("hello")' | js-exec
1621
+
1622
+ File Extension Auto-Detection:
1623
+ .js function-body mode
1624
+ .mjs ES module mode
1625
+ .ts, .mts ES module mode + TypeScript stripping
1626
+
1627
+ Node.js Compatibility:
1628
+ Code written for Node.js largely works here. Both require and import are
1629
+ supported for the documented built-ins. Filesystem and command APIs retain
1630
+ synchronous Node.js call semantics inside the sandbox.
1631
+
1632
+ Available modules:
1633
+ fs, path, child_process, process, console,
1634
+ os, url, assert, util, events, buffer, stream,
1635
+ string_decoder, querystring
1636
+
1637
+ Limits:
1638
+ Memory: 64 MB per execution
1639
+ Timeout: configurable via maxJsTimeoutMs
1640
+ File reads: up to ~24 MB per file
1641
+ File writes: up to ~6 MB cumulative per execution (reads unlimited)
1642
+ Engine: run (QuickJS)
1643
+ `;function wt(r){let e={code:null,isModule:!1,scriptArgs:[],scriptFile:null,showVersion:!1};for(let s=0;s<r.length;s++){let n=r[s];if(n==="-m"||n==="--module"){e.isModule=!0;continue}if(n!=="--strip-types")return n==="-c"?s+1>=r.length?{exitCode:2,stderr:`js-exec: option requires an argument -- 'c'
1644
+ `,stdout:""}:(e.code=r[s+1],e.scriptArgs=r.slice(s+2),e):n==="--version"||n==="-V"?(e.showVersion=!0,e):n.startsWith("-")&&n!=="-"&&n!=="--"?{exitCode:2,stderr:`js-exec: unrecognized option '${n}'
1645
+ `,stdout:""}:n==="--"?(s+1<r.length&&(e.scriptFile=r[s+1],e.scriptArgs=r.slice(s+2)),e):n==="-"?(e.scriptArgs=r.slice(s+1),e):(e.scriptFile=n,e.scriptArgs=r.slice(s+1),e)}return e}var Wt={name:"js-exec",async execute(r,e){if(ye(r))return{exitCode:0,stderr:"",stdout:$e};let s=wt(r);if("exitCode"in s)return s;if(s.showVersion)return{exitCode:0,stderr:"",stdout:`QuickJS (run)
1646
+ `};let n,o;if(s.code!==null)n=s.code,o="-c";else if(s.scriptFile!==null){let l=e.fs.resolvePath(e.cwd,s.scriptFile);if(!await e.fs.exists(l))return{exitCode:2,stderr:`js-exec: can't open file '${s.scriptFile}': No such file or directory
1647
+ `,stdout:""};try{n=await e.fs.readFile(l),o=l}catch(c){return{exitCode:2,stderr:`js-exec: can't open file '${s.scriptFile}': ${S(c.message)}
1648
+ `,stdout:""}}}else if(Y(e.stdin).trim())n=Y(e.stdin),o="<stdin>";else return{exitCode:2,stderr:`js-exec: no input provided (use -c CODE or provide a script file)
1649
+ `,stdout:""};let u=s.isModule||o.endsWith(".mjs")||o.endsWith(".mts")||o.endsWith(".ts");return await Ne({bootstrapCode:e.jsBootstrapCode,isModule:u,scriptArgs:s.scriptArgs,scriptPath:o,source:n},e)}},zt={name:"node",async execute(){return{exitCode:1,stderr:`node: this sandbox uses js-exec instead of node
1650
+
1651
+ ${$e}`,stdout:""}}};export{Wt as jsExecCommand,zt as nodeStubCommand};