@jerryan/just-bash 3.8.0 → 3.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/README.md +5 -15
  3. package/dist/AGENTS.md +2 -2
  4. package/dist/Bash.d.ts +2 -4
  5. package/dist/bin/chunks/{chunk-7WBCA2BB.js → chunk-3DWQCLNP.js} +1 -1
  6. package/dist/bin/{shell/chunks/chunk-MPFNZYEA.js → chunks/chunk-6JEDM6CZ.js} +1 -1
  7. package/dist/bin/chunks/{chunk-QFTZKD5O.js → chunk-6TUILMPB.js} +1 -1
  8. package/dist/bin/chunks/chunk-E54Z6VIE.js +12 -0
  9. package/dist/bin/chunks/chunk-GBKR5KTT.js +44 -0
  10. package/dist/bin/{shell/chunks/chunk-MF3GVFLC.js → chunks/chunk-L345YZ6R.js} +1 -1
  11. package/dist/bin/chunks/chunk-QKJAAJ7J.js +3 -0
  12. package/dist/bin/chunks/{diff-JSJ56EOK.js → diff-DM47S5PT.js} +1 -1
  13. package/dist/bin/{shell/chunks/flag-coverage-2H5CPEM6.js → chunks/flag-coverage-LLAQBVIG.js} +1 -1
  14. package/dist/bin/chunks/js-exec-ZAAIZQWI.js +99 -0
  15. package/dist/bin/chunks/js-exec-worker.js +4995 -0
  16. package/dist/bin/chunks/python3-TJ6DCPIA.js +14 -0
  17. package/dist/bin/chunks/{sleep-DVFE2GSF.js → sleep-MOJQBZMY.js} +1 -1
  18. package/dist/bin/{shell/chunks/sqlite3-KNN6V2W6.js → chunks/sqlite3-CXQTZRPZ.js} +1 -1
  19. package/dist/bin/chunks/{timeout-YGFHQJKX.js → timeout-RQOWSWYG.js} +1 -1
  20. package/dist/bin/just-bash.js +1 -1
  21. package/dist/bin/shell/chunks/{chunk-7WBCA2BB.js → chunk-3DWQCLNP.js} +1 -1
  22. package/dist/bin/{chunks/chunk-MPFNZYEA.js → shell/chunks/chunk-6JEDM6CZ.js} +1 -1
  23. package/dist/bin/shell/chunks/{chunk-QFTZKD5O.js → chunk-6TUILMPB.js} +1 -1
  24. package/dist/bin/shell/chunks/chunk-E54Z6VIE.js +12 -0
  25. package/dist/bin/shell/chunks/chunk-GBKR5KTT.js +44 -0
  26. package/dist/bin/{chunks/chunk-MF3GVFLC.js → shell/chunks/chunk-L345YZ6R.js} +1 -1
  27. package/dist/bin/shell/chunks/chunk-QKJAAJ7J.js +3 -0
  28. package/dist/bin/shell/chunks/{diff-JSJ56EOK.js → diff-DM47S5PT.js} +1 -1
  29. package/dist/bin/{chunks/flag-coverage-2H5CPEM6.js → shell/chunks/flag-coverage-LLAQBVIG.js} +1 -1
  30. package/dist/bin/shell/chunks/js-exec-ZAAIZQWI.js +99 -0
  31. package/dist/bin/shell/chunks/python3-TJ6DCPIA.js +14 -0
  32. package/dist/bin/shell/chunks/{sleep-DVFE2GSF.js → sleep-MOJQBZMY.js} +1 -1
  33. package/dist/bin/{chunks/sqlite3-KNN6V2W6.js → shell/chunks/sqlite3-CXQTZRPZ.js} +1 -1
  34. package/dist/bin/shell/chunks/{timeout-YGFHQJKX.js → timeout-RQOWSWYG.js} +1 -1
  35. package/dist/bin/shell/shell.js +1 -1
  36. package/dist/bundle/browser.js +596 -579
  37. package/dist/bundle/chunks/{chunk-N3A4JVFJ.js → chunk-6IA4DXG2.js} +1 -1
  38. package/dist/bundle/chunks/chunk-BS6EJR2R.js +11 -0
  39. package/dist/bundle/chunks/chunk-E2F4A3CM.js +43 -0
  40. package/dist/bundle/chunks/{chunk-GNPLDVBD.js → chunk-H3A45X3W.js} +1 -1
  41. package/dist/bundle/chunks/chunk-PS2RJNZZ.js +2 -0
  42. package/dist/bundle/chunks/{chunk-DMWNBCXJ.js → chunk-TLPMB3FO.js} +1 -1
  43. package/dist/bundle/chunks/{chunk-XV2V56NQ.js → chunk-YFFU74KY.js} +1 -1
  44. package/dist/bundle/chunks/{diff-VDB6RXHO.js → diff-R7TXVVLN.js} +1 -1
  45. package/dist/bundle/chunks/{flag-coverage-UMQ3BWDP.js → flag-coverage-YQGACUSN.js} +1 -1
  46. package/dist/bundle/chunks/js-exec-MUZRDUJ3.js +98 -0
  47. package/dist/bundle/chunks/js-exec-worker.js +4995 -0
  48. package/dist/bundle/chunks/python3-W4UMQJAQ.js +13 -0
  49. package/dist/bundle/chunks/{sleep-PPRBTSVR.js → sleep-25QUPVDK.js} +1 -1
  50. package/dist/bundle/chunks/{sqlite3-KB3MXTTM.js → sqlite3-DQNCWDG5.js} +1 -1
  51. package/dist/bundle/chunks/{timeout-C6WDYPLV.js → timeout-37GM7IIL.js} +1 -1
  52. package/dist/bundle/index.cjs +1128 -2663
  53. package/dist/bundle/index.js +2 -2
  54. package/dist/commands/js-exec/js-exec-worker.d.ts +35 -0
  55. package/dist/commands/js-exec/js-exec.d.ts +14 -1
  56. package/dist/fs/vfs-template.d.ts +6 -0
  57. package/dist/interpreter/interpreter.d.ts +1 -1
  58. package/dist/interpreter/types.d.ts +1 -1
  59. package/dist/limits.d.ts +2 -2
  60. package/dist/timers.d.ts +9 -0
  61. package/dist/types.d.ts +3 -4
  62. package/package.json +8 -8
  63. package/dist/bin/chunks/chunk-2NJJXU4K.js +0 -27
  64. package/dist/bin/chunks/chunk-PPVF2N6C.js +0 -3
  65. package/dist/bin/chunks/js-exec-T3SAB2B6.js +0 -1651
  66. package/dist/bin/chunks/python3-3ERN3L6S.js +0 -23
  67. package/dist/bin/shell/chunks/chunk-2NJJXU4K.js +0 -27
  68. package/dist/bin/shell/chunks/chunk-PPVF2N6C.js +0 -3
  69. package/dist/bin/shell/chunks/js-exec-T3SAB2B6.js +0 -1651
  70. package/dist/bin/shell/chunks/python3-3ERN3L6S.js +0 -23
  71. package/dist/bundle/chunks/chunk-B6OSJB22.js +0 -26
  72. package/dist/bundle/chunks/chunk-WXPNKIIH.js +0 -2
  73. package/dist/bundle/chunks/js-exec-ZQMIYQTH.js +0 -1650
  74. package/dist/bundle/chunks/python3-QB7OE256.js +0 -22
  75. package/dist/commands/js-exec/run-runtime.d.ts +0 -10
@@ -0,0 +1,13 @@
1
+ import{createRequire} from"node:module";const require=createRequire(import.meta.url);
2
+ import{a as Q,b as W}from"./chunk-BS6EJR2R.js";import{a as I}from"./chunk-6IA4DXG2.js";import"./chunk-WNH3HOQA.js";import"./chunk-KIGPB52X.js";import"./chunk-PS2RJNZZ.js";import"./chunk-L2UW7DWF.js";import{a as F}from"./chunk-DLL7UR66.js";import{c as w}from"./chunk-BKUWXPEM.js";import{b as M}from"./chunk-ZBUZKIPX.js";import{d as C}from"./chunk-GN6CQ3J4.js";import"./chunk-T5ZEIOJ3.js";import{a as A,b as d}from"./chunk-FOCWZZDE.js";import{a as E}from"./chunk-W5DWRFSU.js";import{a as P,b as D}from"./chunk-QAYAQNCG.js";import"./chunk-NCUTH6QL.js";import{fileURLToPath as B}from"node:url";import{Worker as L}from"node:worker_threads";var z={name:"python3",summary:"Execute Python code via CPython Emscripten",usage:"python3 [OPTIONS] [-c CODE | -m MODULE | FILE] [ARGS...]",description:["Execute Python code using CPython compiled to WebAssembly via Emscripten.","","This command runs Python in an isolated environment with access to","the virtual filesystem. Standard library modules are available."],options:["-c CODE Execute CODE as Python script","-m MODULE Run library module as a script","--version Show Python version","--help Show this help"],examples:['python3 -c "print(1 + 2)"','python3 -c "import sys; print(sys.version)"',"python3 script.py","python3 script.py arg1 arg2",`echo 'print("hello")' | python3`],notes:["CPython runs in WebAssembly, so execution may be slower than native Python.","Standard library modules are available (no pip install).","Maximum execution time is 30 seconds by default."]};function _(t){let e={code:null,module:null,scriptFile:null,showVersion:!1,scriptArgs:[]};if(t.length===0)return e;let r=t.findIndex(n=>!n.startsWith("-")||n==="-"||n==="--");for(let n=0;n<(r===-1?t.length:r);n++){let i=t[n];if(i==="-c")return n+1>=t.length?{stdout:"",stderr:`python3: option requires an argument -- 'c'
3
+ `,exitCode:2}:(e.code=t[n+1],e.scriptArgs=t.slice(n+2),e);if(i==="-m")return n+1>=t.length?{stdout:"",stderr:`python3: option requires an argument -- 'm'
4
+ `,exitCode:2}:(e.module=t[n+1],e.scriptArgs=t.slice(n+2),e);if(i==="--version"||i==="-V")return e.showVersion=!0,e;if(i.startsWith("-")&&i!=="-")return{stdout:"",stderr:`python3: unrecognized option '${i}'
5
+ `,exitCode:2}}if(r!==-1){let n=t[r];n==="--"?r+1<t.length&&(e.scriptFile=t[r+1],e.scriptArgs=t.slice(r+2)):(e.scriptFile=n,e.scriptArgs=t.slice(r+1))}return e}var b=new WeakMap;function R(t){let e=b.get(t);return e||(e={executionQueue:[],activeExecution:null,poisonedError:null},b.set(t,e)),e}function ne(){b=new WeakMap}var H=B(new URL("./worker.js",import.meta.url));function U(t,e){if(!t||typeof t!="object")return{success:!1,error:"Malformed worker response"};let r=t;return typeof r.protocolToken!="string"||r.protocolToken!==e?{success:!1,error:"Malformed worker response: invalid protocol token"}:r.type==="security-violation"?{success:!1,error:`Security violation: ${typeof r.violation?.type=="string"?r.violation.type:"unknown"}`}:typeof r.success!="boolean"?{success:!1,error:"Malformed worker response: missing success flag"}:r.success?{success:!0}:{success:!1,error:typeof r.error=="string"&&r.error.length>0?r.error:"Worker execution failed"}}function k(t){if(t.poisonedError!==null){for(let o of t.executionQueue.splice(0))o.state==="queued"&&(o.state="settled",o.stopBridge(),o.settle({success:!1,error:t.poisonedError}));return}if(t.activeExecution!==null||t.executionQueue.length===0)return;for(;t.executionQueue.length>0&&t.executionQueue[0]?.state!=="queued";)t.executionQueue.shift();if(t.executionQueue.length===0)return;let e=t.executionQueue.shift();if(!e)return;e.state="running",t.activeExecution=e;let r;try{r=M.runTrusted(()=>new L(H,{workerData:e.input}))}catch(o){let s=o instanceof Error?o.message:String(o);e.state="settled",e.settle({success:!1,error:d(s)}),t.activeExecution===e&&(t.activeExecution=null,k(t));return}e.worker=r;let n=!0,i=()=>{n&&(n=!1,r.removeListener("message",u),r.removeListener("error",g),r.removeListener("exit",v))},c=async(o,s)=>{if(!(t.activeExecution?.executionId!==e.executionId||e.state!=="running")){if(e.state="terminating",i(),e.settle(o),s&&!await e.controller.terminate(r)){let f="Worker termination was not acknowledged";e.worker=null,e.state="settled",t.poisonedError=f,t.activeExecution?.executionId===e.executionId&&(t.activeExecution=null),k(t);return}e.worker=null,e.state="settled",t.activeExecution?.executionId===e.executionId&&(t.activeExecution=null,k(t))}};e.cancel=o=>{c(o,!0)};let p=w(e.requireDefenseContext,"python3","worker message callback",o=>{try{e.controller.assertMessageSize(o,"response")}catch(s){c({success:!1,error:d(E(s))},!0);return}c(U(o,e.input.protocolToken),!0)}),h=w(e.requireDefenseContext,"python3","worker error callback",o=>{let s=d(E(o));c({success:!1,error:s},!0)}),a=w(e.requireDefenseContext,"python3","worker exit callback",()=>{c({success:!1,error:"Worker exited unexpectedly"},!1)}),u=o=>{try{p(o)}catch(s){let l=s instanceof Error?s.message:String(s);c({success:!1,error:d(l)},!0)}},g=o=>{try{h(o)}catch(s){let l=s instanceof Error?s.message:String(s);c({success:!1,error:d(l)},!0)}},v=()=>{try{a()}catch(o){let s=o instanceof Error?o.message:String(o);c({success:!1,error:d(s)},!0)}};r.on("message",u),r.on("error",g),r.on("exit",v)}async function N(t,e,r,n,i=[]){let c=Q(),p=new W(c,r.fs,r.cwd,"python3",r.fetch,r.limits.maxOutputSize),h=r.limits.maxPythonTimeoutMs,a=R(r.fs);if(a.poisonedError!==null)return{stdout:"",stderr:`python3: ${a.poisonedError}
6
+ `,exitCode:1};let u=new I({commandName:"python3",timeoutMs:h,signal:r.signal,maxMessageBytes:r.limits.maxWorkerMessageBytes}),g={protocolToken:u.protocolToken,sharedBuffer:c,pythonCode:t,stdin:e,cwd:r.cwd,env:F(r.env),args:i,scriptPath:n,timeoutMs:h,maxFileSize:r.limits.maxStringLength};u.assertMessageSize({...g,sharedBuffer:void 0},"request");let v=new Promise(l=>{let f=!1,m={executionId:Symbol("python3 execution"),input:g,settle:y=>{f||(f=!0,u.close(),l(y))},requireDefenseContext:r.requireDefenseContext,state:"queued",worker:null,controller:u,stopBridge:()=>p.stop?.(),cancel:()=>{}};m.cancel=y=>{if(m.state!=="queued")return;m.state="settled";let x=a.executionQueue.indexOf(m);x!==-1&&a.executionQueue.splice(x,1),m.settle(y),k(a)};let O=w(r.requireDefenseContext,"python3","worker cancellation callback",y=>{p.stop?.(),m.cancel({success:!1,error:y==="abort"?u.abortMessage():u.timeoutMessage()})}),T=y=>{try{O(y)}catch(x){let $=x instanceof Error?x.message:String(x);m.cancel({success:!1,error:d($)})}};u.arm(T),u.isCanceled||(a.executionQueue.push(m),k(a))}),[o,s]=await Promise.all([p.run(h).catch(l=>({stdout:"",stderr:`python3: bridge error: ${d(E(l))}
7
+ `,exitCode:1})),v.catch(l=>({success:!1,error:d(E(l))}))]);if(!s.success&&s.error){let l=d(s.error),f=s.error===u.timeoutMessage()||s.error===u.abortMessage();return{stdout:o.stdout,stderr:`${o.stderr}python3: ${l}
8
+ `,exitCode:o.exitCode||(f?124:1)}}return{...o}}var V={name:"python3",async execute(t,e){if(D(t))return P(z);let r=_(t);if("exitCode"in r)return r;if(r.showVersion)return{stdout:`Python 3.13.2 (Emscripten)
9
+ `,stderr:"",exitCode:0};let n,i,c=e.stdin;if(r.code!==null)n=r.code,i="-c";else if(r.module!==null){if(!/^[a-zA-Z_][a-zA-Z0-9_.]*$/.test(r.module))return{stdout:"",stderr:`python3: No module named '${r.module.slice(0,200)}'
10
+ `,exitCode:1};n=`import runpy; runpy.run_module('${r.module}', run_name='__main__')`,i=r.module}else if(r.scriptFile==="-")n=C(e.stdin),c="",i="-";else if(r.scriptFile!==null){let p=e.fs.resolvePath(e.cwd,r.scriptFile);if(!await e.fs.exists(p))return{stdout:"",stderr:`python3: can't open file '${r.scriptFile}': [Errno 2] No such file or directory
11
+ `,exitCode:2};try{n=await e.fs.readFile(p),i=r.scriptFile}catch(h){let a=A(h.message);return{stdout:"",stderr:`python3: can't open file '${r.scriptFile}': ${a}
12
+ `,exitCode:2}}}else if(C(e.stdin).trim())n=C(e.stdin),c="",i="<stdin>";else return{stdout:"",stderr:`python3: no input provided (use -c CODE, -m MODULE, or provide a script file)
13
+ `,exitCode:2};return N(n,c,e,i,r.scriptArgs)}},se={name:"python",async execute(t,e){return V.execute(t,e)}};export{ne as _resetExecutionQueue,V as python3Command,se as pythonCommand};
@@ -1,2 +1,2 @@
1
1
  import{createRequire} from"node:module";const require=createRequire(import.meta.url);
2
- import{a,b}from"./chunk-DMWNBCXJ.js";import"./chunk-SX2HC7SO.js";import"./chunk-WXPNKIIH.js";import"./chunk-ZBUZKIPX.js";import"./chunk-QAYAQNCG.js";import"./chunk-NCUTH6QL.js";export{b as flagsForFuzzing,a as sleepCommand};
2
+ import{a,b}from"./chunk-TLPMB3FO.js";import"./chunk-SX2HC7SO.js";import"./chunk-PS2RJNZZ.js";import"./chunk-ZBUZKIPX.js";import"./chunk-QAYAQNCG.js";import"./chunk-NCUTH6QL.js";export{b as flagsForFuzzing,a as sleepCommand};
@@ -1,2 +1,2 @@
1
1
  import{createRequire} from"node:module";const require=createRequire(import.meta.url);
2
- import{a,b,c}from"./chunk-GNPLDVBD.js";import"./chunk-N3A4JVFJ.js";import"./chunk-WXPNKIIH.js";import"./chunk-BKUWXPEM.js";import"./chunk-ZBUZKIPX.js";import"./chunk-S6DNKKUL.js";import"./chunk-4CC3OZPU.js";import"./chunk-TVCZIH6M.js";import"./chunk-GN6CQ3J4.js";import"./chunk-T5ZEIOJ3.js";import"./chunk-FOCWZZDE.js";import"./chunk-W5DWRFSU.js";import"./chunk-QAYAQNCG.js";import"./chunk-NCUTH6QL.js";export{a as _internals,c as flagsForFuzzing,b as sqlite3Command};
2
+ import{a,b,c}from"./chunk-H3A45X3W.js";import"./chunk-6IA4DXG2.js";import"./chunk-PS2RJNZZ.js";import"./chunk-BKUWXPEM.js";import"./chunk-ZBUZKIPX.js";import"./chunk-S6DNKKUL.js";import"./chunk-4CC3OZPU.js";import"./chunk-TVCZIH6M.js";import"./chunk-GN6CQ3J4.js";import"./chunk-T5ZEIOJ3.js";import"./chunk-FOCWZZDE.js";import"./chunk-W5DWRFSU.js";import"./chunk-QAYAQNCG.js";import"./chunk-NCUTH6QL.js";export{a as _internals,c as flagsForFuzzing,b as sqlite3Command};
@@ -1,2 +1,2 @@
1
1
  import{createRequire} from"node:module";const require=createRequire(import.meta.url);
2
- import{a,b}from"./chunk-XV2V56NQ.js";import"./chunk-SX2HC7SO.js";import"./chunk-BRJERIF4.js";import"./chunk-WXPNKIIH.js";import"./chunk-L2UW7DWF.js";import"./chunk-ZBUZKIPX.js";import"./chunk-GN6CQ3J4.js";import"./chunk-QAYAQNCG.js";import"./chunk-NCUTH6QL.js";export{b as flagsForFuzzing,a as timeoutCommand};
2
+ import{a,b}from"./chunk-YFFU74KY.js";import"./chunk-SX2HC7SO.js";import"./chunk-BRJERIF4.js";import"./chunk-PS2RJNZZ.js";import"./chunk-L2UW7DWF.js";import"./chunk-ZBUZKIPX.js";import"./chunk-GN6CQ3J4.js";import"./chunk-QAYAQNCG.js";import"./chunk-NCUTH6QL.js";export{b as flagsForFuzzing,a as timeoutCommand};