diff --git a/bower.json b/bower.json
index 39d774e2..04385953 100644
--- a/bower.json
+++ b/bower.json
@@ -1,6 +1,6 @@
{
"name": "diff2html",
- "version": "1.1.1",
+ "version": "1.1.3",
"homepage": "http://rtfpessoa.github.io/diff2html/",
"description": "Fast Diff to colorized HTML",
"keywords": [
diff --git a/dist/diff2html.js b/dist/diff2html.js
index 18dfa38b..a2a9f703 100644
--- a/dist/diff2html.js
+++ b/dist/diff2html.js
@@ -55,7 +55,7 @@
var diffParser = __webpack_require__(1).DiffParser;
var fileLister = __webpack_require__(3).FileListPrinter;
- var htmlPrinter = __webpack_require__(6).HtmlPrinter;
+ var htmlPrinter = __webpack_require__(20).HtmlPrinter;
function Diff2Html() {
}
@@ -607,7 +607,7 @@
/* 5 */
/***/ function(module, exports, __webpack_require__) {
- var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* See LICENSE file for terms of use */
+ /* See LICENSE file for terms of use */
/*
* Text diff implementation.
@@ -623,26 +623,222 @@
* "An O(ND) Difference Algorithm and its Variations" (Myers, 1986).
* http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.4.6927
*/
- (function(global, undefined) {
- var objectPrototypeToString = Object.prototype.toString;
+ 'use strict';
- /*istanbul ignore next*/
- function map(arr, mapper, that) {
- if (Array.prototype.map) {
- return Array.prototype.map.call(arr, mapper, that);
+ exports.__esModule = true;
+ // istanbul ignore next
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
+
+ var _diffBase = __webpack_require__(6);
+
+ var _diffBase2 = _interopRequireDefault(_diffBase);
+
+ var _diffCharacter = __webpack_require__(7);
+
+ var _diffWord = __webpack_require__(8);
+
+ var _diffLine = __webpack_require__(10);
+
+ var _diffSentence = __webpack_require__(11);
+
+ var _diffCss = __webpack_require__(12);
+
+ var _diffJson = __webpack_require__(13);
+
+ var _patchApply = __webpack_require__(14);
+
+ var _patchParse = __webpack_require__(15);
+
+ var _patchCreate = __webpack_require__(17);
+
+ var _convertDmp = __webpack_require__(18);
+
+ var _convertXml = __webpack_require__(19);
+
+ exports.Diff = _diffBase2['default'];
+ exports.diffChars = _diffCharacter.diffChars;
+ exports.diffWords = _diffWord.diffWords;
+ exports.diffWordsWithSpace = _diffWord.diffWordsWithSpace;
+ exports.diffLines = _diffLine.diffLines;
+ exports.diffTrimmedLines = _diffLine.diffTrimmedLines;
+ exports.diffSentences = _diffSentence.diffSentences;
+ exports.diffCss = _diffCss.diffCss;
+ exports.diffJson = _diffJson.diffJson;
+ exports.structuredPatch = _patchCreate.structuredPatch;
+ exports.createTwoFilesPatch = _patchCreate.createTwoFilesPatch;
+ exports.createPatch = _patchCreate.createPatch;
+ exports.applyPatch = _patchApply.applyPatch;
+ exports.applyPatches = _patchApply.applyPatches;
+ exports.parsePatch = _patchParse.parsePatch;
+ exports.convertChangesToDMP = _convertDmp.convertChangesToDMP;
+ exports.convertChangesToXML = _convertXml.convertChangesToXML;
+ exports.canonicalize = _diffJson.canonicalize;
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9pbmRleC5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozt3QkFnQmlCLGFBQWE7Ozs7NkJBQ04sa0JBQWtCOzt3QkFDRSxhQUFhOzt3QkFDZixhQUFhOzs0QkFDM0IsaUJBQWlCOzt1QkFFdkIsWUFBWTs7d0JBQ0csYUFBYTs7MEJBRVgsZUFBZTs7MEJBQzdCLGVBQWU7OzJCQUN3QixnQkFBZ0I7OzBCQUU5QyxlQUFlOzswQkFDZixlQUFlOztRQUcvQyxJQUFJO1FBRUosU0FBUztRQUNULFNBQVM7UUFDVCxrQkFBa0I7UUFDbEIsU0FBUztRQUNULGdCQUFnQjtRQUNoQixhQUFhO1FBRWIsT0FBTztRQUNQLFFBQVE7UUFFUixlQUFlO1FBQ2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b0RNUCxcbiAgY29udmVydENoYW5nZXNUb1hNTCxcbiAgY2Fub25pY2FsaXplXG59O1xuIl19
+
+
+/***/ },
+/* 6 */
+/***/ function(module, exports) {
+
+ 'use strict';
+
+ exports.__esModule = true;
+ exports['default'] = Diff;
+
+ function Diff() {}
+
+ Diff.prototype = {
+ diff: function diff(oldString, newString) {
+ var options = arguments.length <= 2 || arguments[2] === undefined ? {} : arguments[2];
+
+ var callback = options.callback;
+ if (typeof options === 'function') {
+ callback = options;
+ options = {};
}
+ this.options = options;
- var other = new Array(arr.length);
+ var self = this;
- for (var i = 0, n = arr.length; i < n; i++) {
- other[i] = mapper.call(that, arr[i], i, arr);
+ function done(value) {
+ if (callback) {
+ setTimeout(function () {
+ callback(undefined, value);
+ }, 0);
+ return true;
+ } else {
+ return value;
+ }
}
- return other;
- }
- function clonePath(path) {
- return { newPos: path.newPos, components: path.components.slice(0) };
- }
- function removeEmpty(array) {
+
+ // Allow subclasses to massage the input prior to running
+ 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;
+ var editLength = 1;
+ var maxEditLength = newLen + oldLen;
+ var bestPath = [{ newPos: -1, components: [] }];
+
+ // Seed editLength = 0, i.e. the content starts with the same values
+ 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 }]);
+ }
+
+ // Main worker method. checks all permutations of a given edit length for acceptance.
+ function execEditLength() {
+ for (var diagonalPath = -1 * editLength; diagonalPath <= editLength; diagonalPath += 2) {
+ var basePath = undefined;
+ var addPath = bestPath[diagonalPath - 1],
+ removePath = bestPath[diagonalPath + 1],
+ _oldPos = (removePath ? removePath.newPos : 0) - diagonalPath;
+ if (addPath) {
+ // No one else is going to attempt to use this value, clear it
+ bestPath[diagonalPath - 1] = undefined;
+ }
+
+ var canAdd = addPath && addPath.newPos + 1 < newLen,
+ canRemove = removePath && 0 <= _oldPos && _oldPos < oldLen;
+ if (!canAdd && !canRemove) {
+ // If this path is a terminal then prune
+ bestPath[diagonalPath] = undefined;
+ continue;
+ }
+
+ // Select the diagonal that we want to branch from. We select the prior
+ // path whose position in the new string is the farthest from the origin
+ // and does not pass the bounds of the diff graph
+ if (!canAdd || canRemove && addPath.newPos < removePath.newPos) {
+ basePath = clonePath(removePath);
+ self.pushComponent(basePath.components, undefined, true);
+ } else {
+ basePath = addPath; // No need to clone, we've pulled it from the list
+ basePath.newPos++;
+ self.pushComponent(basePath.components, true, undefined);
+ }
+
+ _oldPos = self.extractCommon(basePath, newString, oldString, diagonalPath);
+
+ // If we have hit the end of both strings, then we are done
+ if (basePath.newPos + 1 >= newLen && _oldPos + 1 >= oldLen) {
+ return done(buildValues(self, basePath.components, newString, oldString, self.useLongestToken));
+ } else {
+ // Otherwise track this path as a potential candidate and continue.
+ bestPath[diagonalPath] = basePath;
+ }
+ }
+
+ editLength++;
+ }
+
+ // Performs the length of edit iteration. Is a bit fugly as this has to support the
+ // sync and async mode which is never fun. Loops over execEditLength until a value
+ // is produced.
+ if (callback) {
+ (function exec() {
+ setTimeout(function () {
+ // This should not happen, but we want to be safe.
+ /* istanbul ignore next */
+ if (editLength > maxEditLength) {
+ return callback();
+ }
+
+ if (!execEditLength()) {
+ exec();
+ }
+ }, 0);
+ })();
+ } else {
+ while (editLength <= maxEditLength) {
+ var ret = execEditLength();
+ if (ret) {
+ return ret;
+ }
+ }
+ }
+ },
+
+ pushComponent: function pushComponent(components, added, removed) {
+ var last = components[components.length - 1];
+ if (last && last.added === added && last.removed === removed) {
+ // We need to clone here as the component clone operation is just
+ // as shallow array clone
+ components[components.length - 1] = { count: last.count + 1, added: added, removed: removed };
+ } else {
+ components.push({ count: 1, added: added, removed: removed });
+ }
+ },
+ extractCommon: function extractCommon(basePath, newString, oldString, diagonalPath) {
+ var newLen = newString.length,
+ oldLen = oldString.length,
+ newPos = basePath.newPos,
+ oldPos = newPos - diagonalPath,
+ commonCount = 0;
+ while (newPos + 1 < newLen && oldPos + 1 < oldLen && this.equals(newString[newPos + 1], oldString[oldPos + 1])) {
+ newPos++;
+ oldPos++;
+ commonCount++;
+ }
+
+ if (commonCount) {
+ basePath.components.push({ count: commonCount });
+ }
+
+ basePath.newPos = newPos;
+ return oldPos;
+ },
+
+ equals: function equals(left, right) {
+ return left === right;
+ },
+ removeEmpty: function removeEmpty(array) {
var ret = [];
for (var i = 0; i < array.length; i++) {
if (array[i]) {
@@ -650,586 +846,1008 @@
}
}
return ret;
+ },
+ castInput: function castInput(value) {
+ return value;
+ },
+ tokenize: function tokenize(value) {
+ return value.split('');
+ }
+ };
+
+ function buildValues(diff, components, newString, oldString, useLongestToken) {
+ var componentPos = 0,
+ componentLen = components.length,
+ newPos = 0,
+ oldPos = 0;
+
+ for (; componentPos < componentLen; componentPos++) {
+ var component = components[componentPos];
+ if (!component.removed) {
+ 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;
+
+ // Common case
+ if (!component.added) {
+ oldPos += component.count;
+ }
+ } else {
+ component.value = oldString.slice(oldPos, oldPos + component.count).join('');
+ oldPos += component.count;
+
+ // Reverse add and remove so removes are output first to match common convention
+ // The diffing algorithm is tied to add then remove output and this is the simplest
+ // route to get the desired output with minimal overhead.
+ if (componentPos && components[componentPos - 1].added) {
+ var tmp = components[componentPos - 1];
+ components[componentPos - 1] = components[componentPos];
+ components[componentPos] = tmp;
+ }
+ }
}
- function escapeHTML(s) {
- var n = s;
- n = n.replace(/&/g, '&');
- n = n.replace(//g, '>');
- n = n.replace(/"/g, '"');
-
- return n;
+
+ // Special case handle for when one terminal is ignored. For this case we merge the
+ // terminal into the prior string and drop the change.
+ var lastComponent = components[componentLen - 1];
+ if ((lastComponent.added || lastComponent.removed) && diff.equals('', lastComponent.value)) {
+ components[componentLen - 2].value += lastComponent.value;
+ components.pop();
}
- // This function handles the presence of circular references by bailing out when encountering an
- // object that is already on the "stack" of items being processed.
- function canonicalize(obj, stack, replacementStack) {
- stack = stack || [];
- replacementStack = replacementStack || [];
+ return components;
+ }
- var i;
+ function clonePath(path) {
+ return { newPos: path.newPos, components: path.components.slice(0) };
+ }
+ module.exports = exports['default'];
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9kaWZmL2Jhc2UuanMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O3FCQUF3QixJQUFJOztBQUFiLFNBQVMsSUFBSSxHQUFHLEVBQUU7O0FBRWpDLElBQUksQ0FBQyxTQUFTLEdBQUc7QUFDZixNQUFJLEVBQUEsY0FBQyxTQUFTLEVBQUUsU0FBUyxFQUFnQjtRQUFkLE9BQU8seURBQUcsRUFBRTs7QUFDckMsUUFBSSxRQUFRLEdBQUcsT0FBTyxDQUFDLFFBQVEsQ0FBQztBQUNoQyxRQUFJLE9BQU8sT0FBTyxLQUFLLFVBQVUsRUFBRTtBQUNqQyxjQUFRLEdBQUcsT0FBTyxDQUFDO0FBQ25CLGFBQU8sR0FBRyxFQUFFLENBQUM7S0FDZDtBQUNELFFBQUksQ0FBQyxPQUFPLEdBQUcsT0FBTyxDQUFDOztBQUV2QixRQUFJLElBQUksR0FBRyxJQUFJLENBQUM7O0FBRWhCLGFBQVMsSUFBSSxDQUFDLEtBQUssRUFBRTtBQUNuQixVQUFJLFFBQVEsRUFBRTtBQUNaLGtCQUFVLENBQUMsWUFBVztBQUFFLGtCQUFRLENBQUMsU0FBUyxFQUFFLEtBQUssQ0FBQyxDQUFDO1NBQUUsRUFBRSxD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lbnRzW2NvbXBvbmVudFBvcyAtIDFdLmFkZGVkKSB7XG4gICAgICAgIGxldCB0bXAgPSBjb21wb25lbnRzW2NvbXBvbmVudFBvcyAtIDFdO1xuICAgICAgICBjb21wb25lbnRzW2NvbXBvbmVudFBvcyAtIDFdID0gY29tcG9uZW50c1tjb21wb25lbnRQb3NdO1xuICAgICAgICBjb21wb25lbnRzW2NvbXBvbmVudFBvc10gPSB0bXA7XG4gICAgICB9XG4gICAgfVxuICB9XG5cbiAgLy8gU3BlY2lhbCBjYXNlIGhhbmRsZSBmb3Igd2hlbiBvbmUgdGVybWluYWwgaXMgaWdub3JlZC4gRm9yIHRoaXMgY2FzZSB3ZSBtZXJnZSB0aGVcbiAgLy8gdGVybWluYWwgaW50byB0aGUgcHJpb3Igc3RyaW5nIGFuZCBkcm9wIHRoZSBjaGFuZ2UuXG4gIGxldCBsYXN0Q29tcG9uZW50ID0gY29tcG9uZW50c1tjb21wb25lbnRMZW4gLSAxXTtcbiAgaWYgKChsYXN0Q29tcG9uZW50LmFkZGVkIHx8IGxhc3RDb21wb25lbnQucmVtb3ZlZCkgJiYgZGlmZi5lcXVhbHMoJycsIGxhc3RDb21wb25lbnQudmFsdWUpKSB7XG4gICAgY29tcG9uZW50c1tjb21wb25lbnRMZW4gLSAyXS52YWx1ZSArPSBsYXN0Q29tcG9uZW50LnZhbHVlO1xuICAgIGNvbXBvbmVudHMucG9wKCk7XG4gIH1cblxuICByZXR1cm4gY29tcG9uZW50cztcbn1cblxuZnVuY3Rpb24gY2xvbmVQYXRoKHBhdGgpIHtcbiAgcmV0dXJuIHsgbmV3UG9zOiBwYXRoLm5ld1BvcywgY29tcG9uZW50czogcGF0aC5jb21wb25lbnRzLnNsaWNlKDApIH07XG59XG4iXX0=
- for (i = 0; i < stack.length; i += 1) {
- if (stack[i] === obj) {
- return replacementStack[i];
- }
+
+/***/ },
+/* 7 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ exports.__esModule = true;
+ exports.diffChars = diffChars;
+ // istanbul ignore next
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
+
+ var _base = __webpack_require__(6);
+
+ var _base2 = _interopRequireDefault(_base);
+
+ var characterDiff = new _base2['default']();
+ exports.characterDiff = characterDiff;
+
+ function diffChars(oldStr, newStr, callback) {
+ return characterDiff.diff(oldStr, newStr, callback);
+ }
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9kaWZmL2NoYXJhY3Rlci5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7OztvQkFBaUIsUUFBUTs7OztBQUVsQixJQUFNLGFBQWEsR0FBRyx1QkFBVSxDQUFDOzs7QUFDakMsU0FBUyxTQUFTLENBQUMsTUFBTSxFQUFFLE1BQU0sRUFBRSxRQUFRLEVBQUU7QUFBRSxTQUFPLGFBQWEsQ0FBQyxJQUFJLENBQUMsTUFBTSxFQUFFLE1BQU0sRUFBRSxRQUFRLENBQUMsQ0FBQztDQUFFIiwiZmlsZSI6ImNoYXJhY3Rlci5qcyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCBEaWZmIGZyb20gJy4vYmFzZSc7XG5cbmV4cG9ydCBjb25zdCBjaGFyYWN0ZXJEaWZmID0gbmV3IERpZmYoKTtcbmV4cG9ydCBmdW5jdGlvbiBkaWZmQ2hhcnMob2xkU3RyLCBuZXdTdHIsIGNhbGxiYWNrKSB7IHJldHVybiBjaGFyYWN0ZXJEaWZmLmRpZmYob2xkU3RyLCBuZXdTdHIsIGNhbGxiYWNrKTsgfVxuIl19
+
+
+/***/ },
+/* 8 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ exports.__esModule = true;
+ exports.diffWords = diffWords;
+ exports.diffWordsWithSpace = diffWordsWithSpace;
+ // istanbul ignore next
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
+
+ var _base = __webpack_require__(6);
+
+ var _base2 = _interopRequireDefault(_base);
+
+ var _utilParams = __webpack_require__(9);
+
+ // Based on https://en.wikipedia.org/wiki/Latin_script_in_Unicode
+ //
+ // Ranges and exceptions:
+ // Latin-1 Supplement, 0080–00FF
+ // - U+00D7 × Multiplication sign
+ // - U+00F7 ÷ Division sign
+ // Latin Extended-A, 0100–017F
+ // Latin Extended-B, 0180–024F
+ // IPA Extensions, 0250–02AF
+ // Spacing Modifier Letters, 02B0–02FF
+ // - U+02C7 ˇ ˇ Caron
+ // - U+02D8 ˘ ˘ Breve
+ // - U+02D9 ˙ ˙ Dot Above
+ // - U+02DA ˚ ˚ Ring Above
+ // - U+02DB ˛ ˛ Ogonek
+ // - U+02DC ˜ ˜ Small Tilde
+ // - U+02DD ˝ ˝ Double Acute Accent
+ // Latin Extended Additional, 1E00–1EFF
+ var extendedWordChars = /^[A-Za-z\xC0-\u02C6\u02C8-\u02D7\u02DE-\u02FF\u1E00-\u1EFF]+$/;
+
+ var reWhitespace = /\S/;
+
+ var wordDiff = new _base2['default']();
+ exports.wordDiff = wordDiff;
+ wordDiff.equals = function (left, right) {
+ return left === right || this.options.ignoreWhitespace && !reWhitespace.test(left) && !reWhitespace.test(right);
+ };
+ wordDiff.tokenize = function (value) {
+ var tokens = value.split(/(\s+|\b)/);
+
+ // Join the boundary splits that we do not consider to be boundaries. This is primarily the extended Latin character set.
+ for (var i = 0; i < tokens.length - 1; i++) {
+ // If we have an empty string in the next field and we have only word chars before and after, merge
+ if (!tokens[i + 1] && tokens[i + 2] && extendedWordChars.test(tokens[i]) && extendedWordChars.test(tokens[i + 2])) {
+ tokens[i] += tokens[i + 2];
+ tokens.splice(i + 1, 2);
+ i--;
}
+ }
- var canonicalizedObj;
+ return tokens;
+ };
- if ('[object Array]' === objectPrototypeToString.call(obj)) {
- stack.push(obj);
- canonicalizedObj = new Array(obj.length);
- replacementStack.push(canonicalizedObj);
- for (i = 0; i < obj.length; i += 1) {
- canonicalizedObj[i] = canonicalize(obj[i], stack, replacementStack);
- }
- stack.pop();
- replacementStack.pop();
- } else if (typeof obj === 'object' && obj !== null) {
- stack.push(obj);
- canonicalizedObj = {};
- replacementStack.push(canonicalizedObj);
- var sortedKeys = [],
- key;
- for (key in obj) {
- sortedKeys.push(key);
- }
- sortedKeys.sort();
- for (i = 0; i < sortedKeys.length; i += 1) {
- key = sortedKeys[i];
- canonicalizedObj[key] = canonicalize(obj[key], stack, replacementStack);
+ function diffWords(oldStr, newStr, callback) {
+ var options = _utilParams.generateOptions(callback, { ignoreWhitespace: true });
+ return wordDiff.diff(oldStr, newStr, options);
+ }
+
+ function diffWordsWithSpace(oldStr, newStr, callback) {
+ return wordDiff.diff(oldStr, newStr, callback);
+ }
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9kaWZmL3dvcmQuanMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7O29CQUFpQixRQUFROzs7OzBCQUNLLGdCQUFnQjs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7QUFvQjlDLElBQU0saUJBQWlCLEdBQUcsK0RBQXFHLENBQUM7O0FBRWhJLElBQU0sWUFBWSxHQUFHLElBQUksQ0FBQzs7QUFFbkIsSUFBTSxRQUFRLEdBQUcsdUJBQVUsQ0FBQzs7QUFDbkMsUUFBUSxDQUFDLE1BQU0sR0FBRyxVQUFTLElBQUksRUFBRSxLQUFLLEVBQUU7QUFDdEMsU0FBTyxJQUFJLEtBQUssS0FBSyxJQUFLLElBQUksQ0FBQyxPQUFPLENBQUMsZ0JBQWdCLElBQUksQ0FBQyxZQUFZLENBQUMsSUFBSSxDQUFDLElBQUksQ0FBQyxJQUFJLENBQUMsWUFBWSxDQUFDLElBQUksQ0FBQyxLQUFLLENBQUMsQUFBQyxDQUFDO0NBQ25ILENBQUM7QUFDRixRQUFRLENBQUMsUUFBUSxHQUFHLFVBQV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ICAgIGlmICghdG9rZW5zW2kgKyAxXSAmJiB0b2tlbnNbaSArIDJdXG4gICAgICAgICAgJiYgZXh0ZW5kZWRXb3JkQ2hhcnMudGVzdCh0b2tlbnNbaV0pXG4gICAgICAgICAgJiYgZXh0ZW5kZWRXb3JkQ2hhcnMudGVzdCh0b2tlbnNbaSArIDJdKSkge1xuICAgICAgdG9rZW5zW2ldICs9IHRva2Vuc1tpICsgMl07XG4gICAgICB0b2tlbnMuc3BsaWNlKGkgKyAxLCAyKTtcbiAgICAgIGktLTtcbiAgICB9XG4gIH1cblxuICByZXR1cm4gdG9rZW5zO1xufTtcblxuZXhwb3J0IGZ1bmN0aW9uIGRpZmZXb3JkcyhvbGRTdHIsIG5ld1N0ciwgY2FsbGJhY2spIHtcbiAgbGV0IG9wdGlvbnMgPSBnZW5lcmF0ZU9wdGlvbnMoY2FsbGJhY2ssIHtpZ25vcmVXaGl0ZXNwYWNlOiB0cnVlfSk7XG4gIHJldHVybiB3b3JkRGlmZi5kaWZmKG9sZFN0ciwgbmV3U3RyLCBvcHRpb25zKTtcbn1cbmV4cG9ydCBmdW5jdGlvbiBkaWZmV29yZHNXaXRoU3BhY2Uob2xkU3RyLCBuZXdTdHIsIGNhbGxiYWNrKSB7XG4gIHJldHVybiB3b3JkRGlmZi5kaWZmKG9sZFN0ciwgbmV3U3RyLCBjYWxsYmFjayk7XG59XG4iXX0=
+
+
+/***/ },
+/* 9 */
+/***/ function(module, exports) {
+
+ 'use strict';
+
+ exports.__esModule = true;
+ exports.generateOptions = generateOptions;
+
+ function generateOptions(options, defaults) {
+ if (typeof options === 'function') {
+ defaults.callback = options;
+ } else if (options) {
+ for (var _name in options) {
+ /* istanbul ignore else */
+ if (options.hasOwnProperty(_name)) {
+ defaults[_name] = options[_name];
}
- stack.pop();
- replacementStack.pop();
- } else {
- canonicalizedObj = obj;
}
- return canonicalizedObj;
}
+ return defaults;
+ }
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJ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componentPos = 0,
- componentLen = components.length,
- newPos = 0,
- oldPos = 0;
-
- for (; componentPos < componentLen; componentPos++) {
- var component = components[componentPos];
- if (!component.removed) {
- if (!component.added && useLongestToken) {
- var value = newString.slice(newPos, newPos + component.count);
- value = map(value, 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;
- // Common case
- if (!component.added) {
- oldPos += component.count;
- }
- } else {
- component.value = oldString.slice(oldPos, oldPos + component.count).join('');
- oldPos += component.count;
+/***/ },
+/* 10 */
+/***/ function(module, exports, __webpack_require__) {
- // Reverse add and remove so removes are output first to match common convention
- // The diffing algorithm is tied to add then remove output and this is the simplest
- // route to get the desired output with minimal overhead.
- if (componentPos && components[componentPos - 1].added) {
- var tmp = components[componentPos - 1];
- components[componentPos - 1] = components[componentPos];
- components[componentPos] = tmp;
- }
+ 'use strict';
+
+ exports.__esModule = true;
+ exports.diffLines = diffLines;
+ exports.diffTrimmedLines = diffTrimmedLines;
+ // istanbul ignore next
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
+
+ var _base = __webpack_require__(6);
+
+ var _base2 = _interopRequireDefault(_base);
+
+ var _utilParams = __webpack_require__(9);
+
+ var lineDiff = new _base2['default']();
+ exports.lineDiff = lineDiff;
+ lineDiff.tokenize = function (value) {
+ var retLines = [],
+ linesAndNewlines = value.split(/(\n|\r\n)/);
+
+ // Ignore the final empty token that occurs if the string ends with a new line
+ if (!linesAndNewlines[linesAndNewlines.length - 1]) {
+ linesAndNewlines.pop();
+ }
+
+ // Merge the content and line separators into single tokens
+ for (var i = 0; i < linesAndNewlines.length; i++) {
+ var line = linesAndNewlines[i];
+
+ if (i % 2 && !this.options.newlineIsToken) {
+ retLines[retLines.length - 1] += line;
+ } else {
+ if (this.options.ignoreWhitespace) {
+ line = line.trim();
}
+ retLines.push(line);
}
-
- return components;
}
- function Diff(ignoreWhitespace) {
- this.ignoreWhitespace = ignoreWhitespace;
+ return retLines;
+ };
+
+ function diffLines(oldStr, newStr, callback) {
+ return lineDiff.diff(oldStr, newStr, callback);
+ }
+
+ function diffTrimmedLines(oldStr, newStr, callback) {
+ var options = _utilParams.generateOptions(callback, { ignoreWhitespace: true });
+ return lineDiff.diff(oldStr, newStr, options);
+ }
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9kaWZmL2xpbmUuanMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7O29CQUFpQixRQUFROzs7OzBCQUNLLGdCQUFnQjs7QUFFdkMsSUFBTSxRQUFRLEdBQUcsdUJBQVUsQ0FBQzs7QUFDbkMsUUFBUSxDQUFDLFFBQVEsR0FBRyxVQUFTLEtBQUssRUFBRTtBQUNsQyxNQUFJLFFBQVEsR0FBRyxFQUFFO01BQ2IsZ0JBQWdCLEdBQUcsS0FBSyxDQUFDLEtBQUssQ0FBQyxXQUFXLENBQUMsQ0FBQzs7O0FBR2hELE1BQUksQ0FBQyxnQkFBZ0IsQ0FBQyxnQkFBZ0IsQ0FBQyxNQUFNLEdBQUcsQ0FBQyxDQUFDLEVBQUU7QUFDbEQsb0JBQWdCLENBQUMsR0FBRyxFQUFFLENBQUM7R0FDeEI7OztBQUdELE9BQUssSUFBSSxDQUFDLEdBQUcsQ0FBQyxFQUFFLENBQUMsR0FBRyxnQkFBZ0IsQ0FBQyxNQUFNLEVBQUUsQ0FBQyxFQUFFLEVBQUU7QUFDaEQsUUFBSSxJQUFJLEdBQUcsZ0JBQWdCLENBQUMsQ0FBQyxDQUFDLENBQUM7O0FBRS9CLFFBQUksQ0FBQyxHQUFHLENBQUMsSUFBSSxDQUFDLElBQUksQ0FBQyxPQUFPLENBQUMsY0FBYyxFQUFFO0FBQ3pDLGNBQVEsQ0FBQyxRQUFRLENBQUMsTUFBT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HtpZ25vcmVXaGl0ZXNwYWNlOiB0cnVlfSk7XG4gIHJldHVybiBsaW5lRGlmZi5kaWZmKG9sZFN0ciwgbmV3U3RyLCBvcHRpb25zKTtcbn1cbiJdfQ==
+
+
+/***/ },
+/* 11 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ exports.__esModule = true;
+ exports.diffSentences = diffSentences;
+ // istanbul ignore next
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
+
+ var _base = __webpack_require__(6);
+
+ var _base2 = _interopRequireDefault(_base);
+
+ var sentenceDiff = new _base2['default']();
+ exports.sentenceDiff = sentenceDiff;
+ sentenceDiff.tokenize = function (value) {
+ return value.split(/(\S.+?[.!?])(?=\s+|$)/);
+ };
+
+ function diffSentences(oldStr, newStr, callback) {
+ return sentenceDiff.diff(oldStr, newStr, callback);
+ }
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9kaWZmL3NlbnRlbmNlLmpzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7O29CQUFpQixRQUFROzs7O0FBR2xCLElBQU0sWUFBWSxHQUFHLHVCQUFVLENBQUM7O0FBQ3ZDLFlBQVksQ0FBQyxRQUFRLEdBQUcsVUFBUyxLQUFLLEVBQUU7QUFDdEMsU0FBTyxLQUFLLENBQUMsS0FBSyxDQUFDLHVCQUF1QixDQUFDLENBQUM7Q0FDN0MsQ0FBQzs7QUFFSyxTQUFTLGFBQWEsQ0FBQyxNQUFNLEVBQUUsTUFBTSxFQUFFLFFBQVEsRUFBRTtBQUFFLFNBQU8sWUFBWSxDQUFDLElBQUksQ0FBQyxNQUFNLEVBQUUsTUFBTSxFQUFFLFFBQVEsQ0FBQyxDQUFDO0NBQUUiLCJmaWxlIjoic2VudGVuY2UuanMiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgRGlmZiBmcm9tICcuL2Jhc2UnO1xuXG5cbmV4cG9ydCBjb25zdCBzZW50ZW5jZURpZmYgPSBuZXcgRGlmZigpO1xuc2VudGVuY2VEaWZmLnRva2VuaXplID0gZnVuY3Rpb24odmFsdWUpIHtcbiAgcmV0dXJuIHZhbHVlLnNwbGl0KC8oXFxTLis/Wy4hP10pKD89XFxzK3wkKS8pO1xufTtcblxuZXhwb3J0IGZ1bmN0aW9uIGRpZmZTZW50ZW5jZXMob2xkU3RyLCBuZXdTdHIsIGNhbGxiYWNrKSB7IHJldHVybiBzZW50ZW5jZURpZmYuZGlmZihvbGRTdHIsIG5ld1N0ciwgY2FsbGJhY2spOyB9XG4iXX0=
+
+
+/***/ },
+/* 12 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ exports.__esModule = true;
+ exports.diffCss = diffCss;
+ // istanbul ignore next
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
+
+ var _base = __webpack_require__(6);
+
+ var _base2 = _interopRequireDefault(_base);
+
+ var cssDiff = new _base2['default']();
+ exports.cssDiff = cssDiff;
+ cssDiff.tokenize = function (value) {
+ return value.split(/([{}:;,]|\s+)/);
+ };
+
+ function diffCss(oldStr, newStr, callback) {
+ return cssDiff.diff(oldStr, newStr, callback);
+ }
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9kaWZmL2Nzcy5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7OztvQkFBaUIsUUFBUTs7OztBQUVsQixJQUFNLE9BQU8sR0FBRyx1QkFBVSxDQUFDOztBQUNsQyxPQUFPLENBQUMsUUFBUSxHQUFHLFVBQVMsS0FBSyxFQUFFO0FBQ2pDLFNBQU8sS0FBSyxDQUFDLEtBQUssQ0FBQyxlQUFlLENBQUMsQ0FBQztDQUNyQyxDQUFDOztBQUVLLFNBQVMsT0FBTyxDQUFDLE1BQU0sRUFBRSxNQUFNLEVBQUUsUUFBUSxFQUFFO0FBQUUsU0FBTyxPQUFPLENBQUMsSUFBSSxDQUFDLE1BQU0sRUFBRSxNQUFNLEVBQUUsUUFBUSxDQUFDLENBQUM7Q0FBRSIsImZpbGUiOiJjc3MuanMiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgRGlmZiBmcm9tICcuL2Jhc2UnO1xuXG5leHBvcnQgY29uc3QgY3NzRGlmZiA9IG5ldyBEaWZmKCk7XG5jc3NEaWZmLnRva2VuaXplID0gZnVuY3Rpb24odmFsdWUpIHtcbiAgcmV0dXJuIHZhbHVlLnNwbGl0KC8oW3t9OjssXXxcXHMrKS8pO1xufTtcblxuZXhwb3J0IGZ1bmN0aW9uIGRpZmZDc3Mob2xkU3RyLCBuZXdTdHIsIGNhbGxiYWNrKSB7IHJldHVybiBjc3NEaWZmLmRpZmYob2xkU3RyLCBuZXdTdHIsIGNhbGxiYWNrKTsgfVxuIl19
+
+
+/***/ },
+/* 13 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ exports.__esModule = true;
+ exports.diffJson = diffJson;
+ exports.canonicalize = canonicalize;
+ // istanbul ignore next
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
+
+ var _base = __webpack_require__(6);
+
+ var _base2 = _interopRequireDefault(_base);
+
+ var _line = __webpack_require__(10);
+
+ var objectPrototypeToString = Object.prototype.toString;
+
+ var jsonDiff = new _base2['default']();
+ exports.jsonDiff = jsonDiff;
+ // Discriminate between two lines of pretty-printed, serialized JSON where one of them has a
+ // dangling comma and the other doesn't. Turns out including the dangling comma yields the nicest output:
+ jsonDiff.useLongestToken = true;
+
+ jsonDiff.tokenize = _line.lineDiff.tokenize;
+ jsonDiff.castInput = function (value) {
+ return typeof value === 'string' ? value : JSON.stringify(canonicalize(value), undefined, ' ');
+ };
+ jsonDiff.equals = function (left, right) {
+ return _base2['default'].prototype.equals(left.replace(/,([\r\n])/g, '$1'), right.replace(/,([\r\n])/g, '$1'));
+ };
+
+ function diffJson(oldObj, newObj, callback) {
+ return jsonDiff.diff(oldObj, newObj, callback);
+ }
+
+ // This function handles the presence of circular references by bailing out when encountering an
+ // object that is already on the "stack" of items being processed.
+
+ function canonicalize(obj, stack, replacementStack) {
+ stack = stack || [];
+ replacementStack = replacementStack || [];
+
+ var i = undefined;
+
+ for (i = 0; i < stack.length; i += 1) {
+ if (stack[i] === obj) {
+ return replacementStack[i];
+ }
}
- Diff.prototype = {
- diff: function(oldString, newString, callback) {
- var self = this;
-
- function done(value) {
- if (callback) {
- setTimeout(function() { callback(undefined, value); }, 0);
- return true;
- } else {
- return value;
- }
- }
- // Handle the identity case (this is due to unrolling editLength == 0
- if (newString === oldString) {
- return done([{ value: newString }]);
- }
- if (!newString) {
- return done([{ value: oldString, removed: true }]);
- }
- if (!oldString) {
- return done([{ value: newString, added: true }]);
+ var canonicalizedObj = undefined;
+
+ if ('[object Array]' === objectPrototypeToString.call(obj)) {
+ stack.push(obj);
+ canonicalizedObj = new Array(obj.length);
+ replacementStack.push(canonicalizedObj);
+ for (i = 0; i < obj.length; i += 1) {
+ canonicalizedObj[i] = canonicalize(obj[i], stack, replacementStack);
+ }
+ stack.pop();
+ replacementStack.pop();
+ } else if (typeof obj === 'object' && obj !== null) {
+ stack.push(obj);
+ canonicalizedObj = {};
+ replacementStack.push(canonicalizedObj);
+ var sortedKeys = [],
+ key = undefined;
+ for (key in obj) {
+ /* istanbul ignore else */
+ if (obj.hasOwnProperty(key)) {
+ sortedKeys.push(key);
}
+ }
+ sortedKeys.sort();
+ for (i = 0; i < sortedKeys.length; i += 1) {
+ key = sortedKeys[i];
+ canonicalizedObj[key] = canonicalize(obj[key], stack, replacementStack);
+ }
+ stack.pop();
+ replacementStack.pop();
+ } else {
+ canonicalizedObj = obj;
+ }
+ return canonicalizedObj;
+ }
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4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3AoKTtcbiAgfSBlbHNlIGlmICh0eXBlb2Ygb2JqID09PSAnb2JqZWN0JyAmJiBvYmogIT09IG51bGwpIHtcbiAgICBzdGFjay5wdXNoKG9iaik7XG4gICAgY2Fub25pY2FsaXplZE9iaiA9IHt9O1xuICAgIHJlcGxhY2VtZW50U3RhY2sucHVzaChjYW5vbmljYWxpemVkT2JqKTtcbiAgICBsZXQgc29ydGVkS2V5cyA9IFtdLFxuICAgICAgICBrZXk7XG4gICAgZm9yIChrZXkgaW4gb2JqKSB7XG4gICAgICAvKiBpc3RhbmJ1bCBpZ25vcmUgZWxzZSAqL1xuICAgICAgaWYgKG9iai5oYXNPd25Qcm9wZXJ0eShrZXkpKSB7XG4gICAgICAgIHNvcnRlZEtleXMucHVzaChrZXkpO1xuICAgICAgfVxuICAgIH1cbiAgICBzb3J0ZWRLZXlzLnNvcnQoKTtcbiAgICBmb3IgKGkgPSAwOyBpIDwgc29ydGVkS2V5cy5sZW5ndGg7IGkgKz0gMSkge1xuICAgICAga2V5ID0gc29ydGVkS2V5c1tpXTtcbiAgICAgIGNhbm9uaWNhbGl6ZWRPYmpba2V5XSA9IGNhbm9uaWNhbGl6ZShvYmpba2V5XSwgc3RhY2ssIHJlcGxhY2VtZW50U3RhY2spO1xuICAgIH1cbiAgICBzdGFjay5wb3AoKTtcbiAgICByZXBsYWNlbWVudFN0YWNrLnBvcCgpO1xuICB9IGVsc2Uge1xuICAgIGNhbm9uaWNhbGl6ZWRPYmogPSBvYmo7XG4gIH1cbiAgcmV0dXJuIGNhbm9uaWNhbGl6ZWRPYmo7XG59XG4iXX0=
- newString = this.tokenize(newString);
- oldString = this.tokenize(oldString);
- var newLen = newString.length, oldLen = oldString.length;
- var editLength = 1;
- var maxEditLength = newLen + oldLen;
- var bestPath = [{ newPos: -1, components: [] }];
+/***/ },
+/* 14 */
+/***/ function(module, exports, __webpack_require__) {
- // Seed editLength = 0, i.e. the content starts with the same values
- 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('')}]);
- }
+ 'use strict';
- // Main worker method. checks all permutations of a given edit length for acceptance.
- function execEditLength() {
- for (var diagonalPath = -1 * editLength; diagonalPath <= editLength; diagonalPath += 2) {
- var basePath;
- var addPath = bestPath[diagonalPath - 1],
- removePath = bestPath[diagonalPath + 1],
- oldPos = (removePath ? removePath.newPos : 0) - diagonalPath;
- if (addPath) {
- // No one else is going to attempt to use this value, clear it
- bestPath[diagonalPath - 1] = undefined;
- }
+ exports.__esModule = true;
+ exports.applyPatch = applyPatch;
+ exports.applyPatches = applyPatches;
+ // istanbul ignore next
- var canAdd = addPath && addPath.newPos + 1 < newLen,
- canRemove = removePath && 0 <= oldPos && oldPos < oldLen;
- if (!canAdd && !canRemove) {
- // If this path is a terminal then prune
- bestPath[diagonalPath] = undefined;
- continue;
- }
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
- // Select the diagonal that we want to branch from. We select the prior
- // path whose position in the new string is the farthest from the origin
- // and does not pass the bounds of the diff graph
- if (!canAdd || (canRemove && addPath.newPos < removePath.newPos)) {
- basePath = clonePath(removePath);
- self.pushComponent(basePath.components, undefined, true);
- } else {
- basePath = addPath; // No need to clone, we've pulled it from the list
- basePath.newPos++;
- self.pushComponent(basePath.components, true, undefined);
- }
+ var _parse = __webpack_require__(15);
- oldPos = self.extractCommon(basePath, newString, oldString, diagonalPath);
+ var _utilDistanceIterator = __webpack_require__(16);
- // If we have hit the end of both strings, then we are done
- if (basePath.newPos + 1 >= newLen && oldPos + 1 >= oldLen) {
- return done(buildValues(basePath.components, newString, oldString, self.useLongestToken));
- } else {
- // Otherwise track this path as a potential candidate and continue.
- bestPath[diagonalPath] = basePath;
+ var _utilDistanceIterator2 = _interopRequireDefault(_utilDistanceIterator);
+
+ function applyPatch(source, uniDiff) {
+ var options = arguments.length <= 2 || arguments[2] === undefined ? {} : arguments[2];
+
+ if (typeof uniDiff === 'string') {
+ uniDiff = _parse.parsePatch(uniDiff);
+ }
+
+ if (Array.isArray(uniDiff)) {
+ if (uniDiff.length > 1) {
+ throw new Error('applyPatch only works with a single input.');
+ }
+
+ uniDiff = uniDiff[0];
+ }
+
+ // Apply the diff to the input
+ 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 = undefined,
+ addEOFNL = undefined;
+
+ /**
+ * Checks if the hunk exactly fits on the provided location
+ */
+ function hunkFits(hunk, toPos) {
+ for (var j = 0; j < hunk.lines.length; j++) {
+ var line = hunk.lines[j],
+ operation = line[0],
+ content = line.substr(1);
+
+ if (operation === ' ' || operation === '-') {
+ // Context sanity check
+ if (!compareLine(toPos + 1, lines[toPos], operation, content)) {
+ errorCount++;
+
+ if (errorCount > fuzzFactor) {
+ return false;
}
}
+ toPos++;
+ }
+ }
+
+ return true;
+ }
+
+ // Search best fit offsets for each hunk based on the previous ones
+ for (var i = 0; i < hunks.length; i++) {
+ var hunk = hunks[i],
+ maxLine = lines.length - hunk.oldLines,
+ localOffset = 0,
+ toPos = offset + hunk.oldStart - 1;
+
+ var iterator = _utilDistanceIterator2['default'](toPos, minLine, maxLine);
- editLength++;
+ for (; localOffset !== undefined; localOffset = iterator()) {
+ if (hunkFits(hunk, toPos + localOffset)) {
+ hunk.offset = offset += localOffset;
+ break;
}
+ }
- // Performs the length of edit iteration. Is a bit fugly as this has to support the
- // sync and async mode which is never fun. Loops over execEditLength until a value
- // is produced.
- if (callback) {
- (function exec() {
- setTimeout(function() {
- // This should not happen, but we want to be safe.
- /*istanbul ignore next */
- if (editLength > maxEditLength) {
- return callback();
- }
+ if (localOffset === undefined) {
+ return false;
+ }
- if (!execEditLength()) {
- exec();
- }
- }, 0);
- }());
- } else {
- while (editLength <= maxEditLength) {
- var ret = execEditLength();
- if (ret) {
- return ret;
+ // Set lower text limit to end of the current hunk, so next ones don't try
+ // to fit over already patched text
+ minLine = hunk.offset + hunk.oldStart + hunk.oldLines;
+ }
+
+ // Apply patch hunks
+ for (var i = 0; i < hunks.length; i++) {
+ var hunk = hunks[i],
+ toPos = hunk.offset + hunk.newStart - 1;
+
+ for (var j = 0; j < hunk.lines.length; j++) {
+ var line = hunk.lines[j],
+ operation = line[0],
+ content = line.substr(1);
+
+ if (operation === ' ') {
+ toPos++;
+ } else if (operation === '-') {
+ lines.splice(toPos, 1);
+ /* istanbul ignore else */
+ } else if (operation === '+') {
+ lines.splice(toPos, 0, content);
+ toPos++;
+ } else if (operation === '\\') {
+ var previousOperation = hunk.lines[j - 1] ? hunk.lines[j - 1][0] : null;
+ if (previousOperation === '+') {
+ removeEOFNL = true;
+ } else if (previousOperation === '-') {
+ addEOFNL = true;
}
}
- }
- },
-
- pushComponent: function(components, added, removed) {
- var last = components[components.length - 1];
- if (last && last.added === added && last.removed === removed) {
- // We need to clone here as the component clone operation is just
- // as shallow array clone
- components[components.length - 1] = {count: last.count + 1, added: added, removed: removed };
- } else {
- components.push({count: 1, added: added, removed: removed });
- }
- },
- extractCommon: function(basePath, newString, oldString, diagonalPath) {
- var newLen = newString.length,
- oldLen = oldString.length,
- newPos = basePath.newPos,
- oldPos = newPos - diagonalPath,
-
- commonCount = 0;
- while (newPos + 1 < newLen && oldPos + 1 < oldLen && this.equals(newString[newPos + 1], oldString[oldPos + 1])) {
- newPos++;
- oldPos++;
- commonCount++;
- }
+ }
+ }
- if (commonCount) {
- basePath.components.push({count: commonCount});
- }
+ // Handle EOFNL insertion/removal
+ if (removeEOFNL) {
+ while (!lines[lines.length - 1]) {
+ lines.pop();
+ }
+ } else if (addEOFNL) {
+ lines.push('');
+ }
+ return lines.join('\n');
+ }
+
+ // Wrapper that supports multiple file patches via callbacks.
- basePath.newPos = newPos;
- return oldPos;
- },
+ function applyPatches(uniDiff, options) {
+ if (typeof uniDiff === 'string') {
+ uniDiff = _parse.parsePatch(uniDiff);
+ }
- equals: function(left, right) {
- var reWhitespace = /\S/;
- return left === right || (this.ignoreWhitespace && !reWhitespace.test(left) && !reWhitespace.test(right));
- },
- tokenize: function(value) {
- return value.split('');
+ var currentIndex = 0;
+ function processIndex() {
+ var index = uniDiff[currentIndex++];
+ if (!index) {
+ return options.complete();
}
- };
- var CharDiff = new Diff();
+ options.loadFile(index, function (err, data) {
+ if (err) {
+ return options.complete(err);
+ }
- var WordDiff = new Diff(true);
- var WordWithSpaceDiff = new Diff();
- WordDiff.tokenize = WordWithSpaceDiff.tokenize = function(value) {
- return removeEmpty(value.split(/(\s+|\b)/));
- };
+ var updatedContent = applyPatch(data, index, options);
+ options.patched(index, updatedContent);
+
+ setTimeout(processIndex, 0);
+ });
+ }
+ processIndex();
+ }
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9wYXRjaC9hcHBseS5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7cUJBQXlCLFNBQVM7O29DQUNMLDJCQUEyQjs7OztBQUVqRCxTQUFTLFVBQVUsQ0FBQyxNQUFNLEVBQUUsT0FBTyxFQUFnQjtNQUFkLE9BQU8seURBQUcsRUFBRTs7QUFDdEQsTUFBSSxPQUFPLE9BQU8sS0FBSyxRQUFRLEVBQUU7QUFDL0IsV0FBTyxHQUFHLGtCQUFXLE9BQU8sQ0FBQyxDQUFDO0dBQy9COztBQUVELE1BQUksS0FBSyxDQUFDLE9BQU8sQ0FBQyxPQUFPLENBQUMsRUFBRTtBQUMxQixRQUFJLE9BQU8sQ0FBQyxNQUFNLEdBQUcsQ0FBQyxFQUFFO0FBQ3RCLFlBQU0sSUFBSSxLQUFLLENBQUMsNENBQTRDLENBQUMsQ0FBQztLQUMvRDs7QUFFRCxXQUFPLEdBQUcsT0FBTyxDQUFD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jaGVkKGluZGV4LCB1cGRhdGVkQ29udGVudCk7XG5cbiAgICAgIHNldFRpbWVvdXQocHJvY2Vzc0luZGV4LCAwKTtcbiAgICB9KTtcbiAgfVxuICBwcm9jZXNzSW5kZXgoKTtcbn1cbiJdfQ==
- var CssDiff = new Diff(true);
- CssDiff.tokenize = function(value) {
- return removeEmpty(value.split(/([{}:;,]|\s+)/));
- };
- var LineDiff = new Diff();
+/***/ },
+/* 15 */
+/***/ function(module, exports) {
- var TrimmedLineDiff = new Diff();
- TrimmedLineDiff.ignoreTrim = true;
+ 'use strict';
- LineDiff.tokenize = TrimmedLineDiff.tokenize = function(value) {
- var retLines = [],
- lines = value.split(/^/m);
- for (var i = 0; i < lines.length; i++) {
- var line = lines[i],
- lastLine = lines[i - 1],
- lastLineLastChar = lastLine && lastLine[lastLine.length - 1];
+ exports.__esModule = true;
+ exports.parsePatch = parsePatch;
- // Merge lines that may contain windows new lines
- if (line === '\n' && lastLineLastChar === '\r') {
- retLines[retLines.length - 1] = retLines[retLines.length - 1].slice(0, -1) + '\r\n';
- } else {
- if (this.ignoreTrim) {
- line = line.trim();
- // add a newline unless this is the last line.
- if (i < lines.length - 1) {
- line += '\n';
- }
- }
- retLines.push(line);
+ function parsePatch(uniDiff) {
+ var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
+
+ var diffstr = uniDiff.split('\n'),
+ list = [],
+ i = 0;
+
+ function parseIndex() {
+ var index = {};
+ list.push(index);
+
+ // Ignore any leading junk
+ while (i < diffstr.length) {
+ if (/^(Index:|diff -r|@@)/.test(diffstr[i])) {
+ break;
}
+ i++;
}
- return retLines;
- };
+ var header = /^(?:Index:|diff(?: -r \w+)+) (.*)/.exec(diffstr[i]);
+ if (header) {
+ index.index = header[1];
+ i++;
- var PatchDiff = new Diff();
- PatchDiff.tokenize = function(value) {
- var ret = [],
- linesAndNewlines = value.split(/(\n|\r\n)/);
+ if (/^===/.test(diffstr[i])) {
+ i++;
+ }
- // Ignore the final empty token that occurs if the string ends with a new line
- if (!linesAndNewlines[linesAndNewlines.length - 1]) {
- linesAndNewlines.pop();
+ parseFileHeader(index);
+ parseFileHeader(index);
+ } else {
+ // Ignore erant header components that might occur at the start of the file
+ parseFileHeader({});
+ parseFileHeader({});
}
- // Merge the content and line separators into single tokens
- for (var i = 0; i < linesAndNewlines.length; i++) {
- var line = linesAndNewlines[i];
+ index.hunks = [];
- if (i % 2) {
- ret[ret.length - 1] += line;
+ while (i < diffstr.length) {
+ if (/^(Index:|diff -r)/.test(diffstr[i])) {
+ break;
+ } else if (/^@@/.test(diffstr[i])) {
+ index.hunks.push(parseHunk());
+ } else if (diffstr[i] && options.strict) {
+ // Ignore unexpected content unless in strict mode
+ throw new Error('Unknown line ' + (i + 1) + ' ' + JSON.stringify(diffstr[i]));
} else {
- ret.push(line);
+ i++;
}
}
- return ret;
- };
+ }
- var SentenceDiff = new Diff();
- SentenceDiff.tokenize = function(value) {
- return removeEmpty(value.split(/(\S.+?[.!?])(?=\s+|$)/));
- };
+ // Parses the --- and +++ headers, if none are found, no lines
+ // are consumed.
+ function parseFileHeader(index) {
+ var fileHeader = /^(\-\-\-|\+\+\+)\s(\S+)\s?(.*)/.exec(diffstr[i]);
+ if (fileHeader) {
+ var keyPrefix = fileHeader[1] === '---' ? 'old' : 'new';
+ index[keyPrefix + 'FileName'] = fileHeader[2];
+ index[keyPrefix + 'Header'] = fileHeader[3];
- var JsonDiff = new Diff();
- // Discriminate between two lines of pretty-printed, serialized JSON where one of them has a
- // dangling comma and the other doesn't. Turns out including the dangling comma yields the nicest output:
- JsonDiff.useLongestToken = true;
- JsonDiff.tokenize = LineDiff.tokenize;
- JsonDiff.equals = function(left, right) {
- return LineDiff.equals(left.replace(/,([\r\n])/g, '$1'), right.replace(/,([\r\n])/g, '$1'));
- };
+ i++;
+ }
+ }
- var JsDiff = {
- Diff: Diff,
+ // Parses a hunk
+ // This assumes that we are at the start of a hunk.
+ function parseHunk() {
+ var chunkHeaderIndex = i,
+ chunkHeaderLine = diffstr[i++],
+ chunkHeader = chunkHeaderLine.split(/@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/);
+
+ var hunk = {
+ oldStart: +chunkHeader[1],
+ oldLines: +chunkHeader[2] || 1,
+ newStart: +chunkHeader[3],
+ newLines: +chunkHeader[4] || 1,
+ lines: []
+ };
- diffChars: function(oldStr, newStr, callback) { return CharDiff.diff(oldStr, newStr, callback); },
- diffWords: function(oldStr, newStr, callback) { return WordDiff.diff(oldStr, newStr, callback); },
- diffWordsWithSpace: function(oldStr, newStr, callback) { return WordWithSpaceDiff.diff(oldStr, newStr, callback); },
- diffLines: function(oldStr, newStr, callback) { return LineDiff.diff(oldStr, newStr, callback); },
- diffTrimmedLines: function(oldStr, newStr, callback) { return TrimmedLineDiff.diff(oldStr, newStr, callback); },
+ var addCount = 0,
+ removeCount = 0;
+ for (; i < diffstr.length; i++) {
+ var operation = diffstr[i][0];
+
+ if (operation === '+' || operation === '-' || operation === ' ' || operation === '\\') {
+ hunk.lines.push(diffstr[i]);
+
+ if (operation === '+') {
+ addCount++;
+ } else if (operation === '-') {
+ removeCount++;
+ } else if (operation === ' ') {
+ addCount++;
+ removeCount++;
+ }
+ } else {
+ break;
+ }
+ }
- diffSentences: function(oldStr, newStr, callback) { return SentenceDiff.diff(oldStr, newStr, callback); },
+ // Handle the empty block count case
+ if (!addCount && hunk.newLines === 1) {
+ hunk.newLines = 0;
+ }
+ if (!removeCount && hunk.oldLines === 1) {
+ hunk.oldLines = 0;
+ }
- diffCss: function(oldStr, newStr, callback) { return CssDiff.diff(oldStr, newStr, callback); },
- diffJson: function(oldObj, newObj, callback) {
- return JsonDiff.diff(
- typeof oldObj === 'string' ? oldObj : JSON.stringify(canonicalize(oldObj), undefined, ' '),
- typeof newObj === 'string' ? newObj : JSON.stringify(canonicalize(newObj), undefined, ' '),
- callback
- );
- },
+ // Perform optional sanity checking
+ if (options.strict) {
+ if (addCount !== hunk.newLines) {
+ throw new Error('Added line count did not match for hunk at line ' + (chunkHeaderIndex + 1));
+ }
+ if (removeCount !== hunk.oldLines) {
+ throw new Error('Removed line count did not match for hunk at line ' + (chunkHeaderIndex + 1));
+ }
+ }
- createTwoFilesPatch: function(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader) {
- var ret = [];
+ return hunk;
+ }
- if (oldFileName == newFileName) {
- ret.push('Index: ' + oldFileName);
- }
- ret.push('===================================================================');
- ret.push('--- ' + oldFileName + (typeof oldHeader === 'undefined' ? '' : '\t' + oldHeader));
- ret.push('+++ ' + newFileName + (typeof newHeader === 'undefined' ? '' : '\t' + newHeader));
+ while (i < diffstr.length) {
+ parseIndex();
+ }
- var diff = PatchDiff.diff(oldStr, newStr);
- diff.push({value: '', lines: []}); // Append an empty value to make cleanup easier
+ return list;
+ }
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9wYXRjaC9wYXJzZS5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7OztBQUFPLFNBQVMsVUFBVSxDQUFDLE9BQU8sRUFBZ0I7TUFBZCxPQUFPLHlEQUFHLEVBQUU7O0FBQzlDLE1BQUksT0FBTyxHQUFHLE9BQU8sQ0FBQyxLQUFLLENBQUMsSUFBSSxDQUFDO01BQzdCLElBQUksR0FBRyxFQUFFO01BQ1QsQ0FBQyxHQUFHLENBQUMsQ0FBQzs7QUFFVixXQUFTLFVBQVUsR0FBRztBQUNwQixRQUFJLEtBQUssR0FBRyxFQUFFLENBQUM7QUFDZixRQUFJLENBQUMsSUFBSSxDQUFDLEtBQUssQ0FBQyxDQUFDOzs7QUFHakIsV0FBTyxDQUFDLEdBQUcsT0FBTyxDQUFDLE1BQU0sRUFBRTtBQUN6QixVQUFJLHNCQUFzQixDQUFDLElBQUksQ0FBQyxPQUFPLENBQUMsQ0FBQyxDQUFDLENBQUMsRUFBRTtBQUMzQyxjQUFNO09BQ1A7QUFDRCxPQU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cZCspKT8gQEAvKTtcblxuICAgIGxldCBodW5rID0ge1xuICAgICAgb2xkU3RhcnQ6ICtjaHVua0hlYWRlclsxXSxcbiAgICAgIG9sZExpbmVzOiArY2h1bmtIZWFkZXJbMl0gfHwgMSxcbiAgICAgIG5ld1N0YXJ0OiArY2h1bmtIZWFkZXJbM10sXG4gICAgICBuZXdMaW5lczogK2NodW5rSGVhZGVyWzRdIHx8IDEsXG4gICAgICBsaW5lczogW11cbiAgICB9O1xuXG4gICAgbGV0IGFkZENvdW50ID0gMCxcbiAgICAgICAgcmVtb3ZlQ291bnQgPSAwO1xuICAgIGZvciAoOyBpIDwgZGlmZnN0ci5sZW5ndGg7IGkrKykge1xuICAgICAgbGV0IG9wZXJhdGlvbiA9IGRpZmZzdHJbaV1bMF07XG5cbiAgICAgIGlmIChvcGVyYXRpb24gPT09ICcrJyB8fCBvcGVyYXRpb24gPT09ICctJyB8fCBvcGVyYXRpb24gPT09ICcgJyB8fCBvcGVyYXRpb24gPT09ICdcXFxcJykge1xuICAgICAgICBodW5rLmxpbmVzLnB1c2goZGlmZnN0cltpXSk7XG5cbiAgICAgICAgaWYgKG9wZXJhdGlvbiA9PT0gJysnKSB7XG4gICAgICAgICAgYWRkQ291bnQrKztcbiAgICAgICAgfSBlbHNlIGlmIChvcGVyYXRpb24gPT09ICctJykge1xuICAgICAgICAgIHJlbW92ZUNvdW50Kys7XG4gICAgICAgIH0gZWxzZSBpZiAob3BlcmF0aW9uID09PSAnICcpIHtcbiAgICAgICAgICBhZGRDb3VudCsrO1xuICAgICAgICAgIHJlbW92ZUNvdW50Kys7XG4gICAgICAgIH1cbiAgICAgIH0gZWxzZSB7XG4gICAgICAgIGJyZWFrO1xuICAgICAgfVxuICAgIH1cblxuICAgIC8vIEhhbmRsZSB0aGUgZW1wdHkgYmxvY2sgY291bnQgY2FzZVxuICAgIGlmICghYWRkQ291bnQgJiYgaHVuay5uZXdMaW5lcyA9PT0gMSkge1xuICAgICAgaHVuay5uZXdMaW5lcyA9IDA7XG4gICAgfVxuICAgIGlmICghcmVtb3ZlQ291bnQgJiYgaHVuay5vbGRMaW5lcyA9PT0gMSkge1xuICAgICAgaHVuay5vbGRMaW5lcyA9IDA7XG4gICAgfVxuXG4gICAgLy8gUGVyZm9ybSBvcHRpb25hbCBzYW5pdHkgY2hlY2tpbmdcbiAgICBpZiAob3B0aW9ucy5zdHJpY3QpIHtcbiAgICAgIGlmIChhZGRDb3VudCAhPT0gaHVuay5uZXdMaW5lcykge1xuICAgICAgICB0aHJvdyBuZXcgRXJyb3IoJ0FkZGVkIGxpbmUgY291bnQgZGlkIG5vdCBtYXRjaCBmb3IgaHVuayBhdCBsaW5lICcgKyAoY2h1bmtIZWFkZXJJbmRleCArIDEpKTtcbiAgICAgIH1cbiAgICAgIGlmIChyZW1vdmVDb3VudCAhPT0gaHVuay5vbGRMaW5lcykge1xuICAgICAgICB0aHJvdyBuZXcgRXJyb3IoJ1JlbW92ZWQgbGluZSBjb3VudCBkaWQgbm90IG1hdGNoIGZvciBodW5rIGF0IGxpbmUgJyArIChjaHVua0hlYWRlckluZGV4ICsgMSkpO1xuICAgICAgfVxuICAgIH1cblxuICAgIHJldHVybiBodW5rO1xuICB9XG5cbiAgd2hpbGUgKGkgPCBkaWZmc3RyLmxlbmd0aCkge1xuICAgIHBhcnNlSW5kZXgoKTtcbiAgfVxuXG4gIHJldHVybiBsaXN0O1xufVxuIl19
- // Formats a given set of lines for printing as context lines in a patch
- function contextLines(lines) {
- return map(lines, function(entry) { return ' ' + entry; });
- }
- // Outputs the no newline at end of file warning if needed
- function eofNL(curRange, i, current) {
- var last = diff[diff.length - 2],
- isLast = i === diff.length - 2,
- isLastOfType = i === diff.length - 3 && current.added !== last.added;
+/***/ },
+/* 16 */
+/***/ function(module, exports) {
- // Figure out if this is the last line for the given file and missing NL
- if (!(/\n$/.test(current.value)) && (isLast || isLastOfType)) {
- curRange.push('\\ No newline at end of file');
- }
- }
+ // Iterator that traverses in the range of [min, max], stepping
+ // by distance from a given start position. I.e. for [0, 4], with
+ "use strict";
- var oldRangeStart = 0, newRangeStart = 0, curRange = [],
- oldLine = 1, newLine = 1;
- for (var i = 0; i < diff.length; i++) {
- var current = diff[i],
- lines = current.lines || current.value.replace(/\n$/, '').split('\n');
- current.lines = lines;
-
- if (current.added || current.removed) {
- // If we have previous context, start with that
- if (!oldRangeStart) {
- var prev = diff[i - 1];
- oldRangeStart = oldLine;
- newRangeStart = newLine;
-
- if (prev) {
- curRange = contextLines(prev.lines.slice(-4));
- oldRangeStart -= curRange.length;
- newRangeStart -= curRange.length;
- }
- }
+ exports.__esModule = true;
- // Output our changes
- curRange.push.apply(curRange, map(lines, function(entry) {
- return (current.added ? '+' : '-') + entry;
- }));
- eofNL(curRange, i, current);
+ exports["default"] = function (start, minLine, maxLine) {
+ var wantForward = true,
+ backwardExhausted = false,
+ forwardExhausted = false,
+ localOffset = 1;
- // Track the updated file position
- if (current.added) {
- newLine += lines.length;
- } else {
- oldLine += lines.length;
- }
- } else {
- // Identical context lines. Track line changes
- if (oldRangeStart) {
- // Close out any changes that have been output (or join overlapping)
- if (lines.length <= 8 && i < diff.length - 2) {
- // Overlapping
- curRange.push.apply(curRange, contextLines(lines));
- } else {
- // end the range and output
- var contextSize = Math.min(lines.length, 4);
- ret.push(
- '@@ -' + oldRangeStart + ',' + (oldLine - oldRangeStart + contextSize)
- + ' +' + newRangeStart + ',' + (newLine - newRangeStart + contextSize)
- + ' @@');
- ret.push.apply(ret, curRange);
- ret.push.apply(ret, contextLines(lines.slice(0, contextSize)));
- if (lines.length <= 4) {
- eofNL(ret, i, current);
- }
-
- oldRangeStart = 0;
- newRangeStart = 0;
- curRange = [];
- }
- }
- oldLine += lines.length;
- newLine += lines.length;
- }
- }
+ return function iterator() {
+ var _again = true;
- return ret.join('\n') + '\n';
- },
+ _function: while (_again) {
+ _again = false;
- createPatch: function(fileName, oldStr, newStr, oldHeader, newHeader) {
- return JsDiff.createTwoFilesPatch(fileName, fileName, oldStr, newStr, oldHeader, newHeader);
- },
+ if (wantForward && !forwardExhausted) {
+ if (backwardExhausted) {
+ localOffset++;
+ } else {
+ wantForward = false;
+ }
- applyPatch: function(oldStr, uniDiff) {
- var diffstr = uniDiff.split('\n'),
- hunks = [],
- i = 0,
- remEOFNL = false,
- addEOFNL = false;
+ // Check if trying to fit beyond text length, and if not, check it fits
+ // after offset location (or desired location on first iteration)
+ if (start + localOffset <= maxLine) {
+ return localOffset;
+ }
- // Skip to the first change hunk
- while (i < diffstr.length && !(/^@@/.test(diffstr[i]))) {
- i++;
+ forwardExhausted = true;
}
- // Parse the unified diff
- for (; i < diffstr.length; i++) {
- if (diffstr[i][0] === '@') {
- var chnukHeader = diffstr[i].split(/@@ -(\d+),(\d+) \+(\d+),(\d+) @@/);
- hunks.unshift({
- start: chnukHeader[3],
- oldlength: +chnukHeader[2],
- removed: [],
- newlength: chnukHeader[4],
- added: []
- });
- } else if (diffstr[i][0] === '+') {
- hunks[0].added.push(diffstr[i].substr(1));
- } else if (diffstr[i][0] === '-') {
- hunks[0].removed.push(diffstr[i].substr(1));
- } else if (diffstr[i][0] === ' ') {
- hunks[0].added.push(diffstr[i].substr(1));
- hunks[0].removed.push(diffstr[i].substr(1));
- } else if (diffstr[i][0] === '\\') {
- if (diffstr[i - 1][0] === '+') {
- remEOFNL = true;
- } else if (diffstr[i - 1][0] === '-') {
- addEOFNL = true;
- }
+ if (!backwardExhausted) {
+ if (!forwardExhausted) {
+ wantForward = true;
}
- }
- // Apply the diff to the input
- var lines = oldStr.split('\n');
- for (i = hunks.length - 1; i >= 0; i--) {
- var hunk = hunks[i];
- // Sanity check the input string. Bail if we don't match.
- for (var j = 0; j < hunk.oldlength; j++) {
- if (lines[hunk.start - 1 + j] !== hunk.removed[j]) {
- return false;
- }
+ // Check if trying to fit before text beginning, and if not, check it fits
+ // before offset location
+ if (minLine <= start - localOffset) {
+ return - localOffset++;
}
- Array.prototype.splice.apply(lines, [hunk.start - 1, hunk.oldlength].concat(hunk.added));
+
+ backwardExhausted = true;
+ _again = true;
+ continue _function;
}
- // Handle EOFNL insertion/removal
- if (remEOFNL) {
- while (!lines[lines.length - 1]) {
- lines.pop();
+ // We tried to fit hunk before text beginning and beyond text lenght, then
+ // hunk can't fit on the text. Return undefined
+ }
+ };
+ };
+
+ module.exports = exports["default"];
+ // start of 2, this will iterate 2, 3, 1, 4, 0.
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy91dGlsL2Rpc3RhbmNlLWl0ZXJhdG9yLmpzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7OztxQkFHZSxVQUFTLEtBQUssRUFBRSxPQUFPLEVBQUUsT0FBTyxFQUFFO0FBQy9DLE1BQUksV0FBVyxHQUFHLElBQUk7TUFDbEIsaUJBQWlCLEdBQUcsS0FBSztNQUN6QixnQkFBZ0IsR0FBRyxLQUFLO01BQ3hCLFdBQVcsR0FBRyxDQUFDLENBQUM7O0FBRXBCLFNBQU8sU0FBUyxRQUFROzs7OEJBQUc7OztBQUN6QixVQUFJLFdBQVcsSUFBSSxDQUFDLGdCQUFnQixFQUFFO0FBQ3BDLFlBQUksaUJBQWlCLEVBQUU7QUFDckIscUJBQVcsRUFBRSxDQUFDO1NBQ2YsTUFBTTtBQUNMLHFCQUFXLEdBQUcsS0FBSyxDQUFDO1NBQ3JCOzs7O0FBSUQsWUFBSSxLQUFLLEdBQUcsV0FBVyxJQUFJLE9BQU8sRUFBRTtBQUNsQyxpQkFBTyxXQUFXLENBQUM7U0FDcEI7O0FBRUQsd0JBQWdCLEdBQUcsSUFBSSxDQUFDO09BQ3pCOztBQUVELFVBQUksQ0FBQyxpQkFBaUIsRUFBRTtBQUN0QixZQUFJLENBQUMsZ0JBQWdCLEVBQUU7QUFDckIscUJBQVcsR0FBRyxJQUFJLENBQUM7U0FDcEI7Ozs7QUFJRCxZQUFJLE9BQU8sSUFBSSxLQUFLLEdBQUc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G9jYXRpb24gKG9yIGRlc2lyZWQgbG9jYXRpb24gb24gZmlyc3QgaXRlcmF0aW9uKVxuICAgICAgaWYgKHN0YXJ0ICsgbG9jYWxPZmZzZXQgPD0gbWF4TGluZSkge1xuICAgICAgICByZXR1cm4gbG9jYWxPZmZzZXQ7XG4gICAgICB9XG5cbiAgICAgIGZvcndhcmRFeGhhdXN0ZWQgPSB0cnVlO1xuICAgIH1cblxuICAgIGlmICghYmFja3dhcmRFeGhhdXN0ZWQpIHtcbiAgICAgIGlmICghZm9yd2FyZEV4aGF1c3RlZCkge1xuICAgICAgICB3YW50Rm9yd2FyZCA9IHRydWU7XG4gICAgICB9XG5cbiAgICAgIC8vIENoZWNrIGlmIHRyeWluZyB0byBmaXQgYmVmb3JlIHRleHQgYmVnaW5uaW5nLCBhbmQgaWYgbm90LCBjaGVjayBpdCBmaXRzXG4gICAgICAvLyBiZWZvcmUgb2Zmc2V0IGxvY2F0aW9uXG4gICAgICBpZiAobWluTGluZSA8PSBzdGFydCAtIGxvY2FsT2Zmc2V0KSB7XG4gICAgICAgIHJldHVybiAtbG9jYWxPZmZzZXQrKztcbiAgICAgIH1cblxuICAgICAgYmFja3dhcmRFeGhhdXN0ZWQgPSB0cnVlO1xuICAgICAgcmV0dXJuIGl0ZXJhdG9yKCk7XG4gICAgfVxuXG4gICAgLy8gV2UgdHJpZWQgdG8gZml0IGh1bmsgYmVmb3JlIHRleHQgYmVnaW5uaW5nIGFuZCBiZXlvbmQgdGV4dCBsZW5naHQsIHRoZW5cbiAgICAvLyBodW5rIGNhbid0IGZpdCBvbiB0aGUgdGV4dC4gUmV0dXJuIHVuZGVmaW5lZFxuICB9O1xufVxuIl19
+
+
+/***/ },
+/* 17 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ exports.__esModule = true;
+ exports.structuredPatch = structuredPatch;
+ exports.createTwoFilesPatch = createTwoFilesPatch;
+ exports.createPatch = createPatch;
+ // istanbul ignore next
+
+ function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; return arr2; } else { return Array.from(arr); } }
+
+ var _diffLine = __webpack_require__(10);
+
+ function structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options) {
+ if (!options) {
+ options = { context: 4 };
+ }
+
+ var diff = _diffLine.diffLines(oldStr, newStr);
+ diff.push({ value: '', lines: [] }); // Append an empty value to make cleanup easier
+
+ function contextLines(lines) {
+ return lines.map(function (entry) {
+ return ' ' + entry;
+ });
+ }
+
+ var hunks = [];
+ var oldRangeStart = 0,
+ newRangeStart = 0,
+ curRange = [],
+ oldLine = 1,
+ newLine = 1;
+
+ var _loop = function (i) {
+ var current = diff[i],
+ lines = current.lines || current.value.replace(/\n$/, '').split('\n');
+ current.lines = lines;
+
+ if (current.added || current.removed) {
+ // istanbul ignore next
+
+ var _curRange;
+
+ // If we have previous context, start with that
+ if (!oldRangeStart) {
+ var prev = diff[i - 1];
+ oldRangeStart = oldLine;
+ newRangeStart = newLine;
+
+ if (prev) {
+ curRange = options.context > 0 ? contextLines(prev.lines.slice(-options.context)) : [];
+ oldRangeStart -= curRange.length;
+ newRangeStart -= curRange.length;
}
- } else if (addEOFNL) {
- lines.push('');
}
- return lines.join('\n');
- },
-
- convertChangesToXML: function(changes) {
- var ret = [];
- for (var i = 0; i < changes.length; i++) {
- var change = changes[i];
- if (change.added) {
- ret.push('');
- } else if (change.removed) {
- ret.push('');
- }
- ret.push(escapeHTML(change.value));
+ // Output our changes
+ (_curRange = curRange).push.apply(_curRange, _toConsumableArray(lines.map(function (entry) {
+ return (current.added ? '+' : '-') + entry;
+ })));
- if (change.added) {
- ret.push('');
- } else if (change.removed) {
- ret.push('');
- }
+ // Track the updated file position
+ if (current.added) {
+ newLine += lines.length;
+ } else {
+ oldLine += lines.length;
}
- return ret.join('');
- },
-
- // See: http://code.google.com/p/google-diff-match-patch/wiki/API
- convertChangesToDMP: function(changes) {
- var ret = [],
- change,
- operation;
- for (var i = 0; i < changes.length; i++) {
- change = changes[i];
- if (change.added) {
- operation = 1;
- } else if (change.removed) {
- operation = -1;
+ } else {
+ // Identical context lines. Track line changes
+ if (oldRangeStart) {
+ // Close out any changes that have been output (or join overlapping)
+ if (lines.length <= options.context * 2 && i < diff.length - 2) {
+ // istanbul ignore next
+
+ var _curRange2;
+
+ // Overlapping
+ (_curRange2 = curRange).push.apply(_curRange2, _toConsumableArray(contextLines(lines)));
} else {
- operation = 0;
- }
+ // istanbul ignore next
+
+ var _curRange3;
+
+ // end the range and output
+ var contextSize = Math.min(lines.length, options.context);
+ (_curRange3 = curRange).push.apply(_curRange3, _toConsumableArray(contextLines(lines.slice(0, contextSize))));
+
+ var hunk = {
+ oldStart: oldRangeStart,
+ oldLines: oldLine - oldRangeStart + contextSize,
+ newStart: newRangeStart,
+ newLines: newLine - newRangeStart + contextSize,
+ lines: curRange
+ };
+ if (i >= diff.length - 2 && lines.length <= options.context) {
+ // EOF is inside this hunk
+ var oldEOFNewline = /\n$/.test(oldStr);
+ var newEOFNewline = /\n$/.test(newStr);
+ if (lines.length == 0 && !oldEOFNewline) {
+ // special case: old has no eol and no trailing context; no-nl can end up before adds
+ curRange.splice(hunk.oldLines, 0, '\\ No newline at end of file');
+ } else if (!oldEOFNewline || !newEOFNewline) {
+ curRange.push('\\ No newline at end of file');
+ }
+ }
+ hunks.push(hunk);
- ret.push([operation, change.value]);
+ oldRangeStart = 0;
+ newRangeStart = 0;
+ curRange = [];
+ }
}
- return ret;
- },
+ oldLine += lines.length;
+ newLine += lines.length;
+ }
+ };
- canonicalize: canonicalize
+ for (var i = 0; i < diff.length; i++) {
+ _loop(i);
+ }
+
+ return {
+ oldFileName: oldFileName, newFileName: newFileName,
+ oldHeader: oldHeader, newHeader: newHeader,
+ hunks: hunks
};
+ }
+
+ function createTwoFilesPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options) {
+ var diff = structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options);
- /*istanbul ignore next */
- /*global module */
- if (typeof module !== 'undefined' && module.exports) {
- module.exports = JsDiff;
- } else if (true) {
- /*global define */
- !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = function() { return JsDiff; }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
- } else if (typeof global.JsDiff === 'undefined') {
- global.JsDiff = JsDiff;
+ var ret = [];
+ if (oldFileName == newFileName) {
+ ret.push('Index: ' + oldFileName);
}
- }(this));
+ ret.push('===================================================================');
+ ret.push('--- ' + diff.oldFileName + (typeof diff.oldHeader === 'undefined' ? '' : '\t' + diff.oldHeader));
+ ret.push('+++ ' + diff.newFileName + (typeof diff.newHeader === 'undefined' ? '' : '\t' + diff.newHeader));
+
+ for (var i = 0; i < diff.hunks.length; i++) {
+ var hunk = diff.hunks[i];
+ ret.push('@@ -' + hunk.oldStart + ',' + hunk.oldLines + ' +' + hunk.newStart + ',' + hunk.newLines + ' @@');
+ ret.push.apply(ret, hunk.lines);
+ }
+
+ return ret.join('\n') + '\n';
+ }
+
+ function createPatch(fileName, oldStr, newStr, oldHeader, newHeader, options) {
+ return createTwoFilesPatch(fileName, fileName, oldStr, newStr, oldHeader, newHeader, options);
+ }
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9wYXRjaC9jcmVhdGUuanMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozt3QkFBd0IsY0FBYzs7QUFFL0IsU0FBUyxlQUFlLENBQUMsV0FBVyxFQUFFLFdBQVcsRUFBRSxNQUFNLEVBQUUsTUFBTSxFQUFFLFNBQVMsRUFBRSxTQUFTLEVBQUUsT0FBTyxFQUFFO0FBQ3ZHLE1BQUksQ0FBQyxPQ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xuICAgICAgfSkpO1xuXG4gICAgICAvLyBUcmFjayB0aGUgdXBkYXRlZCBmaWxlIHBvc2l0aW9uXG4gICAgICBpZiAoY3VycmVudC5hZGRlZCkge1xuICAgICAgICBuZXdMaW5lICs9IGxpbmVzLmxlbmd0aDtcbiAgICAgIH0gZWxzZSB7XG4gICAgICAgIG9sZExpbmUgKz0gbGluZXMubGVuZ3RoO1xuICAgICAgfVxuICAgIH0gZWxzZSB7XG4gICAgICAvLyBJZGVudGljYWwgY29udGV4dCBsaW5lcy4gVHJhY2sgbGluZSBjaGFuZ2VzXG4gICAgICBpZiAob2xkUmFuZ2VTdGFydCkge1xuICAgICAgICAvLyBDbG9zZSBvdXQgYW55IGNoYW5nZXMgdGhhdCBoYXZlIGJlZW4gb3V0cHV0IChvciBqb2luIG92ZXJsYXBwaW5nKVxuICAgICAgICBpZiAobGluZXMubGVuZ3RoIDw9IG9wdGlvbnMuY29udGV4dCAqIDIgJiYgaSA8IGRpZmYubGVuZ3RoIC0gMikge1xuICAgICAgICAgIC8vIE92ZXJsYXBwaW5nXG4gICAgICAgICAgY3VyUmFuZ2UucHVzaCguLi4gY29udGV4dExpbmVzKGxpbmVzKSk7XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgLy8gZW5kIHRoZSByYW5nZSBhbmQgb3V0cHV0XG4gICAgICAgICAgbGV0IGNvbnRleHRTaXplID0gTWF0aC5taW4obGluZXMubGVuZ3RoLCBvcHRpb25zLmNvbnRleHQpO1xuICAgICAgICAgIGN1clJhbmdlLnB1c2goLi4uIGNvbnRleHRMaW5lcyhsaW5lcy5zbGljZSgwLCBjb250ZXh0U2l6ZSkpKTtcblxuICAgICAgICAgIGxldCBodW5rID0ge1xuICAgICAgICAgICAgb2xkU3RhcnQ6IG9sZFJhbmdlU3RhcnQsXG4gICAgICAgICAgICBvbGRMaW5lczogKG9sZExpbmUgLSBvbGRSYW5nZVN0YXJ0ICsgY29udGV4dFNpemUpLFxuICAgICAgICAgICAgbmV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lsZU5hbWUgKyAodHlwZW9mIGRpZmYubmV3SGVhZGVyID09PSAndW5kZWZpbmVkJyA/ICcnIDogJ1xcdCcgKyBkaWZmLm5ld0hlYWRlcikpO1xuXG4gIGZvciAobGV0IGkgPSAwOyBpIDwgZGlmZi5odW5rcy5sZW5ndGg7IGkrKykge1xuICAgIGNvbnN0IGh1bmsgPSBkaWZmLmh1bmtzW2ldO1xuICAgIHJldC5wdXNoKFxuICAgICAgJ0BAIC0nICsgaHVuay5vbGRTdGFydCArICcsJyArIGh1bmsub2xkTGluZXNcbiAgICAgICsgJyArJyArIGh1bmsubmV3U3RhcnQgKyAnLCcgKyBodW5rLm5ld0xpbmVzXG4gICAgICArICcgQEAnXG4gICAgKTtcbiAgICByZXQucHVzaC5hcHBseShyZXQsIGh1bmsubGluZXMpO1xuICB9XG5cbiAgcmV0dXJuIHJldC5qb2luKCdcXG4nKSArICdcXG4nO1xufVxuXG5leHBvcnQgZnVuY3Rpb24gY3JlYXRlUGF0Y2goZmlsZU5hbWUsIG9sZFN0ciwgbmV3U3RyLCBvbGRIZWFkZXIsIG5ld0hlYWRlciwgb3B0aW9ucykge1xuICByZXR1cm4gY3JlYXRlVHdvRmlsZXNQYXRjaChmaWxlTmFtZSwgZmlsZU5hbWUsIG9sZFN0ciwgbmV3U3RyLCBvbGRIZWFkZXIsIG5ld0hlYWRlciwgb3B0aW9ucyk7XG59XG4iXX0=
/***/ },
-/* 6 */
+/* 18 */
+/***/ function(module, exports) {
+
+ // See: http://code.google.com/p/google-diff-match-patch/wiki/API
+ "use strict";
+
+ exports.__esModule = true;
+ exports.convertChangesToDMP = convertChangesToDMP;
+
+ function convertChangesToDMP(changes) {
+ var ret = [],
+ change = undefined,
+ operation = undefined;
+ for (var i = 0; i < changes.length; i++) {
+ change = changes[i];
+ if (change.added) {
+ operation = 1;
+ } else if (change.removed) {
+ operation = -1;
+ } else {
+ operation = 0;
+ }
+
+ ret.push([operation, change.value]);
+ }
+ return ret;
+ }
+ //# sour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KGxldCBpID0gMDsgaSA8IGNoYW5nZXMubGVuZ3RoOyBpKyspIHtcbiAgICBjaGFuZ2UgPSBjaGFuZ2VzW2ldO1xuICAgIGlmIChjaGFuZ2UuYWRkZWQpIHtcbiAgICAgIG9wZXJhdGlvbiA9IDE7XG4gICAgfSBlbHNlIGlmIChjaGFuZ2UucmVtb3ZlZCkge1xuICAgICAgb3BlcmF0aW9uID0gLTE7XG4gICAgfSBlbHNlIHtcbiAgICAgIG9wZXJhdGlvbiA9IDA7XG4gICAgfVxuXG4gICAgcmV0LnB1c2goW29wZXJhdGlvbiwgY2hhbmdlLnZhbHVlXSk7XG4gIH1cbiAgcmV0dXJuIHJldDtcbn1cbiJdfQ==
+
+
+/***/ },
+/* 19 */
+/***/ function(module, exports) {
+
+ 'use strict';
+
+ exports.__esModule = true;
+ exports.convertChangesToXML = convertChangesToXML;
+
+ function convertChangesToXML(changes) {
+ var ret = [];
+ for (var i = 0; i < changes.length; i++) {
+ var change = changes[i];
+ if (change.added) {
+ ret.push('');
+ } else if (change.removed) {
+ ret.push('');
+ }
+
+ ret.push(escapeHTML(change.value));
+
+ if (change.added) {
+ ret.push('');
+ } else if (change.removed) {
+ ret.push('');
+ }
+ }
+ return ret.join('');
+ }
+
+ function escapeHTML(s) {
+ var n = s;
+ n = n.replace(/&/g, '&');
+ n = n.replace(//g, '>');
+ n = n.replace(/"/g, '"');
+
+ return n;
+ }
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9jb252ZXJ0L3htbC5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7OztBQUFPLFNBQVMsbUJBQW1CLENBQUMsT0FBTyxFQUFFO0FBQzNDLE1BQUksR0FBRyxHQUFHLEVBQUUsQ0FBQztBQUNiLE9BQUssSUFBSSxDQUFDLEdBQUcsQ0FBQyxFQUFFLENBQUMsR0FBRyxPQUFPLENBQUMsTUFBTSxFQUFFLENBQ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RQUFRLENBQUMsQ0FBQzs7QUFFOUIsU0FBTyxDQUFDLENBQUM7Q0FDViIsImZpbGUiOiJ4bWwuanMiLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgZnVuY3Rpb24gY29udmVydENoYW5nZXNUb1hNTChjaGFuZ2VzKSB7XG4gIGxldCByZXQgPSBbXTtcbiAgZm9yIChsZXQgaSA9IDA7IGkgPCBjaGFuZ2VzLmxlbmd0aDsgaSsrKSB7XG4gICAgbGV0IGNoYW5nZSA9IGNoYW5nZXNbaV07XG4gICAgaWYgKGNoYW5nZS5hZGRlZCkge1xuICAgICAgcmV0LnB1c2goJzxpbnM+Jyk7XG4gICAgfSBlbHNlIGlmIChjaGFuZ2UucmVtb3ZlZCkge1xuICAgICAgcmV0LnB1c2goJzxkZWw+Jyk7XG4gICAgfVxuXG4gICAgcmV0LnB1c2goZXNjYXBlSFRNTChjaGFuZ2UudmFsdWUpKTtcblxuICAgIGlmIChjaGFuZ2UuYWRkZWQpIHtcbiAgICAgIHJldC5wdXNoKCc8L2lucz4nKTtcbiAgICB9IGVsc2UgaWYgKGNoYW5nZS5yZW1vdmVkKSB7XG4gICAgICByZXQucHVzaCgnPC9kZWw+Jyk7XG4gICAgfVxuICB9XG4gIHJldHVybiByZXQuam9pbignJyk7XG59XG5cbmZ1bmN0aW9uIGVzY2FwZUhUTUwocykge1xuICBsZXQgbiA9IHM7XG4gIG4gPSBuLnJlcGxhY2UoLyYvZywgJyZhbXA7Jyk7XG4gIG4gPSBuLnJlcGxhY2UoLzwvZywgJyZsdDsnKTtcbiAgbiA9IG4ucmVwbGFjZSgvPi9nLCAnJmd0OycpO1xuICBuID0gbi5yZXBsYWNlKC9cIi9nLCAnJnF1b3Q7Jyk7XG5cbiAgcmV0dXJuIG47XG59XG4iXX0=
+
+
+/***/ },
+/* 20 */
/***/ function(module, exports, __webpack_require__) {
/*
@@ -1241,8 +1859,8 @@
(function(ctx, undefined) {
- var lineByLinePrinter = __webpack_require__(7).LineByLinePrinter;
- var sideBySidePrinter = __webpack_require__(8).SideBySidePrinter;
+ var lineByLinePrinter = __webpack_require__(21).LineByLinePrinter;
+ var sideBySidePrinter = __webpack_require__(22).SideBySidePrinter;
function HtmlPrinter() {
}
@@ -1257,7 +1875,7 @@
/***/ },
-/* 7 */
+/* 21 */
/***/ function(module, exports, __webpack_require__) {
/*
@@ -1290,8 +1908,12 @@
return '
\n' +
' \n' +
@@ -1431,7 +2053,7 @@
/***/ },
-/* 8 */
+/* 22 */
/***/ function(module, exports, __webpack_require__) {
/*
@@ -1464,8 +2086,12 @@
return '
\n' +
' \n' +
diff --git a/dist/diff2html.min.js b/dist/diff2html.min.js
index 0b6a104d..43d2bffd 100644
--- a/dist/diff2html.min.js
+++ b/dist/diff2html.min.js
@@ -1,3 +1,2 @@
-!function(modules){function __webpack_require__(moduleId){if(installedModules[moduleId])return installedModules[moduleId].exports;var module=installedModules[moduleId]={exports:{},id:moduleId,loaded:!1};return modules[moduleId].call(module.exports,module,module.exports,__webpack_require__),module.loaded=!0,module.exports}var installedModules={};return __webpack_require__.m=modules,__webpack_require__.c=installedModules,__webpack_require__.p="",__webpack_require__(0)}([function(module,exports,__webpack_require__){(function(global){!function(){function Diff2Html(){}var diffParser=__webpack_require__(1).DiffParser,fileLister=__webpack_require__(3).FileListPrinter,htmlPrinter=__webpack_require__(6).HtmlPrinter;Diff2Html.prototype.getJsonFromDiff=function(diffInput){return diffParser.generateDiffJson(diffInput)},Diff2Html.prototype.getPrettyHtml=function(diffInput,config){var configOrEmpty=config||{},diffJson=diffInput;configOrEmpty.inputFormat&&"diff"!==configOrEmpty.inputFormat||(diffJson=diffParser.generateDiffJson(diffInput));var fileList="";configOrEmpty.showFiles===!0&&(fileList=fileLister.generateFileList(diffJson,configOrEmpty));var diffOutput="";return diffOutput="side-by-side"===configOrEmpty.outputFormat?htmlPrinter.generateSideBySideJsonHtml(diffJson,configOrEmpty):htmlPrinter.generateLineByLineJsonHtml(diffJson,configOrEmpty),fileList+diffOutput},Diff2Html.prototype.getPrettyHtmlFromDiff=function(diffInput,config){var configOrEmpty=config||{};return configOrEmpty.inputFormat="diff",configOrEmpty.outputFormat="line-by-line",this.getPrettyHtml(diffInput,configOrEmpty)},Diff2Html.prototype.getPrettyHtmlFromJson=function(diffJson,config){var configOrEmpty=config||{};return configOrEmpty.inputFormat="json",configOrEmpty.outputFormat="line-by-line",this.getPrettyHtml(diffJson,configOrEmpty)},Diff2Html.prototype.getPrettySideBySideHtmlFromDiff=function(diffInput,config){var configOrEmpty=config||{};return configOrEmpty.inputFormat="diff",configOrEmpty.outputFormat="side-by-side",this.getPrettyHtml(diffInput,configOrEmpty)},Diff2Html.prototype.getPrettySideBySideHtmlFromJson=function(diffJson,config){var configOrEmpty=config||{};return configOrEmpty.inputFormat="json",configOrEmpty.outputFormat="side-by-side",this.getPrettyHtml(diffJson,configOrEmpty)};var diffName="Diff2Html",diffObject=new Diff2Html;module.exports[diffName]=diffObject,global[diffName]=diffObject}(this)}).call(exports,function(){return this}())},function(module,exports,__webpack_require__){!function(){function DiffParser(){}function getExtension(filename,language){var nameSplit=filename.split(".");return nameSplit.length>1?nameSplit[nameSplit.length-1]:language}var utils=__webpack_require__(2).Utils,LINE_TYPE={INSERTS:"d2h-ins",DELETES:"d2h-del",CONTEXT:"d2h-cntx",INFO:"d2h-info"};DiffParser.prototype.LINE_TYPE=LINE_TYPE,DiffParser.prototype.generateDiffJson=function(diffInput){var files=[],currentFile=null,currentBlock=null,oldLine=null,newLine=null,saveBlock=function(){currentBlock&&(currentFile.blocks.push(currentBlock),currentBlock=null)},saveFile=function(){currentFile&¤tFile.newName&&(files.push(currentFile),currentFile=null)},startFile=function(){saveBlock(),saveFile(),currentFile={},currentFile.blocks=[],currentFile.deletedLines=0,currentFile.addedLines=0},startBlock=function(line){saveBlock();var values;(values=/^@@ -(\d+),\d+ \+(\d+),\d+ @@.*/.exec(line))?currentFile.isCombined=!1:(values=/^@@@ -(\d+),\d+ -\d+,\d+ \+(\d+),\d+ @@@.*/.exec(line))?currentFile.isCombined=!0:(values=[0,0],currentFile.isCombined=!1),oldLine=values[1],newLine=values[2],currentBlock={},currentBlock.lines=[],currentBlock.oldStartLine=oldLine,currentBlock.newStartLine=newLine,currentBlock.header=line},createLine=function(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))},diffLines=diffInput.split("\n"),oldMode=/^old mode (\d{6})/,newMode=/^new mode (\d{6})/,deletedFileMode=/^deleted file mode (\d{6})/,newFileMode=/^new file mode (\d{6})/,copyFrom=/^copy from (.+)/,copyTo=/^copy to (.+)/,renameFrom=/^rename from (.+)/,renameTo=/^rename to (.+)/,similarityIndex=/^similarity index (\d+)%/,dissimilarityIndex=/^dissimilarity index (\d+)%/,index=/^index ([0-9a-z]+)..([0-9a-z]+) (\d{6})?/,combinedIndex=/^index ([0-9a-z]+),([0-9a-z]+)..([0-9a-z]+)/,combinedMode=/^mode (\d{6}),(\d{6})..(\d{6})/,combinedNewFile=/^new file mode (\d{6})/,combinedDeletedFile=/^deleted file mode (\d{6}),(\d{6})/;return diffLines.forEach(function(line){if(line&&!utils.startsWith(line,"*")){var values=[];utils.startsWith(line,"diff")?startFile():currentFile&&!currentFile.oldName&&(values=/^--- [aiwco]\/(.+)$/.exec(line))?(currentFile.oldName=values[1],currentFile.language=getExtension(currentFile.oldName,currentFile.language)):currentFile&&!currentFile.newName&&(values=/^\+\+\+ [biwco]?\/(.+)$/.exec(line))?(currentFile.newName=values[1],currentFile.language=getExtension(currentFile.newName,currentFile.language)):currentFile&&utils.startsWith(line,"@@")?startBlock(line):(values=oldMode.exec(line))?currentFile.oldMode=values[1]:(values=newMode.exec(line))?currentFile.newMode=values[1]:(values=deletedFileMode.exec(line))?currentFile.deletedFileMode=values[1]:(values=newFileMode.exec(line))?currentFile.newFileMode=values[1]:(values=copyFrom.exec(line))?(currentFile.oldName=values[1],currentFile.isCopy=!0):(values=copyTo.exec(line))?(currentFile.newName=values[1],currentFile.isCopy=!0):(values=renameFrom.exec(line))?(currentFile.oldName=values[1],currentFile.isRename=!0):(values=renameTo.exec(line))?(currentFile.newName=values[1],currentFile.isRename=!0):(values=similarityIndex.exec(line))?currentFile.unchangedPercentage=values[1]:(values=dissimilarityIndex.exec(line))?currentFile.changedPercentage=values[1]:(values=index.exec(line))?(currentFile.checksumBefore=values[1],currentFile.checksumAfter=values[2],values[2]&&(currentFile.mode=values[3])):(values=combinedIndex.exec(line))?(currentFile.checksumBefore=[values[2],values[3]],currentFile.checksumAfter=values[1]):(values=combinedMode.exec(line))?(currentFile.oldMode=[values[2],values[3]],currentFile.newMode=values[1]):(values=combinedNewFile.exec(line))?currentFile.newFileMode=values[1]:(values=combinedDeletedFile.exec(line))?currentFile.deletedFileMode=values[1]:currentBlock&&createLine(line)}}),saveBlock(),saveFile(),files},module.exports.DiffParser=new DiffParser}(this)},function(module){!function(){function Utils(){}Utils.prototype.escape=function(str){return str.slice(0).replace(/&/g,"&").replace(//g,">").replace(/\t/g," ")},Utils.prototype.getRandomId=function(prefix){return prefix+"-"+Math.random().toString(36).slice(-3)},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 0===str.indexOf(start)},Utils.prototype.valueOrEmpty=function(value){return value?value:""},module.exports.Utils=new Utils}(this)},function(module,exports,__webpack_require__){!function(){function FileListPrinter(){}var printerUtils=__webpack_require__(4).PrinterUtils,utils=__webpack_require__(2).Utils;FileListPrinter.prototype.generateFileList=function(diffFiles){var hideId=utils.getRandomId("d2h-hide"),showId=utils.getRandomId("d2h-show");return'
\n"},module.exports.FileListPrinter=new FileListPrinter}(this)},function(module,exports,__webpack_require__){!function(){function PrinterUtils(){}function isDeletedName(name){return"dev/null"===name}function removeIns(line){return line.replace(/(
((.|\n)*?)<\/ins>)/g,"")}function removeDel(line){return line.replace(/(((.|\n)*?)<\/del>)/g,"")}var jsDiff=__webpack_require__(5),utils=__webpack_require__(2).Utils;PrinterUtils.prototype.getHtmlId=function(file){var hashCode=function(text){var i,chr,len,hash=0;if(0==text.length)return hash;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=file.oldName,newFilename=file.newName;return oldFilename&&newFilename&&oldFilename!==newFilename&&!isDeletedName(newFilename)?oldFilename+" -> "+newFilename:newFilename&&!isDeletedName(newFilename)?newFilename:oldFilename?oldFilename:"Unknown filename"},PrinterUtils.prototype.diffHighlight=function(diffLine1,diffLine2,config){var lineStart1,lineStart2,prefixSize=1;config.isCombined&&(prefixSize=2),lineStart1=diffLine1.substr(0,prefixSize),lineStart2=diffLine2.substr(0,prefixSize),diffLine1=diffLine1.substr(prefixSize),diffLine2=diffLine2.substr(prefixSize);var diff;diff=config.charByChar?jsDiff.diffChars(diffLine1,diffLine2):jsDiff.diffWordsWithSpace(diffLine1,diffLine2);var highlightedLine="";return diff.forEach(function(part){var elemType=part.added?"ins":part.removed?"del":null,escapedValue=utils.escape(part.value);highlightedLine+=null!==elemType?"<"+elemType+">"+escapedValue+""+elemType+">":escapedValue}),{first:{prefix:lineStart1,line:removeIns(highlightedLine)},second:{prefix:lineStart2,line:removeDel(highlightedLine)}}},module.exports.PrinterUtils=new PrinterUtils}(this)},function(module,exports){var __WEBPACK_AMD_DEFINE_ARRAY__,__WEBPACK_AMD_DEFINE_RESULT__;!function(global,undefined){function map(arr,mapper,that){if(Array.prototype.map)return Array.prototype.map.call(arr,mapper,that);for(var other=new Array(arr.length),i=0,n=arr.length;n>i;i++)other[i]=mapper.call(that,arr[i],i,arr);return other}function clonePath(path){return{newPos:path.newPos,components:path.components.slice(0)}}function removeEmpty(array){for(var ret=[],i=0;i/g,">"),n=n.replace(/"/g,""")}function canonicalize(obj,stack,replacementStack){stack=stack||[],replacementStack=replacementStack||[];var i;for(i=0;icomponentPos;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=map(value,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)}}return components}function Diff(ignoreWhitespace){this.ignoreWhitespace=ignoreWhitespace}var objectPrototypeToString=Object.prototype.toString;Diff.prototype={diff:function(oldString,newString,callback){function done(value){return callback?(setTimeout(function(){callback(undefined,value)},0),!0):value}function execEditLength(){for(var diagonalPath=-1*editLength;editLength>=diagonalPath;diagonalPath+=2){var basePath,addPath=bestPath[diagonalPath-1],removePath=bestPath[diagonalPath+1],oldPos=(removePath?removePath.newPos:0)-diagonalPath;addPath&&(bestPath[diagonalPath-1]=undefined);var canAdd=addPath&&addPath.newPos+1=0&&oldLen>oldPos;if(canAdd||canRemove){if(!canAdd||canRemove&&addPath.newPos=newLen&&oldPos+1>=oldLen)return done(buildValues(basePath.components,newString,oldString,self.useLongestToken));bestPath[diagonalPath]=basePath}else bestPath[diagonalPath]=undefined}editLength++}var self=this;if(newString===oldString)return done([{value:newString}]);if(!newString)return done([{value:oldString,removed:!0}]);if(!oldString)return done([{value:newString,added:!0}]);newString=this.tokenize(newString),oldString=this.tokenize(oldString);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("")}]);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){var reWhitespace=/\S/;return left===right||this.ignoreWhitespace&&!reWhitespace.test(left)&&!reWhitespace.test(right)},tokenize:function(value){return value.split("")}};var CharDiff=new Diff,WordDiff=new Diff(!0),WordWithSpaceDiff=new Diff;WordDiff.tokenize=WordWithSpaceDiff.tokenize=function(value){return removeEmpty(value.split(/(\s+|\b)/))};var CssDiff=new Diff(!0);CssDiff.tokenize=function(value){return removeEmpty(value.split(/([{}:;,]|\s+)/))};var LineDiff=new Diff,TrimmedLineDiff=new Diff;TrimmedLineDiff.ignoreTrim=!0,LineDiff.tokenize=TrimmedLineDiff.tokenize=function(value){for(var retLines=[],lines=value.split(/^/m),i=0;i=0;i--){for(var hunk=hunks[i],j=0;j"):change.removed&&ret.push(""),ret.push(escapeHTML(change.value)),change.added?ret.push(""):change.removed&&ret.push("")}return ret.join("")},convertChangesToDMP:function(changes){for(var change,operation,ret=[],i=0;i
\n '+utils.escape(block.header)+" | \n\n",oldLines=[],newLines=[],processedOldLines=[],processedNewLines=[],i=0;inewLines.length)newLines.push(line);else{var oldLine,newLine,j=0;if(oldLines.length===newLines.length){for(j=0;j'+prefix+"");var htmlContent="";return content&&(htmlContent=''+content+""),'\n '+utils.valueOrEmpty(oldNumber)+' '+utils.valueOrEmpty(newNumber)+' | \n '+htmlPrefix+htmlContent+" | \n
\n"}function generateEmptyDiff(){return'\n File without changes | \n
\n'}var diffParser=__webpack_require__(1).DiffParser,printerUtils=__webpack_require__(4).PrinterUtils,utils=__webpack_require__(2).Utils;LineByLinePrinter.prototype.generateLineByLineJsonHtml=function(diffFiles,config){return'\n'+diffFiles.map(function(file){var diffs;return diffs=file.blocks.length?generateFileHtml(file,config):generateEmptyDiff(),'
\n"}).join("\n")+"
\n"},module.exports.LineByLinePrinter=new LineByLinePrinter}(this)},function(module,exports,__webpack_require__){!function(){function SideBySidePrinter(){}function generateSideBySideFileHtml(file,config){var fileHtml={};return fileHtml.left="",fileHtml.right="",file.blocks.forEach(function(block){fileHtml.left+='\n | \n '+utils.escape(block.header)+" | \n
\n",fileHtml.right+='\n | \n | \n
\n';for(var oldLines=[],newLines=[],tmpHtml="",i=0;inewLines.length)newLines.push(line);else{var oldLine,newLine,j=0;if(oldLines.length===newLines.length)for(j=0;j'+prefix+"");var htmlContent="";return content&&(htmlContent=''+content+""),'\n '+number+' | \n '+htmlPrefix+htmlContent+" | \n
\n"}function generateEmptyDiff(){var fileHtml={};return fileHtml.right="",fileHtml.left='\n File without changes | \n
\n',fileHtml}var diffParser=__webpack_require__(1).DiffParser,printerUtils=__webpack_require__(4).PrinterUtils,utils=__webpack_require__(2).Utils;SideBySidePrinter.prototype.generateSideBySideJsonHtml=function(diffFiles,config){return'\n'+diffFiles.map(function(file){var diffs;return diffs=file.blocks.length?generateSideBySideFileHtml(file,config):generateEmptyDiff(),'
\n";
-
-}).join("\n")+"
\n"},module.exports.SideBySidePrinter=new SideBySidePrinter}(this)}]);
\ No newline at end of file
+!function(modules){function __webpack_require__(moduleId){if(installedModules[moduleId])return installedModules[moduleId].exports;var module=installedModules[moduleId]={exports:{},id:moduleId,loaded:!1};return modules[moduleId].call(module.exports,module,module.exports,__webpack_require__),module.loaded=!0,module.exports}var installedModules={};return __webpack_require__.m=modules,__webpack_require__.c=installedModules,__webpack_require__.p="",__webpack_require__(0)}([function(module,exports,__webpack_require__){(function(global){!function(){function Diff2Html(){}var diffParser=__webpack_require__(1).DiffParser,fileLister=__webpack_require__(3).FileListPrinter,htmlPrinter=__webpack_require__(20).HtmlPrinter;Diff2Html.prototype.getJsonFromDiff=function(diffInput){return diffParser.generateDiffJson(diffInput)},Diff2Html.prototype.getPrettyHtml=function(diffInput,config){var configOrEmpty=config||{},diffJson=diffInput;configOrEmpty.inputFormat&&"diff"!==configOrEmpty.inputFormat||(diffJson=diffParser.generateDiffJson(diffInput));var fileList="";configOrEmpty.showFiles===!0&&(fileList=fileLister.generateFileList(diffJson,configOrEmpty));var diffOutput="";return diffOutput="side-by-side"===configOrEmpty.outputFormat?htmlPrinter.generateSideBySideJsonHtml(diffJson,configOrEmpty):htmlPrinter.generateLineByLineJsonHtml(diffJson,configOrEmpty),fileList+diffOutput},Diff2Html.prototype.getPrettyHtmlFromDiff=function(diffInput,config){var configOrEmpty=config||{};return configOrEmpty.inputFormat="diff",configOrEmpty.outputFormat="line-by-line",this.getPrettyHtml(diffInput,configOrEmpty)},Diff2Html.prototype.getPrettyHtmlFromJson=function(diffJson,config){var configOrEmpty=config||{};return configOrEmpty.inputFormat="json",configOrEmpty.outputFormat="line-by-line",this.getPrettyHtml(diffJson,configOrEmpty)},Diff2Html.prototype.getPrettySideBySideHtmlFromDiff=function(diffInput,config){var configOrEmpty=config||{};return configOrEmpty.inputFormat="diff",configOrEmpty.outputFormat="side-by-side",this.getPrettyHtml(diffInput,configOrEmpty)},Diff2Html.prototype.getPrettySideBySideHtmlFromJson=function(diffJson,config){var configOrEmpty=config||{};return configOrEmpty.inputFormat="json",configOrEmpty.outputFormat="side-by-side",this.getPrettyHtml(diffJson,configOrEmpty)};var diffName="Diff2Html",diffObject=new Diff2Html;module.exports[diffName]=diffObject,global[diffName]=diffObject}(this)}).call(exports,function(){return this}())},function(module,exports,__webpack_require__){!function(){function DiffParser(){}function getExtension(filename,language){var nameSplit=filename.split(".");return nameSplit.length>1?nameSplit[nameSplit.length-1]:language}var utils=__webpack_require__(2).Utils,LINE_TYPE={INSERTS:"d2h-ins",DELETES:"d2h-del",CONTEXT:"d2h-cntx",INFO:"d2h-info"};DiffParser.prototype.LINE_TYPE=LINE_TYPE,DiffParser.prototype.generateDiffJson=function(diffInput){var files=[],currentFile=null,currentBlock=null,oldLine=null,newLine=null,saveBlock=function(){currentBlock&&(currentFile.blocks.push(currentBlock),currentBlock=null)},saveFile=function(){currentFile&¤tFile.newName&&(files.push(currentFile),currentFile=null)},startFile=function(){saveBlock(),saveFile(),currentFile={},currentFile.blocks=[],currentFile.deletedLines=0,currentFile.addedLines=0},startBlock=function(line){saveBlock();var values;(values=/^@@ -(\d+),\d+ \+(\d+),\d+ @@.*/.exec(line))?currentFile.isCombined=!1:(values=/^@@@ -(\d+),\d+ -\d+,\d+ \+(\d+),\d+ @@@.*/.exec(line))?currentFile.isCombined=!0:(values=[0,0],currentFile.isCombined=!1),oldLine=values[1],newLine=values[2],currentBlock={},currentBlock.lines=[],currentBlock.oldStartLine=oldLine,currentBlock.newStartLine=newLine,currentBlock.header=line},createLine=function(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))},diffLines=diffInput.split("\n"),oldMode=/^old mode (\d{6})/,newMode=/^new mode (\d{6})/,deletedFileMode=/^deleted file mode (\d{6})/,newFileMode=/^new file mode (\d{6})/,copyFrom=/^copy from (.+)/,copyTo=/^copy to (.+)/,renameFrom=/^rename from (.+)/,renameTo=/^rename to (.+)/,similarityIndex=/^similarity index (\d+)%/,dissimilarityIndex=/^dissimilarity index (\d+)%/,index=/^index ([0-9a-z]+)..([0-9a-z]+) (\d{6})?/,combinedIndex=/^index ([0-9a-z]+),([0-9a-z]+)..([0-9a-z]+)/,combinedMode=/^mode (\d{6}),(\d{6})..(\d{6})/,combinedNewFile=/^new file mode (\d{6})/,combinedDeletedFile=/^deleted file mode (\d{6}),(\d{6})/;return diffLines.forEach(function(line){if(line&&!utils.startsWith(line,"*")){var values=[];utils.startsWith(line,"diff")?startFile():currentFile&&!currentFile.oldName&&(values=/^--- [aiwco]\/(.+)$/.exec(line))?(currentFile.oldName=values[1],currentFile.language=getExtension(currentFile.oldName,currentFile.language)):currentFile&&!currentFile.newName&&(values=/^\+\+\+ [biwco]?\/(.+)$/.exec(line))?(currentFile.newName=values[1],currentFile.language=getExtension(currentFile.newName,currentFile.language)):currentFile&&utils.startsWith(line,"@@")?startBlock(line):(values=oldMode.exec(line))?currentFile.oldMode=values[1]:(values=newMode.exec(line))?currentFile.newMode=values[1]:(values=deletedFileMode.exec(line))?currentFile.deletedFileMode=values[1]:(values=newFileMode.exec(line))?currentFile.newFileMode=values[1]:(values=copyFrom.exec(line))?(currentFile.oldName=values[1],currentFile.isCopy=!0):(values=copyTo.exec(line))?(currentFile.newName=values[1],currentFile.isCopy=!0):(values=renameFrom.exec(line))?(currentFile.oldName=values[1],currentFile.isRename=!0):(values=renameTo.exec(line))?(currentFile.newName=values[1],currentFile.isRename=!0):(values=similarityIndex.exec(line))?currentFile.unchangedPercentage=values[1]:(values=dissimilarityIndex.exec(line))?currentFile.changedPercentage=values[1]:(values=index.exec(line))?(currentFile.checksumBefore=values[1],currentFile.checksumAfter=values[2],values[2]&&(currentFile.mode=values[3])):(values=combinedIndex.exec(line))?(currentFile.checksumBefore=[values[2],values[3]],currentFile.checksumAfter=values[1]):(values=combinedMode.exec(line))?(currentFile.oldMode=[values[2],values[3]],currentFile.newMode=values[1]):(values=combinedNewFile.exec(line))?currentFile.newFileMode=values[1]:(values=combinedDeletedFile.exec(line))?currentFile.deletedFileMode=values[1]:currentBlock&&createLine(line)}}),saveBlock(),saveFile(),files},module.exports.DiffParser=new DiffParser}(this)},function(module){!function(){function Utils(){}Utils.prototype.escape=function(str){return str.slice(0).replace(/&/g,"&").replace(//g,">").replace(/\t/g," ")},Utils.prototype.getRandomId=function(prefix){return prefix+"-"+Math.random().toString(36).slice(-3)},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 0===str.indexOf(start)},Utils.prototype.valueOrEmpty=function(value){return value?value:""},module.exports.Utils=new Utils}(this)},function(module,exports,__webpack_require__){!function(){function FileListPrinter(){}var printerUtils=__webpack_require__(4).PrinterUtils,utils=__webpack_require__(2).Utils;FileListPrinter.prototype.generateFileList=function(diffFiles){var hideId=utils.getRandomId("d2h-hide"),showId=utils.getRandomId("d2h-show");return'\n"},module.exports.FileListPrinter=new FileListPrinter}(this)},function(module,exports,__webpack_require__){!function(){function PrinterUtils(){}function isDeletedName(name){return"dev/null"===name}function removeIns(line){return line.replace(/(((.|\n)*?)<\/ins>)/g,"")}function removeDel(line){return line.replace(/(((.|\n)*?)<\/del>)/g,"")}var jsDiff=__webpack_require__(5),utils=__webpack_require__(2).Utils;PrinterUtils.prototype.getHtmlId=function(file){var hashCode=function(text){var i,chr,len,hash=0;if(0==text.length)return hash;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=file.oldName,newFilename=file.newName;return oldFilename&&newFilename&&oldFilename!==newFilename&&!isDeletedName(newFilename)?oldFilename+" -> "+newFilename:newFilename&&!isDeletedName(newFilename)?newFilename:oldFilename?oldFilename:"Unknown filename"},PrinterUtils.prototype.diffHighlight=function(diffLine1,diffLine2,config){var lineStart1,lineStart2,prefixSize=1;config.isCombined&&(prefixSize=2),lineStart1=diffLine1.substr(0,prefixSize),lineStart2=diffLine2.substr(0,prefixSize),diffLine1=diffLine1.substr(prefixSize),diffLine2=diffLine2.substr(prefixSize);var diff;diff=config.charByChar?jsDiff.diffChars(diffLine1,diffLine2):jsDiff.diffWordsWithSpace(diffLine1,diffLine2);var highlightedLine="";return diff.forEach(function(part){var elemType=part.added?"ins":part.removed?"del":null,escapedValue=utils.escape(part.value);highlightedLine+=null!==elemType?"<"+elemType+">"+escapedValue+""+elemType+">":escapedValue}),{first:{prefix:lineStart1,line:removeIns(highlightedLine)},second:{prefix:lineStart2,line:removeDel(highlightedLine)}}},module.exports.PrinterUtils=new PrinterUtils}(this)},function(module,exports,__webpack_require__){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{"default":obj}}exports.__esModule=!0;var _diffBase=__webpack_require__(6),_diffBase2=_interopRequireDefault(_diffBase),_diffCharacter=__webpack_require__(7),_diffWord=__webpack_require__(8),_diffLine=__webpack_require__(10),_diffSentence=__webpack_require__(11),_diffCss=__webpack_require__(12),_diffJson=__webpack_require__(13),_patchApply=__webpack_require__(14),_patchParse=__webpack_require__(15),_patchCreate=__webpack_require__(17),_convertDmp=__webpack_require__(18),_convertXml=__webpack_require__(19);exports.Diff=_diffBase2["default"],exports.diffChars=_diffCharacter.diffChars,exports.diffWords=_diffWord.diffWords,exports.diffWordsWithSpace=_diffWord.diffWordsWithSpace,exports.diffLines=_diffLine.diffLines,exports.diffTrimmedLines=_diffLine.diffTrimmedLines,exports.diffSentences=_diffSentence.diffSentences,exports.diffCss=_diffCss.diffCss,exports.diffJson=_diffJson.diffJson,exports.structuredPatch=_patchCreate.structuredPatch,exports.createTwoFilesPatch=_patchCreate.createTwoFilesPatch,exports.createPatch=_patchCreate.createPatch,exports.applyPatch=_patchApply.applyPatch,exports.applyPatches=_patchApply.applyPatches,exports.parsePatch=_patchParse.parsePatch,exports.convertChangesToDMP=_convertDmp.convertChangesToDMP,exports.convertChangesToXML=_convertXml.convertChangesToXML,exports.canonicalize=_diffJson.canonicalize},function(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(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;i=start+localOffset)return localOffset;forwardExhausted=!0}if(backwardExhausted);else{if(forwardExhausted||(wantForward=!0),start-localOffset>=minLine)return-localOffset++;backwardExhausted=!0,_again=!0}}}},module.exports=exports["default"]},function(module,exports,__webpack_require__){"use strict";function _toConsumableArray(arr){if(Array.isArray(arr)){for(var i=0,arr2=Array(arr.length);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"):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},function(module,exports,__webpack_require__){!function(){function HtmlPrinter(){}var lineByLinePrinter=__webpack_require__(21).LineByLinePrinter,sideBySidePrinter=__webpack_require__(22).SideBySidePrinter;HtmlPrinter.prototype.generateLineByLineJsonHtml=lineByLinePrinter.generateLineByLineJsonHtml,HtmlPrinter.prototype.generateSideBySideJsonHtml=sideBySidePrinter.generateSideBySideJsonHtml,module.exports.HtmlPrinter=new HtmlPrinter}(this)},function(module,exports,__webpack_require__){!function(){function LineByLinePrinter(){}function generateFileHtml(file,config){return file.blocks.map(function(block){
+for(var lines='\n | \n '+utils.escape(block.header)+" | \n
\n",oldLines=[],newLines=[],processedOldLines=[],processedNewLines=[],i=0;inewLines.length)newLines.push(line);else{var oldLine,newLine,j=0;if(oldLines.length===newLines.length){for(j=0;j'+prefix+"");var htmlContent="";return content&&(htmlContent=''+content+""),'\n '+utils.valueOrEmpty(oldNumber)+' '+utils.valueOrEmpty(newNumber)+' | \n '+htmlPrefix+htmlContent+" | \n
\n"}function generateEmptyDiff(){return'\n File without changes | \n
\n'}var diffParser=__webpack_require__(1).DiffParser,printerUtils=__webpack_require__(4).PrinterUtils,utils=__webpack_require__(2).Utils;LineByLinePrinter.prototype.generateLineByLineJsonHtml=function(diffFiles,config){return'\n'+diffFiles.map(function(file){var diffs;return diffs=file.blocks.length?generateFileHtml(file,config):generateEmptyDiff(),'
\n"}).join("\n")+"
\n"},module.exports.LineByLinePrinter=new LineByLinePrinter}(this)},function(module,exports,__webpack_require__){!function(){function SideBySidePrinter(){}function generateSideBySideFileHtml(file,config){var fileHtml={};return fileHtml.left="",fileHtml.right="",file.blocks.forEach(function(block){fileHtml.left+='\n | \n '+utils.escape(block.header)+" | \n
\n",fileHtml.right+='\n | \n | \n
\n';for(var oldLines=[],newLines=[],tmpHtml="",i=0;inewLines.length)newLines.push(line);else{var oldLine,newLine,j=0;if(oldLines.length===newLines.length)for(j=0;j'+prefix+"");var htmlContent="";return content&&(htmlContent=''+content+""),'\n '+number+' | \n '+htmlPrefix+htmlContent+" | \n
\n"}function generateEmptyDiff(){var fileHtml={};return fileHtml.right="",fileHtml.left='\n File without changes | \n
\n',fileHtml}var diffParser=__webpack_require__(1).DiffParser,printerUtils=__webpack_require__(4).PrinterUtils,utils=__webpack_require__(2).Utils;SideBySidePrinter.prototype.generateSideBySideJsonHtml=function(diffFiles,config){return'\n'+diffFiles.map(function(file){var diffs;return diffs=file.blocks.length?generateSideBySideFileHtml(file,config):generateEmptyDiff(),'
\n"}).join("\n")+"
\n"},module.exports.SideBySidePrinter=new SideBySidePrinter}(this)}]);
\ No newline at end of file
diff --git a/package.json b/package.json
index 68a8cd6f..a759690f 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "diff2html",
- "version": "1.1.2",
+ "version": "1.1.3",
"homepage": "http://rtfpessoa.github.io/diff2html/",
"description": "Fast Diff to colorized HTML",
"keywords": [
@@ -36,13 +36,17 @@
},
"preferGlobal": "true",
"scripts": {
- "test": ""
+ "release": "bash release.sh"
},
"main": "./src/diff2html.js",
"dependencies": {
- "diff": "1.4.0"
+ "diff": "2.2.*"
+ },
+ "devDependencies": {
+ "webpack": "1.12.*",
+ "uglifyjs": "2.4.*",
+ "less": "2.5.*"
},
- "devDependencies": {},
"license": "MIT",
"files": [
"src"
diff --git a/release.sh b/release.sh
index fc7bdddc..fe066c69 100755
--- a/release.sh
+++ b/release.sh
@@ -17,10 +17,6 @@ echo "Cleaning previous versions ..."
rm -rf ${OUTPUT_DIR}
mkdir -p ${OUTPUT_DIR}
-echo "Preparing dependencies ..."
-rm -rf node_modules
-npm install
-
echo "Generating js aggregation file in ${OUTPUT_JS_FILE}"
webpack ./src/diff2html.js ${OUTPUT_JS_FILE}
diff --git a/sample/index.html b/sample/index.html
index 4f3c91b4..7f58f8b8 100644
--- a/sample/index.html
+++ b/sample/index.html
@@ -9,15 +9,15 @@
Author: rtfpessoa
-->
-
+
-
-
+
+