just-bash 2.4.4 → 2.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. package/README.md +42 -4
  2. package/dist/AGENTS.md +2 -2
  3. package/dist/bin/chunks/base64-O7TCK5TL.js +6 -0
  4. package/dist/bin/{shell/chunks/cat-ZEMMQGY5.js → chunks/cat-AJXZOSPN.js} +1 -1
  5. package/dist/bin/chunks/{chunk-45SNFRCY.js → chunk-5WFYIUU2.js} +2 -2
  6. package/dist/bin/chunks/chunk-CTLU5QUH.js +17 -0
  7. package/dist/bin/{shell/chunks/chunk-GX4MPCG6.js → chunks/chunk-Y5QKO4KO.js} +5 -5
  8. package/dist/bin/chunks/{cut-WWPJ2PYT.js → cut-IHF6BEOO.js} +1 -1
  9. package/dist/bin/chunks/grep-QCXXYC54.js +9 -0
  10. package/dist/bin/{shell/chunks/gzip-MNCJB6OR.js → chunks/gzip-YXK3WZQL.js} +22 -22
  11. package/dist/bin/{shell/chunks/jq-XH2PXRWE.js → chunks/jq-XXZPU5CA.js} +1 -1
  12. package/dist/bin/chunks/{md5sum-VGXAOUBA.js → md5sum-2VAAFCTS.js} +1 -1
  13. package/dist/bin/chunks/rg-GVIT6FTE.js +33 -0
  14. package/dist/bin/chunks/{sha1sum-BIUH233Z.js → sha1sum-67P4ME4N.js} +1 -1
  15. package/dist/bin/{shell/chunks/sha256sum-SUIK2MT2.js → chunks/sha256sum-MV3WQ4QF.js} +1 -1
  16. package/dist/bin/{shell/chunks/sort-C3F6LCNY.js → chunks/sort-KUHOCH5S.js} +1 -1
  17. package/dist/bin/chunks/tar-C27YYUAS.js +63 -0
  18. package/dist/bin/{shell/chunks/uniq-DKS7RIAE.js → chunks/uniq-IXHB2FVS.js} +1 -1
  19. package/dist/bin/chunks/{wc-4LMTC3QD.js → wc-QSBRKIF5.js} +1 -1
  20. package/dist/bin/chunks/{xan-WNN2ZOAX.js → xan-6K2NGTHM.js} +1 -1
  21. package/dist/bin/just-bash.js +78 -78
  22. package/dist/bin/shell/chunks/base64-O7TCK5TL.js +6 -0
  23. package/dist/bin/{chunks/cat-ZEMMQGY5.js → shell/chunks/cat-AJXZOSPN.js} +1 -1
  24. package/dist/bin/shell/chunks/{chunk-45SNFRCY.js → chunk-5WFYIUU2.js} +2 -2
  25. package/dist/bin/shell/chunks/chunk-CTLU5QUH.js +17 -0
  26. package/dist/bin/{chunks/chunk-GX4MPCG6.js → shell/chunks/chunk-Y5QKO4KO.js} +5 -5
  27. package/dist/bin/shell/chunks/{cut-WWPJ2PYT.js → cut-IHF6BEOO.js} +1 -1
  28. package/dist/bin/shell/chunks/grep-QCXXYC54.js +9 -0
  29. package/dist/bin/{chunks/gzip-MNCJB6OR.js → shell/chunks/gzip-YXK3WZQL.js} +22 -22
  30. package/dist/bin/{chunks/jq-XH2PXRWE.js → shell/chunks/jq-XXZPU5CA.js} +1 -1
  31. package/dist/bin/shell/chunks/{md5sum-VGXAOUBA.js → md5sum-2VAAFCTS.js} +1 -1
  32. package/dist/bin/shell/chunks/rg-GVIT6FTE.js +33 -0
  33. package/dist/bin/shell/chunks/{sha1sum-BIUH233Z.js → sha1sum-67P4ME4N.js} +1 -1
  34. package/dist/bin/{chunks/sha256sum-SUIK2MT2.js → shell/chunks/sha256sum-MV3WQ4QF.js} +1 -1
  35. package/dist/bin/{chunks/sort-C3F6LCNY.js → shell/chunks/sort-KUHOCH5S.js} +1 -1
  36. package/dist/bin/shell/chunks/tar-C27YYUAS.js +63 -0
  37. package/dist/bin/{chunks/uniq-DKS7RIAE.js → shell/chunks/uniq-IXHB2FVS.js} +1 -1
  38. package/dist/bin/shell/chunks/{wc-4LMTC3QD.js → wc-QSBRKIF5.js} +1 -1
  39. package/dist/bin/shell/chunks/{xan-WNN2ZOAX.js → xan-6K2NGTHM.js} +1 -1
  40. package/dist/bin/shell/shell.js +100 -100
  41. package/dist/bundle/browser.js +557 -517
  42. package/dist/bundle/chunks/base64-3BME25ON.js +5 -0
  43. package/dist/bundle/chunks/{cat-W5XITXDC.js → cat-MV4K6AUA.js} +1 -1
  44. package/dist/bundle/chunks/{chunk-4ACWXGKW.js → chunk-7L36YK2X.js} +2 -2
  45. package/dist/bundle/chunks/{chunk-46TSKXFW.js → chunk-GFLIVSUW.js} +5 -5
  46. package/dist/bundle/chunks/chunk-OHJS5H37.js +16 -0
  47. package/dist/bundle/chunks/{cut-KKAAQJVD.js → cut-NVKWEAZF.js} +1 -1
  48. package/dist/bundle/chunks/grep-TUWLGQC2.js +8 -0
  49. package/dist/bundle/chunks/{gzip-7QAS5P2Y.js → gzip-L3NDJG3F.js} +22 -22
  50. package/dist/bundle/chunks/{jq-AAWVUTC4.js → jq-3YU5HRKE.js} +1 -1
  51. package/dist/bundle/chunks/{md5sum-LJHKXLVT.js → md5sum-KLHZSRUA.js} +1 -1
  52. package/dist/bundle/chunks/rg-KTCMPGU6.js +32 -0
  53. package/dist/bundle/chunks/{sha1sum-NRUZZ4Q6.js → sha1sum-WKWTIZGQ.js} +1 -1
  54. package/dist/bundle/chunks/{sha256sum-5ZGJ4NJL.js → sha256sum-IUVNMBTA.js} +1 -1
  55. package/dist/bundle/chunks/{sort-JHO22QVO.js → sort-EJUT5LXD.js} +1 -1
  56. package/dist/bundle/chunks/tar-QWBXMF7K.js +62 -0
  57. package/dist/bundle/chunks/{uniq-SEKCFR7B.js → uniq-47QVBRNC.js} +1 -1
  58. package/dist/bundle/chunks/{wc-52FZ4QGS.js → wc-DFQKWSIZ.js} +1 -1
  59. package/dist/bundle/chunks/{xan-ZHXYF6B4.js → xan-2R2APJJ4.js} +1 -1
  60. package/dist/bundle/index.js +119 -119
  61. package/dist/commands/registry.d.ts +1 -1
  62. package/dist/commands/rg/file-types.d.ts +49 -0
  63. package/dist/commands/rg/gitignore.d.ts +98 -0
  64. package/dist/commands/rg/rg-options.d.ts +61 -0
  65. package/dist/commands/rg/rg-parser.d.ts +20 -0
  66. package/dist/commands/rg/rg-search.d.ts +15 -0
  67. package/dist/commands/rg/rg.d.ts +12 -0
  68. package/dist/commands/search-engine/index.d.ts +10 -0
  69. package/dist/commands/search-engine/matcher.d.ts +57 -0
  70. package/dist/commands/search-engine/regex.d.ts +27 -0
  71. package/dist/commands/tar/archive.d.ts +107 -0
  72. package/dist/commands/tar/tar.d.ts +8 -0
  73. package/dist/fs/in-memory-fs/in-memory-fs.d.ts +51 -0
  74. package/dist/fs/in-memory-fs/index.d.ts +1 -0
  75. package/dist/fs/init.d.ts +12 -0
  76. package/dist/fs/interface.d.ts +203 -0
  77. package/dist/fs/mountable-fs/index.d.ts +1 -0
  78. package/dist/fs/mountable-fs/mountable-fs.d.ts +108 -0
  79. package/dist/fs/overlay-fs/index.d.ts +1 -0
  80. package/dist/fs/overlay-fs/overlay-fs.d.ts +107 -0
  81. package/dist/fs/read-write-fs/index.d.ts +1 -0
  82. package/dist/fs/read-write-fs/read-write-fs.d.ts +47 -0
  83. package/dist/fs/utils.d.ts +17 -0
  84. package/dist/index.d.ts +1 -0
  85. package/package.json +12 -7
  86. package/dist/bin/chunks/base64-RJX7MYGG.js +0 -6
  87. package/dist/bin/chunks/grep-U2RCKOEG.js +0 -15
  88. package/dist/bin/shell/chunks/base64-RJX7MYGG.js +0 -6
  89. package/dist/bin/shell/chunks/grep-U2RCKOEG.js +0 -15
  90. package/dist/bundle/chunks/base64-F5R4G5EG.js +0 -5
  91. package/dist/bundle/chunks/grep-CTJRP2G3.js +0 -14
@@ -1,5 +0,0 @@
1
- import{a as f}from"./chunk-ZVV5VXYZ.js";import{a as l,b as u}from"./chunk-74CEPOFO.js";import"./chunk-DXB73IDG.js";var g={name:"base64",summary:"base64 encode/decode data and print to standard output",usage:"base64 [OPTION]... [FILE]",options:["-d, --decode decode data","-w, --wrap=COLS wrap encoded lines after COLS character (default 76, 0 to disable)"," --help display this help and exit"]},m={decode:{short:"d",long:"decode",type:"boolean"},wrap:{short:"w",long:"wrap",type:"number",default:76}};async function p(o,r,n){if(r.length===0||r.length===1&&r[0]==="-")return{ok:!0,data:new TextEncoder().encode(o.stdin)};let s=[];for(let e of r){if(e==="-"){s.push(new TextEncoder().encode(o.stdin));continue}try{let t=o.fs.resolvePath(o.cwd,e),a=await o.fs.readFileBuffer(t);s.push(a)}catch{return{ok:!1,error:{stdout:"",stderr:`${n}: ${e}: No such file or directory
2
- `,exitCode:1}}}}let c=s.reduce((e,t)=>e+t.length,0),i=new Uint8Array(c),d=0;for(let e of s)i.set(e,d),d+=e.length;return{ok:!0,data:i}}var x={name:"base64",async execute(o,r){if(u(o))return l(g);let n=f("base64",o,m);if(!n.ok)return n.error;let s=n.result.flags.decode,c=n.result.flags.wrap,i=n.result.positional;try{if(s){let t=await p(r,i,"base64");if(!t.ok)return t.error;let h=new TextDecoder().decode(t.data).replace(/\s/g,""),w=Uint8Array.from(atob(h),b=>b.charCodeAt(0));return{stdout:new TextDecoder().decode(w),stderr:"",exitCode:0}}let d=await p(r,i,"base64");if(!d.ok)return d.error;let e=btoa(String.fromCharCode(...d.data));if(c>0){let t=[];for(let a=0;a<e.length;a+=c)t.push(e.slice(a,a+c));e=t.join(`
3
- `)+(e.length>0?`
4
- `:"")}return{stdout:e,stderr:"",exitCode:0}}catch{return{stdout:"",stderr:`base64: invalid input
5
- `,exitCode:1}}}};export{x as base64Command};
@@ -1,14 +0,0 @@
1
- import{a as N}from"./chunk-UJMN5NLH.js";import{a as j,b as Z,c as q}from"./chunk-74CEPOFO.js";import"./chunk-DXB73IDG.js";var Y={name:"grep",summary:"print lines that match patterns",usage:"grep [OPTION]... PATTERN [FILE]...",options:["-E, --extended-regexp PATTERN is an extended regular expression","-P, --perl-regexp PATTERN is a Perl regular expression","-F, --fixed-strings PATTERN is a set of newline-separated strings","-i, --ignore-case ignore case distinctions","-v, --invert-match select non-matching lines","-w, --word-regexp match only whole words","-x, --line-regexp match only whole lines","-c, --count print only a count of matching lines","-l, --files-with-matches print only names of files with matches","-L, --files-without-match print names of files with no matches","-m NUM, --max-count=NUM stop after NUM matches","-n, --line-number print line number with output lines","-h, --no-filename suppress the file name prefix on output","-o, --only-matching show only nonempty parts of lines that match","-q, --quiet, --silent suppress all normal output","-r, -R, --recursive search directories recursively","-A NUM print NUM lines of trailing context","-B NUM print NUM lines of leading context","-C NUM print NUM lines of context","-e PATTERN use PATTERN for matching"," --include=GLOB search only files matching GLOB"," --exclude=GLOB skip files matching GLOB"," --exclude-dir=DIR skip directories matching DIR"," --help display this help and exit"]},z={name:"grep",async execute(s,e){if(Z(s))return j(Y);let l=!1,i=!1,f=!1,o=!1,w=!1,h=!1,r=!1,$=!1,y=!1,d=!1,m=!1,P=!1,I=!1,R=!1,M=!1,c=0,T=0,a=0,n=[],C=[],S=[],x=null,O=[];for(let p=0;p<s.length;p++){let u=s[p];if(u.startsWith("-")&&u!=="-"){if(u==="-e"&&p+1<s.length){x=s[++p];continue}if(u.startsWith("--include=")){n.push(u.slice(10));continue}if(u.startsWith("--exclude=")){C.push(u.slice(10));continue}if(u.startsWith("--exclude-dir=")){S.push(u.slice(14));continue}if(u.startsWith("--max-count=")){c=parseInt(u.slice(12),10);continue}let A=u.match(/^-m(\d+)$/);if(A){c=parseInt(A[1],10);continue}if(u==="-m"&&p+1<s.length){c=parseInt(s[++p],10);continue}let g=u.match(/^-([ABC])(\d+)$/);if(g){let t=parseInt(g[2],10);g[1]==="A"?a=t:g[1]==="B"?T=t:g[1]==="C"&&(T=t,a=t);continue}if((u==="-A"||u==="-B"||u==="-C")&&p+1<s.length){let t=parseInt(s[++p],10);u==="-A"?a=t:u==="-B"?T=t:(T=t,a=t);continue}let F=u.startsWith("--")?[u]:u.slice(1).split("");for(let t of F)if(t==="i"||t==="--ignore-case")l=!0;else if(t==="n"||t==="--line-number")i=!0;else if(t==="v"||t==="--invert-match")f=!0;else if(t==="c"||t==="--count")o=!0;else if(t==="l"||t==="--files-with-matches")w=!0;else if(t==="L"||t==="--files-without-match")h=!0;else if(t==="r"||t==="R"||t==="--recursive")r=!0;else if(t==="w"||t==="--word-regexp")$=!0;else if(t==="x"||t==="--line-regexp")y=!0;else if(t==="E"||t==="--extended-regexp")d=!0;else if(t==="P"||t==="--perl-regexp")m=!0;else if(t==="F"||t==="--fixed-strings")P=!0;else if(t==="o"||t==="--only-matching")I=!0;else if(t==="h"||t==="--no-filename")R=!0;else if(t==="q"||t==="--quiet"||t==="--silent")M=!0;else{if(t.startsWith("--"))return q("grep",t);if(t.length===1)return q("grep",`-${t}`)}}else x===null?x=u:O.push(u)}if(x===null)return{stdout:"",stderr:`grep: missing pattern
2
- `,exitCode:2};let W;P?W=x.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"):d||m?W=x:W=ee(x),$&&(W=`\\b${W}\\b`),y&&(W=`^${W}$`);let U;try{U=new RegExp(W,l?"gi":"g")}catch{return{stdout:"",stderr:`grep: invalid regular expression: ${x}
3
- `,exitCode:2}}if(O.length===0&&e.stdin){let p=_(e.stdin,U,f,i,o,"",I,T,a,c);return M?{stdout:"",stderr:"",exitCode:p.matched?0:1}:{stdout:p.output,stderr:"",exitCode:p.matched?0:1}}if(O.length===0)return{stdout:"",stderr:`grep: no input files
4
- `,exitCode:2};let E="",G="",D=!1,H=!1,v=[];for(let p of O)if(p.includes("*")||p.includes("?")||p.includes("[")){let u=await te(p,e);if(r)for(let A of u){let g=await Q(A.path,e,n,C,S,A.isFile);v.push(...g)}else v.push(...u)}else if(r){let u=await Q(p,e,n,C,S);v.push(...u)}else v.push({path:p});let K=(v.length>1||r)&&!R,k=50;for(let p=0;p<v.length;p+=k){let u=v.slice(p,p+k),A=await Promise.all(u.map(async g=>{let F=g.path,t=F.split("/").pop()||F;if(C.length>0&&!r&&C.some(B=>N(t,B,{stripQuotes:!0}))||n.length>0&&!r&&!n.some(B=>N(t,B,{stripQuotes:!0})))return null;try{let B=e.fs.resolvePath(e.cwd,F),b=!1;if(g.isFile===void 0?b=(await e.fs.stat(B)).isDirectory:b=!g.isFile,b)return r?null:{error:`grep: ${F}: Is a directory
5
- `};let V=await e.fs.readFile(B),X=_(V,U,f,i,o,K?F:"",I,T,a,c);return{file:F,result:X}}catch{return{error:`grep: ${F}: No such file or directory
6
- `}}}));for(let g of A){if(g===null)continue;if("error"in g&&g.error){G+=g.error,g.error.includes("Is a directory")||(H=!0);continue}if(!("file"in g)||!g.result)continue;let{file:F,result:t}=g;if(t.matched){if(D=!0,M)return{stdout:"",stderr:"",exitCode:0};w?E+=`${F}
7
- `:h||(E+=t.output)}else h?E+=`${F}
8
- `:o&&!w&&(E+=t.output)}}let L;return H?L=2:h?L=E.length>0?0:1:L=D?0:1,M?{stdout:"",stderr:"",exitCode:L}:{stdout:E,stderr:G,exitCode:L}}};function ee(s){let e="",l=0;for(;l<s.length;){let i=s[l];if(i==="\\"&&l+1<s.length){let f=s[l+1];if(f==="|"||f==="("||f===")"){e+=f,l+=2;continue}else if(f==="{"||f==="}"){e+=`\\${f}`,l+=2;continue}}i==="+"||i==="?"||i==="|"||i==="("||i===")"||i==="{"||i==="}"?e+=`\\${i}`:e+=i,l++}return e}function _(s,e,l,i,f,o,w=!1,h=0,r=0,$=0){let y=s.split(`
9
- `),d=y.length,m=d>0&&y[d-1]===""?d-1:d;if(f){let c=0;for(let a=0;a<m;a++)e.lastIndex=0,e.test(y[a])!==l&&c++;return{output:`${o?`${o}:${c}`:String(c)}
10
- `,matched:c>0}}if(h===0&&r===0){let c=[],T=!1,a=0;for(let n=0;n<m&&!($>0&&a>=$);n++){let C=y[n];if(e.lastIndex=0,e.test(C)!==l)if(T=!0,a++,w){e.lastIndex=0;for(let x=e.exec(C);x!==null;x=e.exec(C))c.push(o?`${o}:${x[0]}`:x[0]),x[0].length===0&&e.lastIndex++}else i?c.push(o?`${o}:${n+1}:${C}`:`${n+1}:${C}`):c.push(o?`${o}:${C}`:C)}return{output:c.length>0?`${c.join(`
11
- `)}
12
- `:"",matched:T}}let P=[],I=0,R=new Set,M=[];for(let c=0;c<m&&!($>0&&I>=$);c++)e.lastIndex=0,e.test(y[c])!==l&&(M.push(c),I++);for(let c of M){for(let a=Math.max(0,c-h);a<c;a++)if(!R.has(a)){R.add(a);let n=y[a];i&&(n=`${a+1}-${n}`),o&&(n=`${o}-${n}`),P.push(n)}if(!R.has(c)){R.add(c);let a=y[c];if(w){e.lastIndex=0;for(let n=e.exec(a);n!==null;n=e.exec(a))P.push(o?`${o}:${n[0]}`:n[0]),n[0].length===0&&e.lastIndex++}else{let n=a;i&&(n=`${c+1}:${n}`),o&&(n=`${o}:${n}`),P.push(n)}}let T=Math.min(m-1,c+r);for(let a=c+1;a<=T;a++)if(!R.has(a)){R.add(a);let n=y[a];i&&(n=`${a+1}-${n}`),o&&(n=`${o}-${n}`),P.push(n)}}return{output:P.length>0?`${P.join(`
13
- `)}
14
- `:"",matched:I>0}}async function J(s,e,l,i){let f=l.fs.resolvePath(l.cwd,s);try{if(!(await l.fs.stat(f)).isDirectory){let h=s.split("/").pop()||"";if(e){let r=e.replace(/^\//,"");N(h,r,{stripQuotes:!0})&&i.push(s)}return}let w=await l.fs.readdir(f);for(let h of w){let r=s==="."?h:`${s}/${h}`,$=l.fs.resolvePath(l.cwd,r);if((await l.fs.stat($)).isDirectory)await J(r,e,l,i);else if(e){let d=e.replace(/^\//,"");N(h,d,{stripQuotes:!0})&&i.push(r)}}}catch{}}async function te(s,e){let l=[],i=s.lastIndexOf("/"),f,o;if(i===-1?(f=e.cwd,o=s):(f=s.slice(0,i)||"/",o=s.slice(i+1)),s.includes("**")){let h=[],r=s.split("**"),$=r[0].replace(/\/$/,"")||".",y=r[1]||"";return await J($,y,e,h),h.map(d=>({path:d}))}let w=e.fs.resolvePath(e.cwd,f);try{if(e.fs.readdirWithFileTypes){let h=await e.fs.readdirWithFileTypes(w);for(let r of h)if(N(r.name,o,{stripQuotes:!0})){let $=i===-1?r.name:`${f}/${r.name}`;l.push({path:$,isFile:r.isFile})}}else{let h=await e.fs.readdir(w);for(let r of h)if(N(r,o,{stripQuotes:!0})){let $=i===-1?r:`${f}/${r}`;l.push({path:$})}}}catch{}return l.sort((h,r)=>h.path.localeCompare(r.path))}async function Q(s,e,l=[],i=[],f=[],o){let w=e.fs.resolvePath(e.cwd,s),h=[];try{let r,$;if(o!==void 0)r=o,$=!o;else{let d=await e.fs.stat(w);r=d.isFile,$=d.isDirectory}if(r){let d=s.split("/").pop()||s;return i.length>0&&i.some(m=>N(d,m,{stripQuotes:!0}))?[]:l.length>0&&!l.some(m=>N(d,m,{stripQuotes:!0}))?[]:[{path:s,isFile:!0}]}if(!$)return[];let y=s.split("/").pop()||s;if(f.length>0&&f.some(d=>N(y,d,{stripQuotes:!0})))return[];if(e.fs.readdirWithFileTypes){let d=await e.fs.readdirWithFileTypes(w);for(let m of d){if(m.name.startsWith("."))continue;let P=s==="."?m.name:`${s}/${m.name}`,I=await Q(P,e,l,i,f,m.isFile);h.push(...I)}}else{let d=await e.fs.readdir(w);for(let m of d){if(m.startsWith("."))continue;let P=s==="."?m:`${s}/${m}`,I=await Q(P,e,l,i,f);h.push(...I)}}}catch{}return h}var re={name:"fgrep",async execute(s,e){return z.execute(["-F",...s],e)}},le={name:"egrep",async execute(s,e){return z.execute(["-E",...s],e)}};export{le as egrepCommand,re as fgrepCommand,z as grepCommand};