webmux 0.32.0 → 0.34.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/backend/dist/server.js +642 -372
- package/bin/webmux.js +598 -143
- package/frontend/dist/assets/{DiffDialog-CtwnOqjo.js → DiffDialog-Dv77nDf4.js} +1 -1
- package/frontend/dist/assets/index-BgvCuf9J.js +34 -0
- package/frontend/dist/assets/index-EO_hEDxL.css +1 -0
- package/frontend/dist/index.html +2 -2
- package/package.json +1 -1
- package/frontend/dist/assets/index-CvURkZrd.css +0 -1
- package/frontend/dist/assets/index-EqF9CRFa.js +0 -34
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{D as ue,c as rt,f as Be,p as we,v as at,h as lt,b as ot,N as dt,u as ct,s as ft,A as de,t as ut,G as Re,w as Y,d as ht,l as pt,o as D,B as bt,m as We,z as ee,g as X,q as ye,a as mt,E as gt,e as Q,y as ce,C as vt,x as Ee,j as Se,r as wt,F as Le,k as yt,n as se,i as xt}from"./index-
|
|
1
|
+
import{D as ue,c as rt,f as Be,p as we,v as at,h as lt,b as ot,N as dt,u as ct,s as ft,A as de,t as ut,G as Re,w as Y,d as ht,l as pt,o as D,B as bt,m as We,z as ee,g as X,q as ye,a as mt,E as gt,e as Q,y as ce,C as vt,x as Ee,j as Se,r as wt,F as Le,k as yt,n as se,i as xt}from"./index-BgvCuf9J.js";import"./vendor-xterm-DvXGiZvM.js";function Tt(s,n,t=!1,e=!1,i=!1,o=!1){var r=s,f="";if(t)var c=s;ue(()=>{var u=rt;if(f!==(f=n()??"")){if(t){u.nodes=null,c.innerHTML=f,f!==""&&Be(we(c),c.lastChild);return}if(u.nodes!==null&&(at(u.nodes.start,u.nodes.end),u.nodes=null),f!==""){var g=e?ot:i?dt:void 0,x=lt(e?"svg":i?"math":"template",g);x.innerHTML=f;var S=e||i?x:x.content;if(Be(we(S),S.lastChild),e||i)for(;we(S);)r.before(we(S));else r.before(S)}}})}var A;(function(s){s.INSERT="insert",s.DELETE="delete",s.CONTEXT="context"})(A||(A={}));const Nt={LINE_BY_LINE:"line-by-line"},Ct={NONE:"none"},Et={WORD:"word"};var he;(function(s){s.AUTO="auto",s.DARK="dark",s.LIGHT="light"})(he||(he={}));const St=["-","[","]","/","{","}","(",")","*","+","?",".","\\","^","$","|"],Lt=RegExp("["+St.join("\\")+"]","g");function Dt(s){return s.replace(Lt,"\\$&")}function je(s){return s&&s.replace(/\\/g,"/")}function _t(s){let n,t,e,i=0;for(n=0,e=s.length;n<e;n++)t=s.charCodeAt(n),i=(i<<5)-i+t,i|=0;return i}function Je(s){const n=s.length;let t=-1/0;for(let e=0;e<n;e++)t=Math.max(t,s[e]);return t}function ke(s,n){const t=s.split(".");return t.length>1?t[t.length-1]:n}function ze(s,n){return n.reduce((t,e)=>t||s.startsWith(e),!1)}const Ue=["a/","b/","i/","w/","c/","o/"];function ae(s,n,t){const e=t!==void 0?[...Ue,t]:Ue,i=n?new RegExp(`^${Dt(n)} "?(.+?)"?$`):new RegExp('^"?(.+?)"?$'),[,o=""]=i.exec(s)||[],r=e.find(c=>o.indexOf(c)===0);return(r?o.slice(r.length):o).replace(/\s+\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}(?:\.\d+)? [+-]\d{4}.*$/,"")}function Pt(s,n){return ae(s,"---",n)}function It(s,n){return ae(s,"+++",n)}function Mt(s,n={}){const t=[];let e=null,i=null,o=null,r=null,f=null,c=null,u=null;const g="--- ",x="+++ ",S="@@",a=/^old mode (\d{6})/,d=/^new mode (\d{6})/,m=/^deleted file mode (\d{6})/,p=/^new file mode (\d{6})/,y=/^copy from "?(.+)"?/,N=/^copy to "?(.+)"?/,T=/^rename from "?(.+)"?/,P=/^rename to "?(.+)"?/,L=/^similarity index (\d+)%/,I=/^dissimilarity index (\d+)%/,ie=/^index ([\da-z]+)\.\.([\da-z]+)\s*(\d{6})?/,l=/^Binary files (.*) and (.*) differ/,h=/^GIT binary patch/,w=/^index ([\da-z]+),([\da-z]+)\.\.([\da-z]+)/,C=/^mode (\d{6}),(\d{6})\.\.(\d{6})/,M=/^new file mode (\d{6})/,V=/^deleted file mode (\d{6}),(\d{6})/,k=s.replace(/\/g,"").replace(/\r\n?/g,`
|
|
2
2
|
`).split(`
|
|
3
3
|
`);function E(){i!==null&&e!==null&&(e.blocks.push(i),i=null)}function R(){e!==null&&(!e.oldName&&c!==null&&(e.oldName=c),!e.newName&&u!==null&&(e.newName=u),e.newName&&(t.push(e),e=null)),c=null,u=null}function $(){E(),R(),e={blocks:[],deletedLines:0,addedLines:0}}function j(b){E();let _;e!==null&&((_=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@.*/.exec(b))?(e.isCombined=!1,o=parseInt(_[1],10),f=parseInt(_[2],10)):(_=/^@@@ -(\d+)(?:,\d+)? -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@@.*/.exec(b))?(e.isCombined=!0,o=parseInt(_[1],10),r=parseInt(_[2],10),f=parseInt(_[3],10)):(b.startsWith(S)&&console.error("Failed to parse lines, starting in 0!"),o=0,f=0,e.isCombined=!1)),i={lines:[],oldStartLine:o,oldStartLine2:r,newStartLine:f,header:b}}function O(b){if(e===null||i===null||o===null||f===null)return;const _={content:b},v=e.isCombined?["+ "," +","++"]:["+"],z=e.isCombined?["- "," -","--"]:["-"];ze(b,v)?(e.addedLines++,_.type=A.INSERT,_.oldNumber=void 0,_.newNumber=f++):ze(b,z)?(e.deletedLines++,_.type=A.DELETE,_.oldNumber=o++,_.newNumber=void 0):(_.type=A.CONTEXT,_.oldNumber=o++,_.newNumber=f++),i.lines.push(_)}function q(b,_){let v=_;for(;v<k.length-3;){if(b.startsWith("diff"))return!1;if(k[v].startsWith(g)&&k[v+1].startsWith(x)&&k[v+2].startsWith(S))return!0;v++}return!1}return k.forEach((b,_)=>{if(!b||b.startsWith("*"))return;let v;const z=k[_-1],le=k[_+1],be=k[_+2];if(b.startsWith("diff --git")||b.startsWith("diff --combined")){if($(),(v=/^diff --git "?([a-ciow]\/.+)"? "?([a-ciow]\/.+)"?/.exec(b))&&(c=ae(v[1],void 0,n.dstPrefix),u=ae(v[2],void 0,n.srcPrefix)),e===null)throw new Error("Where is my file !!!");e.isGitDiff=!0;return}if(b.startsWith("Binary files")&&!(e!=null&&e.isGitDiff)){if($(),(v=/^Binary files "?([a-ciow]\/.+)"? and "?([a-ciow]\/.+)"? differ/.exec(b))&&(c=ae(v[1],void 0,n.dstPrefix),u=ae(v[2],void 0,n.srcPrefix)),e===null)throw new Error("Where is my file !!!");e.isBinary=!0;return}if((!e||!e.isGitDiff&&e&&b.startsWith(g)&&le.startsWith(x)&&be.startsWith(S))&&$(),e!=null&&e.isTooBig)return;if(e&&(typeof n.diffMaxChanges=="number"&&e.addedLines+e.deletedLines>n.diffMaxChanges||typeof n.diffMaxLineLength=="number"&&b.length>n.diffMaxLineLength)){e.isTooBig=!0,e.addedLines=0,e.deletedLines=0,e.blocks=[],i=null;const oe=typeof n.diffTooBigMessage=="function"?n.diffTooBigMessage(t.length):"Diff too big to be displayed";j(oe);return}if(b.startsWith(g)&&le.startsWith(x)||b.startsWith(x)&&z.startsWith(g)){if(e&&!e.oldName&&b.startsWith("--- ")&&(v=Pt(b,n.srcPrefix))){e.oldName=v,e.language=ke(e.oldName,e.language);return}if(e&&!e.newName&&b.startsWith("+++ ")&&(v=It(b,n.dstPrefix))){e.newName=v,e.language=ke(e.newName,e.language);return}}if(e&&(b.startsWith(S)||e.isGitDiff&&e.oldName&&e.newName&&!i)){j(b);return}if(i&&(b.startsWith("+")||b.startsWith("-")||b.startsWith(" "))){O(b);return}const re=!q(b,_);if(e===null)throw new Error("Where is my file !!!");(v=a.exec(b))?e.oldMode=v[1]:(v=d.exec(b))?e.newMode=v[1]:(v=m.exec(b))?(e.deletedFileMode=v[1],e.isDeleted=!0):(v=p.exec(b))?(e.newFileMode=v[1],e.isNew=!0):(v=y.exec(b))?(re&&(e.oldName=v[1]),e.isCopy=!0):(v=N.exec(b))?(re&&(e.newName=v[1]),e.isCopy=!0):(v=T.exec(b))?(re&&(e.oldName=v[1]),e.isRename=!0):(v=P.exec(b))?(re&&(e.newName=v[1]),e.isRename=!0):(v=l.exec(b))?(e.isBinary=!0,e.oldName=ae(v[1],void 0,n.srcPrefix),e.newName=ae(v[2],void 0,n.dstPrefix),j("Binary file")):h.test(b)?(e.isBinary=!0,j(b)):(v=L.exec(b))?e.unchangedPercentage=parseInt(v[1],10):(v=I.exec(b))?e.changedPercentage=parseInt(v[1],10):(v=ie.exec(b))?(e.checksumBefore=v[1],e.checksumAfter=v[2],v[3]&&(e.mode=v[3])):(v=w.exec(b))?(e.checksumBefore=[v[2],v[3]],e.checksumAfter=v[1]):(v=C.exec(b))?(e.oldMode=[v[2],v[3]],e.newMode=v[1]):(v=M.exec(b))?(e.newFileMode=v[1],e.isNew=!0):(v=V.exec(b))&&(e.deletedFileMode=v[1],e.isDeleted=!0)}),E(),R(),t}class Qe{diff(n,t,e={}){let i;typeof e=="function"?(i=e,e={}):"callback"in e&&(i=e.callback);const o=this.castInput(n,e),r=this.castInput(t,e),f=this.removeEmpty(this.tokenize(o,e)),c=this.removeEmpty(this.tokenize(r,e));return this.diffWithOptionsObj(f,c,e,i)}diffWithOptionsObj(n,t,e,i){var o;const r=N=>{if(N=this.postProcess(N,e),i){setTimeout(function(){i(N)},0);return}else return N},f=t.length,c=n.length;let u=1,g=f+c;e.maxEditLength!=null&&(g=Math.min(g,e.maxEditLength));const x=(o=e.timeout)!==null&&o!==void 0?o:1/0,S=Date.now()+x,a=[{oldPos:-1,lastComponent:void 0}];let d=this.extractCommon(a[0],t,n,0,e);if(a[0].oldPos+1>=c&&d+1>=f)return r(this.buildValues(a[0].lastComponent,t,n));let m=-1/0,p=1/0;const y=()=>{for(let N=Math.max(m,-u);N<=Math.min(p,u);N+=2){let T;const P=a[N-1],L=a[N+1];P&&(a[N-1]=void 0);let I=!1;if(L){const l=L.oldPos-N;I=L&&0<=l&&l<f}const ie=P&&P.oldPos+1<c;if(!I&&!ie){a[N]=void 0;continue}if(!ie||I&&P.oldPos<L.oldPos?T=this.addToPath(L,!0,!1,0,e):T=this.addToPath(P,!1,!0,1,e),d=this.extractCommon(T,t,n,N,e),T.oldPos+1>=c&&d+1>=f)return r(this.buildValues(T.lastComponent,t,n))||!0;a[N]=T,T.oldPos+1>=c&&(p=Math.min(p,N-1)),d+1>=f&&(m=Math.max(m,N+1))}u++};if(i)(function N(){setTimeout(function(){if(u>g||Date.now()>S)return i(void 0);y()||N()},0)})();else for(;u<=g&&Date.now()<=S;){const N=y();if(N)return N}}addToPath(n,t,e,i,o){const r=n.lastComponent;return r&&!o.oneChangePerToken&&r.added===t&&r.removed===e?{oldPos:n.oldPos+i,lastComponent:{count:r.count+1,added:t,removed:e,previousComponent:r.previousComponent}}:{oldPos:n.oldPos+i,lastComponent:{count:1,added:t,removed:e,previousComponent:r}}}extractCommon(n,t,e,i,o){const r=t.length,f=e.length;let c=n.oldPos,u=c-i,g=0;for(;u+1<r&&c+1<f&&this.equals(e[c+1],t[u+1],o);)u++,c++,g++,o.oneChangePerToken&&(n.lastComponent={count:1,previousComponent:n.lastComponent,added:!1,removed:!1});return g&&!o.oneChangePerToken&&(n.lastComponent={count:g,previousComponent:n.lastComponent,added:!1,removed:!1}),n.oldPos=c,u}equals(n,t,e){return e.comparator?e.comparator(n,t):n===t||!!e.ignoreCase&&n.toLowerCase()===t.toLowerCase()}removeEmpty(n){const t=[];for(let e=0;e<n.length;e++)n[e]&&t.push(n[e]);return t}castInput(n,t){return n}tokenize(n,t){return Array.from(n)}join(n){return n.join("")}postProcess(n,t){return n}get useLongestToken(){return!1}buildValues(n,t,e){const i=[];let o;for(;n;)i.push(n),o=n.previousComponent,delete n.previousComponent,n=o;i.reverse();const r=i.length;let f=0,c=0,u=0;for(;f<r;f++){const g=i[f];if(g.removed)g.value=this.join(e.slice(u,u+g.count)),u+=g.count;else{if(!g.added&&this.useLongestToken){let x=t.slice(c,c+g.count);x=x.map(function(S,a){const d=e[u+a];return d.length>S.length?d:S}),g.value=this.join(x)}else g.value=this.join(t.slice(c,c+g.count));c+=g.count,g.added||(u+=g.count)}}return i}}class Ot extends Qe{}const Ft=new Ot;function Ht(s,n,t){return Ft.diff(s,n,t)}const Ge="a-zA-Z0-9_\\u{AD}\\u{C0}-\\u{D6}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}";class At extends Qe{tokenize(n){const t=new RegExp(`(\\r?\\n)|[${Ge}]+|[^\\S\\n\\r]+|[^${Ge}]`,"ug");return n.match(t)||[]}}const Bt=new At;function Rt(s,n,t){return Bt.diff(s,n,t)}function Wt(s,n){if(s.length===0)return n.length;if(n.length===0)return s.length;const t=[];let e;for(e=0;e<=n.length;e++)t[e]=[e];let i;for(i=0;i<=s.length;i++)t[0][i]=i;for(e=1;e<=n.length;e++)for(i=1;i<=s.length;i++)n.charAt(e-1)===s.charAt(i-1)?t[e][i]=t[e-1][i-1]:t[e][i]=Math.min(t[e-1][i-1]+1,Math.min(t[e][i-1]+1,t[e-1][i]+1));return t[n.length][s.length]}function Me(s){return(n,t)=>{const e=s(n).trim(),i=s(t).trim();return Wt(e,i)/(e.length+i.length)}}function Oe(s){function n(e,i,o=new Map){let r=1/0,f;for(let c=0;c<e.length;++c)for(let u=0;u<i.length;++u){const g=JSON.stringify([e[c],i[u]]);let x;o.has(g)&&(x=o.get(g))||(x=s(e[c],i[u]),o.set(g,x)),x<r&&(r=x,f={indexA:c,indexB:u,score:r})}return f}function t(e,i,o=0,r=new Map){const f=n(e,i,r);if(!f||e.length+i.length<3)return[[e,i]];const c=e.slice(0,f.indexA),u=i.slice(0,f.indexB),g=[e[f.indexA]],x=[i[f.indexB]],S=f.indexA+1,a=f.indexB+1,d=e.slice(S),m=i.slice(a),p=t(c,u,o+1,r),y=t(g,x,o+1,r),N=t(d,m,o+1,r);let T=y;return(f.indexA>0||f.indexB>0)&&(T=p.concat(T)),(e.length>S||i.length>a)&&(T=T.concat(N)),T}return t}const G={INSERTS:"d2h-ins",DELETES:"d2h-del",CONTEXT:"d2h-cntx",INFO:"d2h-info",INSERT_CHANGES:"d2h-ins d2h-change",DELETE_CHANGES:"d2h-del d2h-change"},Te={matching:Ct.NONE,matchWordsThreshold:.25,maxLineLengthHighlight:1e4,diffStyle:Et.WORD,colorScheme:he.LIGHT},te="/",Ze=Me(s=>s.value),jt=Oe(Ze);function De(s){return s.indexOf("dev/null")!==-1}function kt(s){return s.replace(/(<ins[^>]*>((.|\n)*?)<\/ins>)/g,"")}function zt(s){return s.replace(/(<del[^>]*>((.|\n)*?)<\/del>)/g,"")}function xe(s){switch(s){case A.CONTEXT:return G.CONTEXT;case A.INSERT:return G.INSERTS;case A.DELETE:return G.DELETES}}function Fe(s){switch(s){case he.DARK:return"d2h-dark-color-scheme";case he.AUTO:return"d2h-auto-color-scheme";case he.LIGHT:default:return"d2h-light-color-scheme"}}function Ut(s){return s?2:1}function pe(s){return s.slice(0).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/")}function ne(s,n,t=!0){const e=Ut(n);return{prefix:s.substring(0,e),content:t?pe(s.substring(e)):s.substring(e)}}function Ne(s){const n=je(s.oldName),t=je(s.newName);if(n!==t&&!De(n)&&!De(t)){const e=[],i=[],o=n.split(te),r=t.split(te),f=o.length,c=r.length;let u=0,g=f-1,x=c-1;for(;u<g&&u<x&&o[u]===r[u];)e.push(r[u]),u+=1;for(;g>u&&x>u&&o[g]===r[x];)i.unshift(r[x]),g-=1,x-=1;const S=e.join(te),a=i.join(te),d=o.slice(u,g+1).join(te),m=r.slice(u,x+1).join(te);return S.length&&a.length?S+te+"{"+d+" → "+m+"}"+te+a:S.length?S+te+"{"+d+" → "+m+"}":a.length?"{"+d+" → "+m+"}"+te+a:n+" → "+t}else return De(t)?n:t}function He(s){return`d2h-${_t(Ne(s)).toString().slice(-6)}`}function Ae(s){let n="file-changed";return s.isRename||s.isCopy?n="file-renamed":s.isNew?n="file-added":s.isDeleted?n="file-deleted":s.newName!==s.oldName&&(n="file-renamed"),n}function et(s,n,t,e={}){const{matching:i,maxLineLengthHighlight:o,matchWordsThreshold:r,diffStyle:f}=Object.assign(Object.assign({},Te),e),c=ne(s,t,!1),u=ne(n,t,!1);if(c.content.length>o||u.content.length>o)return{oldLine:{prefix:c.prefix,content:pe(c.content)},newLine:{prefix:u.prefix,content:pe(u.content)}};const g=f==="char"?Ht(c.content,u.content):Rt(c.content,u.content),x=[];if(f==="word"&&i==="words"){const a=g.filter(p=>p.removed),d=g.filter(p=>p.added);jt(d,a).forEach(p=>{p[0].length===1&&p[1].length===1&&Ze(p[0][0],p[1][0])<r&&(x.push(p[0][0]),x.push(p[1][0]))})}const S=g.reduce((a,d)=>{const m=d.added?"ins":d.removed?"del":null,p=x.indexOf(d)>-1?' class="d2h-change"':"",y=pe(d.value);return m!==null?`${a}<${m}${p}>${y}</${m}>`:`${a}${y}`},"");return{oldLine:{prefix:c.prefix,content:kt(S)},newLine:{prefix:u.prefix,content:zt(S)}}}const Ve="file-summary",Gt="icon",Vt={colorScheme:Te.colorScheme};class $t{constructor(n,t={}){this.hoganUtils=n,this.config=Object.assign(Object.assign({},Vt),t)}render(n){const t=n.map(e=>this.hoganUtils.render(Ve,"line",{fileHtmlId:He(e),oldName:e.oldName,newName:e.newName,fileName:Ne(e),deletedLines:"-"+e.deletedLines,addedLines:"+"+e.addedLines},{fileIcon:this.hoganUtils.template(Gt,Ae(e))})).join(`
|
|
4
4
|
`);return this.hoganUtils.render(Ve,"wrapper",{colorScheme:Fe(this.config.colorScheme),filesNumber:n.length,files:t})}}const tt=Object.assign(Object.assign({},Te),{renderNothingWhenEmpty:!1,matchingMaxComparisons:2500,maxLineSizeInBlockForComparison:200}),me="generic",$e="line-by-line",Xt="icon",qt="tag";class Kt{constructor(n,t={}){this.hoganUtils=n,this.config=Object.assign(Object.assign({},tt),t)}render(n){const t=n.map(e=>{let i;return e.blocks.length?i=this.generateFileHtml(e):i=this.generateEmptyDiff(),this.makeFileDiffHtml(e,i)}).join(`
|