2017-05-28 00:38:50 +02:00
|
|
|
|
/*!
|
|
|
|
|
|
2017-08-14 05:01:11 +02:00
|
|
|
|
diff v3.3.0
|
2017-05-28 00:38:50 +02:00
|
|
|
|
|
|
|
|
|
Software License Agreement (BSD License)
|
|
|
|
|
|
|
|
|
|
Copyright (c) 2009-2015, Kevin Decker <kpdecker@gmail.com>
|
|
|
|
|
|
|
|
|
|
All rights reserved.
|
|
|
|
|
|
|
|
|
|
Redistribution and use of this software in source and binary forms, with or without modification,
|
|
|
|
|
are permitted provided that the following conditions are met:
|
|
|
|
|
|
|
|
|
|
* Redistributions of source code must retain the above
|
|
|
|
|
copyright notice, this list of conditions and the
|
|
|
|
|
following disclaimer.
|
|
|
|
|
|
|
|
|
|
* Redistributions in binary form must reproduce the above
|
|
|
|
|
copyright notice, this list of conditions and the
|
|
|
|
|
following disclaimer in the documentation and/or other
|
|
|
|
|
materials provided with the distribution.
|
|
|
|
|
|
|
|
|
|
* Neither the name of Kevin Decker nor the names of its
|
|
|
|
|
contributors may be used to endorse or promote products
|
|
|
|
|
derived from this software without specific prior
|
|
|
|
|
written permission.
|
|
|
|
|
|
|
|
|
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
|
|
|
|
|
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
|
|
|
|
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
|
|
|
|
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
|
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
|
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
|
|
|
|
IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
|
|
|
|
OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
|
@license
|
|
|
|
|
*/
|
|
|
|
|
(function webpackUniversalModuleDefinition(root, factory) {
|
|
|
|
|
if(typeof exports === 'object' && typeof module === 'object')
|
|
|
|
|
module.exports = factory();
|
|
|
|
|
else if(typeof define === 'function' && define.amd)
|
|
|
|
|
define([], factory);
|
|
|
|
|
else if(typeof exports === 'object')
|
|
|
|
|
exports["JsDiff"] = factory();
|
|
|
|
|
else
|
|
|
|
|
root["JsDiff"] = factory();
|
|
|
|
|
})(this, function() {
|
|
|
|
|
return /******/ (function(modules) { // webpackBootstrap
|
|
|
|
|
/******/ // The module cache
|
|
|
|
|
/******/ var installedModules = {};
|
|
|
|
|
|
|
|
|
|
/******/ // The require function
|
|
|
|
|
/******/ function __webpack_require__(moduleId) {
|
|
|
|
|
|
|
|
|
|
/******/ // Check if module is in cache
|
|
|
|
|
/******/ if(installedModules[moduleId])
|
|
|
|
|
/******/ return installedModules[moduleId].exports;
|
|
|
|
|
|
|
|
|
|
/******/ // Create a new module (and put it into the cache)
|
|
|
|
|
/******/ var module = installedModules[moduleId] = {
|
|
|
|
|
/******/ exports: {},
|
|
|
|
|
/******/ id: moduleId,
|
|
|
|
|
/******/ loaded: false
|
|
|
|
|
/******/ };
|
|
|
|
|
|
|
|
|
|
/******/ // Execute the module function
|
|
|
|
|
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
|
|
|
|
|
|
|
|
|
/******/ // Flag the module as loaded
|
|
|
|
|
/******/ module.loaded = true;
|
|
|
|
|
|
|
|
|
|
/******/ // Return the exports of the module
|
|
|
|
|
/******/ return module.exports;
|
|
|
|
|
/******/ }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/******/ // expose the modules object (__webpack_modules__)
|
|
|
|
|
/******/ __webpack_require__.m = modules;
|
|
|
|
|
|
|
|
|
|
/******/ // expose the module cache
|
|
|
|
|
/******/ __webpack_require__.c = installedModules;
|
|
|
|
|
|
|
|
|
|
/******/ // __webpack_public_path__
|
|
|
|
|
/******/ __webpack_require__.p = "";
|
|
|
|
|
|
|
|
|
|
/******/ // Load entry module and return exports
|
|
|
|
|
/******/ return __webpack_require__(0);
|
|
|
|
|
/******/ })
|
|
|
|
|
/************************************************************************/
|
|
|
|
|
/******/ ([
|
|
|
|
|
/* 0 */
|
|
|
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
/*istanbul ignore start*/'use strict';
|
|
|
|
|
|
|
|
|
|
exports.__esModule = true;
|
2017-08-14 05:01:11 +02:00
|
|
|
|
exports.canonicalize = exports.convertChangesToXML = exports.convertChangesToDMP = exports.merge = exports.parsePatch = exports.applyPatches = exports.applyPatch = exports.createPatch = exports.createTwoFilesPatch = exports.structuredPatch = exports.diffArrays = exports.diffJson = exports.diffCss = exports.diffSentences = exports.diffTrimmedLines = exports.diffLines = exports.diffWordsWithSpace = exports.diffWords = exports.diffChars = exports.Diff = undefined;
|
2017-05-28 00:38:50 +02:00
|
|
|
|
/*istanbul ignore end*/
|
|
|
|
|
var /*istanbul ignore start*/_base = __webpack_require__(1) /*istanbul ignore end*/;
|
|
|
|
|
|
|
|
|
|
/*istanbul ignore start*/
|
|
|
|
|
var _base2 = _interopRequireDefault(_base);
|
|
|
|
|
|
|
|
|
|
/*istanbul ignore end*/
|
|
|
|
|
var /*istanbul ignore start*/_character = __webpack_require__(2) /*istanbul ignore end*/;
|
|
|
|
|
|
|
|
|
|
var /*istanbul ignore start*/_word = __webpack_require__(3) /*istanbul ignore end*/;
|
|
|
|
|
|
|
|
|
|
var /*istanbul ignore start*/_line = __webpack_require__(5) /*istanbul ignore end*/;
|
|
|
|
|
|
|
|
|
|
var /*istanbul ignore start*/_sentence = __webpack_require__(6) /*istanbul ignore end*/;
|
|
|
|
|
|
|
|
|
|
var /*istanbul ignore start*/_css = __webpack_require__(7) /*istanbul ignore end*/;
|
|
|
|
|
|
|
|
|
|
var /*istanbul ignore start*/_json = __webpack_require__(8) /*istanbul ignore end*/;
|
|
|
|
|
|
|
|
|
|
var /*istanbul ignore start*/_array = __webpack_require__(9) /*istanbul ignore end*/;
|
|
|
|
|
|
|
|
|
|
var /*istanbul ignore start*/_apply = __webpack_require__(10) /*istanbul ignore end*/;
|
|
|
|
|
|
|
|
|
|
var /*istanbul ignore start*/_parse = __webpack_require__(11) /*istanbul ignore end*/;
|
|
|
|
|
|
2017-08-14 05:01:11 +02:00
|
|
|
|
var /*istanbul ignore start*/_merge = __webpack_require__(13) /*istanbul ignore end*/;
|
2017-05-28 00:38:50 +02:00
|
|
|
|
|
2017-08-14 05:01:11 +02:00
|
|
|
|
var /*istanbul ignore start*/_create = __webpack_require__(14) /*istanbul ignore end*/;
|
2017-05-28 00:38:50 +02:00
|
|
|
|
|
2017-08-14 05:01:11 +02:00
|
|
|
|
var /*istanbul ignore start*/_dmp = __webpack_require__(16) /*istanbul ignore end*/;
|
|
|
|
|
|
|
|
|
|
var /*istanbul ignore start*/_xml = __webpack_require__(17) /*istanbul ignore end*/;
|
2017-05-28 00:38:50 +02:00
|
|
|
|
|
|
|
|
|
/*istanbul ignore start*/
|
|
|
|
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
|
|
|
|
|
2017-08-14 05:01:11 +02:00
|
|
|
|
/* See LICENSE file for terms of use */
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Text diff implementation.
|
|
|
|
|
*
|
|
|
|
|
* This library supports the following APIS:
|
|
|
|
|
* JsDiff.diffChars: Character by character diff
|
|
|
|
|
* JsDiff.diffWords: Word (as defined by \b regex) diff which ignores whitespace
|
|
|
|
|
* JsDiff.diffLines: Line based diff
|
|
|
|
|
*
|
|
|
|
|
* JsDiff.diffCss: Diff targeted at CSS content
|
|
|
|
|
*
|
|
|
|
|
* These methods are based on the implementation proposed in
|
|
|
|
|
* "An O(ND) Difference Algorithm and its Variations" (Myers, 1986).
|
|
|
|
|
* http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.4.6927
|
|
|
|
|
*/
|
2017-05-28 00:38:50 +02:00
|
|
|
|
exports. /*istanbul ignore end*/Diff = _base2['default'];
|
|
|
|
|
/*istanbul ignore start*/exports. /*istanbul ignore end*/diffChars = _character.diffChars;
|
|
|
|
|
/*istanbul ignore start*/exports. /*istanbul ignore end*/diffWords = _word.diffWords;
|
|
|
|
|
/*istanbul ignore start*/exports. /*istanbul ignore end*/diffWordsWithSpace = _word.diffWordsWithSpace;
|
|
|
|
|
/*istanbul ignore start*/exports. /*istanbul ignore end*/diffLines = _line.diffLines;
|
|
|
|
|
/*istanbul ignore start*/exports. /*istanbul ignore end*/diffTrimmedLines = _line.diffTrimmedLines;
|
|
|
|
|
/*istanbul ignore start*/exports. /*istanbul ignore end*/diffSentences = _sentence.diffSentences;
|
|
|
|
|
/*istanbul ignore start*/exports. /*istanbul ignore end*/diffCss = _css.diffCss;
|
|
|
|
|
/*istanbul ignore start*/exports. /*istanbul ignore end*/diffJson = _json.diffJson;
|
|
|
|
|
/*istanbul ignore start*/exports. /*istanbul ignore end*/diffArrays = _array.diffArrays;
|
|
|
|
|
/*istanbul ignore start*/exports. /*istanbul ignore end*/structuredPatch = _create.structuredPatch;
|
|
|
|
|
/*istanbul ignore start*/exports. /*istanbul ignore end*/createTwoFilesPatch = _create.createTwoFilesPatch;
|
|
|
|
|
/*istanbul ignore start*/exports. /*istanbul ignore end*/createPatch = _create.createPatch;
|
|
|
|
|
/*istanbul ignore start*/exports. /*istanbul ignore end*/applyPatch = _apply.applyPatch;
|
|
|
|
|
/*istanbul ignore start*/exports. /*istanbul ignore end*/applyPatches = _apply.applyPatches;
|
|
|
|
|
/*istanbul ignore start*/exports. /*istanbul ignore end*/parsePatch = _parse.parsePatch;
|
2017-08-14 05:01:11 +02:00
|
|
|
|
/*istanbul ignore start*/exports. /*istanbul ignore end*/merge = _merge.merge;
|
2017-05-28 00:38:50 +02:00
|
|
|
|
/*istanbul ignore start*/exports. /*istanbul ignore end*/convertChangesToDMP = _dmp.convertChangesToDMP;
|
|
|
|
|
/*istanbul ignore start*/exports. /*istanbul ignore end*/convertChangesToXML = _xml.convertChangesToXML;
|
2017-08-14 05:01:11 +02:00
|
|
|
|
/*istanbul ignore start*/exports. /*istanbul ignore end*/canonicalize = _json.canonicalize;
|
|
|
|
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9pbmRleC5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7OztBQWdCQSxJLHlCQUFBLDhCLHdCQUFBOzs7Ozs7QUFDQSxJLHlCQUFBLHdDLHdCQUFBOztBQUNBLEkseUJBQUEsOEIsd0JBQUE7O0FBQ0EsSSx5QkFBQSw4Qix3QkFBQTs7QUFDQSxJLHlCQUFBLHNDLHdCQUFBOztBQUVBLEkseUJBQUEsNEIsd0JBQUE7O0FBQ0EsSSx5QkFBQSw4Qix3QkFBQTs7QUFFQSxJLHlCQUFBLGdDLHdCQUFBOztBQUVBLEkseUJBQUEsaUMsd0JBQUE7O0FBQ0EsSSx5QkFBQSxpQyx3QkFBQTs7QUFDQSxJLHlCQUFBLGlDLHdCQUFBOztBQUNBLEkseUJBQUEsbUMsd0JBQUE7O0FBRUEsSSx5QkFBQSwrQix3QkFBQTs7QUFDQSxJLHlCQUFBLCtCLHdCQUFBOzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Z0NBR0UsSTt5REFFQSxTO3lEQUNBLFM7eURBQ0Esa0I7eURBQ0EsUzt5REFDQSxnQjt5REFDQSxhO3lEQUVBLE87eURBQ0EsUTt5REFFQSxVO3lEQUVBLGU7eURBQ0EsbUI7eURBQ0EsVz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sXG4gIGFwcGx5UGF0Y2gsXG4gIGFwcGx5UGF0Y2hlcyxcbiAgcGFyc2VQYXRjaCxcbiAgbWVyZ2UsXG4gIGNvbnZlcnRDaGFuZ2VzVG9ETVAsXG4gIGNvbnZlcnRDaGFuZ2VzVG9YTUwsXG4gIGNhbm9uaWNhbGl6ZVxufTtcbiJdfQ==
|
2017-05-28 00:38:50 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ },
|
|
|
|
|
/* 1 */
|
|
|
|
|
/***/ function(module, exports) {
|
|
|
|
|
|
|
|
|
|
/*istanbul ignore start*/'use strict';
|
|
|
|
|
|
|
|
|
|
exports.__esModule = true;
|
|
|
|
|
exports['default'] = /*istanbul ignore end*/Diff;
|
|
|
|
|
function Diff() {}
|
|
|
|
|
|
|
|
|
|
Diff.prototype = { /*istanbul ignore start*/
|
|
|
|
|
/*istanbul ignore end*/diff: function diff(oldString, newString) {
|
|
|
|
|
/*istanbul ignore start*/var /*istanbul ignore end*/options = arguments.length <= 2 || arguments[2] === undefined ? {} : arguments[2];
|
|
|
|
|
|
|
|
|
|
var callback = options.callback;
|
|
|
|
|
if (typeof options === 'function') {
|
|
|
|
|
callback = options;
|
|
|
|
|
options = {};
|
|
|
|
|
}
|
|
|
|
|
this.options = options;
|
|
|
|
|
|
|
|
|
|
var self = this;
|
|
|
|
|
|
|
|
|
|
function done(value) {
|
|
|
|
|
if (callback) {
|
|
|
|
|
setTimeout(function () {
|
|
|
|
|
callback(undefined, value);
|
|
|
|
|
}, 0);
|
|
|
|
|
return true;
|
|
|
|
|
} else {
|
|
|
|
|
return value;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 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: this.join(newString), 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 = /*istanbul ignore start*/void 0 /*istanbul ignore end*/;
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
/*istanbul ignore start*/ /*istanbul ignore end*/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 });
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
/*istanbul ignore start*/ /*istanbul ignore end*/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;
|
|
|
|
|
},
|
|
|
|
|
/*istanbul ignore start*/ /*istanbul ignore end*/equals: function equals(left, right) {
|
2017-08-14 05:01:11 +02:00
|
|
|
|
return left === right || this.options.ignoreCase && left.toLowerCase() === right.toLowerCase();
|
2017-05-28 00:38:50 +02:00
|
|
|
|
},
|
|
|
|
|
/*istanbul ignore start*/ /*istanbul ignore end*/removeEmpty: function removeEmpty(array) {
|
|
|
|
|
var ret = [];
|
|
|
|
|
for (var i = 0; i < array.length; i++) {
|
|
|
|
|
if (array[i]) {
|
|
|
|
|
ret.push(array[i]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return ret;
|
|
|
|
|
},
|
|
|
|
|
/*istanbul ignore start*/ /*istanbul ignore end*/castInput: function castInput(value) {
|
|
|
|
|
return value;
|
|
|
|
|
},
|
|
|
|
|
/*istanbul ignore start*/ /*istanbul ignore end*/tokenize: function tokenize(value) {
|
|
|
|
|
return value.split('');
|
|
|
|
|
},
|
|
|
|
|
/*istanbul ignore start*/ /*istanbul ignore end*/join: function join(chars) {
|
|
|
|
|
return chars.join('');
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
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 = diff.join(value);
|
|
|
|
|
} else {
|
|
|
|
|
component.value = diff.join(newString.slice(newPos, newPos + component.count));
|
|
|
|
|
}
|
|
|
|
|
newPos += component.count;
|
|
|
|
|
|
|
|
|
|
// Common case
|
|
|
|
|
if (!component.added) {
|
|
|
|
|
oldPos += component.count;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
component.value = diff.join(oldString.slice(oldPos, oldPos + component.count));
|
|
|
|
|
oldPos += component.count;
|
|
|
|
|
|
|
|
|
|
// Reverse add and remove so removes are output first to match common convention
|
|
|
|
|
// 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;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 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 (componentLen > 1 && (lastComponent.added || lastComponent.removed) && diff.equals('', lastComponent.value)) {
|
|
|
|
|
components[componentLen - 2].value += lastComponent.value;
|
|
|
|
|
components.pop();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return components;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function clonePath(path) {
|
|
|
|
|
return { newPos: path.newPos, components: path.components.slice(0) };
|
|
|
|
|
}
|
2017-08-14 05:01:11 +02:00
|
|
|
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9kaWZmL2Jhc2UuanMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7OzRDQUF3QixJO0FBQVQsU0FBUyxJQUFULEdBQWdCLENBQUU7O0FBRWpDLEtBQUssU0FBTCxHQUFpQixFO3lCQUNmLElBRGUsZ0JBQ1YsU0FEVSxFQUNDLFNBREQsRUFDMEI7NkJBQUEsSSx1QkFBZCxPQUFjLHlEQUFKLEVBQUk7O0FBQ3ZDLFFBQUksV0FBVyxRQUFRLFFBQXZCO0FBQ0EsUUFBSSxPQUFPLE9BQVAsS0FBbUIsVUFBdkIsRUFBbUM7QUFDakMsaUJBQVcsT0FBWDtBQUNBLGdCQUFVLEVBQVY7QUFDRDtBQUNELFNBQUssT0FBTCxHQUFlLE9BQWY7O0FBRUEsUUFBSSxPQUFPLElBQVg7O0FBRUEsYUFBUyxJQUFULENBQWMsS0FBZCxFQUFxQjtBQUNuQixVQUFJLFFBQUosRUFBYztBQUNaLG1CQUFXLFlBQVc7QUFBRSxtQkFBUyxTQUFULEVBQW9CLEtBQXBCO0FBQTZCLFNBQXJELEVBQ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xHQUFhLENBQXJCLEVBQXdCLE9BQU8sS0FBL0IsRUFBc0MsU0FBUyxPQUEvQyxFQUFwQztBQUNELEtBSkQsTUFJTztBQUNMLGlCQUFXLElBQVgsQ0FBZ0IsRUFBQyxPQUFPLENBQVIsRUFBVyxPQUFPLEtBQWxCLEVBQXlCLFNBQVMsT0FBbEMsRUFBaEI7QUFDRDtBQUNGLEdBekhjO21EQTBIZixhQTFIZSx5QkEwSEQsUUExSEMsRUEwSFMsU0ExSFQsRUEwSG9CLFNBMUhwQixFQTBIK0IsWUExSC9CLEVB
|
2017-05-28 00:38:50 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ },
|
|
|
|
|
/* 2 */
|
|
|
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
/*istanbul ignore start*/'use strict';
|
|
|
|
|
|
|
|
|
|
exports.__esModule = true;
|
|
|
|
|
exports.characterDiff = undefined;
|
|
|
|
|
exports. /*istanbul ignore end*/diffChars = diffChars;
|
|
|
|
|
|
|
|
|
|
var /*istanbul ignore start*/_base = __webpack_require__(1) /*istanbul ignore end*/;
|
|
|
|
|
|
|
|
|
|
/*istanbul ignore start*/
|
|
|
|
|
var _base2 = _interopRequireDefault(_base);
|
|
|
|
|
|
|
|
|
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
|
|
|
|
|
|
|
|
|
/*istanbul ignore end*/var characterDiff = /*istanbul ignore start*/exports. /*istanbul ignore end*/characterDiff = new /*istanbul ignore start*/_base2['default']() /*istanbul ignore end*/;
|
2017-08-14 05:01:11 +02:00
|
|
|
|
function diffChars(oldStr, newStr, options) {
|
|
|
|
|
return characterDiff.diff(oldStr, newStr, options);
|
2017-05-28 00:38:50 +02:00
|
|
|
|
}
|
2017-08-14 05:01:11 +02:00
|
|
|
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9kaWZmL2NoYXJhY3Rlci5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7O2dDQUdnQixTLEdBQUEsUzs7QUFIaEIsSSx5QkFBQSx5Qix3QkFBQTs7Ozs7Ozt1QkFFTyxJQUFNLGdCLHlCQUFBLFEsd0JBQUEsZ0JBQWdCLEkseUJBQUEsbUIsd0JBQXRCO0FBQ0EsU0FBUyxTQUFULENBQW1CLE1BQW5CLEVBQTJCLE1BQTNCLEVBQW1DLE9BQW5DLEVBQTRDO0FBQUUsU0FBTyxjQUFjLElBQWQsQ0FBbUIsTUFBbkIsRUFBMkIsTUFBM0IsRUFBbUMsT0FBbkMsQ0FBUDtBQUFxRCIsImZpbGUiOiJjaGFyYWN0ZXIuanMiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgRGlmZiBmcm9tICcuL2Jhc2UnO1xuXG5leHBvcnQgY29uc3QgY2hhcmFjdGVyRGlmZiA9IG5ldyBEaWZmKCk7XG5leHBvcnQgZnVuY3Rpb24gZGlmZkNoYXJzKG9sZFN0ciwgbmV3U3RyLCBvcHRpb25zKSB7IHJldHVybiBjaGFyYWN0ZXJEaWZmLmRpZmYob2xkU3RyLCBuZXdTdHIsIG9wdGlvbnMpOyB9XG4iXX0=
|
2017-05-28 00:38:50 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ },
|
|
|
|
|
/* 3 */
|
|
|
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
/*istanbul ignore start*/'use strict';
|
|
|
|
|
|
|
|
|
|
exports.__esModule = true;
|
|
|
|
|
exports.wordDiff = undefined;
|
|
|
|
|
exports. /*istanbul ignore end*/diffWords = diffWords;
|
|
|
|
|
/*istanbul ignore start*/exports. /*istanbul ignore end*/diffWordsWithSpace = diffWordsWithSpace;
|
|
|
|
|
|
|
|
|
|
var /*istanbul ignore start*/_base = __webpack_require__(1) /*istanbul ignore end*/;
|
|
|
|
|
|
|
|
|
|
/*istanbul ignore start*/
|
|
|
|
|
var _base2 = _interopRequireDefault(_base);
|
|
|
|
|
|
|
|
|
|
/*istanbul ignore end*/
|
|
|
|
|
var /*istanbul ignore start*/_params = __webpack_require__(4) /*istanbul ignore end*/;
|
|
|
|
|
|
|
|
|
|
/*istanbul ignore start*/
|
|
|
|
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
|
|
|
|
|
|
|
|
|
/*istanbul ignore end*/
|
|
|
|
|
|
|
|
|
|
// 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 = /*istanbul ignore start*/exports. /*istanbul ignore end*/wordDiff = new /*istanbul ignore start*/_base2['default']() /*istanbul ignore end*/;
|
|
|
|
|
wordDiff.equals = function (left, right) {
|
2017-08-14 05:01:11 +02:00
|
|
|
|
if (this.options.ignoreCase) {
|
|
|
|
|
left = left.toLowerCase();
|
|
|
|
|
right = right.toLowerCase();
|
|
|
|
|
}
|
2017-05-28 00:38:50 +02:00
|
|
|
|
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--;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return tokens;
|
|
|
|
|
};
|
|
|
|
|
|
2017-08-14 05:01:11 +02:00
|
|
|
|
function diffWords(oldStr, newStr, options) {
|
|
|
|
|
options = /*istanbul ignore start*/(0, _params.generateOptions) /*istanbul ignore end*/(options, { ignoreWhitespace: true });
|
2017-05-28 00:38:50 +02:00
|
|
|
|
return wordDiff.diff(oldStr, newStr, options);
|
|
|
|
|
}
|
2017-08-14 05:01:11 +02:00
|
|
|
|
|
|
|
|
|
function diffWordsWithSpace(oldStr, newStr, options) {
|
|
|
|
|
return wordDiff.diff(oldStr, newStr, options);
|
2017-05-28 00:38:50 +02:00
|
|
|
|
}
|
2017-08-14 05:01:11 +02:00
|
|
|
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9kaWZmL3dvcmQuanMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7OztnQ0FtRGdCL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uIGxlZnQgPT09IHJpZ2h0IHx8ICh0aGlzLm9wdGlvbnMuaWdub3JlV2hpdGVzcGFjZSAmJiAhcmVXaGl0ZXNwYWNlLnRlc3QobGVmdCkgJiYgIXJlV2hpdGVzcGFjZS50ZXN0KHJpZ2h0KSk7XG59O1xud29yZERpZmYudG9rZW5pemUgPSBmdW5jdGlvbih2YWx1ZSkge1xuICBsZXQgdG9rZW5zID0gdmFsdWUuc3BsaXQoLyhcXHMrfFxcYikvKTtcblxuICAvLyBKb2luIHRoZSBib3VuZGFyeSBzcGxpdHMgdGhhdCB3ZSBkbyBub3QgY29uc2lkZXIgdG8gYmUgYm91bmRhcmllcy4gVGhpcyBpcyBwcmltYXJpbHkgdGhlIGV4dGVuZGVkIExhdGluIGNoYXJhY3RlciBzZXQuXG4gIGZvciAobGV0IGkgPSAwOyBpIDwgdG9rZW5zLmxlbmd0aCAtIDE7IGkrKykge1xuICAgIC8vIElmIHdlIGhhdmUgYW4gZW1wdHkgc3RyaW5nIGluIHRoZSBuZXh0IGZpZWxkIGFuZCB3ZSBoYXZlIG9ubHkgd29yZCBjaGFycyBiZWZvcmUgYW5kIGFmdGVyLCBtZXJnZVxuICAgIGlmICghdG9rZW5zW2kgKyAxXSAmJiB0b2tlbnNbaSArIDJdXG4gICAgICAgICAgJiYgZXh0ZW5kZWRXb3JkQ2hhcnMudGVzdCh0b2tlbnNbaV0pXG4gICAgICAgICAgJiYgZXh0
|
2017-05-28 00:38:50 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ },
|
|
|
|
|
/* 4 */
|
|
|
|
|
/***/ function(module, exports) {
|
|
|
|
|
|
|
|
|
|
/*istanbul ignore start*/'use strict';
|
|
|
|
|
|
|
|
|
|
exports.__esModule = true;
|
|
|
|
|
exports. /*istanbul ignore end*/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];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return defaults;
|
|
|
|
|
}
|
|
|
|
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy91dGlsL3BhcmFtcy5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Z0NBQWdCLGUsR0FBQSxlO0FBQVQsU0FBUyxlQUFULENBQXlCLE9BQXpCLEVBQWtDLFFBQWxDLEVBQTRDO0FBQ2pELE1BQUksT0FBTyxPQUFQLEtBQW1CLFVBQXZCLEVBQW1DO0FBQ2pDLGFBQVMsUUFBVCxHQUFvQixPQUFwQjtBQUNELEdBRkQsTUFFTyxJQUFJLE9BQUosRUFBYTtBQUNsQixTQUFLLElBQUksSUFBVCxJQUFpQixPQUFqQixFQUEwQjs7QUFFeEIsVUFBSSxRQUFRLGNBQVIsQ0FBdUIsSUFBdkIsQ0FBSixFQUFrQztBQUNoQyxpQkFBUyxJQUFULElBQWlCLFFBQVEsSUFBUixDQUFqQjtBQUNEO0FBQ0Y7QUFDRjtBQUNELFNBQU8sUUFBUDtBQUNEIiwiZmlsZSI6InBhcmFtcy5qcyIsInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCBmdW5jdGlvbiBnZW5lcmF0ZU9wdGlvbnMob3B0aW9ucywgZGVmYXVsdHMpIHtcbiAgaWYgKHR5cGVvZiBvcHRpb25zID09PSAnZnVuY3Rpb24nKSB7XG4gICAgZGVmYXVsdHMuY2FsbGJhY2sgPSBvcHRpb25zO1xuICB9IGVsc2UgaWYgKG9wdGlvbnMpIHtcbiAgICBmb3IgKGxldCBuYW1lIGluIG9wdGlvbnMpIHtcbiAgICAgIC8qIGlzdGFuYnVsIGlnbm9yZSBlbHNlICovXG4gICAgICBpZiAob3B0aW9ucy5oYXNPd25Qcm9wZXJ0eShuYW1lKSkge1xuICAgICAgICBkZWZhdWx0c1tuYW1lXSA9IG9wdGlvbnNbbmFtZV07XG4gICAgICB9XG4gICAgfVxuICB9XG4gIHJldHVybiBkZWZhdWx0cztcbn1cbiJdfQ==
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ },
|
|
|
|
|
/* 5 */
|
|
|
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
/*istanbul ignore start*/'use strict';
|
|
|
|
|
|
|
|
|
|
exports.__esModule = true;
|
|
|
|
|
exports.lineDiff = undefined;
|
|
|
|
|
exports. /*istanbul ignore end*/diffLines = diffLines;
|
|
|
|
|
/*istanbul ignore start*/exports. /*istanbul ignore end*/diffTrimmedLines = diffTrimmedLines;
|
|
|
|
|
|
|
|
|
|
var /*istanbul ignore start*/_base = __webpack_require__(1) /*istanbul ignore end*/;
|
|
|
|
|
|
|
|
|
|
/*istanbul ignore start*/
|
|
|
|
|
var _base2 = _interopRequireDefault(_base);
|
|
|
|
|
|
|
|
|
|
/*istanbul ignore end*/
|
|
|
|
|
var /*istanbul ignore start*/_params = __webpack_require__(4) /*istanbul ignore end*/;
|
|
|
|
|
|
|
|
|
|
/*istanbul ignore start*/
|
|
|
|
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
|
|
|
|
|
|
|
|
|
/*istanbul ignore end*/var lineDiff = /*istanbul ignore start*/exports. /*istanbul ignore end*/lineDiff = new /*istanbul ignore start*/_base2['default']() /*istanbul ignore end*/;
|
|
|
|
|
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 retLines;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
function diffLines(oldStr, newStr, callback) {
|
|
|
|
|
return lineDiff.diff(oldStr, newStr, callback);
|
|
|
|
|
}
|
|
|
|
|
function diffTrimmedLines(oldStr, newStr, callback) {
|
|
|
|
|
var options = /*istanbul ignore start*/(0, _params.generateOptions) /*istanbul ignore end*/(callback, { ignoreWhitespace: true });
|
|
|
|
|
return lineDiff.diff(oldStr, newStr, options);
|
|
|
|
|
}
|
|
|
|
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9kaWZmL2xpbmUuanMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7OztnQ0E4QmdCLFMsR0FBQSxTO3lEQUNBLGdCLEdBQUEsZ0I7O0FBL0JoQixJLHlCQUFBLHlCLHdCQUFBOzs7Ozs7QUFDQSxJLHlCQUFBLG1DLHdCQUFBOzs7Ozt1QkFFTyxJQUFNLFcseUJBQUEsUSx3QkFBQSxXQUFXLEkseUJBQUEsbUIsd0JBQWpCO0FBQ1AsU0FBUyxRQUFULEdBQW9CLFVBQVMsS0FBVCxFQUFnQjtBQUNsQyxNQUFJLFdBQVcsRUFBZjtBQUFBLE1BQ0ksbUJBQW1CLE1BQU0sS0FBTixDQUFZLFdBQVosQ0FEdkI7OztBQUlBLE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W5lcztcbn07XG5cbmV4cG9ydCBmdW5jdGlvbiBkaWZmTGluZXMob2xkU3RyLCBuZXdTdHIsIGNhbGxiYWNrKSB7IHJldHVybiBsaW5lRGlmZi5kaWZmKG9sZFN0ciwgbmV3U3RyLCBjYWxsYmFjayk7IH1cbmV4cG9ydCBmdW5jdGlvbiBkaWZmVHJpbW1lZExpbmVzKG9sZFN0ciwgbmV3U3RyLCBjYWxsYmFjaykge1xuICBsZXQgb3B0aW9ucyA9IGdlbmVyYXRlT3B0aW9ucyhjYWxsYmFjaywge2lnbm9yZVdoaXRlc3BhY2U6IHRydWV9KTtcbiAgcmV0dXJuIGxpbmVEaWZmLmRpZmYob2xkU3RyLCBuZXdTdHIsIG9wdGlvbnMpO1xufVxuIl19
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ },
|
|
|
|
|
/* 6 */
|
|
|
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
/*istanbul ignore start*/'use strict';
|
|
|
|
|
|
|
|
|
|
exports.__esModule = true;
|
|
|
|
|
exports.sentenceDiff = undefined;
|
|
|
|
|
exports. /*istanbul ignore end*/diffSentences = diffSentences;
|
|
|
|
|
|
|
|
|
|
var /*istanbul ignore start*/_base = __webpack_require__(1) /*istanbul ignore end*/;
|
|
|
|
|
|
|
|
|
|
/*istanbul ignore start*/
|
|
|
|
|
var _base2 = _interopRequireDefault(_base);
|
|
|
|
|
|
|
|
|
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
|
|
|
|
|
|
|
|
|
/*istanbul ignore end*/var sentenceDiff = /*istanbul ignore start*/exports. /*istanbul ignore end*/sentenceDiff = new /*istanbul ignore start*/_base2['default']() /*istanbul ignore end*/;
|
|
|
|
|
sentenceDiff.tokenize = function (value) {
|
|
|
|
|
return value.split(/(\S.+?[.!?])(?=\s+|$)/);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
function diffSentences(oldStr, newStr, callback) {
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
|
|
|
|
|
|
|
/***/ },
|
|
|
|
|
/* 7 */
|
|
|
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
/*istanbul ignore start*/'use strict';
|
|
|
|
|
|
|
|
|
|
exports.__esModule = true;
|
|
|
|
|
exports.cssDiff = undefined;
|
|
|
|
|
exports. /*istanbul ignore end*/diffCss = diffCss;
|
|
|
|
|
|
|
|
|
|
var /*istanbul ignore start*/_base = __webpack_require__(1) /*istanbul ignore end*/;
|
|
|
|
|
|
|
|
|
|
/*istanbul ignore start*/
|
|
|
|
|
var _base2 = _interopRequireDefault(_base);
|
|
|
|
|
|
|
|
|
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
|
|
|
|
|
|
|
|
|
/*istanbul ignore end*/var cssDiff = /*istanbul ignore start*/exports. /*istanbul ignore end*/cssDiff = new /*istanbul ignore start*/_base2['default']() /*istanbul ignore end*/;
|
|
|
|
|
cssDiff.tokenize = function (value) {
|
|
|
|
|
return value.split(/([{}:;,]|\s+)/);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
function diffCss(oldStr, newStr, callback) {
|
|
|
|
|
return cssDiff.diff(oldStr, newStr, callback);
|
|
|
|
|
}
|
|
|
|
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9kaWZmL2Nzcy5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7O2dDQU9nQixPLEdBQUEsTzs7QUFQaEIsSSx5QkFBQSx5Qix3QkFBQTs7Ozs7Ozt1QkFFTyxJQUFNLFUseUJBQUEsUSx3QkFBQSxVQUFVLEkseUJBQUEsbUIsd0JBQWhCO0FBQ1AsUUFBUSxRQUFSLEdBQW1CLFVBQVMsS0FBVCxFQUFnQjtBQUNqQyxTQUFPLE1BQU0sS0FBTixDQUFZLGVBQVosQ0FBUDtBQUNELENBRkQ7O0FBSU8sU0FBUyxPQUFULENBQWlCLE1BQWpCLEVBQXlCLE1BQXpCLEVBQWlDLFFBQWpDLEVBQTJDO0FBQUUsU0FBTyxRQUFRLElBQVIsQ0FBYSxNQUFiLEVBQXFCLE1BQXJCLEVBQTZCLFFBQTdCLENBQVA7QUFBZ0QiLCJmaWxlIjoiY3NzLmpzIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IERpZmYgZnJvbSAnLi9iYXNlJztcblxuZXhwb3J0IGNvbnN0IGNzc0RpZmYgPSBuZXcgRGlmZigpO1xuY3NzRGlmZi50b2tlbml6ZSA9IGZ1bmN0aW9uKHZhbHVlKSB7XG4gIHJldHVybiB2YWx1ZS5zcGxpdCgvKFt7fTo7LF18XFxzKykvKTtcbn07XG5cbmV4cG9ydCBmdW5jdGlvbiBkaWZmQ3NzKG9sZFN0ciwgbmV3U3RyLCBjYWxsYmFjaykgeyByZXR1cm4gY3NzRGlmZi5kaWZmKG9sZFN0ciwgbmV3U3RyLCBjYWxsYmFjayk7IH1cbiJdfQ==
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ },
|
|
|
|
|
/* 8 */
|
|
|
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
/*istanbul ignore start*/'use strict';
|
|
|
|
|
|
|
|
|
|
exports.__esModule = true;
|
|
|
|
|
exports.jsonDiff = undefined;
|
|
|
|
|
|
|
|
|
|
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; };
|
|
|
|
|
|
|
|
|
|
exports. /*istanbul ignore end*/diffJson = diffJson;
|
|
|
|
|
/*istanbul ignore start*/exports. /*istanbul ignore end*/canonicalize = canonicalize;
|
|
|
|
|
|
|
|
|
|
var /*istanbul ignore start*/_base = __webpack_require__(1) /*istanbul ignore end*/;
|
|
|
|
|
|
|
|
|
|
/*istanbul ignore start*/
|
|
|
|
|
var _base2 = _interopRequireDefault(_base);
|
|
|
|
|
|
|
|
|
|
/*istanbul ignore end*/
|
|
|
|
|
var /*istanbul ignore start*/_line = __webpack_require__(5) /*istanbul ignore end*/;
|
|
|
|
|
|
|
|
|
|
/*istanbul ignore start*/
|
|
|
|
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
|
|
|
|
|
|
|
|
|
/*istanbul ignore end*/
|
|
|
|
|
|
|
|
|
|
var objectPrototypeToString = Object.prototype.toString;
|
|
|
|
|
|
|
|
|
|
var jsonDiff = /*istanbul ignore start*/exports. /*istanbul ignore end*/jsonDiff = new /*istanbul ignore start*/_base2['default']() /*istanbul ignore end*/;
|
|
|
|
|
// 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 = /*istanbul ignore start*/_line.lineDiff. /*istanbul ignore end*/tokenize;
|
|
|
|
|
jsonDiff.castInput = function (value) {
|
|
|
|
|
/*istanbul ignore start*/var /*istanbul ignore end*/undefinedReplacement = this.options.undefinedReplacement;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return typeof value === 'string' ? value : JSON.stringify(canonicalize(value), function (k, v) {
|
|
|
|
|
if (typeof v === 'undefined') {
|
|
|
|
|
return undefinedReplacement;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return v;
|
|
|
|
|
}, ' ');
|
|
|
|
|
};
|
|
|
|
|
jsonDiff.equals = function (left, right) {
|
2017-08-14 05:01:11 +02:00
|
|
|
|
return (/*istanbul ignore start*/_base2['default']. /*istanbul ignore end*/prototype.equals.call(jsonDiff, left.replace(/,([\r\n])/g, '$1'), right.replace(/,([\r\n])/g, '$1'))
|
2017-05-28 00:38:50 +02:00
|
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
function diffJson(oldObj, newObj, options) {
|
|
|
|
|
return jsonDiff.diff(oldObj, newObj, options);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 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 = /*istanbul ignore start*/void 0 /*istanbul ignore end*/;
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < stack.length; i += 1) {
|
|
|
|
|
if (stack[i] === obj) {
|
|
|
|
|
return replacementStack[i];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var canonicalizedObj = /*istanbul ignore start*/void 0 /*istanbul ignore end*/;
|
|
|
|
|
|
|
|
|
|
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();
|
|
|
|
|
return canonicalizedObj;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (obj && obj.toJSON) {
|
|
|
|
|
obj = obj.toJSON();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( /*istanbul ignore start*/(typeof /*istanbul ignore end*/obj === 'undefined' ? 'undefined' : _typeof(obj)) === 'object' && obj !== null) {
|
|
|
|
|
stack.push(obj);
|
|
|
|
|
canonicalizedObj = {};
|
|
|
|
|
replacementStack.push(canonicalizedObj);
|
|
|
|
|
var sortedKeys = [],
|
|
|
|
|
key = /*istanbul ignore start*/void 0 /*istanbul ignore end*/;
|
|
|
|
|
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;
|
|
|
|
|
}
|
2017-08-14 05:01:11 +02:00
|
|
|
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9kaWZmL2pzb24uanMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7OztnQ0EyQmdCLFEsR0FBQSxRO3lEQUlBLFksR0FBQSxZOztBQS9CaEIsSSx5QkFBQSx5Qix3QkFBQTs7Ozs7O0FBQ0EsSSx5QkFBQSx5Qix3QkFBQTs7Ozs7OztBQUVBLElBQU0sMEJBQTBCLE9BQU8sU0FBUCxDQUFpQixRQUFqRDs7QUFHTyxJQUFNLFcseUJBQUEsUSx3QkFBQSxXQUFXLEkseUJBQUEsbUIsd0JBQWpCOzs7QUFHUCxTQUFTLGVBQVQsR0FBMkIsSUFBM0I7O0FBRUEsU0FBUyxRQUFULEcseUJBQW9CLGUsd0JBQVMsUUFBN0I7QUFDQSxTQUFTLFNBQVQsR0FBcUIsVUFBUyxLQUFULEVBQWdCOzJCQUFBLEksdUJBQzVCLG9CQUQ0QixHQUNKLEtBQUssT0FERCxDQUM1QixvQkFENEI7OztBQUduQyxTQUFPLE9BQU8sS0FBUCxLQUFpQixRQUFqQixHQUE0QixLQUE1QixHQUFvQyxLQUFLLFNBQUwsQ0FBZSxhQUFhL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gdHlwZW9mIHZhbHVlID09PSAnc3RyaW5nJyA/IHZhbHVlIDogSlNPTi5zdHJpbmdpZnkoY2Fub25pY2FsaXplKHZhbHVlKSwgZnVuY3Rpb24oaywgdikge1xuICAgIGlmICh0eXBlb2YgdiA9PT0gJ3VuZGVmaW5lZCcpIHtcbiAgICAgIHJldHVybiB1bmRlZmluZWRSZXBsYWNlbWVudDtcbiAgICB9
|
2017-05-28 00:38:50 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ },
|
|
|
|
|
/* 9 */
|
|
|
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
/*istanbul ignore start*/'use strict';
|
|
|
|
|
|
|
|
|
|
exports.__esModule = true;
|
|
|
|
|
exports.arrayDiff = undefined;
|
|
|
|
|
exports. /*istanbul ignore end*/diffArrays = diffArrays;
|
|
|
|
|
|
|
|
|
|
var /*istanbul ignore start*/_base = __webpack_require__(1) /*istanbul ignore end*/;
|
|
|
|
|
|
|
|
|
|
/*istanbul ignore start*/
|
|
|
|
|
var _base2 = _interopRequireDefault(_base);
|
|
|
|
|
|
|
|
|
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
|
|
|
|
|
|
|
|
|
/*istanbul ignore end*/var arrayDiff = /*istanbul ignore start*/exports. /*istanbul ignore end*/arrayDiff = new /*istanbul ignore start*/_base2['default']() /*istanbul ignore end*/;
|
|
|
|
|
arrayDiff.tokenize = arrayDiff.join = function (value) {
|
|
|
|
|
return value.slice();
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
function diffArrays(oldArr, newArr, callback) {
|
|
|
|
|
return arrayDiff.diff(oldArr, newArr, callback);
|
|
|
|
|
}
|
|
|
|
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9kaWZmL2FycmF5LmpzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Z0NBT2dCLFUsR0FBQSxVOztBQVBoQixJLHlCQUFBLHlCLHdCQUFBOzs7Ozs7O3VCQUVPLElBQU0sWSx5QkFBQSxRLHdCQUFBLFlBQVksSSx5QkFBQSxtQix3QkFBbEI7QUFDUCxVQUFVLFFBQVYsR0FBcUIsVUFBVSxJQUFWLEdBQWlCLFVBQVMsS0FBVCxFQUFnQjtBQUNwRCxTQUFPLE1BQU0sS0FBTixFQUFQO0FBQ0QsQ0FGRDs7QUFJTyxTQUFTLFVBQVQsQ0FBb0IsTUFBcEIsRUFBNEIsTUFBNUIsRUFBb0MsUUFBcEMsRUFBOEM7QUFBRSxTQUFPLFVBQVUsSUFBVixDQUFlLE1BQWYsRUFBdUIsTUFBdkIsRUFBK0IsUUFBL0IsQ0FBUDtBQUFrRCIsImZpbGUiOiJhcnJheS5qcyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCBEaWZmIGZyb20gJy4vYmFzZSc7XG5cbmV4cG9ydCBjb25zdCBhcnJheURpZmYgPSBuZXcgRGlmZigpO1xuYXJyYXlEaWZmLnRva2VuaXplID0gYXJyYXlEaWZmLmpvaW4gPSBmdW5jdGlvbih2YWx1ZSkge1xuICByZXR1cm4gdmFsdWUuc2xpY2UoKTtcbn07XG5cbmV4cG9ydCBmdW5jdGlvbiBkaWZmQXJyYXlzKG9sZEFyciwgbmV3QXJyLCBjYWxsYmFjaykgeyByZXR1cm4gYXJyYXlEaWZmLmRpZmYob2xkQXJyLCBuZXdBcnIsIGNhbGxiYWNrKTsgfVxuIl19
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ },
|
|
|
|
|
/* 10 */
|
|
|
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
/*istanbul ignore start*/'use strict';
|
|
|
|
|
|
|
|
|
|
exports.__esModule = true;
|
|
|
|
|
exports. /*istanbul ignore end*/applyPatch = applyPatch;
|
|
|
|
|
/*istanbul ignore start*/exports. /*istanbul ignore end*/applyPatches = applyPatches;
|
|
|
|
|
|
|
|
|
|
var /*istanbul ignore start*/_parse = __webpack_require__(11) /*istanbul ignore end*/;
|
|
|
|
|
|
|
|
|
|
var /*istanbul ignore start*/_distanceIterator = __webpack_require__(12) /*istanbul ignore end*/;
|
|
|
|
|
|
|
|
|
|
/*istanbul ignore start*/
|
|
|
|
|
var _distanceIterator2 = _interopRequireDefault(_distanceIterator);
|
|
|
|
|
|
|
|
|
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
|
|
|
|
|
|
|
|
|
/*istanbul ignore end*/function applyPatch(source, uniDiff) {
|
|
|
|
|
/*istanbul ignore start*/var /*istanbul ignore end*/options = arguments.length <= 2 || arguments[2] === undefined ? {} : arguments[2];
|
|
|
|
|
|
|
|
|
|
if (typeof uniDiff === 'string') {
|
|
|
|
|
uniDiff = /*istanbul ignore start*/(0, _parse.parsePatch) /*istanbul ignore end*/(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(/\r\n|[\n\v\f\r\x85]/),
|
|
|
|
|
delimiters = source.match(/\r\n|[\n\v\f\r\x85]/g) || [],
|
|
|
|
|
hunks = uniDiff.hunks,
|
|
|
|
|
compareLine = options.compareLine || function (lineNumber, line, operation, patchContent) /*istanbul ignore start*/{
|
|
|
|
|
return (/*istanbul ignore end*/line === patchContent
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
errorCount = 0,
|
|
|
|
|
fuzzFactor = options.fuzzFactor || 0,
|
|
|
|
|
minLine = 0,
|
|
|
|
|
offset = 0,
|
|
|
|
|
removeEOFNL = /*istanbul ignore start*/void 0 /*istanbul ignore end*/,
|
|
|
|
|
addEOFNL = /*istanbul ignore start*/void 0 /*istanbul ignore end*/;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 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 = /*istanbul ignore start*/(0, _distanceIterator2['default']) /*istanbul ignore end*/(toPos, minLine, maxLine);
|
|
|
|
|
|
|
|
|
|
for (; localOffset !== undefined; localOffset = iterator()) {
|
|
|
|
|
if (hunkFits(hunk, toPos + localOffset)) {
|
|
|
|
|
hunk.offset = offset += localOffset;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (localOffset === undefined) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 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
|
2017-08-14 05:01:11 +02:00
|
|
|
|
var diffOffset = 0;
|
2017-05-28 00:38:50 +02:00
|
|
|
|
for (var _i = 0; _i < hunks.length; _i++) {
|
|
|
|
|
var _hunk = hunks[_i],
|
2017-08-14 05:01:11 +02:00
|
|
|
|
_toPos = _hunk.oldStart + _hunk.offset + diffOffset - 1;
|
|
|
|
|
diffOffset += _hunk.newLines - _hunk.oldLines;
|
2017-05-28 00:38:50 +02:00
|
|
|
|
|
|
|
|
|
for (var j = 0; j < _hunk.lines.length; j++) {
|
|
|
|
|
var line = _hunk.lines[j],
|
|
|
|
|
operation = line[0],
|
|
|
|
|
content = line.substr(1),
|
|
|
|
|
delimiter = _hunk.linedelimiters[j];
|
|
|
|
|
|
|
|
|
|
if (operation === ' ') {
|
|
|
|
|
_toPos++;
|
|
|
|
|
} else if (operation === '-') {
|
|
|
|
|
lines.splice(_toPos, 1);
|
|
|
|
|
delimiters.splice(_toPos, 1);
|
|
|
|
|
/* istanbul ignore else */
|
|
|
|
|
} else if (operation === '+') {
|
|
|
|
|
lines.splice(_toPos, 0, content);
|
|
|
|
|
delimiters.splice(_toPos, 0, delimiter);
|
|
|
|
|
_toPos++;
|
|
|
|
|
} else if (operation === '\\') {
|
|
|
|
|
var previousOperation = _hunk.lines[j - 1] ? _hunk.lines[j - 1][0] : null;
|
|
|
|
|
if (previousOperation === '+') {
|
|
|
|
|
removeEOFNL = true;
|
|
|
|
|
} else if (previousOperation === '-') {
|
|
|
|
|
addEOFNL = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Handle EOFNL insertion/removal
|
|
|
|
|
if (removeEOFNL) {
|
|
|
|
|
while (!lines[lines.length - 1]) {
|
|
|
|
|
lines.pop();
|
|
|
|
|
delimiters.pop();
|
|
|
|
|
}
|
|
|
|
|
} else if (addEOFNL) {
|
|
|
|
|
lines.push('');
|
|
|
|
|
delimiters.push('\n');
|
|
|
|
|
}
|
|
|
|
|
for (var _k = 0; _k < lines.length - 1; _k++) {
|
|
|
|
|
lines[_k] = lines[_k] + delimiters[_k];
|
|
|
|
|
}
|
|
|
|
|
return lines.join('');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Wrapper that supports multiple file patches via callbacks.
|
|
|
|
|
function applyPatches(uniDiff, options) {
|
|
|
|
|
if (typeof uniDiff === 'string') {
|
|
|
|
|
uniDiff = /*istanbul ignore start*/(0, _parse.parsePatch) /*istanbul ignore end*/(uniDiff);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var currentIndex = 0;
|
|
|
|
|
function processIndex() {
|
|
|
|
|
var index = uniDiff[currentIndex++];
|
|
|
|
|
if (!index) {
|
|
|
|
|
return options.complete();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
options.loadFile(index, function (err, data) {
|
|
|
|
|
if (err) {
|
|
|
|
|
return options.complete(err);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var updatedContent = applyPatch(data, index, options);
|
|
|
|
|
options.patched(index, updatedContent, function (err) {
|
|
|
|
|
if (err) {
|
|
|
|
|
return options.complete(err);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
processIndex();
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
processIndex();
|
|
|
|
|
}
|
2017-08-14 05:01:11 +02:00
|
|
|
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9wYXRjaC9hcHBseS5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Z0NBR2dCLFUsR0FBQSxVO3lEQWdJQSxZLEdBQUEsWTs7QUFuSWhCLEkseUJBQUEsMkIsd0JBQUE7O0FBQ0EsSSx5Qk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FQUF1QjtBQUM1QixnQkFBTSxNQUFOLENBQWEsTUFBYixFQUFvQixDQUFwQixFQUF1QixPQUF2QjtBQUNBLHFCQUFXLE1BQVgsQ0FBa0IsTUFBbEIsRUFBeUIsQ0FBekIsRUFBNEIsU0FBNUI7QUFDQTtBQUNELFNBSk0sTUFJQSxJQUFJLGNBQWMsSUFBbEIsRUFBd0I7QUFDN0IsY0FBSSxvQkFBb0IsTUFBSyxLQUFMLENBQVcsSUFBSSxDQUFmLElBQW9CLE1BQUssS0FBTCxDQUFXLElBQUksQ0FBZixFQUFrQixDQUFsQixDQUFwQixHQUEyQyxJQUFuRTtBQUNBLGNBQUksc0JBQXNCLEdBQTFCLEVBQStCO0FBQzdCLDBCQUFjLElBQWQ7QUFDRCxXQUZELE1BRU8sSUFBSSxzQkFBc0IsR0FBMUIsRUFBK0I7QUFDcEMsdUJBQVcsSUFBWDtBQUNEO0FBQ0Y7QUFDRjtBQUNGOzs7QUFHRCxNQUFJLFdBQUosRUFBaUI7QUFDZixXQUFPLENBQUMsTUFBTSxNQUFNLE1BQU4sR0FBZSxDQUFyQixDQUFSLEVBQWlDO0FBQy9CLFlBQU0sR0FBTjtBQUNBLGlCQUFXLEdBQVg7QUFDRDtBQUNGLEdBTEQsTUFLTyxJQUFJLFFBQUosRUFBYztBQUNuQixVQUFNLElBQU4sQ0FBVyxF
|
2017-05-28 00:38:50 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ },
|
|
|
|
|
/* 11 */
|
|
|
|
|
/***/ function(module, exports) {
|
|
|
|
|
|
|
|
|
|
/*istanbul ignore start*/'use strict';
|
|
|
|
|
|
|
|
|
|
exports.__esModule = true;
|
|
|
|
|
exports. /*istanbul ignore end*/parsePatch = parsePatch;
|
|
|
|
|
function parsePatch(uniDiff) {
|
|
|
|
|
/*istanbul ignore start*/var /*istanbul ignore end*/options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
|
|
|
|
|
|
|
|
|
|
var diffstr = uniDiff.split(/\r\n|[\n\v\f\r\x85]/),
|
|
|
|
|
delimiters = uniDiff.match(/\r\n|[\n\v\f\r\x85]/g) || [],
|
|
|
|
|
list = [],
|
|
|
|
|
i = 0;
|
|
|
|
|
|
|
|
|
|
function parseIndex() {
|
|
|
|
|
var index = {};
|
|
|
|
|
list.push(index);
|
|
|
|
|
|
|
|
|
|
// Parse diff metadata
|
|
|
|
|
while (i < diffstr.length) {
|
|
|
|
|
var line = diffstr[i];
|
|
|
|
|
|
|
|
|
|
// File header found, end parsing diff metadata
|
|
|
|
|
if (/^(\-\-\-|\+\+\+|@@)\s/.test(line)) {
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Diff index
|
|
|
|
|
var header = /^(?:Index:|diff(?: -r \w+)+)\s+(.+?)\s*$/.exec(line);
|
|
|
|
|
if (header) {
|
|
|
|
|
index.index = header[1];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
i++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Parse file headers if they are defined. Unified diff requires them, but
|
|
|
|
|
// there's no technical issues to have an isolated hunk without file header
|
|
|
|
|
parseFileHeader(index);
|
|
|
|
|
parseFileHeader(index);
|
|
|
|
|
|
|
|
|
|
// Parse hunks
|
|
|
|
|
index.hunks = [];
|
|
|
|
|
|
|
|
|
|
while (i < diffstr.length) {
|
|
|
|
|
var _line = diffstr[i];
|
|
|
|
|
|
|
|
|
|
if (/^(Index:|diff|\-\-\-|\+\+\+)\s/.test(_line)) {
|
|
|
|
|
break;
|
|
|
|
|
} else if (/^@@/.test(_line)) {
|
|
|
|
|
index.hunks.push(parseHunk());
|
|
|
|
|
} else if (_line && options.strict) {
|
|
|
|
|
// Ignore unexpected content unless in strict mode
|
|
|
|
|
throw new Error('Unknown line ' + (i + 1) + ' ' + JSON.stringify(_line));
|
|
|
|
|
} else {
|
|
|
|
|
i++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Parses the --- and +++ headers, if none are found, no lines
|
|
|
|
|
// are consumed.
|
|
|
|
|
function parseFileHeader(index) {
|
|
|
|
|
var headerPattern = /^(---|\+\+\+)\s+([\S ]*)(?:\t(.*?)\s*)?$/;
|
|
|
|
|
var fileHeader = headerPattern.exec(diffstr[i]);
|
|
|
|
|
if (fileHeader) {
|
|
|
|
|
var keyPrefix = fileHeader[1] === '---' ? 'old' : 'new';
|
2017-08-14 05:01:11 +02:00
|
|
|
|
var fileName = fileHeader[2].replace(/\\\\/g, '\\');
|
|
|
|
|
if (/^".*"$/.test(fileName)) {
|
|
|
|
|
fileName = fileName.substr(1, fileName.length - 2);
|
|
|
|
|
}
|
|
|
|
|
index[keyPrefix + 'FileName'] = fileName;
|
2017-05-28 00:38:50 +02:00
|
|
|
|
index[keyPrefix + 'Header'] = fileHeader[3];
|
|
|
|
|
|
|
|
|
|
i++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 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: [],
|
|
|
|
|
linedelimiters: []
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
var addCount = 0,
|
|
|
|
|
removeCount = 0;
|
|
|
|
|
for (; i < diffstr.length; i++) {
|
|
|
|
|
// Lines starting with '---' could be mistaken for the "remove line" operation
|
|
|
|
|
// But they could be the header for the next file. Therefore prune such cases out.
|
|
|
|
|
if (diffstr[i].indexOf('--- ') === 0 && i + 2 < diffstr.length && diffstr[i + 1].indexOf('+++ ') === 0 && diffstr[i + 2].indexOf('@@') === 0) {
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
var operation = diffstr[i][0];
|
|
|
|
|
|
|
|
|
|
if (operation === '+' || operation === '-' || operation === ' ' || operation === '\\') {
|
|
|
|
|
hunk.lines.push(diffstr[i]);
|
|
|
|
|
hunk.linedelimiters.push(delimiters[i] || '\n');
|
|
|
|
|
|
|
|
|
|
if (operation === '+') {
|
|
|
|
|
addCount++;
|
|
|
|
|
} else if (operation === '-') {
|
|
|
|
|
removeCount++;
|
|
|
|
|
} else if (operation === ' ') {
|
|
|
|
|
addCount++;
|
|
|
|
|
removeCount++;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Handle the empty block count case
|
|
|
|
|
if (!addCount && hunk.newLines === 1) {
|
|
|
|
|
hunk.newLines = 0;
|
|
|
|
|
}
|
|
|
|
|
if (!removeCount && hunk.oldLines === 1) {
|
|
|
|
|
hunk.oldLines = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 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));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return hunk;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
while (i < diffstr.length) {
|
|
|
|
|
parseIndex();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return list;
|
|
|
|
|
}
|
2017-08-14 05:01:11 +02:00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*/"use strict";
|
|
|
|
|
|
|
|
|
|
exports.__esModule = true;
|
|
|
|
|
|
|
|
|
|
exports["default"] = /*istanbul ignore end*/function (start, minLine, maxLine) {
|
|
|
|
|
var wantForward = true,
|
|
|
|
|
backwardExhausted = false,
|
|
|
|
|
forwardExhausted = false,
|
|
|
|
|
localOffset = 1;
|
|
|
|
|
|
|
|
|
|
return function iterator() {
|
|
|
|
|
if (wantForward && !forwardExhausted) {
|
|
|
|
|
if (backwardExhausted) {
|
|
|
|
|
localOffset++;
|
|
|
|
|
} else {
|
|
|
|
|
wantForward = 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;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
forwardExhausted = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!backwardExhausted) {
|
|
|
|
|
if (!forwardExhausted) {
|
|
|
|
|
wantForward = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Check if trying to fit before text beginning, and if not, check it fits
|
|
|
|
|
// before offset location
|
|
|
|
|
if (minLine <= start - localOffset) {
|
|
|
|
|
return -localOffset++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
backwardExhausted = true;
|
|
|
|
|
return iterator();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// We tried to fit hunk before text beginning and beyond text lenght, then
|
|
|
|
|
// hunk can't fit on the text. Return undefined
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy91dGlsL2Rpc3RhbmNlLWl0ZXJhdG9yLmpzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7NENBR2UsVUFBUyxLQUFULEVBQWdCLE9B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ICAgIC8vIGJlZm9yZSBvZmZzZXQgbG9jYXRpb25cbiAgICAgIGlmIChtaW5MaW5lIDw9IHN0YXJ0IC0gbG9jYWxPZmZzZXQpIHtcbiAgICAgICAgcmV0dXJuIC1sb2NhbE9mZnNldCsrO1xuICAgICAgfVxuXG4gICAgICBiYWNrd2FyZEV4aGF1c3RlZCA9IHRydWU7XG4gICAgICByZXR1cm4gaXRlcmF0b3IoKTtcbiAgICB9XG5cbiAgICAvLyBXZSB0cmllZCB0byBmaXQgaHVuayBiZWZvcmUgdGV4dCBiZWdpbm5pbmcgYW5kIGJleW9uZCB0ZXh0IGxlbmdodCwgdGhlblxuICAgIC8vIGh1bmsgY2FuJ3QgZml0IG9uIHRoZSB0ZXh0LiBSZXR1cm4gdW5kZWZpbmVkXG4gIH07XG59XG4iXX0=
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ },
|
|
|
|
|
/* 13 */
|
|
|
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
/*istanbul ignore start*/'use strict';
|
|
|
|
|
|
2017-08-14 05:01:11 +02:00
|
|
|
|
exports.__esModule = true;
|
|
|
|
|
exports. /*istanbul ignore end*/calcLineCount = calcLineCount;
|
|
|
|
|
/*istanbul ignore start*/exports. /*istanbul ignore end*/merge = merge;
|
|
|
|
|
|
|
|
|
|
var /*istanbul ignore start*/_create = __webpack_require__(14) /*istanbul ignore end*/;
|
|
|
|
|
|
|
|
|
|
var /*istanbul ignore start*/_parse = __webpack_require__(11) /*istanbul ignore end*/;
|
|
|
|
|
|
|
|
|
|
var /*istanbul ignore start*/_array = __webpack_require__(15) /*istanbul ignore end*/;
|
|
|
|
|
|
|
|
|
|
/*istanbul ignore start*/
|
|
|
|
|
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); } }
|
|
|
|
|
|
|
|
|
|
/*istanbul ignore end*/function calcLineCount(hunk) {
|
|
|
|
|
var conflicted = false;
|
|
|
|
|
|
|
|
|
|
hunk.oldLines = 0;
|
|
|
|
|
hunk.newLines = 0;
|
|
|
|
|
|
|
|
|
|
hunk.lines.forEach(function (line) {
|
|
|
|
|
if (typeof line !== 'string') {
|
|
|
|
|
conflicted = true;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (line[0] === '+' || line[0] === ' ') {
|
|
|
|
|
hunk.newLines++;
|
|
|
|
|
}
|
|
|
|
|
if (line[0] === '-' || line[0] === ' ') {
|
|
|
|
|
hunk.oldLines++;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
if (conflicted) {
|
|
|
|
|
delete hunk.oldLines;
|
|
|
|
|
delete hunk.newLines;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function merge(mine, theirs, base) {
|
|
|
|
|
mine = loadPatch(mine, base);
|
|
|
|
|
theirs = loadPatch(theirs, base);
|
|
|
|
|
|
|
|
|
|
var ret = {};
|
|
|
|
|
|
|
|
|
|
// For index we just let it pass through as it doesn't have any necessary meaning.
|
|
|
|
|
// Leaving sanity checks on this to the API consumer that may know more about the
|
|
|
|
|
// meaning in their own context.
|
|
|
|
|
if (mine.index || theirs.index) {
|
|
|
|
|
ret.index = mine.index || theirs.index;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (mine.newFileName || theirs.newFileName) {
|
|
|
|
|
if (!fileNameChanged(mine)) {
|
|
|
|
|
// No header or no change in ours, use theirs (and ours if theirs does not exist)
|
|
|
|
|
ret.oldFileName = theirs.oldFileName || mine.oldFileName;
|
|
|
|
|
ret.newFileName = theirs.newFileName || mine.newFileName;
|
|
|
|
|
ret.oldHeader = theirs.oldHeader || mine.oldHeader;
|
|
|
|
|
ret.newHeader = theirs.newHeader || mine.newHeader;
|
|
|
|
|
} else if (!fileNameChanged(theirs)) {
|
|
|
|
|
// No header or no change in theirs, use ours
|
|
|
|
|
ret.oldFileName = mine.oldFileName;
|
|
|
|
|
ret.newFileName = mine.newFileName;
|
|
|
|
|
ret.oldHeader = mine.oldHeader;
|
|
|
|
|
ret.newHeader = mine.newHeader;
|
|
|
|
|
} else {
|
|
|
|
|
// Both changed... figure it out
|
|
|
|
|
ret.oldFileName = selectField(ret, mine.oldFileName, theirs.oldFileName);
|
|
|
|
|
ret.newFileName = selectField(ret, mine.newFileName, theirs.newFileName);
|
|
|
|
|
ret.oldHeader = selectField(ret, mine.oldHeader, theirs.oldHeader);
|
|
|
|
|
ret.newHeader = selectField(ret, mine.newHeader, theirs.newHeader);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ret.hunks = [];
|
|
|
|
|
|
|
|
|
|
var mineIndex = 0,
|
|
|
|
|
theirsIndex = 0,
|
|
|
|
|
mineOffset = 0,
|
|
|
|
|
theirsOffset = 0;
|
|
|
|
|
|
|
|
|
|
while (mineIndex < mine.hunks.length || theirsIndex < theirs.hunks.length) {
|
|
|
|
|
var mineCurrent = mine.hunks[mineIndex] || { oldStart: Infinity },
|
|
|
|
|
theirsCurrent = theirs.hunks[theirsIndex] || { oldStart: Infinity };
|
|
|
|
|
|
|
|
|
|
if (hunkBefore(mineCurrent, theirsCurrent)) {
|
|
|
|
|
// This patch does not overlap with any of the others, yay.
|
|
|
|
|
ret.hunks.push(cloneHunk(mineCurrent, mineOffset));
|
|
|
|
|
mineIndex++;
|
|
|
|
|
theirsOffset += mineCurrent.newLines - mineCurrent.oldLines;
|
|
|
|
|
} else if (hunkBefore(theirsCurrent, mineCurrent)) {
|
|
|
|
|
// This patch does not overlap with any of the others, yay.
|
|
|
|
|
ret.hunks.push(cloneHunk(theirsCurrent, theirsOffset));
|
|
|
|
|
theirsIndex++;
|
|
|
|
|
mineOffset += theirsCurrent.newLines - theirsCurrent.oldLines;
|
|
|
|
|
} else {
|
|
|
|
|
// Overlap, merge as best we can
|
|
|
|
|
var mergedHunk = {
|
|
|
|
|
oldStart: Math.min(mineCurrent.oldStart, theirsCurrent.oldStart),
|
|
|
|
|
oldLines: 0,
|
|
|
|
|
newStart: Math.min(mineCurrent.newStart + mineOffset, theirsCurrent.oldStart + theirsOffset),
|
|
|
|
|
newLines: 0,
|
|
|
|
|
lines: []
|
|
|
|
|
};
|
|
|
|
|
mergeLines(mergedHunk, mineCurrent.oldStart, mineCurrent.lines, theirsCurrent.oldStart, theirsCurrent.lines);
|
|
|
|
|
theirsIndex++;
|
|
|
|
|
mineIndex++;
|
|
|
|
|
|
|
|
|
|
ret.hunks.push(mergedHunk);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function loadPatch(param, base) {
|
|
|
|
|
if (typeof param === 'string') {
|
|
|
|
|
if (/^@@/m.test(param) || /^Index:/m.test(param)) {
|
|
|
|
|
return (/*istanbul ignore start*/(0, _parse.parsePatch) /*istanbul ignore end*/(param)[0]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!base) {
|
|
|
|
|
throw new Error('Must provide a base reference or pass in a patch');
|
|
|
|
|
}
|
|
|
|
|
return (/*istanbul ignore start*/(0, _create.structuredPatch) /*istanbul ignore end*/(undefined, undefined, base, param)
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return param;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function fileNameChanged(patch) {
|
|
|
|
|
return patch.newFileName && patch.newFileName !== patch.oldFileName;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function selectField(index, mine, theirs) {
|
|
|
|
|
if (mine === theirs) {
|
|
|
|
|
return mine;
|
|
|
|
|
} else {
|
|
|
|
|
index.conflict = true;
|
|
|
|
|
return { mine: mine, theirs: theirs };
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function hunkBefore(test, check) {
|
|
|
|
|
return test.oldStart < check.oldStart && test.oldStart + test.oldLines < check.oldStart;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function cloneHunk(hunk, offset) {
|
|
|
|
|
return {
|
|
|
|
|
oldStart: hunk.oldStart, oldLines: hunk.oldLines,
|
|
|
|
|
newStart: hunk.newStart + offset, newLines: hunk.newLines,
|
|
|
|
|
lines: hunk.lines
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function mergeLines(hunk, mineOffset, mineLines, theirOffset, theirLines) {
|
|
|
|
|
// This will generally result in a conflicted hunk, but there are cases where the context
|
|
|
|
|
// is the only overlap where we can successfully merge the content here.
|
|
|
|
|
var mine = { offset: mineOffset, lines: mineLines, index: 0 },
|
|
|
|
|
their = { offset: theirOffset, lines: theirLines, index: 0 };
|
|
|
|
|
|
|
|
|
|
// Handle any leading content
|
|
|
|
|
insertLeading(hunk, mine, their);
|
|
|
|
|
insertLeading(hunk, their, mine);
|
|
|
|
|
|
|
|
|
|
// Now in the overlap content. Scan through and select the best changes from each.
|
|
|
|
|
while (mine.index < mine.lines.length && their.index < their.lines.length) {
|
|
|
|
|
var mineCurrent = mine.lines[mine.index],
|
|
|
|
|
theirCurrent = their.lines[their.index];
|
|
|
|
|
|
|
|
|
|
if ((mineCurrent[0] === '-' || mineCurrent[0] === '+') && (theirCurrent[0] === '-' || theirCurrent[0] === '+')) {
|
|
|
|
|
// Both modified ...
|
|
|
|
|
mutualChange(hunk, mine, their);
|
|
|
|
|
} else if (mineCurrent[0] === '+' && theirCurrent[0] === ' ') {
|
|
|
|
|
/*istanbul ignore start*/
|
|
|
|
|
var _hunk$lines;
|
|
|
|
|
|
|
|
|
|
/*istanbul ignore end*/
|
|
|
|
|
// Mine inserted
|
|
|
|
|
/*istanbul ignore start*/(_hunk$lines = /*istanbul ignore end*/hunk.lines).push. /*istanbul ignore start*/apply /*istanbul ignore end*/( /*istanbul ignore start*/_hunk$lines /*istanbul ignore end*/, /*istanbul ignore start*/_toConsumableArray( /*istanbul ignore end*/collectChange(mine)));
|
|
|
|
|
} else if (theirCurrent[0] === '+' && mineCurrent[0] === ' ') {
|
|
|
|
|
/*istanbul ignore start*/
|
|
|
|
|
var _hunk$lines2;
|
|
|
|
|
|
|
|
|
|
/*istanbul ignore end*/
|
|
|
|
|
// Theirs inserted
|
|
|
|
|
/*istanbul ignore start*/(_hunk$lines2 = /*istanbul ignore end*/hunk.lines).push. /*istanbul ignore start*/apply /*istanbul ignore end*/( /*istanbul ignore start*/_hunk$lines2 /*istanbul ignore end*/, /*istanbul ignore start*/_toConsumableArray( /*istanbul ignore end*/collectChange(their)));
|
|
|
|
|
} else if (mineCurrent[0] === '-' && theirCurrent[0] === ' ') {
|
|
|
|
|
// Mine removed or edited
|
|
|
|
|
removal(hunk, mine, their);
|
|
|
|
|
} else if (theirCurrent[0] === '-' && mineCurrent[0] === ' ') {
|
|
|
|
|
// Their removed or edited
|
|
|
|
|
removal(hunk, their, mine, true);
|
|
|
|
|
} else if (mineCurrent === theirCurrent) {
|
|
|
|
|
// Context identity
|
|
|
|
|
hunk.lines.push(mineCurrent);
|
|
|
|
|
mine.index++;
|
|
|
|
|
their.index++;
|
|
|
|
|
} else {
|
|
|
|
|
// Context mismatch
|
|
|
|
|
conflict(hunk, collectChange(mine), collectChange(their));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Now push anything that may be remaining
|
|
|
|
|
insertTrailing(hunk, mine);
|
|
|
|
|
insertTrailing(hunk, their);
|
|
|
|
|
|
|
|
|
|
calcLineCount(hunk);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function mutualChange(hunk, mine, their) {
|
|
|
|
|
var myChanges = collectChange(mine),
|
|
|
|
|
theirChanges = collectChange(their);
|
|
|
|
|
|
|
|
|
|
if (allRemoves(myChanges) && allRemoves(theirChanges)) {
|
|
|
|
|
// Special case for remove changes that are supersets of one another
|
|
|
|
|
if ( /*istanbul ignore start*/(0, _array.arrayStartsWith) /*istanbul ignore end*/(myChanges, theirChanges) && skipRemoveSuperset(their, myChanges, myChanges.length - theirChanges.length)) {
|
|
|
|
|
/*istanbul ignore start*/
|
|
|
|
|
var _hunk$lines3;
|
|
|
|
|
|
|
|
|
|
/*istanbul ignore end*/
|
|
|
|
|
/*istanbul ignore start*/(_hunk$lines3 = /*istanbul ignore end*/hunk.lines).push. /*istanbul ignore start*/apply /*istanbul ignore end*/( /*istanbul ignore start*/_hunk$lines3 /*istanbul ignore end*/, /*istanbul ignore start*/_toConsumableArray( /*istanbul ignore end*/myChanges));
|
|
|
|
|
return;
|
|
|
|
|
} else if ( /*istanbul ignore start*/(0, _array.arrayStartsWith) /*istanbul ignore end*/(theirChanges, myChanges) && skipRemoveSuperset(mine, theirChanges, theirChanges.length - myChanges.length)) {
|
|
|
|
|
/*istanbul ignore start*/
|
|
|
|
|
var _hunk$lines4;
|
|
|
|
|
|
|
|
|
|
/*istanbul ignore end*/
|
|
|
|
|
/*istanbul ignore start*/(_hunk$lines4 = /*istanbul ignore end*/hunk.lines).push. /*istanbul ignore start*/apply /*istanbul ignore end*/( /*istanbul ignore start*/_hunk$lines4 /*istanbul ignore end*/, /*istanbul ignore start*/_toConsumableArray( /*istanbul ignore end*/theirChanges));
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
} else if ( /*istanbul ignore start*/(0, _array.arrayEqual) /*istanbul ignore end*/(myChanges, theirChanges)) {
|
|
|
|
|
/*istanbul ignore start*/
|
|
|
|
|
var _hunk$lines5;
|
|
|
|
|
|
|
|
|
|
/*istanbul ignore end*/
|
|
|
|
|
/*istanbul ignore start*/(_hunk$lines5 = /*istanbul ignore end*/hunk.lines).push. /*istanbul ignore start*/apply /*istanbul ignore end*/( /*istanbul ignore start*/_hunk$lines5 /*istanbul ignore end*/, /*istanbul ignore start*/_toConsumableArray( /*istanbul ignore end*/myChanges));
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
conflict(hunk, myChanges, theirChanges);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function removal(hunk, mine, their, swap) {
|
|
|
|
|
var myChanges = collectChange(mine),
|
|
|
|
|
theirChanges = collectContext(their, myChanges);
|
|
|
|
|
if (theirChanges.merged) {
|
|
|
|
|
/*istanbul ignore start*/
|
|
|
|
|
var _hunk$lines6;
|
|
|
|
|
|
|
|
|
|
/*istanbul ignore end*/
|
|
|
|
|
/*istanbul ignore start*/(_hunk$lines6 = /*istanbul ignore end*/hunk.lines).push. /*istanbul ignore start*/apply /*istanbul ignore end*/( /*istanbul ignore start*/_hunk$lines6 /*istanbul ignore end*/, /*istanbul ignore start*/_toConsumableArray( /*istanbul ignore end*/theirChanges.merged));
|
|
|
|
|
} else {
|
|
|
|
|
conflict(hunk, swap ? theirChanges : myChanges, swap ? myChanges : theirChanges);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function conflict(hunk, mine, their) {
|
|
|
|
|
hunk.conflict = true;
|
|
|
|
|
hunk.lines.push({
|
|
|
|
|
conflict: true,
|
|
|
|
|
mine: mine,
|
|
|
|
|
theirs: their
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function insertLeading(hunk, insert, their) {
|
|
|
|
|
while (insert.offset < their.offset && insert.index < insert.lines.length) {
|
|
|
|
|
var line = insert.lines[insert.index++];
|
|
|
|
|
hunk.lines.push(line);
|
|
|
|
|
insert.offset++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
function insertTrailing(hunk, insert) {
|
|
|
|
|
while (insert.index < insert.lines.length) {
|
|
|
|
|
var line = insert.lines[insert.index++];
|
|
|
|
|
hunk.lines.push(line);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function collectChange(state) {
|
|
|
|
|
var ret = [],
|
|
|
|
|
operation = state.lines[state.index][0];
|
|
|
|
|
while (state.index < state.lines.length) {
|
|
|
|
|
var line = state.lines[state.index];
|
|
|
|
|
|
|
|
|
|
// Group additions that are immediately after subtractions and treat them as one "atomic" modify change.
|
|
|
|
|
if (operation === '-' && line[0] === '+') {
|
|
|
|
|
operation = '+';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (operation === line[0]) {
|
|
|
|
|
ret.push(line);
|
|
|
|
|
state.index++;
|
|
|
|
|
} else {
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
function collectContext(state, matchChanges) {
|
|
|
|
|
var changes = [],
|
|
|
|
|
merged = [],
|
|
|
|
|
matchIndex = 0,
|
|
|
|
|
contextChanges = false,
|
|
|
|
|
conflicted = false;
|
|
|
|
|
while (matchIndex < matchChanges.length && state.index < state.lines.length) {
|
|
|
|
|
var change = state.lines[state.index],
|
|
|
|
|
match = matchChanges[matchIndex];
|
|
|
|
|
|
|
|
|
|
// Once we've hit our add, then we are done
|
|
|
|
|
if (match[0] === '+') {
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
contextChanges = contextChanges || change[0] !== ' ';
|
|
|
|
|
|
|
|
|
|
merged.push(match);
|
|
|
|
|
matchIndex++;
|
|
|
|
|
|
|
|
|
|
// Consume any additions in the other block as a conflict to attempt
|
|
|
|
|
// to pull in the remaining context after this
|
|
|
|
|
if (change[0] === '+') {
|
|
|
|
|
conflicted = true;
|
|
|
|
|
|
|
|
|
|
while (change[0] === '+') {
|
|
|
|
|
changes.push(change);
|
|
|
|
|
change = state.lines[++state.index];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (match.substr(1) === change.substr(1)) {
|
|
|
|
|
changes.push(change);
|
|
|
|
|
state.index++;
|
|
|
|
|
} else {
|
|
|
|
|
conflicted = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ((matchChanges[matchIndex] || '')[0] === '+' && contextChanges) {
|
|
|
|
|
conflicted = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (conflicted) {
|
|
|
|
|
return changes;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
while (matchIndex < matchChanges.length) {
|
|
|
|
|
merged.push(matchChanges[matchIndex++]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
merged: merged,
|
|
|
|
|
changes: changes
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function allRemoves(changes) {
|
|
|
|
|
return changes.reduce(function (prev, change) {
|
|
|
|
|
return prev && change[0] === '-';
|
|
|
|
|
}, true);
|
|
|
|
|
}
|
|
|
|
|
function skipRemoveSuperset(state, removeChanges, delta) {
|
|
|
|
|
for (var i = 0; i < delta; i++) {
|
|
|
|
|
var changeContent = removeChanges[removeChanges.length - delta + i].substr(1);
|
|
|
|
|
if (state.lines[state.index + i] !== ' ' + changeContent) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
state.index += delta;
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9wYXRjaC9tZXJnZS5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Z0NBS2dCLGEsR0FBQSxhO3lEQTBCQSxLLEdBQUEsSzs7QUEvQmhCLEkseUJBQUEsNkIsd0JBQUE7O0FBQ0EsSSx5QkFBQSwyQix3QkFBQTs7QUFFQSxJLHlCQUFBLGlDLHdCQUFBOzs7Ozt1QkFFTyxTQUFTLGFBQVQsQ0FBdUIsSUFBdkIsRUFBNkI7QUFDbEMsTUFBSSxhQUFhLEtBQWpCOztBQUVBLE9BQUssUUFBTCxHQUFnQixDQUFoQjtBQUNBLE9BQUssUUFBTCxHQUFnQixDQUFoQjs7QUFFQSxPQU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QUVELFNBQVMsU0FBVCxDQUFtQixLQUFuQixFQUEwQixJQUExQixFQUFnQztBQUM5QixNQUFJLE9BQU8sS0FBUCxLQUFpQixRQUFyQixFQUErQjtBQUM3QixRQUFJLE9BQU8sSUFBUCxDQUFZLEtBQVosS0FBdUIsV0FBVyxJQUFYLENBQWdCLEtBQWhCLENBQTNCLEVBQW9EO0FBQ2xELGEsMEJBQU8sc0Isd0JBQUEsQ0FBVyxLQUFYLEVBQWtCLENBQWxCO0FBQVA7QUFDRDs7QUFFRCxRQUFJLENBQUMsSUFBTCxFQUFXO0FBQ1QsWUFBTSxJQUFJLEtBQUosQ0FBVSxrREFBVixDQUFOO0FBQ0Q7QUFDRCxXLDBCQUFPLDRCLHdCQUFBLENBQWdCLFNBQWhCLEVBQTJCLFNBQTNCLEVBQXNDLElBQXRDLEVBQTRDLEtBQTVDO0FBQVA7QUFD
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ },
|
|
|
|
|
/* 14 */
|
|
|
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
/*istanbul ignore start*/'use strict';
|
|
|
|
|
|
2017-05-28 00:38:50 +02:00
|
|
|
|
exports.__esModule = true;
|
|
|
|
|
exports. /*istanbul ignore end*/structuredPatch = structuredPatch;
|
|
|
|
|
/*istanbul ignore start*/exports. /*istanbul ignore end*/createTwoFilesPatch = createTwoFilesPatch;
|
|
|
|
|
/*istanbul ignore start*/exports. /*istanbul ignore end*/createPatch = createPatch;
|
|
|
|
|
|
|
|
|
|
var /*istanbul ignore start*/_line = __webpack_require__(5) /*istanbul ignore end*/;
|
|
|
|
|
|
|
|
|
|
/*istanbul ignore start*/
|
|
|
|
|
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); } }
|
|
|
|
|
|
|
|
|
|
/*istanbul ignore end*/function structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options) {
|
|
|
|
|
if (!options) {
|
|
|
|
|
options = {};
|
|
|
|
|
}
|
|
|
|
|
if (typeof options.context === 'undefined') {
|
|
|
|
|
options.context = 4;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var diff = /*istanbul ignore start*/(0, _line.diffLines) /*istanbul ignore end*/(oldStr, newStr, options);
|
|
|
|
|
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;
|
|
|
|
|
/*istanbul ignore start*/
|
|
|
|
|
var _loop = function _loop( /*istanbul ignore end*/i) {
|
|
|
|
|
var current = diff[i],
|
|
|
|
|
lines = current.lines || current.value.replace(/\n$/, '').split('\n');
|
|
|
|
|
current.lines = lines;
|
|
|
|
|
|
|
|
|
|
if (current.added || current.removed) {
|
|
|
|
|
/*istanbul ignore start*/
|
|
|
|
|
var _curRange;
|
|
|
|
|
|
|
|
|
|
/*istanbul ignore end*/
|
|
|
|
|
// 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;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Output our changes
|
|
|
|
|
/*istanbul ignore start*/(_curRange = /*istanbul ignore end*/curRange).push. /*istanbul ignore start*/apply /*istanbul ignore end*/( /*istanbul ignore start*/_curRange /*istanbul ignore end*/, /*istanbul ignore start*/_toConsumableArray( /*istanbul ignore end*/lines.map(function (entry) {
|
|
|
|
|
return (current.added ? '+' : '-') + entry;
|
|
|
|
|
})));
|
|
|
|
|
|
|
|
|
|
// 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 <= options.context * 2 && i < diff.length - 2) {
|
|
|
|
|
/*istanbul ignore start*/
|
|
|
|
|
var _curRange2;
|
|
|
|
|
|
|
|
|
|
/*istanbul ignore end*/
|
|
|
|
|
// Overlapping
|
|
|
|
|
/*istanbul ignore start*/(_curRange2 = /*istanbul ignore end*/curRange).push. /*istanbul ignore start*/apply /*istanbul ignore end*/( /*istanbul ignore start*/_curRange2 /*istanbul ignore end*/, /*istanbul ignore start*/_toConsumableArray( /*istanbul ignore end*/contextLines(lines)));
|
|
|
|
|
} else {
|
|
|
|
|
/*istanbul ignore start*/
|
|
|
|
|
var _curRange3;
|
|
|
|
|
|
|
|
|
|
/*istanbul ignore end*/
|
|
|
|
|
// end the range and output
|
|
|
|
|
var contextSize = Math.min(lines.length, options.context);
|
|
|
|
|
/*istanbul ignore start*/(_curRange3 = /*istanbul ignore end*/curRange).push. /*istanbul ignore start*/apply /*istanbul ignore end*/( /*istanbul ignore start*/_curRange3 /*istanbul ignore end*/, /*istanbul ignore start*/_toConsumableArray( /*istanbul ignore end*/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);
|
|
|
|
|
|
|
|
|
|
oldRangeStart = 0;
|
|
|
|
|
newRangeStart = 0;
|
|
|
|
|
curRange = [];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
oldLine += lines.length;
|
|
|
|
|
newLine += lines.length;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
for (var i = 0; i < diff.length; i++) {
|
|
|
|
|
/*istanbul ignore start*/
|
|
|
|
|
_loop( /*istanbul ignore end*/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);
|
|
|
|
|
|
|
|
|
|
var ret = [];
|
|
|
|
|
if (oldFileName == newFileName) {
|
|
|
|
|
ret.push('Index: ' + oldFileName);
|
|
|
|
|
}
|
|
|
|
|
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,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9wYXRjaC9jcmVhdGUuanMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O2dDQUVnQixlLEdBQUEsZTt5REFpR0EsbUIsR0FBQSxtQjt5REF3QkEsVyxHQUFBLFc7O0FBM0hoQixJLHlCQUFBLCtCLHdCQUFBOzs7Ozt1QkFFTyxTQUFTLGVBQVQsQ0FBeUIsV0FBekIsRUFBc0MsV0FBdEMsRUFBbUQsTUFBbkQsRUFBMkQsTUFBM0QsRUFBbUUsU0FBbkUsRUFBOEUsU0FBOUUsRUFBeUYsT0FBekYsRUFBa0c7QUFDdkcsTUFBSSxDQUFDLE9BQUwsRUFBYztBQUNaLGNBQVUsRUFBVjtBQUNEO0FBQ0QsTUFBSSxPQUFPLFFBQVEsT0FBZixLQUEyQixXQUEvQixFQUE0QztBQUMxQyxZQUFRLE9BQ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QSxVLHdCQUE3QixDQUE2QjtBQXNFckM7O0FBRUQsU0FBTztBQUNMLGlCQUFhLFdBRFIsRUFDcUIsYUFBYSxXQURsQztBQUVMLGVBQVcsU0FGTixFQUVpQixXQUFXLFNBRjVCO0FBR0wsV0FBTztBQUhGLEdBQVA7QUFLRDs7QUFFTSxTQUFTLG1CQUFULENBQTZCLFdBQTdCLEVBQTBDLFdBQTFDLEVBQXVELE1BQXZELEVBQStELE1BQS9ELEVBQXVFLFNBQXZFLEVBQWtGLFNBQWxGLEVBQTZGLE9BQTdGLEVBQXNHO0FBQzNHLE1BQU0sT0FBTyxnQkFBZ0IsV0FBaEIsRUFBNkIsV0FBN0IsRUFBMEMsTUFBMUMsRUFBa0QsTUFBbEQsRUFBMEQsU0FB
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ },
|
2017-08-14 05:01:11 +02:00
|
|
|
|
/* 15 */
|
|
|
|
|
/***/ function(module, exports) {
|
|
|
|
|
|
|
|
|
|
/*istanbul ignore start*/"use strict";
|
|
|
|
|
|
|
|
|
|
exports.__esModule = true;
|
|
|
|
|
exports. /*istanbul ignore end*/arrayEqual = arrayEqual;
|
|
|
|
|
/*istanbul ignore start*/exports. /*istanbul ignore end*/arrayStartsWith = arrayStartsWith;
|
|
|
|
|
function arrayEqual(a, b) {
|
|
|
|
|
if (a.length !== b.length) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return arrayStartsWith(a, b);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function arrayStartsWith(array, start) {
|
|
|
|
|
if (start.length > array.length) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (var i = 0; i < start.length; i++) {
|
|
|
|
|
if (start[i] !== array[i]) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
//# sourceMappingURL=data:application/json;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uZ3RoKSB7XG4gICAgcmV0dXJuIGZhbHNlO1xuICB9XG5cbiAgZm9yIChsZXQgaSA9IDA7IGkgPCBzdGFydC5sZW5ndGg7IGkrKykge1xuICAgIGlmIChzdGFydFtpXSAhPT0gYXJyYXlbaV0pIHtcbiAgICAgIHJldHVybiBmYWxzZTtcbiAgICB9XG4gIH1cblxuICByZXR1cm4gdHJ1ZTtcbn1cbiJdfQ==
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ },
|
|
|
|
|
/* 16 */
|
2017-05-28 00:38:50 +02:00
|
|
|
|
/***/ function(module, exports) {
|
|
|
|
|
|
|
|
|
|
/*istanbul ignore start*/"use strict";
|
|
|
|
|
|
|
|
|
|
exports.__esModule = true;
|
|
|
|
|
exports. /*istanbul ignore end*/convertChangesToDMP = convertChangesToDMP;
|
|
|
|
|
// See: http://code.google.com/p/google-diff-match-patch/wiki/API
|
|
|
|
|
function convertChangesToDMP(changes) {
|
|
|
|
|
var ret = [],
|
|
|
|
|
change = /*istanbul ignore start*/void 0 /*istanbul ignore end*/,
|
|
|
|
|
operation = /*istanbul ignore start*/void 0 /*istanbul ignore end*/;
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9jb252ZXJ0L2RtcC5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Z0NBQ2dCLG1CLEdBQUEsbUI7O0FBQVQsU0FBUyxtQkFBVCxDQUE2QixPQUE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iAgICB9XG5cbiAgICByZXQucHVzaChbb3BlcmF0aW9uLCBjaGFuZ2UudmFsdWVdKTtcbiAgfVxuICByZXR1cm4gcmV0O1xufVxuIl19
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***/ },
|
2017-08-14 05:01:11 +02:00
|
|
|
|
/* 17 */
|
2017-05-28 00:38:50 +02:00
|
|
|
|
/***/ function(module, exports) {
|
|
|
|
|
|
|
|
|
|
/*istanbul ignore start*/'use strict';
|
|
|
|
|
|
|
|
|
|
exports.__esModule = true;
|
|
|
|
|
exports. /*istanbul ignore end*/convertChangesToXML = convertChangesToXML;
|
|
|
|
|
function convertChangesToXML(changes) {
|
|
|
|
|
var ret = [];
|
|
|
|
|
for (var i = 0; i < changes.length; i++) {
|
|
|
|
|
var change = changes[i];
|
|
|
|
|
if (change.added) {
|
|
|
|
|
ret.push('<ins>');
|
|
|
|
|
} else if (change.removed) {
|
|
|
|
|
ret.push('<del>');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ret.push(escapeHTML(change.value));
|
|
|
|
|
|
|
|
|
|
if (change.added) {
|
|
|
|
|
ret.push('</ins>');
|
|
|
|
|
} else if (change.removed) {
|
|
|
|
|
ret.push('</del>');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return ret.join('');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function escapeHTML(s) {
|
|
|
|
|
var n = s;
|
|
|
|
|
n = n.replace(/&/g, '&');
|
|
|
|
|
n = n.replace(/</g, '<');
|
|
|
|
|
n = n.replace(/>/g, '>');
|
|
|
|
|
n = n.replace(/"/g, '"');
|
|
|
|
|
|
|
|
|
|
return n;
|
|
|
|
|
}
|
|
|
|
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9jb252ZXJ0L3htbC5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Z0NBQWdCLG1CLEdBQUE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