├── .gitignore ├── README.md ├── dest └── .gitkeep ├── index.html ├── index.js ├── lib ├── github.css ├── highlight.pack.js ├── jquery-1.12.0.min.js ├── render.js └── style.css ├── package-lock.json ├── package.json └── src └── render.js /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | dest/* 3 | !.gitkeep 4 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # node-giff 2 | 3 | ![ScreenShot](https://raw.github.com/wiki/do7be/node-giff/image/4cf1ee481479cb44af9d2914b51df9f2.gif) 4 | 5 | ## Installation 6 | 7 | ``` 8 | $ npm install -g node-giff 9 | ``` 10 | 11 | ## Usage 12 | 13 | ``` 14 | Usage: giff [options] [] [--] [...] 15 | 16 | Options: 17 | 18 | -h, --help output usage information 19 | -V, --version output the version number 20 | --cached show diff of staging files 21 | ``` 22 | 23 | Open your browser and show result of "git diff". 24 | 25 | ## Example 26 | 27 | ``` 28 | $ giff HEAD^ 29 | $ giff hoge.js 30 | ``` 31 | 32 | ## Thanks 33 | 34 | * https://github.com/rtfpessoa/diff2html by [rtfpessoa](https://github.com/rtfpessoa) 35 | 36 | * [https://highlightjs.org/](https://highlightjs.org/) 37 | 38 | ## MIT LICENSE 39 | 40 | Copyright © 2016 do7be licensed under [MIT](http://opensource.org/licenses/MIT) 41 | 42 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 43 | 44 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 45 | 46 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 47 | -------------------------------------------------------------------------------- /dest/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/do7be/node-giff/ec1a17bca2924a076765648996f97f50acde89b9/dest/.gitkeep -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Giff 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |

Git Diff Result by giff

16 | 17 |
18 |
19 | 20 | Unified 21 | 22 | 23 | Split 24 | 25 |
26 |
27 | 28 |
29 |

Unified

30 | 31 |
32 |
33 |
34 |
35 |

Split

36 | 37 |
38 |
39 |
40 | 41 | https://github.com/do7be/node-giff 42 | 43 | 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | // @ts-check 3 | 4 | 'use strict'; 5 | 6 | const 7 | path = require('path'), 8 | fs = require('fs'), 9 | util = require('util'), 10 | spawn = require('child_process').spawn, 11 | exec = require('child_process').exec, 12 | program = require('commander'); 13 | 14 | // set program info 15 | program 16 | .version('0.0.7') 17 | .usage('[options] [] [--] [...]') 18 | .option('--cached', 'show diff of staging files') 19 | .parse(process.argv); 20 | 21 | // judge options 22 | const options = ['--patience']; 23 | if (program.cached) { 24 | options.push('--cached'); 25 | } 26 | 27 | // init output file 28 | const realPath = fs.realpathSync(__dirname); 29 | const output = fs.createWriteStream(`${realPath}/dest/diff.js`) 30 | output.write('var lineDiffExample="'); 31 | 32 | // git diff 33 | const giff = spawn('git', ['diff'].concat(program.args).concat(options)); 34 | giff.stdout.on('data', function (data) { 35 | // encode to JSON to get escaping 36 | const encoded = JSON.stringify(data.toString()); 37 | // extract the encoded string's contents 38 | const contents = encoded.slice(1, -1); 39 | output.write(contents); 40 | }); 41 | 42 | giff.stderr.on('data', function (data) { 43 | console.log('stderr: ' + data); 44 | }); 45 | 46 | giff.on('exit', function (code) { 47 | output.end('";', function () { 48 | console.log(`${realPath}/index.html`); 49 | exec(`which open && open ${realPath}/index.html`); 50 | }); 51 | }); 52 | -------------------------------------------------------------------------------- /lib/github.css: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | github.com style (c) Vasily Polovnyov 4 | 5 | */ 6 | 7 | .hljs { 8 | display: block; 9 | overflow-x: auto; 10 | padding: 0.5em; 11 | color: #333; 12 | background: #f8f8f8; 13 | } 14 | 15 | .hljs-comment, 16 | .hljs-quote { 17 | color: #998; 18 | font-style: italic; 19 | } 20 | 21 | .hljs-keyword, 22 | .hljs-selector-tag, 23 | .hljs-subst { 24 | color: #333; 25 | font-weight: bold; 26 | } 27 | 28 | .hljs-number, 29 | .hljs-literal, 30 | .hljs-variable, 31 | .hljs-template-variable, 32 | .hljs-tag .hljs-attr { 33 | color: #008080; 34 | } 35 | 36 | .hljs-string, 37 | .hljs-doctag { 38 | color: #d14; 39 | } 40 | 41 | .hljs-title, 42 | .hljs-section, 43 | .hljs-selector-id { 44 | color: #900; 45 | font-weight: bold; 46 | } 47 | 48 | .hljs-subst { 49 | font-weight: normal; 50 | } 51 | 52 | .hljs-type, 53 | .hljs-class .hljs-title { 54 | color: #458; 55 | font-weight: bold; 56 | } 57 | 58 | .hljs-tag, 59 | .hljs-name, 60 | .hljs-attribute { 61 | color: #000080; 62 | font-weight: normal; 63 | } 64 | 65 | .hljs-regexp, 66 | .hljs-link { 67 | color: #009926; 68 | } 69 | 70 | .hljs-symbol, 71 | .hljs-bullet { 72 | color: #990073; 73 | } 74 | 75 | .hljs-built_in, 76 | .hljs-builtin-name { 77 | color: #0086b3; 78 | } 79 | 80 | .hljs-meta { 81 | color: #999; 82 | font-weight: bold; 83 | } 84 | 85 | .hljs-deletion { 86 | background: #fdd; 87 | } 88 | 89 | .hljs-addition { 90 | background: #dfd; 91 | } 92 | 93 | .hljs-emphasis { 94 | font-style: italic; 95 | } 96 | 97 | .hljs-strong { 98 | font-weight: bold; 99 | } 100 | -------------------------------------------------------------------------------- /lib/highlight.pack.js: -------------------------------------------------------------------------------- 1 | /*! highlight.js v9.1.0 | BSD3 License | git.io/hljslicense */ 2 | !function(e){"undefined"!=typeof exports?e(exports):(self.hljs=e({}),"function"==typeof define&&define.amd&&define("hljs",[],function(){return self.hljs}))}(function(e){function n(e){return e.replace(/&/gm,"&").replace(//gm,">")}function t(e){return e.nodeName.toLowerCase()}function r(e,n){var t=e&&e.exec(n);return t&&0==t.index}function a(e){return/^(no-?highlight|plain|text)$/i.test(e)}function i(e){var n,t,r,i=e.className+" ";if(i+=e.parentNode?e.parentNode.className:"",t=/\blang(?:uage)?-([\w-]+)\b/i.exec(i))return E(t[1])?t[1]:"no-highlight";for(i=i.split(/\s+/),n=0,r=i.length;r>n;n++)if(E(i[n])||a(i[n]))return i[n]}function o(e,n){var t,r={};for(t in e)r[t]=e[t];if(n)for(t in n)r[t]=n[t];return r}function u(e){var n=[];return function r(e,a){for(var i=e.firstChild;i;i=i.nextSibling)3==i.nodeType?a+=i.nodeValue.length:1==i.nodeType&&(n.push({event:"start",offset:a,node:i}),a=r(i,a),t(i).match(/br|hr|img|input/)||n.push({event:"stop",offset:a,node:i}));return a}(e,0),n}function c(e,r,a){function i(){return e.length&&r.length?e[0].offset!=r[0].offset?e[0].offset"}function u(e){l+=""}function c(e){("start"==e.event?o:u)(e.node)}for(var s=0,l="",f=[];e.length||r.length;){var g=i();if(l+=n(a.substr(s,g[0].offset-s)),s=g[0].offset,g==e){f.reverse().forEach(u);do c(g.splice(0,1)[0]),g=i();while(g==e&&g.length&&g[0].offset==s);f.reverse().forEach(o)}else"start"==g[0].event?f.push(g[0].node):f.pop(),c(g.splice(0,1)[0])}return l+n(a.substr(s))}function s(e){function n(e){return e&&e.source||e}function t(t,r){return new RegExp(n(t),"m"+(e.cI?"i":"")+(r?"g":""))}function r(a,i){if(!a.compiled){if(a.compiled=!0,a.k=a.k||a.bK,a.k){var u={},c=function(n,t){e.cI&&(t=t.toLowerCase()),t.split(" ").forEach(function(e){var t=e.split("|");u[t[0]]=[n,t[1]?Number(t[1]):1]})};"string"==typeof a.k?c("keyword",a.k):Object.keys(a.k).forEach(function(e){c(e,a.k[e])}),a.k=u}a.lR=t(a.l||/\b\w+\b/,!0),i&&(a.bK&&(a.b="\\b("+a.bK.split(" ").join("|")+")\\b"),a.b||(a.b=/\B|\b/),a.bR=t(a.b),a.e||a.eW||(a.e=/\B|\b/),a.e&&(a.eR=t(a.e)),a.tE=n(a.e)||"",a.eW&&i.tE&&(a.tE+=(a.e?"|":"")+i.tE)),a.i&&(a.iR=t(a.i)),void 0===a.r&&(a.r=1),a.c||(a.c=[]);var s=[];a.c.forEach(function(e){e.v?e.v.forEach(function(n){s.push(o(e,n))}):s.push("self"==e?a:e)}),a.c=s,a.c.forEach(function(e){r(e,a)}),a.starts&&r(a.starts,i);var l=a.c.map(function(e){return e.bK?"\\.?("+e.b+")\\.?":e.b}).concat([a.tE,a.i]).map(n).filter(Boolean);a.t=l.length?t(l.join("|"),!0):{exec:function(){return null}}}}r(e)}function l(e,t,a,i){function o(e,n){for(var t=0;t";return i+=e+'">',i+n+o}function p(){if(!L.k)return n(M);var e="",t=0;L.lR.lastIndex=0;for(var r=L.lR.exec(M);r;){e+=n(M.substr(t,r.index-t));var a=g(L,r);a?(B+=a[1],e+=h(a[0],n(r[0]))):e+=n(r[0]),t=L.lR.lastIndex,r=L.lR.exec(M)}return e+n(M.substr(t))}function d(){var e="string"==typeof L.sL;if(e&&!R[L.sL])return n(M);var t=e?l(L.sL,M,!0,y[L.sL]):f(M,L.sL.length?L.sL:void 0);return L.r>0&&(B+=t.r),e&&(y[L.sL]=t.top),h(t.language,t.value,!1,!0)}function b(){return void 0!==L.sL?d():p()}function v(e,t){var r=e.cN?h(e.cN,"",!0):"";e.rB?(k+=r,M=""):e.eB?(k+=n(t)+r,M=""):(k+=r,M=t),L=Object.create(e,{parent:{value:L}})}function m(e,t){if(M+=e,void 0===t)return k+=b(),0;var r=o(t,L);if(r)return k+=b(),v(r,t),r.rB?0:t.length;var a=u(L,t);if(a){var i=L;i.rE||i.eE||(M+=t),k+=b();do L.cN&&(k+=""),B+=L.r,L=L.parent;while(L!=a.parent);return i.eE&&(k+=n(t)),M="",a.starts&&v(a.starts,""),i.rE?0:t.length}if(c(t,L))throw new Error('Illegal lexeme "'+t+'" for mode "'+(L.cN||"")+'"');return M+=t,t.length||1}var N=E(e);if(!N)throw new Error('Unknown language: "'+e+'"');s(N);var w,L=i||N,y={},k="";for(w=L;w!=N;w=w.parent)w.cN&&(k=h(w.cN,"",!0)+k);var M="",B=0;try{for(var C,j,I=0;;){if(L.t.lastIndex=I,C=L.t.exec(t),!C)break;j=m(t.substr(I,C.index-I),C[0]),I=C.index+j}for(m(t.substr(I)),w=L;w.parent;w=w.parent)w.cN&&(k+="");return{r:B,value:k,language:e,top:L}}catch(O){if(-1!=O.message.indexOf("Illegal"))return{r:0,value:n(t)};throw O}}function f(e,t){t=t||x.languages||Object.keys(R);var r={r:0,value:n(e)},a=r;return t.forEach(function(n){if(E(n)){var t=l(n,e,!1);t.language=n,t.r>a.r&&(a=t),t.r>r.r&&(a=r,r=t)}}),a.language&&(r.second_best=a),r}function g(e){return x.tabReplace&&(e=e.replace(/^((<[^>]+>|\t)+)/gm,function(e,n){return n.replace(/\t/g,x.tabReplace)})),x.useBR&&(e=e.replace(/\n/g,"
")),e}function h(e,n,t){var r=n?w[n]:t,a=[e.trim()];return e.match(/\bhljs\b/)||a.push("hljs"),-1===e.indexOf(r)&&a.push(r),a.join(" ").trim()}function p(e){var n=i(e);if(!a(n)){var t;x.useBR?(t=document.createElementNS("http://www.w3.org/1999/xhtml","div"),t.innerHTML=e.innerHTML.replace(/\n/g,"").replace(//g,"\n")):t=e;var r=t.textContent,o=n?l(n,r,!0):f(r),s=u(t);if(s.length){var p=document.createElementNS("http://www.w3.org/1999/xhtml","div");p.innerHTML=o.value,o.value=c(s,u(p),r)}o.value=g(o.value),e.innerHTML=o.value,e.className=h(e.className,n,o.language),e.result={language:o.language,re:o.r},o.second_best&&(e.second_best={language:o.second_best.language,re:o.second_best.r})}}function d(e){x=o(x,e)}function b(){if(!b.called){b.called=!0;var e=document.querySelectorAll("pre code");Array.prototype.forEach.call(e,p)}}function v(){addEventListener("DOMContentLoaded",b,!1),addEventListener("load",b,!1)}function m(n,t){var r=R[n]=t(e);r.aliases&&r.aliases.forEach(function(e){w[e]=n})}function N(){return Object.keys(R)}function E(e){return e=(e||"").toLowerCase(),R[e]||R[w[e]]}var x={classPrefix:"hljs-",tabReplace:null,useBR:!1,languages:void 0},R={},w={};return e.highlight=l,e.highlightAuto=f,e.fixMarkup=g,e.highlightBlock=p,e.configure=d,e.initHighlighting=b,e.initHighlightingOnLoad=v,e.registerLanguage=m,e.listLanguages=N,e.getLanguage=E,e.inherit=o,e.IR="[a-zA-Z]\\w*",e.UIR="[a-zA-Z_]\\w*",e.NR="\\b\\d+(\\.\\d+)?",e.CNR="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",e.BNR="\\b(0b[01]+)",e.RSR="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",e.BE={b:"\\\\[\\s\\S]",r:0},e.ASM={cN:"string",b:"'",e:"'",i:"\\n",c:[e.BE]},e.QSM={cN:"string",b:'"',e:'"',i:"\\n",c:[e.BE]},e.PWM={b:/\b(a|an|the|are|I|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|like)\b/},e.C=function(n,t,r){var a=e.inherit({cN:"comment",b:n,e:t,c:[]},r||{});return a.c.push(e.PWM),a.c.push({cN:"doctag",b:"(?:TODO|FIXME|NOTE|BUG|XXX):",r:0}),a},e.CLCM=e.C("//","$"),e.CBCM=e.C("/\\*","\\*/"),e.HCM=e.C("#","$"),e.NM={cN:"number",b:e.NR,r:0},e.CNM={cN:"number",b:e.CNR,r:0},e.BNM={cN:"number",b:e.BNR,r:0},e.CSSNM={cN:"number",b:e.NR+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",r:0},e.RM={cN:"regexp",b:/\//,e:/\/[gimuy]*/,i:/\n/,c:[e.BE,{b:/\[/,e:/\]/,r:0,c:[e.BE]}]},e.TM={cN:"title",b:e.IR,r:0},e.UTM={cN:"title",b:e.UIR,r:0},e});hljs.registerLanguage("cpp",function(t){var e={cN:"keyword",b:"\\b[a-z\\d_]*_t\\b"},r={cN:"string",v:[t.inherit(t.QSM,{b:'((u8?|U)|L)?"'}),{b:'(u8?|U)?R"',e:'"',c:[t.BE]},{b:"'\\\\?.",e:"'",i:"."}]},i={cN:"number",v:[{b:"\\b(\\d+(\\.\\d*)?|\\.\\d+)(u|U|l|L|ul|UL|f|F)"},{b:t.CNR}],r:0},s={cN:"meta",b:"#",e:"$",k:{"meta-keyword":"if else elif endif define undef warning error line pragma ifdef ifndef"},c:[{b:/\\\n/,r:0},{bK:"include",e:"$",k:{"meta-keyword":"include"},c:[t.inherit(r,{cN:"meta-string"}),{cN:"meta-string",b:"<",e:">",i:"\\n"}]},r,t.CLCM,t.CBCM]},a=t.IR+"\\s*\\(",c={keyword:"int float while private char catch export virtual operator sizeof dynamic_cast|10 typedef const_cast|10 const struct for static_cast|10 union namespace unsigned long volatile static protected bool template mutable if public friend do goto auto void enum else break extern using class asm case typeid short reinterpret_cast|10 default double register explicit signed typename try this switch continue inline delete alignof constexpr decltype noexcept static_assert thread_local restrict _Bool complex _Complex _Imaginary atomic_bool atomic_char atomic_schar atomic_uchar atomic_short atomic_ushort atomic_int atomic_uint atomic_long atomic_ulong atomic_llong atomic_ullong",built_in:"std string cin cout cerr clog stdin stdout stderr stringstream istringstream ostringstream auto_ptr deque list queue stack vector map set bitset multiset multimap unordered_set unordered_map unordered_multiset unordered_multimap array shared_ptr abort abs acos asin atan2 atan calloc ceil cosh cos exit exp fabs floor fmod fprintf fputs free frexp fscanf isalnum isalpha iscntrl isdigit isgraph islower isprint ispunct isspace isupper isxdigit tolower toupper labs ldexp log10 log malloc realloc memchr memcmp memcpy memset modf pow printf putchar puts scanf sinh sin snprintf sprintf sqrt sscanf strcat strchr strcmp strcpy strcspn strlen strncat strncmp strncpy strpbrk strrchr strspn strstr tanh tan vfprintf vprintf vsprintf endl initializer_list unique_ptr",literal:"true false nullptr NULL"};return{aliases:["c","cc","h","c++","h++","hpp"],k:c,i:"",k:c,c:["self",e]},{b:t.IR+"::",k:c},{bK:"new throw return else",r:0},{cN:"function",b:"("+t.IR+"[\\*&\\s]+)+"+a,rB:!0,e:/[{;=]/,eE:!0,k:c,i:/[^\w\s\*&]/,c:[{b:a,rB:!0,c:[t.TM],r:0},{cN:"params",b:/\(/,e:/\)/,k:c,r:0,c:[t.CLCM,t.CBCM,r,i]},t.CLCM,t.CBCM,s]}]}});hljs.registerLanguage("python",function(e){var r={cN:"meta",b:/^(>>>|\.\.\.) /},b={cN:"string",c:[e.BE],v:[{b:/(u|b)?r?'''/,e:/'''/,c:[r],r:10},{b:/(u|b)?r?"""/,e:/"""/,c:[r],r:10},{b:/(u|r|ur)'/,e:/'/,r:10},{b:/(u|r|ur)"/,e:/"/,r:10},{b:/(b|br)'/,e:/'/},{b:/(b|br)"/,e:/"/},e.ASM,e.QSM]},a={cN:"number",r:0,v:[{b:e.BNR+"[lLjJ]?"},{b:"\\b(0o[0-7]+)[lLjJ]?"},{b:e.CNR+"[lLjJ]?"}]},l={cN:"params",b:/\(/,e:/\)/,c:["self",r,a,b]};return{aliases:["py","gyp"],k:{keyword:"and elif is global as in if from raise for except finally print import pass return exec else break not with class assert yield try while continue del or def lambda async await nonlocal|10 None True False",built_in:"Ellipsis NotImplemented"},i:/(<\/|->|\?)/,c:[r,a,b,e.HCM,{v:[{cN:"function",bK:"def",r:10},{cN:"class",bK:"class"}],e:/:/,i:/[${=;\n,]/,c:[e.UTM,l,{b:/->/,eW:!0,k:"None"}]},{cN:"meta",b:/^[\t ]*@/,e:/$/},{b:/\b(print|exec)\(/}]}});hljs.registerLanguage("makefile",function(e){var a={cN:"variable",b:/\$\(/,e:/\)/,c:[e.BE]};return{aliases:["mk","mak"],c:[e.HCM,{b:/^\w+\s*\W*=/,rB:!0,r:0,starts:{e:/\s*\W*=/,eE:!0,starts:{e:/$/,r:0,c:[a]}}},{cN:"section",b:/^[\w]+:\s*$/},{cN:"meta",b:/^\.PHONY:/,e:/$/,k:{"meta-keyword":".PHONY"},l:/[\.\w]+/},{b:/^\t+/,e:/$/,r:0,c:[e.QSM,a]}]}});hljs.registerLanguage("javascript",function(e){return{aliases:["js"],k:{keyword:"in of if for while finally var new function do return void else break catch instanceof with throw case default try this switch continue typeof delete let yield const export super debugger as async await import from as",literal:"true false null undefined NaN Infinity",built_in:"eval isFinite isNaN parseFloat parseInt decodeURI decodeURIComponent encodeURI encodeURIComponent escape unescape Object Function Boolean Error EvalError InternalError RangeError ReferenceError StopIteration SyntaxError TypeError URIError Number Math Date String RegExp Array Float32Array Float64Array Int16Array Int32Array Int8Array Uint16Array Uint32Array Uint8Array Uint8ClampedArray ArrayBuffer DataView JSON Intl arguments require module console window document Symbol Set Map WeakSet WeakMap Proxy Reflect Promise"},c:[{cN:"meta",r:10,b:/^\s*['"]use (strict|asm)['"]/},{cN:"meta",b:/^#!/,e:/$/},e.ASM,e.QSM,{cN:"string",b:"`",e:"`",c:[e.BE,{cN:"subst",b:"\\$\\{",e:"\\}"}]},e.CLCM,e.CBCM,{cN:"number",v:[{b:"\\b(0[bB][01]+)"},{b:"\\b(0[oO][0-7]+)"},{b:e.CNR}],r:0},{b:"("+e.RSR+"|\\b(case|return|throw)\\b)\\s*",k:"return throw case",c:[e.CLCM,e.CBCM,e.RM,{b:/\s*[);\]]/,r:0,sL:"xml"}],r:0},{cN:"function",bK:"function",e:/\{/,eE:!0,c:[e.inherit(e.TM,{b:/[A-Za-z$_][0-9A-Za-z$_]*/}),{cN:"params",b:/\(/,e:/\)/,eB:!0,eE:!0,c:[e.CLCM,e.CBCM]}],i:/\[|%/},{b:/\$[(.]/},{b:"\\."+e.IR,r:0},{cN:"class",bK:"class",e:/[{;=]/,eE:!0,i:/[:"\[\]]/,c:[{bK:"extends"},e.UTM]},{bK:"constructor",e:/\{/,eE:!0}],i:/#(?!!)/}});hljs.registerLanguage("markdown",function(e){return{aliases:["md","mkdown","mkd"],c:[{cN:"section",v:[{b:"^#{1,6}",e:"$"},{b:"^.+?\\n[=-]{2,}$"}]},{b:"<",e:">",sL:"xml",r:0},{cN:"bullet",b:"^([*+-]|(\\d+\\.))\\s+"},{cN:"strong",b:"[*_]{2}.+?[*_]{2}"},{cN:"emphasis",v:[{b:"\\*.+?\\*"},{b:"_.+?_",r:0}]},{cN:"quote",b:"^>\\s+",e:"$"},{cN:"code",v:[{b:"`.+?`"},{b:"^( {4}| )",e:"$",r:0}]},{b:"^[-\\*]{3,}",e:"$"},{b:"\\[.+?\\][\\(\\[].*?[\\)\\]]",rB:!0,c:[{cN:"string",b:"\\[",e:"\\]",eB:!0,rE:!0,r:0},{cN:"link",b:"\\]\\(",e:"\\)",eB:!0,eE:!0},{cN:"symbol",b:"\\]\\[",e:"\\]",eB:!0,eE:!0}],r:10},{b:"^\\[.+\\]:",rB:!0,c:[{cN:"symbol",b:"\\[",e:"\\]:",eB:!0,eE:!0,starts:{cN:"link",e:"$"}}]}]}});hljs.registerLanguage("scss",function(e){var t="[a-zA-Z-][a-zA-Z0-9_-]*",i={cN:"variable",b:"(\\$"+t+")\\b"},r={cN:"number",b:"#[0-9A-Fa-f]+"};({cN:"attribute",b:"[A-Z\\_\\.\\-]+",e:":",eE:!0,i:"[^\\s]",starts:{eW:!0,eE:!0,c:[r,e.CSSNM,e.QSM,e.ASM,e.CBCM,{cN:"meta",b:"!important"}]}});return{cI:!0,i:"[=/|']",c:[e.CLCM,e.CBCM,{cN:"selector-id",b:"\\#[A-Za-z0-9_-]+",r:0},{cN:"selector-class",b:"\\.[A-Za-z0-9_-]+",r:0},{cN:"selector-attr",b:"\\[",e:"\\]",i:"$"},{cN:"selector-tag",b:"\\b(a|abbr|acronym|address|area|article|aside|audio|b|base|big|blockquote|body|br|button|canvas|caption|cite|code|col|colgroup|command|datalist|dd|del|details|dfn|div|dl|dt|em|embed|fieldset|figcaption|figure|footer|form|frame|frameset|(h[1-6])|head|header|hgroup|hr|html|i|iframe|img|input|ins|kbd|keygen|label|legend|li|link|map|mark|meta|meter|nav|noframes|noscript|object|ol|optgroup|option|output|p|param|pre|progress|q|rp|rt|ruby|samp|script|section|select|small|span|strike|strong|style|sub|sup|table|tbody|td|textarea|tfoot|th|thead|time|title|tr|tt|ul|var|video)\\b",r:0},{b:":(visited|valid|root|right|required|read-write|read-only|out-range|optional|only-of-type|only-child|nth-of-type|nth-last-of-type|nth-last-child|nth-child|not|link|left|last-of-type|last-child|lang|invalid|indeterminate|in-range|hover|focus|first-of-type|first-line|first-letter|first-child|first|enabled|empty|disabled|default|checked|before|after|active)"},{b:"::(after|before|choices|first-letter|first-line|repeat-index|repeat-item|selection|value)"},i,{cN:"attribute",b:"\\b(z-index|word-wrap|word-spacing|word-break|width|widows|white-space|visibility|vertical-align|unicode-bidi|transition-timing-function|transition-property|transition-duration|transition-delay|transition|transform-style|transform-origin|transform|top|text-underline-position|text-transform|text-shadow|text-rendering|text-overflow|text-indent|text-decoration-style|text-decoration-line|text-decoration-color|text-decoration|text-align-last|text-align|tab-size|table-layout|right|resize|quotes|position|pointer-events|perspective-origin|perspective|page-break-inside|page-break-before|page-break-after|padding-top|padding-right|padding-left|padding-bottom|padding|overflow-y|overflow-x|overflow-wrap|overflow|outline-width|outline-style|outline-offset|outline-color|outline|orphans|order|opacity|object-position|object-fit|normal|none|nav-up|nav-right|nav-left|nav-index|nav-down|min-width|min-height|max-width|max-height|mask|marks|margin-top|margin-right|margin-left|margin-bottom|margin|list-style-type|list-style-position|list-style-image|list-style|line-height|letter-spacing|left|justify-content|initial|inherit|ime-mode|image-orientation|image-resolution|image-rendering|icon|hyphens|height|font-weight|font-variant-ligatures|font-variant|font-style|font-stretch|font-size-adjust|font-size|font-language-override|font-kerning|font-feature-settings|font-family|font|float|flex-wrap|flex-shrink|flex-grow|flex-flow|flex-direction|flex-basis|flex|filter|empty-cells|display|direction|cursor|counter-reset|counter-increment|content|column-width|column-span|column-rule-width|column-rule-style|column-rule-color|column-rule|column-gap|column-fill|column-count|columns|color|clip-path|clip|clear|caption-side|break-inside|break-before|break-after|box-sizing|box-shadow|box-decoration-break|bottom|border-width|border-top-width|border-top-style|border-top-right-radius|border-top-left-radius|border-top-color|border-top|border-style|border-spacing|border-right-width|border-right-style|border-right-color|border-right|border-radius|border-left-width|border-left-style|border-left-color|border-left|border-image-width|border-image-source|border-image-slice|border-image-repeat|border-image-outset|border-image|border-color|border-collapse|border-bottom-width|border-bottom-style|border-bottom-right-radius|border-bottom-left-radius|border-bottom-color|border-bottom|border|background-size|background-repeat|background-position|background-origin|background-image|background-color|background-clip|background-attachment|background-blend-mode|background|backface-visibility|auto|animation-timing-function|animation-play-state|animation-name|animation-iteration-count|animation-fill-mode|animation-duration|animation-direction|animation-delay|animation|align-self|align-items|align-content)\\b",i:"[^\\s]"},{b:"\\b(whitespace|wait|w-resize|visible|vertical-text|vertical-ideographic|uppercase|upper-roman|upper-alpha|underline|transparent|top|thin|thick|text|text-top|text-bottom|tb-rl|table-header-group|table-footer-group|sw-resize|super|strict|static|square|solid|small-caps|separate|se-resize|scroll|s-resize|rtl|row-resize|ridge|right|repeat|repeat-y|repeat-x|relative|progress|pointer|overline|outside|outset|oblique|nowrap|not-allowed|normal|none|nw-resize|no-repeat|no-drop|newspaper|ne-resize|n-resize|move|middle|medium|ltr|lr-tb|lowercase|lower-roman|lower-alpha|loose|list-item|line|line-through|line-edge|lighter|left|keep-all|justify|italic|inter-word|inter-ideograph|inside|inset|inline|inline-block|inherit|inactive|ideograph-space|ideograph-parenthesis|ideograph-numeric|ideograph-alpha|horizontal|hidden|help|hand|groove|fixed|ellipsis|e-resize|double|dotted|distribute|distribute-space|distribute-letter|distribute-all-lines|disc|disabled|default|decimal|dashed|crosshair|collapse|col-resize|circle|char|center|capitalize|break-word|break-all|bottom|both|bolder|bold|block|bidi-override|below|baseline|auto|always|all-scroll|absolute|table|table-cell)\\b"},{b:":",e:";",c:[i,r,e.CSSNM,e.QSM,e.ASM,{cN:"meta",b:"!important"}]},{b:"@",e:"[{;]",k:"mixin include extend for if else each while charset import debug media page content font-face namespace warn",c:[i,e.QSM,e.ASM,r,e.CSSNM,{b:"\\s[A-Za-z0-9_.-]+",r:0}]}]}});hljs.registerLanguage("cs",function(e){var t="abstract as base bool break byte case catch char checked const continue decimal dynamic default delegate do double else enum event explicit extern false finally fixed float for foreach goto if implicit in int interface internal is lock long null when object operator out override params private protected public readonly ref sbyte sealed short sizeof stackalloc static string struct switch this true try typeof uint ulong unchecked unsafe ushort using virtual volatile void while async protected public private internal ascending descending from get group into join let orderby partial select set value var where yield",r=e.IR+"(<"+e.IR+">)?";return{aliases:["csharp"],k:t,i:/::/,c:[e.C("///","$",{rB:!0,c:[{cN:"doctag",v:[{b:"///",r:0},{b:""},{b:""}]}]}),e.CLCM,e.CBCM,{cN:"meta",b:"#",e:"$",k:{"meta-keyword":"if else elif endif define undef warning error line region endregion pragma checksum"}},{cN:"string",b:'@"',e:'"',c:[{b:'""'}]},e.ASM,e.QSM,e.CNM,{bK:"class interface",e:/[{;=]/,i:/[^\s:]/,c:[e.TM,e.CLCM,e.CBCM]},{bK:"namespace",e:/[{;=]/,i:/[^\s:]/,c:[e.inherit(e.TM,{b:"[a-zA-Z](\\.?\\w)*"}),e.CLCM,e.CBCM]},{bK:"new return throw await",r:0},{cN:"function",b:"("+r+"\\s+)+"+e.IR+"\\s*\\(",rB:!0,e:/[{;=]/,eE:!0,k:t,c:[{b:e.IR+"\\s*\\(",rB:!0,c:[e.TM],r:0},{cN:"params",b:/\(/,e:/\)/,eB:!0,eE:!0,k:t,r:0,c:[e.ASM,e.QSM,e.CNM,e.CBCM]},e.CLCM,e.CBCM]}]}});hljs.registerLanguage("diff",function(e){return{aliases:["patch"],c:[{cN:"meta",r:10,v:[{b:/^@@ +\-\d+,\d+ +\+\d+,\d+ +@@$/},{b:/^\*\*\* +\d+,\d+ +\*\*\*\*$/},{b:/^\-\-\- +\d+,\d+ +\-\-\-\-$/}]},{cN:"comment",v:[{b:/Index: /,e:/$/},{b:/=====/,e:/=====$/},{b:/^\-\-\-/,e:/$/},{b:/^\*{3} /,e:/$/},{b:/^\+\+\+/,e:/$/},{b:/\*{5}/,e:/\*{5}$/}]},{cN:"addition",b:"^\\+",e:"$"},{cN:"deletion",b:"^\\-",e:"$"},{cN:"addition",b:"^\\!",e:"$"}]}});hljs.registerLanguage("css",function(e){var c="[a-zA-Z-][a-zA-Z0-9_-]*",t={b:/[A-Z\_\.\-]+\s*:/,rB:!0,e:";",eW:!0,c:[{cN:"attribute",b:/\S/,e:":",eE:!0,starts:{eW:!0,eE:!0,c:[{b:/[\w-]+\s*\(/,rB:!0,c:[{cN:"built_in",b:/[\w-]+/}]},e.CSSNM,e.QSM,e.ASM,e.CBCM,{cN:"number",b:"#[0-9A-Fa-f]+"},{cN:"meta",b:"!important"}]}}]};return{cI:!0,i:/[=\/|'\$]/,c:[e.CBCM,{cN:"selector-id",b:/#[A-Za-z0-9_-]+/},{cN:"selector-class",b:/\.[A-Za-z0-9_-]+/},{cN:"selector-attr",b:/\[/,e:/\]/,i:"$"},{cN:"selector-pseudo",b:/:(:)?[a-zA-Z0-9\_\-\+\(\)"'.]+/},{b:"@(font-face|page)",l:"[a-z-]+",k:"font-face page"},{b:"@",e:"[{;]",c:[{cN:"keyword",b:/\S+/},{b:/\s/,eW:!0,eE:!0,r:0,c:[e.ASM,e.QSM,e.CSSNM]}]},{cN:"selector-tag",b:c,r:0},{b:"{",e:"}",i:/\S/,c:[e.CBCM,t]}]}});hljs.registerLanguage("perl",function(e){var t="getpwent getservent quotemeta msgrcv scalar kill dbmclose undef lc ma syswrite tr send umask sysopen shmwrite vec qx utime local oct semctl localtime readpipe do return format read sprintf dbmopen pop getpgrp not getpwnam rewinddir qqfileno qw endprotoent wait sethostent bless s|0 opendir continue each sleep endgrent shutdown dump chomp connect getsockname die socketpair close flock exists index shmgetsub for endpwent redo lstat msgctl setpgrp abs exit select print ref gethostbyaddr unshift fcntl syscall goto getnetbyaddr join gmtime symlink semget splice x|0 getpeername recv log setsockopt cos last reverse gethostbyname getgrnam study formline endhostent times chop length gethostent getnetent pack getprotoent getservbyname rand mkdir pos chmod y|0 substr endnetent printf next open msgsnd readdir use unlink getsockopt getpriority rindex wantarray hex system getservbyport endservent int chr untie rmdir prototype tell listen fork shmread ucfirst setprotoent else sysseek link getgrgid shmctl waitpid unpack getnetbyname reset chdir grep split require caller lcfirst until warn while values shift telldir getpwuid my getprotobynumber delete and sort uc defined srand accept package seekdir getprotobyname semop our rename seek if q|0 chroot sysread setpwent no crypt getc chown sqrt write setnetent setpriority foreach tie sin msgget map stat getlogin unless elsif truncate exec keys glob tied closedirioctl socket readlink eval xor readline binmode setservent eof ord bind alarm pipe atan2 getgrent exp time push setgrent gt lt or ne m|0 break given say state when",r={cN:"subst",b:"[$@]\\{",e:"\\}",k:t},s={b:"->{",e:"}"},n={v:[{b:/\$\d/},{b:/[\$%@](\^\w\b|#\w+(::\w+)*|{\w+}|\w+(::\w*)*)/},{b:/[\$%@][^\s\w{]/,r:0}]},i=[e.BE,r,n],o=[n,e.HCM,e.C("^\\=\\w","\\=cut",{eW:!0}),s,{cN:"string",c:i,v:[{b:"q[qwxr]?\\s*\\(",e:"\\)",r:5},{b:"q[qwxr]?\\s*\\[",e:"\\]",r:5},{b:"q[qwxr]?\\s*\\{",e:"\\}",r:5},{b:"q[qwxr]?\\s*\\|",e:"\\|",r:5},{b:"q[qwxr]?\\s*\\<",e:"\\>",r:5},{b:"qw\\s+q",e:"q",r:5},{b:"'",e:"'",c:[e.BE]},{b:'"',e:'"'},{b:"`",e:"`",c:[e.BE]},{b:"{\\w+}",c:[],r:0},{b:"-?\\w+\\s*\\=\\>",c:[],r:0}]},{cN:"number",b:"(\\b0[0-7_]+)|(\\b0x[0-9a-fA-F_]+)|(\\b[1-9][0-9_]*(\\.[0-9_]+)?)|[0_]\\b",r:0},{b:"(\\/\\/|"+e.RSR+"|\\b(split|return|print|reverse|grep)\\b)\\s*",k:"split return print reverse grep",r:0,c:[e.HCM,{cN:"regexp",b:"(s|tr|y)/(\\\\.|[^/])*/(\\\\.|[^/])*/[a-z]*",r:10},{cN:"regexp",b:"(m|qr)?/",e:"/[a-z]*",c:[e.BE],r:0}]},{cN:"function",bK:"sub",e:"(\\s*\\(.*?\\))?[;{]",eE:!0,r:5,c:[e.TM]},{b:"-\\w\\b",r:0},{b:"^__DATA__$",e:"^__END__$",sL:"mojolicious",c:[{b:"^@@.*",e:"$",cN:"comment"}]}];return r.c=o,s.c=o,{aliases:["pl"],k:t,c:o}});hljs.registerLanguage("json",function(e){var t={literal:"true false null"},i=[e.QSM,e.CNM],r={e:",",eW:!0,eE:!0,c:i,k:t},s={b:"{",e:"}",c:[{cN:"attr",b:'\\s*"',e:'"\\s*:\\s*',eB:!0,eE:!0,c:[e.BE],i:"\\n",starts:r}],i:"\\S"},n={b:"\\[",e:"\\]",c:[e.inherit(r)],i:"\\S"};return i.splice(i.length,0,s,n),{c:i,k:t,i:"\\S"}});hljs.registerLanguage("bash",function(e){var t={cN:"variable",v:[{b:/\$[\w\d#@][\w\d_]*/},{b:/\$\{(.*?)}/}]},s={cN:"string",b:/"/,e:/"/,c:[e.BE,t,{cN:"variable",b:/\$\(/,e:/\)/,c:[e.BE]}]},a={cN:"string",b:/'/,e:/'/};return{aliases:["sh","zsh"],l:/-?[a-z\.]+/,k:{keyword:"if then else elif fi for while in do done case esac function",literal:"true false",built_in:"break cd continue eval exec exit export getopts hash pwd readonly return shift test times trap umask unset alias bind builtin caller command declare echo enable help let local logout mapfile printf read readarray source type typeset ulimit unalias set shopt autoload bg bindkey bye cap chdir clone comparguments compcall compctl compdescribe compfiles compgroups compquote comptags comptry compvalues dirs disable disown echotc echoti emulate fc fg float functions getcap getln history integer jobs kill limit log noglob popd print pushd pushln rehash sched setcap setopt stat suspend ttyctl unfunction unhash unlimit unsetopt vared wait whence where which zcompile zformat zftp zle zmodload zparseopts zprof zpty zregexparse zsocket zstyle ztcp",_:"-ne -eq -lt -gt -f -d -e -s -l -a"},c:[{cN:"meta",b:/^#![^\n]+sh\s*$/,r:10},{cN:"function",b:/\w[\w\d_]*\s*\(\s*\)\s*\{/,rB:!0,c:[e.inherit(e.TM,{b:/\w[\w\d_]*/})],r:0},e.HCM,s,a,t]}});hljs.registerLanguage("objectivec",function(e){var t={cN:"built_in",b:"(AV|CA|CF|CG|CI|MK|MP|NS|UI|XC)\\w+"},i={keyword:"int float while char export sizeof typedef const struct for union unsigned long volatile static bool mutable if do return goto void enum else break extern asm case short default double register explicit signed typename this switch continue wchar_t inline readonly assign readwrite self @synchronized id typeof nonatomic super unichar IBOutlet IBAction strong weak copy in out inout bycopy byref oneway __strong __weak __block __autoreleasing @private @protected @public @try @property @end @throw @catch @finally @autoreleasepool @synthesize @dynamic @selector @optional @required",literal:"false true FALSE TRUE nil YES NO NULL",built_in:"BOOL dispatch_once_t dispatch_queue_t dispatch_sync dispatch_async dispatch_once"},n=/[a-zA-Z@][a-zA-Z0-9_]*/,o="@interface @class @protocol @implementation";return{aliases:["mm","objc","obj-c"],k:i,l:n,i:""}]}]},{cN:"class",b:"("+o.split(" ").join("|")+")\\b",e:"({|$)",eE:!0,k:o,l:n,c:[e.UTM]},{b:"\\."+e.UIR,r:0}]}});hljs.registerLanguage("dts",function(e){var a={cN:"string",v:[e.inherit(e.QSM,{b:'((u8?|U)|L)?"'}),{b:'(u8?|U)?R"',e:'"',c:[e.BE]},{b:"'\\\\?.",e:"'",i:"."}]},c={cN:"number",v:[{b:"\\b(\\d+(\\.\\d*)?|\\.\\d+)(u|U|l|L|ul|UL|f|F)"},{b:e.CNR}],r:0},b={cN:"meta",b:"#",e:"$",k:{"meta-keyword":"if else elif endif define undef ifdef ifndef"},c:[{b:/\\\n/,r:0},{bK:"include",e:"$",k:{"meta-keyword":"include"},c:[e.inherit(a,{cN:"meta-string"}),{cN:"meta-string",b:"<",e:">",i:"\\n"}]},a,e.CLCM,e.CBCM]},i={cN:"variable",b:"\\&[a-z\\d_]*\\b"},r={cN:"meta-keyword",b:"/[a-z][a-z\\d-]*/"},d={cN:"symbol",b:"^\\s*[a-zA-Z_][a-zA-Z\\d_]*:"},n={cN:"params",b:"<",e:">",c:[c,i]},s={cN:"class",b:/[a-zA-Z_][a-zA-Z\d_@]*\s{/,e:/[{;=]/,rB:!0,eE:!0},t={cN:"class",b:"/\\s*{",e:"};",r:10,c:[i,r,d,s,n,e.CLCM,e.CBCM,c,a]};return{k:"",c:[t,i,r,d,s,n,e.CLCM,e.CBCM,c,a,b,{b:e.IR+"::",k:""}]}});hljs.registerLanguage("apache",function(e){var r={cN:"number",b:"[\\$%]\\d+"};return{aliases:["apacheconf"],cI:!0,c:[e.HCM,{cN:"section",b:""},{cN:"attribute",b:/\w+/,r:0,k:{nomarkup:"order deny allow setenv rewriterule rewriteengine rewritecond documentroot sethandler errordocument loadmodule options header listen serverroot servername"},starts:{e:/$/,r:0,k:{literal:"on off all"},c:[{cN:"meta",b:"\\s\\[",e:"\\]$"},{cN:"variable",b:"[\\$%]\\{",e:"\\}",c:["self",r]},r,e.QSM]}}],i:/\S/}});hljs.registerLanguage("xml",function(s){var t="[A-Za-z0-9\\._:-]+",e={b:/<\?(php)?(?!\w)/,e:/\?>/,sL:"php"},r={eW:!0,i:/]+/}]}]}]};return{aliases:["html","xhtml","rss","atom","xsl","plist"],cI:!0,c:[{cN:"meta",b:"",r:10,c:[{b:"\\[",e:"\\]"}]},s.C("",{r:10}),{b:"<\\!\\[CDATA\\[",e:"\\]\\]>",r:10},{cN:"tag",b:"|$)",e:">",k:{name:"style"},c:[r],starts:{e:"",rE:!0,sL:["css","xml"]}},{cN:"tag",b:"|$)",e:">",k:{name:"script"},c:[r],starts:{e:"",rE:!0,sL:["actionscript","javascript","handlebars","xml"]}},e,{cN:"meta",b:/<\?\w+/,e:/\?>/,r:10},{cN:"tag",b:"",c:[{cN:"name",b:/[^\/><\s]+/,r:0},r]}]}});hljs.registerLanguage("coffeescript",function(e){var c={keyword:"in if for while finally new do return else break catch instanceof throw try this switch continue typeof delete debugger super then unless until loop of by when and or is isnt not",literal:"true false null undefined yes no on off",built_in:"npm require console print module global window document"},n="[A-Za-z$_][0-9A-Za-z$_]*",r={cN:"subst",b:/#\{/,e:/}/,k:c},s=[e.BNM,e.inherit(e.CNM,{starts:{e:"(\\s*/)?",r:0}}),{cN:"string",v:[{b:/'''/,e:/'''/,c:[e.BE]},{b:/'/,e:/'/,c:[e.BE]},{b:/"""/,e:/"""/,c:[e.BE,r]},{b:/"/,e:/"/,c:[e.BE,r]}]},{cN:"regexp",v:[{b:"///",e:"///",c:[r,e.HCM]},{b:"//[gim]*",r:0},{b:/\/(?![ *])(\\\/|.)*?\/[gim]*(?=\W|$)/}]},{b:"@"+n},{b:"`",e:"`",eB:!0,eE:!0,sL:"javascript"}];r.c=s;var i=e.inherit(e.TM,{b:n}),t="(\\(.*\\))?\\s*\\B[-=]>",o={cN:"params",b:"\\([^\\(]",rB:!0,c:[{b:/\(/,e:/\)/,k:c,c:["self"].concat(s)}]};return{aliases:["coffee","cson","iced"],k:c,i:/\/\*/,c:s.concat([e.C("###","###"),e.HCM,{cN:"function",b:"^\\s*"+n+"\\s*=\\s*"+t,e:"[-=]>",rB:!0,c:[i,o]},{b:/[:\(,=]\s*/,r:0,c:[{cN:"function",b:t,e:"[-=]>",rB:!0,c:[o]}]},{cN:"class",bK:"class",e:"$",i:/[:="\[\]]/,c:[{bK:"extends",eW:!0,i:/[:="\[\]]/,c:[i]},i]},{b:n+":",e:":",rB:!0,rE:!0,r:0}])}});hljs.registerLanguage("ruby",function(e){var b="[a-zA-Z_]\\w*[!?=]?|[-+~]\\@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?",c="and false then defined module in return redo if BEGIN retry end for true self when next until do begin unless END rescue nil else break undef not super class case require yield alias while ensure elsif or include attr_reader attr_writer attr_accessor",r={cN:"doctag",b:"@[A-Za-z]+"},a={b:"#<",e:">"},s=[e.C("#","$",{c:[r]}),e.C("^\\=begin","^\\=end",{c:[r],r:10}),e.C("^__END__","\\n$")],n={cN:"subst",b:"#\\{",e:"}",k:c},t={cN:"string",c:[e.BE,n],v:[{b:/'/,e:/'/},{b:/"/,e:/"/},{b:/`/,e:/`/},{b:"%[qQwWx]?\\(",e:"\\)"},{b:"%[qQwWx]?\\[",e:"\\]"},{b:"%[qQwWx]?{",e:"}"},{b:"%[qQwWx]?<",e:">"},{b:"%[qQwWx]?/",e:"/"},{b:"%[qQwWx]?%",e:"%"},{b:"%[qQwWx]?-",e:"-"},{b:"%[qQwWx]?\\|",e:"\\|"},{b:/\B\?(\\\d{1,3}|\\x[A-Fa-f0-9]{1,2}|\\u[A-Fa-f0-9]{4}|\\?\S)\b/}]},i={cN:"params",b:"\\(",e:"\\)",endsParent:!0,k:c},d=[t,a,{cN:"class",bK:"class module",e:"$|;",i:/=/,c:[e.inherit(e.TM,{b:"[A-Za-z_]\\w*(::\\w+)*(\\?|\\!)?"}),{b:"<\\s*",c:[{b:"("+e.IR+"::)?"+e.IR}]}].concat(s)},{cN:"function",bK:"def",e:"$|;",c:[e.inherit(e.TM,{b:b}),i].concat(s)},{cN:"symbol",b:e.UIR+"(\\!|\\?)?:",r:0},{cN:"symbol",b:":",c:[t,{b:b}],r:0},{cN:"number",b:"(\\b0[0-7_]+)|(\\b0x[0-9a-fA-F_]+)|(\\b[1-9][0-9_]*(\\.[0-9_]+)?)|[0_]\\b",r:0},{b:"(\\$\\W)|((\\$|\\@\\@?)(\\w+))"},{b:"("+e.RSR+")\\s*",c:[a,{cN:"regexp",c:[e.BE,n],i:/\n/,v:[{b:"/",e:"/[a-z]*"},{b:"%r{",e:"}[a-z]*"},{b:"%r\\(",e:"\\)[a-z]*"},{b:"%r!",e:"![a-z]*"},{b:"%r\\[",e:"\\][a-z]*"}]}].concat(s),r:0}].concat(s);n.c=d,i.c=d;var o="[>?]>",l="[\\w#]+\\(\\w+\\):\\d+:\\d+>",u="(\\w+-)?\\d+\\.\\d+\\.\\d(p\\d+)?[^>]+>",w=[{b:/^\s*=>/,starts:{e:"$",c:d}},{cN:"meta",b:"^("+o+"|"+l+"|"+u+")",starts:{e:"$",c:d}}];return{aliases:["rb","gemspec","podspec","thor","irb"],k:c,i:/\/\*/,c:s.concat(w).concat(d)}});hljs.registerLanguage("scala",function(e){var t={cN:"meta",b:"@[A-Za-z]+"},a={cN:"subst",v:[{b:"\\$[A-Za-z0-9_]+"},{b:"\\${",e:"}"}]},r={cN:"string",v:[{b:'"',e:'"',i:"\\n",c:[e.BE]},{b:'"""',e:'"""',r:10},{b:'[a-z]+"',e:'"',i:"\\n",c:[e.BE,a]},{cN:"string",b:'[a-z]+"""',e:'"""',c:[a],r:10}]},c={cN:"symbol",b:"'\\w[\\w\\d_]*(?!')"},i={cN:"type",b:"\\b[A-Z][A-Za-z0-9_]*",r:0},s={cN:"title",b:/[^0-9\n\t "'(),.`{}\[\]:;][^\n\t "'(),.`{}\[\]:;]+|[^0-9\n\t "'(),.`{}\[\]:;=]/,r:0},n={cN:"class",bK:"class object trait type",e:/[:={\[\n;]/,eE:!0,c:[{bK:"extends with",r:10},{b:/\[/,e:/\]/,eB:!0,eE:!0,r:0,c:[i]},{cN:"params",b:/\(/,e:/\)/,eB:!0,eE:!0,r:0,c:[i]},s]},l={cN:"function",bK:"def",e:/[:={\[(\n;]/,eE:!0,c:[s]};return{k:{literal:"true false null",keyword:"type yield lazy override def with val var sealed abstract private trait object if forSome for while throw finally protected extends import final return else break new catch super class case package default try this match continue throws implicit"},c:[e.CLCM,e.CBCM,r,c,i,l,n,e.CNM,t]}});hljs.registerLanguage("nginx",function(e){var r={cN:"variable",v:[{b:/\$\d+/},{b:/\$\{/,e:/}/},{b:"[\\$\\@]"+e.UIR}]},b={eW:!0,l:"[a-z/_]+",k:{literal:"on off yes no true false none blocked debug info notice warn error crit select break last permanent redirect kqueue rtsig epoll poll /dev/poll"},r:0,i:"=>",c:[e.HCM,{cN:"string",c:[e.BE,r],v:[{b:/"/,e:/"/},{b:/'/,e:/'/}]},{b:"([a-z]+):/",e:"\\s",eW:!0,eE:!0,c:[r]},{cN:"regexp",c:[e.BE,r],v:[{b:"\\s\\^",e:"\\s|{|;",rE:!0},{b:"~\\*?\\s+",e:"\\s|{|;",rE:!0},{b:"\\*(\\.[a-z\\-]+)+"},{b:"([a-z\\-]+\\.)+\\*"}]},{cN:"number",b:"\\b\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}(:\\d{1,5})?\\b"},{cN:"number",b:"\\b\\d+[kKmMgGdshdwy]*\\b",r:0},r]};return{aliases:["nginxconf"],c:[e.HCM,{b:e.UIR+"\\s+{",rB:!0,e:"{",c:[{cN:"section",b:e.UIR}],r:0},{b:e.UIR+"\\s",e:";|{",rB:!0,c:[{cN:"attribute",b:e.UIR,starts:b}],r:0}],i:"[^\\s\\}]"}});hljs.registerLanguage("java",function(e){var a=e.UIR+"(<"+e.UIR+"(\\s*,\\s*"+e.UIR+")*>)?",t="false synchronized int abstract float private char boolean static null if const for true while long strictfp finally protected import native final void enum else break transient catch instanceof byte super volatile case assert short package default double public try this switch continue throws protected public private",r="\\b(0[bB]([01]+[01_]+[01]+|[01]+)|0[xX]([a-fA-F0-9]+[a-fA-F0-9_]+[a-fA-F0-9]+|[a-fA-F0-9]+)|(([\\d]+[\\d_]+[\\d]+|[\\d]+)(\\.([\\d]+[\\d_]+[\\d]+|[\\d]+))?|\\.([\\d]+[\\d_]+[\\d]+|[\\d]+))([eE][-+]?\\d+)?)[lLfF]?",c={cN:"number",b:r,r:0};return{aliases:["jsp"],k:t,i:/<\/|#/,c:[e.C("/\\*\\*","\\*/",{r:0,c:[{b:/\w+@/,r:0},{cN:"doctag",b:"@[A-Za-z]+"}]}),e.CLCM,e.CBCM,e.ASM,e.QSM,{cN:"class",bK:"class interface",e:/[{;=]/,eE:!0,k:"class interface",i:/[:"\[\]]/,c:[{bK:"extends implements"},e.UTM]},{bK:"new throw return else",r:0},{cN:"function",b:"("+a+"\\s+)+"+e.UIR+"\\s*\\(",rB:!0,e:/[{;=]/,eE:!0,k:t,c:[{b:e.UIR+"\\s*\\(",rB:!0,r:0,c:[e.UTM]},{cN:"params",b:/\(/,e:/\)/,k:t,r:0,c:[e.ASM,e.QSM,e.CNM,e.CBCM]},e.CLCM,e.CBCM]},c,{cN:"meta",b:"@[A-Za-z]+"}]}});hljs.registerLanguage("php",function(e){var c={b:"\\$+[a-zA-Z_-ÿ][a-zA-Z0-9_-ÿ]*"},a={cN:"meta",b:/<\?(php)?|\?>/},i={cN:"string",c:[e.BE,a],v:[{b:'b"',e:'"'},{b:"b'",e:"'"},e.inherit(e.ASM,{i:null}),e.inherit(e.QSM,{i:null})]},t={v:[e.BNM,e.CNM]};return{aliases:["php3","php4","php5","php6"],cI:!0,k:"and include_once list abstract global private echo interface as static endswitch array null if endwhile or const for endforeach self var while isset public protected exit foreach throw elseif include __FILE__ empty require_once do xor return parent clone use __CLASS__ __LINE__ else break print eval new catch __METHOD__ case exception default die require __FUNCTION__ enddeclare final try switch continue endfor endif declare unset true false trait goto instanceof insteadof __DIR__ __NAMESPACE__ yield finally",c:[e.CLCM,e.HCM,e.C("/\\*","\\*/",{c:[{cN:"doctag",b:"@[A-Za-z]+"},a]}),e.C("__halt_compiler.+?;",!1,{eW:!0,k:"__halt_compiler",l:e.UIR}),{cN:"string",b:/<<<['"]?\w+['"]?$/,e:/^\w+;?$/,c:[e.BE,{cN:"subst",v:[{b:/\$\w+/},{b:/\{\$/,e:/\}/}]}]},a,c,{b:/(::|->)+[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/},{cN:"function",bK:"function",e:/[;{]/,eE:!0,i:"\\$|\\[|%",c:[e.UTM,{cN:"params",b:"\\(",e:"\\)",c:["self",c,e.CBCM,i,t]}]},{cN:"class",bK:"class interface",e:"{",eE:!0,i:/[:\(\$"]/,c:[{bK:"extends implements"},e.UTM]},{bK:"namespace",e:";",i:/[\.']/,c:[e.UTM]},{bK:"use",e:";",c:[e.UTM]},{b:"=>"},i,t]}});hljs.registerLanguage("ini",function(e){var b={cN:"string",c:[e.BE],v:[{b:"'''",e:"'''",r:10},{b:'"""',e:'"""',r:10},{b:'"',e:'"'},{b:"'",e:"'"}]};return{aliases:["toml"],cI:!0,i:/\S/,c:[e.C(";","$"),e.HCM,{cN:"section",b:/^\s*\[+/,e:/\]+/},{b:/^[a-z0-9\[\]_-]+\s*=\s*/,e:"$",rB:!0,c:[{cN:"attr",b:/[a-z0-9\[\]_-]+/},{b:/=/,eW:!0,r:0,c:[{cN:"literal",b:/\bon|off|true|false|yes|no\b/},{cN:"variable",v:[{b:/\$[\w\d"][\w\d_]*/},{b:/\$\{(.*?)}/}]},b,{cN:"number",b:/([\+\-]+)?[\d]+_[\d_]+/},e.NM]}]}]}});hljs.registerLanguage("http",function(e){var t="HTTP/[0-9\\.]+";return{aliases:["https"],i:"\\S",c:[{b:"^"+t,e:"$",c:[{cN:"number",b:"\\b\\d{3}\\b"}]},{b:"^[A-Z]+ (.*?) "+t+"$",rB:!0,e:"$",c:[{cN:"string",b:" ",e:" ",eB:!0,eE:!0},{b:t},{cN:"keyword",b:"[A-Z]+"}]},{cN:"attribute",b:"^\\w",e:": ",eE:!0,i:"\\n|\\s|=",starts:{e:"$",r:0}},{b:"\\n\\n",starts:{sL:[],eW:!0}}]}});hljs.registerLanguage("sql",function(e){var t=e.C("--","$");return{cI:!0,i:/[<>{}*]/,c:[{bK:"begin end start commit rollback savepoint lock alter create drop rename call delete do handler insert load replace select truncate update set show pragma grant merge describe use explain help declare prepare execute deallocate release unlock purge reset change stop analyze cache flush optimize repair kill install uninstall checksum restore check backup revoke",e:/;/,eW:!0,k:{keyword:"abort abs absolute acc acce accep accept access accessed accessible account acos action activate add addtime admin administer advanced advise aes_decrypt aes_encrypt after agent aggregate ali alia alias allocate allow alter always analyze ancillary and any anydata anydataset anyschema anytype apply archive archived archivelog are as asc ascii asin assembly assertion associate asynchronous at atan atn2 attr attri attrib attribu attribut attribute attributes audit authenticated authentication authid authors auto autoallocate autodblink autoextend automatic availability avg backup badfile basicfile before begin beginning benchmark between bfile bfile_base big bigfile bin binary_double binary_float binlog bit_and bit_count bit_length bit_or bit_xor bitmap blob_base block blocksize body both bound buffer_cache buffer_pool build bulk by byte byteordermark bytes c cache caching call calling cancel capacity cascade cascaded case cast catalog category ceil ceiling chain change changed char_base char_length character_length characters characterset charindex charset charsetform charsetid check checksum checksum_agg child choose chr chunk class cleanup clear client clob clob_base clone close cluster_id cluster_probability cluster_set clustering coalesce coercibility col collate collation collect colu colum column column_value columns columns_updated comment commit compact compatibility compiled complete composite_limit compound compress compute concat concat_ws concurrent confirm conn connec connect connect_by_iscycle connect_by_isleaf connect_by_root connect_time connection consider consistent constant constraint constraints constructor container content contents context contributors controlfile conv convert convert_tz corr corr_k corr_s corresponding corruption cos cost count count_big counted covar_pop covar_samp cpu_per_call cpu_per_session crc32 create creation critical cross cube cume_dist curdate current current_date current_time current_timestamp current_user cursor curtime customdatum cycle d data database databases datafile datafiles datalength date_add date_cache date_format date_sub dateadd datediff datefromparts datename datepart datetime2fromparts day day_to_second dayname dayofmonth dayofweek dayofyear days db_role_change dbtimezone ddl deallocate declare decode decompose decrement decrypt deduplicate def defa defau defaul default defaults deferred defi defin define degrees delayed delegate delete delete_all delimited demand dense_rank depth dequeue des_decrypt des_encrypt des_key_file desc descr descri describ describe descriptor deterministic diagnostics difference dimension direct_load directory disable disable_all disallow disassociate discardfile disconnect diskgroup distinct distinctrow distribute distributed div do document domain dotnet double downgrade drop dumpfile duplicate duration e each edition editionable editions element ellipsis else elsif elt empty enable enable_all enclosed encode encoding encrypt end end-exec endian enforced engine engines enqueue enterprise entityescaping eomonth error errors escaped evalname evaluate event eventdata events except exception exceptions exchange exclude excluding execu execut execute exempt exists exit exp expire explain export export_set extended extent external external_1 external_2 externally extract f failed failed_login_attempts failover failure far fast feature_set feature_value fetch field fields file file_name_convert filesystem_like_logging final finish first first_value fixed flash_cache flashback floor flush following follows for forall force form forma format found found_rows freelist freelists freepools fresh from from_base64 from_days ftp full function g general generated get get_format get_lock getdate getutcdate global global_name globally go goto grant grants greatest group group_concat group_id grouping grouping_id groups gtid_subtract guarantee guard handler hash hashkeys having hea head headi headin heading heap help hex hierarchy high high_priority hosts hour http i id ident_current ident_incr ident_seed identified identity idle_time if ifnull ignore iif ilike ilm immediate import in include including increment index indexes indexing indextype indicator indices inet6_aton inet6_ntoa inet_aton inet_ntoa infile initial initialized initially initrans inmemory inner innodb input insert install instance instantiable instr interface interleaved intersect into invalidate invisible is is_free_lock is_ipv4 is_ipv4_compat is_not is_not_null is_used_lock isdate isnull isolation iterate java join json json_exists k keep keep_duplicates key keys kill l language large last last_day last_insert_id last_value lax lcase lead leading least leaves left len lenght length less level levels library like like2 like4 likec limit lines link list listagg little ln load load_file lob lobs local localtime localtimestamp locate locator lock locked log log10 log2 logfile logfiles logging logical logical_reads_per_call logoff logon logs long loop low low_priority lower lpad lrtrim ltrim m main make_set makedate maketime managed management manual map mapping mask master master_pos_wait match matched materialized max maxextents maximize maxinstances maxlen maxlogfiles maxloghistory maxlogmembers maxsize maxtrans md5 measures median medium member memcompress memory merge microsecond mid migration min minextents minimum mining minus minute minvalue missing mod mode model modification modify module monitoring month months mount move movement multiset mutex n name name_const names nan national native natural nav nchar nclob nested never new newline next nextval no no_write_to_binlog noarchivelog noaudit nobadfile nocheck nocompress nocopy nocycle nodelay nodiscardfile noentityescaping noguarantee nokeep nologfile nomapping nomaxvalue nominimize nominvalue nomonitoring none noneditionable nonschema noorder nopr nopro noprom nopromp noprompt norely noresetlogs noreverse normal norowdependencies noschemacheck noswitch not nothing notice notrim novalidate now nowait nth_value nullif nulls num numb numbe nvarchar nvarchar2 object ocicoll ocidate ocidatetime ociduration ociinterval ociloblocator ocinumber ociref ocirefcursor ocirowid ocistring ocitype oct octet_length of off offline offset oid oidindex old on online only opaque open operations operator optimal optimize option optionally or oracle oracle_date oradata ord ordaudio orddicom orddoc order ordimage ordinality ordvideo organization orlany orlvary out outer outfile outline output over overflow overriding p package pad parallel parallel_enable parameters parent parse partial partition partitions pascal passing password password_grace_time password_lock_time password_reuse_max password_reuse_time password_verify_function patch path patindex pctincrease pctthreshold pctused pctversion percent percent_rank percentile_cont percentile_disc performance period period_add period_diff permanent physical pi pipe pipelined pivot pluggable plugin policy position post_transaction pow power pragma prebuilt precedes preceding precision prediction prediction_cost prediction_details prediction_probability prediction_set prepare present preserve prior priority private private_sga privileges procedural procedure procedure_analyze processlist profiles project prompt protection public publishingservername purge quarter query quick quiesce quota quotename radians raise rand range rank raw read reads readsize rebuild record records recover recovery recursive recycle redo reduced ref reference referenced references referencing refresh regexp_like register regr_avgx regr_avgy regr_count regr_intercept regr_r2 regr_slope regr_sxx regr_sxy reject rekey relational relative relaylog release release_lock relies_on relocate rely rem remainder rename repair repeat replace replicate replication required reset resetlogs resize resource respect restore restricted result result_cache resumable resume retention return returning returns reuse reverse revoke right rlike role roles rollback rolling rollup round row row_count rowdependencies rowid rownum rows rtrim rules safe salt sample save savepoint sb1 sb2 sb4 scan schema schemacheck scn scope scroll sdo_georaster sdo_topo_geometry search sec_to_time second section securefile security seed segment select self sequence sequential serializable server servererror session session_user sessions_per_user set sets settings sha sha1 sha2 share shared shared_pool short show shrink shutdown si_averagecolor si_colorhistogram si_featurelist si_positionalcolor si_stillimage si_texture siblings sid sign sin size size_t sizes skip slave sleep smalldatetimefromparts smallfile snapshot some soname sort soundex source space sparse spfile split sql sql_big_result sql_buffer_result sql_cache sql_calc_found_rows sql_small_result sql_variant_property sqlcode sqldata sqlerror sqlname sqlstate sqrt square standalone standby start starting startup statement static statistics stats_binomial_test stats_crosstab stats_ks_test stats_mode stats_mw_test stats_one_way_anova stats_t_test_ stats_t_test_indep stats_t_test_one stats_t_test_paired stats_wsr_test status std stddev stddev_pop stddev_samp stdev stop storage store stored str str_to_date straight_join strcmp strict string struct stuff style subdate subpartition subpartitions substitutable substr substring subtime subtring_index subtype success sum suspend switch switchoffset switchover sync synchronous synonym sys sys_xmlagg sysasm sysaux sysdate sysdatetimeoffset sysdba sysoper system system_user sysutcdatetime t table tables tablespace tan tdo template temporary terminated tertiary_weights test than then thread through tier ties time time_format time_zone timediff timefromparts timeout timestamp timestampadd timestampdiff timezone_abbr timezone_minute timezone_region to to_base64 to_date to_days to_seconds todatetimeoffset trace tracking transaction transactional translate translation treat trigger trigger_nestlevel triggers trim truncate try_cast try_convert try_parse type ub1 ub2 ub4 ucase unarchived unbounded uncompress under undo unhex unicode uniform uninstall union unique unix_timestamp unknown unlimited unlock unpivot unrecoverable unsafe unsigned until untrusted unusable unused update updated upgrade upped upper upsert url urowid usable usage use use_stored_outlines user user_data user_resources users using utc_date utc_timestamp uuid uuid_short validate validate_password_strength validation valist value values var var_samp varcharc vari varia variab variabl variable variables variance varp varraw varrawc varray verify version versions view virtual visible void wait wallet warning warnings week weekday weekofyear wellformed when whene whenev wheneve whenever where while whitespace with within without work wrapped xdb xml xmlagg xmlattributes xmlcast xmlcolattval xmlelement xmlexists xmlforest xmlindex xmlnamespaces xmlpi xmlquery xmlroot xmlschema xmlserialize xmltable xmltype xor year year_to_month years yearweek",literal:"true false null",built_in:"array bigint binary bit blob boolean char character date dec decimal float int int8 integer interval number numeric real record serial serial8 smallint text varchar varying void"},c:[{cN:"string",b:"'",e:"'",c:[e.BE,{b:"''"}]},{cN:"string",b:'"',e:'"',c:[e.BE,{b:'""'}]},{cN:"string",b:"`",e:"`",c:[e.BE]},e.CNM,e.CBCM,t]},e.CBCM,t]}});hljs.registerLanguage("rust",function(e){var t="([uif](8|16|32|64|size))?",r=e.inherit(e.CBCM);r.c.push("self");var n="Copy Send Sized Sync Drop Fn FnMut FnOnce drop Box ToOwned Clone PartialEq PartialOrd Eq Ord AsRef AsMut Into From Default Iterator Extend IntoIterator DoubleEndedIterator ExactSizeIterator Option Result SliceConcatExt String ToString Vec assert! assert_eq! bitflags! bytes! cfg! col! concat! concat_idents! debug_assert! debug_assert_eq! env! panic! file! format! format_args! include_bin! include_str! line! local_data_key! module_path! option_env! print! println! select! stringify! try! unimplemented! unreachable! vec! write! writeln!";return{aliases:["rs"],k:{keyword:"alignof as be box break const continue crate do else enum extern false fn for if impl in let loop match mod mut offsetof once priv proc pub pure ref return self Self sizeof static struct super trait true type typeof unsafe unsized use virtual while where yield int i8 i16 i32 i64 uint u8 u32 u64 float f32 f64 str char bool",literal:"true false Some None Ok Err",built_in:n},l:e.IR+"!?",i:""}]}}); -------------------------------------------------------------------------------- /lib/render.js: -------------------------------------------------------------------------------- 1 | (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o'); 40 | } else if (change.removed) { 41 | ret.push(''); 42 | } 43 | 44 | ret.push(escapeHTML(change.value)); 45 | 46 | if (change.added) { 47 | ret.push(''); 48 | } else if (change.removed) { 49 | ret.push(''); 50 | } 51 | } 52 | return ret.join(''); 53 | } 54 | 55 | function escapeHTML(s) { 56 | var n = s; 57 | n = n.replace(/&/g, '&'); 58 | n = n.replace(//g, '>'); 60 | n = n.replace(/"/g, '"'); 61 | 62 | return n; 63 | } 64 | 65 | 66 | },{}],3:[function(require,module,exports){ 67 | 'use strict'; 68 | 69 | exports.__esModule = true; 70 | exports['default'] = Diff; 71 | 72 | function Diff() {} 73 | 74 | Diff.prototype = { 75 | diff: function diff(oldString, newString) { 76 | var options = arguments.length <= 2 || arguments[2] === undefined ? {} : arguments[2]; 77 | 78 | var callback = options.callback; 79 | if (typeof options === 'function') { 80 | callback = options; 81 | options = {}; 82 | } 83 | this.options = options; 84 | 85 | var self = this; 86 | 87 | function done(value) { 88 | if (callback) { 89 | setTimeout(function () { 90 | callback(undefined, value); 91 | }, 0); 92 | return true; 93 | } else { 94 | return value; 95 | } 96 | } 97 | 98 | // Allow subclasses to massage the input prior to running 99 | oldString = this.castInput(oldString); 100 | newString = this.castInput(newString); 101 | 102 | oldString = this.removeEmpty(this.tokenize(oldString)); 103 | newString = this.removeEmpty(this.tokenize(newString)); 104 | 105 | var newLen = newString.length, 106 | oldLen = oldString.length; 107 | var editLength = 1; 108 | var maxEditLength = newLen + oldLen; 109 | var bestPath = [{ newPos: -1, components: [] }]; 110 | 111 | // Seed editLength = 0, i.e. the content starts with the same values 112 | var oldPos = this.extractCommon(bestPath[0], newString, oldString, 0); 113 | if (bestPath[0].newPos + 1 >= newLen && oldPos + 1 >= oldLen) { 114 | // Identity per the equality and tokenizer 115 | return done([{ value: newString.join(''), count: newString.length }]); 116 | } 117 | 118 | // Main worker method. checks all permutations of a given edit length for acceptance. 119 | function execEditLength() { 120 | for (var diagonalPath = -1 * editLength; diagonalPath <= editLength; diagonalPath += 2) { 121 | var basePath = undefined; 122 | var addPath = bestPath[diagonalPath - 1], 123 | removePath = bestPath[diagonalPath + 1], 124 | _oldPos = (removePath ? removePath.newPos : 0) - diagonalPath; 125 | if (addPath) { 126 | // No one else is going to attempt to use this value, clear it 127 | bestPath[diagonalPath - 1] = undefined; 128 | } 129 | 130 | var canAdd = addPath && addPath.newPos + 1 < newLen, 131 | canRemove = removePath && 0 <= _oldPos && _oldPos < oldLen; 132 | if (!canAdd && !canRemove) { 133 | // If this path is a terminal then prune 134 | bestPath[diagonalPath] = undefined; 135 | continue; 136 | } 137 | 138 | // Select the diagonal that we want to branch from. We select the prior 139 | // path whose position in the new string is the farthest from the origin 140 | // and does not pass the bounds of the diff graph 141 | if (!canAdd || canRemove && addPath.newPos < removePath.newPos) { 142 | basePath = clonePath(removePath); 143 | self.pushComponent(basePath.components, undefined, true); 144 | } else { 145 | basePath = addPath; // No need to clone, we've pulled it from the list 146 | basePath.newPos++; 147 | self.pushComponent(basePath.components, true, undefined); 148 | } 149 | 150 | _oldPos = self.extractCommon(basePath, newString, oldString, diagonalPath); 151 | 152 | // If we have hit the end of both strings, then we are done 153 | if (basePath.newPos + 1 >= newLen && _oldPos + 1 >= oldLen) { 154 | return done(buildValues(self, basePath.components, newString, oldString, self.useLongestToken)); 155 | } else { 156 | // Otherwise track this path as a potential candidate and continue. 157 | bestPath[diagonalPath] = basePath; 158 | } 159 | } 160 | 161 | editLength++; 162 | } 163 | 164 | // Performs the length of edit iteration. Is a bit fugly as this has to support the 165 | // sync and async mode which is never fun. Loops over execEditLength until a value 166 | // is produced. 167 | if (callback) { 168 | (function exec() { 169 | setTimeout(function () { 170 | // This should not happen, but we want to be safe. 171 | /* istanbul ignore next */ 172 | if (editLength > maxEditLength) { 173 | return callback(); 174 | } 175 | 176 | if (!execEditLength()) { 177 | exec(); 178 | } 179 | }, 0); 180 | })(); 181 | } else { 182 | while (editLength <= maxEditLength) { 183 | var ret = execEditLength(); 184 | if (ret) { 185 | return ret; 186 | } 187 | } 188 | } 189 | }, 190 | 191 | pushComponent: function pushComponent(components, added, removed) { 192 | var last = components[components.length - 1]; 193 | if (last && last.added === added && last.removed === removed) { 194 | // We need to clone here as the component clone operation is just 195 | // as shallow array clone 196 | components[components.length - 1] = { count: last.count + 1, added: added, removed: removed }; 197 | } else { 198 | components.push({ count: 1, added: added, removed: removed }); 199 | } 200 | }, 201 | extractCommon: function extractCommon(basePath, newString, oldString, diagonalPath) { 202 | var newLen = newString.length, 203 | oldLen = oldString.length, 204 | newPos = basePath.newPos, 205 | oldPos = newPos - diagonalPath, 206 | commonCount = 0; 207 | while (newPos + 1 < newLen && oldPos + 1 < oldLen && this.equals(newString[newPos + 1], oldString[oldPos + 1])) { 208 | newPos++; 209 | oldPos++; 210 | commonCount++; 211 | } 212 | 213 | if (commonCount) { 214 | basePath.components.push({ count: commonCount }); 215 | } 216 | 217 | basePath.newPos = newPos; 218 | return oldPos; 219 | }, 220 | 221 | equals: function equals(left, right) { 222 | return left === right; 223 | }, 224 | removeEmpty: function removeEmpty(array) { 225 | var ret = []; 226 | for (var i = 0; i < array.length; i++) { 227 | if (array[i]) { 228 | ret.push(array[i]); 229 | } 230 | } 231 | return ret; 232 | }, 233 | castInput: function castInput(value) { 234 | return value; 235 | }, 236 | tokenize: function tokenize(value) { 237 | return value.split(''); 238 | } 239 | }; 240 | 241 | function buildValues(diff, components, newString, oldString, useLongestToken) { 242 | var componentPos = 0, 243 | componentLen = components.length, 244 | newPos = 0, 245 | oldPos = 0; 246 | 247 | for (; componentPos < componentLen; componentPos++) { 248 | var component = components[componentPos]; 249 | if (!component.removed) { 250 | if (!component.added && useLongestToken) { 251 | var value = newString.slice(newPos, newPos + component.count); 252 | value = value.map(function (value, i) { 253 | var oldValue = oldString[oldPos + i]; 254 | return oldValue.length > value.length ? oldValue : value; 255 | }); 256 | 257 | component.value = value.join(''); 258 | } else { 259 | component.value = newString.slice(newPos, newPos + component.count).join(''); 260 | } 261 | newPos += component.count; 262 | 263 | // Common case 264 | if (!component.added) { 265 | oldPos += component.count; 266 | } 267 | } else { 268 | component.value = oldString.slice(oldPos, oldPos + component.count).join(''); 269 | oldPos += component.count; 270 | 271 | // Reverse add and remove so removes are output first to match common convention 272 | // The diffing algorithm is tied to add then remove output and this is the simplest 273 | // route to get the desired output with minimal overhead. 274 | if (componentPos && components[componentPos - 1].added) { 275 | var tmp = components[componentPos - 1]; 276 | components[componentPos - 1] = components[componentPos]; 277 | components[componentPos] = tmp; 278 | } 279 | } 280 | } 281 | 282 | // Special case handle for when one terminal is ignored. For this case we merge the 283 | // terminal into the prior string and drop the change. 284 | var lastComponent = components[componentLen - 1]; 285 | if ((lastComponent.added || lastComponent.removed) && diff.equals('', lastComponent.value)) { 286 | components[componentLen - 2].value += lastComponent.value; 287 | components.pop(); 288 | } 289 | 290 | return components; 291 | } 292 | 293 | function clonePath(path) { 294 | return { newPos: path.newPos, components: path.components.slice(0) }; 295 | } 296 | module.exports = exports['default']; 297 | 298 | 299 | },{}],4:[function(require,module,exports){ 300 | 'use strict'; 301 | 302 | exports.__esModule = true; 303 | exports.diffChars = diffChars; 304 | // istanbul ignore next 305 | 306 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } 307 | 308 | var _base = require('./base'); 309 | 310 | var _base2 = _interopRequireDefault(_base); 311 | 312 | var characterDiff = new _base2['default'](); 313 | exports.characterDiff = characterDiff; 314 | 315 | function diffChars(oldStr, newStr, callback) { 316 | return characterDiff.diff(oldStr, newStr, callback); 317 | } 318 | 319 | 320 | },{"./base":3}],5:[function(require,module,exports){ 321 | 'use strict'; 322 | 323 | exports.__esModule = true; 324 | exports.diffCss = diffCss; 325 | // istanbul ignore next 326 | 327 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } 328 | 329 | var _base = require('./base'); 330 | 331 | var _base2 = _interopRequireDefault(_base); 332 | 333 | var cssDiff = new _base2['default'](); 334 | exports.cssDiff = cssDiff; 335 | cssDiff.tokenize = function (value) { 336 | return value.split(/([{}:;,]|\s+)/); 337 | }; 338 | 339 | function diffCss(oldStr, newStr, callback) { 340 | return cssDiff.diff(oldStr, newStr, callback); 341 | } 342 | 343 | 344 | },{"./base":3}],6:[function(require,module,exports){ 345 | 'use strict'; 346 | 347 | exports.__esModule = true; 348 | exports.diffJson = diffJson; 349 | exports.canonicalize = canonicalize; 350 | // istanbul ignore next 351 | 352 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } 353 | 354 | var _base = require('./base'); 355 | 356 | var _base2 = _interopRequireDefault(_base); 357 | 358 | var _line = require('./line'); 359 | 360 | var objectPrototypeToString = Object.prototype.toString; 361 | 362 | var jsonDiff = new _base2['default'](); 363 | exports.jsonDiff = jsonDiff; 364 | // Discriminate between two lines of pretty-printed, serialized JSON where one of them has a 365 | // dangling comma and the other doesn't. Turns out including the dangling comma yields the nicest output: 366 | jsonDiff.useLongestToken = true; 367 | 368 | jsonDiff.tokenize = _line.lineDiff.tokenize; 369 | jsonDiff.castInput = function (value) { 370 | return typeof value === 'string' ? value : JSON.stringify(canonicalize(value), undefined, ' '); 371 | }; 372 | jsonDiff.equals = function (left, right) { 373 | return _base2['default'].prototype.equals(left.replace(/,([\r\n])/g, '$1'), right.replace(/,([\r\n])/g, '$1')); 374 | }; 375 | 376 | function diffJson(oldObj, newObj, callback) { 377 | return jsonDiff.diff(oldObj, newObj, callback); 378 | } 379 | 380 | // This function handles the presence of circular references by bailing out when encountering an 381 | // object that is already on the "stack" of items being processed. 382 | 383 | function canonicalize(obj, stack, replacementStack) { 384 | stack = stack || []; 385 | replacementStack = replacementStack || []; 386 | 387 | var i = undefined; 388 | 389 | for (i = 0; i < stack.length; i += 1) { 390 | if (stack[i] === obj) { 391 | return replacementStack[i]; 392 | } 393 | } 394 | 395 | var canonicalizedObj = undefined; 396 | 397 | if ('[object Array]' === objectPrototypeToString.call(obj)) { 398 | stack.push(obj); 399 | canonicalizedObj = new Array(obj.length); 400 | replacementStack.push(canonicalizedObj); 401 | for (i = 0; i < obj.length; i += 1) { 402 | canonicalizedObj[i] = canonicalize(obj[i], stack, replacementStack); 403 | } 404 | stack.pop(); 405 | replacementStack.pop(); 406 | } else if (typeof obj === 'object' && obj !== null) { 407 | stack.push(obj); 408 | canonicalizedObj = {}; 409 | replacementStack.push(canonicalizedObj); 410 | var sortedKeys = [], 411 | key = undefined; 412 | for (key in obj) { 413 | /* istanbul ignore else */ 414 | if (obj.hasOwnProperty(key)) { 415 | sortedKeys.push(key); 416 | } 417 | } 418 | sortedKeys.sort(); 419 | for (i = 0; i < sortedKeys.length; i += 1) { 420 | key = sortedKeys[i]; 421 | canonicalizedObj[key] = canonicalize(obj[key], stack, replacementStack); 422 | } 423 | stack.pop(); 424 | replacementStack.pop(); 425 | } else { 426 | canonicalizedObj = obj; 427 | } 428 | return canonicalizedObj; 429 | } 430 | 431 | 432 | },{"./base":3,"./line":7}],7:[function(require,module,exports){ 433 | 'use strict'; 434 | 435 | exports.__esModule = true; 436 | exports.diffLines = diffLines; 437 | exports.diffTrimmedLines = diffTrimmedLines; 438 | // istanbul ignore next 439 | 440 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } 441 | 442 | var _base = require('./base'); 443 | 444 | var _base2 = _interopRequireDefault(_base); 445 | 446 | var _utilParams = require('../util/params'); 447 | 448 | var lineDiff = new _base2['default'](); 449 | exports.lineDiff = lineDiff; 450 | lineDiff.tokenize = function (value) { 451 | var retLines = [], 452 | linesAndNewlines = value.split(/(\n|\r\n)/); 453 | 454 | // Ignore the final empty token that occurs if the string ends with a new line 455 | if (!linesAndNewlines[linesAndNewlines.length - 1]) { 456 | linesAndNewlines.pop(); 457 | } 458 | 459 | // Merge the content and line separators into single tokens 460 | for (var i = 0; i < linesAndNewlines.length; i++) { 461 | var line = linesAndNewlines[i]; 462 | 463 | if (i % 2 && !this.options.newlineIsToken) { 464 | retLines[retLines.length - 1] += line; 465 | } else { 466 | if (this.options.ignoreWhitespace) { 467 | line = line.trim(); 468 | } 469 | retLines.push(line); 470 | } 471 | } 472 | 473 | return retLines; 474 | }; 475 | 476 | function diffLines(oldStr, newStr, callback) { 477 | return lineDiff.diff(oldStr, newStr, callback); 478 | } 479 | 480 | function diffTrimmedLines(oldStr, newStr, callback) { 481 | var options = _utilParams.generateOptions(callback, { ignoreWhitespace: true }); 482 | return lineDiff.diff(oldStr, newStr, options); 483 | } 484 | 485 | 486 | },{"../util/params":15,"./base":3}],8:[function(require,module,exports){ 487 | 'use strict'; 488 | 489 | exports.__esModule = true; 490 | exports.diffSentences = diffSentences; 491 | // istanbul ignore next 492 | 493 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } 494 | 495 | var _base = require('./base'); 496 | 497 | var _base2 = _interopRequireDefault(_base); 498 | 499 | var sentenceDiff = new _base2['default'](); 500 | exports.sentenceDiff = sentenceDiff; 501 | sentenceDiff.tokenize = function (value) { 502 | return value.split(/(\S.+?[.!?])(?=\s+|$)/); 503 | }; 504 | 505 | function diffSentences(oldStr, newStr, callback) { 506 | return sentenceDiff.diff(oldStr, newStr, callback); 507 | } 508 | 509 | 510 | },{"./base":3}],9:[function(require,module,exports){ 511 | 'use strict'; 512 | 513 | exports.__esModule = true; 514 | exports.diffWords = diffWords; 515 | exports.diffWordsWithSpace = diffWordsWithSpace; 516 | // istanbul ignore next 517 | 518 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } 519 | 520 | var _base = require('./base'); 521 | 522 | var _base2 = _interopRequireDefault(_base); 523 | 524 | var _utilParams = require('../util/params'); 525 | 526 | // Based on https://en.wikipedia.org/wiki/Latin_script_in_Unicode 527 | // 528 | // Ranges and exceptions: 529 | // Latin-1 Supplement, 0080–00FF 530 | // - U+00D7 × Multiplication sign 531 | // - U+00F7 ÷ Division sign 532 | // Latin Extended-A, 0100–017F 533 | // Latin Extended-B, 0180–024F 534 | // IPA Extensions, 0250–02AF 535 | // Spacing Modifier Letters, 02B0–02FF 536 | // - U+02C7 ˇ ˇ Caron 537 | // - U+02D8 ˘ ˘ Breve 538 | // - U+02D9 ˙ ˙ Dot Above 539 | // - U+02DA ˚ ˚ Ring Above 540 | // - U+02DB ˛ ˛ Ogonek 541 | // - U+02DC ˜ ˜ Small Tilde 542 | // - U+02DD ˝ ˝ Double Acute Accent 543 | // Latin Extended Additional, 1E00–1EFF 544 | var extendedWordChars = /^[A-Za-z\xC0-\u02C6\u02C8-\u02D7\u02DE-\u02FF\u1E00-\u1EFF]+$/; 545 | 546 | var reWhitespace = /\S/; 547 | 548 | var wordDiff = new _base2['default'](); 549 | exports.wordDiff = wordDiff; 550 | wordDiff.equals = function (left, right) { 551 | return left === right || this.options.ignoreWhitespace && !reWhitespace.test(left) && !reWhitespace.test(right); 552 | }; 553 | wordDiff.tokenize = function (value) { 554 | var tokens = value.split(/(\s+|\b)/); 555 | 556 | // Join the boundary splits that we do not consider to be boundaries. This is primarily the extended Latin character set. 557 | for (var i = 0; i < tokens.length - 1; i++) { 558 | // If we have an empty string in the next field and we have only word chars before and after, merge 559 | if (!tokens[i + 1] && tokens[i + 2] && extendedWordChars.test(tokens[i]) && extendedWordChars.test(tokens[i + 2])) { 560 | tokens[i] += tokens[i + 2]; 561 | tokens.splice(i + 1, 2); 562 | i--; 563 | } 564 | } 565 | 566 | return tokens; 567 | }; 568 | 569 | function diffWords(oldStr, newStr, callback) { 570 | var options = _utilParams.generateOptions(callback, { ignoreWhitespace: true }); 571 | return wordDiff.diff(oldStr, newStr, options); 572 | } 573 | 574 | function diffWordsWithSpace(oldStr, newStr, callback) { 575 | return wordDiff.diff(oldStr, newStr, callback); 576 | } 577 | 578 | 579 | },{"../util/params":15,"./base":3}],10:[function(require,module,exports){ 580 | /* See LICENSE file for terms of use */ 581 | 582 | /* 583 | * Text diff implementation. 584 | * 585 | * This library supports the following APIS: 586 | * JsDiff.diffChars: Character by character diff 587 | * JsDiff.diffWords: Word (as defined by \b regex) diff which ignores whitespace 588 | * JsDiff.diffLines: Line based diff 589 | * 590 | * JsDiff.diffCss: Diff targeted at CSS content 591 | * 592 | * These methods are based on the implementation proposed in 593 | * "An O(ND) Difference Algorithm and its Variations" (Myers, 1986). 594 | * http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.4.6927 595 | */ 596 | 'use strict'; 597 | 598 | exports.__esModule = true; 599 | // istanbul ignore next 600 | 601 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } 602 | 603 | var _diffBase = require('./diff/base'); 604 | 605 | var _diffBase2 = _interopRequireDefault(_diffBase); 606 | 607 | var _diffCharacter = require('./diff/character'); 608 | 609 | var _diffWord = require('./diff/word'); 610 | 611 | var _diffLine = require('./diff/line'); 612 | 613 | var _diffSentence = require('./diff/sentence'); 614 | 615 | var _diffCss = require('./diff/css'); 616 | 617 | var _diffJson = require('./diff/json'); 618 | 619 | var _patchApply = require('./patch/apply'); 620 | 621 | var _patchParse = require('./patch/parse'); 622 | 623 | var _patchCreate = require('./patch/create'); 624 | 625 | var _convertDmp = require('./convert/dmp'); 626 | 627 | var _convertXml = require('./convert/xml'); 628 | 629 | exports.Diff = _diffBase2['default']; 630 | exports.diffChars = _diffCharacter.diffChars; 631 | exports.diffWords = _diffWord.diffWords; 632 | exports.diffWordsWithSpace = _diffWord.diffWordsWithSpace; 633 | exports.diffLines = _diffLine.diffLines; 634 | exports.diffTrimmedLines = _diffLine.diffTrimmedLines; 635 | exports.diffSentences = _diffSentence.diffSentences; 636 | exports.diffCss = _diffCss.diffCss; 637 | exports.diffJson = _diffJson.diffJson; 638 | exports.structuredPatch = _patchCreate.structuredPatch; 639 | exports.createTwoFilesPatch = _patchCreate.createTwoFilesPatch; 640 | exports.createPatch = _patchCreate.createPatch; 641 | exports.applyPatch = _patchApply.applyPatch; 642 | exports.applyPatches = _patchApply.applyPatches; 643 | exports.parsePatch = _patchParse.parsePatch; 644 | exports.convertChangesToDMP = _convertDmp.convertChangesToDMP; 645 | exports.convertChangesToXML = _convertXml.convertChangesToXML; 646 | exports.canonicalize = _diffJson.canonicalize; 647 | 648 | 649 | },{"./convert/dmp":1,"./convert/xml":2,"./diff/base":3,"./diff/character":4,"./diff/css":5,"./diff/json":6,"./diff/line":7,"./diff/sentence":8,"./diff/word":9,"./patch/apply":11,"./patch/create":12,"./patch/parse":13}],11:[function(require,module,exports){ 650 | 'use strict'; 651 | 652 | exports.__esModule = true; 653 | exports.applyPatch = applyPatch; 654 | exports.applyPatches = applyPatches; 655 | // istanbul ignore next 656 | 657 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } 658 | 659 | var _parse = require('./parse'); 660 | 661 | var _utilDistanceIterator = require('../util/distance-iterator'); 662 | 663 | var _utilDistanceIterator2 = _interopRequireDefault(_utilDistanceIterator); 664 | 665 | function applyPatch(source, uniDiff) { 666 | var options = arguments.length <= 2 || arguments[2] === undefined ? {} : arguments[2]; 667 | 668 | if (typeof uniDiff === 'string') { 669 | uniDiff = _parse.parsePatch(uniDiff); 670 | } 671 | 672 | if (Array.isArray(uniDiff)) { 673 | if (uniDiff.length > 1) { 674 | throw new Error('applyPatch only works with a single input.'); 675 | } 676 | 677 | uniDiff = uniDiff[0]; 678 | } 679 | 680 | // Apply the diff to the input 681 | var lines = source.split('\n'), 682 | hunks = uniDiff.hunks, 683 | compareLine = options.compareLine || function (lineNumber, line, operation, patchContent) { 684 | return line === patchContent; 685 | }, 686 | errorCount = 0, 687 | fuzzFactor = options.fuzzFactor || 0, 688 | minLine = 0, 689 | offset = 0, 690 | removeEOFNL = undefined, 691 | addEOFNL = undefined; 692 | 693 | /** 694 | * Checks if the hunk exactly fits on the provided location 695 | */ 696 | function hunkFits(hunk, toPos) { 697 | for (var j = 0; j < hunk.lines.length; j++) { 698 | var line = hunk.lines[j], 699 | operation = line[0], 700 | content = line.substr(1); 701 | 702 | if (operation === ' ' || operation === '-') { 703 | // Context sanity check 704 | if (!compareLine(toPos + 1, lines[toPos], operation, content)) { 705 | errorCount++; 706 | 707 | if (errorCount > fuzzFactor) { 708 | return false; 709 | } 710 | } 711 | toPos++; 712 | } 713 | } 714 | 715 | return true; 716 | } 717 | 718 | // Search best fit offsets for each hunk based on the previous ones 719 | for (var i = 0; i < hunks.length; i++) { 720 | var hunk = hunks[i], 721 | maxLine = lines.length - hunk.oldLines, 722 | localOffset = 0, 723 | toPos = offset + hunk.oldStart - 1; 724 | 725 | var iterator = _utilDistanceIterator2['default'](toPos, minLine, maxLine); 726 | 727 | for (; localOffset !== undefined; localOffset = iterator()) { 728 | if (hunkFits(hunk, toPos + localOffset)) { 729 | hunk.offset = offset += localOffset; 730 | break; 731 | } 732 | } 733 | 734 | if (localOffset === undefined) { 735 | return false; 736 | } 737 | 738 | // Set lower text limit to end of the current hunk, so next ones don't try 739 | // to fit over already patched text 740 | minLine = hunk.offset + hunk.oldStart + hunk.oldLines; 741 | } 742 | 743 | // Apply patch hunks 744 | for (var i = 0; i < hunks.length; i++) { 745 | var hunk = hunks[i], 746 | toPos = hunk.offset + hunk.newStart - 1; 747 | 748 | for (var j = 0; j < hunk.lines.length; j++) { 749 | var line = hunk.lines[j], 750 | operation = line[0], 751 | content = line.substr(1); 752 | 753 | if (operation === ' ') { 754 | toPos++; 755 | } else if (operation === '-') { 756 | lines.splice(toPos, 1); 757 | /* istanbul ignore else */ 758 | } else if (operation === '+') { 759 | lines.splice(toPos, 0, content); 760 | toPos++; 761 | } else if (operation === '\\') { 762 | var previousOperation = hunk.lines[j - 1] ? hunk.lines[j - 1][0] : null; 763 | if (previousOperation === '+') { 764 | removeEOFNL = true; 765 | } else if (previousOperation === '-') { 766 | addEOFNL = true; 767 | } 768 | } 769 | } 770 | } 771 | 772 | // Handle EOFNL insertion/removal 773 | if (removeEOFNL) { 774 | while (!lines[lines.length - 1]) { 775 | lines.pop(); 776 | } 777 | } else if (addEOFNL) { 778 | lines.push(''); 779 | } 780 | return lines.join('\n'); 781 | } 782 | 783 | // Wrapper that supports multiple file patches via callbacks. 784 | 785 | function applyPatches(uniDiff, options) { 786 | if (typeof uniDiff === 'string') { 787 | uniDiff = _parse.parsePatch(uniDiff); 788 | } 789 | 790 | var currentIndex = 0; 791 | function processIndex() { 792 | var index = uniDiff[currentIndex++]; 793 | if (!index) { 794 | return options.complete(); 795 | } 796 | 797 | options.loadFile(index, function (err, data) { 798 | if (err) { 799 | return options.complete(err); 800 | } 801 | 802 | var updatedContent = applyPatch(data, index, options); 803 | options.patched(index, updatedContent); 804 | 805 | setTimeout(processIndex, 0); 806 | }); 807 | } 808 | processIndex(); 809 | } 810 | 811 | 812 | },{"../util/distance-iterator":14,"./parse":13}],12:[function(require,module,exports){ 813 | 'use strict'; 814 | 815 | exports.__esModule = true; 816 | exports.structuredPatch = structuredPatch; 817 | exports.createTwoFilesPatch = createTwoFilesPatch; 818 | exports.createPatch = createPatch; 819 | // istanbul ignore next 820 | 821 | function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; return arr2; } else { return Array.from(arr); } } 822 | 823 | var _diffLine = require('../diff/line'); 824 | 825 | function structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options) { 826 | if (!options) { 827 | options = { context: 4 }; 828 | } 829 | 830 | var diff = _diffLine.diffLines(oldStr, newStr); 831 | diff.push({ value: '', lines: [] }); // Append an empty value to make cleanup easier 832 | 833 | function contextLines(lines) { 834 | return lines.map(function (entry) { 835 | return ' ' + entry; 836 | }); 837 | } 838 | 839 | var hunks = []; 840 | var oldRangeStart = 0, 841 | newRangeStart = 0, 842 | curRange = [], 843 | oldLine = 1, 844 | newLine = 1; 845 | 846 | var _loop = function (i) { 847 | var current = diff[i], 848 | lines = current.lines || current.value.replace(/\n$/, '').split('\n'); 849 | current.lines = lines; 850 | 851 | if (current.added || current.removed) { 852 | // istanbul ignore next 853 | 854 | var _curRange; 855 | 856 | // If we have previous context, start with that 857 | if (!oldRangeStart) { 858 | var prev = diff[i - 1]; 859 | oldRangeStart = oldLine; 860 | newRangeStart = newLine; 861 | 862 | if (prev) { 863 | curRange = options.context > 0 ? contextLines(prev.lines.slice(-options.context)) : []; 864 | oldRangeStart -= curRange.length; 865 | newRangeStart -= curRange.length; 866 | } 867 | } 868 | 869 | // Output our changes 870 | (_curRange = curRange).push.apply(_curRange, _toConsumableArray(lines.map(function (entry) { 871 | return (current.added ? '+' : '-') + entry; 872 | }))); 873 | 874 | // Track the updated file position 875 | if (current.added) { 876 | newLine += lines.length; 877 | } else { 878 | oldLine += lines.length; 879 | } 880 | } else { 881 | // Identical context lines. Track line changes 882 | if (oldRangeStart) { 883 | // Close out any changes that have been output (or join overlapping) 884 | if (lines.length <= options.context * 2 && i < diff.length - 2) { 885 | // istanbul ignore next 886 | 887 | var _curRange2; 888 | 889 | // Overlapping 890 | (_curRange2 = curRange).push.apply(_curRange2, _toConsumableArray(contextLines(lines))); 891 | } else { 892 | // istanbul ignore next 893 | 894 | var _curRange3; 895 | 896 | // end the range and output 897 | var contextSize = Math.min(lines.length, options.context); 898 | (_curRange3 = curRange).push.apply(_curRange3, _toConsumableArray(contextLines(lines.slice(0, contextSize)))); 899 | 900 | var hunk = { 901 | oldStart: oldRangeStart, 902 | oldLines: oldLine - oldRangeStart + contextSize, 903 | newStart: newRangeStart, 904 | newLines: newLine - newRangeStart + contextSize, 905 | lines: curRange 906 | }; 907 | if (i >= diff.length - 2 && lines.length <= options.context) { 908 | // EOF is inside this hunk 909 | var oldEOFNewline = /\n$/.test(oldStr); 910 | var newEOFNewline = /\n$/.test(newStr); 911 | if (lines.length == 0 && !oldEOFNewline) { 912 | // special case: old has no eol and no trailing context; no-nl can end up before adds 913 | curRange.splice(hunk.oldLines, 0, '\\ No newline at end of file'); 914 | } else if (!oldEOFNewline || !newEOFNewline) { 915 | curRange.push('\\ No newline at end of file'); 916 | } 917 | } 918 | hunks.push(hunk); 919 | 920 | oldRangeStart = 0; 921 | newRangeStart = 0; 922 | curRange = []; 923 | } 924 | } 925 | oldLine += lines.length; 926 | newLine += lines.length; 927 | } 928 | }; 929 | 930 | for (var i = 0; i < diff.length; i++) { 931 | _loop(i); 932 | } 933 | 934 | return { 935 | oldFileName: oldFileName, newFileName: newFileName, 936 | oldHeader: oldHeader, newHeader: newHeader, 937 | hunks: hunks 938 | }; 939 | } 940 | 941 | function createTwoFilesPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options) { 942 | var diff = structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options); 943 | 944 | var ret = []; 945 | if (oldFileName == newFileName) { 946 | ret.push('Index: ' + oldFileName); 947 | } 948 | ret.push('==================================================================='); 949 | ret.push('--- ' + diff.oldFileName + (typeof diff.oldHeader === 'undefined' ? '' : '\t' + diff.oldHeader)); 950 | ret.push('+++ ' + diff.newFileName + (typeof diff.newHeader === 'undefined' ? '' : '\t' + diff.newHeader)); 951 | 952 | for (var i = 0; i < diff.hunks.length; i++) { 953 | var hunk = diff.hunks[i]; 954 | ret.push('@@ -' + hunk.oldStart + ',' + hunk.oldLines + ' +' + hunk.newStart + ',' + hunk.newLines + ' @@'); 955 | ret.push.apply(ret, hunk.lines); 956 | } 957 | 958 | return ret.join('\n') + '\n'; 959 | } 960 | 961 | function createPatch(fileName, oldStr, newStr, oldHeader, newHeader, options) { 962 | return createTwoFilesPatch(fileName, fileName, oldStr, newStr, oldHeader, newHeader, options); 963 | } 964 | 965 | 966 | },{"../diff/line":7}],13:[function(require,module,exports){ 967 | 'use strict'; 968 | 969 | exports.__esModule = true; 970 | exports.parsePatch = parsePatch; 971 | 972 | function parsePatch(uniDiff) { 973 | var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; 974 | 975 | var diffstr = uniDiff.split('\n'), 976 | list = [], 977 | i = 0; 978 | 979 | function parseIndex() { 980 | var index = {}; 981 | list.push(index); 982 | 983 | // Parse diff metadata 984 | while (i < diffstr.length) { 985 | var line = diffstr[i]; 986 | 987 | // File header found, end parsing diff metadata 988 | if (/^(\-\-\-|\+\+\+|@@)\s/.test(line)) { 989 | break; 990 | } 991 | 992 | // Diff index 993 | var header = /^(?:Index:|diff(?: -r \w+)+)\s+(.+?)\s*$/.exec(line); 994 | if (header) { 995 | index.index = header[1]; 996 | } 997 | 998 | i++; 999 | } 1000 | 1001 | // Parse file headers if they are defined. Unified diff requires them, but 1002 | // there's no technical issues to have an isolated hunk without file header 1003 | parseFileHeader(index); 1004 | parseFileHeader(index); 1005 | 1006 | // Parse hunks 1007 | index.hunks = []; 1008 | 1009 | while (i < diffstr.length) { 1010 | var line = diffstr[i]; 1011 | 1012 | if (/^(Index:|diff|\-\-\-|\+\+\+)\s/.test(line)) { 1013 | break; 1014 | } else if (/^@@/.test(line)) { 1015 | index.hunks.push(parseHunk()); 1016 | } else if (line && options.strict) { 1017 | // Ignore unexpected content unless in strict mode 1018 | throw new Error('Unknown line ' + (i + 1) + ' ' + JSON.stringify(line)); 1019 | } else { 1020 | i++; 1021 | } 1022 | } 1023 | } 1024 | 1025 | // Parses the --- and +++ headers, if none are found, no lines 1026 | // are consumed. 1027 | function parseFileHeader(index) { 1028 | var fileHeader = /^(\-\-\-|\+\+\+)\s+(\S+)\s?(.+?)\s*$/.exec(diffstr[i]); 1029 | if (fileHeader) { 1030 | var keyPrefix = fileHeader[1] === '---' ? 'old' : 'new'; 1031 | index[keyPrefix + 'FileName'] = fileHeader[2]; 1032 | index[keyPrefix + 'Header'] = fileHeader[3]; 1033 | 1034 | i++; 1035 | } 1036 | } 1037 | 1038 | // Parses a hunk 1039 | // This assumes that we are at the start of a hunk. 1040 | function parseHunk() { 1041 | var chunkHeaderIndex = i, 1042 | chunkHeaderLine = diffstr[i++], 1043 | chunkHeader = chunkHeaderLine.split(/@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/); 1044 | 1045 | var hunk = { 1046 | oldStart: +chunkHeader[1], 1047 | oldLines: +chunkHeader[2] || 1, 1048 | newStart: +chunkHeader[3], 1049 | newLines: +chunkHeader[4] || 1, 1050 | lines: [] 1051 | }; 1052 | 1053 | var addCount = 0, 1054 | removeCount = 0; 1055 | for (; i < diffstr.length; i++) { 1056 | var operation = diffstr[i][0]; 1057 | 1058 | if (operation === '+' || operation === '-' || operation === ' ' || operation === '\\') { 1059 | hunk.lines.push(diffstr[i]); 1060 | 1061 | if (operation === '+') { 1062 | addCount++; 1063 | } else if (operation === '-') { 1064 | removeCount++; 1065 | } else if (operation === ' ') { 1066 | addCount++; 1067 | removeCount++; 1068 | } 1069 | } else { 1070 | break; 1071 | } 1072 | } 1073 | 1074 | // Handle the empty block count case 1075 | if (!addCount && hunk.newLines === 1) { 1076 | hunk.newLines = 0; 1077 | } 1078 | if (!removeCount && hunk.oldLines === 1) { 1079 | hunk.oldLines = 0; 1080 | } 1081 | 1082 | // Perform optional sanity checking 1083 | if (options.strict) { 1084 | if (addCount !== hunk.newLines) { 1085 | throw new Error('Added line count did not match for hunk at line ' + (chunkHeaderIndex + 1)); 1086 | } 1087 | if (removeCount !== hunk.oldLines) { 1088 | throw new Error('Removed line count did not match for hunk at line ' + (chunkHeaderIndex + 1)); 1089 | } 1090 | } 1091 | 1092 | return hunk; 1093 | } 1094 | 1095 | while (i < diffstr.length) { 1096 | parseIndex(); 1097 | } 1098 | 1099 | return list; 1100 | } 1101 | 1102 | 1103 | },{}],14:[function(require,module,exports){ 1104 | // Iterator that traverses in the range of [min, max], stepping 1105 | // by distance from a given start position. I.e. for [0, 4], with 1106 | "use strict"; 1107 | 1108 | exports.__esModule = true; 1109 | 1110 | exports["default"] = function (start, minLine, maxLine) { 1111 | var wantForward = true, 1112 | backwardExhausted = false, 1113 | forwardExhausted = false, 1114 | localOffset = 1; 1115 | 1116 | return function iterator() { 1117 | var _again = true; 1118 | 1119 | _function: while (_again) { 1120 | _again = false; 1121 | 1122 | if (wantForward && !forwardExhausted) { 1123 | if (backwardExhausted) { 1124 | localOffset++; 1125 | } else { 1126 | wantForward = false; 1127 | } 1128 | 1129 | // Check if trying to fit beyond text length, and if not, check it fits 1130 | // after offset location (or desired location on first iteration) 1131 | if (start + localOffset <= maxLine) { 1132 | return localOffset; 1133 | } 1134 | 1135 | forwardExhausted = true; 1136 | } 1137 | 1138 | if (!backwardExhausted) { 1139 | if (!forwardExhausted) { 1140 | wantForward = true; 1141 | } 1142 | 1143 | // Check if trying to fit before text beginning, and if not, check it fits 1144 | // before offset location 1145 | if (minLine <= start - localOffset) { 1146 | return - localOffset++; 1147 | } 1148 | 1149 | backwardExhausted = true; 1150 | _again = true; 1151 | continue _function; 1152 | } 1153 | 1154 | // We tried to fit hunk before text beginning and beyond text lenght, then 1155 | // hunk can't fit on the text. Return undefined 1156 | } 1157 | }; 1158 | }; 1159 | 1160 | module.exports = exports["default"]; 1161 | // start of 2, this will iterate 2, 3, 1, 4, 0. 1162 | 1163 | 1164 | },{}],15:[function(require,module,exports){ 1165 | 'use strict'; 1166 | 1167 | exports.__esModule = true; 1168 | exports.generateOptions = generateOptions; 1169 | 1170 | function generateOptions(options, defaults) { 1171 | if (typeof options === 'function') { 1172 | defaults.callback = options; 1173 | } else if (options) { 1174 | for (var _name in options) { 1175 | /* istanbul ignore else */ 1176 | if (options.hasOwnProperty(_name)) { 1177 | defaults[_name] = options[_name]; 1178 | } 1179 | } 1180 | } 1181 | return defaults; 1182 | } 1183 | 1184 | 1185 | },{}],16:[function(require,module,exports){ 1186 | /* 1187 | * 1188 | * Diff Parser (diff-parser.js) 1189 | * Author: rtfpessoa 1190 | * 1191 | */ 1192 | 1193 | (function(ctx, undefined) { 1194 | 1195 | var utils = require('./utils.js').Utils; 1196 | 1197 | var LINE_TYPE = { 1198 | INSERTS: 'd2h-ins', 1199 | DELETES: 'd2h-del', 1200 | INSERT_CHANGES: 'd2h-ins d2h-change', 1201 | DELETE_CHANGES: 'd2h-del d2h-change', 1202 | CONTEXT: 'd2h-cntx', 1203 | INFO: 'd2h-info' 1204 | }; 1205 | 1206 | function DiffParser() { 1207 | } 1208 | 1209 | DiffParser.prototype.LINE_TYPE = LINE_TYPE; 1210 | 1211 | DiffParser.prototype.generateDiffJson = function(diffInput) { 1212 | var files = []; 1213 | var currentFile = null; 1214 | var currentBlock = null; 1215 | var oldLine = null; 1216 | var newLine = null; 1217 | 1218 | var saveBlock = function() { 1219 | /* Add previous block(if exists) before start a new file */ 1220 | if (currentBlock) { 1221 | currentFile.blocks.push(currentBlock); 1222 | currentBlock = null; 1223 | } 1224 | }; 1225 | 1226 | var saveFile = function() { 1227 | /* 1228 | * Add previous file(if exists) before start a new one 1229 | * if it has name (to avoid binary files errors) 1230 | */ 1231 | if (currentFile && currentFile.newName) { 1232 | files.push(currentFile); 1233 | currentFile = null; 1234 | } 1235 | }; 1236 | 1237 | var startFile = function() { 1238 | saveBlock(); 1239 | saveFile(); 1240 | 1241 | /* Create file structure */ 1242 | currentFile = {}; 1243 | currentFile.blocks = []; 1244 | currentFile.deletedLines = 0; 1245 | currentFile.addedLines = 0; 1246 | }; 1247 | 1248 | var startBlock = function(line) { 1249 | saveBlock(); 1250 | 1251 | var values; 1252 | 1253 | if (values = /^@@ -(\d+),\d+ \+(\d+),\d+ @@.*/.exec(line)) { 1254 | currentFile.isCombined = false; 1255 | } else if (values = /^@@@ -(\d+),\d+ -\d+,\d+ \+(\d+),\d+ @@@.*/.exec(line)) { 1256 | currentFile.isCombined = true; 1257 | } else { 1258 | values = [0, 0]; 1259 | currentFile.isCombined = false; 1260 | } 1261 | 1262 | oldLine = values[1]; 1263 | newLine = values[2]; 1264 | 1265 | /* Create block metadata */ 1266 | currentBlock = {}; 1267 | currentBlock.lines = []; 1268 | currentBlock.oldStartLine = oldLine; 1269 | currentBlock.newStartLine = newLine; 1270 | currentBlock.header = line; 1271 | }; 1272 | 1273 | var createLine = function(line) { 1274 | var currentLine = {}; 1275 | currentLine.content = line; 1276 | 1277 | var newLinePrefixes = !currentFile.isCombined ? ['+'] : ['+', ' +']; 1278 | var delLinePrefixes = !currentFile.isCombined ? ['-'] : ['-', ' -']; 1279 | 1280 | /* Fill the line data */ 1281 | if (utils.startsWith(line, newLinePrefixes)) { 1282 | currentFile.addedLines++; 1283 | 1284 | currentLine.type = LINE_TYPE.INSERTS; 1285 | currentLine.oldNumber = null; 1286 | currentLine.newNumber = newLine++; 1287 | 1288 | currentBlock.lines.push(currentLine); 1289 | 1290 | } else if (utils.startsWith(line, delLinePrefixes)) { 1291 | currentFile.deletedLines++; 1292 | 1293 | currentLine.type = LINE_TYPE.DELETES; 1294 | currentLine.oldNumber = oldLine++; 1295 | currentLine.newNumber = null; 1296 | 1297 | currentBlock.lines.push(currentLine); 1298 | 1299 | } else { 1300 | currentLine.type = LINE_TYPE.CONTEXT; 1301 | currentLine.oldNumber = oldLine++; 1302 | currentLine.newNumber = newLine++; 1303 | 1304 | currentBlock.lines.push(currentLine); 1305 | } 1306 | }; 1307 | 1308 | var diffLines = diffInput.split('\n'); 1309 | 1310 | /* Diff */ 1311 | var oldMode = /^old mode (\d{6})/; 1312 | var newMode = /^new mode (\d{6})/; 1313 | var deletedFileMode = /^deleted file mode (\d{6})/; 1314 | var newFileMode = /^new file mode (\d{6})/; 1315 | 1316 | var copyFrom = /^copy from (.+)/; 1317 | var copyTo = /^copy to (.+)/; 1318 | 1319 | var renameFrom = /^rename from (.+)/; 1320 | var renameTo = /^rename to (.+)/; 1321 | 1322 | var similarityIndex = /^similarity index (\d+)%/; 1323 | var dissimilarityIndex = /^dissimilarity index (\d+)%/; 1324 | var index = /^index ([0-9a-z]+)..([0-9a-z]+) (\d{6})?/; 1325 | 1326 | /* Combined Diff */ 1327 | var combinedIndex = /^index ([0-9a-z]+),([0-9a-z]+)..([0-9a-z]+)/; 1328 | var combinedMode = /^mode (\d{6}),(\d{6})..(\d{6})/; 1329 | var combinedNewFile = /^new file mode (\d{6})/; 1330 | var combinedDeletedFile = /^deleted file mode (\d{6}),(\d{6})/; 1331 | 1332 | diffLines.forEach(function(line) { 1333 | // Unmerged paths, and possibly other non-diffable files 1334 | // https://github.com/scottgonzalez/pretty-diff/issues/11 1335 | // Also, remove some useless lines 1336 | if (!line || utils.startsWith(line, '*')) { 1337 | return; 1338 | } 1339 | 1340 | var values = []; 1341 | if (utils.startsWith(line, 'diff')) { 1342 | startFile(); 1343 | } else if (currentFile && !currentFile.oldName && (values = /^--- [aiwco]\/(.+)$/.exec(line))) { 1344 | currentFile.oldName = values[1]; 1345 | currentFile.language = getExtension(currentFile.oldName, currentFile.language); 1346 | } else if (currentFile && !currentFile.newName && (values = /^\+\+\+ [biwco]?\/(.+)$/.exec(line))) { 1347 | currentFile.newName = values[1]; 1348 | currentFile.language = getExtension(currentFile.newName, currentFile.language); 1349 | } else if (currentFile && utils.startsWith(line, '@@')) { 1350 | startBlock(line); 1351 | } else if ((values = oldMode.exec(line))) { 1352 | currentFile.oldMode = values[1]; 1353 | } else if ((values = newMode.exec(line))) { 1354 | currentFile.newMode = values[1]; 1355 | } else if ((values = deletedFileMode.exec(line))) { 1356 | currentFile.deletedFileMode = values[1]; 1357 | } else if ((values = newFileMode.exec(line))) { 1358 | currentFile.newFileMode = values[1]; 1359 | } else if ((values = copyFrom.exec(line))) { 1360 | currentFile.oldName = values[1]; 1361 | currentFile.isCopy = true; 1362 | } else if ((values = copyTo.exec(line))) { 1363 | currentFile.newName = values[1]; 1364 | currentFile.isCopy = true; 1365 | } else if ((values = renameFrom.exec(line))) { 1366 | currentFile.oldName = values[1]; 1367 | currentFile.isRename = true; 1368 | } else if ((values = renameTo.exec(line))) { 1369 | currentFile.newName = values[1]; 1370 | currentFile.isRename = true; 1371 | } else if ((values = similarityIndex.exec(line))) { 1372 | currentFile.unchangedPercentage = values[1]; 1373 | } else if ((values = dissimilarityIndex.exec(line))) { 1374 | currentFile.changedPercentage = values[1]; 1375 | } else if ((values = index.exec(line))) { 1376 | currentFile.checksumBefore = values[1]; 1377 | currentFile.checksumAfter = values[2]; 1378 | values[2] && (currentFile.mode = values[3]); 1379 | } else if ((values = combinedIndex.exec(line))) { 1380 | currentFile.checksumBefore = [values[2], values[3]]; 1381 | currentFile.checksumAfter = values[1]; 1382 | } else if ((values = combinedMode.exec(line))) { 1383 | currentFile.oldMode = [values[2], values[3]]; 1384 | currentFile.newMode = values[1]; 1385 | } else if ((values = combinedNewFile.exec(line))) { 1386 | currentFile.newFileMode = values[1]; 1387 | } else if ((values = combinedDeletedFile.exec(line))) { 1388 | currentFile.deletedFileMode = values[1]; 1389 | } else if (currentBlock) { 1390 | createLine(line); 1391 | } 1392 | }); 1393 | 1394 | saveBlock(); 1395 | saveFile(); 1396 | 1397 | return files; 1398 | }; 1399 | 1400 | function getExtension(filename, language) { 1401 | var nameSplit = filename.split('.'); 1402 | if (nameSplit.length > 1) { 1403 | return nameSplit[nameSplit.length - 1]; 1404 | } else { 1405 | return language; 1406 | } 1407 | } 1408 | 1409 | module.exports['DiffParser'] = new DiffParser(); 1410 | 1411 | })(this); 1412 | 1413 | },{"./utils.js":24}],17:[function(require,module,exports){ 1414 | (function (global){ 1415 | /* 1416 | * 1417 | * Diff to HTML (diff2html.js) 1418 | * Author: rtfpessoa 1419 | * 1420 | */ 1421 | 1422 | (function(ctx, undefined) { 1423 | 1424 | var diffParser = require('./diff-parser.js').DiffParser; 1425 | var fileLister = require('./file-list-printer.js').FileListPrinter; 1426 | var htmlPrinter = require('./html-printer.js').HtmlPrinter; 1427 | 1428 | function Diff2Html() { 1429 | } 1430 | 1431 | /* 1432 | * Line diff type configuration 1433 | var config = { 1434 | "wordByWord": true, // (default) 1435 | // OR 1436 | "charByChar": true 1437 | }; 1438 | */ 1439 | 1440 | /* 1441 | * Generates json object from string diff input 1442 | */ 1443 | Diff2Html.prototype.getJsonFromDiff = function(diffInput) { 1444 | return diffParser.generateDiffJson(diffInput); 1445 | }; 1446 | 1447 | /* 1448 | * Generates the html diff. The config parameter configures the output/input formats and other options 1449 | */ 1450 | Diff2Html.prototype.getPrettyHtml = function(diffInput, config) { 1451 | var configOrEmpty = config || {}; 1452 | 1453 | var diffJson = diffInput; 1454 | if(!configOrEmpty.inputFormat || configOrEmpty.inputFormat === 'diff') { 1455 | diffJson = diffParser.generateDiffJson(diffInput); 1456 | } 1457 | 1458 | var fileList = ""; 1459 | if(configOrEmpty.showFiles === true) { 1460 | fileList = fileLister.generateFileList(diffJson, configOrEmpty); 1461 | } 1462 | 1463 | var diffOutput = ""; 1464 | if(configOrEmpty.outputFormat === 'side-by-side') { 1465 | diffOutput = htmlPrinter.generateSideBySideJsonHtml(diffJson, configOrEmpty); 1466 | } else { 1467 | diffOutput = htmlPrinter.generateLineByLineJsonHtml(diffJson, configOrEmpty); 1468 | } 1469 | 1470 | return fileList + diffOutput 1471 | }; 1472 | 1473 | 1474 | /* 1475 | * Deprecated methods - The following methods exist only to maintain compatibility with previous versions 1476 | */ 1477 | 1478 | /* 1479 | * Generates pretty html from string diff input 1480 | */ 1481 | Diff2Html.prototype.getPrettyHtmlFromDiff = function(diffInput, config) { 1482 | var configOrEmpty = config || {}; 1483 | configOrEmpty['inputFormat'] = 'diff'; 1484 | configOrEmpty['outputFormat'] = 'line-by-line'; 1485 | return this.getPrettyHtml(diffInput, configOrEmpty) 1486 | }; 1487 | 1488 | /* 1489 | * Generates pretty html from a json object 1490 | */ 1491 | Diff2Html.prototype.getPrettyHtmlFromJson = function(diffJson, config) { 1492 | var configOrEmpty = config || {}; 1493 | configOrEmpty['inputFormat'] = 'json'; 1494 | configOrEmpty['outputFormat'] = 'line-by-line'; 1495 | return this.getPrettyHtml(diffJson, configOrEmpty) 1496 | }; 1497 | 1498 | /* 1499 | * Generates pretty side by side html from string diff input 1500 | */ 1501 | Diff2Html.prototype.getPrettySideBySideHtmlFromDiff = function(diffInput, config) { 1502 | var configOrEmpty = config || {}; 1503 | configOrEmpty['inputFormat'] = 'diff'; 1504 | configOrEmpty['outputFormat'] = 'side-by-side'; 1505 | return this.getPrettyHtml(diffInput, configOrEmpty) 1506 | }; 1507 | 1508 | /* 1509 | * Generates pretty side by side html from a json object 1510 | */ 1511 | Diff2Html.prototype.getPrettySideBySideHtmlFromJson = function(diffJson, config) { 1512 | var configOrEmpty = config || {}; 1513 | configOrEmpty['inputFormat'] = 'json'; 1514 | configOrEmpty['outputFormat'] = 'side-by-side'; 1515 | return this.getPrettyHtml(diffJson, configOrEmpty) 1516 | }; 1517 | 1518 | var diffName = 'Diff2Html'; 1519 | var diffObject = new Diff2Html(); 1520 | module.exports[diffName] = diffObject; 1521 | // Expose diff2html in the browser 1522 | global[diffName] = diffObject; 1523 | 1524 | })(this); 1525 | 1526 | }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) 1527 | },{"./diff-parser.js":16,"./file-list-printer.js":18,"./html-printer.js":19}],18:[function(require,module,exports){ 1528 | /* 1529 | * 1530 | * FileListPrinter (file-list-printer.js) 1531 | * Author: nmatpt 1532 | * 1533 | */ 1534 | 1535 | (function (ctx, undefined) { 1536 | 1537 | var printerUtils = require('./printer-utils.js').PrinterUtils; 1538 | var utils = require('./utils.js').Utils; 1539 | 1540 | function FileListPrinter() { 1541 | } 1542 | 1543 | FileListPrinter.prototype.generateFileList = function (diffFiles) { 1544 | var hideId = utils.getRandomId("d2h-hide"); //necessary if there are 2 elements like this in the same page 1545 | var showId = utils.getRandomId("d2h-show"); 1546 | return '
\n' + 1547 | '
Files changed (' + diffFiles.length + ')  
\n' + 1548 | ' +\n' + 1549 | ' -\n' + 1550 | '
\n' + 1551 | ' \n' + 1552 | 1553 | 1554 | diffFiles.map(function (file) { 1555 | return ' \n' + 1556 | ' \n' + 1559 | ' \n' + 1562 | ' \n' + 1563 | ' \n' 1564 | }).join('\n') + 1565 | '
\n' + 1557 | ' +' + file.addedLines + '\n' + 1558 | ' \n' + 1560 | ' -' + file.deletedLines + '\n' + 1561 | '  ' + printerUtils.getDiffName(file) + '
\n'; 1566 | }; 1567 | 1568 | module.exports['FileListPrinter'] = new FileListPrinter(); 1569 | 1570 | })(this); 1571 | 1572 | },{"./printer-utils.js":21,"./utils.js":24}],19:[function(require,module,exports){ 1573 | /* 1574 | * 1575 | * HtmlPrinter (html-printer.js) 1576 | * Author: rtfpessoa 1577 | * 1578 | */ 1579 | 1580 | (function(ctx, undefined) { 1581 | 1582 | var lineByLinePrinter = require('./line-by-line-printer.js').LineByLinePrinter; 1583 | var sideBySidePrinter = require('./side-by-side-printer.js').SideBySidePrinter; 1584 | 1585 | function HtmlPrinter() { 1586 | } 1587 | 1588 | HtmlPrinter.prototype.generateLineByLineJsonHtml = lineByLinePrinter.generateLineByLineJsonHtml; 1589 | 1590 | HtmlPrinter.prototype.generateSideBySideJsonHtml = sideBySidePrinter.generateSideBySideJsonHtml; 1591 | 1592 | module.exports['HtmlPrinter'] = new HtmlPrinter(); 1593 | 1594 | })(this); 1595 | 1596 | },{"./line-by-line-printer.js":20,"./side-by-side-printer.js":23}],20:[function(require,module,exports){ 1597 | /* 1598 | * 1599 | * LineByLinePrinter (line-by-line-printer.js) 1600 | * Author: rtfpessoa 1601 | * 1602 | */ 1603 | 1604 | (function(ctx, undefined) { 1605 | 1606 | var diffParser = require('./diff-parser.js').DiffParser; 1607 | var printerUtils = require('./printer-utils.js').PrinterUtils; 1608 | var utils = require('./utils.js').Utils; 1609 | var Rematch = require('./rematch.js').Rematch; 1610 | 1611 | function LineByLinePrinter() { 1612 | } 1613 | 1614 | LineByLinePrinter.prototype.generateLineByLineJsonHtml = function(diffFiles, config) { 1615 | return '
\n' + 1616 | diffFiles.map(function(file) { 1617 | 1618 | var diffs; 1619 | if (file.blocks.length) { 1620 | diffs = generateFileHtml(file, config); 1621 | } else { 1622 | diffs = generateEmptyDiff(); 1623 | } 1624 | 1625 | return '
\n' + 1626 | '
\n' + 1627 | '
\n' + 1628 | ' ' + 1629 | ' +' + file.addedLines + '\n' + 1630 | ' \n' + 1631 | ' ' + 1632 | ' -' + file.deletedLines + '\n' + 1633 | ' \n' + 1634 | '
\n' + 1635 | '
' + printerUtils.getDiffName(file) + '
\n' + 1636 | '
\n' + 1637 | '
\n' + 1638 | '
\n' + 1639 | ' \n' + 1640 | ' \n' + 1641 | ' ' + diffs + 1642 | ' \n' + 1643 | '
\n' + 1644 | '
\n' + 1645 | '
\n' + 1646 | '
\n'; 1647 | }).join('\n') + 1648 | '
\n'; 1649 | }; 1650 | 1651 | var matcher=Rematch.rematch(function(a,b) { 1652 | var amod = a.content.substr(1), 1653 | bmod = b.content.substr(1); 1654 | return Rematch.distance(amod, bmod); 1655 | }); 1656 | 1657 | function generateFileHtml(file, config) { 1658 | return file.blocks.map(function(block) { 1659 | 1660 | var lines = '\n' + 1661 | ' \n' + 1662 | ' ' + 1663 | '
' + utils.escape(block.header) + '
' + 1664 | ' \n' + 1665 | '\n'; 1666 | 1667 | var oldLines = []; 1668 | var newLines = []; 1669 | function processChangeBlock() { 1670 | var matches; 1671 | var insertType; 1672 | var deleteType; 1673 | var doMatching = config.matching === "lines" || config.matching === "words"; 1674 | if (doMatching) { 1675 | matches = matcher(oldLines, newLines); 1676 | insertType = diffParser.LINE_TYPE.INSERT_CHANGES; 1677 | deleteType = diffParser.LINE_TYPE.DELETE_CHANGES; 1678 | } else { 1679 | matches = [[oldLines,newLines]]; 1680 | insertType = diffParser.LINE_TYPE.INSERTS; 1681 | deleteType = diffParser.LINE_TYPE.DELETES; 1682 | } 1683 | matches.forEach(function(match){ 1684 | var oldLines = match[0]; 1685 | var newLines = match[1]; 1686 | var processedOldLines = []; 1687 | var processedNewLines = []; 1688 | var j = 0; 1689 | var oldLine, newLine, 1690 | common = Math.min(oldLines.length, newLines.length), 1691 | max = Math.max(oldLines.length, newLines.length); 1692 | for (j = 0; j < common; j++) { 1693 | oldLine = oldLines[j]; 1694 | newLine = newLines[j]; 1695 | 1696 | config.isCombined = file.isCombined; 1697 | var diff = printerUtils.diffHighlight(oldLine.content, newLine.content, config); 1698 | 1699 | processedOldLines += 1700 | generateLineHtml(deleteType, oldLine.oldNumber, oldLine.newNumber, 1701 | diff.first.line, diff.first.prefix); 1702 | processedNewLines += 1703 | generateLineHtml(insertType, newLine.oldNumber, newLine.newNumber, 1704 | diff.second.line, diff.second.prefix); 1705 | } 1706 | 1707 | lines += processedOldLines + processedNewLines; 1708 | lines += processLines(oldLines.slice(common), newLines.slice(common)); 1709 | 1710 | processedOldLines = []; 1711 | processedNewLines = []; 1712 | }); 1713 | oldLines = []; 1714 | newLines = []; 1715 | } 1716 | 1717 | for (var i = 0; i < block.lines.length; i++) { 1718 | var line = block.lines[i]; 1719 | var escapedLine = utils.escape(line.content); 1720 | 1721 | if ( line.type !== diffParser.LINE_TYPE.INSERTS && 1722 | (newLines.length > 0 || (line.type !== diffParser.LINE_TYPE.DELETES && oldLines.length > 0))) { 1723 | processChangeBlock(); 1724 | } 1725 | if (line.type == diffParser.LINE_TYPE.CONTEXT) { 1726 | lines += generateLineHtml(line.type, line.oldNumber, line.newNumber, escapedLine); 1727 | } else if (line.type == diffParser.LINE_TYPE.INSERTS && !oldLines.length) { 1728 | lines += generateLineHtml(line.type, line.oldNumber, line.newNumber, escapedLine); 1729 | } else if (line.type == diffParser.LINE_TYPE.DELETES) { 1730 | oldLines.push(line); 1731 | } else if (line.type == diffParser.LINE_TYPE.INSERTS && !!oldLines.length) { 1732 | newLines.push(line); 1733 | } else { 1734 | console.error('unknown state in html line-by-line generator'); 1735 | processChangeBlock(); 1736 | } 1737 | } 1738 | 1739 | processChangeBlock(); 1740 | 1741 | return lines; 1742 | }).join('\n'); 1743 | } 1744 | 1745 | function processLines(oldLines, newLines) { 1746 | var lines = ''; 1747 | 1748 | for (j = 0; j < oldLines.length; j++) { 1749 | var oldLine = oldLines[j]; 1750 | var oldEscapedLine = utils.escape(oldLine.content); 1751 | lines += generateLineHtml(oldLine.type, oldLine.oldNumber, oldLine.newNumber, oldEscapedLine); 1752 | } 1753 | 1754 | for (j = 0; j < newLines.length; j++) { 1755 | var newLine = newLines[j]; 1756 | var newEscapedLine = utils.escape(newLine.content); 1757 | lines += generateLineHtml(newLine.type, newLine.oldNumber, newLine.newNumber, newEscapedLine); 1758 | } 1759 | 1760 | return lines; 1761 | } 1762 | 1763 | function generateLineHtml(type, oldNumber, newNumber, content, prefix) { 1764 | var htmlPrefix = ''; 1765 | if (prefix) { 1766 | htmlPrefix = '' + prefix + ''; 1767 | } 1768 | 1769 | var htmlContent = ''; 1770 | if (content) { 1771 | htmlContent = '' + content + ''; 1772 | } 1773 | 1774 | return '\n' + 1775 | ' ' + 1776 | '
' + utils.valueOrEmpty(oldNumber) + '
' + 1777 | '
' + utils.valueOrEmpty(newNumber) + '
' + 1778 | ' \n' + 1779 | ' ' + 1780 | '
' + htmlPrefix + htmlContent + '
' + 1781 | ' \n' + 1782 | '\n'; 1783 | } 1784 | 1785 | function generateEmptyDiff() { 1786 | return '\n' + 1787 | ' ' + 1788 | '
' + 1789 | 'File without changes' + 1790 | '
' + 1791 | ' \n' + 1792 | '\n'; 1793 | } 1794 | 1795 | module.exports['LineByLinePrinter'] = new LineByLinePrinter(); 1796 | 1797 | })(this); 1798 | 1799 | },{"./diff-parser.js":16,"./printer-utils.js":21,"./rematch.js":22,"./utils.js":24}],21:[function(require,module,exports){ 1800 | /* 1801 | * 1802 | * PrinterUtils (printer-utils.js) 1803 | * Author: rtfpessoa 1804 | * 1805 | */ 1806 | 1807 | (function(ctx, undefined) { 1808 | 1809 | var jsDiff = require('diff'); 1810 | var utils = require('./utils.js').Utils; 1811 | var Rematch = require('./rematch.js').Rematch; 1812 | 1813 | function PrinterUtils() { 1814 | } 1815 | 1816 | PrinterUtils.prototype.getHtmlId = function(file) { 1817 | var hashCode = function(text) { 1818 | var hash = 0, i, chr, len; 1819 | if (text.length == 0) return hash; 1820 | for (i = 0, len = text.length; i < len; i++) { 1821 | chr = text.charCodeAt(i); 1822 | hash = ((hash << 5) - hash) + chr; 1823 | hash |= 0; // Convert to 32bit integer 1824 | } 1825 | return hash; 1826 | }; 1827 | 1828 | return "d2h-" + hashCode(this.getDiffName(file)).toString().slice(-6); 1829 | }; 1830 | 1831 | PrinterUtils.prototype.getDiffName = function(file) { 1832 | var oldFilename = file.oldName; 1833 | var newFilename = file.newName; 1834 | 1835 | if (oldFilename && newFilename 1836 | && oldFilename !== newFilename 1837 | && !isDeletedName(newFilename)) { 1838 | return oldFilename + ' -> ' + newFilename; 1839 | } else if (newFilename && !isDeletedName(newFilename)) { 1840 | return newFilename; 1841 | } else if (oldFilename) { 1842 | return oldFilename; 1843 | } else { 1844 | return 'Unknown filename'; 1845 | } 1846 | }; 1847 | 1848 | PrinterUtils.prototype.diffHighlight = function(diffLine1, diffLine2, config) { 1849 | var lineStart1, lineStart2; 1850 | 1851 | var prefixSize = 1; 1852 | 1853 | if (config.isCombined) { 1854 | prefixSize = 2; 1855 | } 1856 | 1857 | lineStart1 = diffLine1.substr(0, prefixSize); 1858 | lineStart2 = diffLine2.substr(0, prefixSize); 1859 | 1860 | diffLine1 = diffLine1.substr(prefixSize); 1861 | diffLine2 = diffLine2.substr(prefixSize); 1862 | 1863 | var diff; 1864 | if (config.charByChar) { 1865 | diff = jsDiff.diffChars(diffLine1, diffLine2); 1866 | } else { 1867 | diff = jsDiff.diffWordsWithSpace(diffLine1, diffLine2); 1868 | } 1869 | 1870 | var highlightedLine = ''; 1871 | 1872 | var changedWords = []; 1873 | if (!config.charByChar && config.matching === 'words') { 1874 | var treshold = 0.25; 1875 | if (typeof(config.matchWordsThreshold) !== "undefined") { 1876 | treshold = config.matchWordsThreshold; 1877 | } 1878 | var matcher = Rematch.rematch(function(a, b) { 1879 | var amod = a.value, 1880 | bmod = b.value, 1881 | result = Rematch.distance(amod, bmod); 1882 | return result; 1883 | }); 1884 | var removed = diff.filter(function isRemoved(element){ 1885 | return element.removed; 1886 | }); 1887 | var added = diff.filter(function isAdded(element){ 1888 | return element.added; 1889 | }); 1890 | var chunks = matcher(added, removed); 1891 | chunks = chunks.forEach(function(chunk){ 1892 | if(chunk[0].length === 1 && chunk[1].length === 1) { 1893 | var dist = Rematch.distance(chunk[0][0].value, chunk[1][0].value) 1894 | if (dist < treshold) { 1895 | changedWords.push(chunk[0][0]); 1896 | changedWords.push(chunk[1][0]); 1897 | } 1898 | } 1899 | }); 1900 | } 1901 | diff.forEach(function(part) { 1902 | var addClass = changedWords.indexOf(part) > -1 ? ' class="d2h-change"' : ''; 1903 | var elemType = part.added ? 'ins' : part.removed ? 'del' : null; 1904 | var escapedValue = utils.escape(part.value); 1905 | 1906 | if (elemType !== null) { 1907 | highlightedLine += '<' + elemType + addClass + '>' + escapedValue + ''; 1908 | } else { 1909 | highlightedLine += escapedValue; 1910 | } 1911 | }); 1912 | 1913 | return { 1914 | first: { 1915 | prefix: lineStart1, 1916 | line: removeIns(highlightedLine) 1917 | }, 1918 | second: { 1919 | prefix: lineStart2, 1920 | line: removeDel(highlightedLine) 1921 | } 1922 | } 1923 | }; 1924 | 1925 | function isDeletedName(name) { 1926 | return name === 'dev/null'; 1927 | } 1928 | 1929 | function removeIns(line) { 1930 | return line.replace(/(]*>((.|\n)*?)<\/ins>)/g, ''); 1931 | } 1932 | 1933 | function removeDel(line) { 1934 | return line.replace(/(]*>((.|\n)*?)<\/del>)/g, ''); 1935 | } 1936 | 1937 | module.exports['PrinterUtils'] = new PrinterUtils(); 1938 | 1939 | })(this); 1940 | 1941 | },{"./rematch.js":22,"./utils.js":24,"diff":10}],22:[function(require,module,exports){ 1942 | /* 1943 | * 1944 | * Rematch (rematch.js) 1945 | * Matching two sequences of objects by similarity 1946 | * Author: W. Illmeyer, Nexxar GmbH 1947 | * 1948 | */ 1949 | 1950 | (function(ctx, undefined) { 1951 | var Rematch = {}; 1952 | Rematch.arrayToString = function arrayToString(a) { 1953 | if (Object.prototype.toString.apply(a,[]) === "[object Array]") { 1954 | return "[" + a.map(arrayToString).join(", ") + "]"; 1955 | } else { 1956 | return a; 1957 | } 1958 | } 1959 | 1960 | /* 1961 | Copyright (c) 2011 Andrei Mackenzie 1962 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 1963 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 1964 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 1965 | */ 1966 | function levenshtein(a, b){ 1967 | if(a.length == 0) return b.length; 1968 | if(b.length == 0) return a.length; 1969 | 1970 | var matrix = []; 1971 | 1972 | // increment along the first column of each row 1973 | var i; 1974 | for(i = 0; i <= b.length; i++){ 1975 | matrix[i] = [i]; 1976 | } 1977 | 1978 | // increment each column in the first row 1979 | var j; 1980 | for(j = 0; j <= a.length; j++){ 1981 | matrix[0][j] = j; 1982 | } 1983 | 1984 | // Fill in the rest of the matrix 1985 | for(i = 1; i <= b.length; i++){ 1986 | for(j = 1; j <= a.length; j++){ 1987 | if(b.charAt(i-1) == a.charAt(j-1)){ 1988 | matrix[i][j] = matrix[i-1][j-1]; 1989 | } else { 1990 | matrix[i][j] = Math.min(matrix[i-1][j-1] + 1, // substitution 1991 | Math.min(matrix[i][j-1] + 1, // insertion 1992 | matrix[i-1][j] + 1)); // deletion 1993 | } 1994 | } 1995 | } 1996 | return matrix[b.length][a.length]; 1997 | } 1998 | Rematch.levenshtein = levenshtein; 1999 | 2000 | Rematch.distance = function distance(x,y) { 2001 | x=x.trim(); 2002 | y=y.trim(); 2003 | var lev = levenshtein(x,y), 2004 | score = lev / (x.length + y.length); 2005 | return score; 2006 | } 2007 | 2008 | Rematch.rematch = function rematch(distanceFunction) { 2009 | 2010 | function findBestMatch(a, b, cache) { 2011 | var cachecount = 0; 2012 | 2013 | for(var key in cache) { 2014 | cachecount++; 2015 | } 2016 | var bestMatchDist = Infinity; 2017 | var bestMatch; 2018 | for (var i = 0; i < a.length; ++i) { 2019 | for (var j = 0; j < b.length; ++j) { 2020 | var cacheKey = JSON.stringify([a[i], b[j]]); 2021 | var md; 2022 | if (cache.hasOwnProperty(cacheKey)) { 2023 | md = cache[cacheKey]; 2024 | } else { 2025 | md = distanceFunction(a[i], b[j]); 2026 | cache[cacheKey] = md; 2027 | } 2028 | if (md < bestMatchDist) { 2029 | bestMatchDist = md; 2030 | bestMatch = { indexA: i, indexB: j, score: bestMatchDist }; 2031 | } 2032 | } 2033 | } 2034 | return bestMatch; 2035 | } 2036 | function group(a, b, level, cache) { 2037 | 2038 | if (typeof(cache)==="undefined") { 2039 | cache = {}; 2040 | } 2041 | var minLength = Math.min(a.length, b.length); 2042 | var bm = findBestMatch(a,b, cache); 2043 | if (!level) { 2044 | level = 0; 2045 | } 2046 | if (!bm || (a.length + b.length < 3)) { 2047 | return [[a, b]]; 2048 | } 2049 | var a1 = a.slice(0, bm.indexA), 2050 | b1 = b.slice(0, bm.indexB), 2051 | aMatch = [a[bm.indexA]], 2052 | bMatch = [b[bm.indexB]], 2053 | tailA = bm.indexA + 1, 2054 | tailB = bm.indexB + 1, 2055 | a2 = a.slice(tailA), 2056 | b2 = b.slice(tailB); 2057 | 2058 | var group1 = group(a1, b1, level+1, cache); 2059 | var groupMatch = group(aMatch, bMatch, level+1, cache); 2060 | var group2 = group(a2, b2, level+1, cache); 2061 | var result = groupMatch; 2062 | if (bm.indexA > 0 || bm.indexB > 0) { 2063 | result = group1.concat(result); 2064 | } 2065 | if (a.length > tailA || b.length > tailB ) { 2066 | result = result.concat(group2); 2067 | } 2068 | return result; 2069 | } 2070 | return group; 2071 | } 2072 | 2073 | module.exports['Rematch'] = Rematch; 2074 | 2075 | })(this); 2076 | 2077 | },{}],23:[function(require,module,exports){ 2078 | /* 2079 | * 2080 | * HtmlPrinter (html-printer.js) 2081 | * Author: rtfpessoa 2082 | * 2083 | */ 2084 | 2085 | (function(ctx, undefined) { 2086 | 2087 | var diffParser = require('./diff-parser.js').DiffParser; 2088 | var printerUtils = require('./printer-utils.js').PrinterUtils; 2089 | var utils = require('./utils.js').Utils; 2090 | var Rematch = require('./rematch.js').Rematch; 2091 | 2092 | function SideBySidePrinter() { 2093 | } 2094 | 2095 | SideBySidePrinter.prototype.generateSideBySideJsonHtml = function(diffFiles, config) { 2096 | return '
\n' + 2097 | diffFiles.map(function(file) { 2098 | 2099 | var diffs; 2100 | if (file.blocks.length) { 2101 | diffs = generateSideBySideFileHtml(file, config); 2102 | } else { 2103 | diffs = generateEmptyDiff(); 2104 | } 2105 | 2106 | return '
\n' + 2107 | '
\n' + 2108 | '
\n' + 2109 | ' ' + 2110 | ' +' + file.addedLines + '\n' + 2111 | ' \n' + 2112 | ' ' + 2113 | ' -' + file.deletedLines + '\n' + 2114 | ' \n' + 2115 | '
\n' + 2116 | '
' + printerUtils.getDiffName(file) + '
\n' + 2117 | '
\n' + 2118 | '
\n' + 2119 | '
\n' + 2120 | '
\n' + 2121 | ' \n' + 2122 | ' \n' + 2123 | ' ' + diffs.left + 2124 | ' \n' + 2125 | '
\n' + 2126 | '
\n' + 2127 | '
\n' + 2128 | '
\n' + 2129 | '
\n' + 2130 | ' \n' + 2131 | ' \n' + 2132 | ' ' + diffs.right + 2133 | ' \n' + 2134 | '
\n' + 2135 | '
\n' + 2136 | '
\n' + 2137 | '
\n' + 2138 | '
\n'; 2139 | }).join('\n') + 2140 | '
\n'; 2141 | }; 2142 | 2143 | var matcher=Rematch.rematch(function(a,b) { 2144 | var amod = a.content.substr(1), 2145 | bmod = b.content.substr(1); 2146 | return Rematch.distance(amod, bmod); 2147 | }); 2148 | 2149 | function generateSideBySideFileHtml(file, config) { 2150 | var fileHtml = {}; 2151 | fileHtml.left = ''; 2152 | fileHtml.right = ''; 2153 | 2154 | file.blocks.forEach(function(block) { 2155 | 2156 | fileHtml.left += '\n' + 2157 | ' \n' + 2158 | ' ' + 2159 | '
' + 2160 | ' ' + utils.escape(block.header) + 2161 | '
' + 2162 | ' \n' + 2163 | '\n'; 2164 | 2165 | fileHtml.right += '\n' + 2166 | ' \n' + 2167 | ' ' + 2168 | '
' + 2169 | ' \n' + 2170 | '\n'; 2171 | 2172 | var oldLines = []; 2173 | var newLines = []; 2174 | function processChangeBlock() { 2175 | var matches; 2176 | var insertType; 2177 | var deleteType; 2178 | var doMatching = config.matching === "lines" || config.matching === "words"; 2179 | if (doMatching) { 2180 | matches = matcher(oldLines, newLines); 2181 | insertType = diffParser.LINE_TYPE.INSERT_CHANGES; 2182 | deleteType = diffParser.LINE_TYPE.DELETE_CHANGES; 2183 | } else { 2184 | matches = [[oldLines,newLines]]; 2185 | insertType = diffParser.LINE_TYPE.INSERTS; 2186 | deleteType = diffParser.LINE_TYPE.DELETES; 2187 | } 2188 | matches.forEach(function(match){ 2189 | var oldLines = match[0]; 2190 | var newLines = match[1]; 2191 | var tmpHtml; 2192 | var j = 0; 2193 | var oldLine, newLine, 2194 | common = Math.min(oldLines.length, newLines.length), 2195 | max = Math.max(oldLines.length, newLines.length); 2196 | for (j = 0; j < common; j++) { 2197 | oldLine = oldLines[j]; 2198 | newLine = newLines[j]; 2199 | 2200 | config.isCombined = file.isCombined; 2201 | 2202 | var diff = printerUtils.diffHighlight(oldLine.content, newLine.content, config); 2203 | 2204 | fileHtml.left += 2205 | generateSingleLineHtml(deleteType, oldLine.oldNumber, 2206 | diff.first.line, diff.first.prefix); 2207 | fileHtml.right += 2208 | generateSingleLineHtml(insertType, newLine.newNumber, 2209 | diff.second.line, diff.second.prefix); 2210 | } 2211 | if (max > common) { 2212 | var oldSlice = oldLines.slice(common), 2213 | newSlice = newLines.slice(common); 2214 | tmpHtml = processLines(oldLines.slice(common), newLines.slice(common)); 2215 | fileHtml.left += tmpHtml.left; 2216 | fileHtml.right += tmpHtml.right; 2217 | } 2218 | }); 2219 | oldLines = []; 2220 | newLines = []; 2221 | } 2222 | for (var i = 0; i < block.lines.length; i++) { 2223 | var line = block.lines[i]; 2224 | var prefix = line[0]; 2225 | var escapedLine = utils.escape(line.content.substr(1)); 2226 | 2227 | if ( line.type !== diffParser.LINE_TYPE.INSERTS && 2228 | (newLines.length > 0 || (line.type !== diffParser.LINE_TYPE.DELETES && oldLines.length > 0))) { 2229 | processChangeBlock(); 2230 | } 2231 | if (line.type == diffParser.LINE_TYPE.CONTEXT) { 2232 | fileHtml.left += generateSingleLineHtml(line.type, line.oldNumber, escapedLine, prefix); 2233 | fileHtml.right += generateSingleLineHtml(line.type, line.newNumber, escapedLine, prefix); 2234 | } else if (line.type == diffParser.LINE_TYPE.INSERTS && !oldLines.length) { 2235 | fileHtml.left += generateSingleLineHtml(diffParser.LINE_TYPE.CONTEXT, '', '', ''); 2236 | fileHtml.right += generateSingleLineHtml(line.type, line.newNumber, escapedLine, prefix); 2237 | } else if (line.type == diffParser.LINE_TYPE.DELETES) { 2238 | oldLines.push(line); 2239 | } else if (line.type == diffParser.LINE_TYPE.INSERTS && !!oldLines.length) { 2240 | newLines.push(line); 2241 | } else { 2242 | console.error('unknown state in html side-by-side generator'); 2243 | processChangeBlock(); 2244 | } 2245 | } 2246 | 2247 | processChangeBlock(); 2248 | }); 2249 | 2250 | return fileHtml; 2251 | } 2252 | 2253 | function processLines(oldLines, newLines) { 2254 | var fileHtml = {}; 2255 | fileHtml.left = ''; 2256 | fileHtml.right = ''; 2257 | 2258 | var maxLinesNumber = Math.max(oldLines.length, newLines.length); 2259 | for (j = 0; j < maxLinesNumber; j++) { 2260 | var oldLine = oldLines[j]; 2261 | var newLine = newLines[j]; 2262 | var oldContent; 2263 | var newContent; 2264 | var oldPrefix; 2265 | var newPrefix; 2266 | if (oldLine) { 2267 | oldContent = utils.escape(oldLine.content.substr(1)); 2268 | oldPrefix = oldLine.content[0]; 2269 | } 2270 | if (newLine) { 2271 | newContent = utils.escape(newLine.content.substr(1)); 2272 | newPrefix = newLine.content[0]; 2273 | } 2274 | if (oldLine && newLine) { 2275 | fileHtml.left += generateSingleLineHtml(oldLine.type, oldLine.oldNumber, oldContent, oldPrefix); 2276 | fileHtml.right += generateSingleLineHtml(newLine.type, newLine.newNumber, newContent, newPrefix); 2277 | } else if (oldLine) { 2278 | fileHtml.left += generateSingleLineHtml(oldLine.type, oldLine.oldNumber, oldContent, oldPrefix); 2279 | fileHtml.right += generateSingleLineHtml(diffParser.LINE_TYPE.CONTEXT, '', '', ''); 2280 | } else if (newLine) { 2281 | fileHtml.left += generateSingleLineHtml(diffParser.LINE_TYPE.CONTEXT, '', '', ''); 2282 | fileHtml.right += generateSingleLineHtml(newLine.type, newLine.newNumber, newContent, newPrefix); 2283 | } else { 2284 | console.error('How did it get here?'); 2285 | } 2286 | } 2287 | 2288 | return fileHtml; 2289 | } 2290 | 2291 | function generateSingleLineHtml(type, number, content, prefix) { 2292 | var htmlPrefix = ''; 2293 | if (prefix) { 2294 | htmlPrefix = '' + prefix + ''; 2295 | } 2296 | 2297 | var htmlContent = ''; 2298 | if (content) { 2299 | htmlContent = '' + content + ''; 2300 | } 2301 | 2302 | return '\n' + 2303 | ' ' + number + '\n' + 2304 | ' ' + 2305 | '
' + htmlPrefix + htmlContent + '
' + 2306 | ' \n' + 2307 | ' \n'; 2308 | } 2309 | 2310 | function generateEmptyDiff() { 2311 | var fileHtml = {}; 2312 | fileHtml.right = ''; 2313 | 2314 | fileHtml.left = '\n' + 2315 | ' ' + 2316 | '
' + 2317 | 'File without changes' + 2318 | '
' + 2319 | ' \n' + 2320 | '\n'; 2321 | 2322 | return fileHtml; 2323 | } 2324 | 2325 | module.exports['SideBySidePrinter'] = new SideBySidePrinter(); 2326 | 2327 | })(this); 2328 | 2329 | },{"./diff-parser.js":16,"./printer-utils.js":21,"./rematch.js":22,"./utils.js":24}],24:[function(require,module,exports){ 2330 | /* 2331 | * 2332 | * Utils (utils.js) 2333 | * Author: rtfpessoa 2334 | * 2335 | */ 2336 | 2337 | (function(ctx, undefined) { 2338 | 2339 | function Utils() { 2340 | } 2341 | 2342 | Utils.prototype.escape = function(str) { 2343 | return str.slice(0) 2344 | .replace(/&/g, '&') 2345 | .replace(//g, '>') 2347 | .replace(/\t/g, ' '); 2348 | }; 2349 | 2350 | Utils.prototype.getRandomId = function(prefix) { 2351 | return prefix + "-" + Math.random().toString(36).slice(-3); 2352 | }; 2353 | 2354 | Utils.prototype.startsWith = function(str, start) { 2355 | if (typeof start === 'object') { 2356 | var result = false; 2357 | start.forEach(function(s) { 2358 | if (str.indexOf(s) === 0) { 2359 | result = true; 2360 | } 2361 | }); 2362 | 2363 | return result; 2364 | } 2365 | 2366 | return str.indexOf(start) === 0; 2367 | }; 2368 | 2369 | Utils.prototype.valueOrEmpty = function(value) { 2370 | return value ? value : ''; 2371 | }; 2372 | 2373 | module.exports['Utils'] = new Utils(); 2374 | 2375 | })(this); 2376 | 2377 | },{}],25:[function(require,module,exports){ 2378 | require('diff2html'); 2379 | 2380 | document.addEventListener("DOMContentLoaded", function() { 2381 | var diffJson = Diff2Html.getJsonFromDiff(lineDiffExample); 2382 | var allFileLanguages = diffJson.map(function(line) { 2383 | return line.language; 2384 | }); 2385 | 2386 | var distinctLanguages = allFileLanguages.filter(function(v, i) { 2387 | return allFileLanguages.indexOf(v) == i; 2388 | }); 2389 | 2390 | hljs.configure({languages: distinctLanguages}); 2391 | 2392 | document.getElementById("line-by-line").innerHTML = Diff2Html.getPrettyHtml(diffJson, { inputFormat: 'json', showFiles: true, matching: 'lines' }); 2393 | document.getElementById("side-by-side").innerHTML = Diff2Html.getPrettyHtml(diffJson, { inputFormat: 'json', showFiles: true, matching: 'lines', outputFormat: 'side-by-side' }); 2394 | 2395 | var codeLines = document.getElementsByClassName("d2h-code-line-ctn"); 2396 | [].forEach.call(codeLines, function(line) { 2397 | hljs.highlightBlock(line); 2398 | }); 2399 | }); 2400 | 2401 | },{"diff2html":17}]},{},[25]); 2402 | -------------------------------------------------------------------------------- /lib/style.css: -------------------------------------------------------------------------------- 1 | .clearfix::after { 2 | display: block; 3 | clear: both; 4 | content: ''; 5 | } 6 | 7 | .heading { 8 | margin-top: 40px; 9 | letter-spacing: 2px; 10 | } 11 | .heading::before, 12 | .heading::after { 13 | content: ''; 14 | display: inline-block; 15 | width: 300px; 16 | margin: 0 10px; 17 | border: 1px solid #999; 18 | vertical-align: 7px; 19 | } 20 | 21 | .btn-area { 22 | max-width: 800px; 23 | margin: 0 auto; 24 | } 25 | 26 | section.split { 27 | display: none; 28 | } 29 | 30 | .btn-group { 31 | float: right; 32 | display: inline-block; 33 | vertical-align: middle; 34 | font-size: 0; 35 | } 36 | .btn-group:before { 37 | display: table; 38 | content: ''; 39 | } 40 | .btn-group:after { 41 | display: table; 42 | clear: both; 43 | content: ''; 44 | } 45 | 46 | .btn-sw { 47 | position: relative; 48 | display: inline-block; 49 | font-size: 13px; 50 | font-weight: bold; 51 | line-height: 20px; 52 | color: #333; 53 | white-space: nowrap; 54 | vertical-align: middle; 55 | cursor: pointer; 56 | background-color: #eee; 57 | background-image: -webkit-linear-gradient(#fcfcfc, #eee); 58 | background-image: linear-gradient(#fcfcfc, #eee); 59 | border: 1px solid #d5d5d5; 60 | border-radius: 3px; 61 | padding: 2px 10px; 62 | } 63 | .btn-sw.selected { 64 | background-color: #dcdcdc; 65 | background-image: none; 66 | border-color: #b5b5b5; 67 | box-shadow: inset 0 2px 4px rgba(0,0,0,0.15); 68 | } 69 | .btn-group .btn-sw:first-child:not(:last-child) { 70 | border-top-right-radius: 0; 71 | border-bottom-right-radius: 0; 72 | } 73 | .btn-group .btn-sw:last-child:not(:first-child) { 74 | border-top-left-radius: 0; 75 | border-bottom-left-radius: 0; 76 | } 77 | 78 | .d2h-wrapper { 79 | display: block; 80 | margin: 0 auto; 81 | text-align: left; 82 | width: 100%; 83 | } 84 | 85 | .d2h-file-wrapper { 86 | border: 1px solid #ddd; 87 | border-radius: 3px; 88 | margin-bottom: 1em; 89 | } 90 | 91 | .d2h-file-header { 92 | padding: 5px 10px; 93 | border-bottom: 1px solid #d8d8d8; 94 | background-color: #f7f7f7; 95 | font: 13px Helvetica, arial, freesans, clean, sans-serif, "Segoe UI Emoji", "Segoe UI Symbol"; 96 | } 97 | 98 | .d2h-file-stats { 99 | display: inline; 100 | font-size: 12px; 101 | text-align: center; 102 | max-width: 15%; 103 | } 104 | 105 | .d2h-lines-added { 106 | text-align: right; 107 | } 108 | 109 | .d2h-lines-added > * { 110 | background-color: #ceffce; 111 | border: 1px solid #b4e2b4; 112 | color: #399839; 113 | border-radius: 5px 0 0 5px; 114 | padding: 2px; 115 | } 116 | 117 | .d2h-lines-deleted { 118 | text-align: left; 119 | } 120 | 121 | .d2h-lines-deleted > * { 122 | background-color: #f7c8c8; 123 | border: 1px solid #e9aeae; 124 | color: #c33; 125 | border-radius: 0 5px 5px 0; 126 | padding: 2px; 127 | } 128 | 129 | .d2h-file-name { 130 | display: inline; 131 | line-height: 33px; 132 | max-width: 80%; 133 | white-space: nowrap; 134 | text-overflow: ellipsis; 135 | overflow: hidden; 136 | } 137 | 138 | .d2h-diff-table { 139 | border-collapse: collapse; 140 | font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; 141 | font-size: 12px; 142 | height: 18px; 143 | line-height: 18px; 144 | width: 100%; 145 | } 146 | 147 | .d2h-files-diff { 148 | width: 100%; 149 | } 150 | 151 | .d2h-file-diff { 152 | overflow-x: scroll; 153 | overflow-y: hidden; 154 | } 155 | 156 | .d2h-file-side-diff { 157 | display: inline-block; 158 | overflow-x: scroll; 159 | overflow-y: hidden; 160 | width: 50%; 161 | margin-right: -4px; 162 | } 163 | 164 | .d2h-code-line { 165 | display: block; 166 | white-space: pre; 167 | padding: 0 10px; 168 | height: 18px; 169 | line-height: 18px; 170 | margin-left: 80px; 171 | /* Override HighlightJS */ 172 | color: inherit; 173 | overflow-x: inherit; 174 | background: none; 175 | /* ******************** */ 176 | } 177 | 178 | .d2h-code-side-line { 179 | display: block; 180 | white-space: pre; 181 | padding: 0 10px; 182 | height: 18px; 183 | line-height: 18px; 184 | margin-left: 50px; 185 | /* Override HighlightJS */ 186 | color: inherit; 187 | overflow-x: inherit; 188 | background: none; 189 | /* ******************** */ 190 | } 191 | 192 | .d2h-code-line del, 193 | .d2h-code-side-line del { 194 | display: inline-block; 195 | margin-top: -1px; 196 | text-decoration: none; 197 | background-color: #ffb6ba; 198 | border-radius: 0.2em; 199 | } 200 | 201 | .d2h-code-line ins, 202 | .d2h-code-side-line ins { 203 | display: inline-block; 204 | margin-top: -1px; 205 | text-decoration: none; 206 | background-color: #97f295; 207 | border-radius: 0.2em; 208 | } 209 | 210 | .d2h-code-line-prefix { 211 | float: left; 212 | background: none; 213 | padding: 0; 214 | } 215 | 216 | .d2h-code-line-ctn { 217 | background: none; 218 | padding: 0; 219 | } 220 | 221 | .line-num1 { 222 | box-sizing: border-box; 223 | float: left; 224 | width: 32px; 225 | overflow: hidden; 226 | text-overflow: ellipsis; 227 | padding-left: 3px; 228 | } 229 | 230 | .line-num2 { 231 | box-sizing: border-box; 232 | float: right; 233 | width: 32px; 234 | overflow: hidden; 235 | text-overflow: ellipsis; 236 | padding-left: 3px; 237 | } 238 | 239 | .d2h-code-linenumber { 240 | box-sizing: border-box; 241 | position: absolute; 242 | width: 82px; 243 | height: 18px; 244 | padding-left: 2px; 245 | padding-right: 2px; 246 | line-height: 18px; 247 | background-color: #fff; 248 | color: rgba(0, 0, 0, 0.3); 249 | text-align: right; 250 | border: solid #eeeeee; 251 | border-width: 0 1px 0 1px; 252 | cursor: pointer; 253 | } 254 | 255 | .d2h-code-side-linenumber { 256 | box-sizing: border-box; 257 | position: absolute; 258 | width: 52px; 259 | padding-left: 10px; 260 | padding-right: 10px; 261 | height: 18px; 262 | line-height: 18px; 263 | background-color: #fff; 264 | color: rgba(0, 0, 0, 0.3); 265 | text-align: right; 266 | border: solid #eeeeee; 267 | border-width: 0 1px 0 1px; 268 | cursor: pointer; 269 | overflow: hidden; 270 | text-overflow: ellipsis; 271 | } 272 | 273 | .d2h-del { 274 | background-color: #fee8e9; 275 | border-color: #e9aeae; 276 | } 277 | 278 | .d2h-ins { 279 | background-color: #dfd; 280 | border-color: #b4e2b4; 281 | } 282 | 283 | .d2h-info { 284 | background-color: #f8fafd; 285 | color: rgba(0, 0, 0, 0.3); 286 | border-color: #d5e4f2; 287 | } 288 | 289 | .d2h-file-list-wrapper { 290 | margin-bottom: 10px; 291 | padding: 0 10px; 292 | } 293 | 294 | .d2h-file-list-wrapper a { 295 | text-decoration: none; 296 | color: #3572b0; 297 | } 298 | 299 | .d2h-file-list-wrapper a:visited { 300 | color: #3572b0; 301 | } 302 | 303 | .d2h-file-list-header { 304 | font-weight: bold; 305 | float: left; 306 | } 307 | 308 | .d2h-file-list-line { 309 | text-align: left; 310 | font: 13px Helvetica, arial, freesans, clean, sans-serif, "Segoe UI Emoji", "Segoe UI Symbol"; 311 | } 312 | 313 | .d2h-file-list-line .d2h-file-name { 314 | line-height: 21px; 315 | } 316 | 317 | .d2h-file-list { 318 | display: none; 319 | } 320 | 321 | .d2h-clear { 322 | display: block; 323 | clear: both; 324 | } 325 | 326 | .d2h-del.d2h-change, .d2h-ins.d2h-change { 327 | background-color: #ffc; 328 | } 329 | 330 | ins.d2h-change, del.d2h-change { 331 | background-color: #fad771; 332 | } 333 | 334 | .d2h-file-diff .d2h-del.d2h-change { 335 | background-color: #fae1af; 336 | } 337 | 338 | .d2h-file-diff .d2h-ins.d2h-change { 339 | background-color: #ded; 340 | } 341 | 342 | /* CSS only show/hide */ 343 | .d2h-show { 344 | display: none; 345 | float: left; 346 | } 347 | 348 | .d2h-hide { 349 | float: left; 350 | } 351 | 352 | .d2h-hide:target + .d2h-show { 353 | display: inline; 354 | } 355 | 356 | .d2h-hide:target { 357 | display: none; 358 | } 359 | 360 | .d2h-hide:target ~ .d2h-file-list { 361 | display: block; 362 | } 363 | -------------------------------------------------------------------------------- /package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "node-giff", 3 | "version": "0.0.7", 4 | "lockfileVersion": 1, 5 | "requires": true, 6 | "dependencies": { 7 | "abbrev": { 8 | "version": "1.1.0", 9 | "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.0.tgz", 10 | "integrity": "sha1-0FVMIlZjbi9W58LlrRg/hZQo2B8=" 11 | }, 12 | "acorn": { 13 | "version": "4.0.13", 14 | "resolved": "https://registry.npmjs.org/acorn/-/acorn-4.0.13.tgz", 15 | "integrity": "sha1-EFSVrlNh1pe9GVyCUZLhrX8lN4c=", 16 | "dev": true 17 | }, 18 | "array-filter": { 19 | "version": "0.0.1", 20 | "resolved": "https://registry.npmjs.org/array-filter/-/array-filter-0.0.1.tgz", 21 | "integrity": "sha1-fajPLiZijtcygDWB/SH2fKzS7uw=", 22 | "dev": true 23 | }, 24 | "array-map": { 25 | "version": "0.0.0", 26 | "resolved": "https://registry.npmjs.org/array-map/-/array-map-0.0.0.tgz", 27 | "integrity": "sha1-iKK6tz0c97zVwbEYoAP2b2ZfpmI=", 28 | "dev": true 29 | }, 30 | "array-reduce": { 31 | "version": "0.0.0", 32 | "resolved": "https://registry.npmjs.org/array-reduce/-/array-reduce-0.0.0.tgz", 33 | "integrity": "sha1-FziZ0//Rx9k4PkR5Ul2+J4yrXys=", 34 | "dev": true 35 | }, 36 | "asn1.js": { 37 | "version": "4.9.1", 38 | "resolved": "https://registry.npmjs.org/asn1.js/-/asn1.js-4.9.1.tgz", 39 | "integrity": "sha1-SLokC0WpKA6UdImQull9IWYX/UA=", 40 | "dev": true, 41 | "requires": { 42 | "bn.js": "4.11.8", 43 | "inherits": "2.0.3", 44 | "minimalistic-assert": "1.0.0" 45 | } 46 | }, 47 | "assert": { 48 | "version": "1.4.1", 49 | "resolved": "https://registry.npmjs.org/assert/-/assert-1.4.1.tgz", 50 | "integrity": "sha1-mZEtWRg2tab1s0XA8H7vwI/GXZE=", 51 | "dev": true, 52 | "requires": { 53 | "util": "0.10.3" 54 | } 55 | }, 56 | "astw": { 57 | "version": "2.2.0", 58 | "resolved": "https://registry.npmjs.org/astw/-/astw-2.2.0.tgz", 59 | "integrity": "sha1-e9QXhNMkk5h66yOba04cV6hzuRc=", 60 | "dev": true, 61 | "requires": { 62 | "acorn": "4.0.13" 63 | } 64 | }, 65 | "balanced-match": { 66 | "version": "1.0.0", 67 | "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", 68 | "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", 69 | "dev": true 70 | }, 71 | "base64-js": { 72 | "version": "1.2.1", 73 | "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.2.1.tgz", 74 | "integrity": "sha512-dwVUVIXsBZXwTuwnXI9RK8sBmgq09NDHzyR9SAph9eqk76gKK2JSQmZARC2zRC81JC2QTtxD0ARU5qTS25gIGw==", 75 | "dev": true 76 | }, 77 | "bn.js": { 78 | "version": "4.11.8", 79 | "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.8.tgz", 80 | "integrity": "sha512-ItfYfPLkWHUjckQCk8xC+LwxgK8NYcXywGigJgSwOP8Y2iyWT4f2vsZnoOXTTbo+o5yXmIUJ4gn5538SO5S3gA==", 81 | "dev": true 82 | }, 83 | "brace-expansion": { 84 | "version": "1.1.8", 85 | "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.8.tgz", 86 | "integrity": "sha1-wHshHHyVLsH479Uad+8NHTmQopI=", 87 | "dev": true, 88 | "requires": { 89 | "balanced-match": "1.0.0", 90 | "concat-map": "0.0.1" 91 | } 92 | }, 93 | "brorand": { 94 | "version": "1.1.0", 95 | "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz", 96 | "integrity": "sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8=", 97 | "dev": true 98 | }, 99 | "browser-pack": { 100 | "version": "6.0.2", 101 | "resolved": "https://registry.npmjs.org/browser-pack/-/browser-pack-6.0.2.tgz", 102 | "integrity": "sha1-+GzWzvT1MAyOY+B6TVEvZfv/RTE=", 103 | "dev": true, 104 | "requires": { 105 | "combine-source-map": "0.7.2", 106 | "defined": "1.0.0", 107 | "JSONStream": "1.3.1", 108 | "through2": "2.0.3", 109 | "umd": "3.0.1" 110 | } 111 | }, 112 | "browser-resolve": { 113 | "version": "1.11.2", 114 | "resolved": "https://registry.npmjs.org/browser-resolve/-/browser-resolve-1.11.2.tgz", 115 | "integrity": "sha1-j/CbCixCFxihBRwmCzLkj0QpOM4=", 116 | "dev": true, 117 | "requires": { 118 | "resolve": "1.1.7" 119 | }, 120 | "dependencies": { 121 | "resolve": { 122 | "version": "1.1.7", 123 | "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.1.7.tgz", 124 | "integrity": "sha1-IDEU2CrSxe2ejgQRs5ModeiJ6Xs=", 125 | "dev": true 126 | } 127 | } 128 | }, 129 | "browserify": { 130 | "version": "14.4.0", 131 | "resolved": "https://registry.npmjs.org/browserify/-/browserify-14.4.0.tgz", 132 | "integrity": "sha1-CJo0Y69Y0OSNjNQHCz90ZU1avKk=", 133 | "dev": true, 134 | "requires": { 135 | "assert": "1.4.1", 136 | "browser-pack": "6.0.2", 137 | "browser-resolve": "1.11.2", 138 | "browserify-zlib": "0.1.4", 139 | "buffer": "5.0.7", 140 | "cached-path-relative": "1.0.1", 141 | "concat-stream": "1.5.2", 142 | "console-browserify": "1.1.0", 143 | "constants-browserify": "1.0.0", 144 | "crypto-browserify": "3.11.1", 145 | "defined": "1.0.0", 146 | "deps-sort": "2.0.0", 147 | "domain-browser": "1.1.7", 148 | "duplexer2": "0.1.4", 149 | "events": "1.1.1", 150 | "glob": "7.1.2", 151 | "has": "1.0.1", 152 | "htmlescape": "1.1.1", 153 | "https-browserify": "1.0.0", 154 | "inherits": "2.0.3", 155 | "insert-module-globals": "7.0.1", 156 | "JSONStream": "1.3.1", 157 | "labeled-stream-splicer": "2.0.0", 158 | "module-deps": "4.1.1", 159 | "os-browserify": "0.1.2", 160 | "parents": "1.0.1", 161 | "path-browserify": "0.0.0", 162 | "process": "0.11.10", 163 | "punycode": "1.4.1", 164 | "querystring-es3": "0.2.1", 165 | "read-only-stream": "2.0.0", 166 | "readable-stream": "2.3.3", 167 | "resolve": "1.4.0", 168 | "shasum": "1.0.2", 169 | "shell-quote": "1.6.1", 170 | "stream-browserify": "2.0.1", 171 | "stream-http": "2.7.2", 172 | "string_decoder": "1.0.3", 173 | "subarg": "1.0.0", 174 | "syntax-error": "1.3.0", 175 | "through2": "2.0.3", 176 | "timers-browserify": "1.4.2", 177 | "tty-browserify": "0.0.0", 178 | "url": "0.11.0", 179 | "util": "0.10.3", 180 | "vm-browserify": "0.0.4", 181 | "xtend": "4.0.1" 182 | } 183 | }, 184 | "browserify-aes": { 185 | "version": "1.0.6", 186 | "resolved": "https://registry.npmjs.org/browserify-aes/-/browserify-aes-1.0.6.tgz", 187 | "integrity": "sha1-Xncl297x/Vkw1OurSFZ85FHEigo=", 188 | "dev": true, 189 | "requires": { 190 | "buffer-xor": "1.0.3", 191 | "cipher-base": "1.0.4", 192 | "create-hash": "1.1.3", 193 | "evp_bytestokey": "1.0.0", 194 | "inherits": "2.0.3" 195 | } 196 | }, 197 | "browserify-cipher": { 198 | "version": "1.0.0", 199 | "resolved": "https://registry.npmjs.org/browserify-cipher/-/browserify-cipher-1.0.0.tgz", 200 | "integrity": "sha1-mYgkSHS/XtTijalWZtzWasj8Njo=", 201 | "dev": true, 202 | "requires": { 203 | "browserify-aes": "1.0.6", 204 | "browserify-des": "1.0.0", 205 | "evp_bytestokey": "1.0.0" 206 | } 207 | }, 208 | "browserify-des": { 209 | "version": "1.0.0", 210 | "resolved": "https://registry.npmjs.org/browserify-des/-/browserify-des-1.0.0.tgz", 211 | "integrity": "sha1-2qJ3cXRwki7S/hhZQRihdUOXId0=", 212 | "dev": true, 213 | "requires": { 214 | "cipher-base": "1.0.4", 215 | "des.js": "1.0.0", 216 | "inherits": "2.0.3" 217 | } 218 | }, 219 | "browserify-rsa": { 220 | "version": "4.0.1", 221 | "resolved": "https://registry.npmjs.org/browserify-rsa/-/browserify-rsa-4.0.1.tgz", 222 | "integrity": "sha1-IeCr+vbyApzy+vsTNWenAdQTVSQ=", 223 | "dev": true, 224 | "requires": { 225 | "bn.js": "4.11.8", 226 | "randombytes": "2.0.5" 227 | } 228 | }, 229 | "browserify-sign": { 230 | "version": "4.0.4", 231 | "resolved": "https://registry.npmjs.org/browserify-sign/-/browserify-sign-4.0.4.tgz", 232 | "integrity": "sha1-qk62jl17ZYuqa/alfmMMvXqT0pg=", 233 | "dev": true, 234 | "requires": { 235 | "bn.js": "4.11.8", 236 | "browserify-rsa": "4.0.1", 237 | "create-hash": "1.1.3", 238 | "create-hmac": "1.1.6", 239 | "elliptic": "6.4.0", 240 | "inherits": "2.0.3", 241 | "parse-asn1": "5.1.0" 242 | } 243 | }, 244 | "browserify-zlib": { 245 | "version": "0.1.4", 246 | "resolved": "https://registry.npmjs.org/browserify-zlib/-/browserify-zlib-0.1.4.tgz", 247 | "integrity": "sha1-uzX4pRn2AOD6a4SFJByXnQFB+y0=", 248 | "dev": true, 249 | "requires": { 250 | "pako": "0.2.9" 251 | } 252 | }, 253 | "buffer": { 254 | "version": "5.0.7", 255 | "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.0.7.tgz", 256 | "integrity": "sha512-NeeHXWh5pCbPQCt2/6rLvXqapZfVsqw/YgRgaHpT3H9Uzgs+S0lSg5SQzouIuDvcmlQRqBe8hOO2scKCu3cxrg==", 257 | "dev": true, 258 | "requires": { 259 | "base64-js": "1.2.1", 260 | "ieee754": "1.1.8" 261 | } 262 | }, 263 | "buffer-xor": { 264 | "version": "1.0.3", 265 | "resolved": "https://registry.npmjs.org/buffer-xor/-/buffer-xor-1.0.3.tgz", 266 | "integrity": "sha1-JuYe0UIvtw3ULm42cp7VHYVf6Nk=", 267 | "dev": true 268 | }, 269 | "builtin-status-codes": { 270 | "version": "3.0.0", 271 | "resolved": "https://registry.npmjs.org/builtin-status-codes/-/builtin-status-codes-3.0.0.tgz", 272 | "integrity": "sha1-hZgoeOIbmOHGZCXgPQF0eI9Wnug=", 273 | "dev": true 274 | }, 275 | "cached-path-relative": { 276 | "version": "1.0.1", 277 | "resolved": "https://registry.npmjs.org/cached-path-relative/-/cached-path-relative-1.0.1.tgz", 278 | "integrity": "sha1-0JxLUoAKpMB44t2BqGmqyQ0uVOc=", 279 | "dev": true 280 | }, 281 | "cipher-base": { 282 | "version": "1.0.4", 283 | "resolved": "https://registry.npmjs.org/cipher-base/-/cipher-base-1.0.4.tgz", 284 | "integrity": "sha512-Kkht5ye6ZGmwv40uUDZztayT2ThLQGfnj/T71N/XzeZeo3nf8foyW7zGTsPYkEya3m5f3cAypH+qe7YOrM1U2Q==", 285 | "dev": true, 286 | "requires": { 287 | "inherits": "2.0.3", 288 | "safe-buffer": "5.1.1" 289 | } 290 | }, 291 | "combine-source-map": { 292 | "version": "0.7.2", 293 | "resolved": "https://registry.npmjs.org/combine-source-map/-/combine-source-map-0.7.2.tgz", 294 | "integrity": "sha1-CHAxKFazB6h8xKxIbzqaYq7MwJ4=", 295 | "dev": true, 296 | "requires": { 297 | "convert-source-map": "1.1.3", 298 | "inline-source-map": "0.6.2", 299 | "lodash.memoize": "3.0.4", 300 | "source-map": "0.5.6" 301 | } 302 | }, 303 | "commander": { 304 | "version": "2.11.0", 305 | "resolved": "https://registry.npmjs.org/commander/-/commander-2.11.0.tgz", 306 | "integrity": "sha512-b0553uYA5YAEGgyYIGYROzKQ7X5RAqedkfjiZxwi0kL1g3bOaBNNZfYkzt/CL0umgD5wc9Jec2FbB98CjkMRvQ==" 307 | }, 308 | "concat-map": { 309 | "version": "0.0.1", 310 | "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", 311 | "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", 312 | "dev": true 313 | }, 314 | "concat-stream": { 315 | "version": "1.5.2", 316 | "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.5.2.tgz", 317 | "integrity": "sha1-cIl4Yk2FavQaWnQd790mHadSwmY=", 318 | "dev": true, 319 | "requires": { 320 | "inherits": "2.0.3", 321 | "readable-stream": "2.0.6", 322 | "typedarray": "0.0.6" 323 | }, 324 | "dependencies": { 325 | "readable-stream": { 326 | "version": "2.0.6", 327 | "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.0.6.tgz", 328 | "integrity": "sha1-j5A0HmilPMySh4jaz80Rs265t44=", 329 | "dev": true, 330 | "requires": { 331 | "core-util-is": "1.0.2", 332 | "inherits": "2.0.3", 333 | "isarray": "1.0.0", 334 | "process-nextick-args": "1.0.7", 335 | "string_decoder": "0.10.31", 336 | "util-deprecate": "1.0.2" 337 | } 338 | }, 339 | "string_decoder": { 340 | "version": "0.10.31", 341 | "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", 342 | "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=", 343 | "dev": true 344 | } 345 | } 346 | }, 347 | "console-browserify": { 348 | "version": "1.1.0", 349 | "resolved": "https://registry.npmjs.org/console-browserify/-/console-browserify-1.1.0.tgz", 350 | "integrity": "sha1-8CQcRXMKn8YyOyBtvzjtx0HQuxA=", 351 | "dev": true, 352 | "requires": { 353 | "date-now": "0.1.4" 354 | } 355 | }, 356 | "constants-browserify": { 357 | "version": "1.0.0", 358 | "resolved": "https://registry.npmjs.org/constants-browserify/-/constants-browserify-1.0.0.tgz", 359 | "integrity": "sha1-wguW2MYXdIqvHBYCF2DNJ/y4y3U=", 360 | "dev": true 361 | }, 362 | "convert-source-map": { 363 | "version": "1.1.3", 364 | "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.1.3.tgz", 365 | "integrity": "sha1-SCnId+n+SbMWHzvzZziI4gRpmGA=", 366 | "dev": true 367 | }, 368 | "core-util-is": { 369 | "version": "1.0.2", 370 | "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", 371 | "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", 372 | "dev": true 373 | }, 374 | "create-ecdh": { 375 | "version": "4.0.0", 376 | "resolved": "https://registry.npmjs.org/create-ecdh/-/create-ecdh-4.0.0.tgz", 377 | "integrity": "sha1-iIxyNZbN92EvZJgjPuvXo1MBc30=", 378 | "dev": true, 379 | "requires": { 380 | "bn.js": "4.11.8", 381 | "elliptic": "6.4.0" 382 | } 383 | }, 384 | "create-hash": { 385 | "version": "1.1.3", 386 | "resolved": "https://registry.npmjs.org/create-hash/-/create-hash-1.1.3.tgz", 387 | "integrity": "sha1-YGBCrIuSYnUPSDyt2rD1gZFy2P0=", 388 | "dev": true, 389 | "requires": { 390 | "cipher-base": "1.0.4", 391 | "inherits": "2.0.3", 392 | "ripemd160": "2.0.1", 393 | "sha.js": "2.4.8" 394 | } 395 | }, 396 | "create-hmac": { 397 | "version": "1.1.6", 398 | "resolved": "https://registry.npmjs.org/create-hmac/-/create-hmac-1.1.6.tgz", 399 | "integrity": "sha1-rLniIaThe9sHbpBlfEK5PjcmzwY=", 400 | "dev": true, 401 | "requires": { 402 | "cipher-base": "1.0.4", 403 | "create-hash": "1.1.3", 404 | "inherits": "2.0.3", 405 | "ripemd160": "2.0.1", 406 | "safe-buffer": "5.1.1", 407 | "sha.js": "2.4.8" 408 | } 409 | }, 410 | "crypto-browserify": { 411 | "version": "3.11.1", 412 | "resolved": "https://registry.npmjs.org/crypto-browserify/-/crypto-browserify-3.11.1.tgz", 413 | "integrity": "sha512-Na7ZlwCOqoaW5RwUK1WpXws2kv8mNhWdTlzob0UXulk6G9BDbyiJaGTYBIX61Ozn9l1EPPJpICZb4DaOpT9NlQ==", 414 | "dev": true, 415 | "requires": { 416 | "browserify-cipher": "1.0.0", 417 | "browserify-sign": "4.0.4", 418 | "create-ecdh": "4.0.0", 419 | "create-hash": "1.1.3", 420 | "create-hmac": "1.1.6", 421 | "diffie-hellman": "5.0.2", 422 | "inherits": "2.0.3", 423 | "pbkdf2": "3.0.13", 424 | "public-encrypt": "4.0.0", 425 | "randombytes": "2.0.5" 426 | } 427 | }, 428 | "date-now": { 429 | "version": "0.1.4", 430 | "resolved": "https://registry.npmjs.org/date-now/-/date-now-0.1.4.tgz", 431 | "integrity": "sha1-6vQ5/U1ISK105cx9vvIAZyueNFs=", 432 | "dev": true 433 | }, 434 | "defined": { 435 | "version": "1.0.0", 436 | "resolved": "https://registry.npmjs.org/defined/-/defined-1.0.0.tgz", 437 | "integrity": "sha1-yY2bzvdWdBiOEQlpFRGZ45sfppM=", 438 | "dev": true 439 | }, 440 | "deps-sort": { 441 | "version": "2.0.0", 442 | "resolved": "https://registry.npmjs.org/deps-sort/-/deps-sort-2.0.0.tgz", 443 | "integrity": "sha1-CRckkC6EZYJg65EHSMzNGvbiH7U=", 444 | "dev": true, 445 | "requires": { 446 | "JSONStream": "1.3.1", 447 | "shasum": "1.0.2", 448 | "subarg": "1.0.0", 449 | "through2": "2.0.3" 450 | } 451 | }, 452 | "des.js": { 453 | "version": "1.0.0", 454 | "resolved": "https://registry.npmjs.org/des.js/-/des.js-1.0.0.tgz", 455 | "integrity": "sha1-wHTS4qpqipoH29YfmhXCzYPsjsw=", 456 | "dev": true, 457 | "requires": { 458 | "inherits": "2.0.3", 459 | "minimalistic-assert": "1.0.0" 460 | } 461 | }, 462 | "detective": { 463 | "version": "4.5.0", 464 | "resolved": "https://registry.npmjs.org/detective/-/detective-4.5.0.tgz", 465 | "integrity": "sha1-blqMaybmx6JUsca210kNmOyR7dE=", 466 | "dev": true, 467 | "requires": { 468 | "acorn": "4.0.13", 469 | "defined": "1.0.0" 470 | } 471 | }, 472 | "diff": { 473 | "version": "3.3.0", 474 | "resolved": "https://registry.npmjs.org/diff/-/diff-3.3.0.tgz", 475 | "integrity": "sha512-w0XZubFWn0Adlsapj9EAWX0FqWdO4tz8kc3RiYdWLh4k/V8PTb6i0SMgXt0vRM3zyKnT8tKO7mUlieRQHIjMNg==" 476 | }, 477 | "diff2html": { 478 | "version": "2.3.0", 479 | "resolved": "https://registry.npmjs.org/diff2html/-/diff2html-2.3.0.tgz", 480 | "integrity": "sha1-N1+weDyo+pAwd0k5m8nHXrfPZYA=", 481 | "requires": { 482 | "diff": "3.3.0", 483 | "hogan.js": "3.0.2", 484 | "whatwg-fetch": "2.0.3" 485 | } 486 | }, 487 | "diffie-hellman": { 488 | "version": "5.0.2", 489 | "resolved": "https://registry.npmjs.org/diffie-hellman/-/diffie-hellman-5.0.2.tgz", 490 | "integrity": "sha1-tYNXOScM/ias9jIJn97SoH8gnl4=", 491 | "dev": true, 492 | "requires": { 493 | "bn.js": "4.11.8", 494 | "miller-rabin": "4.0.0", 495 | "randombytes": "2.0.5" 496 | } 497 | }, 498 | "domain-browser": { 499 | "version": "1.1.7", 500 | "resolved": "https://registry.npmjs.org/domain-browser/-/domain-browser-1.1.7.tgz", 501 | "integrity": "sha1-hnqksJP6oF8d4IwG9NeyH9+GmLw=", 502 | "dev": true 503 | }, 504 | "duplexer2": { 505 | "version": "0.1.4", 506 | "resolved": "https://registry.npmjs.org/duplexer2/-/duplexer2-0.1.4.tgz", 507 | "integrity": "sha1-ixLauHjA1p4+eJEFFmKjL8a93ME=", 508 | "dev": true, 509 | "requires": { 510 | "readable-stream": "2.3.3" 511 | } 512 | }, 513 | "elliptic": { 514 | "version": "6.4.0", 515 | "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.4.0.tgz", 516 | "integrity": "sha1-ysmvh2LIWDYYcAPI3+GT5eLq5d8=", 517 | "dev": true, 518 | "requires": { 519 | "bn.js": "4.11.8", 520 | "brorand": "1.1.0", 521 | "hash.js": "1.1.3", 522 | "hmac-drbg": "1.0.1", 523 | "inherits": "2.0.3", 524 | "minimalistic-assert": "1.0.0", 525 | "minimalistic-crypto-utils": "1.0.1" 526 | } 527 | }, 528 | "events": { 529 | "version": "1.1.1", 530 | "resolved": "https://registry.npmjs.org/events/-/events-1.1.1.tgz", 531 | "integrity": "sha1-nr23Y1rQmccNzEwqH1AEKI6L2SQ=", 532 | "dev": true 533 | }, 534 | "evp_bytestokey": { 535 | "version": "1.0.0", 536 | "resolved": "https://registry.npmjs.org/evp_bytestokey/-/evp_bytestokey-1.0.0.tgz", 537 | "integrity": "sha1-SXtmrZ/vZc18CKYYCCS6FHa2blM=", 538 | "dev": true, 539 | "requires": { 540 | "create-hash": "1.1.3" 541 | } 542 | }, 543 | "fs.realpath": { 544 | "version": "1.0.0", 545 | "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", 546 | "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", 547 | "dev": true 548 | }, 549 | "function-bind": { 550 | "version": "1.1.0", 551 | "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.0.tgz", 552 | "integrity": "sha1-FhdnFMgBeY5Ojyz391KUZ7tKV3E=", 553 | "dev": true 554 | }, 555 | "glob": { 556 | "version": "7.1.2", 557 | "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", 558 | "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", 559 | "dev": true, 560 | "requires": { 561 | "fs.realpath": "1.0.0", 562 | "inflight": "1.0.6", 563 | "inherits": "2.0.3", 564 | "minimatch": "3.0.4", 565 | "once": "1.4.0", 566 | "path-is-absolute": "1.0.1" 567 | } 568 | }, 569 | "has": { 570 | "version": "1.0.1", 571 | "resolved": "https://registry.npmjs.org/has/-/has-1.0.1.tgz", 572 | "integrity": "sha1-hGFzP1OLCDfJNh45qauelwTcLyg=", 573 | "dev": true, 574 | "requires": { 575 | "function-bind": "1.1.0" 576 | } 577 | }, 578 | "hash-base": { 579 | "version": "2.0.2", 580 | "resolved": "https://registry.npmjs.org/hash-base/-/hash-base-2.0.2.tgz", 581 | "integrity": "sha1-ZuodhW206KVHDK32/OI65SRO8uE=", 582 | "dev": true, 583 | "requires": { 584 | "inherits": "2.0.3" 585 | } 586 | }, 587 | "hash.js": { 588 | "version": "1.1.3", 589 | "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.3.tgz", 590 | "integrity": "sha512-/UETyP0W22QILqS+6HowevwhEFJ3MBJnwTf75Qob9Wz9t0DPuisL8kW8YZMK62dHAKE1c1p+gY1TtOLY+USEHA==", 591 | "dev": true, 592 | "requires": { 593 | "inherits": "2.0.3", 594 | "minimalistic-assert": "1.0.0" 595 | } 596 | }, 597 | "hmac-drbg": { 598 | "version": "1.0.1", 599 | "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", 600 | "integrity": "sha1-0nRXAQJabHdabFRXk+1QL8DGSaE=", 601 | "dev": true, 602 | "requires": { 603 | "hash.js": "1.1.3", 604 | "minimalistic-assert": "1.0.0", 605 | "minimalistic-crypto-utils": "1.0.1" 606 | } 607 | }, 608 | "hogan.js": { 609 | "version": "3.0.2", 610 | "resolved": "https://registry.npmjs.org/hogan.js/-/hogan.js-3.0.2.tgz", 611 | "integrity": "sha1-TNnhq9QpQUbnZ55B14mHMrAse/0=", 612 | "requires": { 613 | "mkdirp": "0.3.0", 614 | "nopt": "1.0.10" 615 | } 616 | }, 617 | "htmlescape": { 618 | "version": "1.1.1", 619 | "resolved": "https://registry.npmjs.org/htmlescape/-/htmlescape-1.1.1.tgz", 620 | "integrity": "sha1-OgPtwiFLyjtmQko+eVk0lQnLA1E=", 621 | "dev": true 622 | }, 623 | "https-browserify": { 624 | "version": "1.0.0", 625 | "resolved": "https://registry.npmjs.org/https-browserify/-/https-browserify-1.0.0.tgz", 626 | "integrity": "sha1-7AbBDgo0wPL68Zn3/X/Hj//QPHM=", 627 | "dev": true 628 | }, 629 | "ieee754": { 630 | "version": "1.1.8", 631 | "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.1.8.tgz", 632 | "integrity": "sha1-vjPUCsEO8ZJnAfbwii2G+/0a0+Q=", 633 | "dev": true 634 | }, 635 | "indexof": { 636 | "version": "0.0.1", 637 | "resolved": "https://registry.npmjs.org/indexof/-/indexof-0.0.1.tgz", 638 | "integrity": "sha1-gtwzbSMrkGIXnQWrMpOmYFn9Q10=", 639 | "dev": true 640 | }, 641 | "inflight": { 642 | "version": "1.0.6", 643 | "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", 644 | "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", 645 | "dev": true, 646 | "requires": { 647 | "once": "1.4.0", 648 | "wrappy": "1.0.2" 649 | } 650 | }, 651 | "inherits": { 652 | "version": "2.0.3", 653 | "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", 654 | "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", 655 | "dev": true 656 | }, 657 | "inline-source-map": { 658 | "version": "0.6.2", 659 | "resolved": "https://registry.npmjs.org/inline-source-map/-/inline-source-map-0.6.2.tgz", 660 | "integrity": "sha1-+Tk0ccGKedFyT4Y/o4tYY3Ct4qU=", 661 | "dev": true, 662 | "requires": { 663 | "source-map": "0.5.6" 664 | } 665 | }, 666 | "insert-module-globals": { 667 | "version": "7.0.1", 668 | "resolved": "https://registry.npmjs.org/insert-module-globals/-/insert-module-globals-7.0.1.tgz", 669 | "integrity": "sha1-wDv04BywhtW15azorQr+eInWOMM=", 670 | "dev": true, 671 | "requires": { 672 | "combine-source-map": "0.7.2", 673 | "concat-stream": "1.5.2", 674 | "is-buffer": "1.1.5", 675 | "JSONStream": "1.3.1", 676 | "lexical-scope": "1.2.0", 677 | "process": "0.11.10", 678 | "through2": "2.0.3", 679 | "xtend": "4.0.1" 680 | } 681 | }, 682 | "is-buffer": { 683 | "version": "1.1.5", 684 | "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.5.tgz", 685 | "integrity": "sha1-Hzsm72E7IUuIy8ojzGwB2Hlh7sw=", 686 | "dev": true 687 | }, 688 | "isarray": { 689 | "version": "1.0.0", 690 | "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", 691 | "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", 692 | "dev": true 693 | }, 694 | "json-stable-stringify": { 695 | "version": "0.0.1", 696 | "resolved": "https://registry.npmjs.org/json-stable-stringify/-/json-stable-stringify-0.0.1.tgz", 697 | "integrity": "sha1-YRwj6BTbN1Un34URk9tZ3Sryf0U=", 698 | "dev": true, 699 | "requires": { 700 | "jsonify": "0.0.0" 701 | } 702 | }, 703 | "jsonify": { 704 | "version": "0.0.0", 705 | "resolved": "https://registry.npmjs.org/jsonify/-/jsonify-0.0.0.tgz", 706 | "integrity": "sha1-LHS27kHZPKUbe1qu6PUDYx0lKnM=", 707 | "dev": true 708 | }, 709 | "jsonparse": { 710 | "version": "1.3.1", 711 | "resolved": "https://registry.npmjs.org/jsonparse/-/jsonparse-1.3.1.tgz", 712 | "integrity": "sha1-P02uSpH6wxX3EGL4UhzCOfE2YoA=", 713 | "dev": true 714 | }, 715 | "JSONStream": { 716 | "version": "1.3.1", 717 | "resolved": "https://registry.npmjs.org/JSONStream/-/JSONStream-1.3.1.tgz", 718 | "integrity": "sha1-cH92HgHa6eFvG8+TcDt4xwlmV5o=", 719 | "dev": true, 720 | "requires": { 721 | "jsonparse": "1.3.1", 722 | "through": "2.3.8" 723 | } 724 | }, 725 | "labeled-stream-splicer": { 726 | "version": "2.0.0", 727 | "resolved": "https://registry.npmjs.org/labeled-stream-splicer/-/labeled-stream-splicer-2.0.0.tgz", 728 | "integrity": "sha1-pS4dE4AkwAuGscDJH2d5GLiuClk=", 729 | "dev": true, 730 | "requires": { 731 | "inherits": "2.0.3", 732 | "isarray": "0.0.1", 733 | "stream-splicer": "2.0.0" 734 | }, 735 | "dependencies": { 736 | "isarray": { 737 | "version": "0.0.1", 738 | "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", 739 | "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=", 740 | "dev": true 741 | } 742 | } 743 | }, 744 | "lexical-scope": { 745 | "version": "1.2.0", 746 | "resolved": "https://registry.npmjs.org/lexical-scope/-/lexical-scope-1.2.0.tgz", 747 | "integrity": "sha1-/Ope3HBKSzqHls3KQZw6CvryLfQ=", 748 | "dev": true, 749 | "requires": { 750 | "astw": "2.2.0" 751 | } 752 | }, 753 | "lodash.memoize": { 754 | "version": "3.0.4", 755 | "resolved": "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-3.0.4.tgz", 756 | "integrity": "sha1-LcvSwofLwKVcxCMovQxzYVDVPj8=", 757 | "dev": true 758 | }, 759 | "miller-rabin": { 760 | "version": "4.0.0", 761 | "resolved": "https://registry.npmjs.org/miller-rabin/-/miller-rabin-4.0.0.tgz", 762 | "integrity": "sha1-SmL7HUKTPAVYOYL0xxb2+55sbT0=", 763 | "dev": true, 764 | "requires": { 765 | "bn.js": "4.11.8", 766 | "brorand": "1.1.0" 767 | } 768 | }, 769 | "minimalistic-assert": { 770 | "version": "1.0.0", 771 | "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.0.tgz", 772 | "integrity": "sha1-cCvi3aazf0g2vLP121ZkG2Sh09M=", 773 | "dev": true 774 | }, 775 | "minimalistic-crypto-utils": { 776 | "version": "1.0.1", 777 | "resolved": "https://registry.npmjs.org/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz", 778 | "integrity": "sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo=", 779 | "dev": true 780 | }, 781 | "minimatch": { 782 | "version": "3.0.4", 783 | "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", 784 | "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", 785 | "dev": true, 786 | "requires": { 787 | "brace-expansion": "1.1.8" 788 | } 789 | }, 790 | "minimist": { 791 | "version": "1.2.0", 792 | "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", 793 | "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", 794 | "dev": true 795 | }, 796 | "mkdirp": { 797 | "version": "0.3.0", 798 | "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.3.0.tgz", 799 | "integrity": "sha1-G79asbqCevI1dRQ0kEJkVfSB/h4=" 800 | }, 801 | "module-deps": { 802 | "version": "4.1.1", 803 | "resolved": "https://registry.npmjs.org/module-deps/-/module-deps-4.1.1.tgz", 804 | "integrity": "sha1-IyFYM/HaE/1gbMuAh7RIUty4If0=", 805 | "dev": true, 806 | "requires": { 807 | "browser-resolve": "1.11.2", 808 | "cached-path-relative": "1.0.1", 809 | "concat-stream": "1.5.2", 810 | "defined": "1.0.0", 811 | "detective": "4.5.0", 812 | "duplexer2": "0.1.4", 813 | "inherits": "2.0.3", 814 | "JSONStream": "1.3.1", 815 | "parents": "1.0.1", 816 | "readable-stream": "2.3.3", 817 | "resolve": "1.4.0", 818 | "stream-combiner2": "1.1.1", 819 | "subarg": "1.0.0", 820 | "through2": "2.0.3", 821 | "xtend": "4.0.1" 822 | } 823 | }, 824 | "nopt": { 825 | "version": "1.0.10", 826 | "resolved": "https://registry.npmjs.org/nopt/-/nopt-1.0.10.tgz", 827 | "integrity": "sha1-bd0hvSoxQXuScn3Vhfim83YI6+4=", 828 | "requires": { 829 | "abbrev": "1.1.0" 830 | } 831 | }, 832 | "once": { 833 | "version": "1.4.0", 834 | "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", 835 | "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", 836 | "dev": true, 837 | "requires": { 838 | "wrappy": "1.0.2" 839 | } 840 | }, 841 | "os-browserify": { 842 | "version": "0.1.2", 843 | "resolved": "https://registry.npmjs.org/os-browserify/-/os-browserify-0.1.2.tgz", 844 | "integrity": "sha1-ScoCk+CxlZCl9d4Qx/JlphfY/lQ=", 845 | "dev": true 846 | }, 847 | "pako": { 848 | "version": "0.2.9", 849 | "resolved": "https://registry.npmjs.org/pako/-/pako-0.2.9.tgz", 850 | "integrity": "sha1-8/dSL073gjSNqBYbrZ7P1Rv4OnU=", 851 | "dev": true 852 | }, 853 | "parents": { 854 | "version": "1.0.1", 855 | "resolved": "https://registry.npmjs.org/parents/-/parents-1.0.1.tgz", 856 | "integrity": "sha1-/t1NK/GTp3dF/nHjcdc8MwfZx1E=", 857 | "dev": true, 858 | "requires": { 859 | "path-platform": "0.11.15" 860 | } 861 | }, 862 | "parse-asn1": { 863 | "version": "5.1.0", 864 | "resolved": "https://registry.npmjs.org/parse-asn1/-/parse-asn1-5.1.0.tgz", 865 | "integrity": "sha1-N8T5t+06tlx0gXtfJICTf7+XxxI=", 866 | "dev": true, 867 | "requires": { 868 | "asn1.js": "4.9.1", 869 | "browserify-aes": "1.0.6", 870 | "create-hash": "1.1.3", 871 | "evp_bytestokey": "1.0.0", 872 | "pbkdf2": "3.0.13" 873 | } 874 | }, 875 | "path-browserify": { 876 | "version": "0.0.0", 877 | "resolved": "https://registry.npmjs.org/path-browserify/-/path-browserify-0.0.0.tgz", 878 | "integrity": "sha1-oLhwcpquIUAFt9UDLsLLuw+0RRo=", 879 | "dev": true 880 | }, 881 | "path-is-absolute": { 882 | "version": "1.0.1", 883 | "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", 884 | "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", 885 | "dev": true 886 | }, 887 | "path-parse": { 888 | "version": "1.0.5", 889 | "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.5.tgz", 890 | "integrity": "sha1-PBrfhx6pzWyUMbbqK9dKD/BVxME=", 891 | "dev": true 892 | }, 893 | "path-platform": { 894 | "version": "0.11.15", 895 | "resolved": "https://registry.npmjs.org/path-platform/-/path-platform-0.11.15.tgz", 896 | "integrity": "sha1-6GQhf3TDaFDwhSt43Hv31KVyG/I=", 897 | "dev": true 898 | }, 899 | "pbkdf2": { 900 | "version": "3.0.13", 901 | "resolved": "https://registry.npmjs.org/pbkdf2/-/pbkdf2-3.0.13.tgz", 902 | "integrity": "sha512-+dCHxDH+djNtjgWmvVC/my3SYBAKpKNqKSjLkp+GtWWYe4XPE+e/PSD2aCanlEZZnqPk2uekTKNC/ccbwd2X2Q==", 903 | "dev": true, 904 | "requires": { 905 | "create-hash": "1.1.3", 906 | "create-hmac": "1.1.6", 907 | "ripemd160": "2.0.1", 908 | "safe-buffer": "5.1.1", 909 | "sha.js": "2.4.8" 910 | } 911 | }, 912 | "process": { 913 | "version": "0.11.10", 914 | "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", 915 | "integrity": "sha1-czIwDoQBYb2j5podHZGn1LwW8YI=", 916 | "dev": true 917 | }, 918 | "process-nextick-args": { 919 | "version": "1.0.7", 920 | "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.7.tgz", 921 | "integrity": "sha1-FQ4gt1ZZCtP5EJPyWk8q2L/zC6M=", 922 | "dev": true 923 | }, 924 | "public-encrypt": { 925 | "version": "4.0.0", 926 | "resolved": "https://registry.npmjs.org/public-encrypt/-/public-encrypt-4.0.0.tgz", 927 | "integrity": "sha1-OfaZ86RlYN1eusvKaTyvfGXBjMY=", 928 | "dev": true, 929 | "requires": { 930 | "bn.js": "4.11.8", 931 | "browserify-rsa": "4.0.1", 932 | "create-hash": "1.1.3", 933 | "parse-asn1": "5.1.0", 934 | "randombytes": "2.0.5" 935 | } 936 | }, 937 | "punycode": { 938 | "version": "1.4.1", 939 | "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", 940 | "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=", 941 | "dev": true 942 | }, 943 | "querystring": { 944 | "version": "0.2.0", 945 | "resolved": "https://registry.npmjs.org/querystring/-/querystring-0.2.0.tgz", 946 | "integrity": "sha1-sgmEkgO7Jd+CDadW50cAWHhSFiA=", 947 | "dev": true 948 | }, 949 | "querystring-es3": { 950 | "version": "0.2.1", 951 | "resolved": "https://registry.npmjs.org/querystring-es3/-/querystring-es3-0.2.1.tgz", 952 | "integrity": "sha1-nsYfeQSYdXB9aUFFlv2Qek1xHnM=", 953 | "dev": true 954 | }, 955 | "randombytes": { 956 | "version": "2.0.5", 957 | "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.0.5.tgz", 958 | "integrity": "sha512-8T7Zn1AhMsQ/HI1SjcCfT/t4ii3eAqco3yOcSzS4mozsOz69lHLsoMXmF9nZgnFanYscnSlUSgs8uZyKzpE6kg==", 959 | "dev": true, 960 | "requires": { 961 | "safe-buffer": "5.1.1" 962 | } 963 | }, 964 | "read-only-stream": { 965 | "version": "2.0.0", 966 | "resolved": "https://registry.npmjs.org/read-only-stream/-/read-only-stream-2.0.0.tgz", 967 | "integrity": "sha1-JyT9aoET1zdkrCiNQ4YnDB2/F/A=", 968 | "dev": true, 969 | "requires": { 970 | "readable-stream": "2.3.3" 971 | } 972 | }, 973 | "readable-stream": { 974 | "version": "2.3.3", 975 | "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.3.tgz", 976 | "integrity": "sha512-m+qzzcn7KUxEmd1gMbchF+Y2eIUbieUaxkWtptyHywrX0rE8QEYqPC07Vuy4Wm32/xE16NcdBctb8S0Xe/5IeQ==", 977 | "dev": true, 978 | "requires": { 979 | "core-util-is": "1.0.2", 980 | "inherits": "2.0.3", 981 | "isarray": "1.0.0", 982 | "process-nextick-args": "1.0.7", 983 | "safe-buffer": "5.1.1", 984 | "string_decoder": "1.0.3", 985 | "util-deprecate": "1.0.2" 986 | } 987 | }, 988 | "resolve": { 989 | "version": "1.4.0", 990 | "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.4.0.tgz", 991 | "integrity": "sha512-aW7sVKPufyHqOmyyLzg/J+8606v5nevBgaliIlV7nUpVMsDnoBGV/cbSLNjZAg9q0Cfd/+easKVKQ8vOu8fn1Q==", 992 | "dev": true, 993 | "requires": { 994 | "path-parse": "1.0.5" 995 | } 996 | }, 997 | "ripemd160": { 998 | "version": "2.0.1", 999 | "resolved": "https://registry.npmjs.org/ripemd160/-/ripemd160-2.0.1.tgz", 1000 | "integrity": "sha1-D0WEKVxTo2KK9+bXmsohzlfRxuc=", 1001 | "dev": true, 1002 | "requires": { 1003 | "hash-base": "2.0.2", 1004 | "inherits": "2.0.3" 1005 | } 1006 | }, 1007 | "safe-buffer": { 1008 | "version": "5.1.1", 1009 | "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz", 1010 | "integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==", 1011 | "dev": true 1012 | }, 1013 | "sha.js": { 1014 | "version": "2.4.8", 1015 | "resolved": "https://registry.npmjs.org/sha.js/-/sha.js-2.4.8.tgz", 1016 | "integrity": "sha1-NwaMLEdra69ALRSknGf1l5IfY08=", 1017 | "dev": true, 1018 | "requires": { 1019 | "inherits": "2.0.3" 1020 | } 1021 | }, 1022 | "shasum": { 1023 | "version": "1.0.2", 1024 | "resolved": "https://registry.npmjs.org/shasum/-/shasum-1.0.2.tgz", 1025 | "integrity": "sha1-5wEjENj0F/TetXEhUOVni4euVl8=", 1026 | "dev": true, 1027 | "requires": { 1028 | "json-stable-stringify": "0.0.1", 1029 | "sha.js": "2.4.8" 1030 | } 1031 | }, 1032 | "shell-quote": { 1033 | "version": "1.6.1", 1034 | "resolved": "https://registry.npmjs.org/shell-quote/-/shell-quote-1.6.1.tgz", 1035 | "integrity": "sha1-9HgZSczkAmlxJ0MOo7PFR29IF2c=", 1036 | "dev": true, 1037 | "requires": { 1038 | "array-filter": "0.0.1", 1039 | "array-map": "0.0.0", 1040 | "array-reduce": "0.0.0", 1041 | "jsonify": "0.0.0" 1042 | } 1043 | }, 1044 | "source-map": { 1045 | "version": "0.5.6", 1046 | "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.6.tgz", 1047 | "integrity": "sha1-dc449SvwczxafwwRjYEzSiu19BI=", 1048 | "dev": true 1049 | }, 1050 | "stream-browserify": { 1051 | "version": "2.0.1", 1052 | "resolved": "https://registry.npmjs.org/stream-browserify/-/stream-browserify-2.0.1.tgz", 1053 | "integrity": "sha1-ZiZu5fm9uZQKTkUUyvtDu3Hlyds=", 1054 | "dev": true, 1055 | "requires": { 1056 | "inherits": "2.0.3", 1057 | "readable-stream": "2.3.3" 1058 | } 1059 | }, 1060 | "stream-combiner2": { 1061 | "version": "1.1.1", 1062 | "resolved": "https://registry.npmjs.org/stream-combiner2/-/stream-combiner2-1.1.1.tgz", 1063 | "integrity": "sha1-+02KFCDqNidk4hrUeAOXvry0HL4=", 1064 | "dev": true, 1065 | "requires": { 1066 | "duplexer2": "0.1.4", 1067 | "readable-stream": "2.3.3" 1068 | } 1069 | }, 1070 | "stream-http": { 1071 | "version": "2.7.2", 1072 | "resolved": "https://registry.npmjs.org/stream-http/-/stream-http-2.7.2.tgz", 1073 | "integrity": "sha512-c0yTD2rbQzXtSsFSVhtpvY/vS6u066PcXOX9kBB3mSO76RiUQzL340uJkGBWnlBg4/HZzqiUXtaVA7wcRcJgEw==", 1074 | "dev": true, 1075 | "requires": { 1076 | "builtin-status-codes": "3.0.0", 1077 | "inherits": "2.0.3", 1078 | "readable-stream": "2.3.3", 1079 | "to-arraybuffer": "1.0.1", 1080 | "xtend": "4.0.1" 1081 | } 1082 | }, 1083 | "stream-splicer": { 1084 | "version": "2.0.0", 1085 | "resolved": "https://registry.npmjs.org/stream-splicer/-/stream-splicer-2.0.0.tgz", 1086 | "integrity": "sha1-G2O+Q4oTPktnHMGTUZdgAXWRDYM=", 1087 | "dev": true, 1088 | "requires": { 1089 | "inherits": "2.0.3", 1090 | "readable-stream": "2.3.3" 1091 | } 1092 | }, 1093 | "string_decoder": { 1094 | "version": "1.0.3", 1095 | "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz", 1096 | "integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==", 1097 | "dev": true, 1098 | "requires": { 1099 | "safe-buffer": "5.1.1" 1100 | } 1101 | }, 1102 | "subarg": { 1103 | "version": "1.0.0", 1104 | "resolved": "https://registry.npmjs.org/subarg/-/subarg-1.0.0.tgz", 1105 | "integrity": "sha1-9izxdYHplrSPyWVpn1TAauJouNI=", 1106 | "dev": true, 1107 | "requires": { 1108 | "minimist": "1.2.0" 1109 | } 1110 | }, 1111 | "syntax-error": { 1112 | "version": "1.3.0", 1113 | "resolved": "https://registry.npmjs.org/syntax-error/-/syntax-error-1.3.0.tgz", 1114 | "integrity": "sha1-HtkmbE1AvnXcVb+bsct3Biu5bKE=", 1115 | "dev": true, 1116 | "requires": { 1117 | "acorn": "4.0.13" 1118 | } 1119 | }, 1120 | "through": { 1121 | "version": "2.3.8", 1122 | "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", 1123 | "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=", 1124 | "dev": true 1125 | }, 1126 | "through2": { 1127 | "version": "2.0.3", 1128 | "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.3.tgz", 1129 | "integrity": "sha1-AARWmzfHx0ujnEPzzteNGtlBQL4=", 1130 | "dev": true, 1131 | "requires": { 1132 | "readable-stream": "2.3.3", 1133 | "xtend": "4.0.1" 1134 | } 1135 | }, 1136 | "timers-browserify": { 1137 | "version": "1.4.2", 1138 | "resolved": "https://registry.npmjs.org/timers-browserify/-/timers-browserify-1.4.2.tgz", 1139 | "integrity": "sha1-ycWLV1voQHN1y14kYtrO50NZ9B0=", 1140 | "dev": true, 1141 | "requires": { 1142 | "process": "0.11.10" 1143 | } 1144 | }, 1145 | "to-arraybuffer": { 1146 | "version": "1.0.1", 1147 | "resolved": "https://registry.npmjs.org/to-arraybuffer/-/to-arraybuffer-1.0.1.tgz", 1148 | "integrity": "sha1-fSKbH8xjfkZsoIEYCDanqr/4P0M=", 1149 | "dev": true 1150 | }, 1151 | "tty-browserify": { 1152 | "version": "0.0.0", 1153 | "resolved": "https://registry.npmjs.org/tty-browserify/-/tty-browserify-0.0.0.tgz", 1154 | "integrity": "sha1-oVe6QC2iTpv5V/mqadUk7tQpAaY=", 1155 | "dev": true 1156 | }, 1157 | "typedarray": { 1158 | "version": "0.0.6", 1159 | "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", 1160 | "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=", 1161 | "dev": true 1162 | }, 1163 | "umd": { 1164 | "version": "3.0.1", 1165 | "resolved": "https://registry.npmjs.org/umd/-/umd-3.0.1.tgz", 1166 | "integrity": "sha1-iuVW4RAR9jwllnCKiDclnwGz1g4=", 1167 | "dev": true 1168 | }, 1169 | "url": { 1170 | "version": "0.11.0", 1171 | "resolved": "https://registry.npmjs.org/url/-/url-0.11.0.tgz", 1172 | "integrity": "sha1-ODjpfPxgUh63PFJajlW/3Z4uKPE=", 1173 | "dev": true, 1174 | "requires": { 1175 | "punycode": "1.3.2", 1176 | "querystring": "0.2.0" 1177 | }, 1178 | "dependencies": { 1179 | "punycode": { 1180 | "version": "1.3.2", 1181 | "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.3.2.tgz", 1182 | "integrity": "sha1-llOgNvt8HuQjQvIyXM7v6jkmxI0=", 1183 | "dev": true 1184 | } 1185 | } 1186 | }, 1187 | "util": { 1188 | "version": "0.10.3", 1189 | "resolved": "https://registry.npmjs.org/util/-/util-0.10.3.tgz", 1190 | "integrity": "sha1-evsa/lCAUkZInj23/g7TeTNqwPk=", 1191 | "dev": true, 1192 | "requires": { 1193 | "inherits": "2.0.1" 1194 | }, 1195 | "dependencies": { 1196 | "inherits": { 1197 | "version": "2.0.1", 1198 | "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz", 1199 | "integrity": "sha1-sX0I0ya0Qj5Wjv9xn5GwscvfafE=", 1200 | "dev": true 1201 | } 1202 | } 1203 | }, 1204 | "util-deprecate": { 1205 | "version": "1.0.2", 1206 | "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", 1207 | "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", 1208 | "dev": true 1209 | }, 1210 | "vm-browserify": { 1211 | "version": "0.0.4", 1212 | "resolved": "https://registry.npmjs.org/vm-browserify/-/vm-browserify-0.0.4.tgz", 1213 | "integrity": "sha1-XX6kW7755Kb/ZflUOOCofDV9WnM=", 1214 | "dev": true, 1215 | "requires": { 1216 | "indexof": "0.0.1" 1217 | } 1218 | }, 1219 | "whatwg-fetch": { 1220 | "version": "2.0.3", 1221 | "resolved": "https://registry.npmjs.org/whatwg-fetch/-/whatwg-fetch-2.0.3.tgz", 1222 | "integrity": "sha1-nITsLc9oGH/wC8ZOEnS0QhduHIQ=" 1223 | }, 1224 | "wrappy": { 1225 | "version": "1.0.2", 1226 | "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", 1227 | "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", 1228 | "dev": true 1229 | }, 1230 | "xtend": { 1231 | "version": "4.0.1", 1232 | "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz", 1233 | "integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68=", 1234 | "dev": true 1235 | } 1236 | } 1237 | } 1238 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "node-giff", 3 | "version": "0.0.7", 4 | "description": "show git diff on browser", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "bin": { 10 | "giff": "index.js" 11 | }, 12 | "repository": { 13 | "type": "git", 14 | "url": "git+https://github.com/do7be/node-giff.git" 15 | }, 16 | "author": "do7be", 17 | "license": "MIT", 18 | "dependencies": { 19 | "commander": "^2.9.0", 20 | "diff2html": "^2.3.0" 21 | }, 22 | "devDependencies": { 23 | "browserify": "^14.4.0" 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/render.js: -------------------------------------------------------------------------------- 1 | require('diff2html'); 2 | 3 | document.addEventListener("DOMContentLoaded", function() { 4 | var diffJson = Diff2Html.getJsonFromDiff(lineDiffExample); 5 | var allFileLanguages = diffJson.map(function(line) { 6 | return line.language; 7 | }); 8 | 9 | var distinctLanguages = allFileLanguages.filter(function(v, i) { 10 | return allFileLanguages.indexOf(v) == i; 11 | }); 12 | 13 | hljs.configure({languages: distinctLanguages}); 14 | 15 | document.getElementById("line-by-line").innerHTML = Diff2Html.getPrettyHtml(diffJson, { inputFormat: 'json', showFiles: true, matching: 'lines' }); 16 | document.getElementById("side-by-side").innerHTML = Diff2Html.getPrettyHtml(diffJson, { inputFormat: 'json', showFiles: true, matching: 'lines', outputFormat: 'side-by-side' }); 17 | 18 | var codeLines = document.getElementsByClassName("d2h-code-line-ctn"); 19 | [].forEach.call(codeLines, function(line) { 20 | hljs.highlightBlock(line); 21 | }); 22 | }); 23 | --------------------------------------------------------------------------------