diff --git a/bower.json b/bower.json index 05cc5b19..96011a09 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "diff2html", - "version": "2.0.10", + "version": "2.0.11", "homepage": "https://diff2html.xyz", "description": "Fast Diff to colorized HTML", "keywords": [ diff --git a/dist/diff2html.js b/dist/diff2html.js index 37ee85c5..aebd2a58 100644 --- a/dist/diff2html.js +++ b/dist/diff2html.js @@ -66,6 +66,30 @@ function escapeHTML(s) { },{}],4:[function(require,module,exports){ /*istanbul ignore start*/'use strict'; +exports.__esModule = true; +exports.arrayDiff = undefined; +exports. /*istanbul ignore end*/diffArrays = diffArrays; + +var /*istanbul ignore start*/_base = require('./base') /*istanbul ignore end*/; + +/*istanbul ignore start*/ +var _base2 = _interopRequireDefault(_base); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + +/*istanbul ignore end*/var arrayDiff = /*istanbul ignore start*/exports. /*istanbul ignore end*/arrayDiff = new /*istanbul ignore start*/_base2['default']() /*istanbul ignore end*/; +arrayDiff.tokenize = arrayDiff.join = function (value) { + return value.slice(); +}; + +function diffArrays(oldArr, newArr, callback) { + return arrayDiff.diff(oldArr, newArr, callback); +} + + +},{"./base":5}],5:[function(require,module,exports){ +/*istanbul ignore start*/'use strict'; + exports.__esModule = true; exports['default'] = /*istanbul ignore end*/Diff; function Diff() {} @@ -111,7 +135,7 @@ Diff.prototype = { /*istanbul ignore start*/ var oldPos = this.extractCommon(bestPath[0], newString, oldString, 0); if (bestPath[0].newPos + 1 >= newLen && oldPos + 1 >= oldLen) { // Identity per the equality and tokenizer - return done([{ value: newString.join(''), count: newString.length }]); + return done([{ value: this.join(newString), count: newString.length }]); } // Main worker method. checks all permutations of a given edit length for acceptance. @@ -232,6 +256,9 @@ Diff.prototype = { /*istanbul ignore start*/ }, /*istanbul ignore start*/ /*istanbul ignore end*/tokenize: function tokenize(value) { return value.split(''); + }, + /*istanbul ignore start*/ /*istanbul ignore end*/join: function join(chars) { + return chars.join(''); } }; @@ -251,9 +278,9 @@ function buildValues(diff, components, newString, oldString, useLongestToken) { return oldValue.length > value.length ? oldValue : value; }); - component.value = value.join(''); + component.value = diff.join(value); } else { - component.value = newString.slice(newPos, newPos + component.count).join(''); + component.value = diff.join(newString.slice(newPos, newPos + component.count)); } newPos += component.count; @@ -262,7 +289,7 @@ function buildValues(diff, components, newString, oldString, useLongestToken) { oldPos += component.count; } } else { - component.value = oldString.slice(oldPos, oldPos + component.count).join(''); + component.value = diff.join(oldString.slice(oldPos, oldPos + component.count)); oldPos += component.count; // Reverse add and remove so removes are output first to match common convention @@ -292,7 +319,7 @@ function clonePath(path) { } -},{}],5:[function(require,module,exports){ +},{}],6:[function(require,module,exports){ /*istanbul ignore start*/'use strict'; exports.__esModule = true; @@ -312,7 +339,7 @@ function diffChars(oldStr, newStr, callback) { } -},{"./base":4}],6:[function(require,module,exports){ +},{"./base":5}],7:[function(require,module,exports){ /*istanbul ignore start*/'use strict'; exports.__esModule = true; @@ -336,7 +363,7 @@ function diffCss(oldStr, newStr, callback) { } -},{"./base":4}],7:[function(require,module,exports){ +},{"./base":5}],8:[function(require,module,exports){ /*istanbul ignore start*/'use strict'; exports.__esModule = true; @@ -438,7 +465,7 @@ function canonicalize(obj, stack, replacementStack) { } -},{"./base":4,"./line":8}],8:[function(require,module,exports){ +},{"./base":5,"./line":9}],9:[function(require,module,exports){ /*istanbul ignore start*/'use strict'; exports.__esModule = true; @@ -493,7 +520,7 @@ function diffTrimmedLines(oldStr, newStr, callback) { } -},{"../util/params":16,"./base":4}],9:[function(require,module,exports){ +},{"../util/params":17,"./base":5}],10:[function(require,module,exports){ /*istanbul ignore start*/'use strict'; exports.__esModule = true; @@ -517,7 +544,7 @@ function diffSentences(oldStr, newStr, callback) { } -},{"./base":4}],10:[function(require,module,exports){ +},{"./base":5}],11:[function(require,module,exports){ /*istanbul ignore start*/'use strict'; exports.__esModule = true; @@ -589,11 +616,11 @@ function diffWordsWithSpace(oldStr, newStr, callback) { } -},{"../util/params":16,"./base":4}],11:[function(require,module,exports){ +},{"../util/params":17,"./base":5}],12:[function(require,module,exports){ /*istanbul ignore start*/'use strict'; exports.__esModule = true; -exports.canonicalize = exports.convertChangesToXML = exports.convertChangesToDMP = exports.parsePatch = exports.applyPatches = exports.applyPatch = exports.createPatch = exports.createTwoFilesPatch = exports.structuredPatch = exports.diffJson = exports.diffCss = exports.diffSentences = exports.diffTrimmedLines = exports.diffLines = exports.diffWordsWithSpace = exports.diffWords = exports.diffChars = exports.Diff = undefined; +exports.canonicalize = exports.convertChangesToXML = exports.convertChangesToDMP = exports.parsePatch = exports.applyPatches = exports.applyPatch = exports.createPatch = exports.createTwoFilesPatch = exports.structuredPatch = exports.diffArrays = exports.diffJson = exports.diffCss = exports.diffSentences = exports.diffTrimmedLines = exports.diffLines = exports.diffWordsWithSpace = exports.diffWords = exports.diffChars = exports.Diff = undefined; /*istanbul ignore end*/ var /*istanbul ignore start*/_base = require('./diff/base') /*istanbul ignore end*/; @@ -613,6 +640,8 @@ var /*istanbul ignore start*/_css = require('./diff/css') /*istanbul ignore end* var /*istanbul ignore start*/_json = require('./diff/json') /*istanbul ignore end*/; +var /*istanbul ignore start*/_array = require('./diff/array') /*istanbul ignore end*/; + var /*istanbul ignore start*/_apply = require('./patch/apply') /*istanbul ignore end*/; var /*istanbul ignore start*/_parse = require('./patch/parse') /*istanbul ignore end*/; @@ -626,22 +655,6 @@ var /*istanbul ignore start*/_xml = require('./convert/xml') /*istanbul ignore e /*istanbul ignore start*/ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } -/* See LICENSE file for terms of use */ - -/* - * Text diff implementation. - * - * This library supports the following APIS: - * JsDiff.diffChars: Character by character diff - * JsDiff.diffWords: Word (as defined by \b regex) diff which ignores whitespace - * JsDiff.diffLines: Line based diff - * - * JsDiff.diffCss: Diff targeted at CSS content - * - * These methods are based on the implementation proposed in - * "An O(ND) Difference Algorithm and its Variations" (Myers, 1986). - * http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.4.6927 - */ exports. /*istanbul ignore end*/Diff = _base2['default']; /*istanbul ignore start*/exports. /*istanbul ignore end*/diffChars = _character.diffChars; /*istanbul ignore start*/exports. /*istanbul ignore end*/diffWords = _word.diffWords; @@ -651,6 +664,7 @@ exports. /*istanbul ignore end*/Diff = _base2['default']; /*istanbul ignore start*/exports. /*istanbul ignore end*/diffSentences = _sentence.diffSentences; /*istanbul ignore start*/exports. /*istanbul ignore end*/diffCss = _css.diffCss; /*istanbul ignore start*/exports. /*istanbul ignore end*/diffJson = _json.diffJson; +/*istanbul ignore start*/exports. /*istanbul ignore end*/diffArrays = _array.diffArrays; /*istanbul ignore start*/exports. /*istanbul ignore end*/structuredPatch = _create.structuredPatch; /*istanbul ignore start*/exports. /*istanbul ignore end*/createTwoFilesPatch = _create.createTwoFilesPatch; /*istanbul ignore start*/exports. /*istanbul ignore end*/createPatch = _create.createPatch; @@ -659,10 +673,25 @@ exports. /*istanbul ignore end*/Diff = _base2['default']; /*istanbul ignore start*/exports. /*istanbul ignore end*/parsePatch = _parse.parsePatch; /*istanbul ignore start*/exports. /*istanbul ignore end*/convertChangesToDMP = _dmp.convertChangesToDMP; /*istanbul ignore start*/exports. /*istanbul ignore end*/convertChangesToXML = _xml.convertChangesToXML; -/*istanbul ignore start*/exports. /*istanbul ignore end*/canonicalize = _json.canonicalize; +/*istanbul ignore start*/exports. /*istanbul ignore end*/canonicalize = _json.canonicalize; /* See LICENSE file for terms of use */ + +/* + * Text diff implementation. + * + * This library supports the following APIS: + * JsDiff.diffChars: Character by character diff + * JsDiff.diffWords: Word (as defined by \b regex) diff which ignores whitespace + * JsDiff.diffLines: Line based diff + * + * JsDiff.diffCss: Diff targeted at CSS content + * + * These methods are based on the implementation proposed in + * "An O(ND) Difference Algorithm and its Variations" (Myers, 1986). + * http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.4.6927 + */ -},{"./convert/dmp":2,"./convert/xml":3,"./diff/base":4,"./diff/character":5,"./diff/css":6,"./diff/json":7,"./diff/line":8,"./diff/sentence":9,"./diff/word":10,"./patch/apply":12,"./patch/create":13,"./patch/parse":14}],12:[function(require,module,exports){ +},{"./convert/dmp":2,"./convert/xml":3,"./diff/array":4,"./diff/base":5,"./diff/character":6,"./diff/css":7,"./diff/json":8,"./diff/line":9,"./diff/sentence":10,"./diff/word":11,"./patch/apply":13,"./patch/create":14,"./patch/parse":15}],13:[function(require,module,exports){ /*istanbul ignore start*/'use strict'; exports.__esModule = true; @@ -694,7 +723,8 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'd } // Apply the diff to the input - var lines = source.split('\n'), + var lines = source.split(/\r\n|[\n\v\f\r\x85]/), + delimiters = source.match(/\r\n|[\n\v\f\r\x85]/g) || [], hunks = uniDiff.hunks, compareLine = options.compareLine || function (lineNumber, line, operation, patchContent) /*istanbul ignore start*/{ return (/*istanbul ignore end*/line === patchContent @@ -768,15 +798,18 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'd for (var j = 0; j < _hunk.lines.length; j++) { var line = _hunk.lines[j], operation = line[0], - content = line.substr(1); + content = line.substr(1), + delimiter = _hunk.linedelimiters[j]; if (operation === ' ') { _toPos++; } else if (operation === '-') { lines.splice(_toPos, 1); + delimiters.splice(_toPos, 1); /* istanbul ignore else */ } else if (operation === '+') { lines.splice(_toPos, 0, content); + delimiters.splice(_toPos, 0, delimiter); _toPos++; } else if (operation === '\\') { var previousOperation = _hunk.lines[j - 1] ? _hunk.lines[j - 1][0] : null; @@ -793,11 +826,16 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'd if (removeEOFNL) { while (!lines[lines.length - 1]) { lines.pop(); + delimiters.pop(); } } else if (addEOFNL) { lines.push(''); + delimiters.push('\n'); } - return lines.join('\n'); + for (var _k = 0; _k < lines.length - 1; _k++) { + lines[_k] = lines[_k] + delimiters[_k]; + } + return lines.join(''); } // Wrapper that supports multiple file patches via callbacks. @@ -832,7 +870,7 @@ function applyPatches(uniDiff, options) { } -},{"../util/distance-iterator":15,"./parse":14}],13:[function(require,module,exports){ +},{"../util/distance-iterator":16,"./parse":15}],14:[function(require,module,exports){ /*istanbul ignore start*/'use strict'; exports.__esModule = true; @@ -987,7 +1025,7 @@ function createPatch(fileName, oldStr, newStr, oldHeader, newHeader, options) { } -},{"../diff/line":8}],14:[function(require,module,exports){ +},{"../diff/line":9}],15:[function(require,module,exports){ /*istanbul ignore start*/'use strict'; exports.__esModule = true; @@ -995,7 +1033,8 @@ exports. /*istanbul ignore end*/parsePatch = parsePatch; function parsePatch(uniDiff) { /*istanbul ignore start*/var /*istanbul ignore end*/options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; - var diffstr = uniDiff.split('\n'), + var diffstr = uniDiff.split(/\r\n|[\n\v\f\r\x85]/), + delimiters = uniDiff.match(/\r\n|[\n\v\f\r\x85]/g) || [], list = [], i = 0; @@ -1071,7 +1110,8 @@ function parsePatch(uniDiff) { oldLines: +chunkHeader[2] || 1, newStart: +chunkHeader[3], newLines: +chunkHeader[4] || 1, - lines: [] + lines: [], + linedelimiters: [] }; var addCount = 0, @@ -1086,6 +1126,7 @@ function parsePatch(uniDiff) { if (operation === '+' || operation === '-' || operation === ' ' || operation === '\\') { hunk.lines.push(diffstr[i]); + hunk.linedelimiters.push(delimiters[i] || '\n'); if (operation === '+') { addCount++; @@ -1129,7 +1170,7 @@ function parsePatch(uniDiff) { } -},{}],15:[function(require,module,exports){ +},{}],16:[function(require,module,exports){ /*istanbul ignore start*/"use strict"; exports.__esModule = true; @@ -1178,7 +1219,7 @@ exports["default"] = /*istanbul ignore end*/function (start, minLine, maxLine) { }; -},{}],16:[function(require,module,exports){ +},{}],17:[function(require,module,exports){ /*istanbul ignore start*/'use strict'; exports.__esModule = true; @@ -1198,7 +1239,7 @@ function generateOptions(options, defaults) { } -},{}],17:[function(require,module,exports){ +},{}],18:[function(require,module,exports){ /* * Copyright 2011 Twitter, Inc. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -1623,7 +1664,7 @@ function generateOptions(options, defaults) { } })(typeof exports !== 'undefined' ? exports : Hogan); -},{}],18:[function(require,module,exports){ +},{}],19:[function(require,module,exports){ /* * Copyright 2011 Twitter, Inc. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -1646,7 +1687,7 @@ Hogan.Template = require('./template').Template; Hogan.template = Hogan.Template; module.exports = Hogan; -},{"./compiler":17,"./template":19}],19:[function(require,module,exports){ +},{"./compiler":18,"./template":20}],20:[function(require,module,exports){ /* * Copyright 2011 Twitter, Inc. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -1989,7 +2030,7 @@ var Hogan = {}; })(typeof exports !== 'undefined' ? exports : Hogan); -},{}],20:[function(require,module,exports){ +},{}],21:[function(require,module,exports){ (function (process){ // Copyright Joyent, Inc. and other Node contributors. // @@ -2217,7 +2258,7 @@ var substr = 'ab'.substr(-1) === 'b' ; }).call(this,require('_process')) -},{"_process":21}],21:[function(require,module,exports){ +},{"_process":22}],22:[function(require,module,exports){ // shim for using process in browser var process = module.exports = {}; @@ -2399,7 +2440,7 @@ process.chdir = function (dir) { }; process.umask = function() { return 0; }; -},{}],22:[function(require,module,exports){ +},{}],23:[function(require,module,exports){ /* * * Diff Parser (diff-parser.js) @@ -2434,6 +2475,9 @@ process.umask = function() { return 0; }; var oldLine2 = null; // Used for combined diff var newLine = null; + var possibleOldName; + var possibleNewName; + /* Diff Header */ var oldFileNameHeader = '--- '; var newFileNameHeader = '+++ '; @@ -2452,10 +2496,23 @@ process.umask = function() { return 0; }; * if it has name (to avoid binary files errors) */ function saveFile() { - if (currentFile && currentFile.newName) { - files.push(currentFile); - currentFile = null; + if (currentFile) { + if (!currentFile.oldName) { + currentFile.oldName = possibleOldName; + } + + if (!currentFile.newName) { + currentFile.newName = possibleNewName; + } + + if (currentFile.newName) { + files.push(currentFile); + currentFile = null; + } } + + possibleOldName = undefined; + possibleNewName = undefined; } /* Create file structure */ @@ -2598,6 +2655,7 @@ process.umask = function() { return 0; }; var index = /^index ([0-9a-z]+)\.\.([0-9a-z]+)\s*(\d{6})?/; var binaryFiles = /^Binary files (.*) and (.*) differ/; + var binaryDiff = /^GIT binary patch/; /* Combined Diff */ var combinedIndex = /^index ([0-9a-z]+),([0-9a-z]+)\.\.([0-9a-z]+)/; @@ -2613,12 +2671,23 @@ process.umask = function() { return 0; }; return; } + // Used to store regex capture groups + var values; + var prevLine = diffLines[lineIndex - 1]; var nxtLine = diffLines[lineIndex + 1]; var afterNxtLine = diffLines[lineIndex + 2]; if (utils.startsWith(line, 'diff')) { startFile(); + + // diff --git a/blocked_delta_results.png b/blocked_delta_results.png + var gitDiffStart = /^diff --git "?(.+)"? "?(.+)"?/; + if ((values = gitDiffStart.exec(line))) { + possibleOldName = _getFilename(null, values[1], config.dstPrefix); + possibleNewName = _getFilename(null, values[2], config.srcPrefix); + } + currentFile.isGitDiff = true; return; } @@ -2636,8 +2705,6 @@ process.umask = function() { return 0; }; startFile(); } - var values; - /* * We need to make sure that we have the three lines of the header. * This avoids cases like the ones described in: @@ -2730,8 +2797,12 @@ process.umask = function() { return 0; }; currentFile.isRename = true; } else if ((values = binaryFiles.exec(line))) { currentFile.isBinary = true; - currentFile.oldName = _getFilename(null, values[1], [config.srcPrefix]); - currentFile.newName = _getFilename(null, values[2], [config.dstPrefix]); + currentFile.oldName = _getFilename(null, values[1], config.srcPrefix); + currentFile.newName = _getFilename(null, values[2], config.dstPrefix); + startBlock('Binary file'); + } else if ((values = binaryDiff.exec(line))) { + currentFile.isBinary = true; + startBlock(line); } else if ((values = similarityIndex.exec(line))) { currentFile.unchangedPercentage = values[1]; } else if ((values = dissimilarityIndex.exec(line))) { @@ -2771,26 +2842,19 @@ process.umask = function() { return 0; }; } function getSrcFilename(line, cfg) { - var prefixes = ['a/', 'i/', 'w/', 'c/', 'o/']; - - if (cfg.srcPrefix) { - prefixes.push(cfg.srcPrefix); - } - - return _getFilename('---', line, prefixes); + return _getFilename('---', line, cfg.srcPrefix); } function getDstFilename(line, cfg) { - var prefixes = ['b/', 'i/', 'w/', 'c/', 'o/']; + return _getFilename('\\+\\+\\+', line, cfg.dstPrefix); + } - if (cfg.dstPrefix) { - prefixes.push(cfg.dstPrefix); + function _getFilename(linePrefix, line, extraPrefix) { + var prefixes = ['a/', 'b/', 'i/', 'w/', 'c/', 'o/']; + if (extraPrefix) { + prefixes.push(extraPrefix); } - return _getFilename('\\+\\+\\+', line, prefixes); - } - - function _getFilename(linePrefix, line, prefixes) { var FilenameRegExp; if (linePrefix) { FilenameRegExp = new RegExp('^' + linePrefix + ' "?(.+?)"?$'); @@ -2823,7 +2887,7 @@ process.umask = function() { return 0; }; module.exports.DiffParser = new DiffParser(); })(); -},{"./utils.js":32}],23:[function(require,module,exports){ +},{"./utils.js":33}],24:[function(require,module,exports){ (function (global){ /* * @@ -2934,7 +2998,7 @@ process.umask = function() { return 0; }; })(); }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./diff-parser.js":22,"./html-printer.js":26}],24:[function(require,module,exports){ +},{"./diff-parser.js":23,"./html-printer.js":27}],25:[function(require,module,exports){ /* * * FileListPrinter (file-list-printer.js) @@ -2983,7 +3047,7 @@ process.umask = function() { return 0; }; module.exports.FileListPrinter = FileListPrinter; })(); -},{"./hoganjs-utils.js":25,"./printer-utils.js":28}],25:[function(require,module,exports){ +},{"./hoganjs-utils.js":26,"./printer-utils.js":29}],26:[function(require,module,exports){ (function (__dirname){ /* * @@ -3076,7 +3140,7 @@ process.umask = function() { return 0; }; })(); }).call(this,"/src") -},{"./templates/diff2html-templates.js":31,"fs":1,"hogan.js":18,"path":20}],26:[function(require,module,exports){ +},{"./templates/diff2html-templates.js":32,"fs":1,"hogan.js":19,"path":21}],27:[function(require,module,exports){ /* * * HtmlPrinter (html-printer.js) @@ -3110,7 +3174,7 @@ process.umask = function() { return 0; }; module.exports.HtmlPrinter = new HtmlPrinter(); })(); -},{"./file-list-printer.js":24,"./line-by-line-printer.js":27,"./side-by-side-printer.js":30}],27:[function(require,module,exports){ +},{"./file-list-printer.js":25,"./line-by-line-printer.js":28,"./side-by-side-printer.js":31}],28:[function(require,module,exports){ /* * * LineByLinePrinter (line-by-line-printer.js) @@ -3335,7 +3399,7 @@ process.umask = function() { return 0; }; module.exports.LineByLinePrinter = LineByLinePrinter; })(); -},{"./diff-parser.js":22,"./hoganjs-utils.js":25,"./printer-utils.js":28,"./rematch.js":29,"./utils.js":32}],28:[function(require,module,exports){ +},{"./diff-parser.js":23,"./hoganjs-utils.js":26,"./printer-utils.js":29,"./rematch.js":30,"./utils.js":33}],29:[function(require,module,exports){ /* * * PrinterUtils (printer-utils.js) @@ -3573,7 +3637,7 @@ process.umask = function() { return 0; }; module.exports.PrinterUtils = new PrinterUtils(); })(); -},{"./rematch.js":29,"./utils.js":32,"diff":11}],29:[function(require,module,exports){ +},{"./rematch.js":30,"./utils.js":33,"diff":12}],30:[function(require,module,exports){ /* * * Rematch (rematch.js) @@ -3716,7 +3780,7 @@ process.umask = function() { return 0; }; module.exports.Rematch = Rematch; })(); -},{}],30:[function(require,module,exports){ +},{}],31:[function(require,module,exports){ /* * * HtmlPrinter (html-printer.js) @@ -3976,7 +4040,7 @@ process.umask = function() { return 0; }; module.exports.SideBySidePrinter = SideBySidePrinter; })(); -},{"./diff-parser.js":22,"./hoganjs-utils.js":25,"./printer-utils.js":28,"./rematch.js":29,"./utils.js":32}],31:[function(require,module,exports){ +},{"./diff-parser.js":23,"./hoganjs-utils.js":26,"./printer-utils.js":29,"./rematch.js":30,"./utils.js":33}],32:[function(require,module,exports){ (function (global){ (function() { if (!!!global.browserTemplates) global.browserTemplates = {}; @@ -4003,7 +4067,7 @@ module.exports = global.browserTemplates; })(); }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"hogan.js":18}],32:[function(require,module,exports){ +},{"hogan.js":19}],33:[function(require,module,exports){ /* * * Utils (utils.js) @@ -4045,4 +4109,4 @@ module.exports = global.browserTemplates; module.exports.Utils = new Utils(); })(); -},{}]},{},[23]); +},{}]},{},[24]); diff --git a/dist/diff2html.min.js b/dist/diff2html.min.js index 67045895..9092df6b 100644 --- a/dist/diff2html.min.js +++ b/dist/diff2html.min.js @@ -1,4 +1,4 @@ -!function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a="function"==typeof require&&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}for(var i="function"==typeof require&&require,o=0;o"):change.removed&&ret.push(""),ret.push(escapeHTML(change.value)),change.added?ret.push(""):change.removed&&ret.push("")}return ret.join("")}function escapeHTML(s){var n=s;return n=n.replace(/&/g,"&"),n=n.replace(//g,">"),n=n.replace(/"/g,""")}exports.__esModule=!0,exports.convertChangesToXML=convertChangesToXML},{}],4:[function(require,module,exports){"use strict";function Diff(){}function buildValues(diff,components,newString,oldString,useLongestToken){for(var componentPos=0,componentLen=components.length,newPos=0,oldPos=0;componentLen>componentPos;componentPos++){var component=components[componentPos];if(component.removed){if(component.value=oldString.slice(oldPos,oldPos+component.count).join(""),oldPos+=component.count,componentPos&&components[componentPos-1].added){var tmp=components[componentPos-1];components[componentPos-1]=components[componentPos],components[componentPos]=tmp}}else{if(!component.added&&useLongestToken){var value=newString.slice(newPos,newPos+component.count);value=value.map(function(value,i){var oldValue=oldString[oldPos+i];return oldValue.length>value.length?oldValue:value}),component.value=value.join("")}else component.value=newString.slice(newPos,newPos+component.count).join("");newPos+=component.count,component.added||(oldPos+=component.count)}}var lastComponent=components[componentLen-1];return componentLen>1&&(lastComponent.added||lastComponent.removed)&&diff.equals("",lastComponent.value)&&(components[componentLen-2].value+=lastComponent.value,components.pop()),components}function clonePath(path){return{newPos:path.newPos,components:path.components.slice(0)}}exports.__esModule=!0,exports["default"]=Diff,Diff.prototype={diff:function(oldString,newString){function done(value){return callback?(setTimeout(function(){callback(void 0,value)},0),!0):value}function execEditLength(){for(var diagonalPath=-1*editLength;editLength>=diagonalPath;diagonalPath+=2){var basePath=void 0,addPath=bestPath[diagonalPath-1],removePath=bestPath[diagonalPath+1],_oldPos=(removePath?removePath.newPos:0)-diagonalPath;addPath&&(bestPath[diagonalPath-1]=void 0);var canAdd=addPath&&addPath.newPos+1=0&&oldLen>_oldPos;if(canAdd||canRemove){if(!canAdd||canRemove&&addPath.newPos=newLen&&_oldPos+1>=oldLen)return done(buildValues(self,basePath.components,newString,oldString,self.useLongestToken));bestPath[diagonalPath]=basePath}else bestPath[diagonalPath]=void 0}editLength++}var options=arguments.length<=2||void 0===arguments[2]?{}:arguments[2],callback=options.callback;"function"==typeof options&&(callback=options,options={}),this.options=options;var self=this;oldString=this.castInput(oldString),newString=this.castInput(newString),oldString=this.removeEmpty(this.tokenize(oldString)),newString=this.removeEmpty(this.tokenize(newString));var newLen=newString.length,oldLen=oldString.length,editLength=1,maxEditLength=newLen+oldLen,bestPath=[{newPos:-1,components:[]}],oldPos=this.extractCommon(bestPath[0],newString,oldString,0);if(bestPath[0].newPos+1>=newLen&&oldPos+1>=oldLen)return done([{value:newString.join(""),count:newString.length}]);if(callback)!function exec(){setTimeout(function(){return editLength>maxEditLength?callback():void(execEditLength()||exec())},0)}();else for(;maxEditLength>=editLength;){var ret=execEditLength();if(ret)return ret}},pushComponent:function(components,added,removed){var last=components[components.length-1];last&&last.added===added&&last.removed===removed?components[components.length-1]={count:last.count+1,added:added,removed:removed}:components.push({count:1,added:added,removed:removed})},extractCommon:function(basePath,newString,oldString,diagonalPath){for(var newLen=newString.length,oldLen=oldString.length,newPos=basePath.newPos,oldPos=newPos-diagonalPath,commonCount=0;newLen>newPos+1&&oldLen>oldPos+1&&this.equals(newString[newPos+1],oldString[oldPos+1]);)newPos++,oldPos++,commonCount++;return commonCount&&basePath.components.push({count:commonCount}),basePath.newPos=newPos,oldPos},equals:function(left,right){return left===right},removeEmpty:function(array){for(var ret=[],i=0;ifuzzFactor))return!1;toPos++}}return!0}var options=arguments.length<=2||void 0===arguments[2]?{}:arguments[2];if("string"==typeof uniDiff&&(uniDiff=_parse.parsePatch(uniDiff)),Array.isArray(uniDiff)){if(uniDiff.length>1)throw new Error("applyPatch only works with a single input.");uniDiff=uniDiff[0]}for(var lines=source.split("\n"),hunks=uniDiff.hunks,compareLine=options.compareLine||function(lineNumber,line,operation,patchContent){return line===patchContent},errorCount=0,fuzzFactor=options.fuzzFactor||0,minLine=0,offset=0,removeEOFNL=void 0,addEOFNL=void 0,i=0;i0?contextLines(prev.lines.slice(-options.context)):[],oldRangeStart-=curRange.length,newRangeStart-=curRange.length)}(_curRange=curRange).push.apply(_curRange,_toConsumableArray(lines.map(function(entry){return(current.added?"+":"-")+entry}))),current.added?newLine+=lines.length:oldLine+=lines.length}else{if(oldRangeStart)if(lines.length<=2*options.context&&i=diff.length-2&&lines.length<=options.context){var oldEOFNewline=/\n$/.test(oldStr),newEOFNewline=/\n$/.test(newStr);0!=lines.length||oldEOFNewline?oldEOFNewline&&newEOFNewline||curRange.push("\\ No newline at end of file"):curRange.splice(hunk.oldLines,0,"\\ No newline at end of file")}hunks.push(hunk),oldRangeStart=0,newRangeStart=0,curRange=[]}oldLine+=lines.length,newLine+=lines.length}},i=0;i=start+localOffset)return localOffset;forwardExhausted=!0}return backwardExhausted?void 0:(forwardExhausted||(wantForward=!0),start-localOffset>=minLine?-localOffset++:(backwardExhausted=!0,iterator()))}}},{}],16:[function(require,module,exports){"use strict";function generateOptions(options,defaults){if("function"==typeof options)defaults.callback=options;else if(options)for(var name in options)options.hasOwnProperty(name)&&(defaults[name]=options[name]);return defaults}exports.__esModule=!0,exports.generateOptions=generateOptions},{}],17:[function(require,module,exports){!function(Hogan){function cleanTripleStache(token){"}"===token.n.substr(token.n.length-1)&&(token.n=token.n.substring(0,token.n.length-1))}function trim(s){return s.trim?s.trim():s.replace(/^\s*|\s*$/g,"")}function tagChange(tag,text,index){if(text.charAt(index)!=tag.charAt(0))return!1;for(var i=1,l=tag.length;l>i;i++)if(text.charAt(index+i)!=tag.charAt(i))return!1;return!0}function buildTree(tokens,kind,stack,customTags){var instructions=[],opener=null,tail=null,token=null;for(tail=stack[stack.length-1];tokens.length>0;){if(token=tokens.shift(),tail&&"<"==tail.tag&&!(token.tag in allowedInSuper))throw new Error("Illegal content in < super tag.");if(Hogan.tags[token.tag]<=Hogan.tags.$||isOpener(token,customTags))stack.push(token),token.nodes=buildTree(tokens,token.tag,stack,customTags);else{if("/"==token.tag){if(0===stack.length)throw new Error("Closing tag without opener: /"+token.n);if(opener=stack.pop(),token.n!=opener.n&&!isCloser(token.n,opener.n,customTags))throw new Error("Nesting error: "+opener.n+" vs. "+token.n);return opener.end=token.i,instructions}"\n"==token.tag&&(token.last=0==tokens.length||"\n"==tokens[0].tag)}instructions.push(token)}if(stack.length>0)throw new Error("missing closing tag: "+stack.pop().n);return instructions}function isOpener(token,tags){for(var i=0,l=tags.length;l>i;i++)if(tags[i].o==token.n)return token.tag="#",!0}function isCloser(close,open,tags){for(var i=0,l=tags.length;l>i;i++)if(tags[i].c==close&&tags[i].o==open)return!0}function stringifySubstitutions(obj){var items=[];for(var key in obj)items.push('"'+esc(key)+'": function(c,p,t,i) {'+obj[key]+"}");return"{ "+items.join(",")+" }"}function stringifyPartials(codeObj){var partials=[];for(var key in codeObj.partials)partials.push('"'+esc(key)+'":{name:"'+esc(codeObj.partials[key].name)+'", '+stringifyPartials(codeObj.partials[key])+"}");return"partials: {"+partials.join(",")+"}, subs: "+stringifySubstitutions(codeObj.subs)}function esc(s){return s.replace(rSlash,"\\\\").replace(rQuot,'\\"').replace(rNewline,"\\n").replace(rCr,"\\r").replace(rLineSep,"\\u2028").replace(rParagraphSep,"\\u2029")}function chooseMethod(s){return~s.indexOf(".")?"d":"f"}function createPartial(node,context){var prefix="<"+(context.prefix||""),sym=prefix+node.n+serialNo++;return context.partials[sym]={name:node.n,partials:{}},context.code+='t.b(t.rp("'+esc(sym)+'",c,p,"'+(node.indent||"")+'"));',sym}function tripleStache(node,context){context.code+="t.b(t.t(t."+chooseMethod(node.n)+'("'+esc(node.n)+'",c,p,0)));'}function write(s){return"t.b("+s+");"}var rIsWhitespace=/\S/,rQuot=/\"/g,rNewline=/\n/g,rCr=/\r/g,rSlash=/\\/g,rLineSep=/\u2028/,rParagraphSep=/\u2029/;Hogan.tags={"#":1,"^":2,"<":3,$:4,"/":5,"!":6,">":7,"=":8,_v:9,"{":10,"&":11,_t:12},Hogan.scan=function(text,delimiters){function addBuf(){buf.length>0&&(tokens.push({tag:"_t",text:new String(buf)}),buf="")}function lineIsWhitespace(){for(var isAllWhitespace=!0,j=lineStart;j"==next.tag&&(next.indent=tokens[j].text.toString()),tokens.splice(j,1));else noNewLine||tokens.push({tag:"\n"});seenTag=!1,lineStart=tokens.length}function changeDelimiters(text,index){var close="="+ctag,closeIndex=text.indexOf(close,index),delimiters=trim(text.substring(text.indexOf("=",index)+1,closeIndex)).split(" ");return otag=delimiters[0],ctag=delimiters[delimiters.length-1],closeIndex+close.length-1}var len=text.length,IN_TEXT=0,IN_TAG_TYPE=1,IN_TAG=2,state=IN_TEXT,tagType=null,tag=null,buf="",tokens=[],seenTag=!1,i=0,lineStart=0,otag="{{",ctag="}}";for(delimiters&&(delimiters=delimiters.split(" "),otag=delimiters[0],ctag=delimiters[1]),i=0;len>i;i++)state==IN_TEXT?tagChange(otag,text,i)?(--i,addBuf(),state=IN_TAG_TYPE):"\n"==text.charAt(i)?filterLine(seenTag):buf+=text.charAt(i):state==IN_TAG_TYPE?(i+=otag.length-1,tag=Hogan.tags[text.charAt(i+1)],tagType=tag?text.charAt(i+1):"_v","="==tagType?(i=changeDelimiters(text,i),state=IN_TEXT):(tag&&i++,state=IN_TAG),seenTag=i):tagChange(ctag,text,i)?(tokens.push({tag:tagType,n:trim(buf),otag:otag,ctag:ctag,i:"/"==tagType?seenTag-otag.length:i+ctag.length}),buf="",i+=ctag.length-1,state=IN_TEXT,"{"==tagType&&("}}"==ctag?i++:cleanTripleStache(tokens[tokens.length-1]))):buf+=text.charAt(i);return filterLine(seenTag,!0),tokens};var allowedInSuper={_t:!0,"\n":!0,$:!0,"/":!0};Hogan.stringify=function(codeObj){return"{code: function (c,p,i) { "+Hogan.wrapMain(codeObj.code)+" },"+stringifyPartials(codeObj)+"}"};var serialNo=0;Hogan.generate=function(tree,text,options){serialNo=0;var context={code:"",subs:{},partials:{}};return Hogan.walk(tree,context),options.asString?this.stringify(context,text,options):this.makeTemplate(context,text,options)},Hogan.wrapMain=function(code){return'var t=this;t.b(i=i||"");'+code+"return t.fl();"},Hogan.template=Hogan.Template,Hogan.makeTemplate=function(codeObj,text,options){var template=this.makePartials(codeObj);return template.code=new Function("c","p","i",this.wrapMain(codeObj.code)),new this.template(template,text,this,options)},Hogan.makePartials=function(codeObj){var key,template={subs:{},partials:codeObj.partials,name:codeObj.name};for(key in template.partials)template.partials[key]=this.makePartials(template.partials[key]);for(key in codeObj.subs)template.subs[key]=new Function("c","p","t","i",codeObj.subs[key]);return template},Hogan.codegen={"#":function(node,context){context.code+="if(t.s(t."+chooseMethod(node.n)+'("'+esc(node.n)+'",c,p,1),c,p,0,'+node.i+","+node.end+',"'+node.otag+" "+node.ctag+'")){t.rs(c,p,function(c,p,t){',Hogan.walk(node.nodes,context),context.code+="});c.pop();}"},"^":function(node,context){context.code+="if(!t.s(t."+chooseMethod(node.n)+'("'+esc(node.n)+'",c,p,1),c,p,1,0,0,"")){',Hogan.walk(node.nodes,context),context.code+="};"},">":createPartial,"<":function(node,context){var ctx={partials:{},code:"",subs:{},inPartial:!0};Hogan.walk(node.nodes,ctx);var template=context.partials[createPartial(node,context)];template.subs=ctx.subs,template.partials=ctx.partials},$:function(node,context){var ctx={subs:{},code:"",partials:context.partials,prefix:node.n};Hogan.walk(node.nodes,ctx),context.subs[node.n]=ctx.code,context.inPartial||(context.code+='t.sub("'+esc(node.n)+'",c,p,i);')},"\n":function(node,context){context.code+=write('"\\n"'+(node.last?"":" + i"))},_v:function(node,context){context.code+="t.b(t.v(t."+chooseMethod(node.n)+'("'+esc(node.n)+'",c,p,0)));'},_t:function(node,context){context.code+=write('"'+esc(node.text)+'"')},"{":tripleStache,"&":tripleStache},Hogan.walk=function(nodelist,context){for(var func,i=0,l=nodelist.length;l>i;i++)func=Hogan.codegen[nodelist[i].tag],func&&func(nodelist[i],context);return context},Hogan.parse=function(tokens,text,options){return options=options||{},buildTree(tokens,"",[],options.sectionTags||[])},Hogan.cache={},Hogan.cacheKey=function(text,options){return[text,!!options.asString,!!options.disableLambda,options.delimiters,!!options.modelGet].join("||")},Hogan.compile=function(text,options){options=options||{};var key=Hogan.cacheKey(text,options),template=this.cache[key];if(template){var partials=template.partials;for(var name in partials)delete partials[name].instance;return template}return template=this.generate(this.parse(this.scan(text,options.delimiters),text,options),text,options),this.cache[key]=template}}("undefined"!=typeof exports?exports:Hogan)},{}],18:[function(require,module){var Hogan=require("./compiler");Hogan.Template=require("./template").Template,Hogan.template=Hogan.Template,module.exports=Hogan},{"./compiler":17,"./template":19}],19:[function(require,module,exports){var Hogan={};!function(Hogan){function findInScope(key,scope,doModelGet){var val;return scope&&"object"==typeof scope&&(void 0!==scope[key]?val=scope[key]:doModelGet&&scope.get&&"function"==typeof scope.get&&(val=scope.get(key))),val}function createSpecializedPartial(instance,subs,partials,stackSubs,stackPartials,stackText){function PartialTemplate(){}function Substitutions(){}PartialTemplate.prototype=instance,Substitutions.prototype=instance.subs;var key,partial=new PartialTemplate;partial.subs=new Substitutions,partial.subsText={},partial.buf="",stackSubs=stackSubs||{},partial.stackSubs=stackSubs,partial.subsText=stackText;for(key in subs)stackSubs[key]||(stackSubs[key]=subs[key]);for(key in stackSubs)partial.subs[key]=stackSubs[key];stackPartials=stackPartials||{},partial.stackPartials=stackPartials;for(key in partials)stackPartials[key]||(stackPartials[key]=partials[key]);for(key in stackPartials)partial.partials[key]=stackPartials[key];return partial}function coerceToString(val){return String(null===val||void 0===val?"":val)}function hoganEscape(str){return str=coerceToString(str),hChars.test(str)?str.replace(rAmp,"&").replace(rLt,"<").replace(rGt,">").replace(rApos,"'").replace(rQuot,"""):str}Hogan.Template=function(codeObj,text,compiler,options){codeObj=codeObj||{},this.r=codeObj.code||this.r,this.c=compiler,this.options=options||{},this.text=text||"",this.partials=codeObj.partials||{},this.subs=codeObj.subs||{},this.buf=""},Hogan.Template.prototype={r:function(){return""},v:hoganEscape,t:coerceToString,render:function(context,partials,indent){return this.ri([context],partials||{},indent); +!function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a="function"==typeof require&&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}for(var i="function"==typeof require&&require,o=0;o"):change.removed&&ret.push(""),ret.push(escapeHTML(change.value)),change.added?ret.push(""):change.removed&&ret.push("")}return ret.join("")}function escapeHTML(s){var n=s;return n=n.replace(/&/g,"&"),n=n.replace(//g,">"),n=n.replace(/"/g,""")}exports.__esModule=!0,exports.convertChangesToXML=convertChangesToXML},{}],4:[function(require,module,exports){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{"default":obj}}function diffArrays(oldArr,newArr,callback){return arrayDiff.diff(oldArr,newArr,callback)}exports.__esModule=!0,exports.arrayDiff=void 0,exports.diffArrays=diffArrays;var _base=require("./base"),_base2=_interopRequireDefault(_base),arrayDiff=exports.arrayDiff=new _base2["default"];arrayDiff.tokenize=arrayDiff.join=function(value){return value.slice()}},{"./base":5}],5:[function(require,module,exports){"use strict";function Diff(){}function buildValues(diff,components,newString,oldString,useLongestToken){for(var componentPos=0,componentLen=components.length,newPos=0,oldPos=0;componentLen>componentPos;componentPos++){var component=components[componentPos];if(component.removed){if(component.value=diff.join(oldString.slice(oldPos,oldPos+component.count)),oldPos+=component.count,componentPos&&components[componentPos-1].added){var tmp=components[componentPos-1];components[componentPos-1]=components[componentPos],components[componentPos]=tmp}}else{if(!component.added&&useLongestToken){var value=newString.slice(newPos,newPos+component.count);value=value.map(function(value,i){var oldValue=oldString[oldPos+i];return oldValue.length>value.length?oldValue:value}),component.value=diff.join(value)}else component.value=diff.join(newString.slice(newPos,newPos+component.count));newPos+=component.count,component.added||(oldPos+=component.count)}}var lastComponent=components[componentLen-1];return componentLen>1&&(lastComponent.added||lastComponent.removed)&&diff.equals("",lastComponent.value)&&(components[componentLen-2].value+=lastComponent.value,components.pop()),components}function clonePath(path){return{newPos:path.newPos,components:path.components.slice(0)}}exports.__esModule=!0,exports["default"]=Diff,Diff.prototype={diff:function(oldString,newString){function done(value){return callback?(setTimeout(function(){callback(void 0,value)},0),!0):value}function execEditLength(){for(var diagonalPath=-1*editLength;editLength>=diagonalPath;diagonalPath+=2){var basePath=void 0,addPath=bestPath[diagonalPath-1],removePath=bestPath[diagonalPath+1],_oldPos=(removePath?removePath.newPos:0)-diagonalPath;addPath&&(bestPath[diagonalPath-1]=void 0);var canAdd=addPath&&addPath.newPos+1=0&&oldLen>_oldPos;if(canAdd||canRemove){if(!canAdd||canRemove&&addPath.newPos=newLen&&_oldPos+1>=oldLen)return done(buildValues(self,basePath.components,newString,oldString,self.useLongestToken));bestPath[diagonalPath]=basePath}else bestPath[diagonalPath]=void 0}editLength++}var options=arguments.length<=2||void 0===arguments[2]?{}:arguments[2],callback=options.callback;"function"==typeof options&&(callback=options,options={}),this.options=options;var self=this;oldString=this.castInput(oldString),newString=this.castInput(newString),oldString=this.removeEmpty(this.tokenize(oldString)),newString=this.removeEmpty(this.tokenize(newString));var newLen=newString.length,oldLen=oldString.length,editLength=1,maxEditLength=newLen+oldLen,bestPath=[{newPos:-1,components:[]}],oldPos=this.extractCommon(bestPath[0],newString,oldString,0);if(bestPath[0].newPos+1>=newLen&&oldPos+1>=oldLen)return done([{value:this.join(newString),count:newString.length}]);if(callback)!function exec(){setTimeout(function(){return editLength>maxEditLength?callback():void(execEditLength()||exec())},0)}();else for(;maxEditLength>=editLength;){var ret=execEditLength();if(ret)return ret}},pushComponent:function(components,added,removed){var last=components[components.length-1];last&&last.added===added&&last.removed===removed?components[components.length-1]={count:last.count+1,added:added,removed:removed}:components.push({count:1,added:added,removed:removed})},extractCommon:function(basePath,newString,oldString,diagonalPath){for(var newLen=newString.length,oldLen=oldString.length,newPos=basePath.newPos,oldPos=newPos-diagonalPath,commonCount=0;newLen>newPos+1&&oldLen>oldPos+1&&this.equals(newString[newPos+1],oldString[oldPos+1]);)newPos++,oldPos++,commonCount++;return commonCount&&basePath.components.push({count:commonCount}),basePath.newPos=newPos,oldPos},equals:function(left,right){return left===right},removeEmpty:function(array){for(var ret=[],i=0;ifuzzFactor))return!1;toPos++}}return!0}var options=arguments.length<=2||void 0===arguments[2]?{}:arguments[2];if("string"==typeof uniDiff&&(uniDiff=_parse.parsePatch(uniDiff)),Array.isArray(uniDiff)){if(uniDiff.length>1)throw new Error("applyPatch only works with a single input.");uniDiff=uniDiff[0]}for(var lines=source.split(/\r\n|[\n\v\f\r\x85]/),delimiters=source.match(/\r\n|[\n\v\f\r\x85]/g)||[],hunks=uniDiff.hunks,compareLine=options.compareLine||function(lineNumber,line,operation,patchContent){return line===patchContent},errorCount=0,fuzzFactor=options.fuzzFactor||0,minLine=0,offset=0,removeEOFNL=void 0,addEOFNL=void 0,i=0;i0?contextLines(prev.lines.slice(-options.context)):[],oldRangeStart-=curRange.length,newRangeStart-=curRange.length)}(_curRange=curRange).push.apply(_curRange,_toConsumableArray(lines.map(function(entry){return(current.added?"+":"-")+entry}))),current.added?newLine+=lines.length:oldLine+=lines.length}else{if(oldRangeStart)if(lines.length<=2*options.context&&i=diff.length-2&&lines.length<=options.context){var oldEOFNewline=/\n$/.test(oldStr),newEOFNewline=/\n$/.test(newStr);0!=lines.length||oldEOFNewline?oldEOFNewline&&newEOFNewline||curRange.push("\\ No newline at end of file"):curRange.splice(hunk.oldLines,0,"\\ No newline at end of file")}hunks.push(hunk),oldRangeStart=0,newRangeStart=0,curRange=[]}oldLine+=lines.length,newLine+=lines.length}},i=0;i=start+localOffset)return localOffset;forwardExhausted=!0}return backwardExhausted?void 0:(forwardExhausted||(wantForward=!0),start-localOffset>=minLine?-localOffset++:(backwardExhausted=!0,iterator()))}}},{}],17:[function(require,module,exports){"use strict";function generateOptions(options,defaults){if("function"==typeof options)defaults.callback=options;else if(options)for(var name in options)options.hasOwnProperty(name)&&(defaults[name]=options[name]);return defaults}exports.__esModule=!0,exports.generateOptions=generateOptions},{}],18:[function(require,module,exports){!function(Hogan){function cleanTripleStache(token){"}"===token.n.substr(token.n.length-1)&&(token.n=token.n.substring(0,token.n.length-1))}function trim(s){return s.trim?s.trim():s.replace(/^\s*|\s*$/g,"")}function tagChange(tag,text,index){if(text.charAt(index)!=tag.charAt(0))return!1;for(var i=1,l=tag.length;l>i;i++)if(text.charAt(index+i)!=tag.charAt(i))return!1;return!0}function buildTree(tokens,kind,stack,customTags){var instructions=[],opener=null,tail=null,token=null;for(tail=stack[stack.length-1];tokens.length>0;){if(token=tokens.shift(),tail&&"<"==tail.tag&&!(token.tag in allowedInSuper))throw new Error("Illegal content in < super tag.");if(Hogan.tags[token.tag]<=Hogan.tags.$||isOpener(token,customTags))stack.push(token),token.nodes=buildTree(tokens,token.tag,stack,customTags);else{if("/"==token.tag){if(0===stack.length)throw new Error("Closing tag without opener: /"+token.n);if(opener=stack.pop(),token.n!=opener.n&&!isCloser(token.n,opener.n,customTags))throw new Error("Nesting error: "+opener.n+" vs. "+token.n);return opener.end=token.i,instructions}"\n"==token.tag&&(token.last=0==tokens.length||"\n"==tokens[0].tag)}instructions.push(token)}if(stack.length>0)throw new Error("missing closing tag: "+stack.pop().n);return instructions}function isOpener(token,tags){for(var i=0,l=tags.length;l>i;i++)if(tags[i].o==token.n)return token.tag="#",!0}function isCloser(close,open,tags){for(var i=0,l=tags.length;l>i;i++)if(tags[i].c==close&&tags[i].o==open)return!0}function stringifySubstitutions(obj){var items=[];for(var key in obj)items.push('"'+esc(key)+'": function(c,p,t,i) {'+obj[key]+"}");return"{ "+items.join(",")+" }"}function stringifyPartials(codeObj){var partials=[];for(var key in codeObj.partials)partials.push('"'+esc(key)+'":{name:"'+esc(codeObj.partials[key].name)+'", '+stringifyPartials(codeObj.partials[key])+"}");return"partials: {"+partials.join(",")+"}, subs: "+stringifySubstitutions(codeObj.subs)}function esc(s){return s.replace(rSlash,"\\\\").replace(rQuot,'\\"').replace(rNewline,"\\n").replace(rCr,"\\r").replace(rLineSep,"\\u2028").replace(rParagraphSep,"\\u2029")}function chooseMethod(s){return~s.indexOf(".")?"d":"f"}function createPartial(node,context){var prefix="<"+(context.prefix||""),sym=prefix+node.n+serialNo++;return context.partials[sym]={name:node.n,partials:{}},context.code+='t.b(t.rp("'+esc(sym)+'",c,p,"'+(node.indent||"")+'"));',sym}function tripleStache(node,context){context.code+="t.b(t.t(t."+chooseMethod(node.n)+'("'+esc(node.n)+'",c,p,0)));'}function write(s){return"t.b("+s+");"}var rIsWhitespace=/\S/,rQuot=/\"/g,rNewline=/\n/g,rCr=/\r/g,rSlash=/\\/g,rLineSep=/\u2028/,rParagraphSep=/\u2029/;Hogan.tags={"#":1,"^":2,"<":3,$:4,"/":5,"!":6,">":7,"=":8,_v:9,"{":10,"&":11,_t:12},Hogan.scan=function(text,delimiters){function addBuf(){buf.length>0&&(tokens.push({tag:"_t",text:new String(buf)}),buf="")}function lineIsWhitespace(){for(var isAllWhitespace=!0,j=lineStart;j"==next.tag&&(next.indent=tokens[j].text.toString()),tokens.splice(j,1));else noNewLine||tokens.push({tag:"\n"});seenTag=!1,lineStart=tokens.length}function changeDelimiters(text,index){var close="="+ctag,closeIndex=text.indexOf(close,index),delimiters=trim(text.substring(text.indexOf("=",index)+1,closeIndex)).split(" ");return otag=delimiters[0],ctag=delimiters[delimiters.length-1],closeIndex+close.length-1}var len=text.length,IN_TEXT=0,IN_TAG_TYPE=1,IN_TAG=2,state=IN_TEXT,tagType=null,tag=null,buf="",tokens=[],seenTag=!1,i=0,lineStart=0,otag="{{",ctag="}}";for(delimiters&&(delimiters=delimiters.split(" "),otag=delimiters[0],ctag=delimiters[1]),i=0;len>i;i++)state==IN_TEXT?tagChange(otag,text,i)?(--i,addBuf(),state=IN_TAG_TYPE):"\n"==text.charAt(i)?filterLine(seenTag):buf+=text.charAt(i):state==IN_TAG_TYPE?(i+=otag.length-1,tag=Hogan.tags[text.charAt(i+1)],tagType=tag?text.charAt(i+1):"_v","="==tagType?(i=changeDelimiters(text,i),state=IN_TEXT):(tag&&i++,state=IN_TAG),seenTag=i):tagChange(ctag,text,i)?(tokens.push({tag:tagType,n:trim(buf),otag:otag,ctag:ctag,i:"/"==tagType?seenTag-otag.length:i+ctag.length}),buf="",i+=ctag.length-1,state=IN_TEXT,"{"==tagType&&("}}"==ctag?i++:cleanTripleStache(tokens[tokens.length-1]))):buf+=text.charAt(i);return filterLine(seenTag,!0),tokens};var allowedInSuper={_t:!0,"\n":!0,$:!0,"/":!0};Hogan.stringify=function(codeObj){return"{code: function (c,p,i) { "+Hogan.wrapMain(codeObj.code)+" },"+stringifyPartials(codeObj)+"}"};var serialNo=0;Hogan.generate=function(tree,text,options){serialNo=0;var context={code:"",subs:{},partials:{}};return Hogan.walk(tree,context),options.asString?this.stringify(context,text,options):this.makeTemplate(context,text,options)},Hogan.wrapMain=function(code){return'var t=this;t.b(i=i||"");'+code+"return t.fl();"},Hogan.template=Hogan.Template,Hogan.makeTemplate=function(codeObj,text,options){var template=this.makePartials(codeObj);return template.code=new Function("c","p","i",this.wrapMain(codeObj.code)),new this.template(template,text,this,options)},Hogan.makePartials=function(codeObj){var key,template={subs:{},partials:codeObj.partials,name:codeObj.name};for(key in template.partials)template.partials[key]=this.makePartials(template.partials[key]);for(key in codeObj.subs)template.subs[key]=new Function("c","p","t","i",codeObj.subs[key]);return template},Hogan.codegen={"#":function(node,context){context.code+="if(t.s(t."+chooseMethod(node.n)+'("'+esc(node.n)+'",c,p,1),c,p,0,'+node.i+","+node.end+',"'+node.otag+" "+node.ctag+'")){t.rs(c,p,function(c,p,t){',Hogan.walk(node.nodes,context),context.code+="});c.pop();}"},"^":function(node,context){context.code+="if(!t.s(t."+chooseMethod(node.n)+'("'+esc(node.n)+'",c,p,1),c,p,1,0,0,"")){',Hogan.walk(node.nodes,context),context.code+="};"},">":createPartial,"<":function(node,context){var ctx={partials:{},code:"",subs:{},inPartial:!0};Hogan.walk(node.nodes,ctx);var template=context.partials[createPartial(node,context)];template.subs=ctx.subs,template.partials=ctx.partials},$:function(node,context){var ctx={subs:{},code:"",partials:context.partials,prefix:node.n};Hogan.walk(node.nodes,ctx),context.subs[node.n]=ctx.code,context.inPartial||(context.code+='t.sub("'+esc(node.n)+'",c,p,i);')},"\n":function(node,context){context.code+=write('"\\n"'+(node.last?"":" + i"))},_v:function(node,context){context.code+="t.b(t.v(t."+chooseMethod(node.n)+'("'+esc(node.n)+'",c,p,0)));'},_t:function(node,context){context.code+=write('"'+esc(node.text)+'"')},"{":tripleStache,"&":tripleStache},Hogan.walk=function(nodelist,context){for(var func,i=0,l=nodelist.length;l>i;i++)func=Hogan.codegen[nodelist[i].tag],func&&func(nodelist[i],context);return context},Hogan.parse=function(tokens,text,options){return options=options||{},buildTree(tokens,"",[],options.sectionTags||[])},Hogan.cache={},Hogan.cacheKey=function(text,options){return[text,!!options.asString,!!options.disableLambda,options.delimiters,!!options.modelGet].join("||")},Hogan.compile=function(text,options){options=options||{};var key=Hogan.cacheKey(text,options),template=this.cache[key];if(template){var partials=template.partials;for(var name in partials)delete partials[name].instance;return template}return template=this.generate(this.parse(this.scan(text,options.delimiters),text,options),text,options),this.cache[key]=template}}("undefined"!=typeof exports?exports:Hogan)},{}],19:[function(require,module){var Hogan=require("./compiler");Hogan.Template=require("./template").Template,Hogan.template=Hogan.Template,module.exports=Hogan},{"./compiler":18,"./template":20}],20:[function(require,module,exports){var Hogan={};!function(Hogan){function findInScope(key,scope,doModelGet){var val;return scope&&"object"==typeof scope&&(void 0!==scope[key]?val=scope[key]:doModelGet&&scope.get&&"function"==typeof scope.get&&(val=scope.get(key))),val}function createSpecializedPartial(instance,subs,partials,stackSubs,stackPartials,stackText){function PartialTemplate(){}function Substitutions(){}PartialTemplate.prototype=instance,Substitutions.prototype=instance.subs;var key,partial=new PartialTemplate;partial.subs=new Substitutions,partial.subsText={}, +partial.buf="",stackSubs=stackSubs||{},partial.stackSubs=stackSubs,partial.subsText=stackText;for(key in subs)stackSubs[key]||(stackSubs[key]=subs[key]);for(key in stackSubs)partial.subs[key]=stackSubs[key];stackPartials=stackPartials||{},partial.stackPartials=stackPartials;for(key in partials)stackPartials[key]||(stackPartials[key]=partials[key]);for(key in stackPartials)partial.partials[key]=stackPartials[key];return partial}function coerceToString(val){return String(null===val||void 0===val?"":val)}function hoganEscape(str){return str=coerceToString(str),hChars.test(str)?str.replace(rAmp,"&").replace(rLt,"<").replace(rGt,">").replace(rApos,"'").replace(rQuot,"""):str}Hogan.Template=function(codeObj,text,compiler,options){codeObj=codeObj||{},this.r=codeObj.code||this.r,this.c=compiler,this.options=options||{},this.text=text||"",this.partials=codeObj.partials||{},this.subs=codeObj.subs||{},this.buf=""},Hogan.Template.prototype={r:function(){return""},v:hoganEscape,t:coerceToString,render:function(context,partials,indent){return this.ri([context],partials||{},indent)},ri:function(context,partials,indent){return this.r(context,partials,indent)},ep:function(symbol,partials){var partial=this.partials[symbol],template=partials[partial.name];if(partial.instance&&partial.base==template)return partial.instance;if("string"==typeof template){if(!this.c)throw new Error("No compiler available.");template=this.c.compile(template,this.options)}if(!template)return null;if(this.partials[symbol].base=template,partial.subs){partials.stackText||(partials.stackText={});for(key in partial.subs)partials.stackText[key]||(partials.stackText[key]=void 0!==this.activeSub&&partials.stackText[this.activeSub]?partials.stackText[this.activeSub]:this.text);template=createSpecializedPartial(template,partial.subs,partial.partials,this.stackSubs,this.stackPartials,partials.stackText)}return this.partials[symbol].instance=template,template},rp:function(symbol,context,partials,indent){var partial=this.ep(symbol,partials);return partial?partial.ri(context,partials,indent):""},rs:function(context,partials,section){var tail=context[context.length-1];if(!isArray(tail))return void section(context,partials,this);for(var i=0;i=0;i--)if(v=ctx[i],val=findInScope(key,v,doModelGet),void 0!==val){found=!0;break}return found?(returnFound||"function"!=typeof val||(val=this.mv(val,ctx,partials)),val):returnFound?!1:""},ls:function(func,cx,partials,text,tags){var oldTags=this.options.delimiters;return this.options.delimiters=tags,this.b(this.ct(coerceToString(func.call(cx,text)),cx,partials)),this.options.delimiters=oldTags,!1},ct:function(text,cx,partials){if(this.options.disableLambda)throw new Error("Lambda features disabled.");return this.c.compile(text,this.options).render(cx,partials)},b:function(s){this.buf+=s},fl:function(){var r=this.buf;return this.buf="",r},ms:function(func,ctx,partials,inverted,start,end,tags){var textSource,cx=ctx[ctx.length-1],result=func.call(cx);return"function"==typeof result?inverted?!0:(textSource=this.activeSub&&this.subsText&&this.subsText[this.activeSub]?this.subsText[this.activeSub]:this.text,this.ls(result,cx,partials,textSource.substring(start,end),tags)):result},mv:function(func,ctx,partials){var cx=ctx[ctx.length-1],result=func.call(cx);return"function"==typeof result?this.ct(coerceToString(result.call(cx)),cx,partials):result},sub:function(name,context,partials,indent){var f=this.subs[name];f&&(this.activeSub=name,f(context,partials,this,indent),this.activeSub=!1)}};var rAmp=/&/g,rLt=//g,rApos=/\'/g,rQuot=/\"/g,hChars=/[&<>\"\']/,isArray=Array.isArray||function(a){return"[object Array]"===Object.prototype.toString.call(a)}}("undefined"!=typeof exports?exports:Hogan)},{}],21:[function(require,module,exports){(function(process){function normalizeArray(parts,allowAboveRoot){for(var up=0,i=parts.length-1;i>=0;i--){var last=parts[i];"."===last?parts.splice(i,1):".."===last?(parts.splice(i,1),up++):up&&(parts.splice(i,1),up--)}if(allowAboveRoot)for(;up--;up)parts.unshift("..");return parts}function filter(xs,f){if(xs.filter)return xs.filter(f);for(var res=[],i=0;i=-1&&!resolvedAbsolute;i--){var path=i>=0?arguments[i]:process.cwd();if("string"!=typeof path)throw new TypeError("Arguments to path.resolve must be strings");path&&(resolvedPath=path+"/"+resolvedPath,resolvedAbsolute="/"===path.charAt(0))}return resolvedPath=normalizeArray(filter(resolvedPath.split("/"),function(p){return!!p}),!resolvedAbsolute).join("/"),(resolvedAbsolute?"/":"")+resolvedPath||"."},exports.normalize=function(path){var isAbsolute=exports.isAbsolute(path),trailingSlash="/"===substr(path,-1);return path=normalizeArray(filter(path.split("/"),function(p){return!!p}),!isAbsolute).join("/"),path||isAbsolute||(path="."),path&&trailingSlash&&(path+="/"),(isAbsolute?"/":"")+path},exports.isAbsolute=function(path){return"/"===path.charAt(0)},exports.join=function(){var paths=Array.prototype.slice.call(arguments,0);return exports.normalize(filter(paths,function(p){if("string"!=typeof p)throw new TypeError("Arguments to path.join must be strings");return p}).join("/"))},exports.relative=function(from,to){function trim(arr){for(var start=0;start=0&&""===arr[end];end--);return start>end?[]:arr.slice(start,end-start+1)}from=exports.resolve(from).substr(1),to=exports.resolve(to).substr(1);for(var fromParts=trim(from.split("/")),toParts=trim(to.split("/")),length=Math.min(fromParts.length,toParts.length),samePartsLength=length,i=0;length>i;i++)if(fromParts[i]!==toParts[i]){samePartsLength=i;break}for(var outputParts=[],i=samePartsLength;istart&&(start=str.length+start),str.substr(start,len)}}).call(this,require("_process"))},{_process:22}],22:[function(require,module){function defaultSetTimout(){throw new Error("setTimeout has not been defined")}function defaultClearTimeout(){throw new Error("clearTimeout has not been defined")}function runTimeout(fun){if(cachedSetTimeout===setTimeout)return setTimeout(fun,0);if((cachedSetTimeout===defaultSetTimout||!cachedSetTimeout)&&setTimeout)return cachedSetTimeout=setTimeout,setTimeout(fun,0);try{return cachedSetTimeout(fun,0)}catch(e){try{return cachedSetTimeout.call(null,fun,0)}catch(e){return cachedSetTimeout.call(this,fun,0)}}}function runClearTimeout(marker){if(cachedClearTimeout===clearTimeout)return clearTimeout(marker);if((cachedClearTimeout===defaultClearTimeout||!cachedClearTimeout)&&clearTimeout)return cachedClearTimeout=clearTimeout,clearTimeout(marker);try{return cachedClearTimeout(marker)}catch(e){try{return cachedClearTimeout.call(null,marker)}catch(e){return cachedClearTimeout.call(this,marker)}}}function cleanUpNextTick(){draining&¤tQueue&&(draining=!1,currentQueue.length?queue=currentQueue.concat(queue):queueIndex=-1,queue.length&&drainQueue())}function drainQueue(){if(!draining){var timeout=runTimeout(cleanUpNextTick);draining=!0;for(var len=queue.length;len;){for(currentQueue=queue,queue=[];++queueIndex1)for(var i=1;i1?nameSplit[nameSplit.length-1]:language}function getSrcFilename(line,cfg){return _getFilename("---",line,cfg.srcPrefix)}function getDstFilename(line,cfg){return _getFilename("\\+\\+\\+",line,cfg.dstPrefix)}function _getFilename(linePrefix,line,extraPrefix){var prefixes=["a/","b/","i/","w/","c/","o/"];extraPrefix&&prefixes.push(extraPrefix);var FilenameRegExp;FilenameRegExp=new RegExp(linePrefix?"^"+linePrefix+' "?(.+?)"?$':'^"?(.+?)"?$');var filename,values=FilenameRegExp.exec(line);if(values&&values[1]){filename=values[1];var matchingPrefixes=prefixes.filter(function(p){return 0===filename.indexOf(p)});matchingPrefixes[0]&&(filename=filename.slice(matchingPrefixes[0].length)),filename=filename.replace(/\s+\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}(?:\.\d+)? \+\d{4}.*$/,"")}return filename}var utils=require("./utils.js").Utils,LINE_TYPE={INSERTS:"d2h-ins",DELETES:"d2h-del",INSERT_CHANGES:"d2h-ins d2h-change",DELETE_CHANGES:"d2h-del d2h-change",CONTEXT:"d2h-cntx",INFO:"d2h-info"};DiffParser.prototype.LINE_TYPE=LINE_TYPE,DiffParser.prototype.generateDiffJson=function(diffInput,configuration){function saveBlock(){currentBlock&&(currentFile.blocks.push(currentBlock),currentBlock=null)}function saveFile(){currentFile&&(currentFile.oldName||(currentFile.oldName=possibleOldName),currentFile.newName||(currentFile.newName=possibleNewName),currentFile.newName&&(files.push(currentFile),currentFile=null)),possibleOldName=void 0,possibleNewName=void 0}function startFile(){saveBlock(),saveFile(),currentFile={},currentFile.blocks=[],currentFile.deletedLines=0,currentFile.addedLines=0}function startBlock(line){saveBlock();var values;(values=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@.*/.exec(line))?(currentFile.isCombined=!1,oldLine=values[1],newLine=values[2]):(values=/^@@@ -(\d+)(?:,\d+)? -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@@.*/.exec(line))?(currentFile.isCombined=!0,oldLine=values[1],oldLine2=values[2],newLine=values[3]):(utils.startsWith(line,hunkHeaderPrefix)&&console.error("Failed to parse lines, starting in 0!"),oldLine=0,newLine=0,currentFile.isCombined=!1),currentBlock={},currentBlock.lines=[],currentBlock.oldStartLine=oldLine,currentBlock.oldStartLine2=oldLine2,currentBlock.newStartLine=newLine,currentBlock.header=line}function createLine(line){var currentLine={};currentLine.content=line;var newLinePrefixes=currentFile.isCombined?["+"," +"]:["+"],delLinePrefixes=currentFile.isCombined?["-"," -"]:["-"];utils.startsWith(line,newLinePrefixes)?(currentFile.addedLines++,currentLine.type=LINE_TYPE.INSERTS,currentLine.oldNumber=null,currentLine.newNumber=newLine++,currentBlock.lines.push(currentLine)):utils.startsWith(line,delLinePrefixes)?(currentFile.deletedLines++,currentLine.type=LINE_TYPE.DELETES,currentLine.oldNumber=oldLine++,currentLine.newNumber=null,currentBlock.lines.push(currentLine)):(currentLine.type=LINE_TYPE.CONTEXT,currentLine.oldNumber=oldLine++,currentLine.newNumber=newLine++,currentBlock.lines.push(currentLine))}function existHunkHeader(line,lineIdx){for(var idx=lineIdx;idxcomparisons&&("lines"===that.config.matching||"words"===that.config.matching);doMatching?(matches=matcher(oldLines,newLines),insertType=diffParser.LINE_TYPE.INSERT_CHANGES,deleteType=diffParser.LINE_TYPE.DELETE_CHANGES):(matches=[[oldLines,newLines]],insertType=diffParser.LINE_TYPE.INSERTS,deleteType=diffParser.LINE_TYPE.DELETES),matches.forEach(function(match){oldLines=match[0],newLines=match[1];for(var oldLine,newLine,processedOldLines=[],processedNewLines=[],common=Math.min(oldLines.length,newLines.length),j=0;common>j;j++){oldLine=oldLines[j],newLine=newLines[j],that.config.isCombined=file.isCombined;var diff=printerUtils.diffHighlight(oldLine.content,newLine.content,that.config);processedOldLines+=that.makeLineHtml(file.isCombined,deleteType,oldLine.oldNumber,oldLine.newNumber,diff.first.line,diff.first.prefix),processedNewLines+=that.makeLineHtml(file.isCombined,insertType,newLine.oldNumber,newLine.newNumber,diff.second.line,diff.second.prefix)}lines+=processedOldLines+processedNewLines,lines+=that._processLines(file.isCombined,oldLines.slice(common),newLines.slice(common))}),oldLines=[],newLines=[]}for(var lines=that.makeColumnLineNumberHtml(block),oldLines=[],newLines=[],i=0;i0||line.type!==diffParser.LINE_TYPE.DELETES&&oldLines.length>0)&&processChangeBlock(),line.type===diffParser.LINE_TYPE.CONTEXT?lines+=that.makeLineHtml(file.isCombined,line.type,line.oldNumber,line.newNumber,escapedLine):line.type!==diffParser.LINE_TYPE.INSERTS||oldLines.length?line.type===diffParser.LINE_TYPE.DELETES?oldLines.push(line):line.type===diffParser.LINE_TYPE.INSERTS&&Boolean(oldLines.length)?newLines.push(line):(console.error("Unknown state in html line-by-line generator"),processChangeBlock()):lines+=that.makeLineHtml(file.isCombined,line.type,line.oldNumber,line.newNumber,escapedLine)}return processChangeBlock(),lines}).join("\n")},LineByLinePrinter.prototype._processLines=function(isCombined,oldLines,newLines){for(var lines="",i=0;i]*>((.|\n)*?)<\/ins>)/g,"")}function removeDel(line){return line.replace(/(]*>((.|\n)*?)<\/del>)/g,"")}var jsDiff=require("diff"),utils=require("./utils.js").Utils,Rematch=require("./rematch.js").Rematch,separator="/";PrinterUtils.prototype.separatePrefix=function(isCombined,line){var prefix,lineWithoutPrefix;return isCombined?(prefix=line.substring(0,2),lineWithoutPrefix=line.substring(2)):(prefix=line.substring(0,1),lineWithoutPrefix=line.substring(1)),{prefix:prefix,line:lineWithoutPrefix}},PrinterUtils.prototype.getHtmlId=function(file){var hashCode=function(text){var i,chr,len,hash=0;for(i=0,len=text.length;len>i;i++)chr=text.charCodeAt(i),hash=(hash<<5)-hash+chr,hash|=0;return hash};return"d2h-"+hashCode(this.getDiffName(file)).toString().slice(-6)},PrinterUtils.prototype.getDiffName=function(file){var oldFilename=unifyPath(file.oldName),newFilename=unifyPath(file.newName);if(oldFilename&&newFilename&&oldFilename!==newFilename&&!isDevNullName(oldFilename)&&!isDevNullName(newFilename)){for(var prefixPaths=[],suffixPaths=[],oldFilenameParts=oldFilename.split(separator),newFilenameParts=newFilename.split(separator),oldFilenamePartsSize=oldFilenameParts.length,newFilenamePartsSize=newFilenameParts.length,i=0,j=oldFilenamePartsSize-1,k=newFilenamePartsSize-1;j>i&&k>i&&oldFilenameParts[i]===newFilenameParts[i];)prefixPaths.push(newFilenameParts[i]),i+=1;for(;j>i&&k>i&&oldFilenameParts[j]===newFilenameParts[k];)suffixPaths.unshift(newFilenameParts[k]),j-=1,k-=1;var finalPrefix=prefixPaths.join(separator),finalSuffix=suffixPaths.join(separator),oldRemainingPath=oldFilenameParts.slice(i,j+1).join(separator),newRemainingPath=newFilenameParts.slice(i,k+1).join(separator); -},ri:function(context,partials,indent){return this.r(context,partials,indent)},ep:function(symbol,partials){var partial=this.partials[symbol],template=partials[partial.name];if(partial.instance&&partial.base==template)return partial.instance;if("string"==typeof template){if(!this.c)throw new Error("No compiler available.");template=this.c.compile(template,this.options)}if(!template)return null;if(this.partials[symbol].base=template,partial.subs){partials.stackText||(partials.stackText={});for(key in partial.subs)partials.stackText[key]||(partials.stackText[key]=void 0!==this.activeSub&&partials.stackText[this.activeSub]?partials.stackText[this.activeSub]:this.text);template=createSpecializedPartial(template,partial.subs,partial.partials,this.stackSubs,this.stackPartials,partials.stackText)}return this.partials[symbol].instance=template,template},rp:function(symbol,context,partials,indent){var partial=this.ep(symbol,partials);return partial?partial.ri(context,partials,indent):""},rs:function(context,partials,section){var tail=context[context.length-1];if(!isArray(tail))return void section(context,partials,this);for(var i=0;i=0;i--)if(v=ctx[i],val=findInScope(key,v,doModelGet),void 0!==val){found=!0;break}return found?(returnFound||"function"!=typeof val||(val=this.mv(val,ctx,partials)),val):returnFound?!1:""},ls:function(func,cx,partials,text,tags){var oldTags=this.options.delimiters;return this.options.delimiters=tags,this.b(this.ct(coerceToString(func.call(cx,text)),cx,partials)),this.options.delimiters=oldTags,!1},ct:function(text,cx,partials){if(this.options.disableLambda)throw new Error("Lambda features disabled.");return this.c.compile(text,this.options).render(cx,partials)},b:function(s){this.buf+=s},fl:function(){var r=this.buf;return this.buf="",r},ms:function(func,ctx,partials,inverted,start,end,tags){var textSource,cx=ctx[ctx.length-1],result=func.call(cx);return"function"==typeof result?inverted?!0:(textSource=this.activeSub&&this.subsText&&this.subsText[this.activeSub]?this.subsText[this.activeSub]:this.text,this.ls(result,cx,partials,textSource.substring(start,end),tags)):result},mv:function(func,ctx,partials){var cx=ctx[ctx.length-1],result=func.call(cx);return"function"==typeof result?this.ct(coerceToString(result.call(cx)),cx,partials):result},sub:function(name,context,partials,indent){var f=this.subs[name];f&&(this.activeSub=name,f(context,partials,this,indent),this.activeSub=!1)}};var rAmp=/&/g,rLt=//g,rApos=/\'/g,rQuot=/\"/g,hChars=/[&<>\"\']/,isArray=Array.isArray||function(a){return"[object Array]"===Object.prototype.toString.call(a)}}("undefined"!=typeof exports?exports:Hogan)},{}],20:[function(require,module,exports){(function(process){function normalizeArray(parts,allowAboveRoot){for(var up=0,i=parts.length-1;i>=0;i--){var last=parts[i];"."===last?parts.splice(i,1):".."===last?(parts.splice(i,1),up++):up&&(parts.splice(i,1),up--)}if(allowAboveRoot)for(;up--;up)parts.unshift("..");return parts}function filter(xs,f){if(xs.filter)return xs.filter(f);for(var res=[],i=0;i=-1&&!resolvedAbsolute;i--){var path=i>=0?arguments[i]:process.cwd();if("string"!=typeof path)throw new TypeError("Arguments to path.resolve must be strings");path&&(resolvedPath=path+"/"+resolvedPath,resolvedAbsolute="/"===path.charAt(0))}return resolvedPath=normalizeArray(filter(resolvedPath.split("/"),function(p){return!!p}),!resolvedAbsolute).join("/"),(resolvedAbsolute?"/":"")+resolvedPath||"."},exports.normalize=function(path){var isAbsolute=exports.isAbsolute(path),trailingSlash="/"===substr(path,-1);return path=normalizeArray(filter(path.split("/"),function(p){return!!p}),!isAbsolute).join("/"),path||isAbsolute||(path="."),path&&trailingSlash&&(path+="/"),(isAbsolute?"/":"")+path},exports.isAbsolute=function(path){return"/"===path.charAt(0)},exports.join=function(){var paths=Array.prototype.slice.call(arguments,0);return exports.normalize(filter(paths,function(p){if("string"!=typeof p)throw new TypeError("Arguments to path.join must be strings");return p}).join("/"))},exports.relative=function(from,to){function trim(arr){for(var start=0;start=0&&""===arr[end];end--);return start>end?[]:arr.slice(start,end-start+1)}from=exports.resolve(from).substr(1),to=exports.resolve(to).substr(1);for(var fromParts=trim(from.split("/")),toParts=trim(to.split("/")),length=Math.min(fromParts.length,toParts.length),samePartsLength=length,i=0;length>i;i++)if(fromParts[i]!==toParts[i]){samePartsLength=i;break}for(var outputParts=[],i=samePartsLength;istart&&(start=str.length+start),str.substr(start,len)}}).call(this,require("_process"))},{_process:21}],21:[function(require,module){function defaultSetTimout(){throw new Error("setTimeout has not been defined")}function defaultClearTimeout(){throw new Error("clearTimeout has not been defined")}function runTimeout(fun){if(cachedSetTimeout===setTimeout)return setTimeout(fun,0);if((cachedSetTimeout===defaultSetTimout||!cachedSetTimeout)&&setTimeout)return cachedSetTimeout=setTimeout,setTimeout(fun,0);try{return cachedSetTimeout(fun,0)}catch(e){try{return cachedSetTimeout.call(null,fun,0)}catch(e){return cachedSetTimeout.call(this,fun,0)}}}function runClearTimeout(marker){if(cachedClearTimeout===clearTimeout)return clearTimeout(marker);if((cachedClearTimeout===defaultClearTimeout||!cachedClearTimeout)&&clearTimeout)return cachedClearTimeout=clearTimeout,clearTimeout(marker);try{return cachedClearTimeout(marker)}catch(e){try{return cachedClearTimeout.call(null,marker)}catch(e){return cachedClearTimeout.call(this,marker)}}}function cleanUpNextTick(){draining&¤tQueue&&(draining=!1,currentQueue.length?queue=currentQueue.concat(queue):queueIndex=-1,queue.length&&drainQueue())}function drainQueue(){if(!draining){var timeout=runTimeout(cleanUpNextTick);draining=!0;for(var len=queue.length;len;){for(currentQueue=queue,queue=[];++queueIndex1)for(var i=1;i1?nameSplit[nameSplit.length-1]:language}function getSrcFilename(line,cfg){var prefixes=["a/","i/","w/","c/","o/"];return cfg.srcPrefix&&prefixes.push(cfg.srcPrefix),_getFilename("---",line,prefixes)}function getDstFilename(line,cfg){var prefixes=["b/","i/","w/","c/","o/"];return cfg.dstPrefix&&prefixes.push(cfg.dstPrefix),_getFilename("\\+\\+\\+",line,prefixes)}function _getFilename(linePrefix,line,prefixes){var FilenameRegExp;FilenameRegExp=new RegExp(linePrefix?"^"+linePrefix+' "?(.+?)"?$':'^"?(.+?)"?$');var filename,values=FilenameRegExp.exec(line);if(values&&values[1]){filename=values[1];var matchingPrefixes=prefixes.filter(function(p){return 0===filename.indexOf(p)});matchingPrefixes[0]&&(filename=filename.slice(matchingPrefixes[0].length)),filename=filename.replace(/\s+\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}(?:\.\d+)? \+\d{4}.*$/,"")}return filename}var utils=require("./utils.js").Utils,LINE_TYPE={INSERTS:"d2h-ins",DELETES:"d2h-del",INSERT_CHANGES:"d2h-ins d2h-change",DELETE_CHANGES:"d2h-del d2h-change",CONTEXT:"d2h-cntx",INFO:"d2h-info"};DiffParser.prototype.LINE_TYPE=LINE_TYPE,DiffParser.prototype.generateDiffJson=function(diffInput,configuration){function saveBlock(){currentBlock&&(currentFile.blocks.push(currentBlock),currentBlock=null)}function saveFile(){currentFile&¤tFile.newName&&(files.push(currentFile),currentFile=null)}function startFile(){saveBlock(),saveFile(),currentFile={},currentFile.blocks=[],currentFile.deletedLines=0,currentFile.addedLines=0}function startBlock(line){saveBlock();var values;(values=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@.*/.exec(line))?(currentFile.isCombined=!1,oldLine=values[1],newLine=values[2]):(values=/^@@@ -(\d+)(?:,\d+)? -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@@.*/.exec(line))?(currentFile.isCombined=!0,oldLine=values[1],oldLine2=values[2],newLine=values[3]):(utils.startsWith(line,hunkHeaderPrefix)&&console.error("Failed to parse lines, starting in 0!"),oldLine=0,newLine=0,currentFile.isCombined=!1),currentBlock={},currentBlock.lines=[],currentBlock.oldStartLine=oldLine,currentBlock.oldStartLine2=oldLine2,currentBlock.newStartLine=newLine,currentBlock.header=line}function createLine(line){var currentLine={};currentLine.content=line;var newLinePrefixes=currentFile.isCombined?["+"," +"]:["+"],delLinePrefixes=currentFile.isCombined?["-"," -"]:["-"];utils.startsWith(line,newLinePrefixes)?(currentFile.addedLines++,currentLine.type=LINE_TYPE.INSERTS,currentLine.oldNumber=null,currentLine.newNumber=newLine++,currentBlock.lines.push(currentLine)):utils.startsWith(line,delLinePrefixes)?(currentFile.deletedLines++,currentLine.type=LINE_TYPE.DELETES,currentLine.oldNumber=oldLine++,currentLine.newNumber=null,currentBlock.lines.push(currentLine)):(currentLine.type=LINE_TYPE.CONTEXT,currentLine.oldNumber=oldLine++,currentLine.newNumber=newLine++,currentBlock.lines.push(currentLine))}function existHunkHeader(line,lineIdx){for(var idx=lineIdx;idxcomparisons&&("lines"===that.config.matching||"words"===that.config.matching);doMatching?(matches=matcher(oldLines,newLines),insertType=diffParser.LINE_TYPE.INSERT_CHANGES,deleteType=diffParser.LINE_TYPE.DELETE_CHANGES):(matches=[[oldLines,newLines]],insertType=diffParser.LINE_TYPE.INSERTS,deleteType=diffParser.LINE_TYPE.DELETES),matches.forEach(function(match){oldLines=match[0],newLines=match[1];for(var oldLine,newLine,processedOldLines=[],processedNewLines=[],common=Math.min(oldLines.length,newLines.length),j=0;common>j;j++){oldLine=oldLines[j],newLine=newLines[j],that.config.isCombined=file.isCombined;var diff=printerUtils.diffHighlight(oldLine.content,newLine.content,that.config);processedOldLines+=that.makeLineHtml(file.isCombined,deleteType,oldLine.oldNumber,oldLine.newNumber,diff.first.line,diff.first.prefix),processedNewLines+=that.makeLineHtml(file.isCombined,insertType,newLine.oldNumber,newLine.newNumber,diff.second.line,diff.second.prefix)}lines+=processedOldLines+processedNewLines,lines+=that._processLines(file.isCombined,oldLines.slice(common),newLines.slice(common))}),oldLines=[],newLines=[]}for(var lines=that.makeColumnLineNumberHtml(block),oldLines=[],newLines=[],i=0;i0||line.type!==diffParser.LINE_TYPE.DELETES&&oldLines.length>0)&&processChangeBlock(),line.type===diffParser.LINE_TYPE.CONTEXT?lines+=that.makeLineHtml(file.isCombined,line.type,line.oldNumber,line.newNumber,escapedLine):line.type!==diffParser.LINE_TYPE.INSERTS||oldLines.length?line.type===diffParser.LINE_TYPE.DELETES?oldLines.push(line):line.type===diffParser.LINE_TYPE.INSERTS&&Boolean(oldLines.length)?newLines.push(line):(console.error("Unknown state in html line-by-line generator"),processChangeBlock()):lines+=that.makeLineHtml(file.isCombined,line.type,line.oldNumber,line.newNumber,escapedLine)}return processChangeBlock(),lines}).join("\n")},LineByLinePrinter.prototype._processLines=function(isCombined,oldLines,newLines){for(var lines="",i=0;i]*>((.|\n)*?)<\/ins>)/g,"")}function removeDel(line){return line.replace(/(]*>((.|\n)*?)<\/del>)/g,"")}var jsDiff=require("diff"),utils=require("./utils.js").Utils,Rematch=require("./rematch.js").Rematch,separator="/";PrinterUtils.prototype.separatePrefix=function(isCombined,line){var prefix,lineWithoutPrefix;return isCombined?(prefix=line.substring(0,2),lineWithoutPrefix=line.substring(2)):(prefix=line.substring(0,1),lineWithoutPrefix=line.substring(1)),{prefix:prefix,line:lineWithoutPrefix}},PrinterUtils.prototype.getHtmlId=function(file){var hashCode=function(text){var i,chr,len,hash=0;for(i=0,len=text.length;len>i;i++)chr=text.charCodeAt(i),hash=(hash<<5)-hash+chr,hash|=0;return hash};return"d2h-"+hashCode(this.getDiffName(file)).toString().slice(-6)},PrinterUtils.prototype.getDiffName=function(file){var oldFilename=unifyPath(file.oldName),newFilename=unifyPath(file.newName);if(oldFilename&&newFilename&&oldFilename!==newFilename&&!isDevNullName(oldFilename)&&!isDevNullName(newFilename)){for(var prefixPaths=[],suffixPaths=[],oldFilenameParts=oldFilename.split(separator),newFilenameParts=newFilename.split(separator),oldFilenamePartsSize=oldFilenameParts.length,newFilenamePartsSize=newFilenameParts.length,i=0,j=oldFilenamePartsSize-1,k=newFilenamePartsSize-1;j>i&&k>i&&oldFilenameParts[i]===newFilenameParts[i];)prefixPaths.push(newFilenameParts[i]),i+=1;for(;j>i&&k>i&&oldFilenameParts[j]===newFilenameParts[k];)suffixPaths.unshift(newFilenameParts[k]),j-=1,k-=1;var finalPrefix=prefixPaths.join(separator),finalSuffix=suffixPaths.join(separator),oldRemainingPath=oldFilenameParts.slice(i,j+1).join(separator),newRemainingPath=newFilenameParts.slice(i,k+1).join(separator);return finalPrefix.length&&finalSuffix.length?finalPrefix+separator+"{"+oldRemainingPath+" → "+newRemainingPath+"}"+separator+finalSuffix:finalPrefix.length?finalPrefix+separator+"{"+oldRemainingPath+" → "+newRemainingPath+"}":finalSuffix.length?"{"+oldRemainingPath+" → "+newRemainingPath+"}"+separator+finalSuffix:oldFilename+" → "+newFilename}return newFilename&&!isDevNullName(newFilename)?newFilename:oldFilename?oldFilename:"unknown/file/path"},PrinterUtils.prototype.getFileTypeIcon=function(file){var templateName="file-changed";return file.isRename?templateName="file-renamed":file.isCopy?templateName="file-renamed":file.isNew?templateName="file-added":file.isDeleted?templateName="file-deleted":file.newName!==file.oldName&&(templateName="file-renamed"),templateName},PrinterUtils.prototype.diffHighlight=function(diffLine1,diffLine2,config){var linePrefix1,linePrefix2,unprefixedLine1,unprefixedLine2,prefixSize=1;config.isCombined&&(prefixSize=2),linePrefix1=diffLine1.substr(0,prefixSize),linePrefix2=diffLine2.substr(0,prefixSize),unprefixedLine1=diffLine1.substr(prefixSize),unprefixedLine2=diffLine2.substr(prefixSize);var diff;diff=config.charByChar?jsDiff.diffChars(unprefixedLine1,unprefixedLine2):jsDiff.diffWordsWithSpace(unprefixedLine1,unprefixedLine2);var highlightedLine="",changedWords=[];if(!config.charByChar&&"words"===config.matching){var treshold=.25;"undefined"!=typeof config.matchWordsThreshold&&(treshold=config.matchWordsThreshold);var matcher=Rematch.rematch(function(a,b){ -var amod=a.value,bmod=b.value;return Rematch.distance(amod,bmod)}),removed=diff.filter(function(element){return element.removed}),added=diff.filter(function(element){return element.added}),chunks=matcher(added,removed);chunks.forEach(function(chunk){if(1===chunk[0].length&&1===chunk[1].length){var dist=Rematch.distance(chunk[0][0].value,chunk[1][0].value);treshold>dist&&(changedWords.push(chunk[0][0]),changedWords.push(chunk[1][0]))}})}return diff.forEach(function(part){var addClass=changedWords.indexOf(part)>-1?' class="d2h-change"':"",elemType=part.added?"ins":part.removed?"del":null,escapedValue=utils.escape(part.value);highlightedLine+=null!==elemType?"<"+elemType+addClass+">"+escapedValue+"":escapedValue}),{first:{prefix:linePrefix1,line:removeIns(highlightedLine)},second:{prefix:linePrefix2,line:removeDel(highlightedLine)}}},module.exports.PrinterUtils=new PrinterUtils}()},{"./rematch.js":29,"./utils.js":32,diff:11}],29:[function(require,module){!function(){function levenshtein(a,b){if(0===a.length)return b.length;if(0===b.length)return a.length;var i,matrix=[];for(i=0;i<=b.length;i++)matrix[i]=[i];var j;for(j=0;j<=a.length;j++)matrix[0][j]=j;for(i=1;i<=b.length;i++)for(j=1;j<=a.length;j++)matrix[i][j]=b.charAt(i-1)===a.charAt(j-1)?matrix[i-1][j-1]:Math.min(matrix[i-1][j-1]+1,Math.min(matrix[i][j-1]+1,matrix[i-1][j]+1));return matrix[b.length][a.length]}var Rematch={};Rematch.levenshtein=levenshtein,Rematch.distance=function(x,y){x=x.trim(),y=y.trim();var lev=levenshtein(x,y),score=lev/(x.length+y.length);return score},Rematch.rematch=function(distanceFunction){function findBestMatch(a,b,cache){for(var bestMatch,bestMatchDist=1/0,i=0;imd&&(bestMatchDist=md,bestMatch={indexA:i,indexB:j,score:bestMatchDist})}return bestMatch}function group(a,b,level,cache){"undefined"==typeof cache&&(cache={});var bm=findBestMatch(a,b,cache);if(level||(level=0),!bm||a.length+b.length<3)return[[a,b]];var a1=a.slice(0,bm.indexA),b1=b.slice(0,bm.indexB),aMatch=[a[bm.indexA]],bMatch=[b[bm.indexB]],tailA=bm.indexA+1,tailB=bm.indexB+1,a2=a.slice(tailA),b2=b.slice(tailB),group1=group(a1,b1,level+1,cache),groupMatch=group(aMatch,bMatch,level+1,cache),group2=group(a2,b2,level+1,cache),result=groupMatch;return(bm.indexA>0||bm.indexB>0)&&(result=group1.concat(result)),(a.length>tailA||b.length>tailB)&&(result=result.concat(group2)),result}return group},module.exports.Rematch=Rematch}()},{}],30:[function(require,module){!function(){function SideBySidePrinter(config){this.config=config;var HoganJsUtils=require("./hoganjs-utils.js").HoganJsUtils;hoganUtils=new HoganJsUtils(config)}var hoganUtils,diffParser=require("./diff-parser.js").DiffParser,printerUtils=require("./printer-utils.js").PrinterUtils,utils=require("./utils.js").Utils,Rematch=require("./rematch.js").Rematch,genericTemplatesPath="generic",baseTemplatesPath="side-by-side",iconsBaseTemplatesPath="icon",tagsBaseTemplatesPath="tag",matcher=Rematch.rematch(function(a,b){var amod=a.content.substr(1),bmod=b.content.substr(1);return Rematch.distance(amod,bmod)});SideBySidePrinter.prototype.makeDiffHtml=function(file,diffs){var fileDiffTemplate=hoganUtils.template(baseTemplatesPath,"file-diff"),filePathTemplate=hoganUtils.template(genericTemplatesPath,"file-path"),fileIconTemplate=hoganUtils.template(iconsBaseTemplatesPath,"file"),fileTagTemplate=hoganUtils.template(tagsBaseTemplatesPath,printerUtils.getFileTypeIcon(file));return fileDiffTemplate.render({file:file,fileHtmlId:printerUtils.getHtmlId(file),diffs:diffs,filePath:filePathTemplate.render({fileDiffName:printerUtils.getDiffName(file)},{fileIcon:fileIconTemplate,fileTag:fileTagTemplate})})},SideBySidePrinter.prototype.generateSideBySideJsonHtml=function(diffFiles){var that=this,content=diffFiles.map(function(file){var diffs;return diffs=file.blocks.length?that.generateSideBySideFileHtml(file):that.generateEmptyDiff(),that.makeDiffHtml(file,diffs)}).join("\n");return hoganUtils.render(genericTemplatesPath,"wrapper",{content:content})},SideBySidePrinter.prototype.makeSideHtml=function(blockHeader){return hoganUtils.render(genericTemplatesPath,"column-line-number",{diffParser:diffParser,blockHeader:blockHeader,lineClass:"d2h-code-side-linenumber",contentClass:"d2h-code-side-line"})},SideBySidePrinter.prototype.generateSideBySideFileHtml=function(file){var that=this,fileHtml={};return fileHtml.left="",fileHtml.right="",file.blocks.forEach(function(block){function processChangeBlock(){var matches,insertType,deleteType,comparisons=oldLines.length*newLines.length,maxComparisons=that.config.matchingMaxComparisons||2500,doMatching=maxComparisons>comparisons&&("lines"===that.config.matching||"words"===that.config.matching);doMatching?(matches=matcher(oldLines,newLines),insertType=diffParser.LINE_TYPE.INSERT_CHANGES,deleteType=diffParser.LINE_TYPE.DELETE_CHANGES):(matches=[[oldLines,newLines]],insertType=diffParser.LINE_TYPE.INSERTS,deleteType=diffParser.LINE_TYPE.DELETES),matches.forEach(function(match){oldLines=match[0],newLines=match[1];for(var common=Math.min(oldLines.length,newLines.length),max=Math.max(oldLines.length,newLines.length),j=0;common>j;j++){var oldLine=oldLines[j],newLine=newLines[j];that.config.isCombined=file.isCombined;var diff=printerUtils.diffHighlight(oldLine.content,newLine.content,that.config);fileHtml.left+=that.generateSingleLineHtml(file.isCombined,deleteType,oldLine.oldNumber,diff.first.line,diff.first.prefix),fileHtml.right+=that.generateSingleLineHtml(file.isCombined,insertType,newLine.newNumber,diff.second.line,diff.second.prefix)}if(max>common){var oldSlice=oldLines.slice(common),newSlice=newLines.slice(common),tmpHtml=that.processLines(file.isCombined,oldSlice,newSlice);fileHtml.left+=tmpHtml.left,fileHtml.right+=tmpHtml.right}}),oldLines=[],newLines=[]}fileHtml.left+=that.makeSideHtml(block.header),fileHtml.right+=that.makeSideHtml("");for(var oldLines=[],newLines=[],i=0;i0||line.type!==diffParser.LINE_TYPE.DELETES&&oldLines.length>0)&&processChangeBlock(),line.type===diffParser.LINE_TYPE.CONTEXT?(fileHtml.left+=that.generateSingleLineHtml(file.isCombined,line.type,line.oldNumber,escapedLine,prefix),fileHtml.right+=that.generateSingleLineHtml(file.isCombined,line.type,line.newNumber,escapedLine,prefix)):line.type!==diffParser.LINE_TYPE.INSERTS||oldLines.length?line.type===diffParser.LINE_TYPE.DELETES?oldLines.push(line):line.type===diffParser.LINE_TYPE.INSERTS&&Boolean(oldLines.length)?newLines.push(line):(console.error("unknown state in html side-by-side generator"),processChangeBlock()):(fileHtml.left+=that.generateSingleLineHtml(file.isCombined,diffParser.LINE_TYPE.CONTEXT,"","",""),fileHtml.right+=that.generateSingleLineHtml(file.isCombined,line.type,line.newNumber,escapedLine,prefix))}processChangeBlock()}),fileHtml},SideBySidePrinter.prototype.processLines=function(isCombined,oldLines,newLines){var that=this,fileHtml={};fileHtml.left="",fileHtml.right="";for(var maxLinesNumber=Math.max(oldLines.length,newLines.length),i=0;maxLinesNumber>i;i++){var oldContent,newContent,oldPrefix,newPrefix,oldLine=oldLines[i],newLine=newLines[i];oldLine&&(oldContent=utils.escape(oldLine.content.substr(1)),oldPrefix=oldLine.content[0]),newLine&&(newContent=utils.escape(newLine.content.substr(1)),newPrefix=newLine.content[0]),oldLine&&newLine?(fileHtml.left+=that.generateSingleLineHtml(isCombined,oldLine.type,oldLine.oldNumber,oldContent,oldPrefix),fileHtml.right+=that.generateSingleLineHtml(isCombined,newLine.type,newLine.newNumber,newContent,newPrefix)):oldLine?(fileHtml.left+=that.generateSingleLineHtml(isCombined,oldLine.type,oldLine.oldNumber,oldContent,oldPrefix),fileHtml.right+=that.generateSingleLineHtml(isCombined,diffParser.LINE_TYPE.CONTEXT,"","","")):newLine?(fileHtml.left+=that.generateSingleLineHtml(isCombined,diffParser.LINE_TYPE.CONTEXT,"","",""),fileHtml.right+=that.generateSingleLineHtml(isCombined,newLine.type,newLine.newNumber,newContent,newPrefix)):console.error("How did it get here?")}return fileHtml},SideBySidePrinter.prototype.generateSingleLineHtml=function(isCombined,type,number,content,possiblePrefix){var lineWithoutPrefix=content,prefix=possiblePrefix;if(!prefix){var lineWithPrefix=printerUtils.separatePrefix(isCombined,content);prefix=lineWithPrefix.prefix,lineWithoutPrefix=lineWithPrefix.line}return hoganUtils.render(genericTemplatesPath,"line",{type:type,lineClass:"d2h-code-side-linenumber",contentClass:"d2h-code-side-line",prefix:prefix,content:lineWithoutPrefix,lineNumber:number})},SideBySidePrinter.prototype.generateEmptyDiff=function(){var fileHtml={};return fileHtml.right="",fileHtml.left=hoganUtils.render(genericTemplatesPath,"empty-diff",{contentClass:"d2h-code-side-line",diffParser:diffParser}),fileHtml},module.exports.SideBySidePrinter=SideBySidePrinter}()},{"./diff-parser.js":22,"./hoganjs-utils.js":25,"./printer-utils.js":28,"./rematch.js":29,"./utils.js":32}],31:[function(require,module){(function(global){!function(){global.browserTemplates||(global.browserTemplates={});var Hogan=require("hogan.js");global.browserTemplates["file-summary-line"]=new Hogan.Template({code:function(c,p,i){var t=this;return t.b(i=i||""),t.b('
  • '),t.b("\n"+i),t.b(' '),t.b("\n"+i),t.b(" "),t.b(t.rp(""),t.b("\n"+i),t.b(' '),t.b(t.v(t.f("fileName",c,p,0))),t.b(""),t.b("\n"+i),t.b(' '),t.b("\n"+i),t.b(' '),t.b(t.v(t.f("addedLines",c,p,0))),t.b(""),t.b("\n"+i),t.b(' '),t.b(t.v(t.f("deletedLines",c,p,0))),t.b(""),t.b("\n"+i),t.b(" "),t.b("\n"+i),t.b(" "),t.b("\n"+i),t.b("
  • "),t.fl()},partials:{"'),t.b("\n"+i),t.b('
    '),t.b("\n"+i),t.b(' Files changed ('),t.b(t.v(t.f("filesNumber",c,p,0))),t.b(")"),t.b("\n"+i),t.b(' hide'),t.b("\n"+i),t.b(' show'),t.b("\n"+i),t.b("
    "),t.b("\n"+i),t.b('
      '),t.b("\n"+i),t.b(" "),t.b(t.t(t.f("files",c,p,0))),t.b("\n"+i),t.b("
    "),t.b("\n"+i),t.b(""),t.fl()},partials:{},subs:{}}),global.browserTemplates["generic-column-line-number"]=new Hogan.Template({code:function(c,p,i){var t=this;return t.b(i=i||""),t.b(""),t.b("\n"+i),t.b(' '),t.b("\n"+i),t.b(' '),t.b("\n"+i),t.b('
    '),t.b(t.t(t.f("blockHeader",c,p,0))),t.b("
    "),t.b("\n"+i),t.b(" "),t.b("\n"+i),t.b(""),t.fl()},partials:{},subs:{}}),global.browserTemplates["generic-empty-diff"]=new Hogan.Template({code:function(c,p,i){var t=this;return t.b(i=i||""),t.b(""),t.b("\n"+i),t.b(' '),t.b("\n"+i),t.b('
    '),t.b("\n"+i),t.b(" File without changes"),t.b("\n"+i),t.b("
    "),t.b("\n"+i),t.b(" "),t.b("\n"+i),t.b(""),t.fl()},partials:{},subs:{}}),global.browserTemplates["generic-file-path"]=new Hogan.Template({code:function(c,p,i){var t=this;return t.b(i=i||""),t.b(''),t.b("\n"+i),t.b(' '),t.b(t.rp(""),t.b("\n"+i),t.b(' '),t.b(t.v(t.f("fileDiffName",c,p,0))),t.b(""),t.b("\n"+i),t.b(t.rp(""),t.fl()},partials:{""),t.b("\n"+i),t.b(' '),t.b("\n"+i),t.b(" "),t.b(t.t(t.f("lineNumber",c,p,0))),t.b("\n"+i),t.b(" "),t.b("\n"+i),t.b(' '),t.b("\n"+i),t.b('
    '),t.b("\n"+i),t.s(t.f("prefix",c,p,1),c,p,0,171,247,"{{ }}")&&(t.rs(c,p,function(c,p,t){t.b(' '),t.b(t.t(t.f("prefix",c,p,0))),t.b(""),t.b("\n"+i)}),c.pop()),t.s(t.f("content",c,p,1),c,p,0,279,353,"{{ }}")&&(t.rs(c,p,function(c,p,t){t.b(' '),t.b(t.t(t.f("content",c,p,0))),t.b(""),t.b("\n"+i)}),c.pop()),t.b("
    "),t.b("\n"+i),t.b(" "),t.b("\n"+i),t.b(""),t.fl()},partials:{},subs:{}}),global.browserTemplates["generic-wrapper"]=new Hogan.Template({code:function(c,p,i){var t=this;return t.b(i=i||""),t.b('
    '),t.b("\n"+i),t.b(" "),t.b(t.t(t.f("content",c,p,0))),t.b("\n"+i),t.b("
    "),t.fl()},partials:{},subs:{}}),global.browserTemplates["icon-file-added"]=new Hogan.Template({code:function(c,p,i){var t=this;return t.b(i=i||""),t.b('"),t.fl()},partials:{},subs:{}}),global.browserTemplates["icon-file-changed"]=new Hogan.Template({code:function(c,p,i){var t=this;return t.b(i=i||""),t.b('"),t.fl()},partials:{},subs:{}}),global.browserTemplates["icon-file-deleted"]=new Hogan.Template({code:function(c,p,i){var t=this;return t.b(i=i||""),t.b('"),t.fl()},partials:{},subs:{}}),global.browserTemplates["icon-file-renamed"]=new Hogan.Template({code:function(c,p,i){var t=this;return t.b(i=i||""),t.b('"),t.fl()},partials:{},subs:{}}),global.browserTemplates["icon-file"]=new Hogan.Template({code:function(c,p,i){var t=this;return t.b(i=i||""),t.b('"),t.fl()},partials:{},subs:{}}),global.browserTemplates["line-by-line-file-diff"]=new Hogan.Template({code:function(c,p,i){var t=this;return t.b(i=i||""),t.b('
    '),t.b("\n"+i),t.b('
    '),t.b("\n"+i),t.b(" "),t.b(t.t(t.f("filePath",c,p,0))),t.b("\n"+i),t.b("
    "),t.b("\n"+i),t.b('
    '),t.b("\n"+i),t.b('
    '),t.b("\n"+i),t.b(' '),t.b("\n"+i),t.b(' '),t.b("\n"+i),t.b(" "),t.b(t.t(t.f("diffs",c,p,0))),t.b("\n"+i),t.b(" "),t.b("\n"+i),t.b("
    "),t.b("\n"+i),t.b("
    "),t.b("\n"+i),t.b("
    "),t.b("\n"+i),t.b("
    "),t.fl()},partials:{},subs:{}}),global.browserTemplates["line-by-line-numbers"]=new Hogan.Template({code:function(c,p,i){var t=this;return t.b(i=i||""),t.b('
    '),t.b(t.v(t.f("oldNumber",c,p,0))),t.b("
    "),t.b("\n"+i),t.b('
    '),t.b(t.v(t.f("newNumber",c,p,0))),t.b("
    "),t.fl()},partials:{},subs:{}}),global.browserTemplates["side-by-side-file-diff"]=new Hogan.Template({code:function(c,p,i){var t=this;return t.b(i=i||""),t.b('
    '),t.b("\n"+i),t.b('
    '),t.b("\n"+i),t.b(" "),t.b(t.t(t.f("filePath",c,p,0))),t.b("\n"+i),t.b("
    "),t.b("\n"+i),t.b('
    '),t.b("\n"+i),t.b('
    '),t.b("\n"+i),t.b('
    '),t.b("\n"+i),t.b(' '),t.b("\n"+i),t.b(' '),t.b("\n"+i),t.b(" "),t.b(t.t(t.d("diffs.left",c,p,0))),t.b("\n"+i),t.b(" "),t.b("\n"+i),t.b("
    "),t.b("\n"+i),t.b("
    "),t.b("\n"+i),t.b("
    "),t.b("\n"+i),t.b('
    '),t.b("\n"+i),t.b('
    '),t.b("\n"+i),t.b(' '),t.b("\n"+i),t.b(' '),t.b("\n"+i),t.b(" "),t.b(t.t(t.d("diffs.right",c,p,0))),t.b("\n"+i),t.b(" "),t.b("\n"+i),t.b("
    "),t.b("\n"+i),t.b("
    "),t.b("\n"+i),t.b("
    "),t.b("\n"+i),t.b("
    "),t.b("\n"+i),t.b("
    "),t.fl()},partials:{},subs:{}}),global.browserTemplates["tag-file-added"]=new Hogan.Template({code:function(c,p,i){var t=this;return t.b(i=i||""),t.b('ADDED'),t.fl()},partials:{},subs:{}}),global.browserTemplates["tag-file-changed"]=new Hogan.Template({code:function(c,p,i){var t=this;return t.b(i=i||""),t.b('CHANGED'),t.fl()},partials:{},subs:{}}),global.browserTemplates["tag-file-deleted"]=new Hogan.Template({code:function(c,p,i){var t=this;return t.b(i=i||""),t.b('DELETED'),t.fl()},partials:{},subs:{}}),global.browserTemplates["tag-file-renamed"]=new Hogan.Template({code:function(c,p,i){var t=this;return t.b(i=i||""),t.b('RENAMED'),t.fl()},partials:{},subs:{}}),module.exports=global.browserTemplates}()}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"hogan.js":18}],32:[function(require,module){!function(){function Utils(){}Utils.prototype.escape=function(str){return str.slice(0).replace(/&/g,"&").replace(//g,">").replace(/\t/g," ")},Utils.prototype.startsWith=function(str,start){if("object"==typeof start){var result=!1;return start.forEach(function(s){0===str.indexOf(s)&&(result=!0)}),result}return str&&0===str.indexOf(start)},Utils.prototype.valueOrEmpty=function(value){return value||""},module.exports.Utils=new Utils}()},{}]},{},[23]); \ No newline at end of file +return finalPrefix.length&&finalSuffix.length?finalPrefix+separator+"{"+oldRemainingPath+" → "+newRemainingPath+"}"+separator+finalSuffix:finalPrefix.length?finalPrefix+separator+"{"+oldRemainingPath+" → "+newRemainingPath+"}":finalSuffix.length?"{"+oldRemainingPath+" → "+newRemainingPath+"}"+separator+finalSuffix:oldFilename+" → "+newFilename}return newFilename&&!isDevNullName(newFilename)?newFilename:oldFilename?oldFilename:"unknown/file/path"},PrinterUtils.prototype.getFileTypeIcon=function(file){var templateName="file-changed";return file.isRename?templateName="file-renamed":file.isCopy?templateName="file-renamed":file.isNew?templateName="file-added":file.isDeleted?templateName="file-deleted":file.newName!==file.oldName&&(templateName="file-renamed"),templateName},PrinterUtils.prototype.diffHighlight=function(diffLine1,diffLine2,config){var linePrefix1,linePrefix2,unprefixedLine1,unprefixedLine2,prefixSize=1;config.isCombined&&(prefixSize=2),linePrefix1=diffLine1.substr(0,prefixSize),linePrefix2=diffLine2.substr(0,prefixSize),unprefixedLine1=diffLine1.substr(prefixSize),unprefixedLine2=diffLine2.substr(prefixSize);var diff;diff=config.charByChar?jsDiff.diffChars(unprefixedLine1,unprefixedLine2):jsDiff.diffWordsWithSpace(unprefixedLine1,unprefixedLine2);var highlightedLine="",changedWords=[];if(!config.charByChar&&"words"===config.matching){var treshold=.25;"undefined"!=typeof config.matchWordsThreshold&&(treshold=config.matchWordsThreshold);var matcher=Rematch.rematch(function(a,b){var amod=a.value,bmod=b.value;return Rematch.distance(amod,bmod)}),removed=diff.filter(function(element){return element.removed}),added=diff.filter(function(element){return element.added}),chunks=matcher(added,removed);chunks.forEach(function(chunk){if(1===chunk[0].length&&1===chunk[1].length){var dist=Rematch.distance(chunk[0][0].value,chunk[1][0].value);treshold>dist&&(changedWords.push(chunk[0][0]),changedWords.push(chunk[1][0]))}})}return diff.forEach(function(part){var addClass=changedWords.indexOf(part)>-1?' class="d2h-change"':"",elemType=part.added?"ins":part.removed?"del":null,escapedValue=utils.escape(part.value);highlightedLine+=null!==elemType?"<"+elemType+addClass+">"+escapedValue+"":escapedValue}),{first:{prefix:linePrefix1,line:removeIns(highlightedLine)},second:{prefix:linePrefix2,line:removeDel(highlightedLine)}}},module.exports.PrinterUtils=new PrinterUtils}()},{"./rematch.js":30,"./utils.js":33,diff:12}],30:[function(require,module){!function(){function levenshtein(a,b){if(0===a.length)return b.length;if(0===b.length)return a.length;var i,matrix=[];for(i=0;i<=b.length;i++)matrix[i]=[i];var j;for(j=0;j<=a.length;j++)matrix[0][j]=j;for(i=1;i<=b.length;i++)for(j=1;j<=a.length;j++)matrix[i][j]=b.charAt(i-1)===a.charAt(j-1)?matrix[i-1][j-1]:Math.min(matrix[i-1][j-1]+1,Math.min(matrix[i][j-1]+1,matrix[i-1][j]+1));return matrix[b.length][a.length]}var Rematch={};Rematch.levenshtein=levenshtein,Rematch.distance=function(x,y){x=x.trim(),y=y.trim();var lev=levenshtein(x,y),score=lev/(x.length+y.length);return score},Rematch.rematch=function(distanceFunction){function findBestMatch(a,b,cache){for(var bestMatch,bestMatchDist=1/0,i=0;imd&&(bestMatchDist=md,bestMatch={indexA:i,indexB:j,score:bestMatchDist})}return bestMatch}function group(a,b,level,cache){"undefined"==typeof cache&&(cache={});var bm=findBestMatch(a,b,cache);if(level||(level=0),!bm||a.length+b.length<3)return[[a,b]];var a1=a.slice(0,bm.indexA),b1=b.slice(0,bm.indexB),aMatch=[a[bm.indexA]],bMatch=[b[bm.indexB]],tailA=bm.indexA+1,tailB=bm.indexB+1,a2=a.slice(tailA),b2=b.slice(tailB),group1=group(a1,b1,level+1,cache),groupMatch=group(aMatch,bMatch,level+1,cache),group2=group(a2,b2,level+1,cache),result=groupMatch;return(bm.indexA>0||bm.indexB>0)&&(result=group1.concat(result)),(a.length>tailA||b.length>tailB)&&(result=result.concat(group2)),result}return group},module.exports.Rematch=Rematch}()},{}],31:[function(require,module){!function(){function SideBySidePrinter(config){this.config=config;var HoganJsUtils=require("./hoganjs-utils.js").HoganJsUtils;hoganUtils=new HoganJsUtils(config)}var hoganUtils,diffParser=require("./diff-parser.js").DiffParser,printerUtils=require("./printer-utils.js").PrinterUtils,utils=require("./utils.js").Utils,Rematch=require("./rematch.js").Rematch,genericTemplatesPath="generic",baseTemplatesPath="side-by-side",iconsBaseTemplatesPath="icon",tagsBaseTemplatesPath="tag",matcher=Rematch.rematch(function(a,b){var amod=a.content.substr(1),bmod=b.content.substr(1);return Rematch.distance(amod,bmod)});SideBySidePrinter.prototype.makeDiffHtml=function(file,diffs){var fileDiffTemplate=hoganUtils.template(baseTemplatesPath,"file-diff"),filePathTemplate=hoganUtils.template(genericTemplatesPath,"file-path"),fileIconTemplate=hoganUtils.template(iconsBaseTemplatesPath,"file"),fileTagTemplate=hoganUtils.template(tagsBaseTemplatesPath,printerUtils.getFileTypeIcon(file));return fileDiffTemplate.render({file:file,fileHtmlId:printerUtils.getHtmlId(file),diffs:diffs,filePath:filePathTemplate.render({fileDiffName:printerUtils.getDiffName(file)},{fileIcon:fileIconTemplate,fileTag:fileTagTemplate})})},SideBySidePrinter.prototype.generateSideBySideJsonHtml=function(diffFiles){var that=this,content=diffFiles.map(function(file){var diffs;return diffs=file.blocks.length?that.generateSideBySideFileHtml(file):that.generateEmptyDiff(),that.makeDiffHtml(file,diffs)}).join("\n");return hoganUtils.render(genericTemplatesPath,"wrapper",{content:content})},SideBySidePrinter.prototype.makeSideHtml=function(blockHeader){return hoganUtils.render(genericTemplatesPath,"column-line-number",{diffParser:diffParser,blockHeader:blockHeader,lineClass:"d2h-code-side-linenumber",contentClass:"d2h-code-side-line"})},SideBySidePrinter.prototype.generateSideBySideFileHtml=function(file){var that=this,fileHtml={};return fileHtml.left="",fileHtml.right="",file.blocks.forEach(function(block){function processChangeBlock(){var matches,insertType,deleteType,comparisons=oldLines.length*newLines.length,maxComparisons=that.config.matchingMaxComparisons||2500,doMatching=maxComparisons>comparisons&&("lines"===that.config.matching||"words"===that.config.matching);doMatching?(matches=matcher(oldLines,newLines),insertType=diffParser.LINE_TYPE.INSERT_CHANGES,deleteType=diffParser.LINE_TYPE.DELETE_CHANGES):(matches=[[oldLines,newLines]],insertType=diffParser.LINE_TYPE.INSERTS,deleteType=diffParser.LINE_TYPE.DELETES),matches.forEach(function(match){oldLines=match[0],newLines=match[1];for(var common=Math.min(oldLines.length,newLines.length),max=Math.max(oldLines.length,newLines.length),j=0;common>j;j++){var oldLine=oldLines[j],newLine=newLines[j];that.config.isCombined=file.isCombined;var diff=printerUtils.diffHighlight(oldLine.content,newLine.content,that.config);fileHtml.left+=that.generateSingleLineHtml(file.isCombined,deleteType,oldLine.oldNumber,diff.first.line,diff.first.prefix),fileHtml.right+=that.generateSingleLineHtml(file.isCombined,insertType,newLine.newNumber,diff.second.line,diff.second.prefix)}if(max>common){var oldSlice=oldLines.slice(common),newSlice=newLines.slice(common),tmpHtml=that.processLines(file.isCombined,oldSlice,newSlice);fileHtml.left+=tmpHtml.left,fileHtml.right+=tmpHtml.right}}),oldLines=[],newLines=[]}fileHtml.left+=that.makeSideHtml(block.header),fileHtml.right+=that.makeSideHtml("");for(var oldLines=[],newLines=[],i=0;i0||line.type!==diffParser.LINE_TYPE.DELETES&&oldLines.length>0)&&processChangeBlock(),line.type===diffParser.LINE_TYPE.CONTEXT?(fileHtml.left+=that.generateSingleLineHtml(file.isCombined,line.type,line.oldNumber,escapedLine,prefix),fileHtml.right+=that.generateSingleLineHtml(file.isCombined,line.type,line.newNumber,escapedLine,prefix)):line.type!==diffParser.LINE_TYPE.INSERTS||oldLines.length?line.type===diffParser.LINE_TYPE.DELETES?oldLines.push(line):line.type===diffParser.LINE_TYPE.INSERTS&&Boolean(oldLines.length)?newLines.push(line):(console.error("unknown state in html side-by-side generator"),processChangeBlock()):(fileHtml.left+=that.generateSingleLineHtml(file.isCombined,diffParser.LINE_TYPE.CONTEXT,"","",""),fileHtml.right+=that.generateSingleLineHtml(file.isCombined,line.type,line.newNumber,escapedLine,prefix))}processChangeBlock()}),fileHtml},SideBySidePrinter.prototype.processLines=function(isCombined,oldLines,newLines){var that=this,fileHtml={};fileHtml.left="",fileHtml.right="";for(var maxLinesNumber=Math.max(oldLines.length,newLines.length),i=0;maxLinesNumber>i;i++){var oldContent,newContent,oldPrefix,newPrefix,oldLine=oldLines[i],newLine=newLines[i];oldLine&&(oldContent=utils.escape(oldLine.content.substr(1)),oldPrefix=oldLine.content[0]),newLine&&(newContent=utils.escape(newLine.content.substr(1)),newPrefix=newLine.content[0]),oldLine&&newLine?(fileHtml.left+=that.generateSingleLineHtml(isCombined,oldLine.type,oldLine.oldNumber,oldContent,oldPrefix),fileHtml.right+=that.generateSingleLineHtml(isCombined,newLine.type,newLine.newNumber,newContent,newPrefix)):oldLine?(fileHtml.left+=that.generateSingleLineHtml(isCombined,oldLine.type,oldLine.oldNumber,oldContent,oldPrefix),fileHtml.right+=that.generateSingleLineHtml(isCombined,diffParser.LINE_TYPE.CONTEXT,"","","")):newLine?(fileHtml.left+=that.generateSingleLineHtml(isCombined,diffParser.LINE_TYPE.CONTEXT,"","",""),fileHtml.right+=that.generateSingleLineHtml(isCombined,newLine.type,newLine.newNumber,newContent,newPrefix)):console.error("How did it get here?")}return fileHtml},SideBySidePrinter.prototype.generateSingleLineHtml=function(isCombined,type,number,content,possiblePrefix){var lineWithoutPrefix=content,prefix=possiblePrefix;if(!prefix){var lineWithPrefix=printerUtils.separatePrefix(isCombined,content);prefix=lineWithPrefix.prefix,lineWithoutPrefix=lineWithPrefix.line}return hoganUtils.render(genericTemplatesPath,"line",{type:type,lineClass:"d2h-code-side-linenumber",contentClass:"d2h-code-side-line",prefix:prefix,content:lineWithoutPrefix,lineNumber:number})},SideBySidePrinter.prototype.generateEmptyDiff=function(){var fileHtml={};return fileHtml.right="",fileHtml.left=hoganUtils.render(genericTemplatesPath,"empty-diff",{contentClass:"d2h-code-side-line",diffParser:diffParser}),fileHtml},module.exports.SideBySidePrinter=SideBySidePrinter}()},{"./diff-parser.js":23,"./hoganjs-utils.js":26,"./printer-utils.js":29,"./rematch.js":30,"./utils.js":33}],32:[function(require,module){(function(global){!function(){global.browserTemplates||(global.browserTemplates={});var Hogan=require("hogan.js");global.browserTemplates["file-summary-line"]=new Hogan.Template({code:function(c,p,i){var t=this;return t.b(i=i||""),t.b('
  • '),t.b("\n"+i),t.b(' '),t.b("\n"+i),t.b(" "),t.b(t.rp(""),t.b("\n"+i),t.b(' '),t.b(t.v(t.f("fileName",c,p,0))),t.b(""),t.b("\n"+i),t.b(' '),t.b("\n"+i),t.b(' '),t.b(t.v(t.f("addedLines",c,p,0))),t.b(""),t.b("\n"+i),t.b(' '),t.b(t.v(t.f("deletedLines",c,p,0))),t.b(""),t.b("\n"+i),t.b(" "),t.b("\n"+i),t.b(" "),t.b("\n"+i),t.b("
  • "),t.fl()},partials:{"'),t.b("\n"+i),t.b('
    '),t.b("\n"+i),t.b(' Files changed ('),t.b(t.v(t.f("filesNumber",c,p,0))),t.b(")"),t.b("\n"+i),t.b(' hide'),t.b("\n"+i),t.b(' show'),t.b("\n"+i),t.b("
    "),t.b("\n"+i),t.b('
      '),t.b("\n"+i),t.b(" "),t.b(t.t(t.f("files",c,p,0))),t.b("\n"+i),t.b("
    "),t.b("\n"+i),t.b(""),t.fl()},partials:{},subs:{}}),global.browserTemplates["generic-column-line-number"]=new Hogan.Template({code:function(c,p,i){var t=this;return t.b(i=i||""),t.b(""),t.b("\n"+i),t.b(' '),t.b("\n"+i),t.b(' '),t.b("\n"+i),t.b('
    '),t.b(t.t(t.f("blockHeader",c,p,0))),t.b("
    "),t.b("\n"+i),t.b(" "),t.b("\n"+i),t.b(""),t.fl()},partials:{},subs:{}}),global.browserTemplates["generic-empty-diff"]=new Hogan.Template({code:function(c,p,i){var t=this;return t.b(i=i||""),t.b(""),t.b("\n"+i),t.b(' '),t.b("\n"+i),t.b('
    '),t.b("\n"+i),t.b(" File without changes"),t.b("\n"+i),t.b("
    "),t.b("\n"+i),t.b(" "),t.b("\n"+i),t.b(""),t.fl()},partials:{},subs:{}}),global.browserTemplates["generic-file-path"]=new Hogan.Template({code:function(c,p,i){var t=this;return t.b(i=i||""),t.b(''),t.b("\n"+i),t.b(' '),t.b(t.rp(""),t.b("\n"+i),t.b(' '),t.b(t.v(t.f("fileDiffName",c,p,0))),t.b(""),t.b("\n"+i),t.b(t.rp(""),t.fl()},partials:{""),t.b("\n"+i),t.b(' '),t.b("\n"+i),t.b(" "),t.b(t.t(t.f("lineNumber",c,p,0))),t.b("\n"+i),t.b(" "),t.b("\n"+i),t.b(' '),t.b("\n"+i),t.b('
    '),t.b("\n"+i),t.s(t.f("prefix",c,p,1),c,p,0,171,247,"{{ }}")&&(t.rs(c,p,function(c,p,t){t.b(' '),t.b(t.t(t.f("prefix",c,p,0))),t.b(""),t.b("\n"+i)}),c.pop()),t.s(t.f("content",c,p,1),c,p,0,279,353,"{{ }}")&&(t.rs(c,p,function(c,p,t){t.b(' '),t.b(t.t(t.f("content",c,p,0))),t.b(""),t.b("\n"+i)}),c.pop()),t.b("
    "),t.b("\n"+i),t.b(" "),t.b("\n"+i),t.b(""),t.fl()},partials:{},subs:{}}),global.browserTemplates["generic-wrapper"]=new Hogan.Template({code:function(c,p,i){var t=this;return t.b(i=i||""),t.b('
    '),t.b("\n"+i),t.b(" "),t.b(t.t(t.f("content",c,p,0))),t.b("\n"+i),t.b("
    "),t.fl()},partials:{},subs:{}}),global.browserTemplates["icon-file-added"]=new Hogan.Template({code:function(c,p,i){var t=this;return t.b(i=i||""),t.b('"),t.fl()},partials:{},subs:{}}),global.browserTemplates["icon-file-changed"]=new Hogan.Template({code:function(c,p,i){var t=this;return t.b(i=i||""),t.b('"),t.fl()},partials:{},subs:{}}),global.browserTemplates["icon-file-deleted"]=new Hogan.Template({code:function(c,p,i){var t=this;return t.b(i=i||""),t.b('"),t.fl()},partials:{},subs:{}}),global.browserTemplates["icon-file-renamed"]=new Hogan.Template({code:function(c,p,i){var t=this;return t.b(i=i||""),t.b('"),t.fl()},partials:{},subs:{}}),global.browserTemplates["icon-file"]=new Hogan.Template({code:function(c,p,i){var t=this;return t.b(i=i||""),t.b('"),t.fl()},partials:{},subs:{}}),global.browserTemplates["line-by-line-file-diff"]=new Hogan.Template({code:function(c,p,i){var t=this;return t.b(i=i||""),t.b('
    '),t.b("\n"+i),t.b('
    '),t.b("\n"+i),t.b(" "),t.b(t.t(t.f("filePath",c,p,0))),t.b("\n"+i),t.b("
    "),t.b("\n"+i),t.b('
    '),t.b("\n"+i),t.b('
    '),t.b("\n"+i),t.b(' '),t.b("\n"+i),t.b(' '),t.b("\n"+i),t.b(" "),t.b(t.t(t.f("diffs",c,p,0))),t.b("\n"+i),t.b(" "),t.b("\n"+i),t.b("
    "),t.b("\n"+i),t.b("
    "),t.b("\n"+i),t.b("
    "),t.b("\n"+i),t.b("
    "),t.fl()},partials:{},subs:{}}),global.browserTemplates["line-by-line-numbers"]=new Hogan.Template({code:function(c,p,i){var t=this;return t.b(i=i||""),t.b('
    '),t.b(t.v(t.f("oldNumber",c,p,0))),t.b("
    "),t.b("\n"+i),t.b('
    '),t.b(t.v(t.f("newNumber",c,p,0))),t.b("
    "),t.fl()},partials:{},subs:{}}),global.browserTemplates["side-by-side-file-diff"]=new Hogan.Template({code:function(c,p,i){var t=this;return t.b(i=i||""),t.b('
    '),t.b("\n"+i),t.b('
    '),t.b("\n"+i),t.b(" "),t.b(t.t(t.f("filePath",c,p,0))),t.b("\n"+i),t.b("
    "),t.b("\n"+i),t.b('
    '),t.b("\n"+i),t.b('
    '),t.b("\n"+i),t.b('
    '),t.b("\n"+i),t.b(' '),t.b("\n"+i),t.b(' '),t.b("\n"+i),t.b(" "),t.b(t.t(t.d("diffs.left",c,p,0))),t.b("\n"+i),t.b(" "),t.b("\n"+i),t.b("
    "),t.b("\n"+i),t.b("
    "),t.b("\n"+i),t.b("
    "),t.b("\n"+i),t.b('
    '),t.b("\n"+i),t.b('
    '),t.b("\n"+i),t.b(' '),t.b("\n"+i),t.b(' '),t.b("\n"+i),t.b(" "),t.b(t.t(t.d("diffs.right",c,p,0))),t.b("\n"+i),t.b(" "),t.b("\n"+i),t.b("
    "),t.b("\n"+i),t.b("
    "),t.b("\n"+i),t.b("
    "),t.b("\n"+i),t.b("
    "),t.b("\n"+i),t.b("
    "),t.fl()},partials:{},subs:{}}),global.browserTemplates["tag-file-added"]=new Hogan.Template({code:function(c,p,i){var t=this;return t.b(i=i||""),t.b('ADDED'),t.fl()},partials:{},subs:{}}),global.browserTemplates["tag-file-changed"]=new Hogan.Template({code:function(c,p,i){var t=this;return t.b(i=i||""),t.b('CHANGED'),t.fl()},partials:{},subs:{}}),global.browserTemplates["tag-file-deleted"]=new Hogan.Template({code:function(c,p,i){var t=this;return t.b(i=i||""),t.b('DELETED'),t.fl()},partials:{},subs:{}}),global.browserTemplates["tag-file-renamed"]=new Hogan.Template({code:function(c,p,i){var t=this;return t.b(i=i||""),t.b('RENAMED'),t.fl()},partials:{},subs:{}}),module.exports=global.browserTemplates}()}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"hogan.js":19}],33:[function(require,module){!function(){function Utils(){}Utils.prototype.escape=function(str){return str.slice(0).replace(/&/g,"&").replace(//g,">").replace(/\t/g," ")},Utils.prototype.startsWith=function(str,start){if("object"==typeof start){var result=!1;return start.forEach(function(s){0===str.indexOf(s)&&(result=!0)}),result}return str&&0===str.indexOf(start)},Utils.prototype.valueOrEmpty=function(value){return value||""},module.exports.Utils=new Utils}()},{}]},{},[24]); \ No newline at end of file diff --git a/package.json b/package.json index 293fcdbf..f11c8f6f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "diff2html", - "version": "2.0.10", + "version": "2.0.11", "homepage": "https://diff2html.xyz", "description": "Fast Diff to colorized HTML", "keywords": [