diff2html
Advanced tools
Comparing version 3.1.9 to 3.1.10
@@ -1,2 +0,2 @@ | ||
!function(e,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define("Diff2Html",[],n):"object"==typeof exports?exports.Diff2Html=n():e.Diff2Html=n()}(this,(function(){return function(e){var n={};function t(i){if(n[i])return n[i].exports;var r=n[i]={i:i,l:!1,exports:{}};return e[i].call(r.exports,r,r.exports,t),r.l=!0,r.exports}return t.m=e,t.c=n,t.d=function(e,n,i){t.o(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:i})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,n){if(1&n&&(e=t(e)),8&n)return e;if(4&n&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(t.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&n&&"string"!=typeof e)for(var r in e)t.d(i,r,function(n){return e[n]}.bind(null,r));return i},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},t.p="",t(t.s=5)}([function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),function(e){e.INSERT="insert",e.DELETE="delete",e.CONTEXT="context"}(n.LineType||(n.LineType={})),n.OutputFormatType={LINE_BY_LINE:"line-by-line",SIDE_BY_SIDE:"side-by-side"},n.LineMatchingType={LINES:"lines",WORDS:"words",NONE:"none"},n.DiffStyleType={WORD:"word",CHAR:"char"}},function(e,n,t){"use strict";var i=this&&this.__assign||function(){return(i=Object.assign||function(e){for(var n,t=1,i=arguments.length;t<i;t++)for(var r in n=arguments[t])Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r]);return e}).apply(this,arguments)},r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var n={};if(null!=e)for(var t in e)Object.hasOwnProperty.call(e,t)&&(n[t]=e[t]);return n.default=e,n};Object.defineProperty(n,"__esModule",{value:!0});var a=r(t(8)),s=t(3),o=r(t(2)),l=t(0);n.CSSLineClass={INSERTS:"d2h-ins",DELETES:"d2h-del",CONTEXT:"d2h-cntx",INFO:"d2h-info",INSERT_CHANGES:"d2h-ins d2h-change",DELETE_CHANGES:"d2h-del d2h-change"},n.defaultRenderConfig={matching:l.LineMatchingType.NONE,matchWordsThreshold:.25,maxLineLengthHighlight:1e4,diffStyle:l.DiffStyleType.WORD};var f=o.newDistanceFn((function(e){return e.value})),u=o.newMatcherFn(f);function d(e){return-1!==e.indexOf("dev/null")}function c(e){return e.replace(/(<del[^>]*>((.|\n)*?)<\/del>)/g,"")}function h(e){return e.slice(0).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/")}function p(e,n,t){void 0===t&&(t=!0);var i=function(e){return e?2:1}(n);return{prefix:e.substring(0,i),content:t?h(e.substring(i)):e.substring(i)}}function b(e){var n=s.unifyPath(e.oldName),t=s.unifyPath(e.newName);if(n===t||d(n)||d(t))return d(t)?n:t;for(var i=[],r=[],a=n.split("/"),o=t.split("/"),l=0,f=a.length-1,u=o.length-1;l<f&&l<u&&a[l]===o[l];)i.push(o[l]),l+=1;for(;f>l&&u>l&&a[f]===o[u];)r.unshift(o[u]),f-=1,u-=1;var c=i.join("/"),h=r.join("/"),p=a.slice(l,f+1).join("/"),b=o.slice(l,u+1).join("/");return c.length&&h.length?c+"/{"+p+" → "+b+"}/"+h:c.length?c+"/{"+p+" → "+b+"}":h.length?"{"+p+" → "+b+"}/"+h:n+" → "+t}n.toCSSClass=function(e){switch(e){case l.LineType.CONTEXT:return n.CSSLineClass.CONTEXT;case l.LineType.INSERT:return n.CSSLineClass.INSERTS;case l.LineType.DELETE:return n.CSSLineClass.DELETES}},n.escapeForHtml=h,n.deconstructLine=p,n.filenameDiff=b,n.getHtmlId=function(e){return"d2h-"+s.hashCode(b(e)).toString().slice(-6)},n.getFileIcon=function(e){var n="file-changed";return e.isRename||e.isCopy?n="file-renamed":e.isNew?n="file-added":e.isDeleted?n="file-deleted":e.newName!==e.oldName&&(n="file-renamed"),n},n.diffHighlight=function(e,t,r,s){void 0===s&&(s={});var o=i(i({},n.defaultRenderConfig),s),l=o.matching,d=o.maxLineLengthHighlight,b=o.matchWordsThreshold,g=o.diffStyle,v=p(e,r,!1),m=p(t,r,!1);if(v.content.length>d||m.content.length>d)return{oldLine:{prefix:v.prefix,content:v.content},newLine:{prefix:m.prefix,content:m.content}};var y="char"===g?a.diffChars(v.content,m.content):a.diffWordsWithSpace(v.content,m.content),w=[];if("word"===g&&"words"===l){var x=y.filter((function(e){return e.removed})),L=y.filter((function(e){return e.added}));u(L,x).forEach((function(e){1===e[0].length&&1===e[1].length&&(f(e[0][0],e[1][0])<b&&(w.push(e[0][0]),w.push(e[1][0])))}))}var S,C=y.reduce((function(e,n){var t=n.added?"ins":n.removed?"del":null,i=w.indexOf(n)>-1?' class="d2h-change"':"",r=h(n.value);return null!==t?e+"<"+t+i+">"+r+"</"+t+">":""+e+r}),"");return{oldLine:{prefix:v.prefix,content:(S=C,S.replace(/(<ins[^>]*>((.|\n)*?)<\/ins>)/g,""))},newLine:{prefix:m.prefix,content:c(C)}}}},function(e,n,t){"use strict";function i(e,n){if(0===e.length)return n.length;if(0===n.length)return e.length;var t,i,r=[];for(t=0;t<=n.length;t++)r[t]=[t];for(i=0;i<=e.length;i++)r[0][i]=i;for(t=1;t<=n.length;t++)for(i=1;i<=e.length;i++)n.charAt(t-1)===e.charAt(i-1)?r[t][i]=r[t-1][i-1]:r[t][i]=Math.min(r[t-1][i-1]+1,Math.min(r[t][i-1]+1,r[t-1][i]+1));return r[n.length][e.length]}Object.defineProperty(n,"__esModule",{value:!0}),n.levenshtein=i,n.newDistanceFn=function(e){return function(n,t){var r=e(n).trim(),a=e(t).trim();return i(r,a)/(r.length+a.length)}},n.newMatcherFn=function(e){return function n(t,i,r,a){void 0===r&&(r=0),void 0===a&&(a=new Map);var s=function(n,t,i){void 0===i&&(i=new Map);for(var r,a=1/0,s=0;s<n.length;++s)for(var o=0;o<t.length;++o){var l=JSON.stringify([n[s],t[o]]),f=void 0;i.has(l)&&(f=i.get(l))||(f=e(n[s],t[o]),i.set(l,f)),f<a&&(r={indexA:s,indexB:o,score:a=f})}return r}(t,i,a);if(!s||t.length+i.length<3)return[[t,i]];var o=t.slice(0,s.indexA),l=i.slice(0,s.indexB),f=[t[s.indexA]],u=[i[s.indexB]],d=s.indexA+1,c=s.indexB+1,h=t.slice(d),p=i.slice(c),b=n(o,l,r+1,a),g=n(f,u,r+1,a),v=n(h,p,r+1,a),m=g;return(s.indexA>0||s.indexB>0)&&(m=b.concat(m)),(t.length>d||i.length>c)&&(m=m.concat(v)),m}}},function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i=RegExp("["+["-","[","]","/","{","}","(",")","*","+","?",".","\\","^","$","|"].join("\\")+"]","g");n.escapeForRegExp=function(e){return e.replace(i,"\\$&")},n.unifyPath=function(e){return e?e.replace(/\\/g,"/"):e},n.hashCode=function(e){var n,t,i=0;for(n=0,t=e.length;n<t;n++)i=(i<<5)-i+e.charCodeAt(n),i|=0;return i}},function(e,n,t){var i=t(12);i.Template=t(13).Template,i.template=i.Template,e.exports=i},function(e,n,t){"use strict";var i=this&&this.__assign||function(){return(i=Object.assign||function(e){for(var n,t=1,i=arguments.length;t<i;t++)for(var r in n=arguments[t])Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r]);return e}).apply(this,arguments)},r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var n={};if(null!=e)for(var t in e)Object.hasOwnProperty.call(e,t)&&(n[t]=e[t]);return n.default=e,n},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(n,"__esModule",{value:!0});var s=r(t(6)),o=r(t(7)),l=r(t(9)),f=r(t(10)),u=t(0),d=a(t(11));n.defaultDiff2HtmlConfig=i(i(i({},l.defaultLineByLineRendererConfig),f.defaultSideBySideRendererConfig),{outputFormat:u.OutputFormatType.LINE_BY_LINE,drawFileList:!0}),n.parse=function(e,t){return void 0===t&&(t={}),s.parse(e,i(i({},n.defaultDiff2HtmlConfig),t))},n.html=function(e,t){void 0===t&&(t={});var r=i(i({},n.defaultDiff2HtmlConfig),t),a="string"==typeof e?s.parse(e,r):e,u=new d.default(r);return(r.drawFileList?o.render(a,u):"")+("side-by-side"===r.outputFormat?new f.default(u,r).render(a):new l.default(u,r).render(a))}},function(e,n,t){"use strict";var i=this&&this.__spreadArrays||function(){for(var e=0,n=0,t=arguments.length;n<t;n++)e+=arguments[n].length;var i=Array(e),r=0;for(n=0;n<t;n++)for(var a=arguments[n],s=0,o=a.length;s<o;s++,r++)i[r]=a[s];return i};Object.defineProperty(n,"__esModule",{value:!0});var r=t(0),a=t(3);function s(e,n){var t=e.split(".");return t.length>1?t[t.length-1]:n}function o(e,n){return n.reduce((function(n,t){return n||e.startsWith(t)}),!1)}var l=["a/","b/","i/","w/","c/","o/"];function f(e,n,t){var r=void 0!==t?i(l,[t]):l,s=((n?new RegExp("^"+a.escapeForRegExp(n)+' "?(.+?)"?$'):new RegExp('^"?(.+?)"?$')).exec(e)||[])[1],o=void 0===s?"":s,f=r.find((function(e){return 0===o.indexOf(e)}));return(f?o.slice(f.length):o).replace(/\s+\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}(?:\.\d+)? [+-]\d{4}.*$/,"")}n.parse=function(e,n){void 0===n&&(n={});var t=[],i=null,a=null,l=null,u=null,d=null,c=null,h=null,p=/^old mode (\d{6})/,b=/^new mode (\d{6})/,g=/^deleted file mode (\d{6})/,v=/^new file mode (\d{6})/,m=/^copy from "?(.+)"?/,y=/^copy to "?(.+)"?/,w=/^rename from "?(.+)"?/,x=/^rename to "?(.+)"?/,L=/^similarity index (\d+)%/,S=/^dissimilarity index (\d+)%/,C=/^index ([\da-z]+)\.\.([\da-z]+)\s*(\d{6})?/,T=/^Binary files (.*) and (.*) differ/,N=/^GIT binary patch/,E=/^index ([\da-z]+),([\da-z]+)\.\.([\da-z]+)/,H=/^mode (\d{6}),(\d{6})\.\.(\d{6})/,k=/^new file mode (\d{6})/,O=/^deleted file mode (\d{6}),(\d{6})/,_=e.replace(/\\ No newline at end of file/g,"").replace(/\r\n?/g,"\n").split("\n");function F(){null!==a&&null!==i&&(i.blocks.push(a),a=null)}function I(){null!==i&&(i.oldName||null===c||(i.oldName=c),i.newName||null===h||(i.newName=h),i.newName&&(t.push(i),i=null)),c=null,h=null}function M(){F(),I(),i={blocks:[],deletedLines:0,addedLines:0}}function P(e){var n;F(),null!==i&&((n=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@.*/.exec(e))?(i.isCombined=!1,l=parseInt(n[1],10),d=parseInt(n[2],10)):(n=/^@@@ -(\d+)(?:,\d+)? -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@@.*/.exec(e))?(i.isCombined=!0,l=parseInt(n[1],10),u=parseInt(n[2],10),d=parseInt(n[3],10)):(e.startsWith("@@")&&console.error("Failed to parse lines, starting in 0!"),l=0,d=0,i.isCombined=!1)),a={lines:[],oldStartLine:l,oldStartLine2:u,newStartLine:d,header:e}}return _.forEach((function(e,t){if(e&&!e.startsWith("*")){var u,F=_[t-1],I=_[t+1],j=_[t+2];if(e.startsWith("diff")){M();if((u=/^diff --git "?(.+)"? "?(.+)"?/.exec(e))&&(c=f(u[1],void 0,n.dstPrefix),h=f(u[2],void 0,n.srcPrefix)),null===i)throw new Error("Where is my file !!!");i.isGitDiff=!0}else{if((!i||!i.isGitDiff&&i&&e.startsWith("--- ")&&I.startsWith("+++ ")&&j.startsWith("@@"))&&M(),e.startsWith("--- ")&&I.startsWith("+++ ")||e.startsWith("+++ ")&&F.startsWith("--- ")){if(i&&!i.oldName&&e.startsWith("--- ")&&(u=function(e,n){return f(e,"---",n)}(e,n.srcPrefix)))return i.oldName=u,void(i.language=s(i.oldName,i.language));if(i&&!i.newName&&e.startsWith("+++ ")&&(u=function(e,n){return f(e,"+++",n)}(e,n.dstPrefix)))return i.newName=u,void(i.language=s(i.newName,i.language))}if(i&&(e.startsWith("@@")||i.isGitDiff&&i.oldName&&i.newName&&!a))P(e);else if(a&&(e.startsWith("+")||e.startsWith("-")||e.startsWith(" ")))!function(e){if(null!==i&&null!==a&&null!==l&&null!==d){var n={content:e},t=i.isCombined?["+ "," +","++"]:["+"],s=i.isCombined?["- "," -","--"]:["-"];o(e,t)?(i.addedLines++,n.type=r.LineType.INSERT,n.oldNumber=void 0,n.newNumber=d++):o(e,s)?(i.deletedLines++,n.type=r.LineType.DELETE,n.oldNumber=l++,n.newNumber=void 0):(n.type=r.LineType.CONTEXT,n.oldNumber=l++,n.newNumber=d++),a.lines.push(n)}}(e);else{var D=!function(e,n){for(var t=n;t<_.length-3;){if(e.startsWith("diff"))return!1;if(_[t].startsWith("--- ")&&_[t+1].startsWith("+++ ")&&_[t+2].startsWith("@@"))return!0;t++}return!1}(e,t);if(null===i)throw new Error("Where is my file !!!");(u=p.exec(e))?i.oldMode=u[1]:(u=b.exec(e))?i.newMode=u[1]:(u=g.exec(e))?(i.deletedFileMode=u[1],i.isDeleted=!0):(u=v.exec(e))?(i.newFileMode=u[1],i.isNew=!0):(u=m.exec(e))?(D&&(i.oldName=u[1]),i.isCopy=!0):(u=y.exec(e))?(D&&(i.newName=u[1]),i.isCopy=!0):(u=w.exec(e))?(D&&(i.oldName=u[1]),i.isRename=!0):(u=x.exec(e))?(D&&(i.newName=u[1]),i.isRename=!0):(u=T.exec(e))?(i.isBinary=!0,i.oldName=f(u[1],void 0,n.srcPrefix),i.newName=f(u[2],void 0,n.dstPrefix),P("Binary file")):N.test(e)?(i.isBinary=!0,P(e)):(u=L.exec(e))?i.unchangedPercentage=parseInt(u[1],10):(u=S.exec(e))?i.changedPercentage=parseInt(u[1],10):(u=C.exec(e))?(i.checksumBefore=u[1],i.checksumAfter=u[2],u[3]&&(i.mode=u[3])):(u=E.exec(e))?(i.checksumBefore=[u[2],u[3]],i.checksumAfter=u[1]):(u=H.exec(e))?(i.oldMode=[u[2],u[3]],i.newMode=u[1]):(u=k.exec(e))?(i.newFileMode=u[1],i.isNew=!0):(u=O.exec(e))&&(i.deletedFileMode=u[1],i.isDeleted=!0)}}}})),F(),I(),t}},function(e,n,t){"use strict";var i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var n={};if(null!=e)for(var t in e)Object.hasOwnProperty.call(e,t)&&(n[t]=e[t]);return n.default=e,n};Object.defineProperty(n,"__esModule",{value:!0});var r=i(t(1));n.render=function(e,n){var t=e.map((function(e){return n.render("file-summary","line",{fileHtmlId:r.getHtmlId(e),oldName:e.oldName,newName:e.newName,fileName:r.filenameDiff(e),deletedLines:"-"+e.deletedLines,addedLines:"+"+e.addedLines},{fileIcon:n.template("icon",r.getFileIcon(e))})})).join("\n");return n.render("file-summary","wrapper",{filesNumber:e.length,files:t})}},function(e,n,t){ | ||
!function(e,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define("Diff2Html",[],n):"object"==typeof exports?exports.Diff2Html=n():e.Diff2Html=n()}(this,(function(){return function(e){var n={};function t(i){if(n[i])return n[i].exports;var r=n[i]={i:i,l:!1,exports:{}};return e[i].call(r.exports,r,r.exports,t),r.l=!0,r.exports}return t.m=e,t.c=n,t.d=function(e,n,i){t.o(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:i})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,n){if(1&n&&(e=t(e)),8&n)return e;if(4&n&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(t.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&n&&"string"!=typeof e)for(var r in e)t.d(i,r,function(n){return e[n]}.bind(null,r));return i},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},t.p="",t(t.s=5)}([function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),function(e){e.INSERT="insert",e.DELETE="delete",e.CONTEXT="context"}(n.LineType||(n.LineType={})),n.OutputFormatType={LINE_BY_LINE:"line-by-line",SIDE_BY_SIDE:"side-by-side"},n.LineMatchingType={LINES:"lines",WORDS:"words",NONE:"none"},n.DiffStyleType={WORD:"word",CHAR:"char"}},function(e,n,t){"use strict";var i=this&&this.__assign||function(){return(i=Object.assign||function(e){for(var n,t=1,i=arguments.length;t<i;t++)for(var r in n=arguments[t])Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r]);return e}).apply(this,arguments)},r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var n={};if(null!=e)for(var t in e)Object.hasOwnProperty.call(e,t)&&(n[t]=e[t]);return n.default=e,n};Object.defineProperty(n,"__esModule",{value:!0});var a=r(t(8)),s=t(3),o=r(t(2)),l=t(0);n.CSSLineClass={INSERTS:"d2h-ins",DELETES:"d2h-del",CONTEXT:"d2h-cntx",INFO:"d2h-info",INSERT_CHANGES:"d2h-ins d2h-change",DELETE_CHANGES:"d2h-del d2h-change"},n.defaultRenderConfig={matching:l.LineMatchingType.NONE,matchWordsThreshold:.25,maxLineLengthHighlight:1e4,diffStyle:l.DiffStyleType.WORD};var f=o.newDistanceFn((function(e){return e.value})),u=o.newMatcherFn(f);function d(e){return-1!==e.indexOf("dev/null")}function c(e){return e.replace(/(<del[^>]*>((.|\n)*?)<\/del>)/g,"")}function h(e){return e.slice(0).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/")}function p(e,n,t){void 0===t&&(t=!0);var i=function(e){return e?2:1}(n);return{prefix:e.substring(0,i),content:t?h(e.substring(i)):e.substring(i)}}function b(e){var n=s.unifyPath(e.oldName),t=s.unifyPath(e.newName);if(n===t||d(n)||d(t))return d(t)?n:t;for(var i=[],r=[],a=n.split("/"),o=t.split("/"),l=0,f=a.length-1,u=o.length-1;l<f&&l<u&&a[l]===o[l];)i.push(o[l]),l+=1;for(;f>l&&u>l&&a[f]===o[u];)r.unshift(o[u]),f-=1,u-=1;var c=i.join("/"),h=r.join("/"),p=a.slice(l,f+1).join("/"),b=o.slice(l,u+1).join("/");return c.length&&h.length?c+"/{"+p+" → "+b+"}/"+h:c.length?c+"/{"+p+" → "+b+"}":h.length?"{"+p+" → "+b+"}/"+h:n+" → "+t}n.toCSSClass=function(e){switch(e){case l.LineType.CONTEXT:return n.CSSLineClass.CONTEXT;case l.LineType.INSERT:return n.CSSLineClass.INSERTS;case l.LineType.DELETE:return n.CSSLineClass.DELETES}},n.escapeForHtml=h,n.deconstructLine=p,n.filenameDiff=b,n.getHtmlId=function(e){return"d2h-"+s.hashCode(b(e)).toString().slice(-6)},n.getFileIcon=function(e){var n="file-changed";return e.isRename||e.isCopy?n="file-renamed":e.isNew?n="file-added":e.isDeleted?n="file-deleted":e.newName!==e.oldName&&(n="file-renamed"),n},n.diffHighlight=function(e,t,r,s){void 0===s&&(s={});var o=i(i({},n.defaultRenderConfig),s),l=o.matching,d=o.maxLineLengthHighlight,b=o.matchWordsThreshold,g=o.diffStyle,v=p(e,r,!1),m=p(t,r,!1);if(v.content.length>d||m.content.length>d)return{oldLine:{prefix:v.prefix,content:h(v.content)},newLine:{prefix:m.prefix,content:h(m.content)}};var y="char"===g?a.diffChars(v.content,m.content):a.diffWordsWithSpace(v.content,m.content),w=[];if("word"===g&&"words"===l){var x=y.filter((function(e){return e.removed})),L=y.filter((function(e){return e.added}));u(L,x).forEach((function(e){1===e[0].length&&1===e[1].length&&(f(e[0][0],e[1][0])<b&&(w.push(e[0][0]),w.push(e[1][0])))}))}var S,C=y.reduce((function(e,n){var t=n.added?"ins":n.removed?"del":null,i=w.indexOf(n)>-1?' class="d2h-change"':"",r=h(n.value);return null!==t?e+"<"+t+i+">"+r+"</"+t+">":""+e+r}),"");return{oldLine:{prefix:v.prefix,content:(S=C,S.replace(/(<ins[^>]*>((.|\n)*?)<\/ins>)/g,""))},newLine:{prefix:m.prefix,content:c(C)}}}},function(e,n,t){"use strict";function i(e,n){if(0===e.length)return n.length;if(0===n.length)return e.length;var t,i,r=[];for(t=0;t<=n.length;t++)r[t]=[t];for(i=0;i<=e.length;i++)r[0][i]=i;for(t=1;t<=n.length;t++)for(i=1;i<=e.length;i++)n.charAt(t-1)===e.charAt(i-1)?r[t][i]=r[t-1][i-1]:r[t][i]=Math.min(r[t-1][i-1]+1,Math.min(r[t][i-1]+1,r[t-1][i]+1));return r[n.length][e.length]}Object.defineProperty(n,"__esModule",{value:!0}),n.levenshtein=i,n.newDistanceFn=function(e){return function(n,t){var r=e(n).trim(),a=e(t).trim();return i(r,a)/(r.length+a.length)}},n.newMatcherFn=function(e){return function n(t,i,r,a){void 0===r&&(r=0),void 0===a&&(a=new Map);var s=function(n,t,i){void 0===i&&(i=new Map);for(var r,a=1/0,s=0;s<n.length;++s)for(var o=0;o<t.length;++o){var l=JSON.stringify([n[s],t[o]]),f=void 0;i.has(l)&&(f=i.get(l))||(f=e(n[s],t[o]),i.set(l,f)),f<a&&(r={indexA:s,indexB:o,score:a=f})}return r}(t,i,a);if(!s||t.length+i.length<3)return[[t,i]];var o=t.slice(0,s.indexA),l=i.slice(0,s.indexB),f=[t[s.indexA]],u=[i[s.indexB]],d=s.indexA+1,c=s.indexB+1,h=t.slice(d),p=i.slice(c),b=n(o,l,r+1,a),g=n(f,u,r+1,a),v=n(h,p,r+1,a),m=g;return(s.indexA>0||s.indexB>0)&&(m=b.concat(m)),(t.length>d||i.length>c)&&(m=m.concat(v)),m}}},function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i=RegExp("["+["-","[","]","/","{","}","(",")","*","+","?",".","\\","^","$","|"].join("\\")+"]","g");n.escapeForRegExp=function(e){return e.replace(i,"\\$&")},n.unifyPath=function(e){return e?e.replace(/\\/g,"/"):e},n.hashCode=function(e){var n,t,i=0;for(n=0,t=e.length;n<t;n++)i=(i<<5)-i+e.charCodeAt(n),i|=0;return i}},function(e,n,t){var i=t(12);i.Template=t(13).Template,i.template=i.Template,e.exports=i},function(e,n,t){"use strict";var i=this&&this.__assign||function(){return(i=Object.assign||function(e){for(var n,t=1,i=arguments.length;t<i;t++)for(var r in n=arguments[t])Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r]);return e}).apply(this,arguments)},r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var n={};if(null!=e)for(var t in e)Object.hasOwnProperty.call(e,t)&&(n[t]=e[t]);return n.default=e,n},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(n,"__esModule",{value:!0});var s=r(t(6)),o=r(t(7)),l=r(t(9)),f=r(t(10)),u=t(0),d=a(t(11));n.defaultDiff2HtmlConfig=i(i(i({},l.defaultLineByLineRendererConfig),f.defaultSideBySideRendererConfig),{outputFormat:u.OutputFormatType.LINE_BY_LINE,drawFileList:!0}),n.parse=function(e,t){return void 0===t&&(t={}),s.parse(e,i(i({},n.defaultDiff2HtmlConfig),t))},n.html=function(e,t){void 0===t&&(t={});var r=i(i({},n.defaultDiff2HtmlConfig),t),a="string"==typeof e?s.parse(e,r):e,u=new d.default(r);return(r.drawFileList?o.render(a,u):"")+("side-by-side"===r.outputFormat?new f.default(u,r).render(a):new l.default(u,r).render(a))}},function(e,n,t){"use strict";var i=this&&this.__spreadArrays||function(){for(var e=0,n=0,t=arguments.length;n<t;n++)e+=arguments[n].length;var i=Array(e),r=0;for(n=0;n<t;n++)for(var a=arguments[n],s=0,o=a.length;s<o;s++,r++)i[r]=a[s];return i};Object.defineProperty(n,"__esModule",{value:!0});var r=t(0),a=t(3);function s(e,n){var t=e.split(".");return t.length>1?t[t.length-1]:n}function o(e,n){return n.reduce((function(n,t){return n||e.startsWith(t)}),!1)}var l=["a/","b/","i/","w/","c/","o/"];function f(e,n,t){var r=void 0!==t?i(l,[t]):l,s=((n?new RegExp("^"+a.escapeForRegExp(n)+' "?(.+?)"?$'):new RegExp('^"?(.+?)"?$')).exec(e)||[])[1],o=void 0===s?"":s,f=r.find((function(e){return 0===o.indexOf(e)}));return(f?o.slice(f.length):o).replace(/\s+\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}(?:\.\d+)? [+-]\d{4}.*$/,"")}n.parse=function(e,n){void 0===n&&(n={});var t=[],i=null,a=null,l=null,u=null,d=null,c=null,h=null,p=/^old mode (\d{6})/,b=/^new mode (\d{6})/,g=/^deleted file mode (\d{6})/,v=/^new file mode (\d{6})/,m=/^copy from "?(.+)"?/,y=/^copy to "?(.+)"?/,w=/^rename from "?(.+)"?/,x=/^rename to "?(.+)"?/,L=/^similarity index (\d+)%/,S=/^dissimilarity index (\d+)%/,C=/^index ([\da-z]+)\.\.([\da-z]+)\s*(\d{6})?/,T=/^Binary files (.*) and (.*) differ/,N=/^GIT binary patch/,E=/^index ([\da-z]+),([\da-z]+)\.\.([\da-z]+)/,H=/^mode (\d{6}),(\d{6})\.\.(\d{6})/,k=/^new file mode (\d{6})/,O=/^deleted file mode (\d{6}),(\d{6})/,_=e.replace(/\\ No newline at end of file/g,"").replace(/\r\n?/g,"\n").split("\n");function F(){null!==a&&null!==i&&(i.blocks.push(a),a=null)}function I(){null!==i&&(i.oldName||null===c||(i.oldName=c),i.newName||null===h||(i.newName=h),i.newName&&(t.push(i),i=null)),c=null,h=null}function M(){F(),I(),i={blocks:[],deletedLines:0,addedLines:0}}function P(e){var n;F(),null!==i&&((n=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@.*/.exec(e))?(i.isCombined=!1,l=parseInt(n[1],10),d=parseInt(n[2],10)):(n=/^@@@ -(\d+)(?:,\d+)? -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@@.*/.exec(e))?(i.isCombined=!0,l=parseInt(n[1],10),u=parseInt(n[2],10),d=parseInt(n[3],10)):(e.startsWith("@@")&&console.error("Failed to parse lines, starting in 0!"),l=0,d=0,i.isCombined=!1)),a={lines:[],oldStartLine:l,oldStartLine2:u,newStartLine:d,header:e}}return _.forEach((function(e,t){if(e&&!e.startsWith("*")){var u,F=_[t-1],I=_[t+1],j=_[t+2];if(e.startsWith("diff")){M();if((u=/^diff --git "?(.+)"? "?(.+)"?/.exec(e))&&(c=f(u[1],void 0,n.dstPrefix),h=f(u[2],void 0,n.srcPrefix)),null===i)throw new Error("Where is my file !!!");i.isGitDiff=!0}else{if((!i||!i.isGitDiff&&i&&e.startsWith("--- ")&&I.startsWith("+++ ")&&j.startsWith("@@"))&&M(),e.startsWith("--- ")&&I.startsWith("+++ ")||e.startsWith("+++ ")&&F.startsWith("--- ")){if(i&&!i.oldName&&e.startsWith("--- ")&&(u=function(e,n){return f(e,"---",n)}(e,n.srcPrefix)))return i.oldName=u,void(i.language=s(i.oldName,i.language));if(i&&!i.newName&&e.startsWith("+++ ")&&(u=function(e,n){return f(e,"+++",n)}(e,n.dstPrefix)))return i.newName=u,void(i.language=s(i.newName,i.language))}if(i&&(e.startsWith("@@")||i.isGitDiff&&i.oldName&&i.newName&&!a))P(e);else if(a&&(e.startsWith("+")||e.startsWith("-")||e.startsWith(" ")))!function(e){if(null!==i&&null!==a&&null!==l&&null!==d){var n={content:e},t=i.isCombined?["+ "," +","++"]:["+"],s=i.isCombined?["- "," -","--"]:["-"];o(e,t)?(i.addedLines++,n.type=r.LineType.INSERT,n.oldNumber=void 0,n.newNumber=d++):o(e,s)?(i.deletedLines++,n.type=r.LineType.DELETE,n.oldNumber=l++,n.newNumber=void 0):(n.type=r.LineType.CONTEXT,n.oldNumber=l++,n.newNumber=d++),a.lines.push(n)}}(e);else{var D=!function(e,n){for(var t=n;t<_.length-3;){if(e.startsWith("diff"))return!1;if(_[t].startsWith("--- ")&&_[t+1].startsWith("+++ ")&&_[t+2].startsWith("@@"))return!0;t++}return!1}(e,t);if(null===i)throw new Error("Where is my file !!!");(u=p.exec(e))?i.oldMode=u[1]:(u=b.exec(e))?i.newMode=u[1]:(u=g.exec(e))?(i.deletedFileMode=u[1],i.isDeleted=!0):(u=v.exec(e))?(i.newFileMode=u[1],i.isNew=!0):(u=m.exec(e))?(D&&(i.oldName=u[1]),i.isCopy=!0):(u=y.exec(e))?(D&&(i.newName=u[1]),i.isCopy=!0):(u=w.exec(e))?(D&&(i.oldName=u[1]),i.isRename=!0):(u=x.exec(e))?(D&&(i.newName=u[1]),i.isRename=!0):(u=T.exec(e))?(i.isBinary=!0,i.oldName=f(u[1],void 0,n.srcPrefix),i.newName=f(u[2],void 0,n.dstPrefix),P("Binary file")):N.test(e)?(i.isBinary=!0,P(e)):(u=L.exec(e))?i.unchangedPercentage=parseInt(u[1],10):(u=S.exec(e))?i.changedPercentage=parseInt(u[1],10):(u=C.exec(e))?(i.checksumBefore=u[1],i.checksumAfter=u[2],u[3]&&(i.mode=u[3])):(u=E.exec(e))?(i.checksumBefore=[u[2],u[3]],i.checksumAfter=u[1]):(u=H.exec(e))?(i.oldMode=[u[2],u[3]],i.newMode=u[1]):(u=k.exec(e))?(i.newFileMode=u[1],i.isNew=!0):(u=O.exec(e))&&(i.deletedFileMode=u[1],i.isDeleted=!0)}}}})),F(),I(),t}},function(e,n,t){"use strict";var i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var n={};if(null!=e)for(var t in e)Object.hasOwnProperty.call(e,t)&&(n[t]=e[t]);return n.default=e,n};Object.defineProperty(n,"__esModule",{value:!0});var r=i(t(1));n.render=function(e,n){var t=e.map((function(e){return n.render("file-summary","line",{fileHtmlId:r.getHtmlId(e),oldName:e.oldName,newName:e.newName,fileName:r.filenameDiff(e),deletedLines:"-"+e.deletedLines,addedLines:"+"+e.addedLines},{fileIcon:n.template("icon",r.getFileIcon(e))})})).join("\n");return n.render("file-summary","wrapper",{filesNumber:e.length,files:t})}},function(e,n,t){ | ||
/*! | ||
@@ -3,0 +3,0 @@ |
@@ -158,7 +158,7 @@ var __assign = (this && this.__assign) || function () { | ||
prefix: line1.prefix, | ||
content: line1.content, | ||
content: escapeForHtml(line1.content), | ||
}, | ||
newLine: { | ||
prefix: line2.prefix, | ||
content: line2.content, | ||
content: escapeForHtml(line2.content), | ||
}, | ||
@@ -165,0 +165,0 @@ }; |
@@ -173,7 +173,7 @@ "use strict"; | ||
prefix: line1.prefix, | ||
content: line1.content, | ||
content: escapeForHtml(line1.content), | ||
}, | ||
newLine: { | ||
prefix: line2.prefix, | ||
content: line2.content, | ||
content: escapeForHtml(line2.content), | ||
}, | ||
@@ -180,0 +180,0 @@ }; |
{ | ||
"name": "diff2html", | ||
"version": "3.1.9", | ||
"version": "3.1.10", | ||
"homepage": "https://diff2html.xyz", | ||
@@ -5,0 +5,0 @@ "description": "Fast Diff to colorized HTML", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1610768