@e2b/cli 0.1.7 → 0.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +2 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -71,7 +71,7 @@ https://github.com/highlightjs/highlight.js/issues/2277`),ke=H,N=J);let oe={code
|
|
|
71
71
|
`),a+=t+"[["+s+`]]
|
|
72
72
|
`,a+=P1(s+".",t,o)}),a}function bX(e,t,n,r){var i=e+Jc(n),s="";return t9(r).length>0&&(s+=t+"["+i+`]
|
|
73
73
|
`),s+P1(i+".",t,r)}});var c9=E(B1=>{"use strict";l();B1.parse=e9();B1.stringify=l9()});var Y1=E(Ji=>{"use strict";l();Object.defineProperty(Ji,"__esModule",{value:!0});Ji.DEFAULT_COLOR_MAP=void 0;Ji.DEFAULT_COLOR_MAP={red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m",white_bold:"\x1B[01m",reset:"\x1B[0m"};var H1=class{constructor(t=Ji.DEFAULT_COLOR_MAP){this.text="",this.colorMap=t}addCharsWithColor(t,n){let r=this.colorMap[t];this.text+=r!==void 0?`${r}${n}${this.colorMap.reset}`:n}renderConsole(){return this.text}};Ji.default=H1});var La=E(Qe=>{"use strict";l();Object.defineProperty(Qe,"__esModule",{value:!0});Qe.DEFAULT_HEADER_ALIGNMENT=Qe.DEFAULT_ROW_ALIGNMENT=Qe.DEFAULT_HEADER_FONT_COLOR=Qe.DEFAULT_ROW_FONT_COLOR=Qe.COLORS=Qe.ALIGNMENTS=Qe.DEFAULT_TABLE_STYLE=Qe.DEFAULT_ROW_SEPARATOR=Qe.DEFAULT_COLUMN_LEN=void 0;Qe.DEFAULT_COLUMN_LEN=20;Qe.DEFAULT_ROW_SEPARATOR=!1;Qe.DEFAULT_TABLE_STYLE={headerTop:{left:"\u250C",mid:"\u252C",right:"\u2510",other:"\u2500"},headerBottom:{left:"\u251C",mid:"\u253C",right:"\u2524",other:"\u2500"},tableBottom:{left:"\u2514",mid:"\u2534",right:"\u2518",other:"\u2500"},vertical:"\u2502",rowSeparator:{left:"\u251C",mid:"\u253C",right:"\u2524",other:"\u2500"}};Qe.ALIGNMENTS=["right","left","center"];Qe.COLORS=["red","green","yellow","white","blue","magenta","cyan","white_bold","reset"];Qe.DEFAULT_ROW_FONT_COLOR="white";Qe.DEFAULT_HEADER_FONT_COLOR="white_bold";Qe.DEFAULT_ROW_ALIGNMENT="right";Qe.DEFAULT_HEADER_ALIGNMENT="center"});var q1=E(Bn=>{"use strict";l();Object.defineProperty(Bn,"__esModule",{value:!0});Bn.rawColumnToInternalColumn=Bn.objIfExists=void 0;var OX=La(),IX=(e,t)=>t?{[e]:t}:{};Bn.objIfExists=IX;var yX=e=>{var t;return Object.assign(Object.assign(Object.assign(Object.assign({name:e.name,title:(t=e.title)!==null&&t!==void 0?t:e.name},(0,Bn.objIfExists)("color",e.color)),(0,Bn.objIfExists)("maxLen",e.maxLen)),(0,Bn.objIfExists)("minLen",e.minLen)),{alignment:e.alignment||OX.DEFAULT_ROW_ALIGNMENT})};Bn.rawColumnToInternalColumn=yX});var f9=E(V1=>{"use strict";l();Object.defineProperty(V1,"__esModule",{value:!0});var vX=[{first:768,last:879},{first:1155,last:1158},{first:1160,last:1161},{first:1425,last:1469},{first:1471,last:1471},{first:1473,last:1474},{first:1476,last:1477},{first:1479,last:1479},{first:1536,last:1539},{first:1552,last:1557},{first:1611,last:1630},{first:1648,last:1648},{first:1750,last:1764},{first:1767,last:1768},{first:1770,last:1773},{first:1807,last:1807},{first:1809,last:1809},{first:1840,last:1866},{first:1958,last:1968},{first:2027,last:2035},{first:2305,last:2306},{first:2364,last:2364},{first:2369,last:2376},{first:2381,last:2381},{first:2385,last:2388},{first:2402,last:2403},{first:2433,last:2433},{first:2492,last:2492},{first:2497,last:2500},{first:2509,last:2509},{first:2530,last:2531},{first:2561,last:2562},{first:2620,last:2620},{first:2625,last:2626},{first:2631,last:2632},{first:2635,last:2637},{first:2672,last:2673},{first:2689,last:2690},{first:2748,last:2748},{first:2753,last:2757},{first:2759,last:2760},{first:2765,last:2765},{first:2786,last:2787},{first:2817,last:2817},{first:2876,last:2876},{first:2879,last:2879},{first:2881,last:2883},{first:2893,last:2893},{first:2902,last:2902},{first:2946,last:2946},{first:3008,last:3008},{first:3021,last:3021},{first:3134,last:3136},{first:3142,last:3144},{first:3146,last:3149},{first:3157,last:3158},{first:3260,last:3260},{first:3263,last:3263},{first:3270,last:3270},{first:3276,last:3277},{first:3298,last:3299},{first:3393,last:3395},{first:3405,last:3405},{first:3530,last:3530},{first:3538,last:3540},{first:3542,last:3542},{first:3633,last:3633},{first:3636,last:3642},{first:3655,last:3662},{first:3761,last:3761},{first:3764,last:3769},{first:3771,last:3772},{first:3784,last:3789},{first:3864,last:3865},{first:3893,last:3893},{first:3895,last:3895},{first:3897,last:3897},{first:3953,last:3966},{first:3968,last:3972},{first:3974,last:3975},{first:3984,last:3991},{first:3993,last:4028},{first:4038,last:4038},{first:4141,last:4144},{first:4146,last:4146},{first:4150,last:4151},{first:4153,last:4153},{first:4184,last:4185},{first:4448,last:4607},{first:4959,last:4959},{first:5906,last:5908},{first:5938,last:5940},{first:5970,last:5971},{first:6002,last:6003},{first:6068,last:6069},{first:6071,last:6077},{first:6086,last:6086},{first:6089,last:6099},{first:6109,last:6109},{first:6155,last:6157},{first:6313,last:6313},{first:6432,last:6434},{first:6439,last:6440},{first:6450,last:6450},{first:6457,last:6459},{first:6679,last:6680},{first:6912,last:6915},{first:6964,last:6964},{first:6966,last:6970},{first:6972,last:6972},{first:6978,last:6978},{first:7019,last:7027},{first:7616,last:7626},{first:7678,last:7679},{first:8203,last:8207},{first:8234,last:8238},{first:8288,last:8291},{first:8298,last:8303},{first:8400,last:8431},{first:12330,last:12335},{first:12441,last:12442},{first:43014,last:43014},{first:43019,last:43019},{first:43045,last:43046},{first:64286,last:64286},{first:65024,last:65039},{first:65056,last:65059},{first:65279,last:65279},{first:65529,last:65531},{first:68097,last:68099},{first:68101,last:68102},{first:68108,last:68111},{first:68152,last:68154},{first:68159,last:68159},{first:119143,last:119145},{first:119155,last:119170},{first:119173,last:119179},{first:119210,last:119213},{first:119362,last:119364},{first:917505,last:917505},{first:917536,last:917631},{first:917760,last:917999}];V1.default=vX});var g9=E($1=>{"use strict";l();Object.defineProperty($1,"__esModule",{value:!0});var xX=(e,t,n)=>{let r=0,i,s=n;if(e<t[0].first||e>t[s].last)return 0;for(;s>=r;)if(i=Math.floor((r+s)/2),e>t[i].last)r=i+1;else if(e<t[i].first)s=i-1;else return 1;return 0};$1.default=xX});var W1=E(wa=>{"use strict";l();var S9=wa&&wa.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(wa,"__esModule",{value:!0});var h9=S9(f9()),MX=S9(g9()),LX=e=>e===0?0:e<32||e>=127&&e<160?-1:MX.default(e,h9.default,h9.default.length-1)?0:1+ +(e>=4352&&(e<=4447||e===9001||e===9002||e>=11904&&e<=42191&&e!==12351||e>=44032&&e<=55203||e>=63744&&e<=64255||e>=65040&&e<=65049||e>=65072&&e<=65135||e>=65280&&e<=65376||e>=65504&&e<=65510||e>=131072&&e<=196605||e>=196608&&e<=262141));wa.default=LX});var T9=E(Pa=>{"use strict";l();var wX=Pa&&Pa.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Pa,"__esModule",{value:!0});var PX=wX(W1()),FX=e=>{let t=0;for(let n=0;n<e.length;n++){let r=e.charCodeAt(n),i=PX.default(r);if(i<0)return-1;t+=i}return t};Pa.default=FX});var D9=E(Tr=>{"use strict";l();var b9=Tr&&Tr.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Tr,"__esModule",{value:!0});Tr.wcswidth=Tr.wcwidth=void 0;var kX=b9(T9());Tr.wcswidth=kX.default;var BX=b9(W1());Tr.wcwidth=BX.default});var K1=E(Xr=>{"use strict";l();Object.defineProperty(Xr,"__esModule",{value:!0});Xr.findWidthInConsole=Xr.stripAnsi=void 0;var UX=D9(),GX=/\x1b\[\d{1,3}(;\d{1,3})*m/g,HX=e=>e.replace(GX,"");Xr.stripAnsi=HX;var YX=(e,t)=>{let n=0;return e=(0,Xr.stripAnsi)(e),t&&Object.entries(t).forEach(([r,i])=>{let s=new RegExp(r,"g");n+=(e.match(s)||[]).length*i,e=e.replace(r,"")}),n+=(0,UX.wcswidth)(e),n};Xr.findWidthInConsole=YX});var Q1=E(br=>{"use strict";l();Object.defineProperty(br,"__esModule",{value:!0});br.biggestWordInSentence=br.limitWidth=br.textWithPadding=void 0;var z1=K1(),qX=(e,t,n,r)=>{let i=(0,z1.findWidthInConsole)(e,r),s=Math.floor((n-i)/2),a=n-s-i;if(n<i)return e;switch(t){case"left":return e.concat(" ".repeat(n-i));case"center":return" ".repeat(s).concat(e).concat(" ".repeat(a));case"right":default:return" ".repeat(n-i).concat(e)}};br.textWithPadding=qX;var VX=(e,t,n)=>{let r=[],i=e.split(" "),s=[],a=0;return i.forEach(o=>{let c=(0,z1.findWidthInConsole)(o,n);a+c<=t?(a+=c+1,s.push(o)):(r.push(s.join(" ")),s=[o],a=c+1)}),r.push(s.join(" ")),r};br.limitWidth=VX;var $X=(e,t)=>e.split(" ").reduce((n,r)=>Math.max(n,(0,z1.findWidthInConsole)(r,t)),0);br.biggestWordInSentence=$X});var Fa=E(ve=>{"use strict";l();Object.defineProperty(ve,"__esModule",{value:!0});ve.getWidthLimitedColumnsArray=ve.createHeaderAsRow=ve.renderTableHorizontalBorders=ve.findLenOfColumn=ve.createRow=ve.createColumFromComputedColumn=ve.createColumFromOnlyName=ve.createTableHorizontalBorders=ve.convertRawRowOptionsToStandard=ve.cellText=void 0;var X1=q1(),C9=K1(),j1=Q1(),ru=La(),es=(e,t)=>Math.max(e,t),WX=e=>e==null?"":`${e}`;ve.cellText=WX;var KX=e=>{if(e)return{color:e.color,separator:e.separator||ru.DEFAULT_ROW_SEPARATOR}};ve.convertRawRowOptionsToStandard=KX;var zX=({left:e,mid:t,right:n,other:r},i)=>{let s=e;return i.forEach(a=>{s+=r.repeat(a+2),s+=t}),s=s.slice(0,-t.length),s+=n,s};ve.createTableHorizontalBorders=zX;var QX=e=>({name:e,title:e});ve.createColumFromOnlyName=QX;var XX=e=>{var t;return Object.assign(Object.assign(Object.assign(Object.assign({name:e.name,title:(t=e.title)!==null&&t!==void 0?t:e.name},(0,X1.objIfExists)("color",e.color)),(0,X1.objIfExists)("maxLen",e.maxLen)),(0,X1.objIfExists)("minLen",e.minLen)),{alignment:e.alignment||ru.DEFAULT_ROW_ALIGNMENT})};ve.createColumFromComputedColumn=XX;var jX=(e,t,n)=>({color:e,separator:n,text:t});ve.createRow=jX;var ZX=(e,t,n)=>{let r=e.name,i=e.title,s=es(0,e?.minLen||0);return e.maxLen?(s=es(s,es(e.maxLen,(0,j1.biggestWordInSentence)(i,n))),s=t.reduce((a,o)=>es(a,(0,j1.biggestWordInSentence)((0,ve.cellText)(o.text[r]),n)),s),s):(s=es(s,(0,C9.findWidthInConsole)(i,n)),t.forEach(a=>{s=es(s,(0,C9.findWidthInConsole)((0,ve.cellText)(a.text[r]),n))}),s)};ve.findLenOfColumn=ZX;var JX=(e,t)=>(0,ve.createTableHorizontalBorders)(e,t);ve.renderTableHorizontalBorders=JX;var ej=(e,t)=>{let n=ru.DEFAULT_HEADER_FONT_COLOR,r=e(n,{},!1);return t.forEach(i=>{r.text[i.name]=i.title}),r};ve.createHeaderAsRow=ej;var tj=(e,t,n)=>{let r={};return e.forEach(i=>{r[i.name]=(0,j1.limitWidth)((0,ve.cellText)(t.text[i.name]),i.length||ru.DEFAULT_COLUMN_LEN,n)}),r};ve.getWidthLimitedColumnsArray=tj});var A9=E(ts=>{"use strict";l();Object.defineProperty(ts,"__esModule",{value:!0});ts.preProcessRows=ts.preProcessColumns=void 0;var nj=Fa(),rj=e=>{e.computedColumns.length&&e.computedColumns.forEach(t=>{e.addColumn(t),e.rows.forEach(n=>{n.text[t.name]=t.function(n.text)})})},ij=e=>{e.enabledColumns.length&&(e.columns=e.columns.filter(t=>e.enabledColumns.includes(t.name)))},sj=e=>{e.disabledColumns.length&&(e.columns=e.columns.filter(t=>!e.disabledColumns.includes(t.name)))},aj=e=>{e.columns.forEach(t=>{t.length=(0,nj.findLenOfColumn)(t,e.rows,e.charLength)})},oj=e=>{rj(e),sj(e),ij(e),aj(e)};ts.preProcessColumns=oj;var lj=e=>{let t=e.rows.filter(n=>e.filterFunction(n.text)).sort((n,r)=>e.sortFunction(n.text,r.text));e.rows=t};ts.preProcessRows=lj});var Z1=E(Yt=>{"use strict";l();var N9=Yt&&Yt.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Yt,"__esModule",{value:!0});Yt.printSimpleTable=Yt.renderSimpleTable=Yt.renderTable=void 0;var O9=N9(Y1()),I9=Q1(),Jt=La(),Dr=Fa(),cj=N9(J1()),R9=A9(),uj=(e,t,n,r,i,s,a,o)=>{let c=new O9.default(a);return c.addCharsWithColor("",e.vertical),t.forEach(u=>{let m=n<r[u.name].length?(0,Dr.cellText)(r[u.name][n]):"";c.addCharsWithColor(Jt.DEFAULT_ROW_FONT_COLOR," "),c.addCharsWithColor(i&&Jt.DEFAULT_HEADER_FONT_COLOR||u.color||s.color,(0,I9.textWithPadding)(m,u.alignment||Jt.DEFAULT_ROW_ALIGNMENT,u.length||Jt.DEFAULT_COLUMN_LEN,o)),c.addCharsWithColor("",` ${e.vertical}`)}),c.renderConsole()},y9=(e,t,n,r,i,s)=>{let a=(0,Dr.getWidthLimitedColumnsArray)(t,n,s),o=Object.values(a).reduce((u,_)=>Math.max(u,_.length),0),c=[];for(let u=0;u<o;u+=1){let _=uj(e,t,u,a,i,n,r,s);c.push(_)}return c},_j=(e,t)=>{let n=[];return n=n.concat(y9(e.tableStyle,e.columns,t,e.colorMap,void 0,e.charLength)),n},dj=e=>{let t=[];if(e.title===void 0)return t;let n=()=>{let s=(a,o)=>a+o+2+1;return e.columns.map(a=>a.length||Jt.DEFAULT_COLUMN_LEN).reduce(s,1)},r=(0,I9.textWithPadding)(e.title,Jt.DEFAULT_HEADER_ALIGNMENT,n()),i=new O9.default(e.colorMap);return i.addCharsWithColor(Jt.DEFAULT_HEADER_FONT_COLOR,r),t.push(i.renderConsole()),t},mj=e=>{let t=[];t.push((0,Dr.renderTableHorizontalBorders)(e.tableStyle.headerTop,e.columns.map(r=>r.length||Jt.DEFAULT_COLUMN_LEN)));let n=(0,Dr.createHeaderAsRow)(Dr.createRow,e.columns);return t=t.concat(y9(e.tableStyle,e.columns,n,e.colorMap,!0)),t.push((0,Dr.renderTableHorizontalBorders)(e.tableStyle.headerBottom,e.columns.map(r=>r.length||Jt.DEFAULT_COLUMN_LEN))),t},pj=e=>{let t=[];return t.push((0,Dr.renderTableHorizontalBorders)(e.tableStyle.tableBottom,e.columns.map(n=>n.length||Jt.DEFAULT_COLUMN_LEN))),t},Ej=(e,t)=>{let n=[],r=e.rows.length-1;return e.rows.indexOf(t)!==r&&t.separator&&n.push((0,Dr.renderTableHorizontalBorders)(e.tableStyle.rowSeparator,e.columns.map(s=>s.length||Jt.DEFAULT_COLUMN_LEN))),n},fj=e=>{(0,R9.preProcessColumns)(e),(0,R9.preProcessRows)(e);let t=[];return dj(e).forEach(n=>t.push(n)),mj(e).forEach(n=>t.push(n)),e.rows.forEach(n=>{_j(e,n).forEach(r=>t.push(r)),Ej(e,n).forEach(r=>t.push(r))}),pj(e).forEach(n=>t.push(n)),t.join(`
|
|
74
|
-
`)};Yt.renderTable=fj;var gj=e=>{let t=new cj.default;return t.addRows(e),(0,Yt.renderTable)(t)};Yt.renderSimpleTable=gj;var hj=e=>{console.log((0,Yt.renderSimpleTable)(e))};Yt.printSimpleTable=hj});var J1=E(tE=>{"use strict";l();Object.defineProperty(tE,"__esModule",{value:!0});var Sj=Y1(),iu=La(),su=Fa(),Tj=q1(),bj=Z1(),Dj=()=>0,Cj=()=>!0,eE=class{initSimple(t){this.columns=t.map(n=>({name:n,title:n,alignment:iu.DEFAULT_ROW_ALIGNMENT}))}initDetailed(t){var n;this.title=t?.title||this.title,this.tableStyle=t?.style||this.tableStyle,this.sortFunction=t?.sort||this.sortFunction,this.filterFunction=t?.filter||this.filterFunction,this.enabledColumns=t?.enabledColumns||this.enabledColumns,this.disabledColumns=t?.disabledColumns||this.disabledColumns,this.computedColumns=t?.computedColumns||this.computedColumns,this.columns=((n=t?.columns)===null||n===void 0?void 0:n.map(Tj.rawColumnToInternalColumn))||this.columns,this.rowSeparator=t?.rowSeparator||this.rowSeparator,this.charLength=t?.charLength||this.charLength,t?.colorMap&&(this.colorMap=Object.assign(Object.assign({},this.colorMap),t.colorMap)),t.rows!==void 0&&this.addRows(t.rows)}constructor(t){this.rows=[],this.columns=[],this.title=void 0,this.tableStyle=iu.DEFAULT_TABLE_STYLE,this.filterFunction=Cj,this.sortFunction=Dj,this.enabledColumns=[],this.disabledColumns=[],this.computedColumns=[],this.rowSeparator=iu.DEFAULT_ROW_SEPARATOR,this.colorMap=Sj.DEFAULT_COLOR_MAP,this.charLength={},t instanceof Array?this.initSimple(t):typeof t=="object"&&this.initDetailed(t)}createColumnFromRow(t){let n=this.columns.map(r=>r.name);Object.keys(t).forEach(r=>{n.includes(r)||this.columns.push((0,su.createColumFromOnlyName)(r))})}addColumn(t){typeof t=="string"?this.columns.push((0,su.createColumFromOnlyName)(t)):this.columns.push((0,su.createColumFromComputedColumn)(t))}addColumns(t){t.forEach(n=>{this.addColumn(n)})}addRow(t,n){this.createColumnFromRow(t),this.rows.push((0,su.createRow)(n?.color||iu.DEFAULT_ROW_FONT_COLOR,t,n?.separator!==void 0?n?.separator:this.rowSeparator))}addRows(t,n){t.forEach(r=>{this.addRow(r,n)})}renderTable(){return(0,bj.renderTable)(this)}};tE.default=eE});var x9=E(ka=>{"use strict";l();var Aj=ka&&ka.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(ka,"__esModule",{value:!0});var Rj=Aj(J1()),v9=Fa(),nE=class{constructor(t){this.table=new Rj.default(t)}addColumn(t){return this.table.addColumn(t),this}addColumns(t){return this.table.addColumns(t),this}addRow(t,n){return this.table.addRow(t,(0,v9.convertRawRowOptionsToStandard)(n)),this}addRows(t,n){return this.table.addRows(t,(0,v9.convertRawRowOptionsToStandard)(n)),this}printTable(){let t=this.table.renderTable();console.log(t)}render(){return this.table.renderTable()}};ka.default=nE});var L9=E(pn=>{"use strict";l();var Nj=pn&&pn.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(pn,"__esModule",{value:!0});pn.renderTable=pn.printTable=pn.Table=void 0;var Oj=Nj(x9());pn.Table=Oj.default;var M9=Z1();Object.defineProperty(pn,"printTable",{enumerable:!0,get:function(){return M9.printSimpleTable}});Object.defineProperty(pn,"renderTable",{enumerable:!0,get:function(){return M9.renderSimpleTable}})});var vj={};dE(vj,{pkg:()=>Xl});module.exports=s5(vj);l();var $9=te(require("update-notifier"));var ou={};dE(ou,{author:()=>_5,bin:()=>S5,bugs:()=>d5,default:()=>D5,dependencies:()=>T5,description:()=>l5,devDependencies:()=>g5,engines:()=>b5,files:()=>h5,homepage:()=>c5,license:()=>u5,name:()=>o5,publishConfig:()=>p5,repository:()=>m5,scripts:()=>f5,sideEffects:()=>E5,version:()=>lu});var o5="@e2b/cli",lu="0.1.
|
|
74
|
+
`)};Yt.renderTable=fj;var gj=e=>{let t=new cj.default;return t.addRows(e),(0,Yt.renderTable)(t)};Yt.renderSimpleTable=gj;var hj=e=>{console.log((0,Yt.renderSimpleTable)(e))};Yt.printSimpleTable=hj});var J1=E(tE=>{"use strict";l();Object.defineProperty(tE,"__esModule",{value:!0});var Sj=Y1(),iu=La(),su=Fa(),Tj=q1(),bj=Z1(),Dj=()=>0,Cj=()=>!0,eE=class{initSimple(t){this.columns=t.map(n=>({name:n,title:n,alignment:iu.DEFAULT_ROW_ALIGNMENT}))}initDetailed(t){var n;this.title=t?.title||this.title,this.tableStyle=t?.style||this.tableStyle,this.sortFunction=t?.sort||this.sortFunction,this.filterFunction=t?.filter||this.filterFunction,this.enabledColumns=t?.enabledColumns||this.enabledColumns,this.disabledColumns=t?.disabledColumns||this.disabledColumns,this.computedColumns=t?.computedColumns||this.computedColumns,this.columns=((n=t?.columns)===null||n===void 0?void 0:n.map(Tj.rawColumnToInternalColumn))||this.columns,this.rowSeparator=t?.rowSeparator||this.rowSeparator,this.charLength=t?.charLength||this.charLength,t?.colorMap&&(this.colorMap=Object.assign(Object.assign({},this.colorMap),t.colorMap)),t.rows!==void 0&&this.addRows(t.rows)}constructor(t){this.rows=[],this.columns=[],this.title=void 0,this.tableStyle=iu.DEFAULT_TABLE_STYLE,this.filterFunction=Cj,this.sortFunction=Dj,this.enabledColumns=[],this.disabledColumns=[],this.computedColumns=[],this.rowSeparator=iu.DEFAULT_ROW_SEPARATOR,this.colorMap=Sj.DEFAULT_COLOR_MAP,this.charLength={},t instanceof Array?this.initSimple(t):typeof t=="object"&&this.initDetailed(t)}createColumnFromRow(t){let n=this.columns.map(r=>r.name);Object.keys(t).forEach(r=>{n.includes(r)||this.columns.push((0,su.createColumFromOnlyName)(r))})}addColumn(t){typeof t=="string"?this.columns.push((0,su.createColumFromOnlyName)(t)):this.columns.push((0,su.createColumFromComputedColumn)(t))}addColumns(t){t.forEach(n=>{this.addColumn(n)})}addRow(t,n){this.createColumnFromRow(t),this.rows.push((0,su.createRow)(n?.color||iu.DEFAULT_ROW_FONT_COLOR,t,n?.separator!==void 0?n?.separator:this.rowSeparator))}addRows(t,n){t.forEach(r=>{this.addRow(r,n)})}renderTable(){return(0,bj.renderTable)(this)}};tE.default=eE});var x9=E(ka=>{"use strict";l();var Aj=ka&&ka.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(ka,"__esModule",{value:!0});var Rj=Aj(J1()),v9=Fa(),nE=class{constructor(t){this.table=new Rj.default(t)}addColumn(t){return this.table.addColumn(t),this}addColumns(t){return this.table.addColumns(t),this}addRow(t,n){return this.table.addRow(t,(0,v9.convertRawRowOptionsToStandard)(n)),this}addRows(t,n){return this.table.addRows(t,(0,v9.convertRawRowOptionsToStandard)(n)),this}printTable(){let t=this.table.renderTable();console.log(t)}render(){return this.table.renderTable()}};ka.default=nE});var L9=E(pn=>{"use strict";l();var Nj=pn&&pn.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(pn,"__esModule",{value:!0});pn.renderTable=pn.printTable=pn.Table=void 0;var Oj=Nj(x9());pn.Table=Oj.default;var M9=Z1();Object.defineProperty(pn,"printTable",{enumerable:!0,get:function(){return M9.printSimpleTable}});Object.defineProperty(pn,"renderTable",{enumerable:!0,get:function(){return M9.renderSimpleTable}})});var vj={};dE(vj,{pkg:()=>Xl});module.exports=s5(vj);l();var $9=te(require("update-notifier"));var ou={};dE(ou,{author:()=>_5,bin:()=>S5,bugs:()=>d5,default:()=>D5,dependencies:()=>T5,description:()=>l5,devDependencies:()=>g5,engines:()=>b5,files:()=>h5,homepage:()=>c5,license:()=>u5,name:()=>o5,publishConfig:()=>p5,repository:()=>m5,scripts:()=>f5,sideEffects:()=>E5,version:()=>lu});var o5="@e2b/cli",lu="0.1.8",l5="CLI for managing e2b sandbox templates",c5="https://e2b.dev",u5="MIT",_5={name:"FoundryLabs, Inc.",email:"hello@e2b.dev",url:"https://e2b.dev"},d5="https://github.com/e2b-dev/e2b/issues",m5={type:"git",url:"https://github.com/e2b-dev/e2b",directory:"packages/cli"},p5={access:"public"},E5=!1,f5={prepublishOnly:"pnpm run build",build:"tsup --minify",dev:"tsup --watch",test:"pnpm build && cd testground/demo-basic && ../../dist/index.js template build","check-deps":"knip","update-deps":"ncu -u && pnpm i"},g5={"@types/common-tags":"^1.8.2","@types/node":"^18.18.6","@types/tar-fs":"^2.0.3","@types/update-notifier":"6.0.5",knip:"^2.33.4","npm-check-updates":"^16.14.6",tsup:"^7.2.0",typescript:"^5.2.2",vitest:"^0.34.6"},h5=["dist","LICENSE","README","package.json"],S5={e2b:"dist/index.js"},T5={"@balena/dockerignore":"^1.0.2","@e2b/sdk":"^0.8.5","@iarna/toml":"^2.2.5","@nodelib/fs.walk":"^2.0.0","async-listen":"^3.0.1",boxen:"^7.1.1",chalk:"^5.3.0","cli-highlight":"^2.1.11",commander:"^11.1.0","common-tags":"^1.8.2","console-table-printer":"^2.11.2",ignore:"^5.2.4",open:"^9.1.0","strip-ansi":"^7.1.0","tar-fs":"^3.0.4","update-notifier":"5.1.0",yup:"^1.3.2"},b5={node:">=18"},D5={name:o5,version:lu,description:l5,homepage:c5,license:u5,author:_5,bugs:d5,repository:m5,publishConfig:p5,sideEffects:E5,scripts:f5,devDependencies:g5,files:h5,bin:S5,dependencies:T5,engines:b5};l();l();var IE=te(OE(),1),{program:zj,createCommand:Qj,createArgument:Xj,createOption:jj,CommanderError:Zj,InvalidArgumentError:Jj,InvalidOptionArgumentError:eZ,Command:gt,Argument:tZ,Option:qa,Help:nZ}=IE.default;l();var Kv=te(vE());var Ql=te(require("fs")),zv=te(require("http"));l();var Eo=te(require("process"),1),Ch=require("buffer"),h_=te(require("path"),1),Ah=require("url"),Rh=te(require("child_process"),1),fo=te(require("fs/promises"),1),S_=require("fs"),fs=te(FE(),1);l();function Cr(e,t,n){let r=i=>Object.defineProperty(e,t,{value:i,enumerable:!0,writable:!0});return Object.defineProperty(e,t,{configurable:!0,enumerable:!0,get(){let i=n();return r(i),i},set(i){r(i)}}),e}l();var mo=te(require("process"),1);l();var YE=te(require("os"),1),qE=require("fs"),VE=te(BE(),1),$E=te(HE(),1),nP=Number(YE.default.release().split(".")[0]),rP=(0,$E.default)(nP>=14?"~/Library/Preferences/com.apple.LaunchServices/com.apple.launchservices.secure.plist":"~/Library/Preferences/com.apple.LaunchServices.plist");async function Ru(){if(process.platform!=="darwin")throw new Error("macOS only");let e="com.apple.Safari",t;try{t=await qE.promises.readFile(rP)}catch(i){if(i.code==="ENOENT")return e;throw i}let n=VE.default.parseBuffer(t),r=n&&n[0].LSHandlers;if(!r||r.length===0)return e;for(let i of r)if(i.LSHandlerURLScheme==="http"&&i.LSHandlerRoleAll){e=i.LSHandlerRoleAll;break}return e}l();l();var Ng=te(Rg(),1);async function Og(e){if(process.platform!=="darwin")throw new Error("macOS only");let{stdout:t}=await(0,Ng.default)("osascript",["-e",e]);return t}async function Qu(e){return Og(`tell application "Finder" to set app_path to application file id "${e}" as string
|
|
75
75
|
tell application "System Events" to get value of property list item "CFBundleName" of property list file (app_path & ":Contents:Info.plist")`)}l();function Xu(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.toLowerCase().replace(/(?:^|\s|-)\S/g,t=>t.toUpperCase())}l();var mh=require("buffer"),ph=te(require("path"),1),uo=te(require("child_process"),1),ms=te(require("process"),1),Eh=te(Fu(),1);l();function ju(e){let t=typeof e=="string"?`
|
|
76
76
|
`:`
|
|
77
77
|
`.charCodeAt(),n=typeof e=="string"?"\r":"\r".charCodeAt();return e[e.length-1]===t&&(e=e.slice(0,-1)),e[e.length-1]===n&&(e=e.slice(0,-1)),e}l();var _s=te(require("process"),1),si=te(require("path"),1),Ig=te(require("url"),1);l();function io(e={}){let{env:t=process.env,platform:n=process.platform}=e;return n!=="win32"?"PATH":Object.keys(t).reverse().find(r=>r.toUpperCase()==="PATH")||"Path"}function jF(e={}){let{cwd:t=_s.default.cwd(),path:n=_s.default.env[io()],execPath:r=_s.default.execPath}=e,i,s=t instanceof URL?Ig.default.fileURLToPath(t):t,a=si.default.resolve(s),o=[];for(;i!==a;)o.push(si.default.join(a,"node_modules/.bin")),i=a,a=si.default.resolve(a,"..");return o.push(si.default.resolve(s,r,"..")),[...o,n].join(si.default.delimiter)}function yg({env:e=_s.default.env,...t}={}){e={...e};let n=io({env:e});return t.path=e[n],e[n]=jF(t),e}l();l();var ZF=(e,t,n,r)=>{if(n==="length"||n==="prototype"||n==="arguments"||n==="caller")return;let i=Object.getOwnPropertyDescriptor(e,n),s=Object.getOwnPropertyDescriptor(t,n);!JF(i,s)&&r||Object.defineProperty(e,n,s)},JF=function(e,t){return e===void 0||e.configurable||e.writable===t.writable&&e.enumerable===t.enumerable&&e.configurable===t.configurable&&(e.writable||e.value===t.value)},e8=(e,t)=>{let n=Object.getPrototypeOf(t);n!==Object.getPrototypeOf(e)&&Object.setPrototypeOf(e,n)},t8=(e,t)=>`/* Wrapped ${e}*/
|
|
@@ -133,7 +133,7 @@ ${Zm(o,"Python SDK")}${Zm(c,"JS SDK",!0)}`;console.log(`
|
|
|
133
133
|
${tr(_,{float:"left",padding:0,margin:1,title:"Usage examples"})}`);break}case"error":throw s.data.logs.forEach(o=>process.stdout.write(Xm(Qt(o)))),new Error(`
|
|
134
134
|
\u274C Building sandbox template ${Gt({aliases:a,...s.data})} failed.
|
|
135
135
|
Check the logs above for more details or contact us ${lr("(https://e2b.dev/docs/getting-help)")} to get help.
|
|
136
|
-
`)}}while(s.data.status==="building")}function G1(e){if(Ma.existsSync(e))return Ma.readFileSync(e,"utf-8")}function RX(e,t){if(t){let o=kn.join(e,t),c=G1(o),u=kn.relative(e,o);if(c===void 0)throw new Error(`No ${At(u)} found in the root directory.`);return{dockerfilePath:o,dockerfileContent:c,dockerfileRelativePath:u}}let n=kn.join(e,hr),r=G1(n),i=kn.relative(e,n),s=i;if(r!==void 0)return{dockerfilePath:n,dockerfileContent:r,dockerfileRelativePath:s};n=kn.join(e,Qi),r=G1(n);let a=kn.relative(e,n);if(s=a,r!==void 0)return{dockerfilePath:n,dockerfileContent:r,dockerfileRelativePath:s};throw new Error(`No ${At(i)} or ${At(a)} found in the root directory.You can specify a custom Dockerfile with ${ot("--dockerfile <file>")} option.`)}async function NX(e,t,n){let r=await fetch(Qs+(n?`/envs/${n}`:"/envs"),{method:"POST",headers:{Authorization:`Bearer ${e}`},body:t}),i=await r.json()
|
|
136
|
+
`)}}while(s.data.status==="building")}function G1(e){if(Ma.existsSync(e))return Ma.readFileSync(e,"utf-8")}function RX(e,t){if(t){let o=kn.join(e,t),c=G1(o),u=kn.relative(e,o);if(c===void 0)throw new Error(`No ${At(u)} found in the root directory.`);return{dockerfilePath:o,dockerfileContent:c,dockerfileRelativePath:u}}let n=kn.join(e,hr),r=G1(n),i=kn.relative(e,n),s=i;if(r!==void 0)return{dockerfilePath:n,dockerfileContent:r,dockerfileRelativePath:s};n=kn.join(e,Qi),r=G1(n);let a=kn.relative(e,n);if(s=a,r!==void 0)return{dockerfilePath:n,dockerfileContent:r,dockerfileRelativePath:s};throw new Error(`No ${At(i)} or ${At(a)} found in the root directory.You can specify a custom Dockerfile with ${ot("--dockerfile <file>")} option.`)}async function NX(e,t,n){let r=await fetch(Qs+(n?`/envs/${n}`:"/envs"),{method:"POST",headers:{Authorization:`Bearer ${e}`},body:t}),i;try{i=await r.json()}catch{throw new Error(`Build API request failed: ${r.statusText}`)}if(!r.ok){let s=i;throw s.code===401?new Error(`Authentication error: ${r.statusText}, ${s.message??"no message"}`):s.code===500?new Error(`Server error: ${r.statusText}, ${s.message??"no message"}`):new Error(`API request failed: ${r.statusText}, ${s.message??"no message"}`)}return i}l();var w9=te(L9());var Ij=ua(dr.path("/envs").method("get").create()),P9=new gt("list").description("List sandbox templates").alias("ls").action(async()=>{try{let e=hc();process.stdout.write(`
|
|
137
137
|
`);let n=(await Ij(e,{})).data;n?.length?(new w9.Table({title:"Sandbox templates",columns:[{name:"envID",alignment:"left",title:"Template ID"},{name:"aliases",alignment:"left",title:"Template Name",color:"blue"}],disabledColumns:["public","buildID"],rows:n.map(i=>({...i,aliases:jm(i.aliases)})),sort:(i,s)=>i.envID.localeCompare(s.envID)}).printTable(),process.stdout.write(`
|
|
138
138
|
`)):console.log("No templates found.")}catch(e){console.error(e),process.exit(1)}});l();l();l();function F9(){let e,t,n=new Promise((r,i)=>{e=r,t=i});return{resolve:e,reject:t,promise:n}}function k9(){return{cols:process.stdout.columns,rows:process.stdout.rows}}async function B9(e,t,n){let{promise:r,resolve:i}=F9();console.log(t);let s=await e.start({onData:c=>process.stdout.write(c),size:k9(),onExit:i,envVars:{TERM:"xterm-256color"}});process.stdin.setEncoding("utf8"),process.stdin.setRawMode(!0),process.stdout.setEncoding("utf8");let a=process.stdout.on("resize",()=>s.resize(k9())),o=process.stdin.on("data",c=>s.sendData(c.toString("utf8")));return r.then(()=>{console.log(n),a.destroy(),o.destroy()}),{kill:s.kill.bind(s),exited:r}}var U9=te(require("fs"));var G9=te(require("path")),H9=new gt("shell").description("Connect terminal to sandbox").argument("[id]",`Connect to sandbox specified by ${ot("[id]")}`).addOption(Bi).alias("sh").action(async(e,t)=>{try{let n=$M(),r=e,i=wi(t.path),s=nu(i),a=U9.default.existsSync(s)?await tu(s):void 0,o=G9.default.relative(i,s);!r&&a&&(console.log(`Found sandbox template ${Gt({envID:a.id,aliases:a.name?[a.name]:void 0},o)}`),r=a.id),r||(console.error("You need to specify sandbox template ID or path to sandbox template config"),process.exit(1)),await yj({apiKey:n,template:{envID:r}}),process.exit(0)}catch(n){console.error(n),process.exit(1)}});async function yj({apiKey:e,template:t}){let n=await da.create({apiKey:e,id:t.envID});if(n.terminal){let{exited:r}=await B9(n.terminal,`Terminal connected to sandbox ${Gt(t)}
|
|
139
139
|
with sandbox URL ${ot(`https://${n.getHostname()}`)}`,`Disconnecting terminal from sandbox ${Gt(t)}`);await r,console.log(`Closing terminal connection to sandbox ${Gt(t)}`)}else throw new Error("Cannot start terminal - no sandbox")}l();var Y9=te(require("fs/promises")),q9=te(require("fs")),rE=te(require("path"));var V9=new gt("init").description(`Create basic E2B Dockerfile (${At("e2b.Dockerfile")}) in root directory. You can then run ${lr("e2b build")} to build sandbox template from this Dockerfile`).addOption(Bi).alias("it").action(async e=>{try{process.stdout.write(`
|