@jerryan/just-bash 3.10.0 → 3.11.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +96 -0
- package/README.md +2 -2
- package/dist/AGENTS.md +2 -2
- package/dist/abort-signals.d.ts +10 -0
- package/dist/bin/chunks/awk2-LCV2AUIX.js +3 -0
- package/dist/bin/{shell/chunks/base64-TQ5KOCNW.js → chunks/base64-OLYCF2PC.js} +1 -1
- package/dist/bin/chunks/{cat-BQ7FQTN5.js → cat-UJLF2DU2.js} +1 -1
- package/dist/bin/{shell/chunks/chmod-S4ARARR4.js → chunks/chmod-V5F4BXZ2.js} +1 -1
- package/dist/bin/chunks/{chunk-V4S4A7M6.js → chunk-2TEF4USR.js} +1 -1
- package/dist/bin/chunks/{chunk-N26Y42L6.js → chunk-3M5OMKFS.js} +1 -1
- package/dist/bin/{shell/chunks/chunk-M3Z5NZXT.js → chunks/chunk-572NXISH.js} +1 -1
- package/dist/bin/chunks/chunk-5NWK7A4R.js +13 -0
- package/dist/bin/{shell/chunks/chunk-YXPSX3SI.js → chunks/chunk-623Q77WZ.js} +1 -1
- package/dist/bin/chunks/chunk-6NG4ULJM.js +7 -0
- package/dist/bin/chunks/{chunk-QFOXSCOD.js → chunk-726WDFMQ.js} +1 -1
- package/dist/bin/chunks/{chunk-4JPWP5WS.js → chunk-AJ3CSZ34.js} +1 -1
- package/dist/bin/{shell/chunks/chunk-VTAMGD42.js → chunks/chunk-APEQNYAO.js} +1 -1
- package/dist/bin/chunks/chunk-BFLKIASG.js +7 -0
- package/dist/bin/chunks/{chunk-IOKQFPM6.js → chunk-BRB5PJ3E.js} +1 -1
- package/dist/bin/chunks/{chunk-ZVG47PYA.js → chunk-BVBYPYA5.js} +1 -1
- package/dist/bin/chunks/{chunk-K65FCSAT.js → chunk-BZJ77YQD.js} +1 -1
- package/dist/bin/{shell/chunks/chunk-GR4ZHKXI.js → chunks/chunk-C2BLJ3AE.js} +1 -1
- package/dist/bin/{shell/chunks/chunk-R7THHH4J.js → chunks/chunk-C45GTJTD.js} +1 -1
- package/dist/bin/chunks/{chunk-GOWX7VPU.js → chunk-CTS7QXCJ.js} +1 -1
- package/dist/bin/chunks/{chunk-42AMF6EE.js → chunk-DTNGYQCJ.js} +1 -1
- package/dist/bin/chunks/{chunk-TW2IJRUF.js → chunk-ENEHPI32.js} +1 -1
- package/dist/bin/chunks/{chunk-E54Z6VIE.js → chunk-ERYPQAZE.js} +5 -5
- package/dist/bin/chunks/{chunk-PQ2INDRF.js → chunk-GB3KUAFV.js} +1 -1
- package/dist/bin/{shell/chunks/chunk-E2O6S35K.js → chunks/chunk-HFVQCXYX.js} +1 -1
- package/dist/bin/chunks/{chunk-IRCAXXH6.js → chunk-HSWCKN2X.js} +1 -1
- package/dist/bin/chunks/{chunk-B6WWC6K3.js → chunk-I6MS5ZWE.js} +1 -1
- package/dist/bin/chunks/{chunk-V4U26ZWL.js → chunk-IOFXLMNJ.js} +1 -1
- package/dist/bin/chunks/chunk-IX6QY5JW.js +5 -0
- package/dist/bin/chunks/{chunk-QKJAAJ7J.js → chunk-IXTPVJ6W.js} +1 -1
- package/dist/bin/chunks/{chunk-OUQKFRVR.js → chunk-JBYLHCKP.js} +1 -1
- package/dist/bin/chunks/{chunk-NXUXZWS5.js → chunk-JLRB7DV3.js} +1 -1
- package/dist/bin/chunks/chunk-JZR2C63H.js +17 -0
- package/dist/bin/{shell/chunks/chunk-GKJD4ULC.js → chunks/chunk-KH6YLKPE.js} +1 -1
- package/dist/bin/{shell/chunks/chunk-Z3TCELKN.js → chunks/chunk-KXSDVBJA.js} +1 -1
- package/dist/bin/chunks/{chunk-DYIBFLS3.js → chunk-LOU52GPJ.js} +2 -2
- package/dist/bin/{shell/chunks/chunk-L345YZ6R.js → chunks/chunk-LVT5R45K.js} +1 -1
- package/dist/bin/{shell/chunks/chunk-PTUQEN6I.js → chunks/chunk-M345X45Z.js} +7 -7
- package/dist/bin/chunks/{chunk-MWQMHODV.js → chunk-NDS7PYKD.js} +1 -1
- package/dist/bin/chunks/chunk-O3PNT72D.js +3 -0
- package/dist/bin/chunks/chunk-OGOISDGZ.js +3 -0
- package/dist/bin/chunks/chunk-OSW4MDDH.js +21 -0
- package/dist/bin/chunks/{chunk-FPWHWWXO.js → chunk-OXV2B2YS.js} +1 -1
- package/dist/bin/chunks/{chunk-QMPZXXEK.js → chunk-OY25E3ZN.js} +1 -1
- package/dist/bin/{shell/chunks/chunk-O2BCKSMK.js → chunks/chunk-PEJXCXSY.js} +1 -1
- package/dist/bin/{shell/chunks/chunk-6KHZX4HU.js → chunks/chunk-PLLMJHMV.js} +1 -1
- package/dist/bin/{shell/chunks/chunk-6TUILMPB.js → chunks/chunk-QELDDRV5.js} +1 -1
- package/dist/bin/chunks/{chunk-3FQBUEB6.js → chunk-RC4UXNHA.js} +1 -1
- package/dist/bin/{shell/chunks/chunk-H7PD6FLC.js → chunks/chunk-RE7Z53A3.js} +1 -1
- package/dist/bin/chunks/chunk-SCQRBEQW.js +275 -0
- package/dist/bin/chunks/{chunk-3DWQCLNP.js → chunk-SS2OPV62.js} +1 -1
- package/dist/bin/{shell/chunks/chunk-CC2AQ6B7.js → chunks/chunk-U6JTVQU6.js} +1 -1
- package/dist/bin/{shell/chunks/chunk-UNCYBFWT.js → chunks/chunk-UFAYH3WW.js} +1 -1
- package/dist/bin/chunks/chunk-UPUFWGHR.js +3 -0
- package/dist/bin/{shell/chunks/chunk-HARVZWUX.js → chunks/chunk-UU42WPB7.js} +1 -1
- package/dist/bin/chunks/{chunk-CNVNOT67.js → chunk-UW4E5XU5.js} +1 -1
- package/dist/bin/{shell/chunks/chunk-F4ACJZIY.js → chunks/chunk-WLQ2KWS3.js} +1 -1
- package/dist/bin/chunks/{chunk-MVBK66TR.js → chunk-WPJ5CECR.js} +1 -1
- package/dist/bin/chunks/{chunk-ANX7U57Q.js → chunk-XBOBVLRL.js} +2 -2
- package/dist/bin/chunks/{chunk-HZGHQZSY.js → chunk-Z3MXFCN7.js} +1 -1
- package/dist/bin/chunks/{column-AJFK3TWF.js → column-AL4LR5PO.js} +1 -1
- package/dist/bin/chunks/{cp-WRBRHVVD.js → cp-XJWV46T5.js} +1 -1
- package/dist/bin/chunks/{curl-NHNZ46BU.js → curl-HZ5SBTVY.js} +11 -11
- package/dist/bin/chunks/{cut-42X6363P.js → cut-LNJEMWBJ.js} +1 -1
- package/dist/bin/chunks/dist-4NZ74CRE.js +141 -0
- package/dist/bin/chunks/{expr-PQEPO5TE.js → expr-GLGO2VEZ.js} +1 -1
- package/dist/bin/chunks/{file-JA7QI2YT.js → file-7M5LLZJY.js} +1 -1
- package/dist/bin/chunks/{find-T3JZPTUX.js → find-QM4ZVJ2E.js} +1 -1
- package/dist/bin/chunks/flag-coverage-ERCJF44K.js +3 -0
- package/dist/bin/chunks/{grep-VXWNMIDD.js → grep-AZJ2CMYE.js} +1 -1
- package/dist/bin/chunks/{gzip-EXJSFNCU.js → gzip-W5CL2E2W.js} +1 -1
- package/dist/bin/{shell/chunks/head-QKVY3SIO.js → chunks/head-ABLEKDMV.js} +1 -1
- package/dist/bin/{shell/chunks/help-HVIDHJ6M.js → chunks/help-EXVKU23F.js} +1 -1
- package/dist/bin/chunks/{html-to-markdown-XUMA42ZC.js → html-to-markdown-FDNPIEKZ.js} +1 -1
- package/dist/bin/{shell/chunks/jq-YS4PR46D.js → chunks/jq-5SOTL7D7.js} +1 -1
- package/dist/bin/chunks/{js-exec-PLUMFEX6.js → js-exec-LISDW7YC.js} +1 -1
- package/dist/bin/chunks/js-exec-worker.js +1 -0
- package/dist/bin/{shell/chunks/ls-LOCOWLZ3.js → chunks/ls-EEX3YIOF.js} +1 -1
- package/dist/bin/chunks/mkdir-KDEZTR53.js +3 -0
- package/dist/bin/chunks/mktemp-OYQYUB5H.js +3 -0
- package/dist/bin/chunks/{mv-NAMOL2HF.js → mv-35V6IA5V.js} +1 -1
- package/dist/bin/chunks/{od-2GXD4D5K.js → od-TD5LZDUM.js} +1 -1
- package/dist/bin/{shell/chunks/paste-DWWA3JTW.js → chunks/paste-QJG6BYAP.js} +1 -1
- package/dist/bin/chunks/{python3-J5GXF27H.js → python3-P6MZ44HK.js} +1 -1
- package/dist/bin/{shell/chunks/rg-XF5U7GS2.js → chunks/rg-B2DVJQVY.js} +1 -1
- package/dist/bin/chunks/rm-HCMKNRM2.js +3 -0
- package/dist/bin/{shell/chunks/rmdir-W73C4GEA.js → chunks/rmdir-WGVUYGPF.js} +1 -1
- package/dist/bin/{shell/chunks/sed-SY63U2YX.js → chunks/sed-66XZQ75T.js} +1 -1
- package/dist/bin/chunks/{seq-X2EAOGV5.js → seq-KBVCQ4WT.js} +1 -1
- package/dist/bin/{shell/chunks/sleep-MOJQBZMY.js → chunks/sleep-4O22Z4DI.js} +1 -1
- package/dist/bin/chunks/{split-2VXPZJJ4.js → split-OK6JHDWZ.js} +1 -1
- package/dist/bin/chunks/sqlite3-57ACN7ES.js +3 -0
- package/dist/bin/chunks/{stat-LROLDXHH.js → stat-VNNI7JDZ.js} +1 -1
- package/dist/bin/chunks/{tail-UOTUV25D.js → tail-PAHZX3MA.js} +1 -1
- package/dist/bin/chunks/{tar-7XOP7VOX.js → tar-RPVTXGFJ.js} +1 -1
- package/dist/bin/chunks/{time-LF7BTSK5.js → time-J2DAZUIN.js} +1 -1
- package/dist/bin/chunks/timeout-XMTXHNFF.js +3 -0
- package/dist/bin/{shell/chunks/tr-PVFO6FRY.js → chunks/tr-ETPC3LHV.js} +1 -1
- package/dist/bin/chunks/worker.js +5 -0
- package/dist/bin/chunks/{xan-RMH6JEXM.js → xan-XZHKEPJ4.js} +1 -1
- package/dist/bin/chunks/{xan-view-PD26QEFN.js → xan-view-CNGKCABE.js} +1 -1
- package/dist/bin/chunks/yes-2EQTNSIB.js +3 -0
- package/dist/bin/chunks/yq-T6S3IDKY.js +3 -0
- package/dist/bin/just-bash.js +291 -286
- package/dist/bin/shell/chunks/awk2-LCV2AUIX.js +3 -0
- package/dist/bin/{chunks/base64-TQ5KOCNW.js → shell/chunks/base64-OLYCF2PC.js} +1 -1
- package/dist/bin/shell/chunks/{cat-BQ7FQTN5.js → cat-UJLF2DU2.js} +1 -1
- package/dist/bin/{chunks/chmod-S4ARARR4.js → shell/chunks/chmod-V5F4BXZ2.js} +1 -1
- package/dist/bin/shell/chunks/{chunk-V4S4A7M6.js → chunk-2TEF4USR.js} +1 -1
- package/dist/bin/shell/chunks/{chunk-N26Y42L6.js → chunk-3M5OMKFS.js} +1 -1
- package/dist/bin/{chunks/chunk-M3Z5NZXT.js → shell/chunks/chunk-572NXISH.js} +1 -1
- package/dist/bin/shell/chunks/chunk-5NWK7A4R.js +13 -0
- package/dist/bin/{chunks/chunk-YXPSX3SI.js → shell/chunks/chunk-623Q77WZ.js} +1 -1
- package/dist/bin/shell/chunks/chunk-6NG4ULJM.js +7 -0
- package/dist/bin/shell/chunks/{chunk-QFOXSCOD.js → chunk-726WDFMQ.js} +1 -1
- package/dist/bin/shell/chunks/{chunk-4JPWP5WS.js → chunk-AJ3CSZ34.js} +1 -1
- package/dist/bin/{chunks/chunk-VTAMGD42.js → shell/chunks/chunk-APEQNYAO.js} +1 -1
- package/dist/bin/shell/chunks/chunk-BFLKIASG.js +7 -0
- package/dist/bin/shell/chunks/{chunk-IOKQFPM6.js → chunk-BRB5PJ3E.js} +1 -1
- package/dist/bin/shell/chunks/{chunk-ZVG47PYA.js → chunk-BVBYPYA5.js} +1 -1
- package/dist/bin/shell/chunks/{chunk-K65FCSAT.js → chunk-BZJ77YQD.js} +1 -1
- package/dist/bin/{chunks/chunk-GR4ZHKXI.js → shell/chunks/chunk-C2BLJ3AE.js} +1 -1
- package/dist/bin/{chunks/chunk-R7THHH4J.js → shell/chunks/chunk-C45GTJTD.js} +1 -1
- package/dist/bin/shell/chunks/{chunk-GOWX7VPU.js → chunk-CTS7QXCJ.js} +1 -1
- package/dist/bin/shell/chunks/{chunk-42AMF6EE.js → chunk-DTNGYQCJ.js} +1 -1
- package/dist/bin/shell/chunks/{chunk-TW2IJRUF.js → chunk-ENEHPI32.js} +1 -1
- package/dist/bin/shell/chunks/{chunk-E54Z6VIE.js → chunk-ERYPQAZE.js} +5 -5
- package/dist/bin/shell/chunks/{chunk-PQ2INDRF.js → chunk-GB3KUAFV.js} +1 -1
- package/dist/bin/{chunks/chunk-E2O6S35K.js → shell/chunks/chunk-HFVQCXYX.js} +1 -1
- package/dist/bin/shell/chunks/{chunk-IRCAXXH6.js → chunk-HSWCKN2X.js} +1 -1
- package/dist/bin/shell/chunks/{chunk-B6WWC6K3.js → chunk-I6MS5ZWE.js} +1 -1
- package/dist/bin/shell/chunks/{chunk-V4U26ZWL.js → chunk-IOFXLMNJ.js} +1 -1
- package/dist/bin/shell/chunks/chunk-IX6QY5JW.js +5 -0
- package/dist/bin/shell/chunks/{chunk-QKJAAJ7J.js → chunk-IXTPVJ6W.js} +1 -1
- package/dist/bin/shell/chunks/{chunk-OUQKFRVR.js → chunk-JBYLHCKP.js} +1 -1
- package/dist/bin/shell/chunks/{chunk-NXUXZWS5.js → chunk-JLRB7DV3.js} +1 -1
- package/dist/bin/shell/chunks/chunk-JZR2C63H.js +17 -0
- package/dist/bin/{chunks/chunk-GKJD4ULC.js → shell/chunks/chunk-KH6YLKPE.js} +1 -1
- package/dist/bin/{chunks/chunk-Z3TCELKN.js → shell/chunks/chunk-KXSDVBJA.js} +1 -1
- package/dist/bin/shell/chunks/{chunk-DYIBFLS3.js → chunk-LOU52GPJ.js} +2 -2
- package/dist/bin/{chunks/chunk-L345YZ6R.js → shell/chunks/chunk-LVT5R45K.js} +1 -1
- package/dist/bin/{chunks/chunk-PTUQEN6I.js → shell/chunks/chunk-M345X45Z.js} +7 -7
- package/dist/bin/shell/chunks/{chunk-MWQMHODV.js → chunk-NDS7PYKD.js} +1 -1
- package/dist/bin/shell/chunks/chunk-O3PNT72D.js +3 -0
- package/dist/bin/shell/chunks/chunk-OGOISDGZ.js +3 -0
- package/dist/bin/shell/chunks/chunk-OSW4MDDH.js +21 -0
- package/dist/bin/shell/chunks/{chunk-FPWHWWXO.js → chunk-OXV2B2YS.js} +1 -1
- package/dist/bin/shell/chunks/{chunk-QMPZXXEK.js → chunk-OY25E3ZN.js} +1 -1
- package/dist/bin/{chunks/chunk-O2BCKSMK.js → shell/chunks/chunk-PEJXCXSY.js} +1 -1
- package/dist/bin/{chunks/chunk-6KHZX4HU.js → shell/chunks/chunk-PLLMJHMV.js} +1 -1
- package/dist/bin/{chunks/chunk-6TUILMPB.js → shell/chunks/chunk-QELDDRV5.js} +1 -1
- package/dist/bin/shell/chunks/{chunk-3FQBUEB6.js → chunk-RC4UXNHA.js} +1 -1
- package/dist/bin/{chunks/chunk-H7PD6FLC.js → shell/chunks/chunk-RE7Z53A3.js} +1 -1
- package/dist/bin/shell/chunks/chunk-SCQRBEQW.js +275 -0
- package/dist/bin/shell/chunks/{chunk-3DWQCLNP.js → chunk-SS2OPV62.js} +1 -1
- package/dist/bin/{chunks/chunk-CC2AQ6B7.js → shell/chunks/chunk-U6JTVQU6.js} +1 -1
- package/dist/bin/{chunks/chunk-UNCYBFWT.js → shell/chunks/chunk-UFAYH3WW.js} +1 -1
- package/dist/bin/shell/chunks/chunk-UPUFWGHR.js +3 -0
- package/dist/bin/{chunks/chunk-HARVZWUX.js → shell/chunks/chunk-UU42WPB7.js} +1 -1
- package/dist/bin/shell/chunks/{chunk-CNVNOT67.js → chunk-UW4E5XU5.js} +1 -1
- package/dist/bin/{chunks/chunk-F4ACJZIY.js → shell/chunks/chunk-WLQ2KWS3.js} +1 -1
- package/dist/bin/shell/chunks/{chunk-MVBK66TR.js → chunk-WPJ5CECR.js} +1 -1
- package/dist/bin/shell/chunks/{chunk-ANX7U57Q.js → chunk-XBOBVLRL.js} +2 -2
- package/dist/bin/shell/chunks/{chunk-HZGHQZSY.js → chunk-Z3MXFCN7.js} +1 -1
- package/dist/bin/shell/chunks/{column-AJFK3TWF.js → column-AL4LR5PO.js} +1 -1
- package/dist/bin/shell/chunks/{cp-WRBRHVVD.js → cp-XJWV46T5.js} +1 -1
- package/dist/bin/shell/chunks/{curl-NHNZ46BU.js → curl-HZ5SBTVY.js} +11 -11
- package/dist/bin/shell/chunks/{cut-42X6363P.js → cut-LNJEMWBJ.js} +1 -1
- package/dist/bin/shell/chunks/dist-4NZ74CRE.js +141 -0
- package/dist/bin/shell/chunks/{expr-PQEPO5TE.js → expr-GLGO2VEZ.js} +1 -1
- package/dist/bin/shell/chunks/{file-JA7QI2YT.js → file-7M5LLZJY.js} +1 -1
- package/dist/bin/shell/chunks/{find-T3JZPTUX.js → find-QM4ZVJ2E.js} +1 -1
- package/dist/bin/shell/chunks/flag-coverage-ERCJF44K.js +3 -0
- package/dist/bin/shell/chunks/{grep-VXWNMIDD.js → grep-AZJ2CMYE.js} +1 -1
- package/dist/bin/shell/chunks/{gzip-EXJSFNCU.js → gzip-W5CL2E2W.js} +1 -1
- package/dist/bin/{chunks/head-QKVY3SIO.js → shell/chunks/head-ABLEKDMV.js} +1 -1
- package/dist/bin/{chunks/help-HVIDHJ6M.js → shell/chunks/help-EXVKU23F.js} +1 -1
- package/dist/bin/shell/chunks/{html-to-markdown-XUMA42ZC.js → html-to-markdown-FDNPIEKZ.js} +1 -1
- package/dist/bin/{chunks/jq-YS4PR46D.js → shell/chunks/jq-5SOTL7D7.js} +1 -1
- package/dist/bin/shell/chunks/{js-exec-PLUMFEX6.js → js-exec-LISDW7YC.js} +1 -1
- package/dist/bin/{chunks/ls-LOCOWLZ3.js → shell/chunks/ls-EEX3YIOF.js} +1 -1
- package/dist/bin/shell/chunks/mkdir-KDEZTR53.js +3 -0
- package/dist/bin/shell/chunks/mktemp-OYQYUB5H.js +3 -0
- package/dist/bin/shell/chunks/{mv-NAMOL2HF.js → mv-35V6IA5V.js} +1 -1
- package/dist/bin/shell/chunks/{od-2GXD4D5K.js → od-TD5LZDUM.js} +1 -1
- package/dist/bin/{chunks/paste-DWWA3JTW.js → shell/chunks/paste-QJG6BYAP.js} +1 -1
- package/dist/bin/shell/chunks/{python3-J5GXF27H.js → python3-P6MZ44HK.js} +1 -1
- package/dist/bin/{chunks/rg-XF5U7GS2.js → shell/chunks/rg-B2DVJQVY.js} +1 -1
- package/dist/bin/shell/chunks/rm-HCMKNRM2.js +3 -0
- package/dist/bin/{chunks/rmdir-W73C4GEA.js → shell/chunks/rmdir-WGVUYGPF.js} +1 -1
- package/dist/bin/{chunks/sed-SY63U2YX.js → shell/chunks/sed-66XZQ75T.js} +1 -1
- package/dist/bin/shell/chunks/{seq-X2EAOGV5.js → seq-KBVCQ4WT.js} +1 -1
- package/dist/bin/{chunks/sleep-MOJQBZMY.js → shell/chunks/sleep-4O22Z4DI.js} +1 -1
- package/dist/bin/shell/chunks/{split-2VXPZJJ4.js → split-OK6JHDWZ.js} +1 -1
- package/dist/bin/shell/chunks/sqlite3-57ACN7ES.js +3 -0
- package/dist/bin/shell/chunks/{stat-LROLDXHH.js → stat-VNNI7JDZ.js} +1 -1
- package/dist/bin/shell/chunks/{tail-UOTUV25D.js → tail-PAHZX3MA.js} +1 -1
- package/dist/bin/shell/chunks/{tar-7XOP7VOX.js → tar-RPVTXGFJ.js} +1 -1
- package/dist/bin/shell/chunks/{time-LF7BTSK5.js → time-J2DAZUIN.js} +1 -1
- package/dist/bin/shell/chunks/timeout-XMTXHNFF.js +3 -0
- package/dist/bin/{chunks/tr-PVFO6FRY.js → shell/chunks/tr-ETPC3LHV.js} +1 -1
- package/dist/bin/shell/chunks/{xan-RMH6JEXM.js → xan-XZHKEPJ4.js} +1 -1
- package/dist/bin/shell/chunks/{xan-view-PD26QEFN.js → xan-view-CNGKCABE.js} +1 -1
- package/dist/bin/shell/chunks/yes-2EQTNSIB.js +3 -0
- package/dist/bin/shell/chunks/yq-T6S3IDKY.js +3 -0
- package/dist/bin/shell/shell.js +337 -332
- package/dist/browser.d.ts +1 -1
- package/dist/bundle/browser.js +741 -730
- package/dist/bundle/chunks/awk2-TLK6FCHV.js +2 -0
- package/dist/bundle/chunks/{base64-MHVQ5XHI.js → base64-GUZMZ645.js} +1 -1
- package/dist/bundle/chunks/{cat-VZBWBIJB.js → cat-LG4YGKUE.js} +1 -1
- package/dist/bundle/chunks/{chmod-KMFNCMRX.js → chmod-XUKPG2M4.js} +1 -1
- package/dist/bundle/chunks/{chunk-WNH3HOQA.js → chunk-353VO5TF.js} +1 -1
- package/dist/bundle/chunks/{chunk-O5OYOY3C.js → chunk-37UJACD6.js} +1 -1
- package/dist/bundle/chunks/{chunk-MMXJJCAE.js → chunk-3LGQ6XEC.js} +1 -1
- package/dist/bundle/chunks/{chunk-P57S6Z6R.js → chunk-3ZY5QX3G.js} +1 -1
- package/dist/bundle/chunks/{chunk-5KOWUQOZ.js → chunk-4VU4IF3W.js} +1 -1
- package/dist/bundle/chunks/{chunk-SIOONII3.js → chunk-52W2IWA7.js} +1 -1
- package/dist/bundle/chunks/chunk-5IB57TIJ.js +274 -0
- package/dist/bundle/chunks/chunk-5J4S2LP5.js +2 -0
- package/dist/bundle/chunks/{chunk-PCPW54JH.js → chunk-5LDRJ22P.js} +1 -1
- package/dist/bundle/chunks/{chunk-BKUWXPEM.js → chunk-654CJKE3.js} +1 -1
- package/dist/bundle/chunks/{chunk-EZNS4GF7.js → chunk-67ODVGSB.js} +1 -1
- package/dist/bundle/chunks/{chunk-6QF3PCMO.js → chunk-6HQQON3N.js} +1 -1
- package/dist/bundle/chunks/{chunk-U57DSHID.js → chunk-6P2DITXT.js} +1 -1
- package/dist/bundle/chunks/chunk-6X2Y5CA2.js +16 -0
- package/dist/bundle/chunks/{chunk-THDUQVY3.js → chunk-74IR77AZ.js} +1 -1
- package/dist/bundle/chunks/{chunk-S3ENGQML.js → chunk-7DVD6YCI.js} +1 -1
- package/dist/bundle/chunks/{chunk-HXWB4Z5X.js → chunk-7II7XIVI.js} +1 -1
- package/dist/bundle/chunks/{chunk-AYSZ5MAE.js → chunk-A3C4Z3Q3.js} +1 -1
- package/dist/bundle/chunks/chunk-A6SU3BZX.js +6 -0
- package/dist/bundle/chunks/{chunk-5NUTFEEG.js → chunk-AMXNXHXK.js} +1 -1
- package/dist/bundle/chunks/{chunk-QJ7OXJAZ.js → chunk-BLG7RWH4.js} +1 -1
- package/dist/bundle/chunks/{chunk-XQ2ZZFO6.js → chunk-BQTWRHZR.js} +2 -2
- package/dist/bundle/chunks/{chunk-6IFH67ZB.js → chunk-BZ2OMW2T.js} +1 -1
- package/dist/bundle/chunks/{chunk-CH7SUFFO.js → chunk-CORCIYJD.js} +1 -1
- package/dist/bundle/chunks/{chunk-LGIJSCWH.js → chunk-EQDVNHQS.js} +1 -1
- package/dist/bundle/chunks/{chunk-U4K5ZDWK.js → chunk-EZEO6MFE.js} +1 -1
- package/dist/bundle/chunks/{chunk-4CDTAUYP.js → chunk-EZT6M2HG.js} +1 -1
- package/dist/bundle/chunks/{chunk-4MJ7VJG4.js → chunk-H7UVJSZR.js} +1 -1
- package/dist/bundle/chunks/{chunk-5EI7WSRV.js → chunk-HYQGYXGZ.js} +1 -1
- package/dist/bundle/chunks/{chunk-6IA4DXG2.js → chunk-IPKSYZ3R.js} +1 -1
- package/dist/bundle/chunks/{chunk-TLPMB3FO.js → chunk-KJBPGFZD.js} +1 -1
- package/dist/bundle/chunks/{chunk-YFFU74KY.js → chunk-MJEJ7QEY.js} +1 -1
- package/dist/bundle/chunks/{chunk-QJFYYEFV.js → chunk-N36I27VM.js} +1 -1
- package/dist/bundle/chunks/chunk-N5L7E4EL.js +6 -0
- package/dist/bundle/chunks/{chunk-IXFQXNL4.js → chunk-NFW4YKDO.js} +1 -1
- package/dist/bundle/chunks/{chunk-PASYAXFP.js → chunk-NOX3PCUH.js} +1 -1
- package/dist/bundle/chunks/{chunk-MQKGGNPS.js → chunk-NXBUT5V2.js} +2 -2
- package/dist/bundle/chunks/{chunk-4KZT23KR.js → chunk-O5BHWBYH.js} +1 -1
- package/dist/bundle/chunks/{chunk-DVSA72LH.js → chunk-QTL2XC4B.js} +1 -1
- package/dist/bundle/chunks/chunk-RK2WBVP4.js +2 -0
- package/dist/bundle/chunks/{chunk-BLPYR4TN.js → chunk-RVBBGZ22.js} +1 -1
- package/dist/bundle/chunks/{chunk-PS2RJNZZ.js → chunk-SXQJYLP7.js} +1 -1
- package/dist/bundle/chunks/{chunk-FXAKF2QS.js → chunk-T7OAZEXT.js} +1 -1
- package/dist/bundle/chunks/{chunk-O452S4KX.js → chunk-URIKBXSE.js} +1 -1
- package/dist/bundle/chunks/{chunk-6BSOPPZH.js → chunk-UVQC75LS.js} +7 -7
- package/dist/bundle/chunks/chunk-VCREDMWH.js +4 -0
- package/dist/bundle/chunks/{chunk-DDPD7SIB.js → chunk-VQ6EUBJ3.js} +1 -1
- package/dist/bundle/chunks/{chunk-4OKRFRMS.js → chunk-VQEB6E2M.js} +1 -1
- package/dist/bundle/chunks/{chunk-R2FBRMDU.js → chunk-VWUMR4IC.js} +1 -1
- package/dist/bundle/chunks/{chunk-XXBIOG4R.js → chunk-WDY2TNMK.js} +1 -1
- package/dist/bundle/chunks/{chunk-H4AFUSSQ.js → chunk-XT7EK6BR.js} +1 -1
- package/dist/bundle/chunks/{chunk-BS6EJR2R.js → chunk-XUTEQMTL.js} +5 -5
- package/dist/bundle/chunks/{chunk-KIGPB52X.js → chunk-XZ34OGNM.js} +1 -1
- package/dist/bundle/chunks/chunk-YUITEK6N.js +12 -0
- package/dist/bundle/chunks/chunk-YZCPEJRE.js +20 -0
- package/dist/bundle/chunks/chunk-ZUEPJPYA.js +2 -0
- package/dist/bundle/chunks/{column-QJI65SH2.js → column-T4LGMRJG.js} +1 -1
- package/dist/bundle/chunks/{cp-P2D2L6PC.js → cp-ZDDVNITX.js} +1 -1
- package/dist/bundle/chunks/{curl-K4WT7UPN.js → curl-RCRD36LD.js} +11 -11
- package/dist/bundle/chunks/{cut-FMDNVWQN.js → cut-35WER2E2.js} +1 -1
- package/dist/bundle/chunks/{expr-A5XITHQD.js → expr-KSNRNE7V.js} +1 -1
- package/dist/bundle/chunks/{file-6AYYTULJ.js → file-XH37HMGV.js} +1 -1
- package/dist/bundle/chunks/{find-IUWEB4XQ.js → find-BFNQSA5B.js} +1 -1
- package/dist/bundle/chunks/flag-coverage-7PBO3TUZ.js +2 -0
- package/dist/bundle/chunks/{grep-Q2O5EIXQ.js → grep-WW5KJPUG.js} +1 -1
- package/dist/bundle/chunks/{gzip-VUJBDHZ5.js → gzip-ISZXQNJJ.js} +1 -1
- package/dist/bundle/chunks/{head-6UIPFWVJ.js → head-VYXZQLPZ.js} +1 -1
- package/dist/bundle/chunks/{help-QDDMBDU7.js → help-62M75TSG.js} +1 -1
- package/dist/bundle/chunks/{html-to-markdown-PE6BPRPA.js → html-to-markdown-4LXS3A44.js} +1 -1
- package/dist/bundle/chunks/{jq-UKAA3QWU.js → jq-3IVOWP3G.js} +1 -1
- package/dist/bundle/chunks/{js-exec-6RW7WZCG.js → js-exec-T2WEE4KG.js} +1 -1
- package/dist/bundle/chunks/js-exec-worker.js +1 -0
- package/dist/bundle/chunks/{ls-ECKG2XHZ.js → ls-FC3CSHKE.js} +1 -1
- package/dist/bundle/chunks/mkdir-DPFWDY25.js +2 -0
- package/dist/bundle/chunks/mktemp-SW2AHXZW.js +2 -0
- package/dist/bundle/chunks/{mv-IF55A2UD.js → mv-PWCFXEF2.js} +1 -1
- package/dist/bundle/chunks/{od-Z4AIL3P4.js → od-VJ6PBBEI.js} +1 -1
- package/dist/bundle/chunks/{paste-ZNHNSRBW.js → paste-TIQETHSO.js} +1 -1
- package/dist/bundle/chunks/{python3-XHTOW7VA.js → python3-6JEP7ZZK.js} +1 -1
- package/dist/bundle/chunks/{rg-E6H2HACA.js → rg-2OPJ5V3D.js} +1 -1
- package/dist/bundle/chunks/rm-AZZM5DCE.js +2 -0
- package/dist/bundle/chunks/{rmdir-WKKBLZ54.js → rmdir-YXYSZD4X.js} +1 -1
- package/dist/bundle/chunks/{sed-6G32B25J.js → sed-HYSBLGO5.js} +1 -1
- package/dist/bundle/chunks/{seq-B6KDLMYQ.js → seq-M2S4FRN4.js} +1 -1
- package/dist/bundle/chunks/{sleep-25QUPVDK.js → sleep-YC4HFEGC.js} +1 -1
- package/dist/bundle/chunks/{split-NEU2K2YN.js → split-UOPIWKKE.js} +1 -1
- package/dist/bundle/chunks/sqlite3-XCROTL6G.js +2 -0
- package/dist/bundle/chunks/{stat-LXFZND2P.js → stat-I3FPUTR7.js} +1 -1
- package/dist/bundle/chunks/{tail-UBGSN4JF.js → tail-WK3WACZK.js} +1 -1
- package/dist/bundle/chunks/{tar-LE7LAAIX.js → tar-VZYMNZV2.js} +1 -1
- package/dist/bundle/chunks/{time-NERE2JJ2.js → time-N6J6DC6C.js} +1 -1
- package/dist/bundle/chunks/timeout-UDR5J2MP.js +2 -0
- package/dist/bundle/chunks/{tr-UI2LA3GA.js → tr-VI5PIA4A.js} +1 -1
- package/dist/bundle/chunks/worker.js +5 -0
- package/dist/bundle/chunks/{xan-UIL24CGT.js → xan-DL576EIT.js} +1 -1
- package/dist/bundle/chunks/xan-view-GJVN6IHX.js +2 -0
- package/dist/bundle/chunks/yes-OVJMX6NM.js +2 -0
- package/dist/bundle/chunks/yq-KYPU4LQP.js +2 -0
- package/dist/bundle/index.cjs +1079 -1068
- package/dist/bundle/index.js +336 -331
- package/dist/commands/mktemp/mktemp.d.ts +4 -0
- package/dist/commands/registry.d.ts +1 -1
- package/dist/commands/yes/yes.d.ts +4 -0
- package/dist/custom-commands.d.ts +7 -0
- package/dist/fs/create-exclusive.d.ts +30 -0
- package/dist/fs/in-memory-fs/in-memory-fs.d.ts +8 -1
- package/dist/fs/interface.d.ts +37 -0
- package/dist/fs/mountable-fs/mountable-fs.d.ts +18 -1
- package/dist/fs/overlay-fs/overlay-fs.d.ts +19 -1
- package/dist/fs/read-write-fs/read-write-fs.d.ts +22 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/interpreter/expansion/array-prefix-suffix.d.ts +2 -1
- package/dist/interpreter/expansion/parameter-ops.d.ts +1 -0
- package/dist/interpreter/expansion/pattern-removal.d.ts +3 -0
- package/dist/interpreter/expansion/variable.d.ts +1 -1
- package/dist/interpreter/helpers/loop.d.ts +32 -0
- package/dist/network/dns-pin.d.ts +1 -32
- package/dist/network/fetch.d.ts +1 -1
- package/dist/security/trusted-globals.d.ts +8 -0
- package/package.json +3 -4
- package/dist/bin/chunks/awk2-NTRVFXRA.js +0 -3
- package/dist/bin/chunks/chunk-3PCPQIUD.js +0 -3
- package/dist/bin/chunks/chunk-HWI42GQO.js +0 -7
- package/dist/bin/chunks/chunk-I57EACSL.js +0 -3
- package/dist/bin/chunks/chunk-NSI6LMDS.js +0 -16
- package/dist/bin/chunks/chunk-ONF4KUYV.js +0 -13
- package/dist/bin/chunks/chunk-PRVPFKTC.js +0 -276
- package/dist/bin/chunks/chunk-U5JLGI56.js +0 -21
- package/dist/bin/chunks/dist-5MWO25Y4.js +0 -141
- package/dist/bin/chunks/flag-coverage-LVKHEUTL.js +0 -3
- package/dist/bin/chunks/mkdir-VHLJ3E65.js +0 -3
- package/dist/bin/chunks/rm-L4RHENMV.js +0 -3
- package/dist/bin/chunks/sqlite3-3S5HIA5W.js +0 -3
- package/dist/bin/chunks/timeout-RQOWSWYG.js +0 -3
- package/dist/bin/chunks/yq-CWBZMGUV.js +0 -3
- package/dist/bin/shell/chunks/awk2-NTRVFXRA.js +0 -3
- package/dist/bin/shell/chunks/chunk-3PCPQIUD.js +0 -3
- package/dist/bin/shell/chunks/chunk-HWI42GQO.js +0 -7
- package/dist/bin/shell/chunks/chunk-I57EACSL.js +0 -3
- package/dist/bin/shell/chunks/chunk-NSI6LMDS.js +0 -16
- package/dist/bin/shell/chunks/chunk-ONF4KUYV.js +0 -13
- package/dist/bin/shell/chunks/chunk-PRVPFKTC.js +0 -276
- package/dist/bin/shell/chunks/chunk-U5JLGI56.js +0 -21
- package/dist/bin/shell/chunks/dist-5MWO25Y4.js +0 -141
- package/dist/bin/shell/chunks/flag-coverage-LVKHEUTL.js +0 -3
- package/dist/bin/shell/chunks/mkdir-VHLJ3E65.js +0 -3
- package/dist/bin/shell/chunks/rm-L4RHENMV.js +0 -3
- package/dist/bin/shell/chunks/sqlite3-3S5HIA5W.js +0 -3
- package/dist/bin/shell/chunks/timeout-RQOWSWYG.js +0 -3
- package/dist/bin/shell/chunks/yq-CWBZMGUV.js +0 -3
- package/dist/bundle/chunks/awk2-VS5QVYHU.js +0 -2
- package/dist/bundle/chunks/chunk-35MBA3VY.js +0 -12
- package/dist/bundle/chunks/chunk-4WRO2G22.js +0 -15
- package/dist/bundle/chunks/chunk-BRJERIF4.js +0 -2
- package/dist/bundle/chunks/chunk-FTET43KM.js +0 -2
- package/dist/bundle/chunks/chunk-GRUZ4SBY.js +0 -275
- package/dist/bundle/chunks/chunk-Y6JBSHCM.js +0 -20
- package/dist/bundle/chunks/chunk-ZBUZKIPX.js +0 -6
- package/dist/bundle/chunks/flag-coverage-SZ4AUPRQ.js +0 -2
- package/dist/bundle/chunks/mkdir-YL7XGMD7.js +0 -2
- package/dist/bundle/chunks/rm-CWLMERIO.js +0 -2
- package/dist/bundle/chunks/sqlite3-KJ5NMKBM.js +0 -2
- package/dist/bundle/chunks/timeout-37GM7IIL.js +0 -2
- package/dist/bundle/chunks/xan-view-FOCYCKZQ.js +0 -2
- package/dist/bundle/chunks/yq-ZRNZKDLE.js +0 -2
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
2
|
+
import{m as a}from"./chunk-TVCZIH6M.js";function l(...i){let n=[...new Set(i.filter(e=>e!==void 0))];if(n.length===0)return{signal:void 0,cleanup(){}};if(n.length===1)return{signal:n[0],cleanup(){}};let t=new AbortController,r=[];for(let e of n){if(e.aborted){t.abort(e.reason);break}let o=()=>t.abort(e.reason);e.addEventListener("abort",o,{once:!0}),r.push([e,o])}return{signal:t.signal,cleanup(){for(let[e,o]of r)e.removeEventListener("abort",o)}}}async function c(i,n,t){if(!n)return i;if(n.aborted)throw i.catch(()=>{}),new a("",t);let r;try{return await Promise.race([i,new Promise((e,o)=>{r=()=>o(new a("",t)),n.addEventListener("abort",r,{once:!0})})])}finally{r&&n.removeEventListener("abort",r)}}export{l as a,c as b};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
2
|
-
import{a as _}from"./chunk-YEYSCLSJ.js";import{b as p}from"./chunk-
|
|
2
|
+
import{a as _}from"./chunk-YEYSCLSJ.js";import{b as p}from"./chunk-A3C4Z3Q3.js";import{l as g}from"./chunk-TVCZIH6M.js";import{a as L}from"./chunk-QIQMJJZ4.js";import{a as S,b as C}from"./chunk-QAYAQNCG.js";var E={name:"base64",summary:"base64 encode/decode data and print to standard output",usage:"base64 [OPTION]... [FILE]",options:["-d, --decode decode data","-w, --wrap=COLS wrap encoded lines after COLS character (default 76, 0 to disable)"," --help display this help and exit"]},F={decode:{short:"d",long:"decode",type:"boolean"},wrap:{short:"w",long:"wrap",type:"number",default:76}};function a(t,e,u,i){if(t>e)throw new g(`base64: ${u} limit exceeded (${e} bytes)`,i)}function k(t){let e=[];for(let i=0;i<t.length;i+=32768)e.push(String.fromCharCode(...t.subarray(i,i+32768)));return e.join("")}function B(t){if(t.length===0)return 0;let e=t.endsWith("==")?2:t.endsWith("=")?1:0;return Math.max(0,Math.ceil(t.length/4)*3-e)}async function x(t,e,u){let i=Math.min(t.limits.maxInputBytes,t.limits.maxStringLength),o=t.stdin;if(e.length===0||e.length===1&&e[0]==="-")return a(o.length,i,"input size","string_length"),{ok:!0,data:Uint8Array.from(o,n=>n.charCodeAt(0))};let c=[],s=0;for(let n of e){if(n==="-"){a(s+o.length,i,"input size","string_length"),c.push(Uint8Array.from(o,r=>r.charCodeAt(0))),s+=o.length;continue}try{let r=t.fs.resolvePath(t.cwd,n),l=await t.fs.stat(r);a(s+l.size,i,"input size","string_length");let f=await t.fs.readFileBuffer(r);a(s+f.length,i,"input size","string_length"),_(t,f.length,u),c.push(f),s+=f.length}catch(r){return p(r),{ok:!1,error:{stdout:"",stderr:`${u}: ${n}: No such file or directory
|
|
3
3
|
`,exitCode:1}}}}let d=new Uint8Array(s),h=0;for(let n of c)d.set(n,h),h+=n.length;return{ok:!0,data:d}}var T={name:"base64",async execute(t,e){if(C(t))return S(E);let u=L("base64",t,F);if(!u.ok)return u.error;let i=u.result.flags.decode,o=u.result.flags.wrap,c=u.result.positional;if(!Number.isSafeInteger(o)||o<0)return{stdout:"",stderr:`base64: invalid wrap size
|
|
4
4
|
`,exitCode:1};try{if(i){let r=await x(e,c,"base64");if(!r.ok)return r.error;if(typeof Buffer<"u"){let y=Buffer.from(r.data).toString("utf8").replace(/\s/g,""),z=B(y);a(z,e.limits.maxStringLength,"decoded size","string_length"),a(z,e.limits.maxOutputSize,"output size","output_size");let w=Buffer.from(y,"base64");return a(w.length,e.limits.maxOutputSize,"output size","output_size"),{stdout:w.toString("latin1"),stderr:"",exitCode:0,stdoutEncoding:"binary"}}let f=k(r.data).replace(/\s/g,""),m=B(f);a(m,e.limits.maxStringLength,"decoded size","string_length"),a(m,e.limits.maxOutputSize,"output size","output_size");let b=atob(f);return a(b.length,e.limits.maxOutputSize,"output size","output_size"),{stdout:b,stderr:"",exitCode:0,stdoutEncoding:"binary"}}let s=await x(e,c,"base64");if(!s.ok)return s.error;let d=Math.ceil(s.data.length/3)*4,h=o>0&&d>0?Math.ceil(d/o):0;if(h>e.limits.maxArrayElements)throw new g(`base64: wrapped line limit exceeded (${e.limits.maxArrayElements})`,"array_elements");a(d,e.limits.maxStringLength,"encoded size","string_length"),a(d+h,e.limits.maxOutputSize,"output size","output_size");let n;if(typeof Buffer<"u"?n=Buffer.from(s.data).toString("base64"):n=btoa(k(s.data)),o>0){let r=[];for(let l=0;l<n.length;l+=o)r.push(n.slice(l,l+o));n=r.join(`
|
|
5
5
|
`)+(n.length>0?`
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
2
|
-
import{a as s,b as i}from"./chunk-
|
|
2
|
+
import{a as s,b as i}from"./chunk-A6SU3BZX.js";function a(t,e,n){if(!t||i.isInSandboxedContext())return;let r=`${e} ${n} attempted outside defense context`;throw new s(r,{timestamp:Date.now(),type:"missing_defense_context",message:r,path:"DefenseInDepthBox.context",stack:new Error().stack,executionId:i.getCurrentExecutionId()})}async function x(t,e,n,r){a(t,e,`${n} (pre-await)`);let o=await r();return a(t,e,`${n} (post-await)`),o}function d(t,e,n,r){let o=((...c)=>(a(t,e,n),r(...c)));return t?i.bindCurrentContext(o):o}export{a,x as b,d as c};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
2
|
-
import{
|
|
2
|
+
import{e as B}from"./chunk-ZUEPJPYA.js";import{l as y}from"./chunk-TVCZIH6M.js";import{a as C,d as I}from"./chunk-GN6CQ3J4.js";import{a as L}from"./chunk-QIQMJJZ4.js";import{a as v,b as E}from"./chunk-QAYAQNCG.js";var H={name:"column",summary:"columnate lists",usage:"column [OPTION]... [FILE]...",description:"Format input into multiple columns. By default, fills rows first. Use -t to create a table based on whitespace-delimited input.",options:["-t Create a table (determine columns from input)","-s SEP Input field delimiter (default: whitespace)","-o SEP Output field delimiter (default: two spaces)","-c WIDTH Output width for fill mode (default: 80)","-n Don't merge multiple adjacent delimiters"],examples:["ls | column # Fill columns with ls output","cat data | column -t # Format as table","column -t -s ',' file # Format CSV as table","column -c 40 file # Fill 40-char wide columns"]},M={table:{short:"t",long:"table",type:"boolean"},separator:{short:"s",type:"string"},outputSep:{short:"o",type:"string"},width:{short:"c",type:"number",default:80},noMerge:{short:"n",type:"boolean"}};function $(t,e,i,l){return e?i?t.split(e,l):t.split(e,l).filter(n=>n.length>0):i?t.split(/[ \t]/,l):t.split(/[ \t]+/,l).filter(n=>n.length>0)}function T(t){let e=[];for(let i of t)for(let l=0;l<i.length;l++){let n=i[l].length;(e[l]===void 0||n>e[l])&&(e[l]=n)}return e}function W(t,e,i){if(t.length===0)return"";let l=T(t),n=new B(i,"column",void 0,1);for(let c=0;c<t.length;c++){let r=t[c];c>0&&n.append(`
|
|
3
3
|
`);for(let o=0;o<r.length;o++)o>0&&n.append(e),n.append(r[o]),o<r.length-1&&n.repeat(" ",l[o]-r[o].length)}return n.build()}function z(t,e,i,l){if(t.length===0)return"";let n=0;for(let s of t)n=Math.max(n,s.length);let c=i.length,r=n+c,o=Math.max(1,Math.floor((e+c)/r)),b=Math.ceil(t.length/o),d=new B(l,"column",void 0,1);for(let s=0;s<b;s++){s>0&&d.append(`
|
|
4
4
|
`);let u=!1;for(let h=0;h<o;h++){let a=h*b+s;a<t.length&&(h===o-1||(h+1)*b+s>=t.length?(u&&d.append(i),d.append(t[a])):(u&&d.append(i),d.append(t[a]),d.repeat(" ",n-t[a].length)),u=!0)}}return d.build()}var R={name:"column",execute:async(t,e)=>{if(E(t))return v(H);let i=L("column",t,M);if(!i.ok)return i.error;let{table:l,separator:n,outputSep:c,width:r,noMerge:o}=i.result.flags,b=i.result.positional,d=c??" ",s=Math.min(e.limits.maxInputBytes,e.limits.maxStringLength),u=e.limits.maxArrayElements,h=Math.min(e.limits.maxStringLength,e.limits.maxOutputSize);if(!Number.isFinite(r)||!Number.isSafeInteger(r)||r<=0||r>10*1024*1024)return{exitCode:1,stdout:"",stderr:`column: invalid width: ${r}
|
|
5
5
|
`};let a;if(b.length===0)a=I(e.stdin)??"";else{let f=[],m=0;for(let g of b)if(g==="-"){let p=I(e.stdin)??"";if(m+=C(p),m>s)throw new y(`column: input size limit exceeded (${s} bytes)`,"string_length");f.push(p)}else{let p=e.fs.resolvePath(e.cwd,g),w=await e.fs.readFile(p);if(w===null)return{exitCode:1,stdout:"",stderr:`column: ${g}: No such file or directory
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
2
|
-
import{b as E}from"./chunk-
|
|
2
|
+
import{b as E}from"./chunk-A3C4Z3Q3.js";import{e as T}from"./chunk-ZUEPJPYA.js";import{l as m}from"./chunk-TVCZIH6M.js";import{a as u,d as I}from"./chunk-GN6CQ3J4.js";import{a as S}from"./chunk-QIQMJJZ4.js";import{a as B,b as F}from"./chunk-QAYAQNCG.js";var $={name:"paste",summary:"merge lines of files",usage:"paste [OPTION]... [FILE]...",description:["Write lines consisting of the sequentially corresponding lines from","each FILE, separated by TABs, to standard output.","","With no FILE, or when FILE is -, read standard input."],options:["-d, --delimiters=LIST reuse characters from LIST instead of TABs","-s, --serial paste one file at a time instead of in parallel"," --help display this help and exit"],examples:["paste file1 file2 Merge file1 and file2 side by side","paste -d, file1 file2 Use comma as delimiter","paste -s file1 Paste all lines of file1 on one line","paste - - < file Paste pairs of lines from file"]},C={delimiter:{short:"d",long:"delimiters",type:"string",default:" "},serial:{short:"s",long:"serial",type:"boolean"}},M={name:"paste",async execute(n,e){if(F(n))return B($);let l=S("paste",n,C);if(!l.ok)return l.error;let r=l.result.flags.delimiter,h=l.result.flags.serial,p=l.result.positional;if(p.length>e.limits.maxArrayElements)throw new m(`paste: file operand limit exceeded (${e.limits.maxArrayElements})`,"array_elements");if(u(r)>e.limits.maxStringLength)throw new m(`paste: delimiter size limit exceeded (${e.limits.maxStringLength} bytes)`,"string_length");if(p.length===0)return{stdout:"",stderr:`usage: paste [-s] [-d delimiters] file ...
|
|
3
3
|
`,exitCode:1};let g=I(e.stdin),o=g?g.split(`
|
|
4
4
|
`):[""];o.length>0&&o[o.length-1]===""&&o.pop();let A=p.filter(t=>t==="-").length,f=[],y=0,x=u(g),L=t=>{if(t.length>e.limits.maxArrayElements-y)throw new m(`paste: line limit exceeded (${e.limits.maxArrayElements})`,"array_elements");y+=t.length,e.executionScope?.consumeWork(t.length,"paste lines")},w=0;for(let t of p)if(t==="-"){let i=[];for(let s=w;s<o.length;s+=A)i.push(o[s]);L(i),f.push(i),w++}else{let i=e.fs.resolvePath(e.cwd,t);try{let s=await e.fs.readFile(i),d=u(s);if(d>e.limits.maxInputBytes-x)throw new m(`paste: aggregate input size limit exceeded (${e.limits.maxInputBytes} bytes)`,"string_length");x+=d,e.executionScope?.consumeInput(d,"paste");let a=s.split(`
|
|
5
5
|
`);a.length>0&&a[a.length-1]===""&&a.pop(),L(a),f.push(a)}catch(s){return E(s),{stdout:"",stderr:`paste: ${t}: No such file or directory
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
2
|
-
import{a as r}from"./chunk-
|
|
2
|
+
import{a as r}from"./chunk-O5BHWBYH.js";var g=2048,o=new Map;function u(l,c,t){let s=typeof t=="boolean"?{ignoreCase:t}:t??{},e=c;s.stripQuotes&&(e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"))&&(e=e.slice(1,-1));let i=s.ignoreCase?`i:${e}`:e,n=o.get(i);if(!n){if(n=a(e,s.ignoreCase),o.size>=g){let f=o.keys().next().value;f!==void 0&&o.delete(f)}o.set(i,n)}return n.test(l)}function a(l,c){let t="^";for(let s=0;s<l.length;s++){let e=l[s];if(e==="*")t+=".*";else if(e==="?")t+=".";else if(e==="["){let i=s+1;for(;i<l.length&&l[i]!=="]";)i++;t+=l.slice(s,i+1),s=i}else e==="."||e==="+"||e==="^"||e==="$"||e==="{"||e==="}"||e==="("||e===")"||e==="|"||e==="\\"?t+=`\\${e}`:t+=e}return t+="$",r(t,c?"i":"")}export{u as a};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
2
|
+
import{a as Te}from"./chunk-TDD4NFYE.js";import{a as Z}from"./chunk-6P2DITXT.js";import{a as Se}from"./chunk-SGX4WOAM.js";import{a as ce}from"./chunk-L2UW7DWF.js";import{a as oe}from"./chunk-O5BHWBYH.js";import{b as he,c as me,d as ye}from"./chunk-57LGFT4S.js";import{d as be}from"./chunk-CM4T4GB4.js";import{l as ae,m as le}from"./chunk-TVCZIH6M.js";import{a as ie}from"./chunk-GN6CQ3J4.js";import{a as ge,b as we}from"./chunk-QAYAQNCG.js";function R(e,t){switch(e.type){case"name":{let n=e.pattern,s=n.match(/^\*(\.[a-zA-Z0-9]+)$/);if(s){let a=s[1],l=t.name;if(e.ignoreCase){if(!l.toLowerCase().endsWith(a.toLowerCase()))return{matches:!1,pruned:!1,printed:!1}}else if(!l.endsWith(a))return{matches:!1,pruned:!1,printed:!1};return{matches:!0,pruned:!1,printed:!1}}return{matches:Z(t.name,n,e.ignoreCase),pruned:!1,printed:!1}}case"path":{let n=e.pattern,s=t.relativePath,a=n.split("/");for(let d=0;d<a.length-1;d++){let r=a[d];if(r&&r!=="."&&r!==".."&&!r.includes("*")&&!r.includes("?")&&!r.includes("[")){let i=`/${r}/`;if(e.ignoreCase){if(!s.toLowerCase().includes(i.toLowerCase()))return{matches:!1,pruned:!1,printed:!1}}else if(!s.includes(i))return{matches:!1,pruned:!1,printed:!1}}}let l=n.match(/\*(\.[a-zA-Z0-9]+)$/);if(l){let d=l[1];if(e.ignoreCase){if(!s.toLowerCase().endsWith(d.toLowerCase()))return{matches:!1,pruned:!1,printed:!1}}else if(!s.endsWith(d))return{matches:!1,pruned:!1,printed:!1}}return{matches:Z(s,n,e.ignoreCase),pruned:!1,printed:!1}}case"regex":try{let n=e.ignoreCase?"i":"";return{matches:oe(e.pattern,n).test(t.relativePath),pruned:!1,printed:!1}}catch{return{matches:!1,pruned:!1,printed:!1}}case"type":return e.fileType==="f"?{matches:t.isFile,pruned:!1,printed:!1}:e.fileType==="d"?{matches:t.isDirectory,pruned:!1,printed:!1}:{matches:!1,pruned:!1,printed:!1};case"empty":return{matches:t.isEmpty,pruned:!1,printed:!1};case"mtime":{let s=(Date.now()-t.mtime)/(1e3*60*60*24),a;return e.comparison==="more"?a=s>e.days:e.comparison==="less"?a=s<e.days:a=Math.floor(s)===e.days,{matches:a,pruned:!1,printed:!1}}case"newer":{let n=t.newerRefTimes.get(e.refPath);return n===void 0?{matches:!1,pruned:!1,printed:!1}:{matches:t.mtime>n,pruned:!1,printed:!1}}case"size":{let n=e.value;switch(e.unit){case"c":n=e.value;break;case"k":n=e.value*1024;break;case"M":n=e.value*1024*1024;break;case"G":n=e.value*1024*1024*1024;break;case"b":n=e.value*512;break}let s;return e.comparison==="more"?s=t.size>n:e.comparison==="less"?s=t.size<n:e.unit==="b"?s=Math.ceil(t.size/512)===e.value:s=t.size===n,{matches:s,pruned:!1,printed:!1}}case"perm":{let n=t.mode&511,s=e.mode&511,a;return e.matchType==="exact"?a=n===s:e.matchType==="all"?a=(n&s)===s:a=(n&s)!==0,{matches:a,pruned:!1,printed:!1}}case"prune":return{matches:!0,pruned:!0,printed:!1};case"action":return{matches:!0,pruned:!1,printed:!1,actions:[e.action]};case"not":{let n=R(e.expr,t);return{matches:!n.matches,pruned:n.pruned,printed:!1,actions:n.actions}}case"and":{let n=R(e.left,t);if(!n.matches)return{matches:!1,pruned:n.pruned,printed:!1,actions:n.actions};let s=R(e.right,t);return{matches:s.matches,pruned:n.pruned||s.pruned,printed:n.printed||s.printed,actions:[...n.actions??[],...s.actions??[]]}}case"or":{let n=R(e.left,t);if(n.matches)return n;let s=R(e.right,t);return{matches:s.matches,pruned:n.pruned||s.pruned,printed:s.printed,actions:[...n.actions??[],...s.actions??[]]}}}}function _(e){if(!e)return!1;switch(e.type){case"name":case"path":case"regex":case"type":case"prune":return!1;case"action":return!1;case"empty":case"mtime":case"newer":case"size":case"perm":return!0;case"not":return _(e.expr);case"and":case"or":return _(e.left)||_(e.right)}}function j(e){if(!e)return!1;switch(e.type){case"empty":return!0;case"not":return j(e.expr);case"and":case"or":return j(e.left)||j(e.right);default:return!1}}function Ce(e){let t=[],n=s=>{s&&(s.type==="newer"?t.push(s.refPath):s.type==="not"?n(s.expr):(s.type==="and"||s.type==="or")&&(n(s.left),n(s.right)))};return n(e),t}function J(e){if(!e)return!0;switch(e.type){case"name":case"path":case"regex":case"type":case"prune":return!0;case"action":return!1;case"empty":case"mtime":case"newer":case"size":case"perm":return!1;case"not":return J(e.expr);case"and":case"or":return J(e.left)&&J(e.right)}}function B(e,t,n,s,a){switch(e.type){case"name":{let l=e.pattern,d=l.match(/^\*(\.[a-zA-Z0-9]+)$/);if(d){let r=d[1];if(e.ignoreCase){if(!t.toLowerCase().endsWith(r.toLowerCase()))return{matches:!1,pruned:!1,printed:!1}}else if(!t.endsWith(r))return{matches:!1,pruned:!1,printed:!1};return{matches:!0,pruned:!1,printed:!1}}return{matches:Z(t,l,e.ignoreCase),pruned:!1,printed:!1}}case"path":{let l=e.pattern,d=l.split("/");for(let i=0;i<d.length-1;i++){let o=d[i];if(o&&o!=="."&&o!==".."&&!o.includes("*")&&!o.includes("?")&&!o.includes("[")){let u=`/${o}/`;if(e.ignoreCase){if(!n.toLowerCase().includes(u.toLowerCase()))return{matches:!1,pruned:!1,printed:!1}}else if(!n.includes(u))return{matches:!1,pruned:!1,printed:!1}}}let r=l.match(/\*(\.[a-zA-Z0-9]+)$/);if(r){let i=r[1];if(e.ignoreCase){if(!n.toLowerCase().endsWith(i.toLowerCase()))return{matches:!1,pruned:!1,printed:!1}}else if(!n.endsWith(i))return{matches:!1,pruned:!1,printed:!1}}return{matches:Z(n,l,e.ignoreCase),pruned:!1,printed:!1}}case"regex":try{let l=e.ignoreCase?"i":"";return{matches:oe(e.pattern,l).test(n),pruned:!1,printed:!1}}catch{return{matches:!1,pruned:!1,printed:!1}}case"type":return e.fileType==="f"?{matches:s,pruned:!1,printed:!1}:e.fileType==="d"?{matches:a,pruned:!1,printed:!1}:{matches:!1,pruned:!1,printed:!1};case"prune":return{matches:!0,pruned:!0,printed:!1};case"action":return{matches:!0,pruned:!1,printed:!1,actions:[e.action]};case"not":{let l=B(e.expr,t,n,s,a);return{matches:!l.matches,pruned:l.pruned,printed:!1,actions:l.actions}}case"and":{let l=B(e.left,t,n,s,a);if(!l.matches)return{matches:!1,pruned:l.pruned,printed:!1,actions:l.actions};let d=B(e.right,t,n,s,a);return{matches:d.matches,pruned:l.pruned||d.pruned,printed:l.printed||d.printed,actions:[...l.actions??[],...d.actions??[]]}}case"or":{let l=B(e.left,t,n,s,a);if(l.matches)return l;let d=B(e.right,t,n,s,a);return{matches:d.matches,pruned:l.pruned||d.pruned,printed:d.printed,actions:[...l.actions??[],...d.actions??[]]}}default:return{matches:!1,pruned:!1,printed:!1}}}function U(e){if(!e)return!1;switch(e.type){case"prune":return!0;case"not":return U(e.expr);case"and":case"or":return U(e.left)||U(e.right);default:return!1}}function L(e){switch(e.type){case"name":case"path":case"regex":case"type":case"prune":return!0;case"action":return!1;case"empty":case"mtime":case"newer":case"size":case"perm":return!1;case"not":return L(e.expr);case"and":case"or":return L(e.left)&&L(e.right)}}function Ee(e,t){if(!e||!t.isDirectory)return{shouldPrune:!1};if(!L(e))return fe(e,t);let n={name:t.name,relativePath:t.relativePath,isFile:t.isFile,isDirectory:t.isDirectory,isEmpty:!1,mtime:0,size:0,mode:0,newerRefTimes:new Map};return{shouldPrune:R(e,n).pruned}}function fe(e,t){switch(e.type){case"or":{if(L(e.left)){let n={name:t.name,relativePath:t.relativePath,isFile:t.isFile,isDirectory:t.isDirectory,isEmpty:!1,mtime:0,size:0,mode:0,newerRefTimes:new Map};if(R(e.left,n).pruned)return{shouldPrune:!0}}return fe(e.right,t)}case"and":{if(L(e.left)&&L(e.right)){let n={name:t.name,relativePath:t.relativePath,isFile:t.isFile,isDirectory:t.isDirectory,isEmpty:!1,mtime:0,size:0,mode:0,newerRefTimes:new Map};return{shouldPrune:R(e,n).pruned}}if(L(e.left)){let n={name:t.name,relativePath:t.relativePath,isFile:t.isFile,isDirectory:t.isDirectory,isEmpty:!1,mtime:0,size:0,mode:0,newerRefTimes:new Map};return R(e.left,n).matches?fe(e.right,t):{shouldPrune:!1}}return{shouldPrune:!1}}case"not":return{shouldPrune:!1};default:return{shouldPrune:!1}}}function ve(e,t){let n=[],s=t,a=r=>({expr:null,pathIndex:s,error:`find: missing argument to \`${r}'
|
|
3
|
+
`}),l=(r,i)=>({expr:null,pathIndex:s,error:`find: invalid argument \`${i}' to \`${r}'
|
|
4
|
+
`});for(;s<e.length;){let r=e[s];if(r==="("||r==="\\("){n.push({type:"lparen"}),s++;continue}if(r===")"||r==="\\)"){n.push({type:"rparen"}),s++;continue}if(r==="-name"){if(s+1>=e.length)return a(r);n.push({type:"expr",expr:{type:"name",pattern:e[++s]}})}else if(r==="-iname"){if(s+1>=e.length)return a(r);n.push({type:"expr",expr:{type:"name",pattern:e[++s],ignoreCase:!0}})}else if(r==="-path"){if(s+1>=e.length)return a(r);n.push({type:"expr",expr:{type:"path",pattern:e[++s]}})}else if(r==="-ipath"){if(s+1>=e.length)return a(r);n.push({type:"expr",expr:{type:"path",pattern:e[++s],ignoreCase:!0}})}else if(r==="-regex"){if(s+1>=e.length)return a(r);n.push({type:"expr",expr:{type:"regex",pattern:e[++s]}})}else if(r==="-iregex"){if(s+1>=e.length)return a(r);n.push({type:"expr",expr:{type:"regex",pattern:e[++s],ignoreCase:!0}})}else if(r==="-type"){if(s+1>=e.length)return a(r);let i=e[++s];if(i==="f"||i==="d")n.push({type:"expr",expr:{type:"type",fileType:i}});else return{expr:null,pathIndex:s,error:`find: Unknown argument to -type: ${i}
|
|
5
|
+
`}}else if(r==="-empty")n.push({type:"expr",expr:{type:"empty"}});else if(r==="-mtime"){if(s+1>=e.length)return a(r);let i=e[++s],o="exact",u=i;if(i.startsWith("+")?(o="more",u=i.slice(1)):i.startsWith("-")&&(o="less",u=i.slice(1)),!/^\d+$/.test(u))return l(r,i);let N=Number(u);if(!Number.isSafeInteger(N))return l(r,i);n.push({type:"expr",expr:{type:"mtime",days:N,comparison:o}})}else if(r==="-newer"){if(s+1>=e.length)return a(r);let i=e[++s];n.push({type:"expr",expr:{type:"newer",refPath:i}})}else if(r==="-size"){if(s+1>=e.length)return a(r);let i=e[++s],o="exact",u=i;i.startsWith("+")?(o="more",u=i.slice(1)):i.startsWith("-")&&(o="less",u=i.slice(1));let N=u.match(/^(\d+)([ckMGb])?$/);if(!N)return l(r,i);let F=Number(N[1]);if(!Number.isSafeInteger(F))return l(r,i);let P=N[2]||"b",V=P==="G"?1024**3:P==="M"?1024**2:P==="k"?1024:P==="b"?512:1;if(!Number.isSafeInteger(F*V))return l(r,i);n.push({type:"expr",expr:{type:"size",value:F,unit:P,comparison:o}})}else if(r==="-perm"){if(s+1>=e.length)return a(r);let i=e[++s],o="exact",u=i;if(i.startsWith("-")?(o="all",u=i.slice(1)):i.startsWith("/")&&(o="any",u=i.slice(1)),!/^[0-7]{1,4}$/.test(u))return l(r,i);let N=Number.parseInt(u,8);n.push({type:"expr",expr:{type:"perm",mode:N,matchType:o}})}else if(r==="-prune")n.push({type:"expr",expr:{type:"prune"}});else if(r==="-not"||r==="!")n.push({type:"not"});else if(r==="-o"||r==="-or")n.push({type:"op",op:"or"});else if(r==="-a"||r==="-and")n.push({type:"op",op:"and"});else if(r==="-maxdepth"||r==="-mindepth"){if(s+1>=e.length)return a(r);s++}else if(r!=="-depth")if(r==="-exec"){let i=[];for(s++;s<e.length&&e[s]!==";"&&e[s]!=="+";)i.push(e[s]),s++;if(s>=e.length)return{expr:null,pathIndex:s,error:"find: missing argument to `-exec'\n"};if(i.length===0)return a("-exec");let o=e[s]==="+";if(o&&(i.at(-1)!=="{}"||i.filter(u=>u==="{}").length!==1))return l("-exec","+");n.push({type:"expr",expr:{type:"action",action:{type:"exec",command:i,batchMode:o}}})}else if(r==="-print")n.push({type:"expr",expr:{type:"action",action:{type:"print"}}});else if(r==="-print0")n.push({type:"expr",expr:{type:"action",action:{type:"print0"}}});else if(r==="-printf"){if(s+1>=e.length)return a(r);let i=e[++s];n.push({type:"expr",expr:{type:"action",action:{type:"printf",format:i}}})}else if(r==="-delete")n.push({type:"expr",expr:{type:"action",action:{type:"delete"}}});else return r.startsWith("-")?{expr:null,pathIndex:s,error:`find: unknown predicate '${r}'
|
|
6
|
+
`}:{expr:null,pathIndex:s,error:`find: paths must precede expression: \`${r}'
|
|
7
|
+
`};s++}if(n.length===0)return{expr:null,pathIndex:s};let d=Re(n);return d.error?{expr:null,pathIndex:s,error:d.error}:{expr:d.expr,pathIndex:s}}function Re(e){let t=0,n;function s(){let i=a();if(!i)return null;for(;t<e.length;){let o=e[t];if(o.type==="op"&&o.op==="or"){t++;let u=a();if(!u)return n="find: expected an expression after `-o'\n",null;i={type:"or",left:i,right:u}}else break}return i}function a(){let i=l();if(!i)return null;for(;t<e.length;){let o=e[t];if(o.type==="op"&&o.op==="and"){t++;let u=l();if(!u)return n="find: expected an expression after `-a'\n",null;i={type:"and",left:i,right:u}}else if(o.type==="expr"||o.type==="not"||o.type==="lparen"){let u=l();if(!u)return i;i={type:"and",left:i,right:u}}else break}return i}function l(){if(t<e.length&&e[t].type==="not"){t++;let i=l();return i?{type:"not",expr:i}:(n="find: expected an expression after `!'\n",null)}return d()}function d(){if(t>=e.length)return null;let i=e[t];if(i.type==="lparen"){t++;let o=s();return!o||t>=e.length||e[t].type!=="rparen"?(n="find: missing closing `)'\n",null):(t++,o)}return i.type==="expr"?(t++,i.expr):(i.type==="rparen",null)}let r=s();return!n&&t<e.length&&(n=e[t].type==="rparen"?"find: unexpected `)'\n":`find: invalid expression
|
|
8
|
+
`),!n&&r&&ee(r)&&(n="find: refusing to evaluate `-delete' under negation\n"),{expr:n?null:r,error:n}}function ee(e,t=!1){return e.type==="action"?t&&e.action.type==="delete":e.type==="not"?ee(e.expr,!t):e.type==="and"||e.type==="or"?ee(e.left,t)||ee(e.right,t):!1}var De=500;function Fe(){return{readdirCalls:0,readdirTime:0,statCalls:0,statTime:0,evalCalls:0,evalTime:0,nodeCount:0,batchCount:0,batchTime:0,earlyPrunes:0}}function ze(e,t,n){e({category:"find",name:"summary",durationMs:n,details:{readdirCalls:t.readdirCalls,readdirTimeMs:t.readdirTime,statCalls:t.statCalls,statTimeMs:t.statTime,evalCalls:t.evalCalls,evalTimeMs:t.evalTime,nodeCount:t.nodeCount,batchCount:t.batchCount,batchTimeMs:t.batchTime,earlyPrunes:t.earlyPrunes,otherTimeMs:n-t.readdirTime-t.statTime-t.evalTime-t.batchTime}})}var Ae={name:"find",summary:"search for files in a directory hierarchy",usage:"find [path...] [expression]",options:["-name PATTERN file name matches shell pattern PATTERN","-iname PATTERN like -name but case insensitive","-path PATTERN file path matches shell pattern PATTERN","-ipath PATTERN like -path but case insensitive","-regex PATTERN file path matches regular expression PATTERN","-iregex PATTERN like -regex but case insensitive","-type TYPE file is of type: f (regular file), d (directory)","-empty file is empty or directory is empty","-mtime N file's data was modified N*24 hours ago","-newer FILE file was modified more recently than FILE","-size N[ckMGb] file uses N units of space (c=bytes, k=KB, M=MB, G=GB, b=512B blocks)","-perm MODE file's permission bits are exactly MODE (octal)","-perm -MODE all permission bits MODE are set","-perm /MODE any permission bits MODE are set","-maxdepth LEVELS descend at most LEVELS directories","-mindepth LEVELS do not apply tests at levels less than LEVELS","-depth process directory contents before directory itself","-prune do not descend into this directory","-not, ! negate the following expression","-a, -and logical AND (default)","-o, -or logical OR","-exec CMD {} ; execute CMD on each file ({} is replaced by filename)","-exec CMD {} + execute CMD with multiple files at once","-print print the full file name (default action)","-print0 print the full file name followed by a null character","-printf FORMAT print FORMAT with directives: %f %h %p %P %s %d %m %M %t","-delete delete found files/directories"," --help display this help and exit"]},st={name:"find",async execute(e,t){if(we(e))return ge(Ae);let n=[],s=null,a=null,l=!1,d=e.length;for(let c=0;c<e.length;c++){let f=e[c];if(f.startsWith("-")||f==="("||f==="\\("||f===")"||f==="\\)"||f==="!"){d=c;break}n.push(f)}n.length===0&&n.push(".");for(let c=d;c<e.length;c++){let f=e[c];if(f==="-exec")for(c++;c<e.length&&e[c]!==";"&&e[c]!=="+";)c++;else if(f==="-maxdepth"||f==="-mindepth"){let p=e[c+1];if(p===void 0||!/^\d+$/.test(p))return{stdout:"",stderr:p===void 0?`find: missing argument to \`${f}'
|
|
9
|
+
`:`find: invalid argument \`${p}' to \`${f}'
|
|
10
|
+
`,exitCode:1};let D=Number(p);if(!Number.isSafeInteger(D))return{stdout:"",stderr:`find: invalid argument \`${p}' to \`${f}'
|
|
11
|
+
`,exitCode:1};f==="-maxdepth"?s=D:a=D,c++}else f==="-depth"&&(l=!0)}let{expr:r,error:i}=ve(e,d);if(i)return{stdout:"",stderr:i,exitCode:1};let o=te(r),u=o.length>0;o.some(c=>c.type==="delete")&&(l=!0);let N=[],F=0,P=t.executionScope?new Se(t.executionScope,"find"):void 0,V=[],ue=[],Q=0,O=new be({limits:t.limits,signal:t.signal,executionScope:t.executionScope,site:"find"}),G=c=>{if(P)P.append("stdout",c);else{let f=ie(c);if(f>t.limits.maxOutputSize-Q)throw new ae(`find: output size limit exceeded (${t.limits.maxOutputSize} bytes)`,"output_size");c&&V.push(c),Q+=f}},q=c=>{if(P)P.append("stderr",c);else{let f=ie(c);if(f>t.limits.maxOutputSize-Q)throw new ae(`find: output size limit exceeded (${t.limits.maxOutputSize} bytes)`,"output_size");c&&ue.push(c),Q+=f}},Me=Ce(r),ne=new Map;for(let c of Me){let f=t.fs.resolvePath(t.cwd,c);try{let p=await t.fs.stat(f);ne.set(c,p.mtime?.getTime()??Date.now())}catch{}}let Pe=o.some(c=>{if(c.type!=="printf")return!1;let f=c.format.replace(/%%/g,"");return/%[-+]?[0-9]*\.?[0-9]*(s|m|M|t|T)/.test(f)}),xe=_(r)||Pe,$e=j(r),pe=U(r),Ie=J(r),ke=typeof t.fs.readdirWithFileTypes=="function";for(let c of n){let z=function(h){let y={path:h.relativePath,name:h.name,size:h.stat?.size??0,mtime:h.stat?.mtime?.getTime()??Date.now(),mode:h.stat?.mode??420,isDirectory:h.isDirectory,depth:h.depth,startingPoint:c},C=h.unreadable===void 0?[]:[{action:{type:"diagnostic",message:`find: ${h.relativePath}: ${h.unreadable}
|
|
12
|
+
`},path:h.relativePath,printfData:y}],k=w=>l?[...C,...w]:[...w,...C];if(!(a===null||h.depth>=a))return C;let g=!0,m=[];if(r!==null){let w=Date.now(),S;if(Ie)S=B(r,h.name,h.relativePath,h.isFile,h.isDirectory);else{let b={name:h.name,relativePath:h.relativePath,isFile:h.isFile,isDirectory:h.isDirectory,isEmpty:h.isEmpty,mtime:h.stat?.mtime?.getTime()??Date.now(),size:h.stat?.size??0,mode:h.stat?.mode??420,newerRefTimes:ne};S=R(r,b)}g=S.matches,m=S.actions??[],p.evalCalls++,p.evalTime+=Date.now()-w}if(!u&&g&&(m=[{type:"print"}]),m.length===0)return C;O.checkpoint(m.length);let T=[];for(let w of m)T.push({action:w,path:h.relativePath,printfData:y});return k(T)};var Ge=z;c.length>1&&c.endsWith("/")&&(c=c.slice(0,-1));let f=t.fs.resolvePath(t.cwd,c);try{await t.fs.stat(f)}catch{q(`find: ${c}: No such file or directory
|
|
13
|
+
`),F=1;continue}let p=Fe(),D=Date.now();async function x(h){let{path:y,depth:C,typeInfo:k}=h;if(O.visit(C),p.nodeCount++,C>(s??t.limits.maxTraversalDepth))return null;let $,g,m;if(k&&!xe)$=k.isFile,g=k.isDirectory;else{try{let W=Date.now();m=await t.fs.lstat(y),p.statCalls++,p.statTime+=Date.now()-W}catch{return null}if(!m)return null;$=m.isFile,g=m.isDirectory}let T;y===f?T=c.split("/").pop()||c:T=y.split("/").pop()||"";let w=y===f?c:c==="."?`./${y.slice(f==="/"?f.length:f.length+1)}`:c+y.slice(f.length),S=[],b=null,E=null,I=!1;g&&pe&&!l&&(I=Ee(r,{name:T,relativePath:w,isFile:$,isDirectory:g}).shouldPrune,I&&p.earlyPrunes++);let H=!(C>=(s??t.limits.maxTraversalDepth))&&!I,K=(H||$e)&&!I,X;if(g&&K){let W=Date.now();try{ke&&t.fs.readdirWithFileTypes?b=await t.fs.readdirWithFileTypes(y):E=await t.fs.readdir(y)}catch(M){let A=Be(M);if(A===null)throw M;X=A,p.readdirCalls++,p.readdirTime+=Date.now()-W}if(b!==null){O.checkpoint(),O.discover(b.length),E=[];for(let M of b)E.push(M.name);if(p.readdirCalls++,p.readdirTime+=Date.now()-W,H)for(let M=0;M<b.length;M++){let A=b[M];S.push({path:y==="/"?`/${A.name}`:`${y}/${A.name}`,depth:C+1,typeInfo:{isFile:A.isFile,isDirectory:A.isDirectory},resultIndex:M})}}else if(E!==null&&(O.checkpoint(),O.discover(E.length),p.readdirCalls++,p.readdirTime+=Date.now()-W,H))for(let M=0;M<E.length;M++){let A=E[M];S.push({path:y==="/"?`/${A}`:`${y}/${A}`,depth:C+1,resultIndex:M})}}let Y=$?(m?.size??0)===0:E!==null&&E.length===0,re=I;if(!l&&r!==null&&!I&&pe){let W=Date.now(),M={name:T,relativePath:w,isFile:$,isDirectory:g,isEmpty:Y,mtime:m?.mtime?.getTime()??Date.now(),size:m?.size??0,mode:m?.mode??420,newerRefTimes:ne};re=R(r,M).pruned,p.evalCalls++,p.evalTime+=Date.now()-W}return{relativePath:w,name:T,isFile:$,isDirectory:g,isEmpty:Y,stat:m,depth:C,children:re?[]:S,pruned:re,unreadable:X}}async function Ne(){let h={effects:[]};if(l){let y=[],C=[{item:{path:f,depth:0,resultIndex:0},parentIndex:-1,childOrderInParent:0}],k=new Map,$=0;for(;$<C.length;){let g=Date.now(),m=Math.min(C.length,$+De),T=C.slice($,m);$=m;let w=await Promise.all(T.map(S=>x(S.item).catch(b=>{if(b instanceof le)return null;throw b})));p.batchCount++,p.batchTime+=Date.now()-g;for(let S=0;S<T.length;S++){let b=w[S],E=T[S];if(!b)continue;let I=y.length;if(E.parentIndex>=0){let v=k.get(E.parentIndex)||[];v.push(I),k.set(E.parentIndex,v)}y.push({node:b,parentIndex:E.parentIndex,childIndices:[]});for(let v=0;v<b.children.length;v++)C.push({item:b.children[v],parentIndex:I,childOrderInParent:v})}}for(let[g,m]of k)g>=0&&g<y.length&&(y[g].childIndices=m);if(y.length>0){let g=[{index:0,visited:!1}];for(;g.length>0;){O.checkpoint();let m=g.pop();if(!m)break;let T=y[m.index];if(T){if(m.visited){for(let w of z(T.node))h.effects.push(w);continue}g.push({index:m.index,visited:!0});for(let w=T.childIndices.length-1;w>=0;w--)g.push({index:T.childIndices[w],visited:!1})}}}}else{let y=new Map,C=0,k=[{item:{path:f,depth:0,resultIndex:0},orderIndex:C++}],$=new Map,g=0;for(;g<k.length;){let T=Date.now(),w=Math.min(k.length,g+De),S=k.slice(g,w);g=w;let b=await Promise.all(S.map(async({item:E,orderIndex:I})=>{try{let v=await x(E);return v?{node:v,orderIndex:I}:null}catch(v){if(v instanceof le)return null;throw v}}));p.batchCount++,p.batchTime+=Date.now()-T;for(let E of b){if(!E)continue;let{node:I,orderIndex:v}=E,H=z(I);if(H.length>0&&y.set(v,H),I.children.length>0){let K=[];for(let X of I.children){let Y=C++;K.push(Y),k.push({item:X,orderIndex:Y})}$.set(v,K)}}}let m=[0];for(;m.length>0;){O.checkpoint();let T=m.pop();if(T===void 0)break;let w=y.get(T);if(w)for(let b of w)h.effects.push(b);let S=$.get(T);if(S)for(let b=S.length-1;b>=0;b--)m.push(S[b])}}return h}let de=await Ne();for(let h of de.effects)N.push(h);if(t.trace){let h=Date.now()-D;ze(t.trace,p,h),t.trace({category:"find",name:"searchPath",durationMs:h,details:{path:c,resultsFound:de.effects.filter(y=>y.action.type!=="diagnostic").length}})}}let se=new Map;for(let c of N){let{action:f,path:p}=c;switch(f.type){case"diagnostic":q(f.message),F=1;break;case"print":G(`${p}
|
|
14
|
+
`);break;case"print0":G(`${p}\0`);break;case"printf":G(Oe(f.format,c.printfData));break;case"delete":{let D=t.fs.resolvePath(t.cwd,p);try{await t.fs.rm(D,{recursive:!1})}catch(x){let z=x instanceof Error?x.message:String(x);q(`find: cannot delete '${p}': ${z}
|
|
15
|
+
`),F=1}break}case"exec":{if(!t.exec)return{stdout:"",stderr:`find: -exec not supported in this context
|
|
16
|
+
`,exitCode:1};if(f.batchMode){let z=se.get(f)??[];z.push(p),se.set(f,z);break}let D=f.command.map(z=>z==="{}"?p:z),x=await t.exec(ce([D[0]]),{cwd:t.cwd,signal:t.signal,args:D.slice(1)});P?P.appendResult(x):(G(x.stdout),q(x.stderr)),x.exitCode!==0&&(F=x.exitCode);break}}}for(let[c,f]of se){if(c.type!=="exec"||!t.exec||f.length===0)continue;let p=[];for(let x of c.command)x==="{}"?p.push(...f):p.push(x);let D=await t.exec(ce([p[0]]),{cwd:t.cwd,signal:t.signal,args:p.slice(1)});P?P.appendResult(D):(G(D.stdout),q(D.stderr)),D.exitCode!==0&&(F=D.exitCode)}return P?.build(F)??{stdout:V.join(""),stderr:ue.join(""),exitCode:F}}};function te(e){return e?e.type==="action"?[e.action]:e.type==="not"?te(e.expr):e.type==="and"||e.type==="or"?[...te(e.left),...te(e.right)]:[]:[]}function Oe(e,t){let n=ye(e),s="",a=0;for(;a<n.length;)if(n[a]==="%"&&a+1<n.length){if(a++,n[a]==="%"){s+="%",a++;continue}let[l,d,r]=me(n,a);if(a+=r,a>=n.length){s+="%";break}let i=n[a],o;switch(i){case"f":o=t.name,a++;break;case"h":{let u=t.path.lastIndexOf("/");o=u>0?t.path.slice(0,u):".",a++;break}case"p":o=t.path,a++;break;case"P":{let u=t.startingPoint;t.path===u?o="":t.path.startsWith(`${u}/`)?o=t.path.slice(u.length+1):u==="."&&t.path.startsWith("./")?o=t.path.slice(2):o=t.path,a++;break}case"s":o=String(t.size),a++;break;case"d":o=String(t.depth),a++;break;case"m":o=(t.mode&511).toString(8),a++;break;case"M":o=Te(t.mode,t.isDirectory),a++;break;case"t":{let u=new Date(t.mtime);o=We(u),a++;break}case"T":{if(a+1<n.length){let u=n[a+1],N=new Date(t.mtime);o=He(N,u),a+=2}else o="%T",a++;break}default:s+=`%${l!==0||d!==-1?`${l}.${d}`:""}${i}`,a++;continue}s+=he(o,l,d)}else s+=n[a],a++;return s}function We(e){let t=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],n=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],s=t[e.getDay()],a=n[e.getMonth()],l=String(e.getDate()).padStart(2," "),d=String(e.getHours()).padStart(2,"0"),r=String(e.getMinutes()).padStart(2,"0"),i=String(e.getSeconds()).padStart(2,"0"),o=e.getFullYear();return`${s} ${a} ${l} ${d}:${r}:${i} ${o}`}var Le=new Map([["EACCES","Permission denied"],["EIO","Input/output error"],["ELOOP","Too many levels of symbolic links"],["ENAMETOOLONG","File name too long"],["ENOENT","No such file or directory"],["ENOTDIR","Not a directory"],["EPERM","Permission denied"]]);function Be(e){let t=typeof e=="object"&&e!==null&&"code"in e&&typeof e.code=="string"?e.code:e instanceof Error?/^(E[A-Z]+)\b/.exec(e.message)?.[1]:void 0;return t===void 0?null:Le.get(t)??null}function He(e,t){switch(t){case"@":return String(e.getTime()/1e3);case"Y":return String(e.getFullYear());case"m":return String(e.getMonth()+1).padStart(2,"0");case"d":return String(e.getDate()).padStart(2,"0");case"H":return String(e.getHours()).padStart(2,"0");case"M":return String(e.getMinutes()).padStart(2,"0");case"S":return String(e.getSeconds()).padStart(2,"0");case"T":return`${String(e.getHours()).padStart(2,"0")}:${String(e.getMinutes()).padStart(2,"0")}:${String(e.getSeconds()).padStart(2,"0")}`;case"F":return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`;default:return`%T${t}`}}var rt={name:"find",flags:[{flag:"-name",type:"value",valueHint:"pattern"},{flag:"-iname",type:"value",valueHint:"pattern"},{flag:"-type",type:"value",valueHint:"string"},{flag:"-maxdepth",type:"value",valueHint:"number"},{flag:"-mindepth",type:"value",valueHint:"number"},{flag:"-empty",type:"boolean"},{flag:"-print",type:"boolean"},{flag:"-print0",type:"boolean"}],needsFiles:!0};export{st as a,rt as b};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
2
|
-
import{b as O,c as N,d as T,e as k}from"./chunk-CM4T4GB4.js";import{f as P}from"./chunk-BMBITA6Y.js";import{l as $,m as C}from"./chunk-TVCZIH6M.js";import{c as p}from"./chunk-T5ZEIOJ3.js";import{a as
|
|
2
|
+
import{b as O,c as N,d as T,e as k}from"./chunk-CM4T4GB4.js";import{f as P}from"./chunk-BMBITA6Y.js";import{l as $,m as C}from"./chunk-TVCZIH6M.js";import{c as p}from"./chunk-T5ZEIOJ3.js";import{a as D}from"./chunk-W5DWRFSU.js";import{a as F}from"./chunk-QIQMJJZ4.js";import{a as E,b as S}from"./chunk-QAYAQNCG.js";var H={name:"mv",summary:"move (rename) files",usage:"mv [OPTION]... SOURCE... DEST",options:["-f, --force do not prompt before overwriting","-n, --no-clobber do not overwrite an existing file","-v, --verbose explain what is being done"," --help display this help and exit"]},I={force:{short:"f",long:"force",type:"boolean"},noClobber:{short:"n",long:"no-clobber",type:"boolean"},verbose:{short:"v",long:"verbose",type:"boolean"}},j={name:"mv",async execute(v,e){if(S(v))return E(H);let i=F("mv",v,I);if(!i.ok)return i.error;let g=i.result.flags.force,u=i.result.flags.noClobber,A=i.result.flags.verbose,d=i.result.positional;if(u&&(g=!1),d.length<2)return{stdout:"",stderr:`mv: missing destination file operand
|
|
3
3
|
`,exitCode:1};let a=d.pop()??"",h=d,f=e.fs.resolvePath(e.cwd,a),b="",s="",l=0,y=new T({limits:e.limits,signal:e.signal,executionScope:e.executionScope,site:"mv"}),m=!1;try{m=(await e.fs.stat(f)).isDirectory}catch{}if(h.length>1&&!m)return{stdout:"",stderr:`mv: target '${a}' is not a directory
|
|
4
4
|
`,exitCode:1};for(let t of h)try{let o=e.fs.resolvePath(e.cwd,t),c=await e.fs.stat(o),n=f;if(m){let r=t.split("/").pop()||t;n=f==="/"?`/${r}`:`${f}/${r}`}if(c.isDirectory){let r=await N(e.fs,o,n,y);if(P(o,n)||r==="inside"){s+=`mv: cannot move '${t}' into itself, '${n}'
|
|
5
5
|
`,l=1;continue}if(r==="unknown"){s+=`mv: cannot safely determine whether '${n}' is inside '${t}'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
2
|
-
import{a as k}from"./chunk-6RK4AAB7.js";import{b as v}from"./chunk-
|
|
2
|
+
import{a as k}from"./chunk-6RK4AAB7.js";import{b as v}from"./chunk-A3C4Z3Q3.js";import{a as y,b,e as S}from"./chunk-ZUEPJPYA.js";import{l as h}from"./chunk-TVCZIH6M.js";import{a as w,d as $}from"./chunk-GN6CQ3J4.js";import{c as L}from"./chunk-NCUTH6QL.js";var g=class extends S{constructor(t){super(t,"xan")}};var C=L(k(),1);var V=class{ctx;site;rows=0;cells=0;constructor(t,i){this.ctx=t,this.site=i}consumeWork(t=1){this.ctx.executionScope?.consumeWork(t,this.site)}addRow(t){this.addRows(1,t)}addRows(t,i){let r=b(t,i,this.site);if(!Number.isSafeInteger(t)||t<0||!Number.isSafeInteger(i)||i<0||i>this.ctx.limits.maxArrayElements||t>Math.min(this.ctx.limits.maxCsvRows,this.ctx.limits.maxArrayElements)-this.rows||r>this.ctx.limits.maxCsvCells-this.cells)throw new h(`${this.site}: derived CSV result limit exceeded`,"array_elements");this.consumeWork(b(t,y(1,i,this.site),this.site)),this.rows+=t,this.cells+=r}};function I(){return Object.create(null)}function j(n,t,i){n[t]=i}function W(n){let t=I();for(let i of Object.keys(n)){let r=n[i];(typeof r=="string"||typeof r=="number"||typeof r=="boolean"||r===null)&&(t[i]=r)}return t}function z(n,t={}){let i=t.maxStringLength??10485760,r=t.maxArrayElements??1e5,a=t.maxRows??r,f=t.maxCells??1e7;if(w(n)>i)throw new h(`xan: CSV input size limit exceeded (${i} bytes)`,"string_length");let d=[],m=n.trim(),o=C.default.parse(m,{preview:1,skipEmptyLines:!0}).data[0]??[];if(o.length>r)throw new h(`xan: CSV column limit exceeded (${r})`,"array_elements");let p=0,s;if(C.default.parse(m,{header:!0,dynamicTyping:!0,skipEmptyLines:!0,step:(e,l)=>{let u=Object.keys(e.data);if(d.length===0&&e.meta.fields){if(e.meta.fields.length>r){s=new h(`xan: CSV column limit exceeded (${r})`,"array_elements"),l.abort();return}o=[...e.meta.fields]}if(d.length>=a||u.length>f-p){s=new h(d.length>=a?`xan: CSV row limit exceeded (${a})`:`xan: CSV cell limit exceeded (${f})`,"array_elements"),l.abort();return}p+=u.length,d.push(W(e.data))}}),s)throw s;return{headers:o,data:d}}function H(n,t={}){let i=t.maxStringLength??10485760,r=t.maxArrayElements??1e5,a=t.maxRows??r,f=t.maxCells??1e7;if(w(n)>i)throw new h(`xan: CSV input size limit exceeded (${i} bytes)`,"string_length");let d=[],m=0,c;if(C.default.parse(n.trim(),{header:!1,dynamicTyping:!1,skipEmptyLines:!0,step:(o,p)=>{let s=o.data;if(d.length>=a||s.length>r||s.length>f-m){c=new h(d.length>=a?`xan: CSV row limit exceeded (${a})`:s.length>r?`xan: CSV column limit exceeded (${r})`:`xan: CSV cell limit exceeded (${f})`,"array_elements"),p.abort();return}m+=s.length,d.push(s)}}),c)throw c;return d}function P(n,t,i){return E(t.length,n.length,(r,a)=>t[r][n[a]],i,n)}function q(n,t,i){return E(t.length,n.length,(r,a)=>t[r][n[a]],i)}function G(n,t,i){return E(n.length,void 0,(r,a)=>n[r][a],t,i,r=>n[r].length)}function E(n,t,i,r,a,f=()=>t??0){let d=r?.limits.maxOutputSize??Number.MAX_SAFE_INTEGER,m=new S(d,"xan CSV output",r?()=>new h(`xan: output size limit exceeded (${d} bytes)`,"output_size"):void 0),c=p=>{let s=p==null?"":String(p),e=0;for(let x=0;x<s.length;x++)s.charCodeAt(x)===34&&e++;let l=e>0||s.includes("\r")||s.includes(`
|
|
3
3
|
`)||s.includes(",")||s.includes("\uFEFF")||s.startsWith(" ")||s.endsWith(" ");m.reserve(y(w(s),y(e,l?2:0,"xan CSV output"),"xan CSV output"));let u=e>0?s.replace(/"/g,'""'):s;m.append(l?`"${u}"`:u)},o=(p,s)=>{for(let e=0;e<s;e++)e>0&&m.append(","),c(i(p,e));m.append(`
|
|
4
4
|
`)};if(a){for(let p=0;p<a.length;p++)p>0&&m.append(","),c(a[p]);m.append(`
|
|
5
5
|
`)}for(let p=0;p<n;p++)r?.executionScope?.throwIfAborted("xan CSV output"),o(p,t??f(p));return m.build()}async function R(n,t){let i=n.find(d=>!d.startsWith("-")),r;if(!i||i==="-")r=$(t.stdin);else try{let d=t.fs.resolvePath(t.cwd,i);r=await t.fs.readFile(d)}catch(d){return v(d),{headers:[],data:[],error:{stdout:"",stderr:`xan: ${i}: No such file or directory
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
2
|
-
import{a as u,b as O,
|
|
2
|
+
import{a as u,b as O,d as W}from"./chunk-ZUEPJPYA.js";import{l as g}from"./chunk-TVCZIH6M.js";import{a as y}from"./chunk-GN6CQ3J4.js";var k={name:"seq",async execute(r,p){let m=`
|
|
3
3
|
`,x=!1,i=[],e=0;for(;e<r.length;){let t=r[e];if(t==="-s"&&e+1<r.length){m=r[e+1],e+=2;continue}if(t==="-w"){x=!0,e++;continue}if(t==="--"){e++;break}if(t.startsWith("-")&&t!=="-"){if(t.startsWith("-s")&&t.length>2){m=t.slice(2),e++;continue}if((t==="-ws"||t==="-sw")&&(x=!0,e+1<r.length)){m=r[e+1],e+=2;continue}}i.push(t),e++}for(;e<r.length;)i.push(r[e]),e++;if(i.length===0)return{stdout:"",stderr:`seq: missing operand
|
|
4
4
|
`,exitCode:1};let d=1,a=1,l;if(i.length===1?l=parseFloat(i[0]):i.length===2?(d=parseFloat(i[0]),l=parseFloat(i[1])):(d=parseFloat(i[0]),a=parseFloat(i[1]),l=parseFloat(i[2])),!Number.isFinite(d)||!Number.isFinite(a)||!Number.isFinite(l))return{stdout:"",stderr:`seq: invalid floating point argument: '${i.find(o=>!Number.isFinite(parseFloat(o)))}'
|
|
5
5
|
`,exitCode:1};if(a===0)return{stdout:"",stderr:`seq: invalid Zero increment value: '0'
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
2
|
-
import{a as t}from"./chunk-
|
|
2
|
+
import{a as t}from"./chunk-A6SU3BZX.js";import{l as n,m as r,n as i}from"./chunk-TVCZIH6M.js";function e(o){return o instanceof n||o instanceof r||o instanceof t||o instanceof i}function E(o){if(e(o))throw o}export{e as a,E as b};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
2
|
+
import*as M from"node:async_hooks";import*as $ from"node:module";var v;function T(){return v||w(),v}function w(){let a=[{prop:"Function",target:globalThis,violationType:"function_constructor",strategy:"throw",reason:"Function constructor allows arbitrary code execution"},{prop:"eval",target:globalThis,violationType:"eval",strategy:"throw",reason:"eval() allows arbitrary code execution"},{prop:"setTimeout",target:globalThis,violationType:"setTimeout",strategy:"throw",reason:"setTimeout with string argument allows code execution"},{prop:"setInterval",target:globalThis,violationType:"setInterval",strategy:"throw",reason:"setInterval with string argument allows code execution"},{prop:"setImmediate",target:globalThis,violationType:"setImmediate",strategy:"throw",reason:"setImmediate could be used to escape sandbox context"},{prop:"env",target:process,violationType:"process_env",strategy:"throw",reason:"process.env could leak sensitive environment variables",allowedKeys:new Set(["NODE_V8_COVERAGE","NODE_DEBUG","NODE_DEBUG_NATIVE","NODE_COMPILE_CACHE","NODE_ENV","WATCH_REPORT_DEPENDENCIES","FORCE_COLOR","DEBUG","UNDICI_NO_FG","JEST_WORKER_ID","__MINIMATCH_TESTING_PLATFORM__","LOG_TOKENS","LOG_STREAM"])},{prop:"binding",target:process,violationType:"process_binding",strategy:"throw",reason:"process.binding provides access to native Node.js modules"},{prop:"_linkedBinding",target:process,violationType:"process_binding",strategy:"throw",reason:"process._linkedBinding provides access to native Node.js modules"},{prop:"dlopen",target:process,violationType:"process_dlopen",strategy:"throw",reason:"process.dlopen allows loading native addons"},{prop:"getBuiltinModule",target:process,violationType:"process_get_builtin_module",strategy:"throw",reason:"process.getBuiltinModule allows loading native Node.js modules (fs, child_process, vm)"},{prop:"exit",target:process,violationType:"process_exit",strategy:"throw",reason:"process.exit could terminate the interpreter"},{prop:"abort",target:process,violationType:"process_exit",strategy:"throw",reason:"process.abort could crash the interpreter"},{prop:"kill",target:process,violationType:"process_kill",strategy:"throw",reason:"process.kill could signal other processes"},{prop:"setuid",target:process,violationType:"process_setuid",strategy:"throw",reason:"process.setuid could escalate privileges"},{prop:"setgid",target:process,violationType:"process_setuid",strategy:"throw",reason:"process.setgid could escalate privileges"},{prop:"seteuid",target:process,violationType:"process_setuid",strategy:"throw",reason:"process.seteuid could escalate effective user privileges"},{prop:"setegid",target:process,violationType:"process_setuid",strategy:"throw",reason:"process.setegid could escalate effective group privileges"},{prop:"initgroups",target:process,violationType:"process_setuid",strategy:"throw",reason:"process.initgroups could modify supplementary group IDs"},{prop:"setgroups",target:process,violationType:"process_setuid",strategy:"throw",reason:"process.setgroups could modify supplementary group IDs"},{prop:"umask",target:process,violationType:"process_umask",strategy:"throw",reason:"process.umask could modify file creation permissions"},{prop:"argv",target:process,violationType:"process_argv",strategy:"throw",reason:"process.argv may contain secrets in CLI arguments"},{prop:"cwd",target:process,violationType:"process_chdir",strategy:"throw",reason:"process.cwd could disclose real host working directory path"},{prop:"chdir",target:process,violationType:"process_chdir",strategy:"throw",reason:"process.chdir could confuse the interpreter's CWD tracking"},{prop:"report",target:process,violationType:"process_report",strategy:"throw",reason:"process.report could disclose full environment, host paths, and system info"},{prop:"loadEnvFile",target:process,violationType:"process_env",strategy:"throw",reason:"process.loadEnvFile could load env files bypassing env proxy"},{prop:"setUncaughtExceptionCaptureCallback",target:process,violationType:"process_exception_handler",strategy:"throw",reason:"setUncaughtExceptionCaptureCallback could intercept security errors"},...["on","once","addListener","prependListener","prependOnceListener"].map(t=>({prop:t,target:process,violationType:"process_exception_handler",strategy:"throw",reason:"process-global listeners can outlive the sandbox and lose its security context"})),{prop:"send",target:process,violationType:"process_send",strategy:"throw",reason:"process.send could communicate with parent process in IPC contexts"},{prop:"channel",target:process,violationType:"process_channel",strategy:"throw",reason:"process.channel could access IPC channel to parent process"},{prop:"cpuUsage",target:process,violationType:"process_timing",strategy:"throw",reason:"process.cpuUsage could enable timing side-channel attacks"},{prop:"memoryUsage",target:process,violationType:"process_timing",strategy:"throw",reason:"process.memoryUsage could enable timing side-channel attacks"},{prop:"hrtime",target:process,violationType:"process_timing",strategy:"throw",reason:"process.hrtime could enable timing side-channel attacks"},{prop:"WeakRef",target:globalThis,violationType:"weak_ref",strategy:"throw",reason:"WeakRef could be used to leak references outside sandbox"},{prop:"FinalizationRegistry",target:globalThis,violationType:"finalization_registry",strategy:"throw",reason:"FinalizationRegistry could be used to leak references outside sandbox"},{prop:"Reflect",target:globalThis,violationType:"reflect",strategy:"freeze",reason:"Reflect provides introspection capabilities"},{prop:"Proxy",target:globalThis,violationType:"proxy",strategy:"throw",reason:"Proxy allows intercepting and modifying object behavior"},{prop:"WebAssembly",target:globalThis,violationType:"webassembly",strategy:"throw",reason:"WebAssembly allows executing arbitrary compiled code"},{prop:"SharedArrayBuffer",target:globalThis,violationType:"shared_array_buffer",strategy:"throw",reason:"SharedArrayBuffer could enable side-channel communication or timing attacks"},{prop:"Atomics",target:globalThis,violationType:"atomics",strategy:"throw",reason:"Atomics could enable side-channel communication or timing attacks"},{prop:"performance",target:globalThis,violationType:"performance_timing",strategy:"throw",reason:"performance.now() provides sub-millisecond timing for side-channel attacks"},{prop:"stdout",target:process,violationType:"process_stdout",strategy:"throw",reason:"process.stdout could bypass interpreter output to write to host stdout"},{prop:"stderr",target:process,violationType:"process_stderr",strategy:"throw",reason:"process.stderr could bypass interpreter output to write to host stderr"},{prop:"__defineGetter__",target:Object.prototype,violationType:"prototype_mutation",strategy:"throw",reason:"__defineGetter__ allows prototype pollution via getter injection"},{prop:"__defineSetter__",target:Object.prototype,violationType:"prototype_mutation",strategy:"throw",reason:"__defineSetter__ allows prototype pollution via setter injection"},{prop:"__lookupGetter__",target:Object.prototype,violationType:"prototype_mutation",strategy:"throw",reason:"__lookupGetter__ enables introspection for prototype pollution attacks"},{prop:"__lookupSetter__",target:Object.prototype,violationType:"prototype_mutation",strategy:"throw",reason:"__lookupSetter__ enables introspection for prototype pollution attacks"},{prop:"JSON",target:globalThis,violationType:"json_mutation",strategy:"freeze",reason:"Freeze JSON to prevent mutation of parsing/serialization"},{prop:"Math",target:globalThis,violationType:"math_mutation",strategy:"freeze",reason:"Freeze Math to prevent mutation of math utilities"}];try{let t=Object.getPrototypeOf(async()=>{}).constructor;t&&t!==Function&&a.push({prop:"constructor",target:Object.getPrototypeOf(async()=>{}),violationType:"async_function_constructor",strategy:"throw",reason:"AsyncFunction constructor allows arbitrary async code execution"})}catch{}try{let t=Object.getPrototypeOf(function*(){}).constructor;t&&t!==Function&&a.push({prop:"constructor",target:Object.getPrototypeOf(function*(){}),violationType:"generator_function_constructor",strategy:"throw",reason:"GeneratorFunction constructor allows arbitrary generator code execution"})}catch{}try{let t=Object.getPrototypeOf(async function*(){}).constructor;t&&t!==Function&&t!==Object.getPrototypeOf(async()=>{}).constructor&&a.push({prop:"constructor",target:Object.getPrototypeOf(async function*(){}),violationType:"async_generator_function_constructor",strategy:"throw",reason:"AsyncGeneratorFunction constructor allows arbitrary async generator code execution"})}catch{}let e=a.filter(t=>{try{return t.target[t.prop]!==void 0}catch{return!1}});return v??=new Set(e.map(({violationType:t})=>t)),e}var j=performance.timeOrigin,V=performance.now.bind(performance);function k(){return Math.floor(j+V())}var E=new Set(["function_constructor","async_function_constructor","generator_function_constructor","async_generator_function_constructor"]);function D(a){let e=a?.find(t=>E.has(t));if(e)throw new RangeError(`defenseInDepth.excludeViolationTypes cannot disable the non-excludable "${e}" protection`)}var R=`
|
|
3
|
+
|
|
4
|
+
This is a defense-in-depth measure and indicates a bug in just-bash. Please report this at security@vercel.com`;function O(a,e,t){let i=t&&!E.has(e)?`
|
|
5
|
+
|
|
6
|
+
If this access is required by trusted host-runtime code, add "${e}" to defenseInDepth.excludeViolationTypes.`:"";return a+R+i}var f=typeof __BROWSER__<"u"&&__BROWSER__;function S(){return typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,a=>{let e=Math.random()*16|0;return(a==="x"?e:e&3|8).toString(16)})}var P=null,m=null,A=null;if(!f)try{P=M.AsyncLocalStorage,m=$,A=m.Module??m.default??null}catch{}var d=class extends Error{violation;constructor(e,t){super(O(e,t.type,t.type==="error_prepare_stack_trace"||T().has(t.type))),this.violation=t,this.name="SecurityViolationError"}},p=!f&&P?new P:null,L=1e3;function G(a,e,...t){return p.run(a,()=>e(...t))}var N={enabled:!0,auditMode:!1,processLifetimeIntrinsicHardening:!1};function I(){return!f&&typeof m?.registerHooks=="function"}function C(a){let e=typeof a=="boolean"?{enabled:a}:a??{};if(D(e.excludeViolationTypes),e.enabled!==void 0&&e.enabled!==!0&&e.enabled!==!1&&e.enabled!=="auto")throw new RangeError('defenseInDepth.enabled must be true, false, or "auto"');let t={...N,...e},i=t.enabled==="auto"?"auto":t.enabled?"enabled":"disabled",r={...t,enabled:i!=="disabled",requested:i};return r.excludeViolationTypes&&(r.excludeViolationTypes=[...new Set(r.excludeViolationTypes)].sort()),r}function H(a,e){if(a.enabled!==e.enabled||a.auditMode!==e.auditMode||a.processLifetimeIntrinsicHardening!==e.processLifetimeIntrinsicHardening||a.onViolation!==e.onViolation)return!1;let t=a.excludeViolationTypes??[],i=e.excludeViolationTypes??[];return t.length===i.length&&t.every((r,o)=>r===i[o])}var B=class a{static instance=null;static importHooksRegistered=!1;static trustedExecutionDepth=new Map;config;refCount=0;patchFailures=[];activeExecutionIds=new Set;contextCache=new Map;originalDescriptors=[];temporaryIntrinsicDescriptors=[];violations=[];activationTime=0;totalActiveTimeMs=0;constructor(e){this.config=e}static getInstance(e){let t=C(e);if(!a.instance)a.instance=new a(t);else{let i=a.instance.config;if(!H(t,i))throw new Error("DefenseInDepthBox config conflict: all resolved defense options, including exclusions and the violation callback, must match across Bash instances. Call DefenseInDepthBox.resetInstance() between incompatible configurations.")}return a.instance}static resetInstance(){a.instance&&(a.instance.forceDeactivate(),a.instance=null),a.trustedExecutionDepth.clear()}static isInSandboxedContext(){return p?p?.getStore()?.sandboxActive===!0:!1}static getCurrentExecutionId(){if(p)return p?.getStore()?.executionId}static enterTrustedScope(e){let t=a.trustedExecutionDepth.get(e)??0;a.trustedExecutionDepth.set(e,t+1)}static leaveTrustedScope(e){let t=a.trustedExecutionDepth.get(e);if(t){if(t===1){a.trustedExecutionDepth.delete(e);return}a.trustedExecutionDepth.set(e,t-1)}}static isTrustedScopeActive(e){return e?(a.trustedExecutionDepth.get(e)??0)>0:!1}static isTrustedContext(e){return!e||e.forceUntrusted?!1:e.trusted===!0||a.isTrustedScopeActive(e.executionId)}isExecutionIdActive(e){return this.activeExecutionIds.has(e)}getCachedContext(e){let t=this.contextCache.get(e);return t||(t={sandboxActive:!0,executionId:e},this.contextCache.set(e,t)),t}static bindCurrentContext(e){if(!p)return e;let t=p.getStore(),i=t?.sandboxActive===!0?t.executionId:void 0;if(!i)return e;let o=a.instance?.getCachedContext(i)??{sandboxActive:!0,executionId:i},n=t?.forceUntrusted?{...o,forceUntrusted:!0}:o;return((...s)=>{let c=a.instance;if(!(c&&!c.isExecutionIdActive(i)&&(c.recordViolation("bound_callback_after_deactivate","bound callback","Bound callback blocked after originating execution was deactivated"),!c.config.auditMode)))return G(n,e,...s)})}isEnabled(){return this.getStatus().state==="enabled"}getStatus(){let e=I();return this.config.requested==="disabled"?{requested:"disabled",state:"disabled",level:"none",contextualDynamicImportProtection:e,processLifetimeIntrinsicHardening:this.config.processLifetimeIntrinsicHardening===!0,intrinsicProtection:this.config.processLifetimeIntrinsicHardening?"process-lifetime":"scoped-best-effort"}:!p||f?{requested:this.config.requested,state:"unsupported",level:"none",contextualDynamicImportProtection:!1,processLifetimeIntrinsicHardening:this.config.processLifetimeIntrinsicHardening===!0,intrinsicProtection:this.config.processLifetimeIntrinsicHardening?"process-lifetime":"scoped-best-effort",reason:"context-aware ESM loader hooks (node:module.registerHooks) are unavailable"}:{requested:this.config.requested,state:"enabled",level:this.config.auditMode?"none":e?"full":"best-effort",contextualDynamicImportProtection:e,processLifetimeIntrinsicHardening:this.config.processLifetimeIntrinsicHardening===!0,intrinsicProtection:this.config.processLifetimeIntrinsicHardening?"process-lifetime":"scoped-best-effort",reason:this.config.auditMode?"audit mode records violations but does not block them":e?void 0:"best-effort protection; context-aware ESM loader hooks are unavailable"}}updateConfig(e){if(this.refCount>0)throw new Error("DefenseInDepthBox configuration cannot change while protection is active");this.config=C({...this.config,...e})}activate(){if(!f&&this.config.enabled&&!p)throw new Error("DefenseInDepthBox: enabled protection requires node:async_hooks and node:module");if(f||!this.config.enabled){let i=S(),r=!1;return{run:o=>r?Promise.reject(new Error("DefenseInDepthBox handle is deactivated and cannot run new work")):o(),deactivate:()=>{r=!0},executionId:i}}if(this.refCount++,this.refCount===1){try{this.applyPatches()}catch(i){throw this.restorePatches(),this.activeExecutionIds.clear(),this.contextCache.clear(),this.refCount=0,i}this.activationTime=Date.now()}let e=S(),t=!1;return{run:i=>t?Promise.reject(new Error("DefenseInDepthBox handle is deactivated and cannot run new work")):(this.activeExecutionIds.add(e),p.run({sandboxActive:!0,executionId:e},i)),deactivate:()=>{t||(t=!0,this.activeExecutionIds.delete(e),this.contextCache.delete(e),a.trustedExecutionDepth.delete(e),this.refCount--,this.refCount===0&&(this.restorePatches(),this.totalActiveTimeMs+=Date.now()-this.activationTime),this.refCount<0&&(this.refCount=0))},executionId:e}}forceDeactivate(){this.refCount>0&&(this.restorePatches(),this.totalActiveTimeMs+=Date.now()-this.activationTime),this.activeExecutionIds.clear(),this.contextCache.clear(),this.refCount=0}isActive(){return this.refCount>0}getStats(){return{violationsBlocked:this.violations.length,violations:[...this.violations],activeTimeMs:this.totalActiveTimeMs+(this.refCount>0?Date.now()-this.activationTime:0),refCount:this.refCount}}getPatchFailures(){return[...this.patchFailures]}clearViolations(){this.violations=[]}getPathForTarget(e,t){return e===globalThis?`globalThis.${t}`:e===process?`process.${t}`:e===Error?`Error.${t}`:e===Function.prototype?`Function.prototype.${t}`:e===Object.prototype?`Object.prototype.${t}`:`<object>.${t}`}static runTrusted(e){if(!p)return e();let t=p.getStore();if(!t)return e();let{executionId:i}=t;return p.run({...t,trusted:!0,forceUntrusted:!1},()=>{a.enterTrustedScope(i);try{let r=e();return typeof r=="object"&&r!==null&&"finally"in r&&typeof r.finally=="function"?r.finally(()=>{a.leaveTrustedScope(i)}):(a.leaveTrustedScope(i),r)}catch(r){throw a.leaveTrustedScope(i),r}})}static async runTrustedAsync(e){if(!p)return e();let t=p.getStore();if(!t)return e();let{executionId:i}=t;return await p.run({...t,trusted:!0,forceUntrusted:!1},async()=>{a.enterTrustedScope(i);try{return await e()}finally{a.leaveTrustedScope(i)}})}static async runUntrustedAsync(e){if(!p)return e();let t=p.getStore();return t?p.run({...t,trusted:!1,forceUntrusted:!0},e):e()}shouldBlock(){if(f||this.config.auditMode||!p)return!1;let e=p?.getStore();return!(e?.sandboxActive!==!0||a.isTrustedContext(e))}shouldAudit(){if(!this.config.auditMode||!p)return!1;let e=p.getStore();return e?.sandboxActive===!0&&!a.isTrustedContext(e)}recordViolation(e,t,i){let r={timestamp:k(),type:e,message:i,path:t,stack:new Error().stack,executionId:p?.getStore()?.executionId};if(this.violations.length<L&&this.violations.push(r),this.config.onViolation)try{this.config.onViolation(r)}catch(o){console.debug("[DefenseInDepthBox] onViolation callback threw:",o instanceof Error?o.message:o)}return r}createBlockingProxy(e,t,i){let r=this;return new Proxy(e,{apply(o,n,s){if(r.shouldBlock()){let c=`${t} is blocked during script execution`,l=r.recordViolation(i,t,c);throw new d(c,l)}return r.shouldAudit()&&r.recordViolation(i,t,`${t} called (audit mode)`),Reflect.apply(o,n,s)},construct(o,n,s){if(r.shouldBlock()){let c=`${t} constructor is blocked during script execution`,l=r.recordViolation(i,t,c);throw new d(c,l)}return r.shouldAudit()&&r.recordViolation(i,t,`${t} constructor called (audit mode)`),Reflect.construct(o,n,s)}})}createBlockingObjectProxy(e,t,i,r){let o=this;return new Proxy(e,{get(n,s,c){if(o.shouldBlock()){if(r&&typeof s=="string"&&r.has(s))return Reflect.get(n,s,c);let l=`${t}.${String(s)}`,u=`${l} is blocked during script execution`,h=o.recordViolation(i,l,u);throw new d(u,h)}if(o.shouldAudit()){let l=`${t}.${String(s)}`;o.recordViolation(i,l,`${l} accessed (audit mode)`)}return Reflect.get(n,s,c)},set(n,s,c,l){if(o.shouldBlock()){let u=`${t}.${String(s)}`,h=`${u} modification is blocked during script execution`,y=o.recordViolation(i,u,h);throw new d(h,y)}return t==="process.env"&&s==="DEBUG"?Reflect.set(n,s,c):Reflect.set(n,s,c,l)},ownKeys(n){if(o.shouldBlock()){let s=`${t} enumeration is blocked during script execution`,c=o.recordViolation(i,t,s);throw new d(s,c)}return Reflect.ownKeys(n)},getOwnPropertyDescriptor(n,s){if(o.shouldBlock()){let c=`${t}.${String(s)}`,l=`${c} descriptor access is blocked during script execution`,u=o.recordViolation(i,c,l);throw new d(l,u)}return Reflect.getOwnPropertyDescriptor(n,s)},has(n,s){if(o.shouldBlock()){let c=`${t}.${String(s)}`,l=`${c} existence check is blocked during script execution`,u=o.recordViolation(i,c,l);throw new d(l,u)}return Reflect.has(n,s)},deleteProperty(n,s){if(o.shouldBlock()){let c=`${t}.${String(s)}`,l=`${c} deletion is blocked during script execution`,u=o.recordViolation(i,c,l);throw new d(l,u)}return Reflect.deleteProperty(n,s)},setPrototypeOf(n,s){if(o.shouldBlock()){let c=`${t} setPrototypeOf is blocked during script execution`,l=o.recordViolation(i,t,c);throw new d(c,l)}return Reflect.setPrototypeOf(n,s)},defineProperty(n,s,c){if(o.shouldBlock()){let l=`${t}.${String(s)}`,u=`${l} defineProperty is blocked during script execution`,h=o.recordViolation(i,l,u);throw new d(u,h)}return Reflect.defineProperty(n,s,c)}})}createReadonlyObjectProxy(e,t,i){let r=this,o=n=>{let s=`${t} ${n} is blocked during script execution`,c=r.recordViolation(i,t,s);throw new d(s,c)};return new Proxy(e,{set(n,s,c,l){return r.shouldBlock()&&o("modification"),Reflect.set(n,s,c,l)},defineProperty(n,s,c){return r.shouldBlock()&&o("defineProperty"),Reflect.defineProperty(n,s,c)},deleteProperty(n,s){return r.shouldBlock()&&o("deletion"),Reflect.deleteProperty(n,s)},setPrototypeOf(n,s){return r.shouldBlock()&&o("setPrototypeOf"),Reflect.setPrototypeOf(n,s)},preventExtensions(n){return r.shouldBlock()&&o("preventExtensions"),Reflect.preventExtensions(n)}})}applyPatches(){this.patchFailures=[];let e=w(),t=new Set(this.config.excludeViolationTypes??[]),i=new Set(["process_send","process_channel","process_stdout","process_stderr"]),r=[];for(let s of e)if(!t.has(s.violationType)&&!i.has(s.violationType)){if(s.strategy==="freeze"){r.push(s);continue}this.applyPatch(s)}this.protectConstructorChain(),t.has("error_prepare_stack_trace")||this.protectErrorPrepareStackTrace(),this.protectPromiseThen(),I()&&this.protectDynamicImport(),this.protectModuleLoad(),this.protectModuleResolveFilename(),this.protectProcessMainModule(),this.protectProcessExecPath(),this.protectProxyRevocable();let o=["Function.prototype.constructor","Module._load","Module._resolveFilename"],n=this.patchFailures.filter(s=>o.includes(s));if(n.length>0)throw this.restorePatches(),new Error(`DefenseInDepthBox: critical patches failed: ${n.join(", ")}`);this.config.processLifetimeIntrinsicHardening||this.protectReversibleIntrinsics(r);for(let s of r)this.applyPatch(s,this.config.processLifetimeIntrinsicHardening===!0);this.config.processLifetimeIntrinsicHardening&&this.lockWellKnownSymbols()}protectReversibleIntrinsics(e){let t=new Set,i=(n,s)=>{let c=Object.getOwnPropertyDescriptor(n,s);!c||!("value"in c)||c.writable!==!0||c.configurable!==!0||(this.temporaryIntrinsicDescriptors.push({target:n,prop:s,descriptor:c}),Object.defineProperty(n,s,{...c,writable:!1}))};for(let{target:n,prop:s}of e){let c=n[s];if(!(typeof c!="object"||c===null)){t.add(c);for(let l of Reflect.ownKeys(c))i(c,l)}}let r=[];for(let n of[Array,Map,Set,RegExp,Promise])r.push([n,Symbol.species]);for(let n of[Array.prototype,String.prototype,Map.prototype,Set.prototype])r.push([n,Symbol.iterator]);r.push([Symbol.prototype,Symbol.toPrimitive],[Date.prototype,Symbol.toPrimitive],[Function.prototype,Symbol.hasInstance],[Array.prototype,Symbol.unscopables]);for(let n of[Symbol.match,Symbol.matchAll,Symbol.replace,Symbol.search,Symbol.split])r.push([RegExp.prototype,n]);for(let n of[Map.prototype,Set.prototype,Promise.prototype,ArrayBuffer.prototype])r.push([n,Symbol.toStringTag]);for(let[n,s]of r)t.add(n),i(n,s);let o=(n,s,c)=>{let l=Object.getOwnPropertyDescriptor(n,s);if(!l||!("value"in l)||typeof l.value!="function"||l.configurable!==!0)return;let u=l.value,h=this,y=function(...b){let g=b[0];if(h.shouldBlock()&&typeof g=="object"&&g!==null&&t.has(g)){let x=`${c}.${s}`,_=`${x} is blocked for protected intrinsics during script execution`,F=h.recordViolation("prototype_mutation",x,_);throw new d(_,F)}return Reflect.apply(u,this,b)};this.temporaryIntrinsicDescriptors.push({target:n,prop:s,descriptor:l}),Object.defineProperty(n,s,{...l,value:y,writable:!1})};for(let n of["assign","defineProperties","defineProperty","freeze","preventExtensions","seal","setPrototypeOf"])o(Object,n,"Object");for(let n of["defineProperty","deleteProperty","preventExtensions","set","setPrototypeOf"])o(Reflect,n,"Reflect")}protectConstructorChain(){this.patchPrototypeConstructor(Function.prototype,"Function.prototype.constructor","function_constructor");try{let e=Object.getPrototypeOf(async()=>{}).constructor;e&&e!==Function&&this.patchPrototypeConstructor(e.prototype,"AsyncFunction.prototype.constructor","async_function_constructor")}catch(e){this.patchFailures.push("AsyncFunction.prototype.constructor"),console.debug("[DefenseInDepthBox] Could not patch AsyncFunction.prototype.constructor:",e instanceof Error?e.message:e)}try{let e=Object.getPrototypeOf(function*(){}).constructor;e&&e!==Function&&this.patchPrototypeConstructor(e.prototype,"GeneratorFunction.prototype.constructor","generator_function_constructor")}catch(e){this.patchFailures.push("GeneratorFunction.prototype.constructor"),console.debug("[DefenseInDepthBox] Could not patch GeneratorFunction.prototype.constructor:",e instanceof Error?e.message:e)}try{let e=Object.getPrototypeOf(async function*(){}).constructor,t=Object.getPrototypeOf(async()=>{}).constructor;e&&e!==Function&&e!==t&&this.patchPrototypeConstructor(e.prototype,"AsyncGeneratorFunction.prototype.constructor","async_generator_function_constructor")}catch(e){this.patchFailures.push("AsyncGeneratorFunction.prototype.constructor"),console.debug("[DefenseInDepthBox] Could not patch AsyncGeneratorFunction.prototype.constructor:",e instanceof Error?e.message:e)}}protectErrorPrepareStackTrace(){let e=this;try{let t=Object.getOwnPropertyDescriptor(Error,"prepareStackTrace");this.originalDescriptors.push({target:Error,prop:"prepareStackTrace",descriptor:t});let i=t?.value;Object.defineProperty(Error,"prepareStackTrace",{get(){return i},set(r){if(e.shouldBlock()){let o="Error.prepareStackTrace modification is blocked during script execution",n=e.recordViolation("error_prepare_stack_trace","Error.prepareStackTrace",o);throw new d(o,n)}e.shouldAudit()&&e.recordViolation("error_prepare_stack_trace","Error.prepareStackTrace","Error.prepareStackTrace set (audit mode)"),i=r},configurable:!0})}catch(t){this.patchFailures.push("Error.prepareStackTrace"),console.debug("[DefenseInDepthBox] Could not protect Error.prepareStackTrace:",t instanceof Error?t.message:t)}}protectPromiseThen(){let e=this;try{let o=function(...n){return p.run(this.captured,()=>{if(!this.box.isExecutionIdActive(this.executionId)){if(this.box.recordViolation("promise_then_after_deactivate","Promise.then","Promise.then callback is blocked after defense deactivation"),this.box.config.auditMode)return Reflect.apply(this.cb,void 0,n);if(this.kind==="fulfilled")return n[0];throw n[0]}return Reflect.apply(this.cb,void 0,n)})};var t=o;let i=Object.getOwnPropertyDescriptor(Promise.prototype,"then");this.originalDescriptors.push({target:Promise.prototype,prop:"then",descriptor:i});let r=i?.value;if(typeof r!="function")return;Object.defineProperty(Promise.prototype,"then",{value:function(s,c){if(!p)return Reflect.apply(r,this,[s,c]);let l=p.getStore(),u=l?.sandboxActive===!0&&l.trusted!==!0?l.executionId:void 0;if(!u)return Reflect.apply(r,this,[s,c]);let h=e.getCachedContext(u),y=l?.forceUntrusted?{...h,forceUntrusted:!0}:h,b=(g,x)=>typeof g!="function"?g:o.bind({box:e,executionId:u,captured:y,cb:g,kind:x});return Reflect.apply(r,this,[b(s,"fulfilled"),b(c,"rejected")])},writable:!0,configurable:!0})}catch(i){this.patchFailures.push("Promise.prototype.then"),console.debug("[DefenseInDepthBox] Could not protect Promise.prototype.then:",i instanceof Error?i.message:i)}}patchPrototypeConstructor(e,t,i){let r=this;try{let o=Object.getOwnPropertyDescriptor(e,"constructor");this.originalDescriptors.push({target:e,prop:"constructor",descriptor:o});let n=o?.value;Object.defineProperty(e,"constructor",{get(){if(r.shouldBlock()){let s=`${t} access is blocked during script execution`,c=r.recordViolation(i,t,s);throw new d(s,c)}return r.shouldAudit()&&r.recordViolation(i,t,`${t} accessed (audit mode)`),n},set(s){if(r.shouldBlock()){let c=`${t} modification is blocked during script execution`,l=r.recordViolation(i,t,c);throw new d(c,l)}Object.defineProperty(this,"constructor",{value:s,writable:!0,configurable:!0})},configurable:!0})}catch(o){this.patchFailures.push(t),console.debug(`[DefenseInDepthBox] Could not patch ${t}:`,o instanceof Error?o.message:o)}}protectProcessMainModule(){if(typeof process>"u")return;let e=this;try{let t=Object.getOwnPropertyDescriptor(process,"mainModule");this.originalDescriptors.push({target:process,prop:"mainModule",descriptor:t});let i=t?.value;i!==void 0&&Object.defineProperty(process,"mainModule",{get(){if(e.shouldBlock()){let r="process.mainModule access is blocked during script execution",o=e.recordViolation("process_main_module","process.mainModule",r);throw new d(r,o)}return e.shouldAudit()&&e.recordViolation("process_main_module","process.mainModule","process.mainModule accessed (audit mode)"),i},set(r){if(e.shouldBlock()){let o="process.mainModule modification is blocked during script execution",n=e.recordViolation("process_main_module","process.mainModule",o);throw new d(o,n)}Object.defineProperty(process,"mainModule",{value:r,writable:!0,configurable:!0})},configurable:!0})}catch(t){this.patchFailures.push("process.mainModule"),console.debug("[DefenseInDepthBox] Could not protect process.mainModule:",t instanceof Error?t.message:t)}}protectProcessExecPath(){if(typeof process>"u")return;let e=this;try{let t=Object.getOwnPropertyDescriptor(process,"execPath");this.originalDescriptors.push({target:process,prop:"execPath",descriptor:t});let i=t?.value??process.execPath;Object.defineProperty(process,"execPath",{get(){if(e.shouldBlock()){let r="process.execPath access is blocked during script execution",o=e.recordViolation("process_exec_path","process.execPath",r);throw new d(r,o)}return e.shouldAudit()&&e.recordViolation("process_exec_path","process.execPath","process.execPath accessed (audit mode)"),i},set(r){if(e.shouldBlock()){let o="process.execPath modification is blocked during script execution",n=e.recordViolation("process_exec_path","process.execPath",o);throw new d(o,n)}Object.defineProperty(process,"execPath",{value:r,writable:!0,configurable:!0})},configurable:!0})}catch(t){this.patchFailures.push("process.execPath"),console.debug("[DefenseInDepthBox] Could not protect process.execPath:",t instanceof Error?t.message:t)}}lockWellKnownSymbols(){let e=(t,i)=>{try{let r=Object.getOwnPropertyDescriptor(t,i);if(r?.configurable){if("value"in r){Object.defineProperty(t,i,{...r,configurable:!1,writable:!1});return}Object.defineProperty(t,i,{...r,configurable:!1})}}catch{}};for(let t of[Array,Map,Set,RegExp,Promise])e(t,Symbol.species);for(let t of[Array.prototype,String.prototype,Map.prototype,Set.prototype])e(t,Symbol.iterator);e(Symbol.prototype,Symbol.toPrimitive),e(Date.prototype,Symbol.toPrimitive);for(let t of[Symbol.match,Symbol.matchAll,Symbol.replace,Symbol.search,Symbol.split])e(RegExp.prototype,t);e(Function.prototype,Symbol.hasInstance),e(Array.prototype,Symbol.unscopables);for(let t of[Map.prototype,Set.prototype,Promise.prototype,ArrayBuffer.prototype])e(t,Symbol.toStringTag)}protectProxyRevocable(){let e=this;try{let t=Proxy.revocable;if(typeof t!="function")return;let i=Object.getOwnPropertyDescriptor(Proxy,"revocable");this.originalDescriptors.push({target:Proxy,prop:"revocable",descriptor:i}),Object.defineProperty(Proxy,"revocable",{value:function(o,n){if(e.shouldBlock()){let s="Proxy.revocable is blocked during script execution",c=e.recordViolation("proxy","Proxy.revocable",s);throw new d(s,c)}return e.shouldAudit()&&e.recordViolation("proxy","Proxy.revocable","Proxy.revocable called (audit mode)"),t(o,n)},writable:!1,configurable:!0})}catch(t){this.patchFailures.push("Proxy.revocable"),console.debug("[DefenseInDepthBox] Could not protect Proxy.revocable:",t instanceof Error?t.message:t)}}protectDynamicImport(){if(!(f||a.importHooksRegistered))try{let e=m;if(!e)throw new Error("node:module is unavailable");let t=new Set;for(let o of e.builtinModules??[]){let n=o.startsWith("node:")?o.slice(5):o;t.add(n);let s=n.indexOf("/");s>0&&t.add(n.slice(0,s))}let i=o=>{if(o.startsWith("./")||o.startsWith("../")||o.startsWith("/")||o.startsWith("file:")||o.startsWith("data:")||o.startsWith("blob:")||o.startsWith("http:")||o.startsWith("https:"))return!1;let n=o.startsWith("node:")?o.slice(5):o;if(!n)return!1;if(typeof e.isBuiltin=="function"&&e.isBuiltin(n)||t.has(n))return!0;let s=n.indexOf("/");return s>0&&t.has(n.slice(0,s))},r=o=>{let n=p?.getStore();return o.config.auditMode===!0&&n?.sandboxActive===!0&&!a.isTrustedContext(n)};if(typeof e.registerHooks=="function"){e.registerHooks({resolve(o,n,s){let c=a.instance;if(!c)return s(o,n);if((o.startsWith("data:")||o.startsWith("blob:"))&&c.shouldBlock()){let l=`import(${o.startsWith("data:")?"data:":"blob:"})`,u=`dynamic import of ${o.startsWith("data:")?"data:":"blob:"} URLs is blocked by defense-in-depth`,h=c.recordViolation("dynamic_import_builtin",l,u);throw new d(u,h)}if(i(o)){let l=`import(${o})`,u=`dynamic import of Node.js builtin '${o}' is blocked during script execution`;if(c.shouldBlock()){let h=c.recordViolation("dynamic_import_builtin",l,u);throw new d(u,h)}r(c)&&c.recordViolation("dynamic_import_builtin",l,`dynamic import of Node.js builtin '${o}' called (audit mode)`)}return s(o,n)}}),a.importHooksRegistered=!0;return}throw new Error("context-aware ESM loader hooks (node:module.registerHooks) are unavailable")}catch(e){throw new Error(`DefenseInDepthBox: could not register dynamic-import hooks: ${e instanceof Error?e.message:String(e)}`,{cause:e})}}protectModuleLoad(){this.protectModuleMethod("_load","module_load")}protectModuleResolveFilename(){this.protectModuleMethod("_resolveFilename","module_resolve_filename")}protectModuleMethod(e,t){if(f)return;let i=`Module.${e}`;try{let r=A,o=r?.[e];if(!r||typeof o!="function")throw new Error("node:module Module class or method is unavailable");let n=Object.getOwnPropertyDescriptor(r,e);if(!n)throw new Error("method has no own property descriptor");if(n.configurable===!1&&n.writable===!1)throw new Error("method is non-configurable and non-writable");let s=this.createBlockingProxy(o,i,t);this.originalDescriptors.push({target:r,prop:e,descriptor:n}),Object.defineProperty(r,e,{...n,value:s});let c=Object.getOwnPropertyDescriptor(r,e);if(r[e]!==s||c?.value!==s)throw new Error("installed patch failed verification")}catch{this.patchFailures.push(i)}}applyPatch(e,t=!1){let{target:i,prop:r,violationType:o,strategy:n}=e;try{let s=i[r];if(s===void 0)return;let c=Object.getOwnPropertyDescriptor(i,r);if(this.originalDescriptors.push({target:i,prop:r,descriptor:c}),n==="freeze"){if(typeof s=="object"&&s!==null){t&&Object.freeze(s);let l=this.getPathForTarget(i,r),u=this.createReadonlyObjectProxy(s,l,o);Object.defineProperty(i,r,{...c,value:u})}}else{let l=this.getPathForTarget(i,r),u=typeof s=="function"?this.createBlockingProxy(s,l,o):this.createBlockingObjectProxy(s,l,o,e.allowedKeys);Object.defineProperty(i,r,{value:u,writable:!0,configurable:!0})}}catch(s){let c=this.getPathForTarget(i,r);this.patchFailures.push(c),console.debug(`[DefenseInDepthBox] Could not patch ${c}:`,s instanceof Error?s.message:s)}}restorePatches(){for(let e=this.temporaryIntrinsicDescriptors.length-1;e>=0;e--){let{target:t,prop:i,descriptor:r}=this.temporaryIntrinsicDescriptors[e];try{Object.defineProperty(t,i,r)}catch(o){console.debug(`[DefenseInDepthBox] Could not restore temporary intrinsic ${String(i)}:`,o instanceof Error?o.message:o)}}this.temporaryIntrinsicDescriptors=[];for(let e=this.originalDescriptors.length-1;e>=0;e--){let{target:t,prop:i,descriptor:r}=this.originalDescriptors[e];try{r?Object.defineProperty(t,i,r):delete t[i]}catch(o){let n=this.getPathForTarget(t,i);console.debug(`[DefenseInDepthBox] Could not restore ${n}:`,o instanceof Error?o.message:o)}}this.originalDescriptors=[]}};export{d as a,B as b};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
2
|
-
import{b as E}from"./chunk-
|
|
2
|
+
import{b as E}from"./chunk-A3C4Z3Q3.js";import{a as h}from"./chunk-CM4T4GB4.js";import{l as $}from"./chunk-TVCZIH6M.js";import{a as k}from"./chunk-GN6CQ3J4.js";import{a as C,b as L,c as F}from"./chunk-QAYAQNCG.js";var A={name:"split",summary:"split a file into pieces",usage:"split [OPTION]... [FILE [PREFIX]]",description:"Output pieces of FILE to PREFIXaa, PREFIXab, ...; default size is 1000 lines, and default PREFIX is 'x'.",options:["-l N Put N lines per output file","-b SIZE Put SIZE bytes per output file (K, M, G suffixes)","-n CHUNKS Split into CHUNKS equal-sized files","-d Use numeric suffixes (00, 01, ...) instead of alphabetic","-a LENGTH Use suffixes of length LENGTH (default: 2)","--additional-suffix=SUFFIX Append SUFFIX to file names"],examples:["split -l 100 file.txt # Split into 100-line chunks","split -b 1M file.bin # Split into 1MB chunks","split -n 5 file.txt # Split into 5 equal parts","split -d file.txt part_ # part_00, part_01, ...","split -a 3 -d file.txt x # x000, x001, ..."]},S=1e5,_=0;function U(e){return Uint8Array.from(e,t=>t.charCodeAt(0))}function N(e){let t=e.match(/^(\d+)([KMGTPEZY]?)([B]?)$/i);if(!t)return null;let i=Number(t[1]);if(!Number.isSafeInteger(i)||i<1)return null;let u=(t[2]||"").toUpperCase(),a=new Map([["",1],["K",1024],["M",1024*1024],["G",1024*1024*1024],["T",1024*1024*1024*1024],["P",1024*1024*1024*1024*1024]]).get(u);return a===void 0||i>Math.floor(Number.MAX_SAFE_INTEGER/a)?null:i*a}function x(e){if(!/^[0-9]+$/.test(e))return null;let t=Number(e);return Number.isSafeInteger(t)&&t>=1?t:null}function H(e,t,i){if(t)return e.toString().padStart(i,"0");let u="abcdefghijklmnopqrstuvwxyz",n=new Array(i),a=e;for(let o=i-1;o>=0;o--)n[o]=u[a%26],a=Math.floor(a/26);return n.join("")}function B(e,t){let i=[],u=0,n=0;for(let a=0;a<e.length;a++)e[a]===10&&(n++,n===t&&(i.push(e.subarray(u,a+1)),u=a+1,n=0));return u<e.length&&i.push(e.subarray(u)),i}function T(e,t){let i=[];for(let u=0;u<e.length;u+=t)i.push(e.subarray(u,u+t));return i}function X(e,t){let i=[],u=Math.ceil(e.length/t);for(let n=0;n<t;n++){let a=n*u,o=Math.min(a+u,e.length);a<o&&i.push(e.subarray(a,o))}return i}function z(e,t){let i=e?10**t:26**t;return Number.isSafeInteger(i)?i:Number.MAX_SAFE_INTEGER}function G(e){if(e.existence!=="unknown")return e.existence==="existing"?e.stableIdentity:e.canonicalPath===void 0?void 0:`missing:${e.canonicalPath}`}function I(e,t){return e.existence!==t.existence||e.existence==="unknown"||t.existence==="unknown"?!1:e.existence==="missing"&&t.existence==="missing"?e.canonicalPath===t.canonicalPath:e.existence==="existing"&&t.existence==="existing"?e.stableIdentity!==void 0&&e.stableIdentity===t.stableIdentity:!1}async function M(e,t,i){let u=t.lastIndexOf("/"),n=u<=0?"/":t.slice(0,u),a=t.slice(u+1);for(let o=0;o<100;o++){let d=_++,c=e.fs.resolvePath(n,`.${a}.just-bash-split-${i}-${d}`),p=await h(e.fs,c);if(p.existence==="missing")return c;if(p.existence==="unknown")break}throw new Error("unable to allocate transaction path")}var Z={name:"split",execute:async(e,t)=>{if(L(e))return C(A);let i={mode:"lines",lines:1e3,bytes:0,chunks:0,useNumericSuffix:!1,suffixLength:2,additionalSuffix:""},u=[],n=0;for(;n<e.length;){let s=e[n];if(s==="-l"&&n+1<e.length){let l=x(e[n+1]);if(l===null)return{exitCode:1,stdout:"",stderr:`split: invalid number of lines: '${e[n+1]}'
|
|
3
3
|
`};i.mode="lines",i.lines=l,n+=2}else if(s.match(/^-l\d+$/)){let l=x(s.slice(2));if(l===null)return{exitCode:1,stdout:"",stderr:`split: invalid number of lines: '${s.slice(2)}'
|
|
4
4
|
`};i.mode="lines",i.lines=l,n++}else if(s==="-b"&&n+1<e.length){let l=N(e[n+1]);if(l===null)return{exitCode:1,stdout:"",stderr:`split: invalid number of bytes: '${e[n+1]}'
|
|
5
5
|
`};i.mode="bytes",i.bytes=l,n+=2}else if(s.match(/^-b.+$/)){let l=N(s.slice(2));if(l===null)return{exitCode:1,stdout:"",stderr:`split: invalid number of bytes: '${s.slice(2)}'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
2
|
-
import{c as E}from"./chunk-YEYSCLSJ.js";import{
|
|
2
|
+
import{c as E}from"./chunk-YEYSCLSJ.js";import{e as W}from"./chunk-ZUEPJPYA.js";import{l as h}from"./chunk-TVCZIH6M.js";import{d as N}from"./chunk-GN6CQ3J4.js";import{a as v,b as L,c as b}from"./chunk-QAYAQNCG.js";var k={name:"cut",summary:"remove sections from each line of files",usage:"cut [OPTION]... [FILE]...",options:["-c LIST select only these characters","-d DELIM use DELIM instead of TAB for field delimiter","-f LIST select only these fields","-s, --only-delimited do not print lines without delimiters"," --help display this help and exit"]};function M(r,o){let l=[],a=r.split(",");if(a.length>o)throw new h(`cut: range count limit exceeded (${o})`,"array_elements");for(let s of a)if(s.includes("-")){let[i,u]=s.split("-"),t=i?Number(i):1,f=u?Number(u):null;if(!Number.isSafeInteger(t)||t<1||f!==null&&(!Number.isSafeInteger(f)||f<t))throw new h("cut: invalid range","array_elements");l.push({start:t,end:f})}else{let i=Number(s);if(!Number.isSafeInteger(i)||i<1)throw new h("cut: invalid range","array_elements");l.push({start:i,end:i})}return l}function B(r,o){let l=[],a=new Set;for(let s of o){let i=s.start-1,u=s.end===null?r.length:s.end;for(let t=i;t<u&&t<r.length;t++)t>=0&&!a.has(t)&&(a.add(t),l.push(r[t]))}return l}var R={name:"cut",async execute(r,o){if(L(r))return v(k);let l=" ",a=null,s=null,i=!1,u=[];for(let n=0;n<r.length;n++){let e=r[n];if(e==="-d")l=r[++n]||" ";else if(e.startsWith("-d"))l=e.slice(2);else if(e==="-f")a=r[++n];else if(e.startsWith("-f"))a=e.slice(2);else if(e==="-c")s=r[++n];else if(e.startsWith("-c"))s=e.slice(2);else if(e==="-s"||e==="--only-delimited")i=!0;else{if(e.startsWith("--"))return b("cut",e);if(e.startsWith("-")){let d=!1;for(let c of e.slice(1))if(c==="s")i=!0;else if(!"dfc".includes(c)){d=!0;break}if(d)return b("cut",e)}else u.push(e)}}if(!a&&!s)return{stdout:"",stderr:`cut: you must specify a list of bytes, characters, or fields
|
|
3
3
|
`,exitCode:1};let t=await E(o,u,{cmdName:"cut"});if(!t.ok)return t.error;let m=(s?N(t.content):t.content).split(`
|
|
4
4
|
`);m.length>0&&m[m.length-1]===""&&m.pop();let x=M(a||s||"1",o.limits.maxArrayElements),g=new W(Math.min(o.limits.maxOutputSize,o.limits.maxStringLength),"cut"),S=0,I=n=>{if(!Number.isSafeInteger(n)||n<0||n>o.limits.maxLoopIterations-S)throw new h(`cut: range expansion limit exceeded (${o.limits.maxLoopIterations})`,"iterations");S+=n,o.executionScope?.consumeWork(n,"cut range expansion")};for(let n of m)if(s){let e=Array.from(n),d=[];for(let c of x){let y=c.start-1,w=c.end===null?e.length:c.end;I(Math.max(0,Math.min(w,e.length)-y));for(let p=y;p<w&&p<e.length;p++)p>=0&&d.push(e[p])}g.append(`${d.join("")}
|
|
5
5
|
`)}else{if(i&&!n.includes(l))continue;let e=n.split(l);for(let c of x){let y=c.start-1,w=c.end===null?e.length:c.end;I(Math.max(0,Math.min(w,e.length)-y))}let d=B(e,x);g.append(`${d.join(l)}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
2
|
-
import{a as $,b as F,c as b,d as j,e as Ze,f as et,g as C,h as tt,i as nt,j as k,k as ie,l as ae}from"./chunk-
|
|
2
|
+
import{a as $,b as F,c as b,d as j,e as Ze,f as et,g as C,h as tt,i as nt,j as k,k as ie,l as ae}from"./chunk-7DVD6YCI.js";import{b as V,d as Qe}from"./chunk-YUITEK6N.js";import{d as Ge,f as Xe,g as oe}from"./chunk-UUIYAOD4.js";import{a as Z}from"./chunk-O5BHWBYH.js";import{b as Ye}from"./chunk-YEYSCLSJ.js";import{b as q}from"./chunk-A3C4Z3Q3.js";import{a as W,d as se,e as re}from"./chunk-ZUEPJPYA.js";import{l as E}from"./chunk-TVCZIH6M.js";import{a as K,d as Y}from"./chunk-GN6CQ3J4.js";import{a as J,b as ne}from"./chunk-QAYAQNCG.js";var G=class{input;pos=0;tokens=[];maxSourceLength;maxTokens;constructor(t,n={}){this.input=t,this.maxSourceLength=n.maxSourceLength??1024*1024,this.maxTokens=n.maxTokens??1e5}tokenize(){if(this.input.length>this.maxSourceLength)throw new E(`xan: expression length limit exceeded (${this.maxSourceLength})`,"string_length");for(;this.pos<this.input.length&&(this.skipWhitespace(),!(this.pos>=this.input.length));){let t=this.nextToken();t&&(this.assertTokenCapacity(),this.tokens.push(t))}return this.assertTokenCapacity(),this.tokens.push({type:"eof",value:"",pos:this.pos}),this.tokens}assertTokenCapacity(){if(this.tokens.length>=this.maxTokens)throw new E(`xan: expression token limit exceeded (${this.maxTokens})`,"array_elements")}skipWhitespace(){for(;this.pos<this.input.length;){let t=this.input[this.pos];if(t===" "||t===" "||t===`
|
|
3
3
|
`||t==="\r")this.pos++;else if(t==="#")for(;this.pos<this.input.length&&this.input[this.pos]!==`
|
|
4
4
|
`;)this.pos++;else break}}nextToken(){let t=this.pos,n=this.input[this.pos];if(n>="0"&&n<="9")return this.readNumber();if(n==='"'||n==="'"||n==="`")return this.readString(n);if(n==="b"&&this.pos+1<this.input.length){let o=this.input[this.pos+1];if(o==='"'||o==="'"||o==="`")return this.pos++,this.readString(o)}if(n==="/"){let o=this.tokens[this.tokens.length-1];return o&&(o.type==="int"||o.type==="float"||o.type==="string"||o.type==="ident"||o.type===")"||o.type==="]")?this.input[this.pos+1]==="/"?(this.pos+=2,{type:"//",value:"//",pos:t}):(this.pos++,{type:"/",value:"/",pos:t}):this.readRegex()}if(this.match("not in"))return{type:"not in",value:"not in",pos:t};if(this.match("=>"))return{type:"=>",value:"=>",pos:t};if(this.match("**"))return{type:"**",value:"**",pos:t};if(this.match("++"))return{type:"++",value:"++",pos:t};if(this.match("//"))return{type:"//",value:"//",pos:t};if(this.match("=="))return{type:"==",value:"==",pos:t};if(this.match("!="))return{type:"!=",value:"!=",pos:t};if(this.match("<="))return{type:"<=",value:"<=",pos:t};if(this.match(">="))return{type:">=",value:">=",pos:t};if(this.match("&&"))return{type:"&&",value:"&&",pos:t};if(this.match("||"))return{type:"||",value:"||",pos:t};let r=new Map([["(","("],[")",")"],["[","["],["]","]"],["{","{"],["}","}"],[",",","],[":",":"],[";",";"],["+","+"],["-","-"],["*","*"],["%","%"],["<","<"],[">",">"],["!","!"],[".","."],["|","|"],["=","="]]).get(n);if(r!==void 0)return this.pos++,{type:r,value:n,pos:t};if(this.isIdentStart(n))return this.readIdentifier();throw new Error(`Unexpected character '${n}' at position ${this.pos}`)}match(t){if(this.input.slice(this.pos,this.pos+t.length)===t){if(/^[a-zA-Z]/.test(t)){let n=this.input[this.pos+t.length];if(n&&this.isIdentChar(n))return!1}return this.pos+=t.length,!0}return!1}isIdentStart(t){return t>="a"&&t<="z"||t>="A"&&t<="Z"||t==="_"}isIdentChar(t){return this.isIdentStart(t)||t>="0"&&t<="9"}readNumber(){let t=this.pos,n=!1,s=!1;for(;this.pos<this.input.length;){let o=this.input[this.pos];if(o>="0"&&o<="9")this.pos++;else if(o==="_")this.pos++;else if(o==="."&&!n&&!s)n=!0,this.pos++;else if((o==="e"||o==="E")&&!s)s=!0,n=!0,this.pos++,this.pos<this.input.length&&(this.input[this.pos]==="+"||this.input[this.pos]==="-")&&this.pos++;else break}let r=this.input.slice(t,this.pos).replace(/_/g,"");return{type:n?"float":"int",value:r,pos:t}}readString(t){let n=this.pos;this.pos++;let s="";for(;this.pos<this.input.length;){let r=this.input[this.pos];if(r===t)return this.pos++,{type:"string",value:s,pos:n};if(r==="\\"){if(this.pos++,this.pos<this.input.length){let o=this.input[this.pos];switch(o){case"n":s+=`
|
|
5
5
|
`;break;case"r":s+="\r";break;case"t":s+=" ";break;case"\\":s+="\\";break;case'"':s+='"';break;case"'":s+="'";break;case"`":s+="`";break;case"0":s+="\0";break;default:s+=o}this.pos++}}else s+=r,this.pos++}throw new Error(`Unterminated string starting at position ${n}`)}readRegex(){let t=this.pos;this.pos++;let n="",s="";for(;this.pos<this.input.length;){let r=this.input[this.pos];if(r==="/"){for(this.pos++;this.pos<this.input.length&&this.input[this.pos]==="i";)s+=this.input[this.pos],this.pos++;return{type:"regex",value:n+(s?`/${s}`:""),pos:t}}r==="\\"?(n+=r,this.pos++,this.pos<this.input.length&&(n+=this.input[this.pos],this.pos++)):(n+=r,this.pos++)}throw new Error(`Unterminated regex starting at position ${t}`)}readIdentifier(){let t=this.pos;for(;this.pos<this.input.length&&this.isIdentChar(this.input[this.pos]);)this.pos++;let n=!1;this.pos<this.input.length&&this.input[this.pos]==="?"&&(n=!0,this.pos++);let s=this.input.slice(t,n?this.pos-1:this.pos);n&&(s+="?");let r=new Map([["true","true"],["false","false"],["null","null"],["and","and"],["or","or"],["eq","eq"],["ne","ne"],["lt","lt"],["le","le"],["gt","gt"],["ge","ge"],["in","in"],["as","as"],["_","_"]]),o=s.replace(/\?$/,""),i=r.get(o);return i!==void 0&&!n?{type:i,value:o,pos:t}:{type:"ident",value:s,pos:t}}};function z(e){return{maxSourceLength:e.limits.maxStringLength,maxTokens:e.limits.maxQueryTokens,maxAstNodes:e.limits.maxQueryElements,maxOperations:e.limits.maxJqIterations,maxDepth:e.limits.maxQueryDepth}}var D={PIPE:1,OR:2,AND:3,EQUALITY:4,COMPARISON:5,ADDITIVE:6,MULTIPLICATIVE:7,POWER:8,UNARY:9,POSTFIX:10},ee=class{pos=0;tokens;depth=0;operations=0;astNodes=0;limits;constructor(t,n={}){this.tokens=t,this.limits={maxSourceLength:n.maxSourceLength??1024*1024,maxTokens:n.maxTokens??1e5,maxDepth:n.maxDepth??100,maxOperations:n.maxOperations??1e5,maxAstNodes:n.maxAstNodes??1e5};let s=0;for(let r of t)this.useOperation(),r.type==="("||r.type==="["||r.type==="{"?(s++,s>this.limits.maxDepth&&this.throwDepthLimit()):(r.type===")"||r.type==="]"||r.type==="}")&&(s=Math.max(0,s-1))}parse(){let t=this.parseExpr(0);if(this.peek().type!=="eof")throw new Error(`Unexpected token: ${this.peek().value}`);return t}parseExpr(t){return this.withDepth(()=>this.parseExprInner(t))}parseExprInner(t){let n=this.parsePrefix();for(;;){let s=this.peek(),r=this.getInfixPrec(s.type);if(r<t)break;n=this.parseInfix(n,r)}return n}useOperation(t=1){if(t>this.limits.maxOperations-this.operations)throw new E(`xan: expression parser operation limit exceeded (${this.limits.maxOperations})`,"iterations");this.operations+=t}withDepth(t){this.depth>=this.limits.maxDepth&&this.throwDepthLimit(),this.depth++;try{return t()}finally{this.depth--}}throwDepthLimit(){throw new E(`xan: expression parser depth limit exceeded (${this.limits.maxDepth})`,"recursion")}addAstNode(){if(this.astNodes>=this.limits.maxAstNodes)throw new E(`xan: expression AST node limit exceeded (${this.limits.maxAstNodes})`,"array_elements");this.astNodes++}parsePrefix(){let t=this.peek();switch(t.type){case"int":return this.advance(),{type:"int",value:Number.parseInt(t.value,10)};case"float":return this.advance(),{type:"float",value:Number.parseFloat(t.value)};case"string":return this.advance(),{type:"string",value:t.value};case"regex":{this.advance();let n=t.value.split("/"),s=n.length>1?n[n.length-1]:"";return{type:"regex",pattern:n.slice(0,-1).join("/")||t.value,caseInsensitive:s.includes("i")}}case"true":return this.advance(),{type:"bool",value:!0};case"false":return this.advance(),{type:"bool",value:!1};case"null":return this.advance(),{type:"null"};case"_":return this.advance(),{type:"underscore"};case"ident":{let n=t.value,s=n.endsWith("?"),r=s?n.slice(0,-1):n;if(this.advance(),this.peek().type==="(")return this.parseFunctionCall(r);if(this.peek().type==="=>"){this.advance();let o=this.parseExpr(0);return this.bindLambdaArgs({type:"lambda",params:[r],body:o},[r])}return{type:"identifier",name:r,unsure:s}}case"(":{this.advance();let n=this.pos;if(this.peek().type===")"){if(this.advance(),this.peek().type==="=>"){this.advance();let r=this.parseExpr(0);return{type:"lambda",params:[],body:r}}throw new Error("Empty parentheses not allowed")}if(this.peek().type==="ident"){let r=[this.peek().value];this.advance();let o=!0;for(;this.peek().type===",";)if(this.advance(),this.peek().type==="ident")r.push(this.peek().value),this.advance();else{o=!1;break}if(o&&this.peek().type===")"&&this.peekAt(1).type==="=>"){this.advance(),this.advance();let i=this.parseExpr(0);return this.bindLambdaArgs({type:"lambda",params:r,body:i},r)}this.pos=n}let s=this.parseExpr(0);return this.expect(")"),s}case"[":return this.parseList();case"{":return this.parseMap();case"-":{this.advance();let n=this.parseExpr(D.UNARY);return n.type==="int"?{type:"int",value:-n.value}:n.type==="float"?{type:"float",value:-n.value}:{type:"func",name:"neg",args:[{expr:n}]}}case"!":return this.advance(),{type:"func",name:"not",args:[{expr:this.parseExpr(D.UNARY)}]};default:throw new Error(`Unexpected token: ${t.type} (${t.value})`)}}parseFunctionCall(t){this.expect("(");let n=[];if(this.peek().type!==")")do{n.length>0&&this.peek().type===","&&this.advance();let s;if(this.peek().type==="ident"){let o=this.peek().value,i=this.pos+1;i<this.tokens.length&&this.tokens[i].type==="="&&(s=o,this.advance(),this.advance())}let r=this.parseExpr(0);n.push({name:s,expr:r})}while(this.peek().type===",");return this.expect(")"),{type:"func",name:t.toLowerCase(),args:n}}parseList(){this.expect("[");let t=[];if(this.peek().type!=="]")do t.length>0&&this.peek().type===","&&this.advance(),t.push(this.parseExpr(0));while(this.peek().type===",");return this.expect("]"),{type:"list",elements:t}}parseMap(){this.expect("{");let t=[];if(this.peek().type!=="}")do{t.length>0&&this.peek().type===","&&this.advance();let n;if(this.peek().type==="ident")n=this.peek().value,this.advance();else if(this.peek().type==="string")n=this.peek().value,this.advance();else throw new Error(`Expected map key, got ${this.peek().type}`);this.expect(":");let s=this.parseExpr(0);t.push({key:n,value:s})}while(this.peek().type===",");return this.expect("}"),{type:"map",entries:t}}parseInfix(t,n){let s=this.peek(),o=new Map([["+","add"],["-","sub"],["*","mul"],["/","div"],["//","idiv"],["%","mod"],["**","pow"],["++","concat"],["==","=="],["!=","!="],["<","<"],["<=","<="],[">",">"],[">=",">="],["eq","eq"],["ne","ne"],["lt","lt"],["le","le"],["gt","gt"],["ge","ge"],["&&","and"],["and","and"],["||","or"],["or","or"]]).get(s.type);if(o!==void 0){this.advance();let i=this.parseExpr(n+(this.isRightAssoc(s.type)?0:1));return{type:"func",name:o,args:[{expr:t},{expr:i}]}}if(s.type==="|"){this.advance();let i=this.parseExpr(n);return this.handlePipe(t,i)}if(s.type===".")return this.advance(),this.handleDot(t);if(s.type==="[")return this.advance(),this.handleIndexing(t);if(s.type==="in")return this.advance(),{type:"func",name:"contains",args:[{expr:this.parseExpr(n+1)},{expr:t}]};if(s.type==="not in")return this.advance(),{type:"func",name:"not",args:[{expr:{type:"func",name:"contains",args:[{expr:this.parseExpr(n+1)},{expr:t}]}}]};throw new Error(`Unexpected infix token: ${s.type}`)}handlePipe(t,n){if(n.type==="identifier")return{type:"func",name:n.name,args:[{expr:t}]};if(n.type==="func"){let s=this.countUnderscores(n);return s===0?n:s===1?this.fillUnderscore(n,t):{type:"pipeline",exprs:[t,n]}}return this.countUnderscores(n)===1?this.fillUnderscore(n,t):n}handleDot(t){let n=this.peek();if(n.type==="ident"){let s=n.value;if(this.advance(),this.peek().type==="("){let r=this.parseFunctionCall(s);return r.type==="func"&&r.args.unshift({expr:t}),r}return{type:"func",name:"get",args:[{expr:t},{expr:{type:"string",value:s}}]}}if(n.type==="int"){let s=Number.parseInt(n.value,10);return this.advance(),{type:"func",name:"get",args:[{expr:t},{expr:{type:"int",value:s}}]}}if(n.type==="string"){let s=n.value;return this.advance(),{type:"func",name:"get",args:[{expr:t},{expr:{type:"string",value:s}}]}}throw new Error(`Expected identifier, number, or string after dot, got ${n.type}`)}handleIndexing(t){if(this.peek().type===":"){if(this.advance(),this.peek().type==="]")return this.advance(),{type:"func",name:"slice",args:[{expr:t}]};let s=this.parseExpr(0);return this.expect("]"),{type:"func",name:"slice",args:[{expr:t},{expr:{type:"int",value:0}},{expr:s}]}}let n=this.parseExpr(0);if(this.peek().type===":"){if(this.advance(),this.peek().type==="]")return this.advance(),{type:"func",name:"slice",args:[{expr:t},{expr:n}]};let s=this.parseExpr(0);return this.expect("]"),{type:"func",name:"slice",args:[{expr:t},{expr:n},{expr:s}]}}return this.expect("]"),{type:"func",name:"get",args:[{expr:t},{expr:n}]}}countUnderscores(t){let n=[t],s=0;for(;n.length>0;){this.useOperation();let r=n.pop();if(!r)break;if(r.type==="underscore")s++;else if(r.type==="func")for(let o of r.args)n.push(o.expr);else if(r.type==="list")n.push(...r.elements);else if(r.type==="map")for(let o of r.entries)n.push(o.value);if(n.length>this.limits.maxAstNodes)throw new E(`xan: expression AST node limit exceeded (${this.limits.maxAstNodes})`,"array_elements")}return s}fillUnderscore(t,n){return this.withDepth(()=>this.fillUnderscoreInner(t,n))}fillUnderscoreInner(t,n){return this.useOperation(),t.type==="underscore"?n:t.type==="func"?{...t,args:t.args.map(s=>({...s,expr:this.fillUnderscore(s.expr,n)}))}:t.type==="list"?{...t,elements:t.elements.map(s=>this.fillUnderscore(s,n))}:t.type==="map"?{...t,entries:t.entries.map(s=>({...s,value:this.fillUnderscore(s.value,n)}))}:t}bindLambdaArgs(t,n){return{...t,body:this.bindLambdaArgsInExpr(t.body,n)}}bindLambdaArgsInExpr(t,n){return this.withDepth(()=>this.bindLambdaArgsInExprInner(t,n))}bindLambdaArgsInExprInner(t,n){return this.useOperation(),t.type==="identifier"&&n.includes(t.name)?{type:"lambdaBinding",name:t.name}:t.type==="func"?{...t,args:t.args.map(s=>({...s,expr:this.bindLambdaArgsInExpr(s.expr,n)}))}:t.type==="list"?{...t,elements:t.elements.map(s=>this.bindLambdaArgsInExpr(s,n))}:t.type==="map"?{...t,entries:t.entries.map(s=>({...s,value:this.bindLambdaArgsInExpr(s.value,n)}))}:t}getInfixPrec(t){switch(t){case"|":return D.PIPE;case"||":case"or":return D.OR;case"&&":case"and":return D.AND;case"==":case"!=":case"eq":case"ne":return D.EQUALITY;case"<":case"<=":case">":case">=":case"lt":case"le":case"gt":case"ge":case"in":case"not in":return D.COMPARISON;case"+":case"-":case"++":return D.ADDITIVE;case"*":case"/":case"//":case"%":return D.MULTIPLICATIVE;case"**":return D.POWER;case".":case"[":return D.POSTFIX;default:return-1}}isRightAssoc(t){return t==="**"}peek(){return this.tokens[this.pos]||{type:"eof",value:"",pos:0}}peekAt(t){return this.tokens[this.pos+t]||{type:"eof",value:"",pos:0}}advance(){return this.useOperation(),this.addAstNode(),this.tokens[this.pos++]}expect(t){let n=this.peek();if(n.type!==t)throw new Error(`Expected ${t}, got ${n.type}`);return this.advance()}};function X(e,t={}){let n=[],r=new G(e,{maxSourceLength:t.maxSourceLength,maxTokens:t.maxTokens}).tokenize(),o=0,i=()=>r[o]||{type:"eof",value:"",pos:0},p=()=>r[o++];for(;i().type!=="eof";){if(i().type===","&&n.length>0){p();continue}let h=[],m=0,c=o;for(;i().type!=="eof";){let l=i();if((l.type===","||l.type==="as")&&m===0)break;(l.type==="("||l.type==="["||l.type==="{")&&m++,(l.type===")"||l.type==="]"||l.type==="}")&&m--,h.push(p())}h.push({type:"eof",value:"",pos:0});let d=new ee(h,t).parse(),u;if(i().type==="as")if(p(),i().type==="("){p();let l=[];for(;i().type!==")"&&i().type!=="eof";)if((i().type==="ident"||i().type==="string")&&(l.push(i().value),p()),i().type===",")p();else if(i().type!==")"&&i().type!=="eof")throw new Error(`Expected tuple alias, got ${i().type}`);if(i().type!==")")throw new Error("Expected ')' after tuple alias");p(),u=l}else if(i().type==="ident"||i().type==="string")u=i().value,p();else throw new Error(`Expected name after 'as', got ${i().type}`);else u=e.slice(r[c].pos,r[o-1]?.pos||e.length).trim(),d.type==="identifier"&&(u=d.name);n.push({expr:d,name:u})}return n}function B(e,t={}){let s=new G(e,{maxSourceLength:t.maxSourceLength,maxTokens:t.maxTokens}).tokenize();return new ee(s,t).parse()}function R(e,t){return t.length===0?O(e,[]):t.length===1?{type:"Pipe",left:t[0],right:O(e,[])}:{type:"Pipe",left:t[0],right:O(e,t.slice(1))}}var le={add:e=>L("+",e[0],e[1]),sub:e=>L("-",e[0],e[1]),mul:e=>L("*",e[0],e[1]),div:e=>L("/",e[0],e[1]),mod:e=>L("%",e[0],e[1]),idiv:e=>O("floor",[L("/",e[0],e[1])]),pow:e=>R("pow",e),neg:e=>({type:"UnaryOp",op:"-",operand:e[0]}),"==":e=>L("==",e[0],e[1]),"!=":e=>L("!=",e[0],e[1]),"<":e=>L("<",e[0],e[1]),"<=":e=>L("<=",e[0],e[1]),">":e=>L(">",e[0],e[1]),">=":e=>L(">=",e[0],e[1]),eq:e=>L("==",M(e[0]),M(e[1])),ne:e=>L("!=",M(e[0]),M(e[1])),lt:e=>L("<",M(e[0]),M(e[1])),le:e=>L("<=",M(e[0]),M(e[1])),gt:e=>L(">",M(e[0]),M(e[1])),ge:e=>L(">=",M(e[0]),M(e[1])),and:e=>L("and",e[0],e[1]),or:e=>L("or",e[0],e[1]),not:e=>({type:"UnaryOp",op:"not",operand:e[0]}),len:e=>R("length",e),length:e=>R("length",e),upper:e=>R("ascii_upcase",e),lower:e=>R("ascii_downcase",e),trim:e=>R("trim",e),ltrim:e=>e.length===0?O("ltrimstr",[{type:"Literal",value:" "}]):{type:"Pipe",left:e[0],right:O("ltrimstr",[{type:"Literal",value:" "}])},rtrim:e=>e.length===0?O("rtrimstr",[{type:"Literal",value:" "}]):{type:"Pipe",left:e[0],right:O("rtrimstr",[{type:"Literal",value:" "}])},split:e=>R("split",e),join:e=>e.length===1?O("join",[{type:"Literal",value:""}]):R("join",e),concat:e=>L("+",e[0],e[1]),startswith:e=>R("startswith",e),endswith:e=>R("endswith",e),contains:e=>R("contains",e),replace:e=>R("gsub",e),substr:e=>e.length===2?{type:"Slice",base:e[0],start:e[1]}:{type:"Slice",base:e[0],start:e[1],end:L("+",e[1],e[2])},abs:e=>R("fabs",e),floor:e=>R("floor",e),ceil:e=>R("ceil",e),round:e=>R("round",e),sqrt:e=>R("sqrt",e),log:e=>R("log",e),log10:e=>R("log10",e),log2:e=>R("log2",e),exp:e=>R("exp",e),sin:e=>R("sin",e),cos:e=>R("cos",e),tan:e=>R("tan",e),asin:e=>R("asin",e),acos:e=>R("acos",e),atan:e=>R("atan",e),min:e=>R("min",e),max:e=>R("max",e),first:e=>e.length===0?{type:"Index",index:{type:"Literal",value:0}}:{type:"Index",index:{type:"Literal",value:0},base:e[0]},last:e=>e.length===0?{type:"Index",index:{type:"Literal",value:-1}}:{type:"Index",index:{type:"Literal",value:-1},base:e[0]},get:e=>e.length===1?{type:"Index",index:e[0]}:{type:"Index",index:e[1],base:e[0]},slice:e=>e.length===1?{type:"Slice",base:e[0]}:e.length===2?{type:"Slice",base:e[0],start:e[1]}:{type:"Slice",base:e[0],start:e[1],end:e[2]},keys:"keys",values:"values",entries:e=>O("to_entries",e),from_entries:"from_entries",reverse:"reverse",sort:"sort",sort_by:"sort_by",group_by:"group_by",unique:"unique",unique_by:"unique_by",flatten:"flatten",map:e=>({type:"Pipe",left:e[0],right:{type:"Array",elements:e[1]}}),select:e=>O("select",e),empty:()=>O("empty",[]),count:()=>O("length",[]),sum:e=>e.length===0?O("add",[]):{type:"Pipe",left:{type:"Array",elements:e[0]},right:O("add",[])},mean:e=>e.length===0?{type:"Pipe",left:{type:"Identity"},right:L("/",O("add",[]),O("length",[]))}:{type:"Pipe",left:{type:"Array",elements:e[0]},right:L("/",O("add",[]),O("length",[]))},avg:e=>e.length===0?{type:"Pipe",left:{type:"Identity"},right:L("/",O("add",[]),O("length",[]))}:{type:"Pipe",left:{type:"Array",elements:e[0]},right:L("/",O("add",[]),O("length",[]))},type:"type",isnull:e=>e.length===0?L("==",{type:"Identity"},{type:"Literal",value:null}):L("==",e[0],{type:"Literal",value:null}),isempty:e=>e.length===0?L("==",{type:"Identity"},{type:"Literal",value:""}):L("==",e[0],{type:"Literal",value:""}),tonumber:e=>e.length===0?O("tonumber",[]):O("tonumber",e),tostring:e=>e.length===0?O("tostring",[]):O("tostring",e),if:e=>st(e[0],e[1],e[2]),coalesce:e=>{if(e.length===0)return{type:"Literal",value:null};if(e.length===1)return e[0];let t=e[e.length-1];for(let n=e.length-2;n>=0;n--){let s=e[n],r=L("and",L("!=",s,{type:"Literal",value:null}),L("!=",s,{type:"Literal",value:""}));t=st(r,s,t)}return t},index:()=>({type:"Field",name:"_row_index"}),now:()=>O("now",[]),fmt:e=>O("tostring",e),format:e=>O("tostring",e)};Object.setPrototypeOf(le,null);function L(e,t,n){return{type:"BinaryOp",op:e,left:t,right:n}}function O(e,t){return{type:"Call",name:e,args:t}}var mt="then";function st(e,t,n){let s=Xe({type:"Cond",cond:e,elifs:[],else:n||{type:"Literal",value:null}});return s[mt]=t,s}function M(e){return{type:"Pipe",left:e,right:{type:"Call",name:"tostring",args:[]}}}function U(e,t=!0,n={}){let s={nodes:0,operations:0,maxNodes:n.maxAstNodes??1e5,maxOperations:n.maxOperations??1e5,maxDepth:n.maxDepth??100};return rt(e,t,s,0)}function rt(e,t,n,s){if(s>=n.maxDepth)throw new E(`xan: expression conversion depth limit exceeded (${n.maxDepth})`,"recursion");if(++n.nodes>n.maxNodes)throw new E(`xan: expression conversion AST limit exceeded (${n.maxNodes})`,"array_elements");if(++n.operations>n.maxOperations)throw new E(`xan: expression conversion operation limit exceeded (${n.maxOperations})`,"iterations");let r=o=>rt(o,t,n,s+1);switch(e.type){case"int":case"float":return{type:"Literal",value:e.value};case"string":return{type:"Literal",value:e.value};case"bool":return{type:"Literal",value:e.value};case"null":return{type:"Literal",value:null};case"underscore":return{type:"Index",base:{type:"Identity"},index:{type:"Literal",value:"_"}};case"identifier":return t?{type:"Field",name:e.name}:{type:"VarRef",name:e.name};case"lambdaBinding":return{type:"VarRef",name:e.name};case"func":{if(e.args.length>n.maxNodes-n.nodes)throw new E(`xan: expression conversion AST limit exceeded (${n.maxNodes})`,"array_elements");let o=e.args.map(p=>r(p.expr));if(e.name==="coalesce"){let p=Math.max(0,o.length-1)*7;if(p>n.maxNodes-n.nodes)throw new E(`xan: expression conversion AST limit exceeded (${n.maxNodes})`,"array_elements");if(n.nodes+=p,n.operations+=o.length,n.operations>n.maxOperations)throw new E(`xan: expression conversion operation limit exceeded (${n.maxOperations})`,"iterations")}let i=Object.hasOwn(le,e.name)?le[e.name]:void 0;return typeof i=="function"?i(o):O(typeof i=="string"?i:e.name,o)}case"list":return e.elements.length===0?{type:"Array"}:{type:"Array",elements:e.elements.reduce((o,i,p)=>{let h=r(i);return p===0?h:{type:"Comma",left:o,right:h}},null)};case"map":return{type:"Object",entries:e.entries.map(o=>({key:o.key,value:r(o.value)}))};case"regex":return{type:"Literal",value:e.pattern};case"slice":return{type:"Slice",start:e.start?r(e.start):void 0,end:e.end?r(e.end):void 0};case"lambda":return r(e.body);case"pipeline":return{type:"Identity"};default:throw new Error(`Unknown moonblade expression type: ${e.type}`)}}function Q(e){return e<2?0:Math.ceil(e*Math.log2(e))}function ue(e,t={}){let n=t.maxArrayElements??1e5,s=t.maxStringLength??10*1024*1024,r=t.maxIterations??1e5,o=t.maxDepth??100;if(K(e)>s)throw new E(`xan: aggregation expression length limit exceeded (${s} bytes)`,"string_length");let i=[],p=0,h=0,m=()=>{if(t.consumeWork?.(),++h>r)throw new E(`xan: aggregation parser operation limit exceeded (${r})`,"iterations")};for(;p<e.length;){for(m();p<e.length&&(e[p]===" "||e[p]===",");)p++;if(p>=e.length)break;let c=p;for(;p<e.length&&/\w/.test(e[p]);)p++;let a=e.slice(c,p);for(;p<e.length&&e[p]===" ";)p++;if(e[p]!=="(")break;p++;let d=1,u=p;for(;p<e.length&&d>0;){if(m(),e[p]==="("?d++:e[p]===")"&&d--,d>o)throw new E(`xan: aggregation parser depth limit exceeded (${o})`,"recursion");d>0&&p++}let l=e.slice(u,p).trim();for(p++;p<e.length&&e[p]===" ";)p++;let f="";if(e.slice(p,p+3).toLowerCase()==="as "){for(p+=3;p<e.length&&e[p]===" ";)p++;let x=p;for(;p<e.length&&/\w/.test(e[p]);)p++;f=e.slice(x,p)}if(f||(f=l?`${a}(${l})`:`${a}()`),i.length>=n)throw new E(`xan: aggregation specification limit exceeded (${n})`,"array_elements");i.push({func:a,expr:l,alias:f})}return i}function ft(e){return/^\w+$/.test(e)}function ht(e,t,n){let s=V(e,t,n);return s.length>0?s[0]:null}function ce(e,t,n={},s={}){let{func:r,expr:o}=t,i=s.maxArrayElements??1e5,p=s.maxStringLength??10*1024*1024,h=s.maxIterations??1e5,m={maxSourceLength:p,maxTokens:i,maxAstNodes:i,maxOperations:h,maxDepth:s.maxDepth??100};if(e.length>i)throw new E(`xan: aggregation input limit exceeded (${i})`,"array_elements");if(r==="count"&&!o)return e.length;let c=ft(o),a=c?null:U(B(o,m),!0,m),d;if(c)d=f=>f[o];else{if(a===null)throw new Error("xan: missing compiled aggregation expression");d=f=>ht(f,a,n)}if(r==="all"||r==="any"){let f=0;for(let x of e){if(s.consumeWork?.(),++f>h)throw new E(`xan: aggregation iteration limit exceeded (${h})`,"iterations");let g=!!d(x);if(r==="all"&&!g)return!1;if(r==="any"&&g)return!0}return r==="all"}let u=[],l=0;for(let f of e){if(s.consumeWork?.(),++l>h)throw new E(`xan: aggregation iteration limit exceeded (${h})`,"iterations");let x=d(f);if(x!=null){if(u.length>=i)throw new E(`xan: aggregation value limit exceeded (${i})`,"array_elements");u.push(x)}}switch(r){case"count":{if(c)return u.length;let f=0;for(let x of u)s.consumeWork?.(),x&&f++;return f}case"sum":{let f=0;for(let x of u)s.consumeWork?.(),f+=typeof x=="number"?x:Number.parseFloat(String(x));return f}case"mean":case"avg":{let f=0;for(let x of u)s.consumeWork?.(),f+=typeof x=="number"?x:Number.parseFloat(String(x));return u.length>0?f/u.length:0}case"min":{let f=null;for(let x of u){s.consumeWork?.();let g=typeof x=="number"?x:Number.parseFloat(String(x));f=f===null?g:Math.min(f,g)}return f}case"max":{let f=null;for(let x of u){s.consumeWork?.();let g=typeof x=="number"?x:Number.parseFloat(String(x));f=f===null?g:Math.max(f,g)}return f}case"first":return u.length>0?u[0]:null;case"last":return u.length>0?u[u.length-1]:null;case"median":{let f=[];for(let g of u){s.consumeWork?.();let y=typeof g=="number"?g:Number.parseFloat(String(g));Number.isNaN(y)||f.push(y)}if(s.consumeWork?.(Q(f.length)),f.sort((g,y)=>g-y),f.length===0)return null;let x=Math.floor(f.length/2);return f.length%2===0?(f[x-1]+f[x])/2:f[x]}case"mode":{let f=new Map;for(let y of u){s.consumeWork?.();let w=String(y);f.set(w,(f.get(w)||0)+1)}let x=0,g=null;for(let[y,w]of f)s.consumeWork?.(),w>x&&(x=w,g=y);return g}case"cardinality":{let f=new Set;for(let x of u)s.consumeWork?.(),f.add(String(x));return f.size}case"values":return ot(u,!1,p,s);case"distinct_values":return ot(u,!0,p,s);default:return null}}function it(e,t,n={},s={}){let r=F();for(let o of t)b(r,o.alias,ce(e,o,n,s));return r}function ot(e,t,n,s){let r=[],o=t?new Set:null,i=0;for(let p of e){s.consumeWork?.();let h=String(p);if(o?.has(h))continue;o?.add(h);let m=K(h)+(r.length>0?1:0);if(m>n-i)throw new E(`xan: aggregation string limit exceeded (${n} bytes)`,"string_length");r.push(h),i+=m}return t&&(s.consumeWork?.(Q(r.length)),r.sort()),r.join("|")}function lt(e,t){return{maxArrayElements:e.limits.maxArrayElements,maxStringLength:e.limits.maxStringLength,maxIterations:e.limits.maxJqIterations,maxDepth:e.limits.maxQueryDepth,consumeWork:(n=1)=>t.consumeWork(n)}}function at(e,t,n){let s=e.size-(t&&e.has("")?1:0);return n>0?Math.min(s,n):s}async function pe(e,t){let n="",s=[];for(let d of e)d.startsWith("-")||(n?s.push(d):n=d);if(!n)return{stdout:"",stderr:`xan agg: no aggregation expression
|
|
@@ -61,7 +61,7 @@ import{a as $,b as F,c as b,d as j,e as Ze,f as et,g as C,h as tt,i as nt,j as k
|
|
|
61
61
|
`,exitCode:1};i=o[0].headers}let m=[];for(let{headers:c,data:a}of o)for(let d of a){let u=F();for(let l of i)b(u,l,c.includes(l)?d[l]:"");m.push(u)}return{stdout:C(i,m,t),stderr:"",exitCode:0}}async function Be(e,t){let n="",s=[],r=!1,o=!1,i=[];for(let u=0;u<e.length;u++){let l=e[u];(l==="-s"||l==="--select")&&u+1<e.length?s=e[++u].split(","):l==="-v"||l==="--invert"?r=!0:l==="-i"||l==="--ignore-case"?o=!0:l==="-r"||l==="--regex"||l.startsWith("-")||(n?i.push(l):n=l)}if(!n)return{stdout:"",stderr:`xan search: no pattern specified
|
|
62
62
|
`,exitCode:1};let{headers:p,data:h,error:m}=await k(i,t);if(m)return m;let c=s.length>0?s:p,a;try{a=Z(n,o?"i":"")}catch{return{stdout:"",stderr:`xan search: invalid regex pattern '${n}'
|
|
63
63
|
`,exitCode:1}}let d=h.filter(u=>{let l=c.some(f=>{let x=u[f];return x!=null&&a.test(String(x))});return r?!l:l});return{stdout:C(p,d,t),stderr:"",exitCode:0}}async function He(e,t){let n="",s=[];for(let l of e)l.startsWith("-")||(n?s.push(l):n=l);if(!n)return{stdout:"",stderr:`xan flatmap: no expression specified
|
|
64
|
-
`,exitCode:1};let{headers:r,data:o,error:i}=await k(s,t);if(i)return i;let p=z(t),m=X(n,p).map(({expr:l,name:f})=>({alias:typeof f=="string"?f:f[0],ast:U(l,!0,p)})),c={limits:t.limits?{maxIterations:t.limits.maxJqIterations,maxStringLength:t.limits.maxStringLength}:void 0};if(W(r.length,m.length,"xan flatmap")>t.limits.maxArrayElements)throw new E(`xan flatmap: output column limit exceeded (${t.limits.maxArrayElements})`,"array_elements");let a=[...r,...m.map(l=>l.alias)],d=[],u=new $(t,"xan flatmap");for(let l of o){let f=[],x=1;for(let g of m){u.consumeWork();let y=V(l,g.ast,c),w=y.length>0&&Array.isArray(y[0])?y[0]:y;if(w.length>t.limits.maxArrayElements)throw new E(`xan flatmap: expression result limit exceeded (${t.limits.maxArrayElements})`,"array_elements");f.push(w),x=Math.max(x,w.length)}for(let g=0;g<x;g++){u.addRow(a.length);let y=j(l);for(let w=0;w<m.length;w++){let A=f[w][g]??null;b(y,m[w].alias,A)}d.push(y)}}return{stdout:C(a,d,t),stderr:"",exitCode:0}}async function Ke(e,t){let{cmdView:n}=await import("./xan-view-
|
|
64
|
+
`,exitCode:1};let{headers:r,data:o,error:i}=await k(s,t);if(i)return i;let p=z(t),m=X(n,p).map(({expr:l,name:f})=>({alias:typeof f=="string"?f:f[0],ast:U(l,!0,p)})),c={limits:t.limits?{maxIterations:t.limits.maxJqIterations,maxStringLength:t.limits.maxStringLength}:void 0};if(W(r.length,m.length,"xan flatmap")>t.limits.maxArrayElements)throw new E(`xan flatmap: output column limit exceeded (${t.limits.maxArrayElements})`,"array_elements");let a=[...r,...m.map(l=>l.alias)],d=[],u=new $(t,"xan flatmap");for(let l of o){let f=[],x=1;for(let g of m){u.consumeWork();let y=V(l,g.ast,c),w=y.length>0&&Array.isArray(y[0])?y[0]:y;if(w.length>t.limits.maxArrayElements)throw new E(`xan flatmap: expression result limit exceeded (${t.limits.maxArrayElements})`,"array_elements");f.push(w),x=Math.max(x,w.length)}for(let g=0;g<x;g++){u.addRow(a.length);let y=j(l);for(let w=0;w<m.length;w++){let A=f[w][g]??null;b(y,m[w].alias,A)}d.push(y)}}return{stdout:C(a,d,t),stderr:"",exitCode:0}}async function Ke(e,t){let{cmdView:n}=await import("./xan-view-GJVN6IHX.js");return n(e,t)}var dt=new Set(["fuzzy-join","glob","hist","input","parallel","plot","progress","range","scrape","tokenize","union-find"]),St=new Set(["agg","behead","cat","count","dedup","drop","enum","explode","f","filter","fixlengths","flatmap","flatten","fmt","frequency","freq","from","groupby","head","headers","implode","join","map","merge","partition","pivot","rename","reverse","sample","search","select","shuffle","slice","sort","split","stats","tail","to","top","transform","transpose","view",...dt]),pt={name:"xan",summary:"CSV toolkit for data manipulation",usage:"xan <COMMAND> [OPTIONS] [FILE]",description:`xan is a collection of commands for working with CSV data.
|
|
65
65
|
It provides a simple, ergonomic interface for common data operations.
|
|
66
66
|
|
|
67
67
|
COMMANDS:
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
2
|
-
import{a as w}from"./chunk-WZQNMEQW.js";import{b as m}from"./chunk-
|
|
2
|
+
import{a as w}from"./chunk-WZQNMEQW.js";import{b as m}from"./chunk-A3C4Z3Q3.js";import{e as v}from"./chunk-ZUEPJPYA.js";import{e as B}from"./chunk-CM4T4GB4.js";import{l as z}from"./chunk-TVCZIH6M.js";import{a as L}from"./chunk-QIQMJJZ4.js";import{a as F,b as E}from"./chunk-QAYAQNCG.js";import{constants as C,gunzipSync as _,gzipSync as A}from"node:zlib";var D={name:"gzip",summary:"compress or expand files",usage:"gzip [OPTION]... [FILE]...",description:`Compress FILEs (by default, in-place).
|
|
3
3
|
|
|
4
4
|
When no FILE is given, or when FILE is -, read from standard input.
|
|
5
5
|
|