@jerryan/just-bash 3.9.0 → 3.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +24 -0
- package/dist/bin/chunks/builtin-manifest-ORBIZM7I.js +3 -0
- package/dist/bin/chunks/{chmod-GX5SYTRL.js → chmod-S4ARARR4.js} +1 -1
- package/dist/bin/chunks/{chunk-GBKR5KTT.js → chunk-3ASHUC7C.js} +13 -13
- package/dist/bin/chunks/{chunk-3ROYEBJI.js → chunk-4JPWP5WS.js} +1 -1
- package/dist/bin/{shell/chunks/chunk-DRPHNXG7.js → chunks/chunk-7LGT4LHQ.js} +1 -1
- package/dist/bin/{shell/chunks/chunk-MBREBDZQ.js → chunks/chunk-AIWBN36Z.js} +1 -1
- package/dist/bin/chunks/chunk-AQKIHX3Q.js +3 -0
- package/dist/bin/chunks/chunk-E2O6S35K.js +10 -0
- package/dist/bin/chunks/{chunk-F2PYTUMR.js → chunk-F4ACJZIY.js} +7 -6
- package/dist/bin/{shell/chunks/chunk-6JEDM6CZ.js → chunks/chunk-GKJD4ULC.js} +1 -1
- package/dist/bin/{shell/chunks/chunk-QJWFCA7P.js → chunks/chunk-HARVZWUX.js} +1 -1
- package/dist/bin/chunks/chunk-IRCAXXH6.js +14 -0
- package/dist/bin/chunks/{chunk-T6OIISUC.js → chunk-K65FCSAT.js} +1 -1
- package/dist/bin/{shell/chunks/chunk-6FGMEZZP.js → chunks/chunk-MWQMHODV.js} +1 -1
- package/dist/bin/chunks/{chunk-BB5VTPMQ.js → chunk-NSI6LMDS.js} +1 -1
- package/dist/bin/{shell/chunks/chunk-ABP4OLJV.js → chunks/chunk-OXEDIWNZ.js} +1 -1
- package/dist/bin/chunks/{chunk-KMYJMEON.js → chunk-R7THHH4J.js} +1 -1
- package/dist/bin/chunks/chunk-UBA7DOWE.js +3 -0
- package/dist/bin/{shell/chunks/chunk-VPSBWWXM.js → chunks/chunk-UNCYBFWT.js} +7 -6
- package/dist/bin/chunks/chunk-VMVXACZ5.js +6 -0
- package/dist/bin/chunks/chunk-Z3TCELKN.js +12 -0
- package/dist/bin/chunks/{cp-YLP7ULVT.js → cp-WRBRHVVD.js} +1 -1
- package/dist/bin/{shell/chunks/diff-DM47S5PT.js → chunks/diff-YLVT27CZ.js} +1 -1
- package/dist/bin/{shell/chunks/du-DH76GZJ3.js → chunks/du-YNAJTGCR.js} +1 -1
- package/dist/bin/{shell/chunks/find-MHC4QV6H.js → chunks/find-T3JZPTUX.js} +1 -1
- package/dist/bin/chunks/{flag-coverage-LLAQBVIG.js → flag-coverage-LVKHEUTL.js} +1 -1
- package/dist/bin/chunks/{gzip-UQZL4R74.js → gzip-EXJSFNCU.js} +1 -1
- package/dist/bin/{shell/chunks/js-exec-ZAAIZQWI.js → chunks/js-exec-PLUMFEX6.js} +1 -1
- package/dist/bin/chunks/{ls-5Z45FV4U.js → ls-LOCOWLZ3.js} +1 -1
- package/dist/bin/chunks/{mkdir-YJ3SOVRP.js → mkdir-VHLJ3E65.js} +1 -1
- package/dist/bin/chunks/{mv-EOOP2TO3.js → mv-NAMOL2HF.js} +1 -1
- package/dist/bin/chunks/{python3-TJ6DCPIA.js → python3-J5GXF27H.js} +5 -5
- package/dist/bin/{shell/chunks/readlink-EJ3IKLWW.js → chunks/readlink-BF435HNQ.js} +1 -1
- package/dist/bin/chunks/{rg-WHVR3YDT.js → rg-XF5U7GS2.js} +1 -1
- package/dist/bin/{shell/chunks/rm-B4LVIG7A.js → chunks/rm-L4RHENMV.js} +1 -1
- package/dist/bin/{shell/chunks/rmdir-PRNISPBA.js → chunks/rmdir-W73C4GEA.js} +1 -1
- package/dist/bin/{shell/chunks/split-HIFKSV2A.js → chunks/split-2VXPZJJ4.js} +1 -1
- package/dist/bin/chunks/{sqlite3-CXQTZRPZ.js → sqlite3-3S5HIA5W.js} +1 -1
- package/dist/bin/chunks/{which-4TPGVSBZ.js → which-G7X54RZL.js} +1 -1
- package/dist/bin/just-bash.js +243 -242
- package/dist/bin/shell/chunks/builtin-manifest-ORBIZM7I.js +3 -0
- package/dist/bin/shell/chunks/{chmod-GX5SYTRL.js → chmod-S4ARARR4.js} +1 -1
- package/dist/bin/shell/chunks/{chunk-GBKR5KTT.js → chunk-3ASHUC7C.js} +13 -13
- package/dist/bin/shell/chunks/{chunk-3ROYEBJI.js → chunk-4JPWP5WS.js} +1 -1
- package/dist/bin/{chunks/chunk-DRPHNXG7.js → shell/chunks/chunk-7LGT4LHQ.js} +1 -1
- package/dist/bin/{chunks/chunk-MBREBDZQ.js → shell/chunks/chunk-AIWBN36Z.js} +1 -1
- package/dist/bin/shell/chunks/chunk-AQKIHX3Q.js +3 -0
- package/dist/bin/shell/chunks/chunk-E2O6S35K.js +10 -0
- package/dist/bin/shell/chunks/{chunk-F2PYTUMR.js → chunk-F4ACJZIY.js} +7 -6
- package/dist/bin/{chunks/chunk-6JEDM6CZ.js → shell/chunks/chunk-GKJD4ULC.js} +1 -1
- package/dist/bin/{chunks/chunk-QJWFCA7P.js → shell/chunks/chunk-HARVZWUX.js} +1 -1
- package/dist/bin/shell/chunks/chunk-IRCAXXH6.js +14 -0
- package/dist/bin/shell/chunks/{chunk-T6OIISUC.js → chunk-K65FCSAT.js} +1 -1
- package/dist/bin/{chunks/chunk-6FGMEZZP.js → shell/chunks/chunk-MWQMHODV.js} +1 -1
- package/dist/bin/shell/chunks/{chunk-BB5VTPMQ.js → chunk-NSI6LMDS.js} +1 -1
- package/dist/bin/{chunks/chunk-ABP4OLJV.js → shell/chunks/chunk-OXEDIWNZ.js} +1 -1
- package/dist/bin/shell/chunks/{chunk-KMYJMEON.js → chunk-R7THHH4J.js} +1 -1
- package/dist/bin/shell/chunks/chunk-UBA7DOWE.js +3 -0
- package/dist/bin/{chunks/chunk-VPSBWWXM.js → shell/chunks/chunk-UNCYBFWT.js} +7 -6
- package/dist/bin/shell/chunks/chunk-VMVXACZ5.js +6 -0
- package/dist/bin/shell/chunks/chunk-Z3TCELKN.js +12 -0
- package/dist/bin/shell/chunks/{cp-YLP7ULVT.js → cp-WRBRHVVD.js} +1 -1
- package/dist/bin/{chunks/diff-DM47S5PT.js → shell/chunks/diff-YLVT27CZ.js} +1 -1
- package/dist/bin/{chunks/du-DH76GZJ3.js → shell/chunks/du-YNAJTGCR.js} +1 -1
- package/dist/bin/{chunks/find-MHC4QV6H.js → shell/chunks/find-T3JZPTUX.js} +1 -1
- package/dist/bin/shell/chunks/{flag-coverage-LLAQBVIG.js → flag-coverage-LVKHEUTL.js} +1 -1
- package/dist/bin/shell/chunks/{gzip-UQZL4R74.js → gzip-EXJSFNCU.js} +1 -1
- package/dist/bin/{chunks/js-exec-ZAAIZQWI.js → shell/chunks/js-exec-PLUMFEX6.js} +1 -1
- package/dist/bin/shell/chunks/{ls-5Z45FV4U.js → ls-LOCOWLZ3.js} +1 -1
- package/dist/bin/shell/chunks/{mkdir-YJ3SOVRP.js → mkdir-VHLJ3E65.js} +1 -1
- package/dist/bin/shell/chunks/{mv-EOOP2TO3.js → mv-NAMOL2HF.js} +1 -1
- package/dist/bin/shell/chunks/{python3-TJ6DCPIA.js → python3-J5GXF27H.js} +5 -5
- package/dist/bin/{chunks/readlink-EJ3IKLWW.js → shell/chunks/readlink-BF435HNQ.js} +1 -1
- package/dist/bin/shell/chunks/{rg-WHVR3YDT.js → rg-XF5U7GS2.js} +1 -1
- package/dist/bin/{chunks/rm-B4LVIG7A.js → shell/chunks/rm-L4RHENMV.js} +1 -1
- package/dist/bin/{chunks/rmdir-PRNISPBA.js → shell/chunks/rmdir-W73C4GEA.js} +1 -1
- package/dist/bin/{chunks/split-HIFKSV2A.js → shell/chunks/split-2VXPZJJ4.js} +1 -1
- package/dist/bin/shell/chunks/{sqlite3-CXQTZRPZ.js → sqlite3-3S5HIA5W.js} +1 -1
- package/dist/bin/shell/chunks/{which-4TPGVSBZ.js → which-G7X54RZL.js} +1 -1
- package/dist/bin/shell/shell.js +305 -304
- package/dist/bundle/browser.js +571 -562
- package/dist/bundle/chunks/builtin-manifest-7MJJDZ2T.js +2 -0
- package/dist/bundle/chunks/{chmod-TEY5MD2W.js → chmod-KMFNCMRX.js} +1 -1
- package/dist/bundle/chunks/{chunk-E2F4A3CM.js → chunk-2A4OZBCS.js} +5 -5
- package/dist/bundle/chunks/{chunk-SE23TEGG.js → chunk-4CDTAUYP.js} +1 -1
- package/dist/bundle/chunks/chunk-4OKRFRMS.js +13 -0
- package/dist/bundle/chunks/{chunk-ATGOUOX2.js → chunk-4WRO2G22.js} +1 -1
- package/dist/bundle/chunks/{chunk-45QZRGYF.js → chunk-5KOWUQOZ.js} +7 -6
- package/dist/bundle/chunks/{chunk-6HO6HX7V.js → chunk-5NUTFEEG.js} +1 -1
- package/dist/bundle/chunks/{chunk-WE7BJ7YU.js → chunk-6IFH67ZB.js} +1 -1
- package/dist/bundle/chunks/chunk-6L6OYVLY.js +2 -0
- package/dist/bundle/chunks/chunk-BMBITA6Y.js +2 -0
- package/dist/bundle/chunks/{chunk-S6DNKKUL.js → chunk-CM4T4GB4.js} +1 -1
- package/dist/bundle/chunks/{chunk-MWL2I5BV.js → chunk-FXAKF2QS.js} +1 -1
- package/dist/bundle/chunks/chunk-H4AFUSSQ.js +9 -0
- package/dist/bundle/chunks/{chunk-H3A45X3W.js → chunk-MMXJJCAE.js} +1 -1
- package/dist/bundle/chunks/{chunk-6QAM55HM.js → chunk-NFODJFHN.js} +1 -1
- package/dist/bundle/chunks/{chunk-LRFR25IP.js → chunk-O5OYOY3C.js} +7 -6
- package/dist/bundle/chunks/{chunk-HCKTU6IR.js → chunk-PASYAXFP.js} +1 -1
- package/dist/bundle/chunks/chunk-THDUQVY3.js +11 -0
- package/dist/bundle/chunks/{chunk-FSKXIFYT.js → chunk-Y6UHNLT5.js} +1 -1
- package/dist/bundle/chunks/chunk-ZIQS5QAW.js +5 -0
- package/dist/bundle/chunks/{cp-UR762VVT.js → cp-P2D2L6PC.js} +1 -1
- package/dist/bundle/chunks/{diff-R7TXVVLN.js → diff-Z3XOLW44.js} +1 -1
- package/dist/bundle/chunks/{du-EQKH3UNA.js → du-YBSJVBXP.js} +1 -1
- package/dist/bundle/chunks/{find-RLKBCGJR.js → find-IUWEB4XQ.js} +1 -1
- package/dist/bundle/chunks/{flag-coverage-YQGACUSN.js → flag-coverage-SZ4AUPRQ.js} +1 -1
- package/dist/bundle/chunks/{gzip-KC5ENBD2.js → gzip-VUJBDHZ5.js} +1 -1
- package/dist/bundle/chunks/{js-exec-MUZRDUJ3.js → js-exec-6RW7WZCG.js} +1 -1
- package/dist/bundle/chunks/{ls-WH5S4PPL.js → ls-ECKG2XHZ.js} +1 -1
- package/dist/bundle/chunks/{mkdir-Z6MMWH3D.js → mkdir-YL7XGMD7.js} +1 -1
- package/dist/bundle/chunks/{mv-WE7DBLEK.js → mv-IF55A2UD.js} +1 -1
- package/dist/bundle/chunks/{python3-W4UMQJAQ.js → python3-XHTOW7VA.js} +5 -5
- package/dist/bundle/chunks/{readlink-JSRKXLLQ.js → readlink-7XGQ3PL7.js} +1 -1
- package/dist/bundle/chunks/{rg-JKB7DR66.js → rg-E6H2HACA.js} +1 -1
- package/dist/bundle/chunks/{rm-IGPLE632.js → rm-CWLMERIO.js} +1 -1
- package/dist/bundle/chunks/{rmdir-3WTXMVKI.js → rmdir-WKKBLZ54.js} +1 -1
- package/dist/bundle/chunks/{split-HUKVGJTW.js → split-NEU2K2YN.js} +1 -1
- package/dist/bundle/chunks/{sqlite3-DQNCWDG5.js → sqlite3-KJ5NMKBM.js} +1 -1
- package/dist/bundle/chunks/{which-UWVKETYW.js → which-BP5YY5BR.js} +1 -1
- package/dist/bundle/index.cjs +744 -735
- package/dist/bundle/index.js +210 -209
- package/dist/commands/which/which.d.ts +10 -0
- package/dist/custom-commands.d.ts +5 -0
- package/dist/fs/path-utils.d.ts +0 -4
- package/dist/limits.d.ts +0 -3
- package/dist/types.d.ts +6 -0
- package/package.json +1 -1
- package/dist/bin/chunks/chunk-6JUPBMCR.js +0 -13
- package/dist/bin/chunks/chunk-CN4JKMTR.js +0 -8
- package/dist/bin/chunks/chunk-HWK7KFGB.js +0 -3
- package/dist/bin/chunks/chunk-RTN6X652.js +0 -11
- package/dist/bin/chunks/chunk-RVPTAYDS.js +0 -4
- package/dist/bin/shell/chunks/chunk-6JUPBMCR.js +0 -13
- package/dist/bin/shell/chunks/chunk-CN4JKMTR.js +0 -8
- package/dist/bin/shell/chunks/chunk-HWK7KFGB.js +0 -3
- package/dist/bin/shell/chunks/chunk-RTN6X652.js +0 -11
- package/dist/bin/shell/chunks/chunk-RVPTAYDS.js +0 -4
- package/dist/bundle/chunks/chunk-2SMD2AUA.js +0 -3
- package/dist/bundle/chunks/chunk-3OBCZP7T.js +0 -12
- package/dist/bundle/chunks/chunk-4CC3OZPU.js +0 -2
- package/dist/bundle/chunks/chunk-A257L6QO.js +0 -7
- package/dist/bundle/chunks/chunk-RWQWFXMH.js +0 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
# just-bash
|
|
2
2
|
|
|
3
|
+
## 3.10.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`c8b5eb6`](https://github.com/JerryAZR/just-bash/commit/c8b5eb67659a3269e7410353573be829026a8214) Thanks [@JerryAZR](https://github.com/JerryAZR)! - feat: generic --version, EROFS GNU messages, which improvements
|
|
8
|
+
|
|
9
|
+
- All commands respond to `--version` with `<cmd> (just-bash)` via
|
|
10
|
+
dispatch-level interception. Commands that handle their own version
|
|
11
|
+
(python3, js-exec, diff, rg) set `handlesOwnVersion: true`. Custom
|
|
12
|
+
commands that handle `--version` must set `handlesOwnVersion: true`
|
|
13
|
+
to opt out of the generic response.
|
|
14
|
+
- rm/cp/mv/mkdir map EROFS to "Read-only file system" (GNU style).
|
|
15
|
+
Redirect failures use errno descriptions ("Read-only file system",
|
|
16
|
+
"Permission denied", etc.) matching real bash.
|
|
17
|
+
- `which` checks shell builtins when no file found in PATH, and prints
|
|
18
|
+
"which: no X in this sandboxed bash environment" on miss.
|
|
19
|
+
- rg implements `--version`.
|
|
20
|
+
|
|
21
|
+
- [`c8b5eb6`](https://github.com/JerryAZR/just-bash/commit/c8b5eb67659a3269e7410353573be829026a8214) Thanks [@JerryAZR](https://github.com/JerryAZR)! - feat: Windows drive-letter path translation (win32 only)
|
|
22
|
+
|
|
23
|
+
On Windows, `C:\foo\bar` and `C:/foo/bar` are translated to `/c/foo/bar`
|
|
24
|
+
(Git Bash convention) in `resolvePath`. On POSIX, `C:\foo` is a valid
|
|
25
|
+
relative filename and is NOT rewritten.
|
|
26
|
+
|
|
3
27
|
## 3.9.0
|
|
4
28
|
|
|
5
29
|
### Minor Changes
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
3
|
+
import{a,b,c,d,e}from"./chunk-AQKIHX3Q.js";import"./chunk-DN2YCFOR.js";export{a as BUILTIN_MANIFEST,b as SHELL_BUILTINS,c as UNIMPLEMENTED_BUILTIN_NAMES,d as builtinPhase,e as builtinPosixEarly};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
3
|
-
import{a,b}from"./chunk-
|
|
3
|
+
import{a,b}from"./chunk-K65FCSAT.js";import"./chunk-GR4ZHKXI.js";import"./chunk-HWI42GQO.js";import"./chunk-I57EACSL.js";import"./chunk-AIWBN36Z.js";import"./chunk-UBA7DOWE.js";import"./chunk-FUT3X2GJ.js";import"./chunk-CPKBPQ2C.js";import"./chunk-OHFB3M3X.js";import"./chunk-PBOVSFTJ.js";import"./chunk-MUFNRCMY.js";import"./chunk-DN2YCFOR.js";export{a as chmodCommand,b as flagsForFuzzing};
|
|
@@ -1,36 +1,36 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
3
3
|
import{b as T}from"./chunk-CPKBPQ2C.js";import{a as R}from"./chunk-NE4R2FVV.js";import{a as _,b as k}from"./chunk-MUFNRCMY.js";var L=class{diff(t,o,e={}){let i;typeof e=="function"?(i=e,e={}):"callback"in e&&(i=e.callback);let s=this.castInput(t,e),f=this.castInput(o,e),l=this.removeEmpty(this.tokenize(s,e)),r=this.removeEmpty(this.tokenize(f,e));return this.diffWithOptionsObj(l,r,e,i)}diffWithOptionsObj(t,o,e,i){var s;let f=c=>{if(c=this.postProcess(c,e),i){setTimeout(function(){i(c)},0);return}else return c},l=o.length,r=t.length,a=1,u=l+r;e.maxEditLength!=null&&(u=Math.min(u,e.maxEditLength));let h=(s=e.timeout)!==null&&s!==void 0?s:1/0,w=Date.now()+h,C=[{oldPos:-1,lastComponent:void 0}],m=this.extractCommon(C[0],o,t,0,e);if(C[0].oldPos+1>=r&&m+1>=l)return f(this.buildValues(C[0].lastComponent,o,t));let d=-1/0,p=1/0,g=()=>{for(let c=Math.max(d,-a);c<=Math.min(p,a);c+=2){let $,P=C[c-1],y=C[c+1];P&&(C[c-1]=void 0);let v=!1;if(y){let W=y.oldPos-c;v=y&&0<=W&&W<l}let F=P&&P.oldPos+1<r;if(!v&&!F){C[c]=void 0;continue}if(!F||v&&P.oldPos<y.oldPos?$=this.addToPath(y,!0,!1,0,e):$=this.addToPath(P,!1,!0,1,e),m=this.extractCommon($,o,t,c,e),$.oldPos+1>=r&&m+1>=l)return f(this.buildValues($.lastComponent,o,t))||!0;C[c]=$,$.oldPos+1>=r&&(p=Math.min(p,c-1)),m+1>=l&&(d=Math.max(d,c+1))}a++};if(i)(function c(){setTimeout(function(){if(a>u||Date.now()>w)return i(void 0);g()||c()},0)})();else for(;a<=u&&Date.now()<=w;){let c=g();if(c)return c}}addToPath(t,o,e,i,s){let f=t.lastComponent;return f&&!s.oneChangePerToken&&f.added===o&&f.removed===e?{oldPos:t.oldPos+i,lastComponent:{count:f.count+1,added:o,removed:e,previousComponent:f.previousComponent}}:{oldPos:t.oldPos+i,lastComponent:{count:1,added:o,removed:e,previousComponent:f}}}extractCommon(t,o,e,i,s){let f=o.length,l=e.length,r=t.oldPos,a=r-i,u=0;for(;a+1<f&&r+1<l&&this.equals(e[r+1],o[a+1],s);)a++,r++,u++,s.oneChangePerToken&&(t.lastComponent={count:1,previousComponent:t.lastComponent,added:!1,removed:!1});return u&&!s.oneChangePerToken&&(t.lastComponent={count:u,previousComponent:t.lastComponent,added:!1,removed:!1}),t.oldPos=r,a}equals(t,o,e){return e.comparator?e.comparator(t,o):t===o||!!e.ignoreCase&&t.toLowerCase()===o.toLowerCase()}removeEmpty(t){let o=[];for(let e=0;e<t.length;e++)t[e]&&o.push(t[e]);return o}castInput(t,o){return t}tokenize(t,o){return Array.from(t)}join(t){return t.join("")}postProcess(t,o){return t}get useLongestToken(){return!1}buildValues(t,o,e){let i=[],s;for(;t;)i.push(t),s=t.previousComponent,delete t.previousComponent,t=s;i.reverse();let f=i.length,l=0,r=0,a=0;for(;l<f;l++){let u=i[l];if(u.removed)u.value=this.join(e.slice(a,a+u.count)),a+=u.count;else{if(!u.added&&this.useLongestToken){let h=o.slice(r,r+u.count);h=h.map(function(w,C){let m=e[a+C];return m.length>w.length?m:w}),u.value=this.join(h)}else u.value=this.join(o.slice(r,r+u.count));r+=u.count,u.added||(a+=u.count)}}return i}};var N=class extends L{tokenize(t){return t.slice()}join(t){return t}removeEmpty(t){return t}},z=new N;function M(n,t,o){return z.diff(n,t,o)}var ne=`\
|
|
4
|
-
`,A=3;function
|
|
4
|
+
`,A=3;function O(n){if(n==="")return{lines:[],noEol:!1};let t=!n.endsWith(`
|
|
5
5
|
`),o=n.split(`
|
|
6
6
|
`);return t||o.pop(),{lines:o,noEol:t}}function H(n,t){let o=n.lines.length-1;return n.lines.map((e,i)=>{let s=i===o&&n.noEol?e:`${e}
|
|
7
7
|
`;return t?s.toLowerCase():s})}function B(n,t,o){let e=M(H(n,o),H(t,o)),i=[],s=0,f=0,l=0;for(;l<e.length;){let r=e[l];if(!r.added&&!r.removed){s+=r.count??r.value.length,f+=r.count??r.value.length,l++;continue}let a={oldStart:s,oldCount:0,newStart:f,newCount:0};for(;l<e.length&&(e[l].added||e[l].removed);){let u=e[l].count??e[l].value.length;e[l].removed?(a.oldCount+=u,s+=u):(a.newCount+=u,f+=u),l++}i.push(a)}return i}function x(n){if(!/[\s"\u0000-\u001f\u007f]/.test(n))return n;let t='"';for(let o of n)o==='"'||o==="\\"?t+=`\\${o}`:o===" "?t+="\\t":o===`
|
|
8
8
|
`?t+="\\n":o==="\r"?t+="\\r":o<" "||o==="\x7F"?t+=`\\${o.charCodeAt(0).toString(8).padStart(3,"0")}`:t+=o;return`${t}"`}function D(n,t,o,e){n.push(`${e}${t.lines[o]}
|
|
9
9
|
`),t.noEol&&o===t.lines.length-1&&n.push(ne)}function q(n,t){return t===0?String(n):t===1?String(n+1):`${n+1},${n+t}`}function J(n,t,o){let e=[];for(let i of o){let s=i.oldCount===0?"a":i.newCount===0?"d":"c";e.push(`${q(i.oldStart,i.oldCount)}${s}${q(i.newStart,i.newCount)}
|
|
10
10
|
`);for(let f=0;f<i.oldCount;f++)D(e,n,i.oldStart+f,"< ");s==="c"&&e.push(`---
|
|
11
|
-
`);for(let f=0;f<i.newCount;f++)D(e,t,i.newStart+f,"> ")}return e.join("")}function Y(n,t){let o=[],e=[];for(let i of n){let s=e[e.length-1];s&&i.oldStart-(s.oldStart+s.oldCount)>2*t&&(o.push(e),e=[]),e.push(i)}return e.length>0&&o.push(e),o}function G(n,t,o,e){let i=n[0],s=n[n.length-1];return{oldFrom:Math.max(0,i.oldStart-e),oldTo:Math.min(t.lines.length,s.oldStart+s.oldCount+e),newFrom:Math.max(0,i.newStart-e),newTo:Math.min(o.lines.length,s.newStart+s.newCount+e)}}function
|
|
11
|
+
`);for(let f=0;f<i.newCount;f++)D(e,t,i.newStart+f,"> ")}return e.join("")}function Y(n,t){let o=[],e=[];for(let i of n){let s=e[e.length-1];s&&i.oldStart-(s.oldStart+s.oldCount)>2*t&&(o.push(e),e=[]),e.push(i)}return e.length>0&&o.push(e),o}function G(n,t,o,e){let i=n[0],s=n[n.length-1];return{oldFrom:Math.max(0,i.oldStart-e),oldTo:Math.min(t.lines.length,s.oldStart+s.oldCount+e),newFrom:Math.max(0,i.newStart-e),newTo:Math.min(o.lines.length,s.newStart+s.newCount+e)}}function V(n,t){let o=t-n;return o===0?`${n},0`:o===1?String(n+1):`${n+1},${o}`}function K(n,t,o,e,i,s){let f=[`--- ${x(n)}
|
|
12
12
|
`,`+++ ${x(t)}
|
|
13
|
-
`];for(let l of Y(i,s)){let r=G(l,o,e,s);f.push(`@@ -${
|
|
14
|
-
`);let a=r.oldFrom;for(let u of l){for(;a<u.oldStart;a++)D(f,o,a," ");for(let h=0;h<u.oldCount;h++)D(f,o,u.oldStart+h,"-");for(let h=0;h<u.newCount;h++)D(f,e,u.newStart+h,"+");a=u.oldStart+u.oldCount}for(;a<r.oldTo;a++)D(f,o,a," ")}return f.join("")}function
|
|
13
|
+
`];for(let l of Y(i,s)){let r=G(l,o,e,s);f.push(`@@ -${V(r.oldFrom,r.oldTo)} +${V(r.newFrom,r.newTo)} @@
|
|
14
|
+
`);let a=r.oldFrom;for(let u of l){for(;a<u.oldStart;a++)D(f,o,a," ");for(let h=0;h<u.oldCount;h++)D(f,o,u.oldStart+h,"-");for(let h=0;h<u.newCount;h++)D(f,e,u.newStart+h,"+");a=u.oldStart+u.oldCount}for(;a<r.oldTo;a++)D(f,o,a," ")}return f.join("")}function U(n,t){let o=t-n;return o===0?String(n):o===1?String(n+1):`${n+1},${t}`}function X(n,t,o,e,i,s){if(!o.some(r=>(s?r.oldCount:r.newCount)>0))return;let l=e;for(let r of o){let a=s?r.oldStart:r.newStart,u=s?r.oldCount:r.newCount;for(;l<a;l++)D(n,t,l," ");let h=r.oldCount>0&&r.newCount>0?"! ":s?"- ":"+ ";for(let w=0;w<u;w++)D(n,t,a+w,h);l=a+u}for(;l<i;l++)D(n,t,l," ")}function Q(n,t,o,e,i,s){let f=[`*** ${x(n)}
|
|
15
15
|
`,`--- ${x(t)}
|
|
16
16
|
`];for(let l of Y(i,s)){let r=G(l,o,e,s);f.push(`***************
|
|
17
|
-
`),f.push(`*** ${
|
|
18
|
-
`),X(f,o,l,r.oldFrom,r.oldTo,!0),f.push(`--- ${
|
|
17
|
+
`),f.push(`*** ${U(r.oldFrom,r.oldTo)} ****
|
|
18
|
+
`),X(f,o,l,r.oldFrom,r.oldTo,!0),f.push(`--- ${U(r.newFrom,r.newTo)} ----
|
|
19
19
|
`),X(f,e,l,r.newFrom,r.newTo,!1)}return f.join("")}var re={name:"diff",summary:"compare files line by line",usage:"diff [OPTION]... FILE1 FILE2",options:[" --normal output a normal diff (default)","-u, --unified output a unified diff","-c, --context output a context diff","-q, --brief report only whether files differ","-s, --report-identical-files report when files are the same","-i, --ignore-case ignore case differences","-r, --recursive recursively compare directories","-N, --new-file treat absent files as empty"," --version output version information and exit"," --help display this help and exit"]},ie={normal:{long:"normal",type:"boolean"},unified:{short:"u",long:"unified",type:"boolean"},context:{short:"c",long:"context",type:"boolean"},brief:{short:"q",long:"brief",type:"boolean"},reportSame:{short:"s",long:"report-identical-files",type:"boolean"},ignoreCase:{short:"i",long:"ignore-case",type:"boolean"},recursive:{short:"r",long:"recursive",type:"boolean"},newFile:{short:"N",long:"new-file",type:"boolean"},version:{long:"version",type:"boolean"}},E=100;function S(n,t,o,e,i){let s=o,f=e;if(i.ignoreCase&&(s=s.toLowerCase(),f=f.toLowerCase()),s===f)return i.reportSame?{output:`Files ${n} and ${t} are identical
|
|
20
20
|
`,differs:!1}:{output:"",differs:!1};if(i.brief)return{output:`Files ${n} and ${t} differ
|
|
21
|
-
`,differs:!0};let l=
|
|
22
|
-
`,differs:!0};let s=o.fs.resolvePath(o.cwd,n),f=o.fs.resolvePath(o.cwd,t),l=await
|
|
21
|
+
`,differs:!0};let l=O(o),r=O(e),a=B(l,r,i.ignoreCase),u;return i.unified?u=K(n,t,l,r,a,A):i.context?u=Q(n,t,l,r,a,A):u=J(l,r,a),{output:u,differs:!0}}async function b(n,t){return n.fs.readFile(n.fs.resolvePath(n.cwd,t))}async function Z(n,t){try{let o=n.fs.resolvePath(n.cwd,t),e=await n.fs.stat(o);return{isFile:e.isFile,isDirectory:e.isDirectory}}catch{return null}}async function j(n,t){if(n.fs.readdirWithFileTypes)return n.fs.readdirWithFileTypes(t);let o=await n.fs.readdir(t),e=[];for(let i of o)try{let s=await n.fs.stat(`${t}/${i}`);e.push({name:i,isFile:s.isFile,isDirectory:s.isDirectory,isSymbolicLink:s.isSymbolicLink??!1})}catch{}return e}function ee(n){return n.isDirectory?"directory":n.isSymbolicLink?"symbolic link":"regular file"}async function te(n,t,o,e,i=0){if(i>E)return{output:`diff: maximum recursion depth exceeded (${E})
|
|
22
|
+
`,differs:!0};let s=o.fs.resolvePath(o.cwd,n),f=o.fs.resolvePath(o.cwd,t),l=await j(o,s),r=await j(o,f),a=new Set(l.map(p=>p.name)),u=new Set(r.map(p=>p.name)),h=[...new Set([...a,...u])].sort(),w=new Map(l.map(p=>[p.name,p])),C=new Map(r.map(p=>[p.name,p])),m="",d=!1;for(let p of h){let g=`${n}/${p}`,c=`${t}/${p}`,$=w.get(p),P=C.get(p);if($&&P)if($.isDirectory&&P.isDirectory){let y=await te(g,c,o,e,i+1);m+=y.output,d=d||y.differs}else if($.isFile&&P.isFile)try{let y=await b(o,g),v=await b(o,c),F=S(g,c,y,v,e);F.differs&&!e.brief&&F.output&&(m+=`${e.headerPrefix} ${g} ${c}
|
|
23
23
|
`),m+=F.output,d=d||F.differs}catch{m+=`diff: ${g}: No such file or directory
|
|
24
24
|
`,d=!0}else m+=`File ${g} is a ${ee($)} while file ${c} is a ${ee(P)}
|
|
25
|
-
`,d=!0;else if($)if(e.newFile)if($.isDirectory){let y=await
|
|
25
|
+
`,d=!0;else if($)if(e.newFile)if($.isDirectory){let y=await I(g,c,o,e,!0,i+1);m+=y.output,d=d||y.differs}else if($.isFile){let y=await b(o,g),v=S(g,c,y,"",e);v.differs&&!e.brief&&v.output&&(m+=`${e.headerPrefix} ${g} ${c}
|
|
26
26
|
`),m+=v.output,d=d||v.differs}else m+=`Only in ${n}: ${p}
|
|
27
27
|
`,d=!0;else m+=`Only in ${n}: ${p}
|
|
28
|
-
`,d=!0;else if(P)if(e.newFile)if(P.isDirectory){let y=await
|
|
28
|
+
`,d=!0;else if(P)if(e.newFile)if(P.isDirectory){let y=await I(c,g,o,e,!1,i+1);m+=y.output,d=d||y.differs}else if(P.isFile){let y=await b(o,c),v=S(g,c,"",y,e);v.differs&&!e.brief&&v.output&&(m+=`${e.headerPrefix} ${g} ${c}
|
|
29
29
|
`),m+=v.output,d=d||v.differs}else m+=`Only in ${t}: ${p}
|
|
30
30
|
`,d=!0;else m+=`Only in ${t}: ${p}
|
|
31
|
-
`,d=!0}return{output:m,differs:d}}async function
|
|
32
|
-
`,differs:!0};let f=o.fs.resolvePath(o.cwd,n),r=[...await
|
|
33
|
-
`),a+=$.output,u=u||$.differs}}return{output:a,differs:u}}var he={name:"diff",async execute(n,t){if(k(n))return _(re);let o=R("diff",n,ie);if(!o.ok)return o.error;let e=o.result.flags;if(e.version)return{stdout:`diff (just-bash)
|
|
31
|
+
`,d=!0}return{output:m,differs:d}}async function I(n,t,o,e,i,s=0){if(s>E)return{output:`diff: maximum recursion depth exceeded (${E})
|
|
32
|
+
`,differs:!0};let f=o.fs.resolvePath(o.cwd,n),r=[...await j(o,f)].sort((h,w)=>h.name<w.name?-1:h.name>w.name?1:0),a="",u=!1;for(let h of r){let w=`${n}/${h.name}`,C=`${t}/${h.name}`;if(h.isDirectory){let m=await I(w,C,o,e,i,s+1);a+=m.output,u=u||m.differs}else if(h.isFile){let m=await b(o,w),d=i?m:"",p=i?"":m,g=i?w:C,c=i?C:w,$=S(g,c,d,p,e);$.differs&&!e.brief&&$.output&&(a+=`${e.headerPrefix} ${g} ${c}
|
|
33
|
+
`),a+=$.output,u=u||$.differs}}return{output:a,differs:u}}var he={handlesOwnVersion:!0,name:"diff",async execute(n,t){if(k(n))return _(re);let o=R("diff",n,ie);if(!o.ok)return o.error;let e=o.result.flags;if(e.version)return{stdout:`diff (just-bash)
|
|
34
34
|
`,stderr:"",exitCode:0};if(Number(e.normal)+Number(e.unified)+Number(e.context)>1)return{stdout:"",stderr:`diff: conflicting output style options
|
|
35
35
|
diff: Try 'diff --help' for more information.
|
|
36
36
|
`,exitCode:2};let s="diff -r";e.unified&&(s+="u"),e.context&&(s+="c"),e.newFile&&(s+="N"),e.ignoreCase&&(s+="i"),e.brief&&(s+="q");let f={unified:e.unified,context:e.context,brief:e.brief,reportSame:e.reportSame,ignoreCase:e.ignoreCase,newFile:e.newFile,headerPrefix:s},l=o.result.positional;if(l.length<2)return{stdout:"",stderr:`diff: missing operand
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
3
|
-
import{d as C}from"./chunk-
|
|
3
|
+
import{d as C}from"./chunk-AIWBN36Z.js";import{a as g}from"./chunk-NE4R2FVV.js";import{a as v}from"./chunk-I4IRHQDW.js";var y=`Usage: rmdir [-pv] DIRECTORY...
|
|
4
4
|
Remove empty directories.
|
|
5
5
|
|
|
6
6
|
Options:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
3
|
-
import{e as F}from"./chunk-
|
|
3
|
+
import{e as F}from"./chunk-AIWBN36Z.js";import{l as d,m as h}from"./chunk-FUT3X2GJ.js";import{a as x}from"./chunk-NE4R2FVV.js";import{a as g,b as z}from"./chunk-MUFNRCMY.js";var $={name:"du",summary:"estimate file space usage",usage:"du [OPTION]... [FILE]...",options:["-a write counts for all files, not just directories","-h print sizes in human readable format","-s display only a total for each argument","-c produce a grand total","--max-depth=N print total for directory only if N or fewer levels deep"," --help display this help and exit"]},b={allFiles:{short:"a",type:"boolean"},humanReadable:{short:"h",type:"boolean"},summarize:{short:"s",type:"boolean"},grandTotal:{short:"c",type:"boolean"},maxDepth:{long:"max-depth",type:"number"}},R={name:"du",async execute(t,s){if(z(t))return g($);let a=x("du",t,b);if(!a.ok)return a.error;let l={allFiles:a.result.flags.allFiles,humanReadable:a.result.flags.humanReadable,summarize:a.result.flags.summarize,grandTotal:a.result.flags.grandTotal,maxDepth:a.result.flags.maxDepth??null},i=a.result.positional;i.length===0&&i.push(".");let n="",o="",e=0;for(let u of i){let f=s.fs.resolvePath(s.cwd,u);try{await s.fs.stat(f);let r=await w(s,f,u,l,0);n+=r.output,e+=r.totalSize,o+=r.stderr}catch(r){if(r instanceof d||r instanceof h)throw r;o+=`du: cannot access '${u}': No such file or directory
|
|
4
4
|
`}}return l.grandTotal&&i.length>0&&(n+=`${p(e,l.humanReadable)} total
|
|
5
5
|
`),{stdout:n,stderr:o,exitCode:o?1:0}}};async function w(t,s,a,l,i){let n={output:"",totalSize:0,stderr:""},o=new Map;return await F({fs:t.fs,root:s,limits:t.limits,signal:t.signal,executionScope:t.executionScope,site:"du",symlinks:"never",includeLeave:!0},e=>{let u=e.path.slice(s.length).replace(/^\//,""),f=u?a==="."?u:`${a}/${u}`:a,r=e.path==="/"?"/":e.path.slice(0,e.path.lastIndexOf("/"))||"/";if(e.phase==="enter"){if(e.stat.isDirectory){o.set(e.path,0);return}o.set(r,(o.get(r)??0)+e.stat.size),(l.allFiles||e.depth===i)&&!l.summarize&&(n.output+=`${p(e.stat.size,l.humanReadable)} ${f}
|
|
6
6
|
`),e.depth===i&&(n.totalSize=e.stat.size);return}let m=o.get(e.path)??0;e.depth>i?o.set(r,(o.get(r)??0)+m):n.totalSize=m;let c=e.depth-i;(l.summarize&&c===0||!l.summarize&&(l.maxDepth===null||c<=l.maxDepth))&&(n.output+=`${p(m,l.humanReadable)} ${f}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
3
|
-
import{e as l,f as v,h as P,k as f}from"./chunk-
|
|
3
|
+
import{e as l,f as v,h as P,k as f}from"./chunk-UBA7DOWE.js";import{l as u,m as y}from"./chunk-FUT3X2GJ.js";import{c as k}from"./chunk-OHFB3M3X.js";import{a as g}from"./chunk-PBOVSFTJ.js";var w=class extends Error{operation;virtualPath;name="FileSystemPolicyError";constructor(t,r,n){super(`${t}: ${g(n)}`),this.operation=t,this.virtualPath=r}};function $(e){if(e.identity!==void 0)return`identity:${e.identity}`;if(e.dev!==void 0&&e.ino!==void 0)return`inode:${String(e.dev)}:${String(e.ino)}`}function b(e){return k(e,"ENOENT")}async function m(e,t,r){let n=l(t),s;try{s=await e.stat(n)}catch(a){if(!b(a))return{existence:"unknown"}}if(s!==void 0){let a=$(s);try{return{existence:"existing",canonicalPath:l(await e.realpath(n)),stableIdentity:a}}catch{return a===void 0?{existence:"unknown"}:{existence:"existing",stableIdentity:a}}}let i=[],o=n;for(;;){r?.checkpoint();let a=P(o);if(a===o)return{existence:"unknown"};i.unshift(o.slice(a==="/"?1:a.length+1)),o=a;try{let c=l(await e.realpath(o));return{existence:"missing",canonicalPath:i.reduce((h,d)=>f(h,d),c)}}catch(c){if(!b(c))return{existence:"missing"}}}}async function C(e,t,r){let[n,s]=await Promise.all([m(e,t),m(e,r)]);return n.existence==="unknown"||s.existence==="unknown"?"unknown":n.existence==="missing"||s.existence==="missing"?n.existence!==s.existence?"different":n.canonicalPath!==void 0&&n.canonicalPath===s.canonicalPath?"same":"unknown":n.stableIdentity!==void 0&&s.stableIdentity!==void 0?n.stableIdentity===s.stableIdentity?"same":"different":n.canonicalPath!==void 0&&n.canonicalPath===s.canonicalPath?"same":"unknown"}async function D(e,t,r,n){let[s,i]=await Promise.all([m(e,t,n),m(e,r,n)]);return s.existence!=="existing"||s.canonicalPath===void 0||i.existence==="unknown"||i.canonicalPath===void 0?"unknown":v(s.canonicalPath,i.canonicalPath)?"inside":"outside"}var x=class{options;entries=0;discoveredEntries=1;work=0;constructor(t){this.options=t}checkpoint(t=1){if(this.options.signal?.aborted)throw new y;if(this.options.executionScope?.throwIfAborted(this.options.site),!Number.isSafeInteger(t)||t<0||t>this.options.limits.maxTraversalWork-this.work)throw new u(`${this.options.site}: ${this.options.label??"filesystem traversal work"} limit exceeded (${this.options.limits.maxTraversalWork})`,"iterations");this.work+=t,this.options.executionScope?.consumeWork(t,`${this.options.site} filesystem traversal`)}visit(t){if(this.checkpoint(),t>this.options.limits.maxTraversalDepth)throw new u(`${this.options.site}: ${this.options.label??"filesystem traversal"} depth limit exceeded (${this.options.limits.maxTraversalDepth})`,"recursion");if(++this.entries>this.options.limits.maxTraversalEntries)throw new u(`${this.options.site}: ${this.options.label??"filesystem traversal"} entry limit exceeded (${this.options.limits.maxTraversalEntries})`,"iterations")}reserve(t){if(!Number.isSafeInteger(t)||t<0||t>this.options.limits.maxTraversalEntries-this.discoveredEntries)throw new u(`${this.options.site}: ${this.options.label??"filesystem traversal"} entry limit exceeded (${this.options.limits.maxTraversalEntries})`,"iterations");this.discoveredEntries+=t}discover(t){this.reserve(t),this.checkpoint(t)}};async function N(e,t){let r=e.budget??new x(e),n=[{kind:"enter",path:l(e.root),depth:0}],s=new Set;for(;n.length>0;){r.checkpoint(0);let i=n.pop();if(!i)break;if(i.kind==="leave"){e.includeLeave&&await t({path:i.path,depth:i.depth,stat:i.stat,isSymlink:i.isSymlink,phase:"leave"}),i.identity&&s.delete(i.identity);continue}r.visit(i.depth);let o=await e.fs.lstat(i.path),a=o.isSymbolicLink,c=a&&e.symlinks==="follow"?await e.fs.stat(i.path):o;if(await t({path:i.path,depth:i.depth,stat:c,isSymlink:a,phase:"enter"}),!c.isDirectory||a&&e.symlinks!=="follow")continue;let h=$(c)??await e.fs.realpath(i.path).then(l).catch(()=>{});if(h!==void 0){if(s.has(h))throw new w(e.site,i.path,"symbolic-link directory cycle detected");s.add(h)}n.push({kind:"leave",path:i.path,depth:i.depth,stat:c,isSymlink:a,identity:h});let d=await e.fs.readdir(i.path);r.checkpoint(),d.sort((p,E)=>p.localeCompare(E));for(let p=d.length-1;p>=0;p--)n.push({kind:"enter",path:f(i.path,d[p]),depth:i.depth+1})}}export{m as a,C as b,D as c,x as d,N as e};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
3
|
+
var d={export:{kind:"handler",phase:"early"},unset:{kind:"handler",phase:"early"},exit:{kind:"handler",phase:"early"},local:{kind:"handler",phase:"early"},set:{kind:"handler",phase:"early"},break:{kind:"handler",phase:"early"},continue:{kind:"handler",phase:"early"},return:{kind:"handler",phase:"early"},shift:{kind:"handler",phase:"early"},getopts:{kind:"handler",phase:"early"},compgen:{kind:"handler",phase:"early"},complete:{kind:"handler",phase:"early"},compopt:{kind:"handler",phase:"early"},pushd:{kind:"handler",phase:"early"},popd:{kind:"handler",phase:"early"},dirs:{kind:"handler",phase:"early"},source:{kind:"handler",phase:"early"},".":{kind:"handler",phase:"early"},read:{kind:"handler",phase:"early"},mapfile:{kind:"handler",phase:"early"},readarray:{kind:"handler",phase:"early"},declare:{kind:"handler",phase:"early"},typeset:{kind:"handler",phase:"early"},readonly:{kind:"handler",phase:"early"},eval:{kind:"handler",phase:"late",posixEarly:!0},cd:{kind:"handler",phase:"late"},":":{kind:"handler",phase:"late"},true:{kind:"handler",phase:"late"},false:{kind:"handler",phase:"late"},let:{kind:"handler",phase:"late"},command:{kind:"handler",phase:"late"},builtin:{kind:"handler",phase:"late"},shopt:{kind:"handler",phase:"late"},exec:{kind:"handler",phase:"late"},wait:{kind:"handler",phase:"late"},type:{kind:"handler",phase:"late"},hash:{kind:"handler",phase:"late"},help:{kind:"handler",phase:"late"},"[":{kind:"handler",phase:"late"},test:{kind:"handler",phase:"late"},echo:{kind:"registry"},printf:{kind:"registry"},pwd:{kind:"registry"},alias:{kind:"registry"},unalias:{kind:"registry"},history:{kind:"registry"},bg:{kind:"unimplemented"},caller:{kind:"unimplemented"},disown:{kind:"unimplemented"},enable:{kind:"unimplemented"},fc:{kind:"unimplemented"},fg:{kind:"unimplemented"},jobs:{kind:"unimplemented"},kill:{kind:"unimplemented"},suspend:{kind:"unimplemented"},times:{kind:"unimplemented"},trap:{kind:"unimplemented"},ulimit:{kind:"unimplemented"},umask:{kind:"unimplemented"}};for(let e of Object.values(d))Object.freeze(e);Object.freeze(d);var l=d,i=new Set(Object.keys(l)),r=new Set(Object.entries(l).filter(([,e])=>e.kind==="unimplemented").map(([e])=>e)),a=l;function t(e){let n=Object.hasOwn(a,e)?a[e]:void 0;return n?.kind==="handler"?n.phase:void 0}function h(e){let n=Object.hasOwn(a,e)?a[e]:void 0;return n?.kind==="handler"&&n.posixEarly===!0}export{l as a,i as b,r as c,t as d,h as e};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
3
|
+
import{c as s}from"./chunk-OHFB3M3X.js";import{a as m}from"./chunk-PBOVSFTJ.js";import{a as c}from"./chunk-NE4R2FVV.js";import{a as l}from"./chunk-I4IRHQDW.js";var y={recursive:{short:"p",long:"parents",type:"boolean"},verbose:{short:"v",long:"verbose",type:"boolean"}},b={name:"mkdir",async execute(f,i){let t=c("mkdir",f,y);if(!t.ok)return t.error;let g=t.result.flags.recursive,p=t.result.flags.verbose,n=t.result.positional;if(n.length===0)return{stdout:"",stderr:`mkdir: missing operand
|
|
4
|
+
`,exitCode:1};let a="",o="",d=0;for(let e of n)try{let r=i.fs.resolvePath(i.cwd,e);await i.fs.mkdir(r,{recursive:g}),p&&(a+=`mkdir: created directory '${e}'
|
|
5
|
+
`)}catch(r){let u=l(r);s(r,"ENOENT")?o+=`mkdir: cannot create directory '${e}': No such file or directory
|
|
6
|
+
`:s(r,"EEXIST")?o+=`mkdir: cannot create directory '${e}': File exists
|
|
7
|
+
`:s(r,"EROFS")?o+=`mkdir: cannot create directory '${e}': Read-only file system
|
|
8
|
+
`:s(r,"EACCES")?o+=`mkdir: cannot create directory '${e}': Permission denied
|
|
9
|
+
`:o+=`mkdir: cannot create directory '${e}': ${m(u)}
|
|
10
|
+
`,d=1}return{stdout:a,stderr:o,exitCode:d}}},$={name:"mkdir",flags:[{flag:"-p",type:"boolean"},{flag:"-v",type:"boolean"}],needsArgs:!0};export{b as a,$ as b};
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
3
|
-
import{c as
|
|
4
|
-
`,exitCode:1};let
|
|
5
|
-
`,
|
|
6
|
-
`)}catch(o){let m=g(o),p=
|
|
7
|
-
`:
|
|
3
|
+
import{c as n}from"./chunk-OHFB3M3X.js";import{a as d}from"./chunk-PBOVSFTJ.js";import{a as u}from"./chunk-NE4R2FVV.js";import{a as g}from"./chunk-I4IRHQDW.js";var b={recursive:{short:"r",long:"recursive",type:"boolean"},recursiveUpper:{short:"R",type:"boolean"},force:{short:"f",long:"force",type:"boolean"},verbose:{short:"v",long:"verbose",type:"boolean"}},C={name:"rm",async execute(v,s){let e=u("rm",v,b);if(!e.ok)return e.error;let l=e.result.flags.recursive||e.result.flags.recursiveUpper,a=e.result.flags.force,y=e.result.flags.verbose,f=e.result.positional;if(f.length===0)return a?{stdout:"",stderr:"",exitCode:0}:{stdout:"",stderr:`rm: missing operand
|
|
4
|
+
`,exitCode:1};let c="",t="",i=0;for(let r of f)try{let o=s.fs.resolvePath(s.cwd,r);if((await s.fs.stat(o)).isDirectory&&!l){t+=`rm: cannot remove '${r}': Is a directory
|
|
5
|
+
`,i=1;continue}await s.fs.rm(o,{recursive:l,force:a}),y&&(c+=`removed '${r}'
|
|
6
|
+
`)}catch(o){let m=g(o),p=n(o,"ENOENT");if(a&&p)continue;p?t+=`rm: cannot remove '${r}': No such file or directory
|
|
7
|
+
`:n(o,"ENOTEMPTY")?t+=`rm: cannot remove '${r}': Directory not empty
|
|
8
|
+
`:n(o,"EROFS")?t+=`rm: cannot remove '${r}': Read-only file system
|
|
8
9
|
`:t+=`rm: cannot remove '${r}': ${d(m)}
|
|
9
|
-
`,
|
|
10
|
+
`,i=1}return{stdout:c,stderr:t,exitCode:i}}},N={name:"rm",flags:[{flag:"-r",type:"boolean"},{flag:"-R",type:"boolean"},{flag:"-f",type:"boolean"},{flag:"-v",type:"boolean"}],needsArgs:!0};export{C as a,N as b};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
3
|
-
import{a as W}from"./chunk-3DWQCLNP.js";import{c as $}from"./chunk-42AMF6EE.js";import{b as C}from"./chunk-HWI42GQO.js";import{a as V}from"./chunk-
|
|
3
|
+
import{a as W}from"./chunk-3DWQCLNP.js";import{c as $}from"./chunk-42AMF6EE.js";import{b as C}from"./chunk-HWI42GQO.js";import{a as V}from"./chunk-AIWBN36Z.js";import{b as I}from"./chunk-CPKBPQ2C.js";import{a as B,b}from"./chunk-PBOVSFTJ.js";import{a as x}from"./chunk-I4IRHQDW.js";import{a as N,b as R}from"./chunk-MUFNRCMY.js";import{existsSync as ce}from"node:fs";import{dirname as de,join as T,sep as Q}from"node:path";import{fileURLToPath as me}from"node:url";import{Worker as he}from"node:worker_threads";import pe from"sql.js";function K(e,t){return e==null?Buffer.byteLength(t,"utf8"):e instanceof Uint8Array||Buffer.isBuffer(e)?e.byteLength:Buffer.byteLength(String(e),"utf8")}function X(e,t,r){let n=r.maxOutputSize??Number.MAX_SAFE_INTEGER,s=Buffer.byteLength(r.separator,"utf8");s+=Buffer.byteLength(r.newline,"utf8");for(let a of e)s+=Buffer.byteLength(a,"utf8");for(let a of t){s+=a.length*16;for(let i of a)s+=K(i,r.nullValue);if(s>n)break}let o=s*8+(t.length+3)*(e.length+3)*16;if(!Number.isSafeInteger(o)||o>n)throw new Error(`formatted output exceeds ${n} byte limit`);return n}function _(e,t,r){let n=X(e,t,r),s;switch(r.mode){case"list":s=Y(e,t,r);break;case"csv":s=Z(e,t,r);break;case"json":s=te(e,t);break;case"line":s=re(e,t,r);break;case"column":s=ne(e,t,r);break;case"table":s=se(e,t,r);break;case"markdown":s=oe(e,t,r);break;case"tabs":s=ie(e,t,r);break;case"box":s=ae(e,t,r);break;case"quote":s=le(e,t,r);break;case"html":s=fe(e,t,r);break;case"ascii":s=ue(e,t,r);break}if(Buffer.byteLength(s,"utf8")>n)throw new Error(`formatted output exceeds ${n} byte limit`);return s}function m(e,t){return e==null?t:e instanceof Uint8Array||Buffer.isBuffer(e)?Buffer.from(e).toString("utf8"):typeof e=="number"&&!Number.isInteger(e)?e.toPrecision(17).replace(/\.?0+$/,""):String(e)}function Y(e,t,r){let n=[];r.header&&e.length>0&&n.push(e.join(r.separator));for(let s of t)n.push(s.map(o=>m(o,r.nullValue)).join(r.separator));return n.length>0?`${n.join(r.newline)}${r.newline}`:""}function Z(e,t,r){let n=[];r.header&&e.length>0&&n.push(e.map(v).join(","));for(let s of t)n.push(s.map(o=>v(m(o,r.nullValue))).join(","));return n.length>0?`${n.join(`
|
|
4
4
|
`)}
|
|
5
5
|
`:""}function v(e){return e.includes(",")||e.includes('"')||e.includes("'")||e.includes(`
|
|
6
6
|
`)?`"${e.replace(/"/g,'""')}"`:e}function F(e){return e.toPrecision(17).replace(/\.?0+$/,"")}function ee(e){return e===null?"null":typeof e=="number"?Number.isInteger(e)?String(e):F(e):JSON.stringify(e)}function te(e,t){return t.length===0?"":`[${t.map(n=>`{${e.map((o,a)=>`${JSON.stringify(o)}:${ee(n[a])}`).join(",")}}`).join(`,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
3
|
-
import{a as w}from"./chunk-QES5OSUC.js";import{b as m}from"./chunk-GR4ZHKXI.js";import{d as v}from"./chunk-I57EACSL.js";import{e as B}from"./chunk-
|
|
3
|
+
import{a as w}from"./chunk-QES5OSUC.js";import{b as m}from"./chunk-GR4ZHKXI.js";import{d as v}from"./chunk-I57EACSL.js";import{e as B}from"./chunk-AIWBN36Z.js";import{l as z}from"./chunk-FUT3X2GJ.js";import{a as L}from"./chunk-NE4R2FVV.js";import{a as F,b as E}from"./chunk-MUFNRCMY.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).
|
|
4
4
|
|
|
5
5
|
When no FILE is given, or when FILE is -, read from standard input.
|
|
6
6
|
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
3
|
+
import{b as P,c as O,d as R,e as T}from"./chunk-AIWBN36Z.js";import{f as F}from"./chunk-UBA7DOWE.js";import{l as $,m as w}from"./chunk-FUT3X2GJ.js";import{c as d}from"./chunk-OHFB3M3X.js";import{a as S}from"./chunk-NE4R2FVV.js";import{a as D}from"./chunk-I4IRHQDW.js";import{a as C,b as E}from"./chunk-MUFNRCMY.js";var H={name:"cp",summary:"copy files and directories",usage:"cp [OPTION]... SOURCE... DEST",options:["-r, -R, --recursive copy directories recursively","-n, --no-clobber do not overwrite an existing file","-p, --preserve preserve file attributes","-v, --verbose explain what is being done"," --help display this help and exit"]},I={recursive:{short:"r",long:"recursive",type:"boolean"},recursiveUpper:{short:"R",type:"boolean"},noClobber:{short:"n",long:"no-clobber",type:"boolean"},preserve:{short:"p",long:"preserve",type:"boolean"},verbose:{short:"v",long:"verbose",type:"boolean"}},q={name:"cp",async execute(m,e){if(E(m))return C(H);let n=S("cp",m,I);if(!n.ok)return n.error;let g=n.result.flags.recursive||n.result.flags.recursiveUpper,k=n.result.flags.noClobber,A=n.result.flags.preserve,N=n.result.flags.verbose,p=n.result.positional;if(p.length<2)return{stdout:"",stderr:`cp: missing destination file operand
|
|
4
|
+
`,exitCode:1};let f=p.pop()??"",y=p,l=e.fs.resolvePath(e.cwd,f),h="",s="",i=0,b=new R({limits:e.limits,signal:e.signal,executionScope:e.executionScope,site:"cp"}),u=!1;try{u=(await e.fs.stat(l)).isDirectory}catch{}if(y.length>1&&!u)return{stdout:"",stderr:`cp: target '${f}' is not a directory
|
|
5
|
+
`,exitCode:1};for(let r of y)try{let t=e.fs.resolvePath(e.cwd,r),a=await e.fs.stat(t),o=l;if(u){let c=r.split("/").pop()||r;o=l==="/"?`/${c}`:`${l}/${c}`}if(a.isDirectory&&!g){s+=`cp: -r not specified; omitting directory '${r}'
|
|
6
|
+
`,i=1;continue}if(a.isDirectory){let c=await O(e.fs,t,o,b);if(F(t,o)||c==="inside"){s+=`cp: cannot copy '${r}' into itself, '${o}'
|
|
7
|
+
`,i=1;continue}if(c==="unknown"){s+=`cp: cannot safely determine whether '${o}' is inside '${r}'
|
|
8
|
+
`,i=1;continue}}if(k)try{await e.fs.stat(o);continue}catch{}let v=await P(e.fs,t,o);if(v==="same"){s+=`cp: '${r}' and '${o}' are the same file
|
|
9
|
+
`,i=1;continue}if(v==="unknown"){s+=`cp: cannot safely determine whether '${r}' and '${o}' are the same file
|
|
10
|
+
`,i=1;continue}a.isDirectory&&await T({fs:e.fs,root:t,limits:e.limits,signal:e.signal,executionScope:e.executionScope,site:"cp",symlinks:"never",budget:b},()=>{}),await e.fs.cp(t,o,{recursive:g}),N&&(h+=`'${r}' -> '${o}'
|
|
11
|
+
`)}catch(t){if(t instanceof $||t instanceof w)throw t;let a=D(t);d(t,"ENOENT")?s+=`cp: cannot stat '${r}': No such file or directory
|
|
12
|
+
`:d(t,"EROFS")?s+=`cp: cannot create regular file '${f}': Read-only file system
|
|
13
|
+
`:s+=`cp: cannot copy '${r}': ${a}
|
|
14
|
+
`,i=1}return{stdout:h,stderr:s,exitCode:i}}},J={name:"cp",flags:[{flag:"-r",type:"boolean"},{flag:"-R",type:"boolean"},{flag:"-n",type:"boolean"},{flag:"-p",type:"boolean"},{flag:"-v",type:"boolean"}],needsArgs:!0,minArgs:2};export{q as a,J as b};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
3
|
-
import{b as w}from"./chunk-GR4ZHKXI.js";import{d as b}from"./chunk-I57EACSL.js";import{d as S,e as F}from"./chunk-
|
|
3
|
+
import{b as w}from"./chunk-GR4ZHKXI.js";import{d as b}from"./chunk-I57EACSL.js";import{d as S,e as F}from"./chunk-AIWBN36Z.js";import{a as v,b as $,c as y}from"./chunk-MUFNRCMY.js";var E={name:"chmod",summary:"change file mode bits",usage:"chmod [OPTIONS] MODE FILE...",options:["-R change files recursively","-v output a diagnostic for every file processed"," --help display this help and exit"]},O={name:"chmod",async execute(e,a){if($(e))return v(E);if(e.length<2)return{stdout:"",stderr:`chmod: missing operand
|
|
4
4
|
`,exitCode:1};let i=!1,f=!1,n=0;for(;n<e.length&&e[n].startsWith("-");){let t=e[n];if(t==="-R"||t==="--recursive")i=!0,n++;else if(t==="-v"||t==="--verbose")f=!0,n++;else if(t==="--"){n++;break}else{if(/^[+-]?[rwxugo]+/.test(t)||/^\d+$/.test(t))break;if(/^-[Rv]+$/.test(t)){t.includes("R")&&(i=!0),t.includes("v")&&(f=!0),n++;continue}return y("chmod",t)}}if(e.length-n<2)return{stdout:"",stderr:`chmod: missing operand
|
|
5
5
|
`,exitCode:1};let r=e[n],d=e.slice(n+1),o=/^[0-7]+$/.test(r),s;if(o)s=parseInt(r,8);else try{p(r,420)}catch{return{stdout:"",stderr:`chmod: invalid mode: '${r}'
|
|
6
6
|
`,exitCode:1}}let u=new b(Math.min(a.limits.maxOutputSize,a.limits.maxStringLength),"chmod"),l="",c=!1;for(let t of d){let m=a.fs.resolvePath(a.cwd,t);try{let h;if(o&&s!==void 0)h=s;else{let g=await a.fs.stat(m);h=p(r,g.mode)}await a.fs.chmod(m,h),f&&u.append(`mode of '${t}' changed to ${h.toString(8).padStart(4,"0")}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
3
|
-
import{d as X}from"./chunk-I57EACSL.js";import{d as I}from"./chunk-
|
|
3
|
+
import{d as X}from"./chunk-I57EACSL.js";import{d as I}from"./chunk-AIWBN36Z.js";import{l as W,m as Z}from"./chunk-FUT3X2GJ.js";import{a as G}from"./chunk-CPKBPQ2C.js";import{a as V}from"./chunk-NE4R2FVV.js";import{a as q,b as Q}from"./chunk-MUFNRCMY.js";function h(s,t,e){if(G(e)>s.limits.maxOutputSize-G(t))throw new W(`ls: output size limit exceeded (${s.limits.maxOutputSize} bytes)`,"output_size");return t+e}function tt(s,t){if(t>s.limits.maxArrayElements)throw new W(`ls: array element limit exceeded (${s.limits.maxArrayElements})`,"array_elements")}function ot(s,t,e){tt(s,e),t.reserve(e)}function x(s,t){let e=new X(s.limits.maxOutputSize,"ls");for(let l=0;l<t.length;l++)l>0&&e.append(`
|
|
4
4
|
`),e.append(t[l]);return t.length>0&&e.append(`
|
|
5
5
|
`),e.build()}function j(s){if(s<1024)return String(s);if(s<1024*1024){let e=s/1024;return e<10?`${e.toFixed(1)}K`:`${Math.round(e)}K`}if(s<1024*1024*1024){let e=s/1048576;return e<10?`${e.toFixed(1)}M`:`${Math.round(e)}M`}let t=s/(1024*1024*1024);return t<10?`${t.toFixed(1)}G`:`${Math.round(t)}G`}function B(s){let e=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][s.getMonth()],l=String(s.getDate()).padStart(2," "),m=new Date,g=new Date(m.getTime()-4320*60*60*1e3);if(s>g){let D=String(s.getHours()).padStart(2,"0"),u=String(s.getMinutes()).padStart(2,"0");return`${e} ${l} ${D}:${u}`}let b=s.getFullYear();return`${e} ${l} ${b}`}function H(s){return s.isDirectory?"/":s.isSymbolicLink?"@":(s.mode&73)!==0?"*":""}var it={name:"ls",summary:"list directory contents",usage:"ls [OPTION]... [FILE]...",options:["-a, --all do not ignore entries starting with .","-A, --almost-all do not list . and ..","-d, --directory list directories themselves, not their contents","-F, --classify append indicator (one of */=>@) to entries","-h, --human-readable with -l, print sizes like 1K 234M 2G etc.","-l use a long listing format","-r, --reverse reverse order while sorting","-R, --recursive list subdirectories recursively","-S sort by file size, largest first","-t sort by time, newest first","-1 list one file per line"," --help display this help and exit"]},at={showAll:{short:"a",long:"all",type:"boolean"},showAlmostAll:{short:"A",long:"almost-all",type:"boolean"},longFormat:{short:"l",type:"boolean"},humanReadable:{short:"h",long:"human-readable",type:"boolean"},recursive:{short:"R",long:"recursive",type:"boolean"},reverse:{short:"r",long:"reverse",type:"boolean"},sortBySize:{short:"S",type:"boolean"},classifyFiles:{short:"F",long:"classify",type:"boolean"},directoryOnly:{short:"d",long:"directory",type:"boolean"},sortByTime:{short:"t",type:"boolean"},onePerLine:{short:"1",type:"boolean"}},gt={name:"ls",async execute(s,t){if(Q(s))return q(it);let e=V("ls",s,at);if(!e.ok)return e.error;let l=e.result.flags.showAll,m=e.result.flags.showAlmostAll,g=e.result.flags.longFormat,b=e.result.flags.humanReadable,D=e.result.flags.recursive,u=e.result.flags.reverse,w=e.result.flags.classifyFiles,P=e.result.flags.directoryOnly,R=lt(s,e.result.flags.sortBySize,e.result.flags.sortByTime);e.result.flags.onePerLine;let z=e.result.positional;z.length===0&&z.push(".");let $="",E="",C=0,O=new I({limits:t.limits,signal:t.signal,executionScope:t.executionScope,site:"ls"});if(P){for(let n of await K(z,t,R,u,O)){O.visit(0);let i=t.fs.resolvePath(t.cwd,n);try{let v=await t.fs.stat(i);if(g){let L=v.isDirectory?"drwxr-xr-x":"-rw-r--r--",c=w?H(await t.fs.lstat(i)):"",S=v.size??0,y=b?j(S).padStart(5):String(S).padStart(5),f=v.mtime??new Date(0),o=B(f);$=h(t,$,`${L} 1 user user ${y} ${o} ${n}${c}
|
|
6
6
|
`)}else{let L=w?H(await t.fs.lstat(i)):"";$=h(t,$,`${n}${L}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
3
|
-
import{a as we}from"./chunk-BIJXTWZ4.js";import{a as Y}from"./chunk-IOKQFPM6.js";import{a as le}from"./chunk-3MRB66F4.js";import{a as be}from"./chunk-K27FY3ES.js";import{a as ae}from"./chunk-YXPSX3SI.js";import{b as ue,c as de,d as he}from"./chunk-YERKK5B3.js";import{d as ge}from"./chunk-
|
|
3
|
+
import{a as we}from"./chunk-BIJXTWZ4.js";import{a as Y}from"./chunk-IOKQFPM6.js";import{a as le}from"./chunk-3MRB66F4.js";import{a as be}from"./chunk-K27FY3ES.js";import{a as ae}from"./chunk-YXPSX3SI.js";import{b as ue,c as de,d as he}from"./chunk-YERKK5B3.js";import{d as ge}from"./chunk-AIWBN36Z.js";import{l as ie}from"./chunk-FUT3X2GJ.js";import{a as re}from"./chunk-CPKBPQ2C.js";import{a as me,b as ye}from"./chunk-MUFNRCMY.js";function z(e,t){switch(e.type){case"name":{let n=e.pattern,s=n.match(/^\*(\.[a-zA-Z0-9]+)$/);if(s){let a=s[1],o=t.name;if(e.ignoreCase){if(!o.toLowerCase().endsWith(a.toLowerCase()))return{matches:!1,pruned:!1,printed:!1}}else if(!o.endsWith(a))return{matches:!1,pruned:!1,printed:!1};return{matches:!0,pruned:!1,printed:!1}}return{matches:Y(t.name,n,e.ignoreCase),pruned:!1,printed:!1}}case"path":{let n=e.pattern,s=t.relativePath,a=n.split("/");for(let u=0;u<a.length-1;u++){let r=a[u];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 o=n.match(/\*(\.[a-zA-Z0-9]+)$/);if(o){let u=o[1];if(e.ignoreCase){if(!s.toLowerCase().endsWith(u.toLowerCase()))return{matches:!1,pruned:!1,printed:!1}}else if(!s.endsWith(u))return{matches:!1,pruned:!1,printed:!1}}return{matches:Y(s,n,e.ignoreCase),pruned:!1,printed:!1}}case"regex":try{let n=e.ignoreCase?"i":"";return{matches:ae(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=z(e.expr,t);return{matches:!n.matches,pruned:n.pruned,printed:!1,actions:n.actions}}case"and":{let n=z(e.left,t);if(!n.matches)return{matches:!1,pruned:n.pruned,printed:!1,actions:n.actions};let s=z(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=z(e.left,t);if(n.matches)return n;let s=z(e.right,t);return{matches:s.matches,pruned:n.pruned||s.pruned,printed:s.printed,actions:[...n.actions??[],...s.actions??[]]}}}}function Z(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 Z(e.expr);case"and":case"or":return Z(e.left)||Z(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 Se(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 V(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 V(e.expr);case"and":case"or":return V(e.left)&&V(e.right)}}function B(e,t,n,s,a){switch(e.type){case"name":{let o=e.pattern,u=o.match(/^\*(\.[a-zA-Z0-9]+)$/);if(u){let r=u[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:Y(t,o,e.ignoreCase),pruned:!1,printed:!1}}case"path":{let o=e.pattern,u=o.split("/");for(let i=0;i<u.length-1;i++){let l=u[i];if(l&&l!=="."&&l!==".."&&!l.includes("*")&&!l.includes("?")&&!l.includes("[")){let p=`/${l}/`;if(e.ignoreCase){if(!n.toLowerCase().includes(p.toLowerCase()))return{matches:!1,pruned:!1,printed:!1}}else if(!n.includes(p))return{matches:!1,pruned:!1,printed:!1}}}let r=o.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:Y(n,o,e.ignoreCase),pruned:!1,printed:!1}}case"regex":try{let o=e.ignoreCase?"i":"";return{matches:ae(e.pattern,o).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 o=B(e.expr,t,n,s,a);return{matches:!o.matches,pruned:o.pruned,printed:!1,actions:o.actions}}case"and":{let o=B(e.left,t,n,s,a);if(!o.matches)return{matches:!1,pruned:o.pruned,printed:!1,actions:o.actions};let u=B(e.right,t,n,s,a);return{matches:u.matches,pruned:o.pruned||u.pruned,printed:o.printed||u.printed,actions:[...o.actions??[],...u.actions??[]]}}case"or":{let o=B(e.left,t,n,s,a);if(o.matches)return o;let u=B(e.right,t,n,s,a);return{matches:u.matches,pruned:o.pruned||u.pruned,printed:u.printed,actions:[...o.actions??[],...u.actions??[]]}}default:return{matches:!1,pruned:!1,printed:!1}}}function _(e){if(!e)return!1;switch(e.type){case"prune":return!0;case"not":return _(e.expr);case"and":case"or":return _(e.left)||_(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 Te(e,t){if(!e||!t.isDirectory)return{shouldPrune:!1};if(!L(e))return oe(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:z(e,n).pruned}}function oe(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(z(e.left,n).pruned)return{shouldPrune:!0}}return oe(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:z(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 z(e.left,n).matches?oe(e.right,t):{shouldPrune:!1}}return{shouldPrune:!1}}case"not":return{shouldPrune:!1};default:return{shouldPrune:!1}}}function Ce(e,t){let n=[],s=t,a=r=>({expr:null,pathIndex:s,error:`find: missing argument to \`${r}'
|
|
4
4
|
`}),o=(r,i)=>({expr:null,pathIndex:s,error:`find: invalid argument \`${i}' to \`${r}'
|
|
5
5
|
`});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}
|
|
6
6
|
`}}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],l="exact",p=i;if(i.startsWith("+")?(l="more",p=i.slice(1)):i.startsWith("-")&&(l="less",p=i.slice(1)),!/^\d+$/.test(p))return o(r,i);let I=Number(p);if(!Number.isSafeInteger(I))return o(r,i);n.push({type:"expr",expr:{type:"mtime",days:I,comparison:l}})}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],l="exact",p=i;i.startsWith("+")?(l="more",p=i.slice(1)):i.startsWith("-")&&(l="less",p=i.slice(1));let I=p.match(/^(\d+)([ckMGb])?$/);if(!I)return o(r,i);let N=Number(I[1]);if(!Number.isSafeInteger(N))return o(r,i);let P=I[2]||"b",j=P==="G"?1024**3:P==="M"?1024**2:P==="k"?1024:P==="b"?512:1;if(!Number.isSafeInteger(N*j))return o(r,i);n.push({type:"expr",expr:{type:"size",value:N,unit:P,comparison:l}})}else if(r==="-perm"){if(s+1>=e.length)return a(r);let i=e[++s],l="exact",p=i;if(i.startsWith("-")?(l="all",p=i.slice(1)):i.startsWith("/")&&(l="any",p=i.slice(1)),!/^[0-7]{1,4}$/.test(p))return o(r,i);let I=Number.parseInt(p,8);n.push({type:"expr",expr:{type:"perm",mode:I,matchType:l}})}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 l=e[s]==="+";if(l&&(i.at(-1)!=="{}"||i.filter(p=>p==="{}").length!==1))return o("-exec","+");n.push({type:"expr",expr:{type:"action",action:{type:"exec",command:i,batchMode:l}}})}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}'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
3
|
-
import{d as k}from"./chunk-
|
|
3
|
+
import{d as k}from"./chunk-AIWBN36Z.js";import{l as u,m}from"./chunk-FUT3X2GJ.js";import{a as h,b as p,c as g}from"./chunk-MUFNRCMY.js";var w={name:"readlink",summary:"print resolved symbolic links or canonical file names",usage:"readlink [OPTIONS] FILE...",options:["-f canonicalize by following every symlink in every component of the given name recursively"," --help display this help and exit"]},x={name:"readlink",async execute(r,n){if(p(r))return h(w);let l=!1,t=0;for(;t<r.length&&r[t].startsWith("-");){let i=r[t];if(i==="-f"||i==="--canonicalize")l=!0,t++;else if(i==="--"){t++;break}else return g("readlink",i)}let c=r.slice(t);if(c.length===0)return{stdout:"",stderr:`readlink: missing operand
|
|
4
4
|
`,exitCode:1};let a="",d=!1,y=new k({limits:n.limits,signal:n.signal,executionScope:n.executionScope,site:"readlink",label:"symlink traversal"});for(let i of c){let s=n.fs.resolvePath(n.cwd,i);try{if(l){let e=s,o=new Set;for(;y.visit(o.size),!o.has(e);){o.add(e);try{let f=await n.fs.readlink(e);if(f.startsWith("/"))e=f;else{let b=e.substring(0,e.lastIndexOf("/"))||"/";e=n.fs.resolvePath(b,f)}}catch{break}}a+=`${e}
|
|
5
5
|
`}else{let e=await n.fs.readlink(s);a+=`${e}
|
|
6
6
|
`}}catch(e){if(e instanceof u||e instanceof m)throw e;l?a+=`${s}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
3
|
-
import{b as E}from"./chunk-GR4ZHKXI.js";import{a as h}from"./chunk-
|
|
3
|
+
import{b as E}from"./chunk-GR4ZHKXI.js";import{a as h}from"./chunk-AIWBN36Z.js";import{l as $}from"./chunk-FUT3X2GJ.js";import{a as k}from"./chunk-CPKBPQ2C.js";import{a as C,b as L,c as F}from"./chunk-MUFNRCMY.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]}'
|
|
4
4
|
`};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)}'
|
|
5
5
|
`};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]}'
|
|
6
6
|
`};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)}'
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{createRequire} from"node:module";const require=createRequire(import.meta.url);
|
|
3
|
+
import{a as i}from"./chunk-OHFB3M3X.js";var a=40,d=493,x=420,$=511;function e(t){if(!t||t==="/")return"/";let r=t.endsWith("/")&&t!=="/"?t.slice(0,-1):t;r.startsWith("/")||(r=`/${r}`);let n=r.split("/").filter(s=>s&&s!=="."),o=[];for(let s of n)s===".."?o.pop():o.push(s);return`/${o.join("/")}`||"/"}function m(t,r){let n=e(t),o=e(r);return o===n||n==="/"||o.startsWith(`${n}/`)}function E(t,r){if(t.includes("\0"))throw new i("ENOENT",`path contains null byte, ${r} '${t}'`)}function c(t){let r=e(t);if(r==="/")return"/";let n=r.lastIndexOf("/");return n===0?"/":r.slice(0,n)}function l(t){if(typeof process>"u"||process.platform!=="win32"||!/^[A-Za-z]:[\\/]/.test(t))return t;let r=t[0].toLowerCase(),n=t.slice(2).replace(/\\/g,"/");return`/${r}${n}`}function p(t,r){if(r=l(r),r.startsWith("/"))return e(r);let n=t==="/"?`/${r}`:`${t}/${r}`;return e(n)}function D(t){return t.replace(/\\/g,"/")}function u(t,r){return t==="/"?`/${r}`:`${t}/${r}`}function P(t,r){if(r.startsWith("/"))return e(r);let n=c(t);return e(u(n,r))}export{a,d as b,x as c,$ as d,e,m as f,E as g,c as h,p as i,D as j,u as k,P as l};
|