1338 lines
116 KiB
JavaScript
1338 lines
116 KiB
JavaScript
|
/*!
|
|||
|
|
|||
|
diff v2.2.2
|
|||
|
|
|||
|
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;
|
|||
|
exports.canonicalize = exports.convertChangesToXML = exports.convertChangesToDMP = exports.parsePatch = exports.applyPatches = exports.applyPatch = exports.createPatch = exports.createTwoFilesPatch = exports.structuredPatch = exports.diffJson = exports.diffCss = exports.diffSentences = exports.diffTrimmedLines = exports.diffLines = exports.diffWordsWithSpace = exports.diffWords = exports.diffChars = exports.Diff = undefined;
|
|||
|
/*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*/_apply = __webpack_require__(9) /*istanbul ignore end*/;
|
|||
|
|
|||
|
var /*istanbul ignore start*/_parse = __webpack_require__(10) /*istanbul ignore end*/;
|
|||
|
|
|||
|
var /*istanbul ignore start*/_create = __webpack_require__(12) /*istanbul ignore end*/;
|
|||
|
|
|||
|
var /*istanbul ignore start*/_dmp = __webpack_require__(13) /*istanbul ignore end*/;
|
|||
|
|
|||
|
var /*istanbul ignore start*/_xml = __webpack_require__(14) /*istanbul ignore end*/;
|
|||
|
|
|||
|
/*istanbul ignore start*/
|
|||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|||
|
|
|||
|
/* See LICENSE file for terms of use */
|
|||
|
|
|||
|
/*
|
|||
|
* Text diff implementation.
|
|||
|
*
|
|||
|
* This library supports the following APIS:
|
|||
|
* JsDiff.diffChars: Character by character diff
|
|||
|
* JsDiff.diffWords: Word (as defined by \b regex) diff which ignores whitespace
|
|||
|
* JsDiff.diffLines: Line based diff
|
|||
|
*
|
|||
|
* JsDiff.diffCss: Diff targeted at CSS content
|
|||
|
*
|
|||
|
* These methods are based on the implementation proposed in
|
|||
|
* "An O(ND) Difference Algorithm and its Variations" (Myers, 1986).
|
|||
|
* http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.4.6927
|
|||
|
*/
|
|||
|
exports. /*istanbul ignore end*/Diff = _base2.default;
|
|||
|
/*istanbul ignore start*/exports. /*istanbul ignore end*/diffChars = _character.diffChars;
|
|||
|
/*istanbul ignore start*/exports. /*istanbul ignore end*/diffWords = _word.diffWords;
|
|||
|
/*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*/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;
|
|||
|
/*istanbul ignore start*/exports. /*istanbul ignore end*/convertChangesToDMP = _dmp.convertChangesToDMP;
|
|||
|
/*istanbul ignore start*/exports. /*istanbul ignore end*/convertChangesToXML = _xml.convertChangesToXML;
|
|||
|
/*istanbul ignore start*/exports. /*istanbul ignore end*/canonicalize = _json.canonicalize;
|
|||
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9pbmRleC5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7OztBQWdCQTs7Ozs7O0FBQ0E7O0FBQ0E7O0FBQ0E7O0FBQ0E7O0FBRUE7O0FBQ0E7O0FBRUE7O0FBQ0E7O0FBQ0E7O0FBRUE7O0FBQ0E7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7OztnQ0FHRTt5REFFQTt5REFDQTt5REFDQTt5REFDQTt5REFDQTt5REFDQTt5REFFQTt5REFDQTt5REFFQTt5REFDQTt5REFDQTt5REFDQTt5REFDQTt5REFDQTt5REFDQTt5REFDQTt5REFDQSIsImZpbGUiOiJpbmRleC5qcyIsInNvdXJjZXNDb250ZW50IjpbIi8qIFNlZSBMSUNFTlNFIGZpbGUgZm9yIHRlcm1zIG9mIHVzZSAqL1xuXG4vKlxuICogVGV4dCBkaWZmIGltcGxlbWVudGF0aW9uLlxuICpcbiAqIFRoaXMgbGlicmFyeSBzdXBwb3J0cyB0aGUgZm9sbG93aW5nIEFQSVM6XG4gKiBKc0RpZmYuZGlmZkNoYXJzOiBDaGFyYWN0ZXIgYnkgY2hhcmFjdGVyIGRpZmZcbiAqIEpzRGlmZi5kaWZ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3BhcnNlJztcbmltcG9ydCB7c3RydWN0dXJlZFBhdGNoLCBjcmVhdGVUd29GaWxlc1BhdGNoLCBjcmVhdGVQYXRjaH0gZnJvbSAnLi9wYXRjaC9jcmVhdGUnO1xuXG5pbXBvcnQge2NvbnZlcnRDaGFuZ2VzVG9ETVB9IGZyb20gJy4vY29udmVydC9kbXAnO1xuaW1wb3J0IHtjb252ZXJ0Q2hhbmdlc1RvWE1MfSBmcm9tICcuL2NvbnZlcnQveG1sJztcblxuZXhwb3J0IHtcbiAgRGlmZixcblxuICBkaWZmQ2hhcnMsXG4gIGRpZmZXb3JkcyxcbiAgZGlmZldvcmRzV2l0aFNwYWNlLFxuICBkaWZmTGluZXMsXG4gIGRpZmZUcmltbWVkTGluZXMsXG4gIGRpZmZTZW50ZW5jZXMsXG5cbiAgZGlmZkNzcyxcbiAgZGlmZkpzb24sXG5cbiAgc3RydWN0dXJlZFBhdGNoLFxuICBjcmVhdGVUd29GaWxlc1BhdGNoLFxuICBjcmVhdGVQYXRjaCxcbiAgYXBwbHlQYXRjaCxcbiAgYXBwbHlQYXRjaGVzLFxuICBwYXJzZVBhdGNoLFxuICBjb252ZXJ0Q2hhbmdlc1RvRE1QLFxuICBjb252ZXJ0Q2hhbmdlc1RvWE1MLFxuICBjYW5vbmljYWxpemVcbn07XG4iXX0=
|
|||
|
|
|||
|
|
|||
|
/***/ },
|
|||
|
/* 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: 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 = /*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) {
|
|||
|
return left === right;
|
|||
|
},
|
|||
|
/*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('');
|
|||
|
}
|
|||
|
};
|
|||
|
|
|||
|
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;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
// 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) };
|
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
|||
|
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*/;
|
|||
|
function diffChars(oldStr, newStr, callback) {
|
|||
|
return characterDiff.diff(oldStr, newStr, callback);
|
|||
|
}
|
|||
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9kaWZmL2NoYXJhY3Rlci5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7O2dDQUdnQjs7QUFIaEI7Ozs7Ozs7dUJBRU8sSUFBTSx5RkFBZ0IscUVBQWhCO0FBQ04sU0FBUyxTQUFULENBQW1CLE1BQW5CLEVBQTJCLE1BQTNCLEVBQW1DLFFBQW5DLEVBQTZDO0FBQUUsU0FBTyxjQUFjLElBQWQsQ0FBbUIsTUFBbkIsRUFBMkIsTUFBM0IsRUFBbUMsUUFBbkMsQ0FBUCxDQUFGO0NBQTdDIiwiZmlsZSI6ImNoYXJhY3Rlci5qcyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCBEaWZmIGZyb20gJy4vYmFzZSc7XG5cbmV4cG9ydCBjb25zdCBjaGFyYWN0ZXJEaWZmID0gbmV3IERpZmYoKTtcbmV4cG9ydCBmdW5jdGlvbiBkaWZmQ2hhcnMob2xkU3RyLCBuZXdTdHIsIGNhbGxiYWNrKSB7IHJldHVybiBjaGFyYWN0ZXJEaWZmLmRpZmYob2xkU3RyLCBuZXdTdHIsIGNhbGxiYWNrKTsgfVxuIl19
|
|||
|
|
|||
|
|
|||
|
/***/ },
|
|||
|
/* 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) {
|
|||
|
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;
|
|||
|
};
|
|||
|
|
|||
|
function diffWords(oldStr, newStr, callback) {
|
|||
|
var options = /*istanbul ignore start*/(0, _params.generateOptions) /*istanbul ignore end*/(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,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9kaWZmL3dvcmQuanMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7OztnQ0ErQ2dCO3lEQUlBOztBQW5EaEI7Ozs7OztBQUNBOzs7Ozs7Ozs7Ozs7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hlIGV4dGVuZGVkIExhdGluIGNoYXJhY3RlciBzZXQuXG4gIGZvciAobGV0IGkgPSAwOyBpIDwgdG9rZW5zLmxlbmd0aCAtIDE7IGkrKykge1xuICAgIC8vIElmIHdlIGhhdmUgYW4gZW1wdHkgc3RyaW5nIGluIHRoZSBuZXh0IGZpZWxkIGFuZCB3ZSBoYXZlIG9ubHkgd29yZCBjaGFycyBiZWZvcmUgYW5kIGFmdGVyLCBtZXJnZVxuICAgIGlmICghdG9rZW5zW2kgKyAxXSAmJiB0b2tlbnNbaSArIDJdXG4gICAgICAgICAgJiYgZXh0ZW5kZWRXb3JkQ2hhcnMudGVzdCh0b2tlbnNbaV0pXG4gICAgICAgICAgJiYgZXh0ZW5kZWRXb3JkQ2hhcnMudGVzdCh0b2tlbnNbaSArIDJdKSkge1xuICAgICAgdG9rZW5zW2ldICs9IHRva2Vuc1tpICsgMl07XG4gICAgICB0b2tlbnMuc3BsaWNlKGkgKyAxLCAyKTtcbiAgICAgIGktLTtcbiAgICB9XG4gIH1cblxuICByZXR1cm4gdG9rZW5zO1xufTtcblxuZXhwb3J0IGZ1bmN0aW9uIGRpZmZXb3JkcyhvbGRTdHIsIG5ld1N0ciwgY2FsbGJhY2spIHtcbiAgbGV0IG9wdGlvbnMgPSBnZW5lcmF0ZU9wdGlvbnMo
|
|||
|
|
|||
|
|
|||
|
/***/ },
|
|||
|
/* 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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x0cztcbn1cbiJdfQ==
|
|||
|
|
|||
|
|
|||
|
/***/ },
|
|||
|
/* 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,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9kaWZmL2xpbmUuanMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7OztnQ0E4QmdCO3lEQUNBOztBQS9CaEI7Ozs7OztBQUNBOzs7Ozt1QkFFTyxJQUFNLCtFQUFXLHFFQUFYO0FBQ2IsU0FBUyxRQUFULEdBQW9CLFVBQVMsS0FBVCxFQUFnQjtBQUNsQyxNQUFJLFdBQVcsRUFBWDtNQUNBLG1CQUFtQixNQUFNLEtBQU4sQ0FBWSxXQUFaLENBQW5COzs7QUFGOEIsTUFLOUIsQ0FBQyxpQkFBaUIsaUJBQWlCLE1BQWpCLEdBQTBCLENBQTFCLENBQWxCLEVBQWdEO0FBQ2xELHFCQUFpQixHQUFqQixHQURrRDtHQUFwRDs7O0FBTGtDLE9BVTdCLElBQUksSUFBSSxDQUFKLEVBQU8sSUFBSSxpQkFBaUIsTUFBakIsRUFBeUIsR0FBN0MsRUFBa0Q7QUFDaEQsUUFBSSxPQUFPLGlCQUFpQixDQUFqQixDQUFQLENBRDRDOztBQUdoRCxRQUFJLElBQUksQ0FBSixJQUFTLENBQUMsS0FBSyxPQUFMLENBQWEsY0FBYixFQUE2QjtBQUN6QyxlQUFTLFNBQVMsTUFBVCxHQUFrQixDQUFsQixDQUFULElBQWlDLElBQWpDLENBRHlDO0tBQTNDLE1BRU87QUFDTCxVQUFJLEtBQUssT0FBTCxDQUFhLGdCQUFi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||
|
|
|||
|
|
|||
|
/***/ },
|
|||
|
/* 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) {
|
|||
|
return sentenceDiff.diff(oldStr, newStr, callback);
|
|||
|
}
|
|||
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9kaWZmL3NlbnRlbmNlLmpzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Z0NBUWdCOztBQVJoQjs7Ozs7Ozt1QkFHTyxJQUFNLHVGQUFlLHFFQUFmO0FBQ2IsYUFBYSxRQUFiLEdBQXdCLFVBQVMsS0FBVCxFQUFnQjtBQUN0QyxTQUFPLE1BQU0sS0FBTixDQUFZLHVCQUFaLENBQVAsQ0FEc0M7Q0FBaEI7O0FBSWpCLFNBQVMsYUFBVCxDQUF1QixNQUF2QixFQUErQixNQUEvQixFQUF1QyxRQUF2QyxFQUFpRDtBQUFFLFNBQU8sYUFBYSxJQUFiLENBQWtCLE1BQWxCLEVBQTBCLE1BQTFCLEVBQWtDLFFBQWxDLENBQVAsQ0FBRjtDQUFqRCIsImZpbGUiOiJzZW50ZW5jZS5qcyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCBEaWZmIGZyb20gJy4vYmFzZSc7XG5cblxuZXhwb3J0IGNvbnN0IHNlbnRlbmNlRGlmZiA9IG5ldyBEaWZmKCk7XG5zZW50ZW5jZURpZmYudG9rZW5pemUgPSBmdW5jdGlvbih2YWx1ZSkge1xuICByZXR1cm4gdmFsdWUuc3BsaXQoLyhcXFMuKz9bLiE/XSkoPz1cXHMrfCQpLyk7XG59O1xuXG5leHBvcnQgZnVuY3Rpb24gZGlmZlNlbnRlbmNlcyhvbGRTdHIsIG5ld1N0ciwgY2FsbGJhY2spIHsgcmV0dXJuIHNlbnRlbmNlRGlmZi5kaWZmKG9sZFN0ciwgbmV3U3RyLCBjYWxsYmFjayk7IH1cbiJdfQ==
|
|||
|
|
|||
|
|
|||
|
/***/ },
|
|||
|
/* 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,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9kaWZmL2Nzcy5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7O2dDQU9nQjs7QUFQaEI7Ozs7Ozs7dUJBRU8sSUFBTSw2RUFBVSxxRUFBVjtBQUNiLFFBQVEsUUFBUixHQUFtQixVQUFTLEtBQVQsRUFBZ0I7QUFDakMsU0FBTyxNQUFNLEtBQU4sQ0FBWSxlQUFaLENBQVAsQ0FEaUM7Q0FBaEI7O0FBSVosU0FBUyxPQUFULENBQWlCLE1BQWpCLEVBQXlCLE1BQXpCLEVBQWlDLFFBQWpDLEVBQTJDO0FBQUUsU0FBTyxRQUFRLElBQVIsQ0FBYSxNQUFiLEVBQXFCLE1BQXJCLEVBQTZCLFFBQTdCLENBQVAsQ0FBRjtDQUEzQyIsImZpbGUiOiJjc3MuanMiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgRGlmZiBmcm9tICcuL2Jhc2UnO1xuXG5leHBvcnQgY29uc3QgY3NzRGlmZiA9IG5ldyBEaWZmKCk7XG5jc3NEaWZmLnRva2VuaXplID0gZnVuY3Rpb24odmFsdWUpIHtcbiAgcmV0dXJuIHZhbHVlLnNwbGl0KC8oW3t9OjssXXxcXHMrKS8pO1xufTtcblxuZXhwb3J0IGZ1bmN0aW9uIGRpZmZDc3Mob2xkU3RyLCBuZXdTdHIsIGNhbGxiYWNrKSB7IHJldHVybiBjc3NEaWZmLmRpZmYob2xkU3RyLCBuZXdTdHIsIGNhbGxiYWNrKTsgfVxuIl19
|
|||
|
|
|||
|
|
|||
|
/***/ },
|
|||
|
/* 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) {
|
|||
|
return typeof value === 'string' ? value : JSON.stringify(canonicalize(value), undefined, ' ');
|
|||
|
};
|
|||
|
jsonDiff.equals = function (left, right) {
|
|||
|
return (/*istanbul ignore start*/_base2.default. /*istanbul ignore end*/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 = /*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;
|
|||
|
}
|
|||
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9kaWZmL2pzb24uanMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7OztnQ0FtQmdCO3lEQUtBOztBQXhCaEI7Ozs7OztBQUNBOzs7Ozs7O0FBRUEsSUFBTSwwQkFBMEIsT0FBTyxTQUFQLENBQWlCLFFBQWpCOztBQUd6QixJQUFNLCtFQUFXLHFFQUFYOzs7QUFHYixTQUFTLGVBQVQsR0FBMkIsSUFBM0I7O0FBRUEsU0FBUyxRQUFULEdBQW9CLGdFQUFTLFFBQVQ7QUFDcEIsU0FBUyxTQUFULEdBQXFCLFVBQVMsS0FBVCxFQUFnQjtBQUNuQyxTQUFPLE9BQU8sS0FBUCxLQUFpQixRQUFqQixHQUE0QixLQUE1QixHQUFvQyxLQUFLLFNBQUwsQ0FBZSxhQUFhLEtBQWIsQ0FBZixFQUFvQyxTQUFwQyxFQUErQyxJQUEvQyxDQUFwQyxDQUQ0QjtDQUFoQjtBQUdyQixTQUFTLE1BQVQsR0FBa0IsVUFBUyxJQUFULEVBQWUsS0FBZixFQUFzQjtBQUN0QyxTQUFPLGlFQUFLLFNBQUwsQ0FBZSxNQUFmLENBQXNCLEtBQUssT0FBTCxDQUFhLFlBQWIsRUFBMkIsSUFBM0IsQ0FBdEIsRUFBd0QsTUFBTSxPQUFOLENBQWMsWUFBZCxFQUE0QixJQUE1QixDQUF4RCxDQUFQO0lBRHNDO0NBQXRCOztBQUlYLFNBQVMsUUFBVCxDQUFrQixNQUFsQixFQUEwQixNQUExQixFQUFrQyxRQUFsQyxFQUE0QztBQUFFLFNBQU8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/ 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__(10) /*istanbul ignore end*/;
|
|||
|
|
|||
|
var /*istanbul ignore start*/_distanceIterator = __webpack_require__(11) /*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('\n'),
|
|||
|
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
|
|||
|
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;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
// 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.
|
|||
|
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);
|
|||
|
|
|||
|
setTimeout(processIndex, 0);
|
|||
|
});
|
|||
|
}
|
|||
|
processIndex();
|
|||
|
}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W9CLE1BQUssS0FBTCxDQUFXLElBQUksQ0FBSixDQUFYLENBQWtCLENBQWxCLENBQXBCLEdBQTJDLElBQTNDLENBREs7QUFFN0IsY0FBSSxzQkFBc0IsR0FBdEIsRUFBMkI7QUFDN0IsMEJBQWMsSUFBZCxDQUQ2QjtXQUEvQixNQUVPLElBQUksc0JBQXNCLEdBQXRCLEVBQTJCO0FBQ3BDLHVCQUFXLElBQVgsQ0FEb0M7V0FBL0I7U0FKRjtLQWJUO0dBSkY7OztBQTdFd0QsTUEwR3BELFdBQUosRUFBaUI7QUFDZixXQUFPLENBQUMsTUFBTSxNQUFNLE1BQU4sR0FBZSxDQUFmLENBQVAsRUFBMEI7QUFDL0IsWUFBTSxHQUFOLEdBRCtCO0tBQWpDO0dBREYsTUFJTyxJQUFJLFFBQUosRUFBYztBQUNuQixVQUFNLElBQU4sQ0FBVyxFQUFYLEVBRG1CO0dBQWQ7QUFHUCxTQUFPLE1BQU0sSUFBTixDQUFXLElBQVgsQ0FBUCxDQWpId0Q7Q0FBbkQ7OztBQXFIQSxTQUFTLFlBQVQsQ0FBc0IsT0FBdEIsRUFBK0IsT0FBL0IsRUFBd0M7QUFDN0MsTUFBSSxPQUFPLE9BQVAsS0FBbUIsUUFBbkIsRUFBNkI7QUFDL0IsY0FBVSx3RUFBVyxPQUFYLENBQVYsQ0FEK0I7R0FBakM7O0FBSUEsTUFBSSxlQUFlLENBQWYsQ0FMeUM7QUFNN0MsV0FBUyxZQUFULEdBQXdCO0FBQ3RCLFFBQUksUUFBUSxRQUFRLGNBQVIsQ0FBUixDQURrQjtBQUV0QixRQUFJLENBQUMsS0FBRCxFQUFRO0FBQ1YsYUFBTyxRQUFRLFFBQVIsRUFB
|
|||
|
|
|||
|
|
|||
|
/***/ },
|
|||
|
/* 10 */
|
|||
|
/***/ 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('\n'),
|
|||
|
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 fileHeader = /^(\-\-\-|\+\+\+)\s+(\S*)\s?(.*?)\s*$/.exec(diffstr[i]);
|
|||
|
if (fileHeader) {
|
|||
|
var keyPrefix = fileHeader[1] === '---' ? 'old' : 'new';
|
|||
|
index[keyPrefix + 'FileName'] = fileHeader[2];
|
|||
|
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: []
|
|||
|
};
|
|||
|
|
|||
|
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;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
// 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;
|
|||
|
}
|
|||
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9wYXRjaC9wYXJzZS5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Z0NBQWdCO0FBQVQsU0FBUyxVQUFULENBQW9CLE9BQXBCLEVBQTJDO3NEQUFkLGdFQUFVLGtCQUFJOztBQUNoRCxNQUFJLFVBQVUsUUFBUSxLQUFSLENBQWMsSUFBZCxDQUFWO01BQ0EsT0FBTyxFQUFQO01BQ0EsSUFBSSxDQUFKLENBSDRDOztBQUtoRCxXQUFTLFVBQVQsR0FBc0I7QUFDcEIsUUFBSSxRQUFRLEVBQVIsQ0FEZ0I7QUFFcEIsU0FBSyxJQUFMLENBQVUsS0FBVjs7O0FBRm9CLFdBS2IsSUFBSSxRQUFRLE1BQVIsRUFBZ0I7QUFDekIsVUFBSSxPQUFPLFFBQVEsQ0FBUixDQUFQOzs7QUFEcUIsVUFJckIsd0JBQXdCLElBQXhCLENBQTZCLElBQTdCLENBQUosRUFBd0M7QUFDdEMsY0FEc0M7T0FBeEM7OztBQUp5QixVQVNyQixTQUFTLDJDQUE2QyxJQUE3QyxDQUFrRCxJQUFsRCxDQUFULENBVHFCO0FBVXpCLFVBQUksTUFBSixFQUFZO0FBQ1YsY0FBTSxLQUFOLEdBQWMsT0FBTyxDQUFQLENBQWQsQ0FEVTtPQUFaOztBQUlBLFVBZHlCO0tB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mIG1ldGFkYXRhXG4gICAgd2hpbGUgKGkgPCBkaWZmc3RyLmxlbmd0aCkge1xuICAgICAgbGV0IGxpbmUgPSBkaWZmc3RyW2ldO1xuXG4gICAgICAvLyBGaWxlIGhlYWRlciBmb3Vu
|
|||
|
|
|||
|
|
|||
|
/***/ },
|
|||
|
/* 11 */
|
|||
|
/***/ function(module, exports) {
|
|||
|
|
|||
|
/*istanbul ignore start*/"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,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy91dGlsL2Rpc3RhbmNlLWl0ZXJhd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5cbiAgICAgIC8vIENoZWNrIGlmIHRyeWluZyB0byBmaXQgYmVmb3JlIHRleHQgYmVnaW5uaW5nLCBhbmQgaWYgbm90LCBjaGVjayBpdCBmaXRzXG4gICAgICAvLyBiZWZvcmUgb2Zmc2V0IGxvY2F0aW9uXG4gICAgICBpZiAobWluTGluZSA8PSBzdGFydCAtIGxvY2FsT2Zmc2V0KSB7XG4gICAgICAgIHJldHVybiAtbG9jYWxPZmZzZXQrKztcbiAgICAgIH1cblxuICAgICAgYmFja3dhcmRFeGhhdXN0ZWQgPSB0cnVlO1xuICAgICAgcmV0dXJuIGl0ZXJhdG9yKCk7XG4gICAgfVxuXG4gICAgLy8gV2UgdHJpZWQgdG8gZml0IGh1bmsgYmVmb3JlIHRleHQgYmVnaW5uaW5nIGFuZCBiZXlvbmQgdGV4dCBsZW5naHQsIHRoZW5cbiAgICAvLyBodW5rIGNhbid0IGZpdCBvbiB0aGUgdGV4dC4gUmV0dXJuIHVuZGVmaW5lZFxuICB9O1xufVxuIl19
|
|||
|
|
|||
|
|
|||
|
/***/ },
|
|||
|
/* 12 */
|
|||
|
/***/ function(module, exports, __webpack_require__) {
|
|||
|
|
|||
|
/*istanbul ignore start*/'use strict';
|
|||
|
|
|||
|
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 = { context: 4 };
|
|||
|
}
|
|||
|
|
|||
|
var diff = /*istanbul ignore start*/(0, _line.diffLines) /*istanbul ignore end*/(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;
|
|||
|
/*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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
|
|
|||
|
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,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9jb252ZXJ0L2RtcC5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Z0NBQ2dCOztBQUFULFNBQVMsbUJBQVQsQ0FBNkIsT0FBN0IsRUFBc0M7QUFDM0MsTUFBSSxNQUFNLEVBQU47TUFDQSxnRUFESjtNQUVJLG1FQUZKLENBRDJDO0FBSTNDLE9BQUssSUFBSSxJQUFJLENBQUosRUFBTyxJQUFJLFFBQVEsTUFBUixFQUFnQixHQUFwQyxFQUF5QztBQUN2QyxhQUFTLFFBQVEsQ0FBUixDQUFULENBRHVDO0FBRXZDLFFBQUksT0FBTyxLQUFQLEVBQWM7QUFDaEIsa0JBQVksQ0FBWixDQURnQjtLQUFsQixNQUVPLElBQUksT0FBTyxPQUFQLEVBQWdCO0FBQ3pCLGtCQUFZLENBQUMsQ0FBRCxDQURhO0tBQXBCLE1BRUE7QUFDTCxrQkFBWSxDQUFaLENBREs7S0FGQTs7QUFNUCxRQUFJLElBQUosQ0FBUyxDQUFDLFNBQUQsRUFBWSxPQUFPLEtBQVAsQ0FBckIsRUFWdUM7R0FBekM7QUFZQSxTQUFPLEdBQVAsQ0FoQjJDO0NBQXRDIiwiZmlsZSI6ImRtcC5qcyIsInNvdXJjZXNDb250ZW50IjpbIi8vIFNlZTogaHR0cDovL2NvZGUuZ29vZ2xlLmNvbS9wL2dvb2dsZS1kaWZmLW1hdGNoLXBhdGNoL3dpa2kvQVBJXG5leHBvcnQgZnVuY3Rpb24gY29udmVydENoYW5nZXNUb0RNUChjaGFuZ2VzKSB7XG4gIGxldCByZXQgPSBbXSxcbiAgICAgIGNoYW5nZSxcbiAgICAgIG9wZXJhdGlvbjtcbiAgZm9yIChsZXQgaSA9IDA7IGkgPCBjaGFuZ2VzLmxlbmd0aDsgaSsrKSB7XG4gICAgY2hhbmdlID0gY2hhbmdlc1tpXTtcbiAgICBpZiAoY2hhbmdlLmFkZGVkKSB7XG4gICAgICBvcGVyYXRpb24gPSAxO1xuICAgIH0gZWxzZSBpZiAoY2hhbmdlLnJlbW92ZWQpIHtcbiAgICAgIG9wZXJhdGlvbiA9IC0xO1xuICAgIH0gZWxzZSB7XG4gICAgICBvcGVyYXRpb24gPSAwO1xuICAgIH1cblxuICAgIHJldC5wdXNoKFtvcGVyYXRpb24sIGNoYW5nZS52YWx1ZV0pO1xuICB9XG4gIHJldHVybiByZXQ7XG59XG4iXX0=
|
|||
|
|
|||
|
|
|||
|
/***/ },
|
|||
|
/* 14 */
|
|||
|
/***/ 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,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9jb252ZXJ0L3htbC5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Z0NBQWdCO0FBQVQsU0FBUyxtQkFBVCxDQUE2QixPQUE3QixFQUFzQztBQUMzQyxNQUFJLE1BQU0sRUFBTixDQUR1QztBQUUzQyxPQUFLLElBQUksSUFBSSxDQUFKLEVBQU8sSUFBSSxRQUFRLE1BQVIsRUFBZ0IsR0FBcEMsRUFBeUM7QUFDdkMsUUFBSSxTQUFTLFFBQVEsQ0FBUixDQUFULENBRG1DO0FBRXZDLFFBQUksT0FBTyxLQUFQLEVBQWM7QUFDaEIsVUFBSSxJQUFKLENBQVMsT0FBVCxFQURnQjtLQUFsQixNQUVPLElBQUksT0FBTyxPQUFQLEVBQWdCO0FBQ3pCLFVBQUksSUFBSixDQUFTLE9BQVQsRUFEeUI7S0FBcEI7O0FBSVAsUUFBSSxJQUFKLENBQVMsV0FBVyxPQUFPLEtBQVAsQ0FBcEIsRUFSdUM7O0FBVXZDLFFBQUksT0FBTyxLQUFQLEVBQWM7QUFDaEIsVUFBSSxJQUFKLENBQVMsUUFBVCxFQURnQjtLQUFsQixNQUVPLElBQUksT0FBTyxPQUFQLEVBQWdCO0FBQ3pCLFVBQUksSUFBSixDQUFTLFFBQVQsRUFEeUI7S0FBcEI7R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