Update Mocha to 8.3.0
This also adds Python-2.0 to the list of accepted licenses.
Lastly, it fixes a bug where the package.json files were incorrectly
reordered. For the `exports` of a particular package, the order that
the entrypoints are defined in is crucial. Therefore, we should not
alter the order of entrypoints and instead maintain the originally
defined ordering. We can use an `OrderedDict` to ensure that Python
always loads the JSON files in the same order.
DISABLE_THIRD_PARTY_CHECK=NPM update
R=jacktfranklin@chromium.org
Bug: none
Change-Id: I5a309782de6015edea6ba3b502aa0db1f008d973
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2692909
Auto-Submit: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
diff --git a/node_modules/diff/lib/index.es6.js b/node_modules/diff/lib/index.es6.js
index b645843..ca0e591 100644
--- a/node_modules/diff/lib/index.es6.js
+++ b/node_modules/diff/lib/index.es6.js
@@ -306,7 +306,8 @@
};
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.
+ // All whitespace symbols except newline group into one token, each newline - in separate token
+ var tokens = value.split(/([^\S\r\n]+|[()[\]{}'"\r\n]|\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
@@ -389,6 +390,8 @@
}
function _typeof(obj) {
+ "@babel/helpers - typeof";
+
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
_typeof = function (obj) {
return typeof obj;
@@ -403,23 +406,36 @@
}
function _toConsumableArray(arr) {
- return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread();
+ return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
}
function _arrayWithoutHoles(arr) {
- if (Array.isArray(arr)) {
- for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];
-
- return arr2;
- }
+ if (Array.isArray(arr)) return _arrayLikeToArray(arr);
}
function _iterableToArray(iter) {
- if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter);
+ if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter);
+}
+
+function _unsupportedIterableToArray(o, minLen) {
+ if (!o) return;
+ if (typeof o === "string") return _arrayLikeToArray(o, minLen);
+ var n = Object.prototype.toString.call(o).slice(8, -1);
+ if (n === "Object" && o.constructor) n = o.constructor.name;
+ if (n === "Map" || n === "Set") return Array.from(o);
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
+}
+
+function _arrayLikeToArray(arr, len) {
+ if (len == null || len > arr.length) len = arr.length;
+
+ for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
+
+ return arr2;
}
function _nonIterableSpread() {
- throw new TypeError("Invalid attempt to spread non-iterable instance");
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
var objectPrototypeToString = Object.prototype.toString;
@@ -608,12 +624,23 @@
chunkHeader = chunkHeaderLine.split(/@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/);
var hunk = {
oldStart: +chunkHeader[1],
- oldLines: +chunkHeader[2] || 1,
+ oldLines: typeof chunkHeader[2] === 'undefined' ? 1 : +chunkHeader[2],
newStart: +chunkHeader[3],
- newLines: +chunkHeader[4] || 1,
+ newLines: typeof chunkHeader[4] === 'undefined' ? 1 : +chunkHeader[4],
lines: [],
linedelimiters: []
- };
+ }; // Unified Diff Format quirk: If the chunk size is 0,
+ // the first number is one lower than one would expect.
+ // https://www.artima.com/weblogs/viewpost.jsp?thread=164293
+
+ if (hunk.oldLines === 0) {
+ hunk.oldStart += 1;
+ }
+
+ if (hunk.newLines === 0) {
+ hunk.newStart += 1;
+ }
+
var addCount = 0,
removeCount = 0;
@@ -806,11 +833,6 @@
diffOffset += _hunk.newLines - _hunk.oldLines;
- if (_toPos < 0) {
- // Creating a new file
- _toPos = 0;
- }
-
for (var j = 0; j < _hunk.lines.length; j++) {
var line = _hunk.lines[j],
operation = line.length > 0 ? line[0] : ' ',
@@ -981,8 +1003,9 @@
var newEOFNewline = /\n$/.test(newStr);
var noNlBeforeAdds = lines.length == 0 && curRange.length > hunk.oldLines;
- if (!oldEOFNewline && noNlBeforeAdds) {
+ if (!oldEOFNewline && noNlBeforeAdds && oldStr.length > 0) {
// special case: old has no eol and no trailing context; no-nl can end up before adds
+ // however, if the old file is empty, do not output the no-nl line
curRange.splice(hunk.oldLines, 0, '\\ No newline at end of file');
}
@@ -1015,12 +1038,11 @@
hunks: hunks
};
}
-function createTwoFilesPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options) {
- var diff = structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options);
+function formatPatch(diff) {
var ret = [];
- if (oldFileName == newFileName) {
- ret.push('Index: ' + oldFileName);
+ if (diff.oldFileName == diff.newFileName) {
+ ret.push('Index: ' + diff.oldFileName);
}
ret.push('===================================================================');
@@ -1028,13 +1050,27 @@
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];
+ var hunk = diff.hunks[i]; // Unified Diff Format quirk: If the chunk size is 0,
+ // the first number is one lower than one would expect.
+ // https://www.artima.com/weblogs/viewpost.jsp?thread=164293
+
+ if (hunk.oldLines === 0) {
+ hunk.oldStart -= 1;
+ }
+
+ if (hunk.newLines === 0) {
+ hunk.newStart -= 1;
+ }
+
ret.push('@@ -' + hunk.oldStart + ',' + hunk.oldLines + ' +' + hunk.newStart + ',' + hunk.newLines + ' @@');
ret.push.apply(ret, hunk.lines);
}
return ret.join('\n') + '\n';
}
+function createTwoFilesPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options) {
+ return formatPatch(structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options));
+}
function createPatch(fileName, oldStr, newStr, oldHeader, newHeader, options) {
return createTwoFilesPatch(fileName, fileName, oldStr, newStr, oldHeader, newHeader, options);
}
@@ -1514,6 +1550,4 @@
return n;
}
-/* See LICENSE file for terms of use */
-
-export { Diff, diffChars, diffWords, diffWordsWithSpace, diffLines, diffTrimmedLines, diffSentences, diffCss, diffJson, diffArrays, structuredPatch, createTwoFilesPatch, createPatch, applyPatch, applyPatches, parsePatch, merge, convertChangesToDMP, convertChangesToXML, canonicalize };
+export { Diff, applyPatch, applyPatches, canonicalize, convertChangesToDMP, convertChangesToXML, createPatch, createTwoFilesPatch, diffArrays, diffChars, diffCss, diffJson, diffLines, diffSentences, diffTrimmedLines, diffWords, diffWordsWithSpace, merge, parsePatch, structuredPatch };