just-bash 3.2.0 → 3.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (288) hide show
  1. package/CHANGELOG.md +71 -0
  2. package/README.md +47 -0
  3. package/dist/ast/types.d.ts +4 -1
  4. package/dist/bin/chunks/{awk2-7UZLEPVX.js → awk2-DZN2ZRSE.js} +1 -1
  5. package/dist/bin/{shell/chunks/base64-W6FVFNXJ.js → chunks/base64-TP4NUOEB.js} +1 -1
  6. package/dist/bin/chunks/{cat-5YECZSFQ.js → cat-A3REFE6L.js} +1 -1
  7. package/dist/bin/{shell/chunks/chmod-45TMYSW2.js → chunks/chmod-PHPDPTZD.js} +1 -1
  8. package/dist/bin/{shell/chunks/chunk-DSZQ22OX.js → chunks/chunk-35BSNGJK.js} +1 -1
  9. package/dist/bin/{shell/chunks/chunk-BWRQ5HYX.js → chunks/chunk-3DCUOX7D.js} +1 -1
  10. package/dist/bin/{shell/chunks/chunk-OKU677H3.js → chunks/chunk-57BWX3A3.js} +1 -1
  11. package/dist/bin/chunks/{chunk-QF7PPON7.js → chunk-5SR55TXB.js} +10 -10
  12. package/dist/bin/{shell/chunks/chunk-XAAXPEOP.js → chunks/chunk-62NF3462.js} +1 -1
  13. package/dist/bin/{shell/chunks/chunk-3OYRDLJJ.js → chunks/chunk-6KTOOQK6.js} +1 -1
  14. package/dist/bin/chunks/chunk-6WNZWDBA.js +12 -0
  15. package/dist/bin/chunks/{chunk-QK6BXSHU.js → chunk-7NMBLWZ5.js} +1 -1
  16. package/dist/bin/chunks/{chunk-W4U4QOZF.js → chunk-BPMGKB5E.js} +1 -1
  17. package/dist/bin/{shell/chunks/chunk-NGD6G5ZG.js → chunks/chunk-BXDEO6VY.js} +1 -1
  18. package/dist/bin/chunks/{chunk-XBB73LFB.js → chunk-CMTQFWZK.js} +2 -2
  19. package/dist/bin/chunks/{chunk-ZXIW4JPL.js → chunk-DX5LO7JF.js} +1 -1
  20. package/dist/bin/chunks/{chunk-SSK3N7FN.js → chunk-EJIZDPMG.js} +1 -1
  21. package/dist/bin/chunks/{chunk-PQPFDJFF.js → chunk-FC5CC5UP.js} +1 -1
  22. package/dist/bin/chunks/chunk-FE6GSISP.js +22 -0
  23. package/dist/bin/chunks/{chunk-VTAIIBJT.js → chunk-GE5ERIO2.js} +1 -1
  24. package/dist/bin/{shell/chunks/chunk-NQQ3X7MZ.js → chunks/chunk-GGPUS2B4.js} +1 -1
  25. package/dist/bin/chunks/{chunk-WWOUFMMY.js → chunk-IHS3YLRI.js} +1 -1
  26. package/dist/bin/chunks/{chunk-3HUI54BW.js → chunk-KHS7PCAP.js} +2 -2
  27. package/dist/bin/chunks/chunk-KP2UH5CJ.js +22 -0
  28. package/dist/bin/chunks/{chunk-B7RRNV3A.js → chunk-MLJZPRDV.js} +1 -1
  29. package/dist/bin/chunks/chunk-MOCKUJD6.js +21 -0
  30. package/dist/bin/{shell/chunks/chunk-TPU3OX2A.js → chunks/chunk-NFYXRUSI.js} +1 -1
  31. package/dist/bin/{shell/chunks/chunk-IAAPXDHN.js → chunks/chunk-NWBQ75GZ.js} +1 -1
  32. package/dist/bin/chunks/{chunk-YMELOXDK.js → chunk-O5R7J45W.js} +8 -8
  33. package/dist/bin/chunks/{chunk-7I6MNC5I.js → chunk-OD2SHTFL.js} +1 -1
  34. package/dist/bin/chunks/{chunk-BNYIXXC2.js → chunk-ODCVIRIN.js} +1 -1
  35. package/dist/bin/{shell/chunks/chunk-NJ67YJRE.js → chunks/chunk-ODPB5AH7.js} +1 -1
  36. package/dist/bin/chunks/chunk-QUWWWM4E.js +276 -0
  37. package/dist/bin/chunks/{chunk-JQER3HUP.js → chunk-ROFYAVPF.js} +2 -2
  38. package/dist/bin/chunks/chunk-SHAOH2UJ.js +5 -0
  39. package/dist/bin/chunks/{chunk-PKWK3LQM.js → chunk-SOKKZSUV.js} +1 -1
  40. package/dist/bin/{shell/chunks/chunk-WSLBBXPJ.js → chunks/chunk-TIYIKCEZ.js} +1 -1
  41. package/dist/bin/chunks/{chunk-4SQKKW2M.js → chunk-TKBTWIXO.js} +1 -1
  42. package/dist/bin/{shell/chunks/chunk-VY2K25J4.js → chunks/chunk-TOTKK2XI.js} +1 -1
  43. package/dist/bin/{shell/chunks/chunk-X63MJBLH.js → chunks/chunk-TY77F4UM.js} +1 -1
  44. package/dist/bin/chunks/{chunk-CB4SODHK.js → chunk-XBX7KFWK.js} +19 -19
  45. package/dist/bin/{shell/chunks/chunk-GEUCQ4AB.js → chunks/chunk-XG7YUZ3R.js} +1 -1
  46. package/dist/bin/chunks/chunk-YABXNPH6.js +65 -0
  47. package/dist/bin/{shell/chunks/chunk-TL4JI2SL.js → chunks/chunk-YB3A42T5.js} +17 -18
  48. package/dist/bin/chunks/{chunk-MZM7RVYU.js → chunk-YBTJPT3R.js} +1 -1
  49. package/dist/bin/chunks/{chunk-X5VUGFUL.js → chunk-Z7QCL4IA.js} +1 -1
  50. package/dist/bin/chunks/{echo-4OUEL7QB.js → echo-NYDCCFWB.js} +1 -1
  51. package/dist/bin/{shell/chunks/expr-56X7LYOS.js → chunks/expr-FAB3XEIB.js} +1 -1
  52. package/dist/bin/{shell/chunks/file-SQSOBJLR.js → chunks/file-ZHL2YACR.js} +1 -1
  53. package/dist/bin/chunks/{find-XY2NTAT5.js → find-6DH6TRDN.js} +1 -1
  54. package/dist/bin/chunks/{flag-coverage-WGSE667D.js → flag-coverage-SPPGTKG3.js} +1 -1
  55. package/dist/bin/{shell/chunks/grep-CMT2H2S7.js → chunks/grep-FBVRTH4M.js} +1 -1
  56. package/dist/bin/chunks/{gzip-DJSFJOY6.js → gzip-AWQGRTSF.js} +1 -1
  57. package/dist/bin/{shell/chunks/head-KPRH4HKC.js → chunks/head-A7CPWX7R.js} +1 -1
  58. package/dist/bin/{shell/chunks/html-to-markdown-WUBAMB4O.js → chunks/html-to-markdown-EMODJ24M.js} +1 -1
  59. package/dist/bin/chunks/{jq-ACCMBTSD.js → jq-DXL4NMI5.js} +1 -1
  60. package/dist/bin/{shell/chunks/js-exec-4KNUPGHA.js → chunks/js-exec-BFLXGNPQ.js} +1 -1
  61. package/dist/bin/chunks/js-exec-worker.js +56 -20
  62. package/dist/bin/chunks/{ls-FTHYNINH.js → ls-R6DAGGBH.js} +1 -1
  63. package/dist/bin/chunks/{od-A7CW5RMS.js → od-ZPR6FUOW.js} +1 -1
  64. package/dist/bin/{shell/chunks/paste-YJLYVJMP.js → chunks/paste-RQKXCKQO.js} +1 -1
  65. package/dist/bin/chunks/{printf-F2KOCULO.js → printf-CNXNRQ3I.js} +1 -1
  66. package/dist/bin/chunks/python3-WKVKCO33.js +14 -0
  67. package/dist/bin/{shell/chunks/rg-JRKJ6I4X.js → chunks/rg-34TWIR7N.js} +1 -1
  68. package/dist/bin/{shell/chunks/sed-QJ2LNV2N.js → chunks/sed-SW74NKGU.js} +1 -1
  69. package/dist/bin/{shell/chunks/sleep-FUDWGDCE.js → chunks/sleep-J2AVORMB.js} +1 -1
  70. package/dist/bin/{shell/chunks/split-7IYQYKOW.js → chunks/split-EDDYGW4A.js} +1 -1
  71. package/dist/bin/chunks/{sqlite3-ZXF6BGDW.js → sqlite3-AZ27WWV7.js} +1 -1
  72. package/dist/bin/{shell/chunks/stat-Y5D3VPLG.js → chunks/stat-XNGV2W6W.js} +1 -1
  73. package/dist/bin/{shell/chunks/tail-QISQLA3I.js → chunks/tail-H2WOZSEI.js} +1 -1
  74. package/dist/bin/chunks/{tar-TB2XWXF6.js → tar-MZP7QXR4.js} +1 -1
  75. package/dist/bin/{shell/chunks/timeout-TDOV6JDA.js → chunks/timeout-GH6S72QX.js} +1 -1
  76. package/dist/bin/chunks/{tr-AR6EK7JH.js → tr-RVCBERJ4.js} +1 -1
  77. package/dist/bin/chunks/undici-CKF2L2IP.js +141 -0
  78. package/dist/bin/chunks/worker.js +17 -1
  79. package/dist/bin/chunks/{xan-D6US4ZGL.js → xan-BSNJF6SH.js} +1 -1
  80. package/dist/bin/chunks/{xan-view-QGKWT354.js → xan-view-H3LNQ72O.js} +1 -1
  81. package/dist/bin/chunks/{yq-EYV7HLKK.js → yq-GNMXK6OP.js} +1 -1
  82. package/dist/bin/just-bash.js +396 -394
  83. package/dist/bin/shell/chunks/{awk2-7UZLEPVX.js → awk2-DZN2ZRSE.js} +1 -1
  84. package/dist/bin/{chunks/base64-W6FVFNXJ.js → shell/chunks/base64-TP4NUOEB.js} +1 -1
  85. package/dist/bin/shell/chunks/{cat-5YECZSFQ.js → cat-A3REFE6L.js} +1 -1
  86. package/dist/bin/{chunks/chmod-45TMYSW2.js → shell/chunks/chmod-PHPDPTZD.js} +1 -1
  87. package/dist/bin/{chunks/chunk-DSZQ22OX.js → shell/chunks/chunk-35BSNGJK.js} +1 -1
  88. package/dist/bin/{chunks/chunk-BWRQ5HYX.js → shell/chunks/chunk-3DCUOX7D.js} +1 -1
  89. package/dist/bin/{chunks/chunk-OKU677H3.js → shell/chunks/chunk-57BWX3A3.js} +1 -1
  90. package/dist/bin/shell/chunks/{chunk-QF7PPON7.js → chunk-5SR55TXB.js} +10 -10
  91. package/dist/bin/{chunks/chunk-XAAXPEOP.js → shell/chunks/chunk-62NF3462.js} +1 -1
  92. package/dist/bin/{chunks/chunk-3OYRDLJJ.js → shell/chunks/chunk-6KTOOQK6.js} +1 -1
  93. package/dist/bin/shell/chunks/chunk-6WNZWDBA.js +12 -0
  94. package/dist/bin/shell/chunks/{chunk-QK6BXSHU.js → chunk-7NMBLWZ5.js} +1 -1
  95. package/dist/bin/shell/chunks/{chunk-W4U4QOZF.js → chunk-BPMGKB5E.js} +1 -1
  96. package/dist/bin/{chunks/chunk-NGD6G5ZG.js → shell/chunks/chunk-BXDEO6VY.js} +1 -1
  97. package/dist/bin/shell/chunks/{chunk-XBB73LFB.js → chunk-CMTQFWZK.js} +2 -2
  98. package/dist/bin/shell/chunks/{chunk-ZXIW4JPL.js → chunk-DX5LO7JF.js} +1 -1
  99. package/dist/bin/shell/chunks/{chunk-SSK3N7FN.js → chunk-EJIZDPMG.js} +1 -1
  100. package/dist/bin/shell/chunks/{chunk-PQPFDJFF.js → chunk-FC5CC5UP.js} +1 -1
  101. package/dist/bin/shell/chunks/chunk-FE6GSISP.js +22 -0
  102. package/dist/bin/shell/chunks/{chunk-VTAIIBJT.js → chunk-GE5ERIO2.js} +1 -1
  103. package/dist/bin/{chunks/chunk-NQQ3X7MZ.js → shell/chunks/chunk-GGPUS2B4.js} +1 -1
  104. package/dist/bin/shell/chunks/{chunk-WWOUFMMY.js → chunk-IHS3YLRI.js} +1 -1
  105. package/dist/bin/shell/chunks/{chunk-3HUI54BW.js → chunk-KHS7PCAP.js} +2 -2
  106. package/dist/bin/shell/chunks/chunk-KP2UH5CJ.js +22 -0
  107. package/dist/bin/shell/chunks/{chunk-B7RRNV3A.js → chunk-MLJZPRDV.js} +1 -1
  108. package/dist/bin/shell/chunks/chunk-MOCKUJD6.js +21 -0
  109. package/dist/bin/{chunks/chunk-TPU3OX2A.js → shell/chunks/chunk-NFYXRUSI.js} +1 -1
  110. package/dist/bin/{chunks/chunk-IAAPXDHN.js → shell/chunks/chunk-NWBQ75GZ.js} +1 -1
  111. package/dist/bin/shell/chunks/{chunk-YMELOXDK.js → chunk-O5R7J45W.js} +8 -8
  112. package/dist/bin/shell/chunks/{chunk-7I6MNC5I.js → chunk-OD2SHTFL.js} +1 -1
  113. package/dist/bin/shell/chunks/{chunk-BNYIXXC2.js → chunk-ODCVIRIN.js} +1 -1
  114. package/dist/bin/{chunks/chunk-NJ67YJRE.js → shell/chunks/chunk-ODPB5AH7.js} +1 -1
  115. package/dist/bin/shell/chunks/chunk-QUWWWM4E.js +276 -0
  116. package/dist/bin/shell/chunks/{chunk-JQER3HUP.js → chunk-ROFYAVPF.js} +2 -2
  117. package/dist/bin/shell/chunks/chunk-SHAOH2UJ.js +5 -0
  118. package/dist/bin/shell/chunks/{chunk-PKWK3LQM.js → chunk-SOKKZSUV.js} +1 -1
  119. package/dist/bin/{chunks/chunk-WSLBBXPJ.js → shell/chunks/chunk-TIYIKCEZ.js} +1 -1
  120. package/dist/bin/shell/chunks/{chunk-4SQKKW2M.js → chunk-TKBTWIXO.js} +1 -1
  121. package/dist/bin/{chunks/chunk-VY2K25J4.js → shell/chunks/chunk-TOTKK2XI.js} +1 -1
  122. package/dist/bin/{chunks/chunk-X63MJBLH.js → shell/chunks/chunk-TY77F4UM.js} +1 -1
  123. package/dist/bin/shell/chunks/{chunk-CB4SODHK.js → chunk-XBX7KFWK.js} +19 -19
  124. package/dist/bin/{chunks/chunk-GEUCQ4AB.js → shell/chunks/chunk-XG7YUZ3R.js} +1 -1
  125. package/dist/bin/shell/chunks/chunk-YABXNPH6.js +65 -0
  126. package/dist/bin/{chunks/chunk-TL4JI2SL.js → shell/chunks/chunk-YB3A42T5.js} +17 -18
  127. package/dist/bin/shell/chunks/{chunk-MZM7RVYU.js → chunk-YBTJPT3R.js} +1 -1
  128. package/dist/bin/shell/chunks/{chunk-X5VUGFUL.js → chunk-Z7QCL4IA.js} +1 -1
  129. package/dist/bin/shell/chunks/{echo-4OUEL7QB.js → echo-NYDCCFWB.js} +1 -1
  130. package/dist/bin/{chunks/expr-56X7LYOS.js → shell/chunks/expr-FAB3XEIB.js} +1 -1
  131. package/dist/bin/{chunks/file-SQSOBJLR.js → shell/chunks/file-ZHL2YACR.js} +1 -1
  132. package/dist/bin/shell/chunks/{find-XY2NTAT5.js → find-6DH6TRDN.js} +1 -1
  133. package/dist/bin/shell/chunks/{flag-coverage-WGSE667D.js → flag-coverage-SPPGTKG3.js} +1 -1
  134. package/dist/bin/{chunks/grep-CMT2H2S7.js → shell/chunks/grep-FBVRTH4M.js} +1 -1
  135. package/dist/bin/shell/chunks/{gzip-DJSFJOY6.js → gzip-AWQGRTSF.js} +1 -1
  136. package/dist/bin/{chunks/head-KPRH4HKC.js → shell/chunks/head-A7CPWX7R.js} +1 -1
  137. package/dist/bin/{chunks/html-to-markdown-WUBAMB4O.js → shell/chunks/html-to-markdown-EMODJ24M.js} +1 -1
  138. package/dist/bin/shell/chunks/{jq-ACCMBTSD.js → jq-DXL4NMI5.js} +1 -1
  139. package/dist/bin/{chunks/js-exec-4KNUPGHA.js → shell/chunks/js-exec-BFLXGNPQ.js} +1 -1
  140. package/dist/bin/shell/chunks/{ls-FTHYNINH.js → ls-R6DAGGBH.js} +1 -1
  141. package/dist/bin/shell/chunks/{od-A7CW5RMS.js → od-ZPR6FUOW.js} +1 -1
  142. package/dist/bin/{chunks/paste-YJLYVJMP.js → shell/chunks/paste-RQKXCKQO.js} +1 -1
  143. package/dist/bin/shell/chunks/{printf-F2KOCULO.js → printf-CNXNRQ3I.js} +1 -1
  144. package/dist/bin/shell/chunks/python3-WKVKCO33.js +14 -0
  145. package/dist/bin/{chunks/rg-JRKJ6I4X.js → shell/chunks/rg-34TWIR7N.js} +1 -1
  146. package/dist/bin/{chunks/sed-QJ2LNV2N.js → shell/chunks/sed-SW74NKGU.js} +1 -1
  147. package/dist/bin/{chunks/sleep-FUDWGDCE.js → shell/chunks/sleep-J2AVORMB.js} +1 -1
  148. package/dist/bin/{chunks/split-7IYQYKOW.js → shell/chunks/split-EDDYGW4A.js} +1 -1
  149. package/dist/bin/shell/chunks/{sqlite3-ZXF6BGDW.js → sqlite3-AZ27WWV7.js} +1 -1
  150. package/dist/bin/{chunks/stat-Y5D3VPLG.js → shell/chunks/stat-XNGV2W6W.js} +1 -1
  151. package/dist/bin/{chunks/tail-QISQLA3I.js → shell/chunks/tail-H2WOZSEI.js} +1 -1
  152. package/dist/bin/shell/chunks/{tar-TB2XWXF6.js → tar-MZP7QXR4.js} +1 -1
  153. package/dist/bin/{chunks/timeout-TDOV6JDA.js → shell/chunks/timeout-GH6S72QX.js} +1 -1
  154. package/dist/bin/shell/chunks/{tr-AR6EK7JH.js → tr-RVCBERJ4.js} +1 -1
  155. package/dist/bin/shell/chunks/undici-CKF2L2IP.js +141 -0
  156. package/dist/bin/shell/chunks/{xan-D6US4ZGL.js → xan-BSNJF6SH.js} +1 -1
  157. package/dist/bin/shell/chunks/{xan-view-QGKWT354.js → xan-view-H3LNQ72O.js} +1 -1
  158. package/dist/bin/shell/chunks/{yq-EYV7HLKK.js → yq-GNMXK6OP.js} +1 -1
  159. package/dist/bin/shell/shell.js +391 -389
  160. package/dist/bundle/browser.js +837 -824
  161. package/dist/bundle/chunks/{awk2-IPNBFNH2.js → awk2-IDCJYLV2.js} +1 -1
  162. package/dist/bundle/chunks/{base64-OXGTKKDA.js → base64-3XQZ3ADB.js} +1 -1
  163. package/dist/bundle/chunks/{cat-636HYSH4.js → cat-XWS72C47.js} +1 -1
  164. package/dist/bundle/chunks/{chmod-4CIOYX5Q.js → chmod-6FVWFWKL.js} +1 -1
  165. package/dist/bundle/chunks/{chunk-6IUGGJ2Y.js → chunk-264HW33U.js} +1 -1
  166. package/dist/bundle/chunks/{chunk-LGLR6TFP.js → chunk-2TLWENMK.js} +1 -1
  167. package/dist/bundle/chunks/{chunk-AMLHAS2N.js → chunk-4AKAIZPW.js} +9 -9
  168. package/dist/bundle/chunks/{chunk-FBXMKFE2.js → chunk-4HMWZAP7.js} +1 -1
  169. package/dist/bundle/chunks/{chunk-EAQUR2NP.js → chunk-4MPKG4PJ.js} +1 -1
  170. package/dist/bundle/chunks/{chunk-LJRVJXUI.js → chunk-4X2R47I5.js} +1 -1
  171. package/dist/bundle/chunks/{chunk-65Z4QURM.js → chunk-5GI2HJYO.js} +8 -8
  172. package/dist/bundle/chunks/{chunk-PJWSSENQ.js → chunk-6D2ZCRTO.js} +1 -1
  173. package/dist/bundle/chunks/chunk-6RK4AAB7.js +21 -0
  174. package/dist/bundle/chunks/chunk-73DVPW3C.js +20 -0
  175. package/dist/bundle/chunks/{chunk-6SHYIICL.js → chunk-AGH5UJJI.js} +2 -2
  176. package/dist/bundle/chunks/{chunk-RAHPENCM.js → chunk-CA7HMEGG.js} +1 -1
  177. package/dist/bundle/chunks/{chunk-SELXJ5KQ.js → chunk-CVMQI27W.js} +1 -1
  178. package/dist/bundle/chunks/{chunk-ORDZCFFT.js → chunk-CYCUGNN7.js} +1 -1
  179. package/dist/bundle/chunks/{chunk-UB6T3UHL.js → chunk-ENMIHC6G.js} +1 -1
  180. package/dist/bundle/chunks/{chunk-5KGKXQF6.js → chunk-EVJMYTCY.js} +2 -2
  181. package/dist/bundle/chunks/{chunk-JYQ6MII2.js → chunk-EZFSCUSP.js} +1 -1
  182. package/dist/bundle/chunks/{chunk-E3D4WVAH.js → chunk-FFNWVPYL.js} +1 -1
  183. package/dist/bundle/chunks/{chunk-MF4F4ZPP.js → chunk-GP3D65AC.js} +1 -1
  184. package/dist/bundle/chunks/{chunk-EWWPEE2G.js → chunk-HZYCWAEC.js} +17 -18
  185. package/dist/bundle/chunks/{chunk-QTLI5LUD.js → chunk-JQL34RLH.js} +1 -1
  186. package/dist/bundle/chunks/{chunk-JCPCQREJ.js → chunk-KBXRZGTY.js} +1 -1
  187. package/dist/bundle/chunks/{chunk-CN3HTJTZ.js → chunk-KESUKNUF.js} +1 -1
  188. package/dist/bundle/chunks/{chunk-XVL654YD.js → chunk-KVG5FR5F.js} +19 -19
  189. package/dist/bundle/chunks/{chunk-KKVPMNSS.js → chunk-LDCENVG4.js} +1 -1
  190. package/dist/bundle/chunks/chunk-M7DIEMEN.js +275 -0
  191. package/dist/bundle/chunks/{chunk-MAWVZWRK.js → chunk-MMSRUX6V.js} +1 -1
  192. package/dist/bundle/chunks/{chunk-INHMNORI.js → chunk-MP3NNO6W.js} +1 -1
  193. package/dist/bundle/chunks/{chunk-AI5LSBJC.js → chunk-QKQP2SCP.js} +1 -1
  194. package/dist/bundle/chunks/{chunk-OTYP7VVT.js → chunk-QNXJ5FEA.js} +1 -1
  195. package/dist/bundle/chunks/{chunk-K3XJ2WT4.js → chunk-QXYDKHGI.js} +1 -1
  196. package/dist/bundle/chunks/chunk-RT7ROXPF.js +4 -0
  197. package/dist/bundle/chunks/{chunk-WENIVVEE.js → chunk-TUNYNC46.js} +2 -2
  198. package/dist/bundle/chunks/chunk-UGU4ZDZA.js +11 -0
  199. package/dist/bundle/chunks/{chunk-D3W7DTI6.js → chunk-VPJHPG6G.js} +1 -1
  200. package/dist/bundle/chunks/{chunk-5HXWWNWH.js → chunk-VQCA62JK.js} +1 -1
  201. package/dist/bundle/chunks/{chunk-NNH4ERNJ.js → chunk-W4IV5QW4.js} +1 -1
  202. package/dist/bundle/chunks/{chunk-3DHFIWMM.js → chunk-XJWBSZIU.js} +1 -1
  203. package/dist/bundle/chunks/{chunk-VOSNSQE2.js → chunk-XOBSBDA5.js} +1 -1
  204. package/dist/bundle/chunks/chunk-XW6UBSKO.js +64 -0
  205. package/dist/bundle/chunks/{chunk-UK4BO5W3.js → chunk-XZZSXYTK.js} +1 -1
  206. package/dist/bundle/chunks/{echo-HZOVZAPR.js → echo-PLLZYM2L.js} +1 -1
  207. package/dist/bundle/chunks/{expr-SHRJJ4PX.js → expr-VKQHAJNO.js} +1 -1
  208. package/dist/bundle/chunks/{file-YC4YEI4P.js → file-WGI2QYXG.js} +1 -1
  209. package/dist/bundle/chunks/{find-DWWMZFO5.js → find-PM3TD7V4.js} +1 -1
  210. package/dist/bundle/chunks/{flag-coverage-THYQHOT3.js → flag-coverage-6LWPOTGE.js} +1 -1
  211. package/dist/bundle/chunks/{grep-S6SNTIHZ.js → grep-SAEHL7UZ.js} +1 -1
  212. package/dist/bundle/chunks/{gzip-BTI6CWY4.js → gzip-2SHFSHNB.js} +1 -1
  213. package/dist/bundle/chunks/{head-UCOA3VQC.js → head-RMKV5HCV.js} +1 -1
  214. package/dist/bundle/chunks/{html-to-markdown-NUF6QEX4.js → html-to-markdown-GEKF6U7Z.js} +1 -1
  215. package/dist/bundle/chunks/{jq-D6N4QCAJ.js → jq-MW2VEOCW.js} +1 -1
  216. package/dist/bundle/chunks/{js-exec-PNUEDFT5.js → js-exec-J4DLDAWY.js} +1 -1
  217. package/dist/bundle/chunks/js-exec-worker.js +56 -20
  218. package/dist/bundle/chunks/{od-YXD2NNIU.js → od-26HTHXXM.js} +1 -1
  219. package/dist/bundle/chunks/{paste-ZU3EODNI.js → paste-WIDT5N6N.js} +1 -1
  220. package/dist/bundle/chunks/{printf-QHD2JRWQ.js → printf-V42QCPHL.js} +1 -1
  221. package/dist/bundle/chunks/python3-4Q7M5CDT.js +13 -0
  222. package/dist/bundle/chunks/{rg-OUJZ5DH6.js → rg-IA4UE2UF.js} +1 -1
  223. package/dist/bundle/chunks/{sed-TZIPJOGL.js → sed-LSWWSQ6J.js} +1 -1
  224. package/dist/bundle/chunks/{sleep-VPYWSKDR.js → sleep-YMKR4HFQ.js} +1 -1
  225. package/dist/bundle/chunks/{split-KNDNAFPT.js → split-EATPU6Q7.js} +1 -1
  226. package/dist/bundle/chunks/{sqlite3-WWZJZW37.js → sqlite3-XXXHFJGP.js} +1 -1
  227. package/dist/bundle/chunks/{stat-MLNSW25G.js → stat-AKB6X3TV.js} +1 -1
  228. package/dist/bundle/chunks/{tail-G3W6PNG3.js → tail-OEM7DTYC.js} +1 -1
  229. package/dist/bundle/chunks/{tar-GLX6QUHW.js → tar-26DH77YN.js} +1 -1
  230. package/dist/bundle/chunks/{timeout-SYQCWBMZ.js → timeout-FOKHN3GQ.js} +1 -1
  231. package/dist/bundle/chunks/{tr-3KPFH3J4.js → tr-VUNRKFC3.js} +1 -1
  232. package/dist/bundle/chunks/undici-PSPBDOYF.js +140 -0
  233. package/dist/bundle/chunks/worker.js +17 -1
  234. package/dist/bundle/chunks/{xan-KKPV2TJ3.js → xan-LUEGYXLV.js} +1 -1
  235. package/dist/bundle/chunks/{xan-view-47P277LZ.js → xan-view-MDMZTFFI.js} +1 -1
  236. package/dist/bundle/chunks/{yq-ZGB3W46S.js → yq-B7E6UX7Y.js} +1 -1
  237. package/dist/bundle/index.cjs +1029 -1032
  238. package/dist/bundle/index.js +391 -389
  239. package/dist/commands/python3/worker.d.ts +1 -0
  240. package/dist/commands/query-engine/evaluator.d.ts +8 -0
  241. package/dist/fs/read-write-fs/read-write-fs.d.ts +42 -1
  242. package/dist/interpreter/builtin-dispatch.d.ts +9 -2
  243. package/dist/interpreter/builtins/eval.d.ts +7 -1
  244. package/dist/interpreter/control-flow.d.ts +1 -1
  245. package/dist/interpreter/fd-table.d.ts +130 -0
  246. package/dist/interpreter/functions.d.ts +3 -1
  247. package/dist/interpreter/helpers/word-matching.d.ts +0 -10
  248. package/dist/interpreter/interpreter.d.ts +7 -0
  249. package/dist/interpreter/numeric-fd-redirects.d.ts +8 -0
  250. package/dist/interpreter/process-substitution.d.ts +62 -0
  251. package/dist/interpreter/redirections.d.ts +33 -37
  252. package/dist/interpreter/subshell-group.d.ts +10 -2
  253. package/dist/interpreter/types.d.ts +38 -1
  254. package/dist/network/dns-pin.d.ts +11 -0
  255. package/dist/parser/expansion-parser.d.ts +3 -1
  256. package/dist/parser/lexer.d.ts +7 -9
  257. package/dist/parser/parser-substitution.d.ts +13 -4
  258. package/dist/parser/parser.d.ts +18 -4
  259. package/dist/parser/types.d.ts +6 -0
  260. package/dist/parser/word-parser.d.ts +2 -0
  261. package/dist/types.d.ts +13 -0
  262. package/package.json +21 -21
  263. package/dist/bin/chunks/chunk-46CDVHZ3.js +0 -5
  264. package/dist/bin/chunks/chunk-D3MUBZ4P.js +0 -65
  265. package/dist/bin/chunks/chunk-LGERQ5TD.js +0 -22
  266. package/dist/bin/chunks/chunk-LNFTLSWJ.js +0 -22
  267. package/dist/bin/chunks/chunk-P6NPCASY.js +0 -11
  268. package/dist/bin/chunks/chunk-PRKSLEHG.js +0 -291
  269. package/dist/bin/chunks/chunk-WYTPLN2M.js +0 -11
  270. package/dist/bin/chunks/python3-AYUQQRCR.js +0 -14
  271. package/dist/bin/chunks/undici-JES22UVU.js +0 -141
  272. package/dist/bin/shell/chunks/chunk-46CDVHZ3.js +0 -5
  273. package/dist/bin/shell/chunks/chunk-D3MUBZ4P.js +0 -65
  274. package/dist/bin/shell/chunks/chunk-LGERQ5TD.js +0 -22
  275. package/dist/bin/shell/chunks/chunk-LNFTLSWJ.js +0 -22
  276. package/dist/bin/shell/chunks/chunk-P6NPCASY.js +0 -11
  277. package/dist/bin/shell/chunks/chunk-PRKSLEHG.js +0 -291
  278. package/dist/bin/shell/chunks/chunk-WYTPLN2M.js +0 -11
  279. package/dist/bin/shell/chunks/python3-AYUQQRCR.js +0 -14
  280. package/dist/bin/shell/chunks/undici-JES22UVU.js +0 -141
  281. package/dist/bundle/chunks/chunk-NOPXHH6G.js +0 -290
  282. package/dist/bundle/chunks/chunk-T2RHALUC.js +0 -64
  283. package/dist/bundle/chunks/chunk-UBTKJ6MG.js +0 -4
  284. package/dist/bundle/chunks/chunk-VECGTAPW.js +0 -10
  285. package/dist/bundle/chunks/chunk-Y3DGIAIG.js +0 -21
  286. package/dist/bundle/chunks/chunk-YOUUMJLJ.js +0 -10
  287. package/dist/bundle/chunks/python3-QDNG2UXX.js +0 -13
  288. package/dist/bundle/chunks/undici-HCLAUJT3.js +0 -140
@@ -14,6 +14,7 @@ export interface WorkerInput {
14
14
  protocolToken: string;
15
15
  sharedBuffer: SharedArrayBuffer;
16
16
  pythonCode: string;
17
+ stdin: string;
17
18
  cwd: string;
18
19
  env: Record<string, string>;
19
20
  args: string[];
@@ -20,6 +20,10 @@ export interface EvalContext {
20
20
  vars: Map<string, QueryValue>;
21
21
  limits: ResolvedQueryExecutionLimits;
22
22
  env?: Map<string, string>;
23
+ /** Named arguments (bare names) exposed via $ARGS.named */
24
+ namedArgs?: Map<string, QueryValue>;
25
+ /** Positional arguments (in order) exposed via $ARGS.positional */
26
+ positionalArgs?: QueryValue[];
23
27
  requireDefenseContext?: boolean;
24
28
  defenseContextChecked?: boolean;
25
29
  /** Original document root for parent/root navigation */
@@ -46,6 +50,10 @@ export declare function assertQueryResultCapacity(ctx: EvalContext, current: num
46
50
  export interface EvaluateOptions {
47
51
  limits?: QueryExecutionLimits;
48
52
  env?: Map<string, string>;
53
+ /** Named arguments (bare names) bound to $NAME and exposed via $ARGS.named */
54
+ namedArgs?: Map<string, QueryValue>;
55
+ /** Positional arguments (in order) exposed via $ARGS.positional */
56
+ positionalArgs?: QueryValue[];
49
57
  coverage?: FeatureCoverageWriter;
50
58
  requireDefenseContext?: boolean;
51
59
  /** Reuse across multiple input documents to enforce one command budget. */
@@ -25,6 +25,17 @@ export interface ReadWriteFsOptions {
25
25
  * Defaults to 10MB (10485760).
26
26
  */
27
27
  maxFileReadSize?: number;
28
+ /**
29
+ * Maximum file size in bytes that metadata operations and append may copy
30
+ * when isolating a multiply-linked regular file. Defaults to 100MB.
31
+ * Set to 0 to disable this limit.
32
+ */
33
+ maxCopyOnWriteSize?: number;
34
+ /**
35
+ * Maximum regular file size in bytes that cp may copy. Defaults to 0
36
+ * (unlimited) for compatibility with normal filesystem copy behavior.
37
+ */
38
+ maxCopySize?: number;
28
39
  /**
29
40
  * Whether to allow following and creating symlinks.
30
41
  * When false (default), any path traversing a symlink is rejected
@@ -33,11 +44,14 @@ export interface ReadWriteFsOptions {
33
44
  allowSymlinks?: boolean;
34
45
  }
35
46
  export declare class ReadWriteFs implements IFileSystem {
47
+ private static activeMutationRoots;
48
+ private static pendingMutations;
36
49
  private readonly root;
37
50
  private readonly canonicalRoot;
38
51
  private readonly maxFileReadSize;
52
+ private readonly maxCopyOnWriteSize;
53
+ private readonly maxCopySize;
39
54
  private readonly allowSymlinks;
40
- private transactionId;
41
55
  constructor(options: ReadWriteFsOptions);
42
56
  /**
43
57
  * Validate that a resolved real path stays within the sandbox root and
@@ -61,17 +75,40 @@ export declare class ReadWriteFs implements IFileSystem {
61
75
  readFileBytes(path: string): Promise<ByteString>;
62
76
  readFileBuffer(path: string): Promise<Uint8Array>;
63
77
  writeFile(path: string, content: FileContent, options?: WriteFileOptions | BufferEncoding): Promise<void>;
78
+ private writeFileUnlocked;
64
79
  appendFile(path: string, content: FileContent, options?: WriteFileOptions | BufferEncoding): Promise<void>;
80
+ private appendFileUnlocked;
81
+ private withFilesystemMutation;
82
+ private static drainMutationQueue;
83
+ private assertCopyOnWriteSize;
84
+ private assertCopySize;
85
+ private randomTransactionToken;
86
+ /** Open a bounded copy source, avoiding atime updates where permitted. */
87
+ private openCopySource;
88
+ /**
89
+ * Commit file contents by replacing a directory entry, never by mutating
90
+ * its existing inode. This prevents writes through host-planted hard links
91
+ * from changing files outside the sandbox.
92
+ */
93
+ private replaceFile;
65
94
  exists(path: string): Promise<boolean>;
66
95
  stat(path: string): Promise<FsStat>;
67
96
  lstat(path: string): Promise<FsStat>;
68
97
  mkdir(path: string, options?: MkdirOptions): Promise<void>;
98
+ private mkdirUnlocked;
69
99
  readdir(path: string): Promise<string[]>;
70
100
  readdirWithFileTypes(path: string): Promise<DirentEntry[]>;
71
101
  rm(path: string, options?: RmOptions): Promise<void>;
102
+ private rmUnlocked;
72
103
  cp(src: string, dest: string, options?: CpOptions): Promise<void>;
104
+ private cpUnlocked;
105
+ private copyTreeEntry;
106
+ private assertCopyDestinationWritable;
107
+ private replaceSymlink;
108
+ private toVirtualAbsoluteSymlinkTarget;
73
109
  private preflightCopyTree;
74
110
  mv(src: string, dest: string): Promise<void>;
111
+ private mvUnlocked;
75
112
  /** Compare canonical path identity, not user-visible lexical spelling. */
76
113
  private isSameOrDescendantIdentity;
77
114
  private uniqueTransactionPath;
@@ -91,8 +128,11 @@ export declare class ReadWriteFs implements IFileSystem {
91
128
  private findEscapingSymlinks;
92
129
  private scanDir;
93
130
  chmod(path: string, mode: number): Promise<void>;
131
+ private chmodUnlocked;
94
132
  symlink(target: string, linkPath: string): Promise<void>;
133
+ private symlinkUnlocked;
95
134
  link(existingPath: string, newPath: string): Promise<void>;
135
+ private linkUnlocked;
96
136
  readlink(path: string): Promise<string>;
97
137
  /**
98
138
  * Resolve all symlinks in a path to get the canonical physical path.
@@ -106,4 +146,5 @@ export declare class ReadWriteFs implements IFileSystem {
106
146
  * @param mtime - Modification time
107
147
  */
108
148
  utimes(path: string, atime: Date, mtime: Date): Promise<void>;
149
+ private utimesUnlocked;
109
150
  }
@@ -9,7 +9,7 @@ import type { InterpreterContext } from "./types.js";
9
9
  /**
10
10
  * Type for the function that runs a command recursively
11
11
  */
12
- export type RunCommandFn = (commandName: string, args: string[], quotedArgs: boolean[], stdin: string, skipFunctions?: boolean, useDefaultPath?: boolean, stdinSourceFd?: number) => Promise<ExecResult>;
12
+ export type RunCommandFn = (commandName: string, args: string[], quotedArgs: boolean[], stdin: string, skipFunctions?: boolean, useDefaultPath?: boolean, stdinSourceFd?: number, stdinRedirected?: boolean) => Promise<ExecResult>;
13
13
  /**
14
14
  * Type for the function that builds exported environment
15
15
  */
@@ -31,7 +31,14 @@ export interface BuiltinDispatchContext {
31
31
  * Dispatch a command to the appropriate builtin handler or external command.
32
32
  * Returns null if the command should be handled by external command resolution.
33
33
  */
34
- export declare function dispatchBuiltin(dispatchCtx: BuiltinDispatchContext, commandName: string, args: string[], _quotedArgs: boolean[], stdin: string, skipFunctions: boolean, _useDefaultPath: boolean, stdinSourceFd: number): Promise<ExecResult | null>;
34
+ export declare function dispatchBuiltin(dispatchCtx: BuiltinDispatchContext, commandName: string, args: string[], _quotedArgs: boolean[], stdin: string, skipFunctions: boolean, _useDefaultPath: boolean, stdinSourceFd: number,
35
+ /**
36
+ * True when a redirection gave this command its own fd 0. `stdin` alone
37
+ * cannot express it: `cmd < empty-file` and an unredirected command both
38
+ * arrive as `""`, but only the first means EOF rather than "inherit the
39
+ * shell's stdin".
40
+ */
41
+ stdinRedirected?: boolean): Promise<ExecResult | null>;
35
42
  /**
36
43
  * Handle external command resolution and execution.
37
44
  * Called when dispatchBuiltin returns null.
@@ -6,4 +6,10 @@
6
6
  */
7
7
  import type { ExecResult } from "../../types.js";
8
8
  import type { InterpreterContext } from "../types.js";
9
- export declare function handleEval(ctx: InterpreterContext, args: string[], stdin?: string): Promise<ExecResult>;
9
+ export declare function handleEval(ctx: InterpreterContext, args: string[], stdin?: string,
10
+ /**
11
+ * A redirection gave this `eval` its own fd 0. Empty content is still
12
+ * ownership: `eval '…' < empty-file` means EOF inside, where an
13
+ * unredirected `eval` shares the shell's stdin.
14
+ */
15
+ stdinRedirected?: boolean): Promise<ExecResult>;
@@ -17,5 +17,5 @@ export declare function executeIf(ctx: InterpreterContext, node: IfNode): Promis
17
17
  export declare function executeFor(ctx: InterpreterContext, node: ForNode): Promise<ExecResult>;
18
18
  export declare function executeCStyleFor(ctx: InterpreterContext, node: CStyleForNode): Promise<ExecResult>;
19
19
  export declare function executeWhile(ctx: InterpreterContext, node: WhileNode, stdin?: string): Promise<ExecResult>;
20
- export declare function executeUntil(ctx: InterpreterContext, node: UntilNode): Promise<ExecResult>;
20
+ export declare function executeUntil(ctx: InterpreterContext, node: UntilNode, stdin?: string): Promise<ExecResult>;
21
21
  export declare function executeCase(ctx: InterpreterContext, node: CaseNode): Promise<ExecResult>;
@@ -0,0 +1,130 @@
1
+ /**
2
+ * File Descriptor Table
3
+ *
4
+ * One typed view over `ctx.state.fileDescriptors`, the shell's descriptor
5
+ * table. The table itself stays a `Map<number, string>` because it is part
6
+ * of the public `CommandContext` surface — extensions read fd values as
7
+ * content — so this module owns the string encoding instead.
8
+ *
9
+ * Entry kinds:
10
+ * - `input` readable content (`N< file`, `N<<EOF`, `N<<<word`). Reading
11
+ * is destructive: the remaining content is written back, so
12
+ * successive `read -u N` calls advance a shared position.
13
+ * - `output` a file opened for writing (`N> file`, `N>> file`).
14
+ * - `readwrite` `N<> file` — content plus an explicit read position.
15
+ * - `dup-out` fd duplicated from stdout/stderr (`N>&1`).
16
+ * - `dup-in` fd duplicated from stdin (`N<&0`).
17
+ *
18
+ * An `input` entry is stored verbatim, so its content can look exactly like
19
+ * one of the marker encodings (a file whose first line is `__file__:/x`).
20
+ * `inputFds` records which descriptors hold content, so the markers are
21
+ * never guessed at for a descriptor this module opened; the prefix sniffing
22
+ * in {@link decodeFdEntry} is only a fallback for descriptors written by
23
+ * older code paths.
24
+ */
25
+ import type { InterpreterContext } from "./types.js";
26
+ /** Lowest descriptor a script may open by number. 0/1/2 are the std streams. */
27
+ export declare const FIRST_USER_FD = 3;
28
+ export type FdEntry = {
29
+ kind: "input";
30
+ content: string;
31
+ } | {
32
+ kind: "output";
33
+ path: string;
34
+ append: boolean;
35
+ } | {
36
+ kind: "readwrite";
37
+ path: string;
38
+ position: number;
39
+ content: string;
40
+ } | {
41
+ kind: "dup-out";
42
+ sourceFd: number;
43
+ } | {
44
+ kind: "dup-in";
45
+ sourceFd: number;
46
+ } | {
47
+ kind: "closed";
48
+ };
49
+ /**
50
+ * A descriptor's raw value, whether it is known to hold content, and which
51
+ * other descriptors shared its open file description.
52
+ */
53
+ interface FdSnapshotEntry {
54
+ raw: string | undefined;
55
+ isInput: boolean;
56
+ aliases: number[];
57
+ }
58
+ /** Descriptor state captured by {@link rememberFd}, replayed by
59
+ * {@link restoreFds}. */
60
+ export type FdSnapshot = Map<number, FdSnapshotEntry>;
61
+ /**
62
+ * Decode a raw table value into a typed entry.
63
+ * Callers that know the descriptor holds content should go through
64
+ * {@link getFdEntry}, which consults `inputFds` first and never guesses.
65
+ */
66
+ export declare function decodeFdEntry(raw: string): FdEntry;
67
+ /** Encode a typed entry back into its raw table value. */
68
+ export declare function encodeFdEntry(entry: FdEntry): string;
69
+ export declare function getFdAliasMembers(ctx: InterpreterContext, fd: number): number[];
70
+ /** Raw table value for `fd`, or undefined when the fd is not open. */
71
+ export declare function getRawFd(ctx: InterpreterContext, fd: number): string | undefined;
72
+ /** Typed entry for `fd`, or undefined when the fd is not open. */
73
+ export declare function getFdEntry(ctx: InterpreterContext, fd: number): FdEntry | undefined;
74
+ export declare function isFdOpen(ctx: InterpreterContext, fd: number): boolean;
75
+ /**
76
+ * Store a raw value, charging the descriptor limit for newly opened fds.
77
+ * Opening a descriptor gives it a NEW open file description, so it stops
78
+ * sharing an offset with anything it was previously duplicated from —
79
+ * `exec 4<&3; exec 4< other` leaves fd 3 alone.
80
+ */
81
+ export declare function setRawFd(ctx: InterpreterContext, fd: number, raw: string, isInput?: boolean): void;
82
+ export declare function setFdEntry(ctx: InterpreterContext, fd: number, entry: FdEntry): void;
83
+ export declare function closeFd(ctx: InterpreterContext, fd: number): void;
84
+ /**
85
+ * Point `fd` at whatever `sourceFd` refers to, the way `dup2()` does: the raw
86
+ * value and its content/marker classification are copied, and the two
87
+ * descriptors join one alias group so they share a read offset from here on.
88
+ * Returns false when `sourceFd` is not open.
89
+ */
90
+ export declare function dupFd(ctx: InterpreterContext, fd: number, sourceFd: number): boolean;
91
+ export declare function moveFd(ctx: InterpreterContext, fd: number, sourceFd: number): boolean;
92
+ /**
93
+ * Readable bytes remaining on `fd`.
94
+ * Returns a reason instead of content when the fd cannot be read from, so
95
+ * callers can pick the diagnostic bash uses for their context.
96
+ */
97
+ export declare function readFd(ctx: InterpreterContext, fd: number): {
98
+ content: string;
99
+ } | {
100
+ error: "not-open" | "write-only";
101
+ };
102
+ /**
103
+ * Advance the read position of `fd` by `count` characters.
104
+ * `input` entries keep only the unread remainder, matching bash's single
105
+ * shared file offset: every later read continues where this one stopped —
106
+ * including reads through a descriptor duplicated from this one, which
107
+ * shares the same open file description.
108
+ */
109
+ export declare function advanceFd(ctx: InterpreterContext, fd: number, count: number): void;
110
+ export declare function writeFdEntry(ctx: InterpreterContext, entry: FdEntry, descriptors: number[], content: string, encoding: "binary" | "utf8"): Promise<boolean>;
111
+ /**
112
+ * Record `fd`'s current state into `snapshot`, unless it is already there —
113
+ * the FIRST value seen is the one a later {@link restoreFds} puts back.
114
+ * A `raw` of `undefined` records "was not open".
115
+ */
116
+ export declare function rememberFd(ctx: InterpreterContext, snapshot: FdSnapshot, fd: number): void;
117
+ /**
118
+ * Snapshot the given descriptors so a scoped redirection can put the table
119
+ * back the way it found it.
120
+ */
121
+ export declare function snapshotFds(ctx: InterpreterContext, fds: Iterable<number>): FdSnapshot;
122
+ /**
123
+ * Undo the descriptor changes recorded by {@link rememberFd}.
124
+ *
125
+ * Only the descriptor is restored, never the file offset behind it: a
126
+ * command that read through `4<&3` has moved the shared description, and
127
+ * bash leaves fd 3 where that read left it once fd 4 is taken back down.
128
+ */
129
+ export declare function restoreFds(ctx: InterpreterContext, snapshot: FdSnapshot): void;
130
+ export {};
@@ -9,4 +9,6 @@ import type { FunctionDefNode } from "../ast/types.js";
9
9
  import type { ExecResult } from "../types.js";
10
10
  import type { InterpreterContext } from "./types.js";
11
11
  export declare function executeFunctionDef(ctx: InterpreterContext, node: FunctionDefNode): ExecResult;
12
- export declare function callFunction(ctx: InterpreterContext, func: FunctionDefNode, args: string[], stdin?: string, callLine?: number): Promise<ExecResult>;
12
+ export declare function callFunction(ctx: InterpreterContext, func: FunctionDefNode, args: string[], stdin?: string, callLine?: number,
13
+ /** A redirection on the call site (`f < file`) gave the function its own fd 0. */
14
+ stdinRedirected?: boolean): Promise<ExecResult>;
@@ -14,13 +14,3 @@ import type { WordNode } from "../../ast/types.js";
14
14
  * runtime value after expansion.
15
15
  */
16
16
  export declare function isWordLiteralMatch(word: WordNode, targets: string[]): boolean;
17
- /**
18
- * Parse the content of a read-write file descriptor.
19
- * Format: __rw__:pathLength:path:position:content
20
- * @returns The parsed components, or null if format is invalid
21
- */
22
- export declare function parseRwFdContent(fdContent: string): {
23
- path: string;
24
- position: number;
25
- content: string;
26
- } | null;
@@ -61,7 +61,14 @@ export declare class Interpreter {
61
61
  private executeUserScript;
62
62
  private executeStatement;
63
63
  private executePipeline;
64
+ /**
65
+ * Execute a command, tearing down any process substitutions its own word
66
+ * expansion opened. Descriptor numbers are handed out from 63 downwards and
67
+ * released here, so they are reused per command exactly like bash and no
68
+ * backing file outlives the command that created it.
69
+ */
64
70
  private executeCommand;
71
+ private executeCommandInner;
65
72
  private executeSimpleCommand;
66
73
  private executeSimpleCommandInner;
67
74
  private runCommand;
@@ -0,0 +1,8 @@
1
+ import type { RedirectionNode } from "../ast/types.js";
2
+ /**
3
+ * The descriptor a redirection acts on, or null when it targets both
4
+ * stdout and stderr (`&>`), which never names a user fd.
5
+ */
6
+ export declare function effectiveRedirectFd(redir: RedirectionNode): number | null;
7
+ /** True when this redirection is installed in the descriptor table. */
8
+ export declare function isNumericFdRedirection(redir: RedirectionNode): boolean;
@@ -0,0 +1,62 @@
1
+ /**
2
+ * Process Substitution
3
+ *
4
+ * Implements bash's `<(cmd)` and `>(cmd)`.
5
+ *
6
+ * Real bash runs `cmd` asynchronously connected to a pipe and substitutes the
7
+ * pipe's path (`/dev/fd/N`, or a FIFO on systems without `/dev/fd`). There are
8
+ * no processes or pipes here, so the construct is modelled with the same
9
+ * building blocks the rest of the interpreter uses for fds: a backing file in
10
+ * the VFS under `/dev/fd/`, whose contents are produced (or consumed) by
11
+ * running the body as a subshell.
12
+ *
13
+ * - `<(cmd)` runs `cmd` eagerly during word expansion, writes its stdout to
14
+ * the backing file, and substitutes that path. Because the body is fully
15
+ * buffered, a body that never terminates on its own (e.g. `yes`) is bounded
16
+ * by the ordinary execution limits rather than by the reader closing the
17
+ * pipe.
18
+ * - `>(cmd)` substitutes an empty writable backing file. Once the command that
19
+ * consumed the path has finished, whatever was written to the file is fed to
20
+ * `cmd` as stdin and `cmd`'s output is appended to the result — the closest
21
+ * deterministic analogue of bash's asynchronous writer.
22
+ *
23
+ * Backing files live only for the duration of the command whose expansion
24
+ * created them: {@link markProcessSubstitutions} / {@link releaseProcessSubstitutions}
25
+ * bracket every command execution, so fd numbers are reused (63, 62, … just
26
+ * like bash) and nothing accumulates in the VFS across commands.
27
+ */
28
+ import type { ProcessSubstitutionPart, ScriptNode } from "../ast/types.js";
29
+ import type { InterpreterContext } from "./types.js";
30
+ /** A process substitution whose backing file is still live. */
31
+ export interface ProcessSubstitutionEntry {
32
+ /** Synthetic descriptor number (63, 62, …). */
33
+ fd: number;
34
+ /** Backing file path handed to the outer command. */
35
+ path: string;
36
+ /** `<(...)` or `>(...)`. */
37
+ direction: "input" | "output";
38
+ /** Body to run with the written bytes as stdin (output substitutions only). */
39
+ body: ScriptNode;
40
+ }
41
+ /**
42
+ * Expand a process substitution to the path the outer command should use.
43
+ */
44
+ export declare function openProcessSubstitution(ctx: InterpreterContext, part: ProcessSubstitutionPart): Promise<string>;
45
+ /**
46
+ * Remember how many process substitutions were live before a command ran.
47
+ */
48
+ export declare function markProcessSubstitutions(ctx: InterpreterContext): number;
49
+ /** Output produced by `>(cmd)` writers drained at the end of a command. */
50
+ export interface ProcessSubstitutionWriterOutput {
51
+ stdout: string;
52
+ stderr: string;
53
+ }
54
+ /**
55
+ * Tear down every process substitution opened since `mark`, newest first.
56
+ *
57
+ * Input substitutions just drop their backing file. Output substitutions first
58
+ * feed everything the outer command wrote into their body; the body's output is
59
+ * returned so the caller can append it to the command's own, the way bash's
60
+ * asynchronous writer shares the shell's stdout and stderr.
61
+ */
62
+ export declare function releaseProcessSubstitutions(ctx: InterpreterContext, mark: number): Promise<ProcessSubstitutionWriterOutput>;
@@ -11,44 +11,40 @@
11
11
  */
12
12
  import type { RedirectionNode } from "../ast/types.js";
13
13
  import type { ExecResult } from "../types.js";
14
+ import { ControlFlowError, ExecutionLimitError, ExitError } from "./errors.js";
15
+ import { type FdEntry } from "./fd-table.js";
14
16
  import type { InterpreterContext } from "./types.js";
15
- /**
16
- * Pre-expanded redirect targets, keyed by index into the redirections array.
17
- * This allows us to expand redirect targets (including side effects) before
18
- * executing a function body, then apply the redirections after.
19
- */
17
+ /** Expanded targets keyed by their position in the original redirection list. */
20
18
  export type ExpandedRedirectTargets = Map<number, string>;
21
- /**
22
- * Pre-expand redirect targets for function definitions.
23
- * This is needed because redirections on function definitions are evaluated
24
- * each time the function is called, and any side effects (like $((i++)))
25
- * must occur BEFORE the function body executes.
26
- */
27
- export declare function preExpandRedirectTargets(ctx: InterpreterContext, redirections: RedirectionNode[]): Promise<{
28
- targets: ExpandedRedirectTargets;
29
- error?: string;
30
- }>;
31
- /**
32
- * Process FD variable redirections ({varname}>file syntax).
33
- * This allocates FDs and sets variables before command execution.
34
- * Returns an error result if there's an issue, or null if successful.
35
- */
36
- export declare function processFdVariableRedirections(ctx: InterpreterContext, redirections: RedirectionNode[], preExpandedTargets?: ExpandedRedirectTargets): Promise<ExecResult | null>;
37
- /**
38
- * Pre-open (truncate) output redirect files before command execution.
39
- * This is needed for compound commands (subshell, for, case, [[) where
40
- * bash opens/truncates the redirect file BEFORE evaluating any words in
41
- * the command body (including command substitutions).
42
- *
43
- * Example: `(echo \`cat FILE\`) > FILE`
44
- * - Bash first truncates FILE (making it empty)
45
- * - Then executes the subshell, where `cat FILE` returns empty string
46
- *
47
- * Returns an error result if there's an issue (like directory or noclobber),
48
- * or null if pre-opening succeeded.
49
- */
50
- export declare function preOpenOutputRedirects(ctx: InterpreterContext, redirections: RedirectionNode[]): Promise<{
19
+ type PreparedDupSource = {
20
+ kind: "standard";
21
+ fd: number;
22
+ } | {
23
+ kind: "entry";
24
+ entry: FdEntry;
25
+ descriptors: number[];
26
+ };
27
+ export type PreparedDupSources = Map<number, PreparedDupSource>;
28
+ export type PreparedRedirections = {
51
29
  targets: ExpandedRedirectTargets;
30
+ dupSources: PreparedDupSources;
31
+ standardRoutes: Map<number, FdEntry>;
32
+ stdin: string | undefined;
33
+ stdinSourceFd: number;
52
34
  error: ExecResult | null;
53
- }>;
54
- export declare function applyRedirections(ctx: InterpreterContext, result: ExecResult, redirections: RedirectionNode[], preExpandedTargets?: ExpandedRedirectTargets): Promise<ExecResult>;
35
+ errorCause?: ExitError | ExecutionLimitError;
36
+ };
37
+ export type RedirectionPolicy = "scoped" | "bare" | "persistent";
38
+ export declare const SIMPLE_REDIRECTION_POLICY: RedirectionPolicy;
39
+ export declare const BARE_REDIRECTION_POLICY: RedirectionPolicy;
40
+ export declare const EXEC_REDIRECTION_POLICY: RedirectionPolicy;
41
+ export type RedirectionTransaction = {
42
+ prepare: (inheritedStdin?: string) => Promise<PreparedRedirections>;
43
+ finish: () => void;
44
+ };
45
+ export declare function createRedirectionTransaction(ctx: InterpreterContext, redirections: RedirectionNode[], policy: RedirectionPolicy): RedirectionTransaction;
46
+ export declare function preparedRedirectionError(prepared: PreparedRedirections): ExecResult;
47
+ export declare function routeControlFlowError(ctx: InterpreterContext, error: ControlFlowError, redirections: RedirectionNode[], prepared: PreparedRedirections): Promise<void>;
48
+ export declare function withPreparedRedirections(ctx: InterpreterContext, redirections: RedirectionNode[], inheritedStdin: string, run: (prepared: PreparedRedirections) => Promise<ExecResult>): Promise<ExecResult>;
49
+ export declare function applyRedirections(ctx: InterpreterContext, result: ExecResult, redirections: RedirectionNode[], targets: ExpandedRedirectTargets, dupSources?: PreparedDupSources, standardRoutes?: Map<number, FdEntry>, writeErrorCommand?: string, omitShellPrefix?: boolean): Promise<ExecResult>;
50
+ export {};
@@ -14,12 +14,20 @@ export type ExecuteStatementFn = (stmt: StatementNode) => Promise<ExecResult>;
14
14
  * Execute a subshell node (...).
15
15
  * Creates an isolated execution environment that doesn't affect the parent.
16
16
  */
17
- export declare function executeSubshell(ctx: InterpreterContext, node: SubshellNode, stdin: string, executeStatement: ExecuteStatementFn): Promise<ExecResult>;
17
+ export declare function executeSubshell(ctx: InterpreterContext, node: SubshellNode, stdin: string, executeStatement: ExecuteStatementFn,
18
+ /** See `executeGroup`: empty content can still be an owned, empty fd 0. */
19
+ stdinOwned?: boolean): Promise<ExecResult>;
18
20
  /**
19
21
  * Execute a group node { ...; }.
20
22
  * Runs commands in the current execution environment.
21
23
  */
22
- export declare function executeGroup(ctx: InterpreterContext, node: GroupNode, stdin: string, executeStatement: ExecuteStatementFn): Promise<ExecResult>;
24
+ export declare function executeGroup(ctx: InterpreterContext, node: GroupNode, stdin: string, executeStatement: ExecuteStatementFn,
25
+ /**
26
+ * The caller already gave this group its own fd 0 — a function body whose
27
+ * definition or call was redirected. Needed because an empty `stdin` cannot
28
+ * say whether it came from `< empty-file` or from no redirection at all.
29
+ */
30
+ stdinOwned?: boolean): Promise<ExecResult>;
23
31
  /**
24
32
  * Type for executeScript callback
25
33
  */
@@ -7,6 +7,7 @@ import type { IFileSystem } from "../fs/interface.js";
7
7
  import type { ExecutionLimits } from "../limits.js";
8
8
  import type { SecureFetch } from "../network/index.js";
9
9
  import type { CommandExecOptions, CommandRegistry, ExecResult, FeatureCoverageWriter, TraceCallback } from "../types.js";
10
+ import type { ProcessSubstitutionEntry } from "./process-substitution.js";
10
11
  export type InterpreterExecOptions = Omit<CommandExecOptions, "cwd"> & {
11
12
  cwd?: string;
12
13
  };
@@ -246,10 +247,40 @@ export interface ProcessState {
246
247
  export interface IOState {
247
248
  /** Stdin available for commands in compound commands (groups, subshells, while loops with piped input) */
248
249
  groupStdin?: string;
250
+ /** Descriptor that supplied `groupStdin`, when it has a shared position. */
251
+ groupStdinSourceFd?: number;
249
252
  /** File descriptors for process substitution and here-docs */
250
253
  fileDescriptors?: Map<number, string>;
254
+ /**
255
+ * Descriptors whose `fileDescriptors` value is verbatim content rather
256
+ * than one of the `__file__:` / `__rw__:` / `__dupout__:` markers. Kept
257
+ * beside the table (which is public API and must stay `Map<number,
258
+ * string>`) so that file content shaped like a marker is never mistaken
259
+ * for one. Maintained exclusively by `fd-table.ts`.
260
+ */
261
+ inputFds?: Set<number>;
262
+ /**
263
+ * Descriptors that share one open file description because of `N<&M`, and
264
+ * therefore share a read offset. Every member of a group maps to the same
265
+ * Set; descriptors with no aliases have no entry. Maintained exclusively
266
+ * by `fd-table.ts`.
267
+ */
268
+ fdAliases?: Map<number, Set<number>>;
269
+ /** Standard descriptors closed by persistent `exec N>&-` redirections. */
270
+ closedStandardFds?: Set<number>;
251
271
  /** Next available file descriptor for {varname}>file allocation (starts at 10) */
252
272
  nextFd?: number;
273
+ /**
274
+ * Process substitutions (`<(cmd)` / `>(cmd)`) whose backing files are still
275
+ * live, oldest first. Used as a stack: each command execution releases the
276
+ * entries its own expansion pushed.
277
+ */
278
+ processSubstitutions?: ProcessSubstitutionEntry[];
279
+ /**
280
+ * True once `/dev/fd` has been routed to a private in-memory filesystem
281
+ * because the supplied one refused to back a descriptor (read-only sandbox).
282
+ */
283
+ processSubstitutionFsMounted?: boolean;
253
284
  }
254
285
  /**
255
286
  * Captures errors that occur during parameter expansion.
@@ -336,7 +367,13 @@ export interface InterpreterContext {
336
367
  execFn: (script: string, options?: InterpreterExecOptions, stdinAlreadyAccounted?: boolean) => Promise<ExecResult>;
337
368
  executeScript: (node: ScriptNode) => Promise<ExecResult>;
338
369
  executeStatement: (node: StatementNode) => Promise<ExecResult>;
339
- executeCommand: (node: CommandNode, stdin: string) => Promise<ExecResult>;
370
+ /**
371
+ * `stdinOwned` says the caller gave this command its own fd 0, even when the
372
+ * content is the empty string (`f < empty-file`). Without it an empty stdin
373
+ * is indistinguishable from "no redirection", and the command would fall
374
+ * back to the enclosing shell's stdin instead of seeing EOF.
375
+ */
376
+ executeCommand: (node: CommandNode, stdin: string, stdinOwned?: boolean) => Promise<ExecResult>;
340
377
  /** Optional secure fetch function for network-enabled commands */
341
378
  fetch?: SecureFetch;
342
379
  /** Optional sleep function for testing with mock clocks */
@@ -23,6 +23,17 @@ export type PinnedConnectionOwnerFactory = (pinned: PinnedAddress) => Promise<Pi
23
23
  export declare class DnsPinningUnavailableError extends Error {
24
24
  constructor();
25
25
  }
26
+ /**
27
+ * Both shapes a dynamic `import("undici")` can resolve to.
28
+ *
29
+ * Node resolves the package and exposes its CommonJS exports as named ones. A
30
+ * bundler that inlines the same module into its own graph cannot always do
31
+ * that, and hands back a namespace carrying the module under `default` alone.
32
+ */
33
+ type UndiciNamespace = typeof import("undici") | Pick<typeof import("undici"), "default">;
34
+ type UndiciExports = typeof import("undici") | typeof import("undici").default;
35
+ /** @internal Pure namespace normalization used by focused interop tests. */
36
+ export declare function _undiciExports(namespace: UndiciNamespace): UndiciExports;
26
37
  type PinnedLookup = import("node:net").LookupFunction;
27
38
  /** @internal Pure connector lookup used by focused binding tests. */
28
39
  export declare function _createPinnedLookup(pinned: PinnedAddress): PinnedLookup;
@@ -13,4 +13,6 @@ noBraceExpansion?: boolean,
13
13
  /** When true, all backslash escapes create Escaped nodes (for regex patterns in [[ =~ ]]) */
14
14
  regexPattern?: boolean,
15
15
  /** When true, \} is treated as escaped } (used in parameter expansion default values) */
16
- inParameterExpansion?: boolean): WordPart[];
16
+ inParameterExpansion?: boolean,
17
+ /** Whether this token starts the complete shell word. */
18
+ atWordStart?: boolean): WordPart[];
@@ -82,6 +82,10 @@ export interface Token {
82
82
  /** For WORD tokens: quote information */
83
83
  quoted?: boolean;
84
84
  singleQuoted?: boolean;
85
+ /** Quote-removed value for a here-document delimiter token. */
86
+ heredocDelimiter?: string;
87
+ /** Whether a here-document content token ended at its delimiter. */
88
+ heredocTerminated?: boolean;
85
89
  }
86
90
  /**
87
91
  * Error thrown when the lexer encounters invalid input
@@ -91,6 +95,7 @@ export declare class LexerError extends Error {
91
95
  column: number;
92
96
  constructor(message: string, line: number, column: number);
93
97
  }
98
+ export declare function isReservedWordToken(type: TokenType): boolean;
94
99
  /**
95
100
  * Lexer class
96
101
  */
@@ -101,6 +106,7 @@ export declare class Lexer {
101
106
  private column;
102
107
  private tokens;
103
108
  private pendingHeredocs;
109
+ private pendingHeredocDelimiterMode;
104
110
  private dparenDepth;
105
111
  private maxHeredocSize;
106
112
  constructor(input: string, options?: LexerOptions);
@@ -121,15 +127,7 @@ export declare class Lexer {
121
127
  private readComment;
122
128
  private readWord;
123
129
  private readHeredocContent;
124
- /**
125
- * Register a here-document to be read after the next newline
126
- */
127
- addPendingHeredoc(delimiter: string, stripTabs: boolean, quoted: boolean): void;
128
- /**
129
- * Look ahead from current position to find the here-doc delimiter
130
- * and register it as a pending here-doc
131
- */
132
- private registerHeredocFromLookahead;
130
+ private readHeredocDelimiterToken;
133
131
  /**
134
132
  * Check if position is followed by word characters (not a word boundary).
135
133
  * Used to determine if } should be literal or RBRACE token.