@keystrokehq/cli 0.1.3 → 0.1.4
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/dist/alias-RTYYYW3D-CLFgrowj.mjs +98 -0
- package/dist/alias-RTYYYW3D-CLFgrowj.mjs.map +1 -0
- package/dist/awk2-LA3USKJP-BbsfXVlR.mjs +2737 -0
- package/dist/awk2-LA3USKJP-BbsfXVlR.mjs.map +1 -0
- package/dist/base64-C2AIWVNC-C0WIgu5V.mjs +123 -0
- package/dist/base64-C2AIWVNC-C0WIgu5V.mjs.map +1 -0
- package/dist/basename-UB3CIYNI-BgNN3bGm.mjs +53 -0
- package/dist/basename-UB3CIYNI-BgNN3bGm.mjs.map +1 -0
- package/dist/bash-YZ33HQZQ-N6YyKtUH.mjs +118 -0
- package/dist/bash-YZ33HQZQ-N6YyKtUH.mjs.map +1 -0
- package/dist/cat-TSFMZVYS-Dz3-oHsV.mjs +63 -0
- package/dist/cat-TSFMZVYS-Dz3-oHsV.mjs.map +1 -0
- package/dist/chmod-TFEPA42X-YF02QJUv.mjs +125 -0
- package/dist/chmod-TFEPA42X-YF02QJUv.mjs.map +1 -0
- package/dist/chunk-27JIFWUR-B6ZjjMMI.mjs +100 -0
- package/dist/chunk-27JIFWUR-B6ZjjMMI.mjs.map +1 -0
- package/dist/chunk-4I3HOE5Z-BixWWVkW.mjs +719 -0
- package/dist/chunk-4I3HOE5Z-BixWWVkW.mjs.map +1 -0
- package/dist/chunk-4RUAZWKT-D60fyWAB.mjs +22543 -0
- package/dist/chunk-4RUAZWKT-D60fyWAB.mjs.map +1 -0
- package/dist/chunk-4WKZNNJK-CiwxAWRf.mjs +69 -0
- package/dist/chunk-4WKZNNJK-CiwxAWRf.mjs.map +1 -0
- package/dist/chunk-5H5SCKJM-BvfXlL01.mjs +606 -0
- package/dist/chunk-5H5SCKJM-BvfXlL01.mjs.map +1 -0
- package/dist/chunk-AQ6FYS2X-CkVetjym.mjs +37 -0
- package/dist/chunk-AQ6FYS2X-CkVetjym.mjs.map +1 -0
- package/dist/chunk-BZUGFHVS-CPWRFwK8.mjs +34 -0
- package/dist/chunk-BZUGFHVS-CPWRFwK8.mjs.map +1 -0
- package/dist/chunk-CHFEPBH4-BUdgjFtD.mjs +594 -0
- package/dist/chunk-CHFEPBH4-BUdgjFtD.mjs.map +1 -0
- package/dist/chunk-DLL7UR66-BUYgzxnR.mjs +14 -0
- package/dist/chunk-DLL7UR66-BUYgzxnR.mjs.map +1 -0
- package/dist/chunk-DiodbrVj.mjs +27 -0
- package/dist/chunk-EBAPSGAO-Ctfslw2R.mjs +247 -0
- package/dist/chunk-EBAPSGAO-Ctfslw2R.mjs.map +1 -0
- package/dist/chunk-FOCWZZDE-BIntqBh2.mjs +19 -0
- package/dist/chunk-FOCWZZDE-BIntqBh2.mjs.map +1 -0
- package/dist/chunk-HBVMHTO5-CJyD-QZX.mjs +10 -0
- package/dist/chunk-HBVMHTO5-CJyD-QZX.mjs.map +1 -0
- package/dist/chunk-L2UW7DWF-B3tEHhPF.mjs +14 -0
- package/dist/chunk-L2UW7DWF-B3tEHhPF.mjs.map +1 -0
- package/dist/chunk-L64BMZUV-CyR7RKok.mjs +30 -0
- package/dist/chunk-L64BMZUV-CyR7RKok.mjs.map +1 -0
- package/dist/chunk-LEKBROJD-CJMrAyu9.mjs +3113 -0
- package/dist/chunk-LEKBROJD-CJMrAyu9.mjs.map +1 -0
- package/dist/chunk-NRSASXYY-CuWyREpD.mjs +41 -0
- package/dist/chunk-NRSASXYY-CuWyREpD.mjs.map +1 -0
- package/dist/chunk-QAYAQNCG-Bl0Kbd53.mjs +63 -0
- package/dist/chunk-QAYAQNCG-Bl0Kbd53.mjs.map +1 -0
- package/dist/chunk-QIQMJJZ4-BwKdslXs.mjs +93 -0
- package/dist/chunk-QIQMJJZ4-BwKdslXs.mjs.map +1 -0
- package/dist/chunk-SAI2SPQQ-CVRoDNs9.mjs +26 -0
- package/dist/chunk-SAI2SPQQ-CVRoDNs9.mjs.map +1 -0
- package/dist/chunk-SO6R3ZKN-tTw_RMDX.mjs +140 -0
- package/dist/chunk-SO6R3ZKN-tTw_RMDX.mjs.map +1 -0
- package/dist/chunk-STHBFACM-lyj-j2a-.mjs +8 -0
- package/dist/chunk-STHBFACM-lyj-j2a-.mjs.map +1 -0
- package/dist/chunk-SX2HC7SO-Cc4Hpis1.mjs +20 -0
- package/dist/chunk-SX2HC7SO-Cc4Hpis1.mjs.map +1 -0
- package/dist/chunk-TDD4NFYE-wsWW75MX.mjs +21 -0
- package/dist/chunk-TDD4NFYE-wsWW75MX.mjs.map +1 -0
- package/dist/chunk-TN7HHBQW-CSB_R-XD.mjs +1137 -0
- package/dist/chunk-TN7HHBQW-CSB_R-XD.mjs.map +1 -0
- package/dist/chunk-VPADYNBD-BKlA28GJ.mjs +122 -0
- package/dist/chunk-VPADYNBD-BKlA28GJ.mjs.map +1 -0
- package/dist/chunk-W5DWRFSU-lCyWk0ph.mjs +11 -0
- package/dist/chunk-W5DWRFSU-lCyWk0ph.mjs.map +1 -0
- package/dist/chunk-WNH3HOQA-BCZUOjCJ.mjs +34 -0
- package/dist/chunk-WNH3HOQA-BCZUOjCJ.mjs.map +1 -0
- package/dist/chunk-XRFHFXFP-BGxzVZgK.mjs +16 -0
- package/dist/chunk-XRFHFXFP-BGxzVZgK.mjs.map +1 -0
- package/dist/chunk-YCLFEX4T-COc1AThz.mjs +77 -0
- package/dist/chunk-YCLFEX4T-COc1AThz.mjs.map +1 -0
- package/dist/clear-HKGFEOF6-CekN2x-O.mjs +28 -0
- package/dist/clear-HKGFEOF6-CekN2x-O.mjs.map +1 -0
- package/dist/column-XT6UFXNQ-DHENV9D2.mjs +143 -0
- package/dist/column-XT6UFXNQ-DHENV9D2.mjs.map +1 -0
- package/dist/comm-VV2LDX2J-ppxDJFkY.mjs +87 -0
- package/dist/comm-VV2LDX2J-ppxDJFkY.mjs.map +1 -0
- package/dist/cp-BISAAS7A-CMWayU4n.mjs +106 -0
- package/dist/cp-BISAAS7A-CMWayU4n.mjs.map +1 -0
- package/dist/cut-OKARJCCV-Bt8b58eI.mjs +119 -0
- package/dist/cut-OKARJCCV-Bt8b58eI.mjs.map +1 -0
- package/dist/date-UUUPW43J-B7T5OTZZ.mjs +188 -0
- package/dist/date-UUUPW43J-B7T5OTZZ.mjs.map +1 -0
- package/dist/diff-MWJFIG7X-DhnPc_5r.mjs +755 -0
- package/dist/diff-MWJFIG7X-DhnPc_5r.mjs.map +1 -0
- package/dist/dirname-MPHRFUTI-Dkb3S4OX.mjs +43 -0
- package/dist/dirname-MPHRFUTI-Dkb3S4OX.mjs.map +1 -0
- package/dist/{dist-DjfxlOWX.mjs → dist-C47GdlWY.mjs} +18 -93
- package/dist/{dist-DjfxlOWX.mjs.map → dist-C47GdlWY.mjs.map} +1 -1
- package/dist/{dist-DWcRd4Se.mjs → dist-CJL2zYbP.mjs} +4 -71
- package/dist/dist-CJL2zYbP.mjs.map +1 -0
- package/dist/dist-Ch53z2P3.mjs +3 -0
- package/dist/dist-CwR72_PS.mjs +1887 -0
- package/dist/dist-CwR72_PS.mjs.map +1 -0
- package/dist/du-572XNP42-ClP4jXB1.mjs +176 -0
- package/dist/du-572XNP42-ClP4jXB1.mjs.map +1 -0
- package/dist/echo-NDWZZHPO-CCp_-MxA.mjs +137 -0
- package/dist/echo-NDWZZHPO-CCp_-MxA.mjs.map +1 -0
- package/dist/env-36M5BO7M-CsP_aiWr.mjs +119 -0
- package/dist/env-36M5BO7M-CsP_aiWr.mjs.map +1 -0
- package/dist/expand-JSPG6VOP-B-YUvYpu.mjs +145 -0
- package/dist/expand-JSPG6VOP-B-YUvYpu.mjs.map +1 -0
- package/dist/expr-5JAACS4X-1TBq84gG.mjs +153 -0
- package/dist/expr-5JAACS4X-1TBq84gG.mjs.map +1 -0
- package/dist/file-IPZJC3FQ-DcZNOWyY.mjs +4201 -0
- package/dist/file-IPZJC3FQ-DcZNOWyY.mjs.map +1 -0
- package/dist/find-INTH3OLC-6p47KeeT.mjs +1332 -0
- package/dist/find-INTH3OLC-6p47KeeT.mjs.map +1 -0
- package/dist/fold-4TQNYMSW-C54bHzLd.mjs +138 -0
- package/dist/fold-4TQNYMSW-C54bHzLd.mjs.map +1 -0
- package/dist/grep-V3LQVMRQ-D99Bq7Kj.mjs +335 -0
- package/dist/grep-V3LQVMRQ-D99Bq7Kj.mjs.map +1 -0
- package/dist/gzip-O5ASJAFY-CZDRROqP.mjs +592 -0
- package/dist/gzip-O5ASJAFY-CZDRROqP.mjs.map +1 -0
- package/dist/head-442HYESI-D96RMdki.mjs +36 -0
- package/dist/head-442HYESI-D96RMdki.mjs.map +1 -0
- package/dist/help-HZ6M2CKN--DK8mY2L.mjs +123 -0
- package/dist/help-HZ6M2CKN--DK8mY2L.mjs.map +1 -0
- package/dist/history-WYYKSLSZ-ACNQVupn.mjs +48 -0
- package/dist/history-WYYKSLSZ-ACNQVupn.mjs.map +1 -0
- package/dist/hostname-C4HQXXUP-CXVVFkUK.mjs +24 -0
- package/dist/hostname-C4HQXXUP-CXVVFkUK.mjs.map +1 -0
- package/dist/html-to-markdown-JW4MSQZO-DQOxFIvF.mjs +15890 -0
- package/dist/html-to-markdown-JW4MSQZO-DQOxFIvF.mjs.map +1 -0
- package/dist/index.mjs +9 -9
- package/dist/join-TBRGI3LQ-B8I9tkJ5.mjs +198 -0
- package/dist/join-TBRGI3LQ-B8I9tkJ5.mjs.map +1 -0
- package/dist/jq-4XLYLOS5-wFZYfsfJ.mjs +257 -0
- package/dist/jq-4XLYLOS5-wFZYfsfJ.mjs.map +1 -0
- package/dist/js-exec-N5KEZBH7-CgtG-I6s.mjs +333 -0
- package/dist/js-exec-N5KEZBH7-CgtG-I6s.mjs.map +1 -0
- package/dist/lib-D4GpdNNK.mjs +45 -0
- package/dist/lib-D4GpdNNK.mjs.map +1 -0
- package/dist/ln-4LGSXXGD-Dg0R9i5G.mjs +101 -0
- package/dist/ln-4LGSXXGD-Dg0R9i5G.mjs.map +1 -0
- package/dist/ls-ZJGQER7M-DLDSfI4x.mjs +1891 -0
- package/dist/ls-ZJGQER7M-DLDSfI4x.mjs.map +1 -0
- package/dist/lzma-CTMDi254.mjs +1135 -0
- package/dist/lzma-CTMDi254.mjs.map +1 -0
- package/dist/{maybe-auto-update-Ou7H6dXT.mjs → maybe-auto-update-B0kal2FM.mjs} +2 -2
- package/dist/{maybe-auto-update-Ou7H6dXT.mjs.map → maybe-auto-update-B0kal2FM.mjs.map} +1 -1
- package/dist/md5sum-SPU24VSG-DQc8sqXO.mjs +16 -0
- package/dist/md5sum-SPU24VSG-DQc8sqXO.mjs.map +1 -0
- package/dist/mkdir-MEPGZOB6-BjUKzhdL.mjs +58 -0
- package/dist/mkdir-MEPGZOB6-BjUKzhdL.mjs.map +1 -0
- package/dist/mv-W5BIQ646-CdSIyY-U.mjs +93 -0
- package/dist/mv-W5BIQ646-CdSIyY-U.mjs.map +1 -0
- package/dist/nl-WSDW7I4O-DmtCnyKU.mjs +208 -0
- package/dist/nl-WSDW7I4O-DmtCnyKU.mjs.map +1 -0
- package/dist/od-WOKFDJTP-DZ2nxQNJ.mjs +73 -0
- package/dist/od-WOKFDJTP-DZ2nxQNJ.mjs.map +1 -0
- package/dist/paste-7JC6S4DX-CtmM5Qy8.mjs +113 -0
- package/dist/paste-7JC6S4DX-CtmM5Qy8.mjs.map +1 -0
- package/dist/printf-TWGXF445-B7cTysaa.mjs +880 -0
- package/dist/printf-TWGXF445-B7cTysaa.mjs.map +1 -0
- package/dist/pwd-WE6EN5AV-CO8o2WQS.mjs +34 -0
- package/dist/pwd-WE6EN5AV-CO8o2WQS.mjs.map +1 -0
- package/dist/python3-POMOR4OA-CKy80mpF.mjs +299 -0
- package/dist/python3-POMOR4OA-CKy80mpF.mjs.map +1 -0
- package/dist/readlink-OPJF4DL5-Rc1Mz_Xx.mjs +76 -0
- package/dist/readlink-OPJF4DL5-Rc1Mz_Xx.mjs.map +1 -0
- package/dist/rev-5EHFX4EJ-3dd9vwHW.mjs +66 -0
- package/dist/rev-5EHFX4EJ-3dd9vwHW.mjs.map +1 -0
- package/dist/rg-S4FXYXWB-BbXVo6JX.mjs +1539 -0
- package/dist/rg-S4FXYXWB-BbXVo6JX.mjs.map +1 -0
- package/dist/rm-SSGETQVQ-Ch53Rmrr.mjs +81 -0
- package/dist/rm-SSGETQVQ-Ch53Rmrr.mjs.map +1 -0
- package/dist/rmdir-OC4ZLPYA-D3QCHlIB.mjs +132 -0
- package/dist/rmdir-OC4ZLPYA-D3QCHlIB.mjs.map +1 -0
- package/dist/sed-S5UIK574-DE1KeTk3.mjs +1722 -0
- package/dist/sed-S5UIK574-DE1KeTk3.mjs.map +1 -0
- package/dist/seq-M5EC7Q57-BHfGjQvK.mjs +85 -0
- package/dist/seq-M5EC7Q57-BHfGjQvK.mjs.map +1 -0
- package/dist/sha1sum-2PTOAFR6-DNjSNcYK.mjs +16 -0
- package/dist/sha1sum-2PTOAFR6-DNjSNcYK.mjs.map +1 -0
- package/dist/sha256sum-NS7D3IXX-BMaCKkT5.mjs +16 -0
- package/dist/sha256sum-NS7D3IXX-BMaCKkT5.mjs.map +1 -0
- package/dist/sleep-X22JJINO-Do5hEQQW.mjs +67 -0
- package/dist/sleep-X22JJINO-Do5hEQQW.mjs.map +1 -0
- package/dist/sort-SW2YEO5B-B7j1zw8k.mjs +320 -0
- package/dist/sort-SW2YEO5B-B7j1zw8k.mjs.map +1 -0
- package/dist/split-4KKZZXXE-h8GD4HP4.mjs +248 -0
- package/dist/split-4KKZZXXE-h8GD4HP4.mjs.map +1 -0
- package/dist/sqlite3-CGOEFJAO-DvzzghDg.mjs +2879 -0
- package/dist/sqlite3-CGOEFJAO-DvzzghDg.mjs.map +1 -0
- package/dist/stat-CD34IZ4P-B5ZOJh4J.mjs +65 -0
- package/dist/stat-CD34IZ4P-B5ZOJh4J.mjs.map +1 -0
- package/dist/strings-6WDHLGMX-DdiEdoL-.mjs +179 -0
- package/dist/strings-6WDHLGMX-DdiEdoL-.mjs.map +1 -0
- package/dist/tac-2STMMJYW-DPyeWM9R.mjs +53 -0
- package/dist/tac-2STMMJYW-DPyeWM9R.mjs.map +1 -0
- package/dist/tail-R4PCA2C4-CUfroNeu.mjs +37 -0
- package/dist/tail-R4PCA2C4-CUfroNeu.mjs.map +1 -0
- package/dist/tar-STHHZTZ6-DRf60e-G.mjs +2838 -0
- package/dist/tar-STHHZTZ6-DRf60e-G.mjs.map +1 -0
- package/dist/tee-YUZ2FKCJ-po_dfyc_.mjs +46 -0
- package/dist/tee-YUZ2FKCJ-po_dfyc_.mjs.map +1 -0
- package/dist/time-D4LNBSWX-DVWhAldK.mjs +112 -0
- package/dist/time-D4LNBSWX-DVWhAldK.mjs.map +1 -0
- package/dist/timeout-YDCRSLPQ-B_yntmXU.mjs +113 -0
- package/dist/timeout-YDCRSLPQ-B_yntmXU.mjs.map +1 -0
- package/dist/touch-UA33VN3N-oW1SBT1r.mjs +104 -0
- package/dist/touch-UA33VN3N-oW1SBT1r.mjs.map +1 -0
- package/dist/tr-36LHWFRQ-CTq3z6wq.mjs +167 -0
- package/dist/tr-36LHWFRQ-CTq3z6wq.mjs.map +1 -0
- package/dist/tree-YLD52CNT-CIozNsLQ.mjs +186 -0
- package/dist/tree-YLD52CNT-CIozNsLQ.mjs.map +1 -0
- package/dist/true-FHQXJXBE-DsJOznSp.mjs +31 -0
- package/dist/true-FHQXJXBE-DsJOznSp.mjs.map +1 -0
- package/dist/unexpand-CADSA4VO-Cq9DTcUg.mjs +155 -0
- package/dist/unexpand-CADSA4VO-Cq9DTcUg.mjs.map +1 -0
- package/dist/uniq-XSIZR6PB-D5lt-IXF.mjs +92 -0
- package/dist/uniq-XSIZR6PB-D5lt-IXF.mjs.map +1 -0
- package/dist/{version-n-JpPeUF.mjs → version-Dxl3y5p6.mjs} +2 -2
- package/dist/{version-n-JpPeUF.mjs.map → version-Dxl3y5p6.mjs.map} +1 -1
- package/dist/wc-LF7NU4LA-BFPabrwD.mjs +111 -0
- package/dist/wc-LF7NU4LA-BFPabrwD.mjs.map +1 -0
- package/dist/which-XEM24D5D-2LvlkpUo.mjs +62 -0
- package/dist/which-XEM24D5D-2LvlkpUo.mjs.map +1 -0
- package/dist/whoami-XMTX52VE-24Kwqrk6.mjs +24 -0
- package/dist/whoami-XMTX52VE-24Kwqrk6.mjs.map +1 -0
- package/dist/xan-Y6WF3IRG-DjKO96Pj.mjs +2832 -0
- package/dist/xan-Y6WF3IRG-DjKO96Pj.mjs.map +1 -0
- package/dist/xan-view-HDVKHFC2-DhDNVE_V.mjs +12 -0
- package/dist/xan-view-HDVKHFC2-DhDNVE_V.mjs.map +1 -0
- package/dist/xargs-MGZPH7AX-D2bIgrdg.mjs +112 -0
- package/dist/xargs-MGZPH7AX-D2bIgrdg.mjs.map +1 -0
- package/dist/yq-4QJW3EQG-XhB3aACo.mjs +8610 -0
- package/dist/yq-4QJW3EQG-XhB3aACo.mjs.map +1 -0
- package/package.json +1 -1
- package/dist/dist-DWcRd4Se.mjs.map +0 -1
- package/dist/dist-DitNZUHA.mjs +0 -3
- package/dist/dist-vwoMCz6d.mjs +0 -775
- package/dist/dist-vwoMCz6d.mjs.map +0 -1
|
@@ -0,0 +1,1891 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { r as s, t as o } from "./chunk-QAYAQNCG-Bl0Kbd53.mjs";
|
|
3
|
+
import "./chunk-BZUGFHVS-CPWRFwK8.mjs";
|
|
4
|
+
import { t as x } from "./chunk-QIQMJJZ4-BwKdslXs.mjs";
|
|
5
|
+
import "./chunk-STHBFACM-lyj-j2a-.mjs";
|
|
6
|
+
import { createRequire } from "node:module";
|
|
7
|
+
//#region ../../node_modules/.pnpm/balanced-match@4.0.4/node_modules/balanced-match/dist/esm/index.js
|
|
8
|
+
const balanced = (a, b, str) => {
|
|
9
|
+
const ma = a instanceof RegExp ? maybeMatch(a, str) : a;
|
|
10
|
+
const mb = b instanceof RegExp ? maybeMatch(b, str) : b;
|
|
11
|
+
const r = ma !== null && mb != null && range(ma, mb, str);
|
|
12
|
+
return r && {
|
|
13
|
+
start: r[0],
|
|
14
|
+
end: r[1],
|
|
15
|
+
pre: str.slice(0, r[0]),
|
|
16
|
+
body: str.slice(r[0] + ma.length, r[1]),
|
|
17
|
+
post: str.slice(r[1] + mb.length)
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
const maybeMatch = (reg, str) => {
|
|
21
|
+
const m = str.match(reg);
|
|
22
|
+
return m ? m[0] : null;
|
|
23
|
+
};
|
|
24
|
+
const range = (a, b, str) => {
|
|
25
|
+
let begs, beg, left, right = void 0, result;
|
|
26
|
+
let ai = str.indexOf(a);
|
|
27
|
+
let bi = str.indexOf(b, ai + 1);
|
|
28
|
+
let i = ai;
|
|
29
|
+
if (ai >= 0 && bi > 0) {
|
|
30
|
+
if (a === b) return [ai, bi];
|
|
31
|
+
begs = [];
|
|
32
|
+
left = str.length;
|
|
33
|
+
while (i >= 0 && !result) {
|
|
34
|
+
if (i === ai) {
|
|
35
|
+
begs.push(i);
|
|
36
|
+
ai = str.indexOf(a, i + 1);
|
|
37
|
+
} else if (begs.length === 1) {
|
|
38
|
+
const r = begs.pop();
|
|
39
|
+
if (r !== void 0) result = [r, bi];
|
|
40
|
+
} else {
|
|
41
|
+
beg = begs.pop();
|
|
42
|
+
if (beg !== void 0 && beg < left) {
|
|
43
|
+
left = beg;
|
|
44
|
+
right = bi;
|
|
45
|
+
}
|
|
46
|
+
bi = str.indexOf(b, i + 1);
|
|
47
|
+
}
|
|
48
|
+
i = ai < bi && ai >= 0 ? ai : bi;
|
|
49
|
+
}
|
|
50
|
+
if (begs.length && right !== void 0) result = [left, right];
|
|
51
|
+
}
|
|
52
|
+
return result;
|
|
53
|
+
};
|
|
54
|
+
//#endregion
|
|
55
|
+
//#region ../../node_modules/.pnpm/brace-expansion@5.0.6/node_modules/brace-expansion/dist/esm/index.js
|
|
56
|
+
const escSlash = "\0SLASH" + Math.random() + "\0";
|
|
57
|
+
const escOpen = "\0OPEN" + Math.random() + "\0";
|
|
58
|
+
const escClose = "\0CLOSE" + Math.random() + "\0";
|
|
59
|
+
const escComma = "\0COMMA" + Math.random() + "\0";
|
|
60
|
+
const escPeriod = "\0PERIOD" + Math.random() + "\0";
|
|
61
|
+
const escSlashPattern = new RegExp(escSlash, "g");
|
|
62
|
+
const escOpenPattern = new RegExp(escOpen, "g");
|
|
63
|
+
const escClosePattern = new RegExp(escClose, "g");
|
|
64
|
+
const escCommaPattern = new RegExp(escComma, "g");
|
|
65
|
+
const escPeriodPattern = new RegExp(escPeriod, "g");
|
|
66
|
+
const slashPattern = /\\\\/g;
|
|
67
|
+
const openPattern = /\\{/g;
|
|
68
|
+
const closePattern = /\\}/g;
|
|
69
|
+
const commaPattern = /\\,/g;
|
|
70
|
+
const periodPattern = /\\\./g;
|
|
71
|
+
const EXPANSION_MAX = 1e5;
|
|
72
|
+
function numeric(str) {
|
|
73
|
+
return !isNaN(str) ? parseInt(str, 10) : str.charCodeAt(0);
|
|
74
|
+
}
|
|
75
|
+
function escapeBraces(str) {
|
|
76
|
+
return str.replace(slashPattern, escSlash).replace(openPattern, escOpen).replace(closePattern, escClose).replace(commaPattern, escComma).replace(periodPattern, escPeriod);
|
|
77
|
+
}
|
|
78
|
+
function unescapeBraces(str) {
|
|
79
|
+
return str.replace(escSlashPattern, "\\").replace(escOpenPattern, "{").replace(escClosePattern, "}").replace(escCommaPattern, ",").replace(escPeriodPattern, ".");
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Basically just str.split(","), but handling cases
|
|
83
|
+
* where we have nested braced sections, which should be
|
|
84
|
+
* treated as individual members, like {a,{b,c},d}
|
|
85
|
+
*/
|
|
86
|
+
function parseCommaParts(str) {
|
|
87
|
+
if (!str) return [""];
|
|
88
|
+
const parts = [];
|
|
89
|
+
const m = balanced("{", "}", str);
|
|
90
|
+
if (!m) return str.split(",");
|
|
91
|
+
const { pre, body, post } = m;
|
|
92
|
+
const p = pre.split(",");
|
|
93
|
+
p[p.length - 1] += "{" + body + "}";
|
|
94
|
+
const postParts = parseCommaParts(post);
|
|
95
|
+
if (post.length) {
|
|
96
|
+
p[p.length - 1] += postParts.shift();
|
|
97
|
+
p.push.apply(p, postParts);
|
|
98
|
+
}
|
|
99
|
+
parts.push.apply(parts, p);
|
|
100
|
+
return parts;
|
|
101
|
+
}
|
|
102
|
+
function expand(str, options = {}) {
|
|
103
|
+
if (!str) return [];
|
|
104
|
+
const { max = EXPANSION_MAX } = options;
|
|
105
|
+
if (str.slice(0, 2) === "{}") str = "\\{\\}" + str.slice(2);
|
|
106
|
+
return expand_(escapeBraces(str), max, true).map(unescapeBraces);
|
|
107
|
+
}
|
|
108
|
+
function embrace(str) {
|
|
109
|
+
return "{" + str + "}";
|
|
110
|
+
}
|
|
111
|
+
function isPadded(el) {
|
|
112
|
+
return /^-?0\d/.test(el);
|
|
113
|
+
}
|
|
114
|
+
function lte(i, y) {
|
|
115
|
+
return i <= y;
|
|
116
|
+
}
|
|
117
|
+
function gte(i, y) {
|
|
118
|
+
return i >= y;
|
|
119
|
+
}
|
|
120
|
+
function expand_(str, max, isTop) {
|
|
121
|
+
/** @type {string[]} */
|
|
122
|
+
const expansions = [];
|
|
123
|
+
const m = balanced("{", "}", str);
|
|
124
|
+
if (!m) return [str];
|
|
125
|
+
const pre = m.pre;
|
|
126
|
+
const post = m.post.length ? expand_(m.post, max, false) : [""];
|
|
127
|
+
if (/\$$/.test(m.pre)) for (let k = 0; k < post.length && k < max; k++) {
|
|
128
|
+
const expansion = pre + "{" + m.body + "}" + post[k];
|
|
129
|
+
expansions.push(expansion);
|
|
130
|
+
}
|
|
131
|
+
else {
|
|
132
|
+
const isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body);
|
|
133
|
+
const isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body);
|
|
134
|
+
const isSequence = isNumericSequence || isAlphaSequence;
|
|
135
|
+
const isOptions = m.body.indexOf(",") >= 0;
|
|
136
|
+
if (!isSequence && !isOptions) {
|
|
137
|
+
if (m.post.match(/,(?!,).*\}/)) {
|
|
138
|
+
str = m.pre + "{" + m.body + escClose + m.post;
|
|
139
|
+
return expand_(str, max, true);
|
|
140
|
+
}
|
|
141
|
+
return [str];
|
|
142
|
+
}
|
|
143
|
+
let n;
|
|
144
|
+
if (isSequence) n = m.body.split(/\.\./);
|
|
145
|
+
else {
|
|
146
|
+
n = parseCommaParts(m.body);
|
|
147
|
+
if (n.length === 1 && n[0] !== void 0) {
|
|
148
|
+
n = expand_(n[0], max, false).map(embrace);
|
|
149
|
+
/* c8 ignore start */
|
|
150
|
+
if (n.length === 1) return post.map((p) => m.pre + n[0] + p);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
let N;
|
|
154
|
+
if (isSequence && n[0] !== void 0 && n[1] !== void 0) {
|
|
155
|
+
const x = numeric(n[0]);
|
|
156
|
+
const y = numeric(n[1]);
|
|
157
|
+
const width = Math.max(n[0].length, n[1].length);
|
|
158
|
+
let incr = n.length === 3 && n[2] !== void 0 ? Math.max(Math.abs(numeric(n[2])), 1) : 1;
|
|
159
|
+
let test = lte;
|
|
160
|
+
if (y < x) {
|
|
161
|
+
incr *= -1;
|
|
162
|
+
test = gte;
|
|
163
|
+
}
|
|
164
|
+
const pad = n.some(isPadded);
|
|
165
|
+
N = [];
|
|
166
|
+
for (let i = x; test(i, y) && N.length < max; i += incr) {
|
|
167
|
+
let c;
|
|
168
|
+
if (isAlphaSequence) {
|
|
169
|
+
c = String.fromCharCode(i);
|
|
170
|
+
if (c === "\\") c = "";
|
|
171
|
+
} else {
|
|
172
|
+
c = String(i);
|
|
173
|
+
if (pad) {
|
|
174
|
+
const need = width - c.length;
|
|
175
|
+
if (need > 0) {
|
|
176
|
+
const z = new Array(need + 1).join("0");
|
|
177
|
+
if (i < 0) c = "-" + z + c.slice(1);
|
|
178
|
+
else c = z + c;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
N.push(c);
|
|
183
|
+
}
|
|
184
|
+
} else {
|
|
185
|
+
N = [];
|
|
186
|
+
for (let j = 0; j < n.length; j++) N.push.apply(N, expand_(n[j], max, false));
|
|
187
|
+
}
|
|
188
|
+
for (let j = 0; j < N.length; j++) for (let k = 0; k < post.length && expansions.length < max; k++) {
|
|
189
|
+
const expansion = pre + N[j] + post[k];
|
|
190
|
+
if (!isTop || isSequence || expansion) expansions.push(expansion);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
return expansions;
|
|
194
|
+
}
|
|
195
|
+
//#endregion
|
|
196
|
+
//#region ../../node_modules/.pnpm/minimatch@10.2.5/node_modules/minimatch/dist/esm/assert-valid-pattern.js
|
|
197
|
+
const MAX_PATTERN_LENGTH = 1024 * 64;
|
|
198
|
+
const assertValidPattern = (pattern) => {
|
|
199
|
+
if (typeof pattern !== "string") throw new TypeError("invalid pattern");
|
|
200
|
+
if (pattern.length > MAX_PATTERN_LENGTH) throw new TypeError("pattern is too long");
|
|
201
|
+
};
|
|
202
|
+
//#endregion
|
|
203
|
+
//#region ../../node_modules/.pnpm/minimatch@10.2.5/node_modules/minimatch/dist/esm/brace-expressions.js
|
|
204
|
+
const posixClasses = {
|
|
205
|
+
"[:alnum:]": ["\\p{L}\\p{Nl}\\p{Nd}", true],
|
|
206
|
+
"[:alpha:]": ["\\p{L}\\p{Nl}", true],
|
|
207
|
+
"[:ascii:]": ["\\x00-\\x7f", false],
|
|
208
|
+
"[:blank:]": ["\\p{Zs}\\t", true],
|
|
209
|
+
"[:cntrl:]": ["\\p{Cc}", true],
|
|
210
|
+
"[:digit:]": ["\\p{Nd}", true],
|
|
211
|
+
"[:graph:]": [
|
|
212
|
+
"\\p{Z}\\p{C}",
|
|
213
|
+
true,
|
|
214
|
+
true
|
|
215
|
+
],
|
|
216
|
+
"[:lower:]": ["\\p{Ll}", true],
|
|
217
|
+
"[:print:]": ["\\p{C}", true],
|
|
218
|
+
"[:punct:]": ["\\p{P}", true],
|
|
219
|
+
"[:space:]": ["\\p{Z}\\t\\r\\n\\v\\f", true],
|
|
220
|
+
"[:upper:]": ["\\p{Lu}", true],
|
|
221
|
+
"[:word:]": ["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}", true],
|
|
222
|
+
"[:xdigit:]": ["A-Fa-f0-9", false]
|
|
223
|
+
};
|
|
224
|
+
const braceEscape = (s) => s.replace(/[[\]\\-]/g, "\\$&");
|
|
225
|
+
const regexpEscape = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
|
226
|
+
const rangesToString = (ranges) => ranges.join("");
|
|
227
|
+
const parseClass = (glob, position) => {
|
|
228
|
+
const pos = position;
|
|
229
|
+
/* c8 ignore start */
|
|
230
|
+
if (glob.charAt(pos) !== "[") throw new Error("not in a brace expression");
|
|
231
|
+
/* c8 ignore stop */
|
|
232
|
+
const ranges = [];
|
|
233
|
+
const negs = [];
|
|
234
|
+
let i = pos + 1;
|
|
235
|
+
let sawStart = false;
|
|
236
|
+
let uflag = false;
|
|
237
|
+
let escaping = false;
|
|
238
|
+
let negate = false;
|
|
239
|
+
let endPos = pos;
|
|
240
|
+
let rangeStart = "";
|
|
241
|
+
WHILE: while (i < glob.length) {
|
|
242
|
+
const c = glob.charAt(i);
|
|
243
|
+
if ((c === "!" || c === "^") && i === pos + 1) {
|
|
244
|
+
negate = true;
|
|
245
|
+
i++;
|
|
246
|
+
continue;
|
|
247
|
+
}
|
|
248
|
+
if (c === "]" && sawStart && !escaping) {
|
|
249
|
+
endPos = i + 1;
|
|
250
|
+
break;
|
|
251
|
+
}
|
|
252
|
+
sawStart = true;
|
|
253
|
+
if (c === "\\") {
|
|
254
|
+
if (!escaping) {
|
|
255
|
+
escaping = true;
|
|
256
|
+
i++;
|
|
257
|
+
continue;
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
if (c === "[" && !escaping) {
|
|
261
|
+
for (const [cls, [unip, u, neg]] of Object.entries(posixClasses)) if (glob.startsWith(cls, i)) {
|
|
262
|
+
if (rangeStart) return [
|
|
263
|
+
"$.",
|
|
264
|
+
false,
|
|
265
|
+
glob.length - pos,
|
|
266
|
+
true
|
|
267
|
+
];
|
|
268
|
+
i += cls.length;
|
|
269
|
+
if (neg) negs.push(unip);
|
|
270
|
+
else ranges.push(unip);
|
|
271
|
+
uflag = uflag || u;
|
|
272
|
+
continue WHILE;
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
escaping = false;
|
|
276
|
+
if (rangeStart) {
|
|
277
|
+
if (c > rangeStart) ranges.push(braceEscape(rangeStart) + "-" + braceEscape(c));
|
|
278
|
+
else if (c === rangeStart) ranges.push(braceEscape(c));
|
|
279
|
+
rangeStart = "";
|
|
280
|
+
i++;
|
|
281
|
+
continue;
|
|
282
|
+
}
|
|
283
|
+
if (glob.startsWith("-]", i + 1)) {
|
|
284
|
+
ranges.push(braceEscape(c + "-"));
|
|
285
|
+
i += 2;
|
|
286
|
+
continue;
|
|
287
|
+
}
|
|
288
|
+
if (glob.startsWith("-", i + 1)) {
|
|
289
|
+
rangeStart = c;
|
|
290
|
+
i += 2;
|
|
291
|
+
continue;
|
|
292
|
+
}
|
|
293
|
+
ranges.push(braceEscape(c));
|
|
294
|
+
i++;
|
|
295
|
+
}
|
|
296
|
+
if (endPos < i) return [
|
|
297
|
+
"",
|
|
298
|
+
false,
|
|
299
|
+
0,
|
|
300
|
+
false
|
|
301
|
+
];
|
|
302
|
+
if (!ranges.length && !negs.length) return [
|
|
303
|
+
"$.",
|
|
304
|
+
false,
|
|
305
|
+
glob.length - pos,
|
|
306
|
+
true
|
|
307
|
+
];
|
|
308
|
+
if (negs.length === 0 && ranges.length === 1 && /^\\?.$/.test(ranges[0]) && !negate) return [
|
|
309
|
+
regexpEscape(ranges[0].length === 2 ? ranges[0].slice(-1) : ranges[0]),
|
|
310
|
+
false,
|
|
311
|
+
endPos - pos,
|
|
312
|
+
false
|
|
313
|
+
];
|
|
314
|
+
const sranges = "[" + (negate ? "^" : "") + rangesToString(ranges) + "]";
|
|
315
|
+
const snegs = "[" + (negate ? "" : "^") + rangesToString(negs) + "]";
|
|
316
|
+
return [
|
|
317
|
+
ranges.length && negs.length ? "(" + sranges + "|" + snegs + ")" : ranges.length ? sranges : snegs,
|
|
318
|
+
uflag,
|
|
319
|
+
endPos - pos,
|
|
320
|
+
true
|
|
321
|
+
];
|
|
322
|
+
};
|
|
323
|
+
//#endregion
|
|
324
|
+
//#region ../../node_modules/.pnpm/minimatch@10.2.5/node_modules/minimatch/dist/esm/unescape.js
|
|
325
|
+
/**
|
|
326
|
+
* Un-escape a string that has been escaped with {@link escape}.
|
|
327
|
+
*
|
|
328
|
+
* If the {@link MinimatchOptions.windowsPathsNoEscape} option is used, then
|
|
329
|
+
* square-bracket escapes are removed, but not backslash escapes.
|
|
330
|
+
*
|
|
331
|
+
* For example, it will turn the string `'[*]'` into `*`, but it will not
|
|
332
|
+
* turn `'\\*'` into `'*'`, because `\` is a path separator in
|
|
333
|
+
* `windowsPathsNoEscape` mode.
|
|
334
|
+
*
|
|
335
|
+
* When `windowsPathsNoEscape` is not set, then both square-bracket escapes and
|
|
336
|
+
* backslash escapes are removed.
|
|
337
|
+
*
|
|
338
|
+
* Slashes (and backslashes in `windowsPathsNoEscape` mode) cannot be escaped
|
|
339
|
+
* or unescaped.
|
|
340
|
+
*
|
|
341
|
+
* When `magicalBraces` is not set, escapes of braces (`{` and `}`) will not be
|
|
342
|
+
* unescaped.
|
|
343
|
+
*/
|
|
344
|
+
const unescape = (s, { windowsPathsNoEscape = false, magicalBraces = true } = {}) => {
|
|
345
|
+
if (magicalBraces) return windowsPathsNoEscape ? s.replace(/\[([^/\\])\]/g, "$1") : s.replace(/((?!\\).|^)\[([^/\\])\]/g, "$1$2").replace(/\\([^/])/g, "$1");
|
|
346
|
+
return windowsPathsNoEscape ? s.replace(/\[([^/\\{}])\]/g, "$1") : s.replace(/((?!\\).|^)\[([^/\\{}])\]/g, "$1$2").replace(/\\([^/{}])/g, "$1");
|
|
347
|
+
};
|
|
348
|
+
//#endregion
|
|
349
|
+
//#region ../../node_modules/.pnpm/minimatch@10.2.5/node_modules/minimatch/dist/esm/ast.js
|
|
350
|
+
var _a;
|
|
351
|
+
const types = new Set([
|
|
352
|
+
"!",
|
|
353
|
+
"?",
|
|
354
|
+
"+",
|
|
355
|
+
"*",
|
|
356
|
+
"@"
|
|
357
|
+
]);
|
|
358
|
+
const isExtglobType = (c) => types.has(c);
|
|
359
|
+
const isExtglobAST = (c) => isExtglobType(c.type);
|
|
360
|
+
const adoptionMap = new Map([
|
|
361
|
+
["!", ["@"]],
|
|
362
|
+
["?", ["?", "@"]],
|
|
363
|
+
["@", ["@"]],
|
|
364
|
+
["*", [
|
|
365
|
+
"*",
|
|
366
|
+
"+",
|
|
367
|
+
"?",
|
|
368
|
+
"@"
|
|
369
|
+
]],
|
|
370
|
+
["+", ["+", "@"]]
|
|
371
|
+
]);
|
|
372
|
+
const adoptionWithSpaceMap = new Map([
|
|
373
|
+
["!", ["?"]],
|
|
374
|
+
["@", ["?"]],
|
|
375
|
+
["+", ["?", "*"]]
|
|
376
|
+
]);
|
|
377
|
+
const adoptionAnyMap = new Map([
|
|
378
|
+
["!", ["?", "@"]],
|
|
379
|
+
["?", ["?", "@"]],
|
|
380
|
+
["@", ["?", "@"]],
|
|
381
|
+
["*", [
|
|
382
|
+
"*",
|
|
383
|
+
"+",
|
|
384
|
+
"?",
|
|
385
|
+
"@"
|
|
386
|
+
]],
|
|
387
|
+
["+", [
|
|
388
|
+
"+",
|
|
389
|
+
"@",
|
|
390
|
+
"?",
|
|
391
|
+
"*"
|
|
392
|
+
]]
|
|
393
|
+
]);
|
|
394
|
+
const usurpMap = new Map([
|
|
395
|
+
["!", new Map([["!", "@"]])],
|
|
396
|
+
["?", new Map([["*", "*"], ["+", "*"]])],
|
|
397
|
+
["@", new Map([
|
|
398
|
+
["!", "!"],
|
|
399
|
+
["?", "?"],
|
|
400
|
+
["@", "@"],
|
|
401
|
+
["*", "*"],
|
|
402
|
+
["+", "+"]
|
|
403
|
+
])],
|
|
404
|
+
["+", new Map([["?", "*"], ["*", "*"]])]
|
|
405
|
+
]);
|
|
406
|
+
const startNoTraversal = "(?!(?:^|/)\\.\\.?(?:$|/))";
|
|
407
|
+
const startNoDot = "(?!\\.)";
|
|
408
|
+
const addPatternStart = new Set(["[", "."]);
|
|
409
|
+
const justDots = new Set(["..", "."]);
|
|
410
|
+
const reSpecials = /* @__PURE__ */ new Set("().*{}+?[]^$\\!");
|
|
411
|
+
const regExpEscape$1 = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
|
412
|
+
const qmark = "[^/]";
|
|
413
|
+
const star$1 = "[^/]*?";
|
|
414
|
+
const starNoEmpty = "[^/]+?";
|
|
415
|
+
let ID = 0;
|
|
416
|
+
var AST = class {
|
|
417
|
+
type;
|
|
418
|
+
#root;
|
|
419
|
+
#hasMagic;
|
|
420
|
+
#uflag = false;
|
|
421
|
+
#parts = [];
|
|
422
|
+
#parent;
|
|
423
|
+
#parentIndex;
|
|
424
|
+
#negs;
|
|
425
|
+
#filledNegs = false;
|
|
426
|
+
#options;
|
|
427
|
+
#toString;
|
|
428
|
+
#emptyExt = false;
|
|
429
|
+
id = ++ID;
|
|
430
|
+
get depth() {
|
|
431
|
+
return (this.#parent?.depth ?? -1) + 1;
|
|
432
|
+
}
|
|
433
|
+
[Symbol.for("nodejs.util.inspect.custom")]() {
|
|
434
|
+
return {
|
|
435
|
+
"@@type": "AST",
|
|
436
|
+
id: this.id,
|
|
437
|
+
type: this.type,
|
|
438
|
+
root: this.#root.id,
|
|
439
|
+
parent: this.#parent?.id,
|
|
440
|
+
depth: this.depth,
|
|
441
|
+
partsLength: this.#parts.length,
|
|
442
|
+
parts: this.#parts
|
|
443
|
+
};
|
|
444
|
+
}
|
|
445
|
+
constructor(type, parent, options = {}) {
|
|
446
|
+
this.type = type;
|
|
447
|
+
if (type) this.#hasMagic = true;
|
|
448
|
+
this.#parent = parent;
|
|
449
|
+
this.#root = this.#parent ? this.#parent.#root : this;
|
|
450
|
+
this.#options = this.#root === this ? options : this.#root.#options;
|
|
451
|
+
this.#negs = this.#root === this ? [] : this.#root.#negs;
|
|
452
|
+
if (type === "!" && !this.#root.#filledNegs) this.#negs.push(this);
|
|
453
|
+
this.#parentIndex = this.#parent ? this.#parent.#parts.length : 0;
|
|
454
|
+
}
|
|
455
|
+
get hasMagic() {
|
|
456
|
+
/* c8 ignore start */
|
|
457
|
+
if (this.#hasMagic !== void 0) return this.#hasMagic;
|
|
458
|
+
/* c8 ignore stop */
|
|
459
|
+
for (const p of this.#parts) {
|
|
460
|
+
if (typeof p === "string") continue;
|
|
461
|
+
if (p.type || p.hasMagic) return this.#hasMagic = true;
|
|
462
|
+
}
|
|
463
|
+
return this.#hasMagic;
|
|
464
|
+
}
|
|
465
|
+
toString() {
|
|
466
|
+
return this.#toString !== void 0 ? this.#toString : !this.type ? this.#toString = this.#parts.map((p) => String(p)).join("") : this.#toString = this.type + "(" + this.#parts.map((p) => String(p)).join("|") + ")";
|
|
467
|
+
}
|
|
468
|
+
#fillNegs() {
|
|
469
|
+
/* c8 ignore start */
|
|
470
|
+
if (this !== this.#root) throw new Error("should only call on root");
|
|
471
|
+
if (this.#filledNegs) return this;
|
|
472
|
+
/* c8 ignore stop */
|
|
473
|
+
this.toString();
|
|
474
|
+
this.#filledNegs = true;
|
|
475
|
+
let n;
|
|
476
|
+
while (n = this.#negs.pop()) {
|
|
477
|
+
if (n.type !== "!") continue;
|
|
478
|
+
let p = n;
|
|
479
|
+
let pp = p.#parent;
|
|
480
|
+
while (pp) {
|
|
481
|
+
for (let i = p.#parentIndex + 1; !pp.type && i < pp.#parts.length; i++) for (const part of n.#parts) {
|
|
482
|
+
/* c8 ignore start */
|
|
483
|
+
if (typeof part === "string") throw new Error("string part in extglob AST??");
|
|
484
|
+
/* c8 ignore stop */
|
|
485
|
+
part.copyIn(pp.#parts[i]);
|
|
486
|
+
}
|
|
487
|
+
p = pp;
|
|
488
|
+
pp = p.#parent;
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
return this;
|
|
492
|
+
}
|
|
493
|
+
push(...parts) {
|
|
494
|
+
for (const p of parts) {
|
|
495
|
+
if (p === "") continue;
|
|
496
|
+
/* c8 ignore start */
|
|
497
|
+
if (typeof p !== "string" && !(p instanceof _a && p.#parent === this)) throw new Error("invalid part: " + p);
|
|
498
|
+
/* c8 ignore stop */
|
|
499
|
+
this.#parts.push(p);
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
toJSON() {
|
|
503
|
+
const ret = this.type === null ? this.#parts.slice().map((p) => typeof p === "string" ? p : p.toJSON()) : [this.type, ...this.#parts.map((p) => p.toJSON())];
|
|
504
|
+
if (this.isStart() && !this.type) ret.unshift([]);
|
|
505
|
+
if (this.isEnd() && (this === this.#root || this.#root.#filledNegs && this.#parent?.type === "!")) ret.push({});
|
|
506
|
+
return ret;
|
|
507
|
+
}
|
|
508
|
+
isStart() {
|
|
509
|
+
if (this.#root === this) return true;
|
|
510
|
+
if (!this.#parent?.isStart()) return false;
|
|
511
|
+
if (this.#parentIndex === 0) return true;
|
|
512
|
+
const p = this.#parent;
|
|
513
|
+
for (let i = 0; i < this.#parentIndex; i++) {
|
|
514
|
+
const pp = p.#parts[i];
|
|
515
|
+
if (!(pp instanceof _a && pp.type === "!")) return false;
|
|
516
|
+
}
|
|
517
|
+
return true;
|
|
518
|
+
}
|
|
519
|
+
isEnd() {
|
|
520
|
+
if (this.#root === this) return true;
|
|
521
|
+
if (this.#parent?.type === "!") return true;
|
|
522
|
+
if (!this.#parent?.isEnd()) return false;
|
|
523
|
+
if (!this.type) return this.#parent?.isEnd();
|
|
524
|
+
/* c8 ignore start */
|
|
525
|
+
const pl = this.#parent ? this.#parent.#parts.length : 0;
|
|
526
|
+
/* c8 ignore stop */
|
|
527
|
+
return this.#parentIndex === pl - 1;
|
|
528
|
+
}
|
|
529
|
+
copyIn(part) {
|
|
530
|
+
if (typeof part === "string") this.push(part);
|
|
531
|
+
else this.push(part.clone(this));
|
|
532
|
+
}
|
|
533
|
+
clone(parent) {
|
|
534
|
+
const c = new _a(this.type, parent);
|
|
535
|
+
for (const p of this.#parts) c.copyIn(p);
|
|
536
|
+
return c;
|
|
537
|
+
}
|
|
538
|
+
static #parseAST(str, ast, pos, opt, extDepth) {
|
|
539
|
+
const maxDepth = opt.maxExtglobRecursion ?? 2;
|
|
540
|
+
let escaping = false;
|
|
541
|
+
let inBrace = false;
|
|
542
|
+
let braceStart = -1;
|
|
543
|
+
let braceNeg = false;
|
|
544
|
+
if (ast.type === null) {
|
|
545
|
+
let i = pos;
|
|
546
|
+
let acc = "";
|
|
547
|
+
while (i < str.length) {
|
|
548
|
+
const c = str.charAt(i++);
|
|
549
|
+
if (escaping || c === "\\") {
|
|
550
|
+
escaping = !escaping;
|
|
551
|
+
acc += c;
|
|
552
|
+
continue;
|
|
553
|
+
}
|
|
554
|
+
if (inBrace) {
|
|
555
|
+
if (i === braceStart + 1) {
|
|
556
|
+
if (c === "^" || c === "!") braceNeg = true;
|
|
557
|
+
} else if (c === "]" && !(i === braceStart + 2 && braceNeg)) inBrace = false;
|
|
558
|
+
acc += c;
|
|
559
|
+
continue;
|
|
560
|
+
} else if (c === "[") {
|
|
561
|
+
inBrace = true;
|
|
562
|
+
braceStart = i;
|
|
563
|
+
braceNeg = false;
|
|
564
|
+
acc += c;
|
|
565
|
+
continue;
|
|
566
|
+
}
|
|
567
|
+
if (!opt.noext && isExtglobType(c) && str.charAt(i) === "(" && extDepth <= maxDepth) {
|
|
568
|
+
ast.push(acc);
|
|
569
|
+
acc = "";
|
|
570
|
+
const ext = new _a(c, ast);
|
|
571
|
+
i = _a.#parseAST(str, ext, i, opt, extDepth + 1);
|
|
572
|
+
ast.push(ext);
|
|
573
|
+
continue;
|
|
574
|
+
}
|
|
575
|
+
acc += c;
|
|
576
|
+
}
|
|
577
|
+
ast.push(acc);
|
|
578
|
+
return i;
|
|
579
|
+
}
|
|
580
|
+
let i = pos + 1;
|
|
581
|
+
let part = new _a(null, ast);
|
|
582
|
+
const parts = [];
|
|
583
|
+
let acc = "";
|
|
584
|
+
while (i < str.length) {
|
|
585
|
+
const c = str.charAt(i++);
|
|
586
|
+
if (escaping || c === "\\") {
|
|
587
|
+
escaping = !escaping;
|
|
588
|
+
acc += c;
|
|
589
|
+
continue;
|
|
590
|
+
}
|
|
591
|
+
if (inBrace) {
|
|
592
|
+
if (i === braceStart + 1) {
|
|
593
|
+
if (c === "^" || c === "!") braceNeg = true;
|
|
594
|
+
} else if (c === "]" && !(i === braceStart + 2 && braceNeg)) inBrace = false;
|
|
595
|
+
acc += c;
|
|
596
|
+
continue;
|
|
597
|
+
} else if (c === "[") {
|
|
598
|
+
inBrace = true;
|
|
599
|
+
braceStart = i;
|
|
600
|
+
braceNeg = false;
|
|
601
|
+
acc += c;
|
|
602
|
+
continue;
|
|
603
|
+
}
|
|
604
|
+
/* c8 ignore stop */
|
|
605
|
+
if (!opt.noext && isExtglobType(c) && str.charAt(i) === "(" && (extDepth <= maxDepth || ast && ast.#canAdoptType(c))) {
|
|
606
|
+
const depthAdd = ast && ast.#canAdoptType(c) ? 0 : 1;
|
|
607
|
+
part.push(acc);
|
|
608
|
+
acc = "";
|
|
609
|
+
const ext = new _a(c, part);
|
|
610
|
+
part.push(ext);
|
|
611
|
+
i = _a.#parseAST(str, ext, i, opt, extDepth + depthAdd);
|
|
612
|
+
continue;
|
|
613
|
+
}
|
|
614
|
+
if (c === "|") {
|
|
615
|
+
part.push(acc);
|
|
616
|
+
acc = "";
|
|
617
|
+
parts.push(part);
|
|
618
|
+
part = new _a(null, ast);
|
|
619
|
+
continue;
|
|
620
|
+
}
|
|
621
|
+
if (c === ")") {
|
|
622
|
+
if (acc === "" && ast.#parts.length === 0) ast.#emptyExt = true;
|
|
623
|
+
part.push(acc);
|
|
624
|
+
acc = "";
|
|
625
|
+
ast.push(...parts, part);
|
|
626
|
+
return i;
|
|
627
|
+
}
|
|
628
|
+
acc += c;
|
|
629
|
+
}
|
|
630
|
+
ast.type = null;
|
|
631
|
+
ast.#hasMagic = void 0;
|
|
632
|
+
ast.#parts = [str.substring(pos - 1)];
|
|
633
|
+
return i;
|
|
634
|
+
}
|
|
635
|
+
#canAdoptWithSpace(child) {
|
|
636
|
+
return this.#canAdopt(child, adoptionWithSpaceMap);
|
|
637
|
+
}
|
|
638
|
+
#canAdopt(child, map = adoptionMap) {
|
|
639
|
+
if (!child || typeof child !== "object" || child.type !== null || child.#parts.length !== 1 || this.type === null) return false;
|
|
640
|
+
const gc = child.#parts[0];
|
|
641
|
+
if (!gc || typeof gc !== "object" || gc.type === null) return false;
|
|
642
|
+
return this.#canAdoptType(gc.type, map);
|
|
643
|
+
}
|
|
644
|
+
#canAdoptType(c, map = adoptionAnyMap) {
|
|
645
|
+
return !!map.get(this.type)?.includes(c);
|
|
646
|
+
}
|
|
647
|
+
#adoptWithSpace(child, index) {
|
|
648
|
+
const gc = child.#parts[0];
|
|
649
|
+
const blank = new _a(null, gc, this.options);
|
|
650
|
+
blank.#parts.push("");
|
|
651
|
+
gc.push(blank);
|
|
652
|
+
this.#adopt(child, index);
|
|
653
|
+
}
|
|
654
|
+
#adopt(child, index) {
|
|
655
|
+
const gc = child.#parts[0];
|
|
656
|
+
this.#parts.splice(index, 1, ...gc.#parts);
|
|
657
|
+
for (const p of gc.#parts) if (typeof p === "object") p.#parent = this;
|
|
658
|
+
this.#toString = void 0;
|
|
659
|
+
}
|
|
660
|
+
#canUsurpType(c) {
|
|
661
|
+
return !!usurpMap.get(this.type)?.has(c);
|
|
662
|
+
}
|
|
663
|
+
#canUsurp(child) {
|
|
664
|
+
if (!child || typeof child !== "object" || child.type !== null || child.#parts.length !== 1 || this.type === null || this.#parts.length !== 1) return false;
|
|
665
|
+
const gc = child.#parts[0];
|
|
666
|
+
if (!gc || typeof gc !== "object" || gc.type === null) return false;
|
|
667
|
+
return this.#canUsurpType(gc.type);
|
|
668
|
+
}
|
|
669
|
+
#usurp(child) {
|
|
670
|
+
const m = usurpMap.get(this.type);
|
|
671
|
+
const gc = child.#parts[0];
|
|
672
|
+
const nt = m?.get(gc.type);
|
|
673
|
+
/* c8 ignore start - impossible */
|
|
674
|
+
if (!nt) return false;
|
|
675
|
+
/* c8 ignore stop */
|
|
676
|
+
this.#parts = gc.#parts;
|
|
677
|
+
for (const p of this.#parts) if (typeof p === "object") p.#parent = this;
|
|
678
|
+
this.type = nt;
|
|
679
|
+
this.#toString = void 0;
|
|
680
|
+
this.#emptyExt = false;
|
|
681
|
+
}
|
|
682
|
+
static fromGlob(pattern, options = {}) {
|
|
683
|
+
const ast = new _a(null, void 0, options);
|
|
684
|
+
_a.#parseAST(pattern, ast, 0, options, 0);
|
|
685
|
+
return ast;
|
|
686
|
+
}
|
|
687
|
+
toMMPattern() {
|
|
688
|
+
/* c8 ignore start */
|
|
689
|
+
if (this !== this.#root) return this.#root.toMMPattern();
|
|
690
|
+
/* c8 ignore stop */
|
|
691
|
+
const glob = this.toString();
|
|
692
|
+
const [re, body, hasMagic, uflag] = this.toRegExpSource();
|
|
693
|
+
if (!(hasMagic || this.#hasMagic || this.#options.nocase && !this.#options.nocaseMagicOnly && glob.toUpperCase() !== glob.toLowerCase())) return body;
|
|
694
|
+
const flags = (this.#options.nocase ? "i" : "") + (uflag ? "u" : "");
|
|
695
|
+
return Object.assign(new RegExp(`^${re}$`, flags), {
|
|
696
|
+
_src: re,
|
|
697
|
+
_glob: glob
|
|
698
|
+
});
|
|
699
|
+
}
|
|
700
|
+
get options() {
|
|
701
|
+
return this.#options;
|
|
702
|
+
}
|
|
703
|
+
toRegExpSource(allowDot) {
|
|
704
|
+
const dot = allowDot ?? !!this.#options.dot;
|
|
705
|
+
if (this.#root === this) {
|
|
706
|
+
this.#flatten();
|
|
707
|
+
this.#fillNegs();
|
|
708
|
+
}
|
|
709
|
+
if (!isExtglobAST(this)) {
|
|
710
|
+
const noEmpty = this.isStart() && this.isEnd() && !this.#parts.some((s) => typeof s !== "string");
|
|
711
|
+
const src = this.#parts.map((p) => {
|
|
712
|
+
const [re, _, hasMagic, uflag] = typeof p === "string" ? _a.#parseGlob(p, this.#hasMagic, noEmpty) : p.toRegExpSource(allowDot);
|
|
713
|
+
this.#hasMagic = this.#hasMagic || hasMagic;
|
|
714
|
+
this.#uflag = this.#uflag || uflag;
|
|
715
|
+
return re;
|
|
716
|
+
}).join("");
|
|
717
|
+
let start = "";
|
|
718
|
+
if (this.isStart()) {
|
|
719
|
+
if (typeof this.#parts[0] === "string") {
|
|
720
|
+
if (!(this.#parts.length === 1 && justDots.has(this.#parts[0]))) {
|
|
721
|
+
const aps = addPatternStart;
|
|
722
|
+
const needNoTrav = dot && aps.has(src.charAt(0)) || src.startsWith("\\.") && aps.has(src.charAt(2)) || src.startsWith("\\.\\.") && aps.has(src.charAt(4));
|
|
723
|
+
const needNoDot = !dot && !allowDot && aps.has(src.charAt(0));
|
|
724
|
+
start = needNoTrav ? startNoTraversal : needNoDot ? startNoDot : "";
|
|
725
|
+
}
|
|
726
|
+
}
|
|
727
|
+
}
|
|
728
|
+
let end = "";
|
|
729
|
+
if (this.isEnd() && this.#root.#filledNegs && this.#parent?.type === "!") end = "(?:$|\\/)";
|
|
730
|
+
return [
|
|
731
|
+
start + src + end,
|
|
732
|
+
unescape(src),
|
|
733
|
+
this.#hasMagic = !!this.#hasMagic,
|
|
734
|
+
this.#uflag
|
|
735
|
+
];
|
|
736
|
+
}
|
|
737
|
+
const repeated = this.type === "*" || this.type === "+";
|
|
738
|
+
const start = this.type === "!" ? "(?:(?!(?:" : "(?:";
|
|
739
|
+
let body = this.#partsToRegExp(dot);
|
|
740
|
+
if (this.isStart() && this.isEnd() && !body && this.type !== "!") {
|
|
741
|
+
const s = this.toString();
|
|
742
|
+
const me = this;
|
|
743
|
+
me.#parts = [s];
|
|
744
|
+
me.type = null;
|
|
745
|
+
me.#hasMagic = void 0;
|
|
746
|
+
return [
|
|
747
|
+
s,
|
|
748
|
+
unescape(this.toString()),
|
|
749
|
+
false,
|
|
750
|
+
false
|
|
751
|
+
];
|
|
752
|
+
}
|
|
753
|
+
let bodyDotAllowed = !repeated || allowDot || dot || false ? "" : this.#partsToRegExp(true);
|
|
754
|
+
if (bodyDotAllowed === body) bodyDotAllowed = "";
|
|
755
|
+
if (bodyDotAllowed) body = `(?:${body})(?:${bodyDotAllowed})*?`;
|
|
756
|
+
let final = "";
|
|
757
|
+
if (this.type === "!" && this.#emptyExt) final = (this.isStart() && !dot ? startNoDot : "") + starNoEmpty;
|
|
758
|
+
else {
|
|
759
|
+
const close = this.type === "!" ? "))" + (this.isStart() && !dot && !allowDot ? startNoDot : "") + "[^/]*?)" : this.type === "@" ? ")" : this.type === "?" ? ")?" : this.type === "+" && bodyDotAllowed ? ")" : this.type === "*" && bodyDotAllowed ? `)?` : `)${this.type}`;
|
|
760
|
+
final = start + body + close;
|
|
761
|
+
}
|
|
762
|
+
return [
|
|
763
|
+
final,
|
|
764
|
+
unescape(body),
|
|
765
|
+
this.#hasMagic = !!this.#hasMagic,
|
|
766
|
+
this.#uflag
|
|
767
|
+
];
|
|
768
|
+
}
|
|
769
|
+
#flatten() {
|
|
770
|
+
if (!isExtglobAST(this)) {
|
|
771
|
+
for (const p of this.#parts) if (typeof p === "object") p.#flatten();
|
|
772
|
+
} else {
|
|
773
|
+
let iterations = 0;
|
|
774
|
+
let done = false;
|
|
775
|
+
do {
|
|
776
|
+
done = true;
|
|
777
|
+
for (let i = 0; i < this.#parts.length; i++) {
|
|
778
|
+
const c = this.#parts[i];
|
|
779
|
+
if (typeof c === "object") {
|
|
780
|
+
c.#flatten();
|
|
781
|
+
if (this.#canAdopt(c)) {
|
|
782
|
+
done = false;
|
|
783
|
+
this.#adopt(c, i);
|
|
784
|
+
} else if (this.#canAdoptWithSpace(c)) {
|
|
785
|
+
done = false;
|
|
786
|
+
this.#adoptWithSpace(c, i);
|
|
787
|
+
} else if (this.#canUsurp(c)) {
|
|
788
|
+
done = false;
|
|
789
|
+
this.#usurp(c);
|
|
790
|
+
}
|
|
791
|
+
}
|
|
792
|
+
}
|
|
793
|
+
} while (!done && ++iterations < 10);
|
|
794
|
+
}
|
|
795
|
+
this.#toString = void 0;
|
|
796
|
+
}
|
|
797
|
+
#partsToRegExp(dot) {
|
|
798
|
+
return this.#parts.map((p) => {
|
|
799
|
+
/* c8 ignore start */
|
|
800
|
+
if (typeof p === "string") throw new Error("string type in extglob ast??");
|
|
801
|
+
/* c8 ignore stop */
|
|
802
|
+
const [re, _, _hasMagic, uflag] = p.toRegExpSource(dot);
|
|
803
|
+
this.#uflag = this.#uflag || uflag;
|
|
804
|
+
return re;
|
|
805
|
+
}).filter((p) => !(this.isStart() && this.isEnd()) || !!p).join("|");
|
|
806
|
+
}
|
|
807
|
+
static #parseGlob(glob, hasMagic, noEmpty = false) {
|
|
808
|
+
let escaping = false;
|
|
809
|
+
let re = "";
|
|
810
|
+
let uflag = false;
|
|
811
|
+
let inStar = false;
|
|
812
|
+
for (let i = 0; i < glob.length; i++) {
|
|
813
|
+
const c = glob.charAt(i);
|
|
814
|
+
if (escaping) {
|
|
815
|
+
escaping = false;
|
|
816
|
+
re += (reSpecials.has(c) ? "\\" : "") + c;
|
|
817
|
+
continue;
|
|
818
|
+
}
|
|
819
|
+
if (c === "*") {
|
|
820
|
+
if (inStar) continue;
|
|
821
|
+
inStar = true;
|
|
822
|
+
re += noEmpty && /^[*]+$/.test(glob) ? starNoEmpty : star$1;
|
|
823
|
+
hasMagic = true;
|
|
824
|
+
continue;
|
|
825
|
+
} else inStar = false;
|
|
826
|
+
if (c === "\\") {
|
|
827
|
+
if (i === glob.length - 1) re += "\\\\";
|
|
828
|
+
else escaping = true;
|
|
829
|
+
continue;
|
|
830
|
+
}
|
|
831
|
+
if (c === "[") {
|
|
832
|
+
const [src, needUflag, consumed, magic] = parseClass(glob, i);
|
|
833
|
+
if (consumed) {
|
|
834
|
+
re += src;
|
|
835
|
+
uflag = uflag || needUflag;
|
|
836
|
+
i += consumed - 1;
|
|
837
|
+
hasMagic = hasMagic || magic;
|
|
838
|
+
continue;
|
|
839
|
+
}
|
|
840
|
+
}
|
|
841
|
+
if (c === "?") {
|
|
842
|
+
re += qmark;
|
|
843
|
+
hasMagic = true;
|
|
844
|
+
continue;
|
|
845
|
+
}
|
|
846
|
+
re += regExpEscape$1(c);
|
|
847
|
+
}
|
|
848
|
+
return [
|
|
849
|
+
re,
|
|
850
|
+
unescape(glob),
|
|
851
|
+
!!hasMagic,
|
|
852
|
+
uflag
|
|
853
|
+
];
|
|
854
|
+
}
|
|
855
|
+
};
|
|
856
|
+
_a = AST;
|
|
857
|
+
//#endregion
|
|
858
|
+
//#region ../../node_modules/.pnpm/minimatch@10.2.5/node_modules/minimatch/dist/esm/escape.js
|
|
859
|
+
/**
|
|
860
|
+
* Escape all magic characters in a glob pattern.
|
|
861
|
+
*
|
|
862
|
+
* If the {@link MinimatchOptions.windowsPathsNoEscape}
|
|
863
|
+
* option is used, then characters are escaped by wrapping in `[]`, because
|
|
864
|
+
* a magic character wrapped in a character class can only be satisfied by
|
|
865
|
+
* that exact character. In this mode, `\` is _not_ escaped, because it is
|
|
866
|
+
* not interpreted as a magic character, but instead as a path separator.
|
|
867
|
+
*
|
|
868
|
+
* If the {@link MinimatchOptions.magicalBraces} option is used,
|
|
869
|
+
* then braces (`{` and `}`) will be escaped.
|
|
870
|
+
*/
|
|
871
|
+
const escape = (s, { windowsPathsNoEscape = false, magicalBraces = false } = {}) => {
|
|
872
|
+
if (magicalBraces) return windowsPathsNoEscape ? s.replace(/[?*()[\]{}]/g, "[$&]") : s.replace(/[?*()[\]\\{}]/g, "\\$&");
|
|
873
|
+
return windowsPathsNoEscape ? s.replace(/[?*()[\]]/g, "[$&]") : s.replace(/[?*()[\]\\]/g, "\\$&");
|
|
874
|
+
};
|
|
875
|
+
//#endregion
|
|
876
|
+
//#region ../../node_modules/.pnpm/minimatch@10.2.5/node_modules/minimatch/dist/esm/index.js
|
|
877
|
+
const minimatch = (p, pattern, options = {}) => {
|
|
878
|
+
assertValidPattern(pattern);
|
|
879
|
+
if (!options.nocomment && pattern.charAt(0) === "#") return false;
|
|
880
|
+
return new Minimatch(pattern, options).match(p);
|
|
881
|
+
};
|
|
882
|
+
const starDotExtRE = /^\*+([^+@!?*[(]*)$/;
|
|
883
|
+
const starDotExtTest = (ext) => (f) => !f.startsWith(".") && f.endsWith(ext);
|
|
884
|
+
const starDotExtTestDot = (ext) => (f) => f.endsWith(ext);
|
|
885
|
+
const starDotExtTestNocase = (ext) => {
|
|
886
|
+
ext = ext.toLowerCase();
|
|
887
|
+
return (f) => !f.startsWith(".") && f.toLowerCase().endsWith(ext);
|
|
888
|
+
};
|
|
889
|
+
const starDotExtTestNocaseDot = (ext) => {
|
|
890
|
+
ext = ext.toLowerCase();
|
|
891
|
+
return (f) => f.toLowerCase().endsWith(ext);
|
|
892
|
+
};
|
|
893
|
+
const starDotStarRE = /^\*+\.\*+$/;
|
|
894
|
+
const starDotStarTest = (f) => !f.startsWith(".") && f.includes(".");
|
|
895
|
+
const starDotStarTestDot = (f) => f !== "." && f !== ".." && f.includes(".");
|
|
896
|
+
const dotStarRE = /^\.\*+$/;
|
|
897
|
+
const dotStarTest = (f) => f !== "." && f !== ".." && f.startsWith(".");
|
|
898
|
+
const starRE = /^\*+$/;
|
|
899
|
+
const starTest = (f) => f.length !== 0 && !f.startsWith(".");
|
|
900
|
+
const starTestDot = (f) => f.length !== 0 && f !== "." && f !== "..";
|
|
901
|
+
const qmarksRE = /^\?+([^+@!?*[(]*)?$/;
|
|
902
|
+
const qmarksTestNocase = ([$0, ext = ""]) => {
|
|
903
|
+
const noext = qmarksTestNoExt([$0]);
|
|
904
|
+
if (!ext) return noext;
|
|
905
|
+
ext = ext.toLowerCase();
|
|
906
|
+
return (f) => noext(f) && f.toLowerCase().endsWith(ext);
|
|
907
|
+
};
|
|
908
|
+
const qmarksTestNocaseDot = ([$0, ext = ""]) => {
|
|
909
|
+
const noext = qmarksTestNoExtDot([$0]);
|
|
910
|
+
if (!ext) return noext;
|
|
911
|
+
ext = ext.toLowerCase();
|
|
912
|
+
return (f) => noext(f) && f.toLowerCase().endsWith(ext);
|
|
913
|
+
};
|
|
914
|
+
const qmarksTestDot = ([$0, ext = ""]) => {
|
|
915
|
+
const noext = qmarksTestNoExtDot([$0]);
|
|
916
|
+
return !ext ? noext : (f) => noext(f) && f.endsWith(ext);
|
|
917
|
+
};
|
|
918
|
+
const qmarksTest = ([$0, ext = ""]) => {
|
|
919
|
+
const noext = qmarksTestNoExt([$0]);
|
|
920
|
+
return !ext ? noext : (f) => noext(f) && f.endsWith(ext);
|
|
921
|
+
};
|
|
922
|
+
const qmarksTestNoExt = ([$0]) => {
|
|
923
|
+
const len = $0.length;
|
|
924
|
+
return (f) => f.length === len && !f.startsWith(".");
|
|
925
|
+
};
|
|
926
|
+
const qmarksTestNoExtDot = ([$0]) => {
|
|
927
|
+
const len = $0.length;
|
|
928
|
+
return (f) => f.length === len && f !== "." && f !== "..";
|
|
929
|
+
};
|
|
930
|
+
/* c8 ignore start */
|
|
931
|
+
const defaultPlatform = typeof process === "object" && process ? typeof process.env === "object" && process.env && process.env.__MINIMATCH_TESTING_PLATFORM__ || process.platform : "posix";
|
|
932
|
+
const path = {
|
|
933
|
+
win32: { sep: "\\" },
|
|
934
|
+
posix: { sep: "/" }
|
|
935
|
+
};
|
|
936
|
+
minimatch.sep = defaultPlatform === "win32" ? path.win32.sep : path.posix.sep;
|
|
937
|
+
const GLOBSTAR = Symbol("globstar **");
|
|
938
|
+
minimatch.GLOBSTAR = GLOBSTAR;
|
|
939
|
+
const star = "[^/]*?";
|
|
940
|
+
const twoStarDot = "(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?";
|
|
941
|
+
const twoStarNoDot = "(?:(?!(?:\\/|^)\\.).)*?";
|
|
942
|
+
const filter = (pattern, options = {}) => (p) => minimatch(p, pattern, options);
|
|
943
|
+
minimatch.filter = filter;
|
|
944
|
+
const ext = (a, b = {}) => Object.assign({}, a, b);
|
|
945
|
+
const defaults = (def) => {
|
|
946
|
+
if (!def || typeof def !== "object" || !Object.keys(def).length) return minimatch;
|
|
947
|
+
const orig = minimatch;
|
|
948
|
+
const m = (p, pattern, options = {}) => orig(p, pattern, ext(def, options));
|
|
949
|
+
return Object.assign(m, {
|
|
950
|
+
Minimatch: class Minimatch extends orig.Minimatch {
|
|
951
|
+
constructor(pattern, options = {}) {
|
|
952
|
+
super(pattern, ext(def, options));
|
|
953
|
+
}
|
|
954
|
+
static defaults(options) {
|
|
955
|
+
return orig.defaults(ext(def, options)).Minimatch;
|
|
956
|
+
}
|
|
957
|
+
},
|
|
958
|
+
AST: class AST extends orig.AST {
|
|
959
|
+
/* c8 ignore start */
|
|
960
|
+
constructor(type, parent, options = {}) {
|
|
961
|
+
super(type, parent, ext(def, options));
|
|
962
|
+
}
|
|
963
|
+
/* c8 ignore stop */
|
|
964
|
+
static fromGlob(pattern, options = {}) {
|
|
965
|
+
return orig.AST.fromGlob(pattern, ext(def, options));
|
|
966
|
+
}
|
|
967
|
+
},
|
|
968
|
+
unescape: (s, options = {}) => orig.unescape(s, ext(def, options)),
|
|
969
|
+
escape: (s, options = {}) => orig.escape(s, ext(def, options)),
|
|
970
|
+
filter: (pattern, options = {}) => orig.filter(pattern, ext(def, options)),
|
|
971
|
+
defaults: (options) => orig.defaults(ext(def, options)),
|
|
972
|
+
makeRe: (pattern, options = {}) => orig.makeRe(pattern, ext(def, options)),
|
|
973
|
+
braceExpand: (pattern, options = {}) => orig.braceExpand(pattern, ext(def, options)),
|
|
974
|
+
match: (list, pattern, options = {}) => orig.match(list, pattern, ext(def, options)),
|
|
975
|
+
sep: orig.sep,
|
|
976
|
+
GLOBSTAR
|
|
977
|
+
});
|
|
978
|
+
};
|
|
979
|
+
minimatch.defaults = defaults;
|
|
980
|
+
const braceExpand = (pattern, options = {}) => {
|
|
981
|
+
assertValidPattern(pattern);
|
|
982
|
+
if (options.nobrace || !/\{(?:(?!\{).)*\}/.test(pattern)) return [pattern];
|
|
983
|
+
return expand(pattern, { max: options.braceExpandMax });
|
|
984
|
+
};
|
|
985
|
+
minimatch.braceExpand = braceExpand;
|
|
986
|
+
const makeRe = (pattern, options = {}) => new Minimatch(pattern, options).makeRe();
|
|
987
|
+
minimatch.makeRe = makeRe;
|
|
988
|
+
const match = (list, pattern, options = {}) => {
|
|
989
|
+
const mm = new Minimatch(pattern, options);
|
|
990
|
+
list = list.filter((f) => mm.match(f));
|
|
991
|
+
if (mm.options.nonull && !list.length) list.push(pattern);
|
|
992
|
+
return list;
|
|
993
|
+
};
|
|
994
|
+
minimatch.match = match;
|
|
995
|
+
const globMagic = /[?*]|[+@!]\(.*?\)|\[|\]/;
|
|
996
|
+
const regExpEscape = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
|
997
|
+
var Minimatch = class {
|
|
998
|
+
options;
|
|
999
|
+
set;
|
|
1000
|
+
pattern;
|
|
1001
|
+
windowsPathsNoEscape;
|
|
1002
|
+
nonegate;
|
|
1003
|
+
negate;
|
|
1004
|
+
comment;
|
|
1005
|
+
empty;
|
|
1006
|
+
preserveMultipleSlashes;
|
|
1007
|
+
partial;
|
|
1008
|
+
globSet;
|
|
1009
|
+
globParts;
|
|
1010
|
+
nocase;
|
|
1011
|
+
isWindows;
|
|
1012
|
+
platform;
|
|
1013
|
+
windowsNoMagicRoot;
|
|
1014
|
+
maxGlobstarRecursion;
|
|
1015
|
+
regexp;
|
|
1016
|
+
constructor(pattern, options = {}) {
|
|
1017
|
+
assertValidPattern(pattern);
|
|
1018
|
+
options = options || {};
|
|
1019
|
+
this.options = options;
|
|
1020
|
+
this.maxGlobstarRecursion = options.maxGlobstarRecursion ?? 200;
|
|
1021
|
+
this.pattern = pattern;
|
|
1022
|
+
this.platform = options.platform || defaultPlatform;
|
|
1023
|
+
this.isWindows = this.platform === "win32";
|
|
1024
|
+
const awe = "allowWindowsEscape";
|
|
1025
|
+
this.windowsPathsNoEscape = !!options.windowsPathsNoEscape || options[awe] === false;
|
|
1026
|
+
if (this.windowsPathsNoEscape) this.pattern = this.pattern.replace(/\\/g, "/");
|
|
1027
|
+
this.preserveMultipleSlashes = !!options.preserveMultipleSlashes;
|
|
1028
|
+
this.regexp = null;
|
|
1029
|
+
this.negate = false;
|
|
1030
|
+
this.nonegate = !!options.nonegate;
|
|
1031
|
+
this.comment = false;
|
|
1032
|
+
this.empty = false;
|
|
1033
|
+
this.partial = !!options.partial;
|
|
1034
|
+
this.nocase = !!this.options.nocase;
|
|
1035
|
+
this.windowsNoMagicRoot = options.windowsNoMagicRoot !== void 0 ? options.windowsNoMagicRoot : !!(this.isWindows && this.nocase);
|
|
1036
|
+
this.globSet = [];
|
|
1037
|
+
this.globParts = [];
|
|
1038
|
+
this.set = [];
|
|
1039
|
+
this.make();
|
|
1040
|
+
}
|
|
1041
|
+
hasMagic() {
|
|
1042
|
+
if (this.options.magicalBraces && this.set.length > 1) return true;
|
|
1043
|
+
for (const pattern of this.set) for (const part of pattern) if (typeof part !== "string") return true;
|
|
1044
|
+
return false;
|
|
1045
|
+
}
|
|
1046
|
+
debug(..._) {}
|
|
1047
|
+
make() {
|
|
1048
|
+
const pattern = this.pattern;
|
|
1049
|
+
const options = this.options;
|
|
1050
|
+
if (!options.nocomment && pattern.charAt(0) === "#") {
|
|
1051
|
+
this.comment = true;
|
|
1052
|
+
return;
|
|
1053
|
+
}
|
|
1054
|
+
if (!pattern) {
|
|
1055
|
+
this.empty = true;
|
|
1056
|
+
return;
|
|
1057
|
+
}
|
|
1058
|
+
this.parseNegate();
|
|
1059
|
+
this.globSet = [...new Set(this.braceExpand())];
|
|
1060
|
+
if (options.debug) this.debug = (...args) => console.error(...args);
|
|
1061
|
+
this.debug(this.pattern, this.globSet);
|
|
1062
|
+
const rawGlobParts = this.globSet.map((s) => this.slashSplit(s));
|
|
1063
|
+
this.globParts = this.preprocess(rawGlobParts);
|
|
1064
|
+
this.debug(this.pattern, this.globParts);
|
|
1065
|
+
let set = this.globParts.map((s, _, __) => {
|
|
1066
|
+
if (this.isWindows && this.windowsNoMagicRoot) {
|
|
1067
|
+
const isUNC = s[0] === "" && s[1] === "" && (s[2] === "?" || !globMagic.test(s[2])) && !globMagic.test(s[3]);
|
|
1068
|
+
const isDrive = /^[a-z]:/i.test(s[0]);
|
|
1069
|
+
if (isUNC) return [...s.slice(0, 4), ...s.slice(4).map((ss) => this.parse(ss))];
|
|
1070
|
+
else if (isDrive) return [s[0], ...s.slice(1).map((ss) => this.parse(ss))];
|
|
1071
|
+
}
|
|
1072
|
+
return s.map((ss) => this.parse(ss));
|
|
1073
|
+
});
|
|
1074
|
+
this.debug(this.pattern, set);
|
|
1075
|
+
this.set = set.filter((s) => s.indexOf(false) === -1);
|
|
1076
|
+
if (this.isWindows) for (let i = 0; i < this.set.length; i++) {
|
|
1077
|
+
const p = this.set[i];
|
|
1078
|
+
if (p[0] === "" && p[1] === "" && this.globParts[i][2] === "?" && typeof p[3] === "string" && /^[a-z]:$/i.test(p[3])) p[2] = "?";
|
|
1079
|
+
}
|
|
1080
|
+
this.debug(this.pattern, this.set);
|
|
1081
|
+
}
|
|
1082
|
+
preprocess(globParts) {
|
|
1083
|
+
if (this.options.noglobstar) {
|
|
1084
|
+
for (const partset of globParts) for (let j = 0; j < partset.length; j++) if (partset[j] === "**") partset[j] = "*";
|
|
1085
|
+
}
|
|
1086
|
+
const { optimizationLevel = 1 } = this.options;
|
|
1087
|
+
if (optimizationLevel >= 2) {
|
|
1088
|
+
globParts = this.firstPhasePreProcess(globParts);
|
|
1089
|
+
globParts = this.secondPhasePreProcess(globParts);
|
|
1090
|
+
} else if (optimizationLevel >= 1) globParts = this.levelOneOptimize(globParts);
|
|
1091
|
+
else globParts = this.adjascentGlobstarOptimize(globParts);
|
|
1092
|
+
return globParts;
|
|
1093
|
+
}
|
|
1094
|
+
adjascentGlobstarOptimize(globParts) {
|
|
1095
|
+
return globParts.map((parts) => {
|
|
1096
|
+
let gs = -1;
|
|
1097
|
+
while (-1 !== (gs = parts.indexOf("**", gs + 1))) {
|
|
1098
|
+
let i = gs;
|
|
1099
|
+
while (parts[i + 1] === "**") i++;
|
|
1100
|
+
if (i !== gs) parts.splice(gs, i - gs);
|
|
1101
|
+
}
|
|
1102
|
+
return parts;
|
|
1103
|
+
});
|
|
1104
|
+
}
|
|
1105
|
+
levelOneOptimize(globParts) {
|
|
1106
|
+
return globParts.map((parts) => {
|
|
1107
|
+
parts = parts.reduce((set, part) => {
|
|
1108
|
+
const prev = set[set.length - 1];
|
|
1109
|
+
if (part === "**" && prev === "**") return set;
|
|
1110
|
+
if (part === "..") {
|
|
1111
|
+
if (prev && prev !== ".." && prev !== "." && prev !== "**") {
|
|
1112
|
+
set.pop();
|
|
1113
|
+
return set;
|
|
1114
|
+
}
|
|
1115
|
+
}
|
|
1116
|
+
set.push(part);
|
|
1117
|
+
return set;
|
|
1118
|
+
}, []);
|
|
1119
|
+
return parts.length === 0 ? [""] : parts;
|
|
1120
|
+
});
|
|
1121
|
+
}
|
|
1122
|
+
levelTwoFileOptimize(parts) {
|
|
1123
|
+
if (!Array.isArray(parts)) parts = this.slashSplit(parts);
|
|
1124
|
+
let didSomething = false;
|
|
1125
|
+
do {
|
|
1126
|
+
didSomething = false;
|
|
1127
|
+
if (!this.preserveMultipleSlashes) {
|
|
1128
|
+
for (let i = 1; i < parts.length - 1; i++) {
|
|
1129
|
+
const p = parts[i];
|
|
1130
|
+
if (i === 1 && p === "" && parts[0] === "") continue;
|
|
1131
|
+
if (p === "." || p === "") {
|
|
1132
|
+
didSomething = true;
|
|
1133
|
+
parts.splice(i, 1);
|
|
1134
|
+
i--;
|
|
1135
|
+
}
|
|
1136
|
+
}
|
|
1137
|
+
if (parts[0] === "." && parts.length === 2 && (parts[1] === "." || parts[1] === "")) {
|
|
1138
|
+
didSomething = true;
|
|
1139
|
+
parts.pop();
|
|
1140
|
+
}
|
|
1141
|
+
}
|
|
1142
|
+
let dd = 0;
|
|
1143
|
+
while (-1 !== (dd = parts.indexOf("..", dd + 1))) {
|
|
1144
|
+
const p = parts[dd - 1];
|
|
1145
|
+
if (p && p !== "." && p !== ".." && p !== "**" && !(this.isWindows && /^[a-z]:$/i.test(p))) {
|
|
1146
|
+
didSomething = true;
|
|
1147
|
+
parts.splice(dd - 1, 2);
|
|
1148
|
+
dd -= 2;
|
|
1149
|
+
}
|
|
1150
|
+
}
|
|
1151
|
+
} while (didSomething);
|
|
1152
|
+
return parts.length === 0 ? [""] : parts;
|
|
1153
|
+
}
|
|
1154
|
+
firstPhasePreProcess(globParts) {
|
|
1155
|
+
let didSomething = false;
|
|
1156
|
+
do {
|
|
1157
|
+
didSomething = false;
|
|
1158
|
+
for (let parts of globParts) {
|
|
1159
|
+
let gs = -1;
|
|
1160
|
+
while (-1 !== (gs = parts.indexOf("**", gs + 1))) {
|
|
1161
|
+
let gss = gs;
|
|
1162
|
+
while (parts[gss + 1] === "**") gss++;
|
|
1163
|
+
if (gss > gs) parts.splice(gs + 1, gss - gs);
|
|
1164
|
+
let next = parts[gs + 1];
|
|
1165
|
+
const p = parts[gs + 2];
|
|
1166
|
+
const p2 = parts[gs + 3];
|
|
1167
|
+
if (next !== "..") continue;
|
|
1168
|
+
if (!p || p === "." || p === ".." || !p2 || p2 === "." || p2 === "..") continue;
|
|
1169
|
+
didSomething = true;
|
|
1170
|
+
parts.splice(gs, 1);
|
|
1171
|
+
const other = parts.slice(0);
|
|
1172
|
+
other[gs] = "**";
|
|
1173
|
+
globParts.push(other);
|
|
1174
|
+
gs--;
|
|
1175
|
+
}
|
|
1176
|
+
if (!this.preserveMultipleSlashes) {
|
|
1177
|
+
for (let i = 1; i < parts.length - 1; i++) {
|
|
1178
|
+
const p = parts[i];
|
|
1179
|
+
if (i === 1 && p === "" && parts[0] === "") continue;
|
|
1180
|
+
if (p === "." || p === "") {
|
|
1181
|
+
didSomething = true;
|
|
1182
|
+
parts.splice(i, 1);
|
|
1183
|
+
i--;
|
|
1184
|
+
}
|
|
1185
|
+
}
|
|
1186
|
+
if (parts[0] === "." && parts.length === 2 && (parts[1] === "." || parts[1] === "")) {
|
|
1187
|
+
didSomething = true;
|
|
1188
|
+
parts.pop();
|
|
1189
|
+
}
|
|
1190
|
+
}
|
|
1191
|
+
let dd = 0;
|
|
1192
|
+
while (-1 !== (dd = parts.indexOf("..", dd + 1))) {
|
|
1193
|
+
const p = parts[dd - 1];
|
|
1194
|
+
if (p && p !== "." && p !== ".." && p !== "**") {
|
|
1195
|
+
didSomething = true;
|
|
1196
|
+
const splin = dd === 1 && parts[dd + 1] === "**" ? ["."] : [];
|
|
1197
|
+
parts.splice(dd - 1, 2, ...splin);
|
|
1198
|
+
if (parts.length === 0) parts.push("");
|
|
1199
|
+
dd -= 2;
|
|
1200
|
+
}
|
|
1201
|
+
}
|
|
1202
|
+
}
|
|
1203
|
+
} while (didSomething);
|
|
1204
|
+
return globParts;
|
|
1205
|
+
}
|
|
1206
|
+
secondPhasePreProcess(globParts) {
|
|
1207
|
+
for (let i = 0; i < globParts.length - 1; i++) for (let j = i + 1; j < globParts.length; j++) {
|
|
1208
|
+
const matched = this.partsMatch(globParts[i], globParts[j], !this.preserveMultipleSlashes);
|
|
1209
|
+
if (matched) {
|
|
1210
|
+
globParts[i] = [];
|
|
1211
|
+
globParts[j] = matched;
|
|
1212
|
+
break;
|
|
1213
|
+
}
|
|
1214
|
+
}
|
|
1215
|
+
return globParts.filter((gs) => gs.length);
|
|
1216
|
+
}
|
|
1217
|
+
partsMatch(a, b, emptyGSMatch = false) {
|
|
1218
|
+
let ai = 0;
|
|
1219
|
+
let bi = 0;
|
|
1220
|
+
let result = [];
|
|
1221
|
+
let which = "";
|
|
1222
|
+
while (ai < a.length && bi < b.length) if (a[ai] === b[bi]) {
|
|
1223
|
+
result.push(which === "b" ? b[bi] : a[ai]);
|
|
1224
|
+
ai++;
|
|
1225
|
+
bi++;
|
|
1226
|
+
} else if (emptyGSMatch && a[ai] === "**" && b[bi] === a[ai + 1]) {
|
|
1227
|
+
result.push(a[ai]);
|
|
1228
|
+
ai++;
|
|
1229
|
+
} else if (emptyGSMatch && b[bi] === "**" && a[ai] === b[bi + 1]) {
|
|
1230
|
+
result.push(b[bi]);
|
|
1231
|
+
bi++;
|
|
1232
|
+
} else if (a[ai] === "*" && b[bi] && (this.options.dot || !b[bi].startsWith(".")) && b[bi] !== "**") {
|
|
1233
|
+
if (which === "b") return false;
|
|
1234
|
+
which = "a";
|
|
1235
|
+
result.push(a[ai]);
|
|
1236
|
+
ai++;
|
|
1237
|
+
bi++;
|
|
1238
|
+
} else if (b[bi] === "*" && a[ai] && (this.options.dot || !a[ai].startsWith(".")) && a[ai] !== "**") {
|
|
1239
|
+
if (which === "a") return false;
|
|
1240
|
+
which = "b";
|
|
1241
|
+
result.push(b[bi]);
|
|
1242
|
+
ai++;
|
|
1243
|
+
bi++;
|
|
1244
|
+
} else return false;
|
|
1245
|
+
return a.length === b.length && result;
|
|
1246
|
+
}
|
|
1247
|
+
parseNegate() {
|
|
1248
|
+
if (this.nonegate) return;
|
|
1249
|
+
const pattern = this.pattern;
|
|
1250
|
+
let negate = false;
|
|
1251
|
+
let negateOffset = 0;
|
|
1252
|
+
for (let i = 0; i < pattern.length && pattern.charAt(i) === "!"; i++) {
|
|
1253
|
+
negate = !negate;
|
|
1254
|
+
negateOffset++;
|
|
1255
|
+
}
|
|
1256
|
+
if (negateOffset) this.pattern = pattern.slice(negateOffset);
|
|
1257
|
+
this.negate = negate;
|
|
1258
|
+
}
|
|
1259
|
+
matchOne(file, pattern, partial = false) {
|
|
1260
|
+
let fileStartIndex = 0;
|
|
1261
|
+
let patternStartIndex = 0;
|
|
1262
|
+
if (this.isWindows) {
|
|
1263
|
+
const fileDrive = typeof file[0] === "string" && /^[a-z]:$/i.test(file[0]);
|
|
1264
|
+
const fileUNC = !fileDrive && file[0] === "" && file[1] === "" && file[2] === "?" && /^[a-z]:$/i.test(file[3]);
|
|
1265
|
+
const patternDrive = typeof pattern[0] === "string" && /^[a-z]:$/i.test(pattern[0]);
|
|
1266
|
+
const patternUNC = !patternDrive && pattern[0] === "" && pattern[1] === "" && pattern[2] === "?" && typeof pattern[3] === "string" && /^[a-z]:$/i.test(pattern[3]);
|
|
1267
|
+
const fdi = fileUNC ? 3 : fileDrive ? 0 : void 0;
|
|
1268
|
+
const pdi = patternUNC ? 3 : patternDrive ? 0 : void 0;
|
|
1269
|
+
if (typeof fdi === "number" && typeof pdi === "number") {
|
|
1270
|
+
const [fd, pd] = [file[fdi], pattern[pdi]];
|
|
1271
|
+
if (fd.toLowerCase() === pd.toLowerCase()) {
|
|
1272
|
+
pattern[pdi] = fd;
|
|
1273
|
+
patternStartIndex = pdi;
|
|
1274
|
+
fileStartIndex = fdi;
|
|
1275
|
+
}
|
|
1276
|
+
}
|
|
1277
|
+
}
|
|
1278
|
+
const { optimizationLevel = 1 } = this.options;
|
|
1279
|
+
if (optimizationLevel >= 2) file = this.levelTwoFileOptimize(file);
|
|
1280
|
+
if (pattern.includes(GLOBSTAR)) return this.#matchGlobstar(file, pattern, partial, fileStartIndex, patternStartIndex);
|
|
1281
|
+
return this.#matchOne(file, pattern, partial, fileStartIndex, patternStartIndex);
|
|
1282
|
+
}
|
|
1283
|
+
#matchGlobstar(file, pattern, partial, fileIndex, patternIndex) {
|
|
1284
|
+
const firstgs = pattern.indexOf(GLOBSTAR, patternIndex);
|
|
1285
|
+
const lastgs = pattern.lastIndexOf(GLOBSTAR);
|
|
1286
|
+
const [head, body, tail] = partial ? [
|
|
1287
|
+
pattern.slice(patternIndex, firstgs),
|
|
1288
|
+
pattern.slice(firstgs + 1),
|
|
1289
|
+
[]
|
|
1290
|
+
] : [
|
|
1291
|
+
pattern.slice(patternIndex, firstgs),
|
|
1292
|
+
pattern.slice(firstgs + 1, lastgs),
|
|
1293
|
+
pattern.slice(lastgs + 1)
|
|
1294
|
+
];
|
|
1295
|
+
if (head.length) {
|
|
1296
|
+
const fileHead = file.slice(fileIndex, fileIndex + head.length);
|
|
1297
|
+
if (!this.#matchOne(fileHead, head, partial, 0, 0)) return false;
|
|
1298
|
+
fileIndex += head.length;
|
|
1299
|
+
patternIndex += head.length;
|
|
1300
|
+
}
|
|
1301
|
+
let fileTailMatch = 0;
|
|
1302
|
+
if (tail.length) {
|
|
1303
|
+
if (tail.length + fileIndex > file.length) return false;
|
|
1304
|
+
let tailStart = file.length - tail.length;
|
|
1305
|
+
if (this.#matchOne(file, tail, partial, tailStart, 0)) fileTailMatch = tail.length;
|
|
1306
|
+
else {
|
|
1307
|
+
if (file[file.length - 1] !== "" || fileIndex + tail.length === file.length) return false;
|
|
1308
|
+
tailStart--;
|
|
1309
|
+
if (!this.#matchOne(file, tail, partial, tailStart, 0)) return false;
|
|
1310
|
+
fileTailMatch = tail.length + 1;
|
|
1311
|
+
}
|
|
1312
|
+
}
|
|
1313
|
+
if (!body.length) {
|
|
1314
|
+
let sawSome = !!fileTailMatch;
|
|
1315
|
+
for (let i = fileIndex; i < file.length - fileTailMatch; i++) {
|
|
1316
|
+
const f = String(file[i]);
|
|
1317
|
+
sawSome = true;
|
|
1318
|
+
if (f === "." || f === ".." || !this.options.dot && f.startsWith(".")) return false;
|
|
1319
|
+
}
|
|
1320
|
+
return partial || sawSome;
|
|
1321
|
+
}
|
|
1322
|
+
const bodySegments = [[[], 0]];
|
|
1323
|
+
let currentBody = bodySegments[0];
|
|
1324
|
+
let nonGsParts = 0;
|
|
1325
|
+
const nonGsPartsSums = [0];
|
|
1326
|
+
for (const b of body) if (b === GLOBSTAR) {
|
|
1327
|
+
nonGsPartsSums.push(nonGsParts);
|
|
1328
|
+
currentBody = [[], 0];
|
|
1329
|
+
bodySegments.push(currentBody);
|
|
1330
|
+
} else {
|
|
1331
|
+
currentBody[0].push(b);
|
|
1332
|
+
nonGsParts++;
|
|
1333
|
+
}
|
|
1334
|
+
let i = bodySegments.length - 1;
|
|
1335
|
+
const fileLength = file.length - fileTailMatch;
|
|
1336
|
+
for (const b of bodySegments) b[1] = fileLength - (nonGsPartsSums[i--] + b[0].length);
|
|
1337
|
+
return !!this.#matchGlobStarBodySections(file, bodySegments, fileIndex, 0, partial, 0, !!fileTailMatch);
|
|
1338
|
+
}
|
|
1339
|
+
#matchGlobStarBodySections(file, bodySegments, fileIndex, bodyIndex, partial, globStarDepth, sawTail) {
|
|
1340
|
+
const bs = bodySegments[bodyIndex];
|
|
1341
|
+
if (!bs) {
|
|
1342
|
+
for (let i = fileIndex; i < file.length; i++) {
|
|
1343
|
+
sawTail = true;
|
|
1344
|
+
const f = file[i];
|
|
1345
|
+
if (f === "." || f === ".." || !this.options.dot && f.startsWith(".")) return false;
|
|
1346
|
+
}
|
|
1347
|
+
return sawTail;
|
|
1348
|
+
}
|
|
1349
|
+
const [body, after] = bs;
|
|
1350
|
+
while (fileIndex <= after) {
|
|
1351
|
+
if (this.#matchOne(file.slice(0, fileIndex + body.length), body, partial, fileIndex, 0) && globStarDepth < this.maxGlobstarRecursion) {
|
|
1352
|
+
const sub = this.#matchGlobStarBodySections(file, bodySegments, fileIndex + body.length, bodyIndex + 1, partial, globStarDepth + 1, sawTail);
|
|
1353
|
+
if (sub !== false) return sub;
|
|
1354
|
+
}
|
|
1355
|
+
const f = file[fileIndex];
|
|
1356
|
+
if (f === "." || f === ".." || !this.options.dot && f.startsWith(".")) return false;
|
|
1357
|
+
fileIndex++;
|
|
1358
|
+
}
|
|
1359
|
+
return partial || null;
|
|
1360
|
+
}
|
|
1361
|
+
#matchOne(file, pattern, partial, fileIndex, patternIndex) {
|
|
1362
|
+
let fi;
|
|
1363
|
+
let pi;
|
|
1364
|
+
let pl;
|
|
1365
|
+
let fl;
|
|
1366
|
+
for (fi = fileIndex, pi = patternIndex, fl = file.length, pl = pattern.length; fi < fl && pi < pl; fi++, pi++) {
|
|
1367
|
+
this.debug("matchOne loop");
|
|
1368
|
+
let p = pattern[pi];
|
|
1369
|
+
let f = file[fi];
|
|
1370
|
+
this.debug(pattern, p, f);
|
|
1371
|
+
/* c8 ignore start */
|
|
1372
|
+
if (p === false || p === GLOBSTAR) return false;
|
|
1373
|
+
/* c8 ignore stop */
|
|
1374
|
+
let hit;
|
|
1375
|
+
if (typeof p === "string") {
|
|
1376
|
+
hit = f === p;
|
|
1377
|
+
this.debug("string match", p, f, hit);
|
|
1378
|
+
} else {
|
|
1379
|
+
hit = p.test(f);
|
|
1380
|
+
this.debug("pattern match", p, f, hit);
|
|
1381
|
+
}
|
|
1382
|
+
if (!hit) return false;
|
|
1383
|
+
}
|
|
1384
|
+
if (fi === fl && pi === pl) return true;
|
|
1385
|
+
else if (fi === fl) return partial;
|
|
1386
|
+
else if (pi === pl) return fi === fl - 1 && file[fi] === "";
|
|
1387
|
+
else throw new Error("wtf?");
|
|
1388
|
+
/* c8 ignore stop */
|
|
1389
|
+
}
|
|
1390
|
+
braceExpand() {
|
|
1391
|
+
return braceExpand(this.pattern, this.options);
|
|
1392
|
+
}
|
|
1393
|
+
parse(pattern) {
|
|
1394
|
+
assertValidPattern(pattern);
|
|
1395
|
+
const options = this.options;
|
|
1396
|
+
if (pattern === "**") return GLOBSTAR;
|
|
1397
|
+
if (pattern === "") return "";
|
|
1398
|
+
let m;
|
|
1399
|
+
let fastTest = null;
|
|
1400
|
+
if (m = pattern.match(starRE)) fastTest = options.dot ? starTestDot : starTest;
|
|
1401
|
+
else if (m = pattern.match(starDotExtRE)) fastTest = (options.nocase ? options.dot ? starDotExtTestNocaseDot : starDotExtTestNocase : options.dot ? starDotExtTestDot : starDotExtTest)(m[1]);
|
|
1402
|
+
else if (m = pattern.match(qmarksRE)) fastTest = (options.nocase ? options.dot ? qmarksTestNocaseDot : qmarksTestNocase : options.dot ? qmarksTestDot : qmarksTest)(m);
|
|
1403
|
+
else if (m = pattern.match(starDotStarRE)) fastTest = options.dot ? starDotStarTestDot : starDotStarTest;
|
|
1404
|
+
else if (m = pattern.match(dotStarRE)) fastTest = dotStarTest;
|
|
1405
|
+
const re = AST.fromGlob(pattern, this.options).toMMPattern();
|
|
1406
|
+
if (fastTest && typeof re === "object") Reflect.defineProperty(re, "test", { value: fastTest });
|
|
1407
|
+
return re;
|
|
1408
|
+
}
|
|
1409
|
+
makeRe() {
|
|
1410
|
+
if (this.regexp || this.regexp === false) return this.regexp;
|
|
1411
|
+
const set = this.set;
|
|
1412
|
+
if (!set.length) {
|
|
1413
|
+
this.regexp = false;
|
|
1414
|
+
return this.regexp;
|
|
1415
|
+
}
|
|
1416
|
+
const options = this.options;
|
|
1417
|
+
const twoStar = options.noglobstar ? star : options.dot ? twoStarDot : twoStarNoDot;
|
|
1418
|
+
const flags = new Set(options.nocase ? ["i"] : []);
|
|
1419
|
+
let re = set.map((pattern) => {
|
|
1420
|
+
const pp = pattern.map((p) => {
|
|
1421
|
+
if (p instanceof RegExp) for (const f of p.flags.split("")) flags.add(f);
|
|
1422
|
+
return typeof p === "string" ? regExpEscape(p) : p === GLOBSTAR ? GLOBSTAR : p._src;
|
|
1423
|
+
});
|
|
1424
|
+
pp.forEach((p, i) => {
|
|
1425
|
+
const next = pp[i + 1];
|
|
1426
|
+
const prev = pp[i - 1];
|
|
1427
|
+
if (p !== GLOBSTAR || prev === GLOBSTAR) return;
|
|
1428
|
+
if (prev === void 0) if (next !== void 0 && next !== GLOBSTAR) pp[i + 1] = "(?:\\/|" + twoStar + "\\/)?" + next;
|
|
1429
|
+
else pp[i] = twoStar;
|
|
1430
|
+
else if (next === void 0) pp[i - 1] = prev + "(?:\\/|\\/" + twoStar + ")?";
|
|
1431
|
+
else if (next !== GLOBSTAR) {
|
|
1432
|
+
pp[i - 1] = prev + "(?:\\/|\\/" + twoStar + "\\/)" + next;
|
|
1433
|
+
pp[i + 1] = GLOBSTAR;
|
|
1434
|
+
}
|
|
1435
|
+
});
|
|
1436
|
+
const filtered = pp.filter((p) => p !== GLOBSTAR);
|
|
1437
|
+
if (this.partial && filtered.length >= 1) {
|
|
1438
|
+
const prefixes = [];
|
|
1439
|
+
for (let i = 1; i <= filtered.length; i++) prefixes.push(filtered.slice(0, i).join("/"));
|
|
1440
|
+
return "(?:" + prefixes.join("|") + ")";
|
|
1441
|
+
}
|
|
1442
|
+
return filtered.join("/");
|
|
1443
|
+
}).join("|");
|
|
1444
|
+
const [open, close] = set.length > 1 ? ["(?:", ")"] : ["", ""];
|
|
1445
|
+
re = "^" + open + re + close + "$";
|
|
1446
|
+
if (this.partial) re = "^(?:\\/|" + open + re.slice(1, -1) + close + ")$";
|
|
1447
|
+
if (this.negate) re = "^(?!" + re + ").+$";
|
|
1448
|
+
try {
|
|
1449
|
+
this.regexp = new RegExp(re, [...flags].join(""));
|
|
1450
|
+
} catch {
|
|
1451
|
+
this.regexp = false;
|
|
1452
|
+
}
|
|
1453
|
+
/* c8 ignore stop */
|
|
1454
|
+
return this.regexp;
|
|
1455
|
+
}
|
|
1456
|
+
slashSplit(p) {
|
|
1457
|
+
if (this.preserveMultipleSlashes) return p.split("/");
|
|
1458
|
+
else if (this.isWindows && /^\/\/[^/]+/.test(p)) return ["", ...p.split(/\/+/)];
|
|
1459
|
+
else return p.split(/\/+/);
|
|
1460
|
+
}
|
|
1461
|
+
match(f, partial = this.partial) {
|
|
1462
|
+
this.debug("match", f, this.pattern);
|
|
1463
|
+
if (this.comment) return false;
|
|
1464
|
+
if (this.empty) return f === "";
|
|
1465
|
+
if (f === "/" && partial) return true;
|
|
1466
|
+
const options = this.options;
|
|
1467
|
+
if (this.isWindows) f = f.split("\\").join("/");
|
|
1468
|
+
const ff = this.slashSplit(f);
|
|
1469
|
+
this.debug(this.pattern, "split", ff);
|
|
1470
|
+
const set = this.set;
|
|
1471
|
+
this.debug(this.pattern, "set", set);
|
|
1472
|
+
let filename = ff[ff.length - 1];
|
|
1473
|
+
if (!filename) for (let i = ff.length - 2; !filename && i >= 0; i--) filename = ff[i];
|
|
1474
|
+
for (const pattern of set) {
|
|
1475
|
+
let file = ff;
|
|
1476
|
+
if (options.matchBase && pattern.length === 1) file = [filename];
|
|
1477
|
+
if (this.matchOne(file, pattern, partial)) {
|
|
1478
|
+
if (options.flipNegate) return true;
|
|
1479
|
+
return !this.negate;
|
|
1480
|
+
}
|
|
1481
|
+
}
|
|
1482
|
+
if (options.flipNegate) return false;
|
|
1483
|
+
return this.negate;
|
|
1484
|
+
}
|
|
1485
|
+
static defaults(def) {
|
|
1486
|
+
return minimatch.defaults(def).Minimatch;
|
|
1487
|
+
}
|
|
1488
|
+
};
|
|
1489
|
+
/* c8 ignore stop */
|
|
1490
|
+
minimatch.AST = AST;
|
|
1491
|
+
minimatch.Minimatch = Minimatch;
|
|
1492
|
+
minimatch.escape = escape;
|
|
1493
|
+
minimatch.unescape = unescape;
|
|
1494
|
+
//#endregion
|
|
1495
|
+
//#region ../../node_modules/.pnpm/just-bash@3.0.1/node_modules/just-bash/dist/bundle/chunks/chunk-R4IFXNY5.js
|
|
1496
|
+
createRequire(import.meta.url);
|
|
1497
|
+
function M(n) {
|
|
1498
|
+
if (n < 1024) return String(n);
|
|
1499
|
+
if (n < 1024 * 1024) {
|
|
1500
|
+
let c = n / 1024;
|
|
1501
|
+
return c < 10 ? `${c.toFixed(1)}K` : `${Math.round(c)}K`;
|
|
1502
|
+
}
|
|
1503
|
+
if (n < 1024 * 1024 * 1024) {
|
|
1504
|
+
let c = n / 1048576;
|
|
1505
|
+
return c < 10 ? `${c.toFixed(1)}M` : `${Math.round(c)}M`;
|
|
1506
|
+
}
|
|
1507
|
+
let s = n / (1024 * 1024 * 1024);
|
|
1508
|
+
return s < 10 ? `${s.toFixed(1)}G` : `${Math.round(s)}G`;
|
|
1509
|
+
}
|
|
1510
|
+
function T(n) {
|
|
1511
|
+
let c = [
|
|
1512
|
+
"Jan",
|
|
1513
|
+
"Feb",
|
|
1514
|
+
"Mar",
|
|
1515
|
+
"Apr",
|
|
1516
|
+
"May",
|
|
1517
|
+
"Jun",
|
|
1518
|
+
"Jul",
|
|
1519
|
+
"Aug",
|
|
1520
|
+
"Sep",
|
|
1521
|
+
"Oct",
|
|
1522
|
+
"Nov",
|
|
1523
|
+
"Dec"
|
|
1524
|
+
][n.getMonth()], w = String(n.getDate()).padStart(2, " ");
|
|
1525
|
+
if (n > /* @__PURE__ */ new Date((/* @__PURE__ */ new Date()).getTime() - 4320 * 60 * 60 * 1e3)) return `${c} ${w} ${String(n.getHours()).padStart(2, "0")}:${String(n.getMinutes()).padStart(2, "0")}`;
|
|
1526
|
+
return `${c} ${w} ${n.getFullYear()}`;
|
|
1527
|
+
}
|
|
1528
|
+
function C(n) {
|
|
1529
|
+
return n.isDirectory ? "/" : n.isSymbolicLink ? "@" : (n.mode & 73) !== 0 ? "*" : "";
|
|
1530
|
+
}
|
|
1531
|
+
var k = {
|
|
1532
|
+
name: "ls",
|
|
1533
|
+
summary: "list directory contents",
|
|
1534
|
+
usage: "ls [OPTION]... [FILE]...",
|
|
1535
|
+
options: [
|
|
1536
|
+
"-a, --all do not ignore entries starting with .",
|
|
1537
|
+
"-A, --almost-all do not list . and ..",
|
|
1538
|
+
"-d, --directory list directories themselves, not their contents",
|
|
1539
|
+
"-F, --classify append indicator (one of */=>@) to entries",
|
|
1540
|
+
"-h, --human-readable with -l, print sizes like 1K 234M 2G etc.",
|
|
1541
|
+
"-l use a long listing format",
|
|
1542
|
+
"-r, --reverse reverse order while sorting",
|
|
1543
|
+
"-R, --recursive list subdirectories recursively",
|
|
1544
|
+
"-S sort by file size, largest first",
|
|
1545
|
+
"-t sort by time, newest first",
|
|
1546
|
+
"-1 list one file per line",
|
|
1547
|
+
" --help display this help and exit"
|
|
1548
|
+
]
|
|
1549
|
+
}, G = {
|
|
1550
|
+
showAll: {
|
|
1551
|
+
short: "a",
|
|
1552
|
+
long: "all",
|
|
1553
|
+
type: "boolean"
|
|
1554
|
+
},
|
|
1555
|
+
showAlmostAll: {
|
|
1556
|
+
short: "A",
|
|
1557
|
+
long: "almost-all",
|
|
1558
|
+
type: "boolean"
|
|
1559
|
+
},
|
|
1560
|
+
longFormat: {
|
|
1561
|
+
short: "l",
|
|
1562
|
+
type: "boolean"
|
|
1563
|
+
},
|
|
1564
|
+
humanReadable: {
|
|
1565
|
+
short: "h",
|
|
1566
|
+
long: "human-readable",
|
|
1567
|
+
type: "boolean"
|
|
1568
|
+
},
|
|
1569
|
+
recursive: {
|
|
1570
|
+
short: "R",
|
|
1571
|
+
long: "recursive",
|
|
1572
|
+
type: "boolean"
|
|
1573
|
+
},
|
|
1574
|
+
reverse: {
|
|
1575
|
+
short: "r",
|
|
1576
|
+
long: "reverse",
|
|
1577
|
+
type: "boolean"
|
|
1578
|
+
},
|
|
1579
|
+
sortBySize: {
|
|
1580
|
+
short: "S",
|
|
1581
|
+
type: "boolean"
|
|
1582
|
+
},
|
|
1583
|
+
classifyFiles: {
|
|
1584
|
+
short: "F",
|
|
1585
|
+
long: "classify",
|
|
1586
|
+
type: "boolean"
|
|
1587
|
+
},
|
|
1588
|
+
directoryOnly: {
|
|
1589
|
+
short: "d",
|
|
1590
|
+
long: "directory",
|
|
1591
|
+
type: "boolean"
|
|
1592
|
+
},
|
|
1593
|
+
sortByTime: {
|
|
1594
|
+
short: "t",
|
|
1595
|
+
type: "boolean"
|
|
1596
|
+
},
|
|
1597
|
+
onePerLine: {
|
|
1598
|
+
short: "1",
|
|
1599
|
+
type: "boolean"
|
|
1600
|
+
}
|
|
1601
|
+
}, Z = {
|
|
1602
|
+
name: "ls",
|
|
1603
|
+
async execute(n, s$1) {
|
|
1604
|
+
if (o(n)) return s(k);
|
|
1605
|
+
let c = x("ls", n, G);
|
|
1606
|
+
if (!c.ok) return c.error;
|
|
1607
|
+
let w = c.result.flags.showAll, S = c.result.flags.showAlmostAll, y = c.result.flags.longFormat, P = c.result.flags.humanReadable, b = c.result.flags.recursive, g = c.result.flags.reverse, v = c.result.flags.sortBySize, $ = c.result.flags.classifyFiles, A = c.result.flags.directoryOnly;
|
|
1608
|
+
c.result.flags.sortByTime;
|
|
1609
|
+
c.result.flags.onePerLine;
|
|
1610
|
+
let r = c.result.positional;
|
|
1611
|
+
r.length === 0 && r.push(".");
|
|
1612
|
+
let a = "", l = "", u = 0;
|
|
1613
|
+
for (let f = 0; f < r.length; f++) {
|
|
1614
|
+
let o = r[f];
|
|
1615
|
+
if (f > 0 && a && !a.endsWith(`
|
|
1616
|
+
|
|
1617
|
+
`) && (a += `
|
|
1618
|
+
`), A) {
|
|
1619
|
+
let i = s$1.fs.resolvePath(s$1.cwd, o);
|
|
1620
|
+
try {
|
|
1621
|
+
let t = await s$1.fs.stat(i);
|
|
1622
|
+
if (y) {
|
|
1623
|
+
let e = t.isDirectory ? "drwxr-xr-x" : "-rw-r--r--", d = $ ? C(await s$1.fs.lstat(i)) : t.isDirectory ? "/" : "", h = t.size ?? 0, m = P ? M(h).padStart(5) : String(h).padStart(5), F = T(t.mtime ?? /* @__PURE__ */ new Date(0));
|
|
1624
|
+
a += `${e} 1 user user ${m} ${F} ${o}${d}
|
|
1625
|
+
`;
|
|
1626
|
+
} else {
|
|
1627
|
+
let e = $ ? C(await s$1.fs.lstat(i)) : "";
|
|
1628
|
+
a += `${o}${e}
|
|
1629
|
+
`;
|
|
1630
|
+
}
|
|
1631
|
+
} catch {
|
|
1632
|
+
l += `ls: cannot access '${o}': No such file or directory
|
|
1633
|
+
`, u = 2;
|
|
1634
|
+
}
|
|
1635
|
+
continue;
|
|
1636
|
+
}
|
|
1637
|
+
if (o.includes("*") || o.includes("?") || o.includes("[")) {
|
|
1638
|
+
let i = await _(o, s$1, w, S, y, g, P, v, $);
|
|
1639
|
+
a += i.stdout, l += i.stderr, i.exitCode !== 0 && (u = i.exitCode);
|
|
1640
|
+
} else {
|
|
1641
|
+
let i = await O(o, s$1, w, S, y, b, r.length > 1, g, P, v, $);
|
|
1642
|
+
a += i.stdout, l += i.stderr, i.exitCode !== 0 && (u = i.exitCode);
|
|
1643
|
+
}
|
|
1644
|
+
}
|
|
1645
|
+
return {
|
|
1646
|
+
stdout: a,
|
|
1647
|
+
stderr: l,
|
|
1648
|
+
exitCode: u
|
|
1649
|
+
};
|
|
1650
|
+
}
|
|
1651
|
+
};
|
|
1652
|
+
async function _(n, s, c, w, S, y = !1, P = !1, b = !1, g = !1) {
|
|
1653
|
+
let v = c || w, $ = s.fs.getAllPaths(), A = s.fs.resolvePath(s.cwd, "."), p = [];
|
|
1654
|
+
for (let r of $) {
|
|
1655
|
+
let a = r.startsWith(A) && r.slice(A.length + 1) || r;
|
|
1656
|
+
if (minimatch(a, n) || minimatch(r, n)) {
|
|
1657
|
+
let l = a.split("/").pop() || a;
|
|
1658
|
+
if (!v && l.startsWith(".")) continue;
|
|
1659
|
+
p.push(a || r);
|
|
1660
|
+
}
|
|
1661
|
+
}
|
|
1662
|
+
if (p.length === 0) return {
|
|
1663
|
+
stdout: "",
|
|
1664
|
+
stderr: `ls: ${n}: No such file or directory
|
|
1665
|
+
`,
|
|
1666
|
+
exitCode: 2
|
|
1667
|
+
};
|
|
1668
|
+
if (b) {
|
|
1669
|
+
let r = [];
|
|
1670
|
+
for (let a of p) {
|
|
1671
|
+
let l = s.fs.resolvePath(s.cwd, a);
|
|
1672
|
+
try {
|
|
1673
|
+
let u = await s.fs.stat(l);
|
|
1674
|
+
r.push({
|
|
1675
|
+
path: a,
|
|
1676
|
+
size: u.size ?? 0
|
|
1677
|
+
});
|
|
1678
|
+
} catch {
|
|
1679
|
+
r.push({
|
|
1680
|
+
path: a,
|
|
1681
|
+
size: 0
|
|
1682
|
+
});
|
|
1683
|
+
}
|
|
1684
|
+
}
|
|
1685
|
+
r.sort((a, l) => l.size - a.size), p.length = 0, p.push(...r.map((a) => a.path));
|
|
1686
|
+
} else p.sort();
|
|
1687
|
+
if (y && p.reverse(), S) {
|
|
1688
|
+
let r = [];
|
|
1689
|
+
for (let a of p) {
|
|
1690
|
+
let l = s.fs.resolvePath(s.cwd, a);
|
|
1691
|
+
try {
|
|
1692
|
+
let u = await s.fs.stat(l), f = u.isDirectory ? "drwxr-xr-x" : "-rw-r--r--", o = g ? C(await s.fs.lstat(l)) : u.isDirectory ? "/" : "", i = u.size ?? 0, t = P ? M(i).padStart(5) : String(i).padStart(5), d = T(u.mtime ?? /* @__PURE__ */ new Date(0));
|
|
1693
|
+
r.push(`${f} 1 user user ${t} ${d} ${a}${o}`);
|
|
1694
|
+
} catch {
|
|
1695
|
+
r.push(`-rw-r--r-- 1 user user 0 Jan 1 00:00 ${a}`);
|
|
1696
|
+
}
|
|
1697
|
+
}
|
|
1698
|
+
return {
|
|
1699
|
+
stdout: `${r.join(`
|
|
1700
|
+
`)}
|
|
1701
|
+
`,
|
|
1702
|
+
stderr: "",
|
|
1703
|
+
exitCode: 0
|
|
1704
|
+
};
|
|
1705
|
+
}
|
|
1706
|
+
if (g) {
|
|
1707
|
+
let r = [];
|
|
1708
|
+
for (let a of p) {
|
|
1709
|
+
let l = s.fs.resolvePath(s.cwd, a);
|
|
1710
|
+
try {
|
|
1711
|
+
let u = await s.fs.lstat(l);
|
|
1712
|
+
r.push(`${a}${C(u)}`);
|
|
1713
|
+
} catch {
|
|
1714
|
+
r.push(a);
|
|
1715
|
+
}
|
|
1716
|
+
}
|
|
1717
|
+
return {
|
|
1718
|
+
stdout: `${r.join(`
|
|
1719
|
+
`)}
|
|
1720
|
+
`,
|
|
1721
|
+
stderr: "",
|
|
1722
|
+
exitCode: 0
|
|
1723
|
+
};
|
|
1724
|
+
}
|
|
1725
|
+
return {
|
|
1726
|
+
stdout: `${p.join(`
|
|
1727
|
+
`)}
|
|
1728
|
+
`,
|
|
1729
|
+
stderr: "",
|
|
1730
|
+
exitCode: 0
|
|
1731
|
+
};
|
|
1732
|
+
}
|
|
1733
|
+
async function O(n, s, c, w, S, y, P, b = !1, g = !1, v = !1, $ = !1, A = !1) {
|
|
1734
|
+
let p = c || w, r = s.fs.resolvePath(s.cwd, n);
|
|
1735
|
+
try {
|
|
1736
|
+
let a = await s.fs.stat(r);
|
|
1737
|
+
if (!a.isDirectory) {
|
|
1738
|
+
let f = $ ? C(await s.fs.lstat(r)) : "";
|
|
1739
|
+
if (S) {
|
|
1740
|
+
let o = a.size ?? 0;
|
|
1741
|
+
return {
|
|
1742
|
+
stdout: `-rw-r--r-- 1 user user ${g ? M(o).padStart(5) : String(o).padStart(5)} ${T(a.mtime ?? /* @__PURE__ */ new Date(0))} ${n}${f}
|
|
1743
|
+
`,
|
|
1744
|
+
stderr: "",
|
|
1745
|
+
exitCode: 0
|
|
1746
|
+
};
|
|
1747
|
+
}
|
|
1748
|
+
return {
|
|
1749
|
+
stdout: `${n}${f}
|
|
1750
|
+
`,
|
|
1751
|
+
stderr: "",
|
|
1752
|
+
exitCode: 0
|
|
1753
|
+
};
|
|
1754
|
+
}
|
|
1755
|
+
let l = await s.fs.readdir(r);
|
|
1756
|
+
if (p || (l = l.filter((f) => !f.startsWith("."))), v) {
|
|
1757
|
+
let f = [];
|
|
1758
|
+
for (let o of l) {
|
|
1759
|
+
let i = r === "/" ? `/${o}` : `${r}/${o}`;
|
|
1760
|
+
try {
|
|
1761
|
+
let t = await s.fs.stat(i);
|
|
1762
|
+
f.push({
|
|
1763
|
+
name: o,
|
|
1764
|
+
size: t.size ?? 0
|
|
1765
|
+
});
|
|
1766
|
+
} catch {
|
|
1767
|
+
f.push({
|
|
1768
|
+
name: o,
|
|
1769
|
+
size: 0
|
|
1770
|
+
});
|
|
1771
|
+
}
|
|
1772
|
+
}
|
|
1773
|
+
f.sort((o, i) => i.size - o.size), l = f.map((o) => o.name);
|
|
1774
|
+
} else l.sort();
|
|
1775
|
+
c && (l = [
|
|
1776
|
+
".",
|
|
1777
|
+
"..",
|
|
1778
|
+
...l
|
|
1779
|
+
]), b && l.reverse();
|
|
1780
|
+
let u = "";
|
|
1781
|
+
if ((y || P) && (u += `${n}:
|
|
1782
|
+
`), S) {
|
|
1783
|
+
u += `total ${l.length}
|
|
1784
|
+
`;
|
|
1785
|
+
let f = l.filter((e) => e === "." || e === ".."), o = l.filter((e) => e !== "." && e !== "..");
|
|
1786
|
+
for (let e of f) u += `drwxr-xr-x 1 user user 0 Jan 1 00:00 ${e}
|
|
1787
|
+
`;
|
|
1788
|
+
let i = [];
|
|
1789
|
+
for (let e = 0; e < o.length; e += 100) {
|
|
1790
|
+
let d = o.slice(e, e + 100), h = await Promise.all(d.map(async (m) => {
|
|
1791
|
+
let z = r === "/" ? `/${m}` : `${r}/${m}`;
|
|
1792
|
+
try {
|
|
1793
|
+
let F = await s.fs.stat(z), B = F.isDirectory ? "drwxr-xr-x" : "-rw-r--r--", J = $ ? C(await s.fs.lstat(z)) : F.isDirectory ? "/" : "", W = F.size ?? 0;
|
|
1794
|
+
return {
|
|
1795
|
+
name: m,
|
|
1796
|
+
line: `${B} 1 user user ${g ? M(W).padStart(5) : String(W).padStart(5)} ${T(F.mtime ?? /* @__PURE__ */ new Date(0))} ${m}${J}
|
|
1797
|
+
`
|
|
1798
|
+
};
|
|
1799
|
+
} catch {
|
|
1800
|
+
return {
|
|
1801
|
+
name: m,
|
|
1802
|
+
line: `-rw-r--r-- 1 user user 0 Jan 1 00:00 ${m}
|
|
1803
|
+
`
|
|
1804
|
+
};
|
|
1805
|
+
}
|
|
1806
|
+
}));
|
|
1807
|
+
i.push(...h);
|
|
1808
|
+
}
|
|
1809
|
+
let t = new Map(o.map((e, d) => [e, d]));
|
|
1810
|
+
i.sort((e, d) => (t.get(e.name) ?? 0) - (t.get(d.name) ?? 0));
|
|
1811
|
+
for (let { line: e } of i) u += e;
|
|
1812
|
+
} else if ($) {
|
|
1813
|
+
let f = [], o = l.filter((t) => t !== "." && t !== ".."), i = l.filter((t) => t === "." || t === "..");
|
|
1814
|
+
for (let t of i) f.push(`${t}/`);
|
|
1815
|
+
for (let t = 0; t < o.length; t += 100) {
|
|
1816
|
+
let e = o.slice(t, t + 100), d = await Promise.all(e.map(async (h) => {
|
|
1817
|
+
let m = r === "/" ? `/${h}` : `${r}/${h}`;
|
|
1818
|
+
try {
|
|
1819
|
+
return `${h}${C(await s.fs.lstat(m))}`;
|
|
1820
|
+
} catch {
|
|
1821
|
+
return h;
|
|
1822
|
+
}
|
|
1823
|
+
}));
|
|
1824
|
+
f.push(...d);
|
|
1825
|
+
}
|
|
1826
|
+
u += f.join(`
|
|
1827
|
+
`) + (f.length ? `
|
|
1828
|
+
` : "");
|
|
1829
|
+
} else u += l.join(`
|
|
1830
|
+
`) + (l.length ? `
|
|
1831
|
+
` : "");
|
|
1832
|
+
if (y) {
|
|
1833
|
+
let f = l.filter((t) => t !== "." && t !== ".."), o = [];
|
|
1834
|
+
if (s.fs.readdirWithFileTypes) o = (await s.fs.readdirWithFileTypes(r)).filter((e) => e.isDirectory && f.includes(e.name)).map((e) => ({
|
|
1835
|
+
name: e.name,
|
|
1836
|
+
isDirectory: !0
|
|
1837
|
+
}));
|
|
1838
|
+
else for (let t = 0; t < f.length; t += 100) {
|
|
1839
|
+
let e = f.slice(t, t + 100), d = await Promise.all(e.map(async (h) => {
|
|
1840
|
+
let m = r === "/" ? `/${h}` : `${r}/${h}`;
|
|
1841
|
+
try {
|
|
1842
|
+
return {
|
|
1843
|
+
name: h,
|
|
1844
|
+
isDirectory: (await s.fs.stat(m)).isDirectory
|
|
1845
|
+
};
|
|
1846
|
+
} catch {
|
|
1847
|
+
return {
|
|
1848
|
+
name: h,
|
|
1849
|
+
isDirectory: !1
|
|
1850
|
+
};
|
|
1851
|
+
}
|
|
1852
|
+
}));
|
|
1853
|
+
o.push(...d.filter((h) => h.isDirectory));
|
|
1854
|
+
}
|
|
1855
|
+
o.sort((t, e) => t.name.localeCompare(e.name)), b && o.reverse();
|
|
1856
|
+
let i = [];
|
|
1857
|
+
for (let t = 0; t < o.length; t += 100) {
|
|
1858
|
+
let e = o.slice(t, t + 100), d = await Promise.all(e.map(async (h) => {
|
|
1859
|
+
let z = await O(n === "." ? `./${h.name}` : `${n}/${h.name}`, s, c, w, S, y, !1, b, g, v, $, !0);
|
|
1860
|
+
return {
|
|
1861
|
+
name: h.name,
|
|
1862
|
+
result: z
|
|
1863
|
+
};
|
|
1864
|
+
}));
|
|
1865
|
+
i.push(...d);
|
|
1866
|
+
}
|
|
1867
|
+
i.sort((t, e) => t.name.localeCompare(e.name)), b && i.reverse();
|
|
1868
|
+
for (let { result: t } of i) u += `
|
|
1869
|
+
`, u += t.stdout;
|
|
1870
|
+
}
|
|
1871
|
+
return {
|
|
1872
|
+
stdout: u,
|
|
1873
|
+
stderr: "",
|
|
1874
|
+
exitCode: 0
|
|
1875
|
+
};
|
|
1876
|
+
} catch {
|
|
1877
|
+
return {
|
|
1878
|
+
stdout: "",
|
|
1879
|
+
stderr: `ls: ${n}: No such file or directory
|
|
1880
|
+
`,
|
|
1881
|
+
exitCode: 2
|
|
1882
|
+
};
|
|
1883
|
+
}
|
|
1884
|
+
}
|
|
1885
|
+
//#endregion
|
|
1886
|
+
//#region ../../node_modules/.pnpm/just-bash@3.0.1/node_modules/just-bash/dist/bundle/chunks/ls-ZJGQER7M.js
|
|
1887
|
+
createRequire(import.meta.url);
|
|
1888
|
+
//#endregion
|
|
1889
|
+
export { Z as lsCommand };
|
|
1890
|
+
|
|
1891
|
+
//# sourceMappingURL=ls-ZJGQER7M-DLDSfI4x.mjs.map
|