Fix dependabot issues
This commit is contained in:
parent
c89d9bd8b0
commit
531c6ba7c8
705 changed files with 53406 additions and 20466 deletions
34
node_modules/concordance/lib/primitiveValues/string.js
generated
vendored
34
node_modules/concordance/lib/primitiveValues/string.js
generated
vendored
|
|
@ -1,7 +1,7 @@
|
|||
'use strict'
|
||||
|
||||
const fastDiff = require('fast-diff')
|
||||
const keyword = require('esutils').keyword
|
||||
const fastDiff = require('fast-diff')
|
||||
|
||||
const constants = require('../constants')
|
||||
const formatUtils = require('../formatUtils')
|
||||
|
|
@ -61,7 +61,7 @@ function includesLinebreaks (string) {
|
|||
return string.includes('\r') || string.includes('\n')
|
||||
}
|
||||
|
||||
function diffLine (theme, actual, expected) {
|
||||
function diffLine (theme, actual, expected, invert) {
|
||||
const outcome = fastDiff(actual, expected)
|
||||
|
||||
// TODO: Compute when line is mostly unequal (80%? 90%?) and treat it as being
|
||||
|
|
@ -83,9 +83,14 @@ function diffLine (theme, actual, expected) {
|
|||
let stringExpected = ''
|
||||
|
||||
const noopWrap = { open: '', close: '' }
|
||||
const deleteWrap = isPartiallyEqual ? theme.string.diff.delete : noopWrap
|
||||
const insertWrap = isPartiallyEqual ? theme.string.diff.insert : noopWrap
|
||||
let deleteWrap = isPartiallyEqual ? theme.string.diff.delete : noopWrap
|
||||
let insertWrap = isPartiallyEqual ? theme.string.diff.insert : noopWrap
|
||||
const equalWrap = isPartiallyEqual ? theme.string.diff.equal : noopWrap
|
||||
|
||||
if (invert) {
|
||||
[deleteWrap, insertWrap] = [insertWrap, deleteWrap]
|
||||
}
|
||||
|
||||
for (const diff of outcome) {
|
||||
if (diff[0] === fastDiff.DELETE) {
|
||||
stringActual += formatUtils.wrap(deleteWrap, diff[1])
|
||||
|
|
@ -99,8 +104,11 @@ function diffLine (theme, actual, expected) {
|
|||
}
|
||||
|
||||
if (!isPartiallyEqual) {
|
||||
stringActual = formatUtils.wrap(theme.string.diff.deleteLine, stringActual)
|
||||
stringExpected = formatUtils.wrap(theme.string.diff.insertLine, stringExpected)
|
||||
const deleteLineWrap = invert ? theme.string.diff.insertLine : theme.string.diff.deleteLine
|
||||
const insertLineWrap = invert ? theme.string.diff.deleteLine : theme.string.diff.insertLine
|
||||
|
||||
stringActual = formatUtils.wrap(deleteLineWrap, stringActual)
|
||||
stringExpected = formatUtils.wrap(insertLineWrap, stringExpected)
|
||||
}
|
||||
|
||||
return [stringActual, stringExpected]
|
||||
|
|
@ -170,7 +178,7 @@ class StringValue {
|
|||
return formatUtils.wrap(theme.string.line, formatUtils.wrap(theme.string, escaped))
|
||||
}
|
||||
|
||||
diffDeep (expected, theme, indent) {
|
||||
diffDeep (expected, theme, indent, invert) {
|
||||
if (expected.tag !== tag) return null
|
||||
|
||||
const escapedActual = basicEscape(this.value)
|
||||
|
|
@ -179,7 +187,9 @@ class StringValue {
|
|||
if (!includesLinebreaks(escapedActual) && !includesLinebreaks(escapedExpected)) {
|
||||
const result = diffLine(theme,
|
||||
escapeQuotes(theme.string.line, escapedActual),
|
||||
escapeQuotes(theme.string.line, escapedExpected))
|
||||
escapeQuotes(theme.string.line, escapedExpected),
|
||||
invert,
|
||||
)
|
||||
|
||||
return lineBuilder.actual.single(formatUtils.wrap(theme.string.line, result[0]))
|
||||
.concat(lineBuilder.expected.single(formatUtils.wrap(theme.string.line, result[1])))
|
||||
|
|
@ -241,7 +251,8 @@ class StringValue {
|
|||
}
|
||||
|
||||
if (actualIsExtraneous && !expectedIsMissing) {
|
||||
const string = formatUtils.wrap(theme.string.diff.deleteLine, actualLines[actualIndex])
|
||||
const wrap = invert ? theme.string.diff.insertLine : theme.string.diff.deleteLine
|
||||
const string = formatUtils.wrap(wrap, actualLines[actualIndex])
|
||||
|
||||
if (actualIndex === 0) {
|
||||
actualBuffer.push(lineBuilder.actual.first(theme.string.multiline.start + string))
|
||||
|
|
@ -255,7 +266,8 @@ class StringValue {
|
|||
actualIndex++
|
||||
extraneousOffset++
|
||||
} else if (expectedIsMissing && !actualIsExtraneous) {
|
||||
const string = formatUtils.wrap(theme.string.diff.insertLine, expectedLines[expectedIndex])
|
||||
const wrap = invert ? theme.string.diff.deleteLine : theme.string.diff.insertLine
|
||||
const string = formatUtils.wrap(wrap, expectedLines[expectedIndex])
|
||||
|
||||
if (mustOpenNextExpected) {
|
||||
expectedBuffer.push(lineBuilder.expected.first(theme.string.multiline.start + string))
|
||||
|
|
@ -268,7 +280,7 @@ class StringValue {
|
|||
|
||||
expectedIndex++
|
||||
} else {
|
||||
const result = diffLine(theme, actualLines[actualIndex], expectedLines[expectedIndex])
|
||||
const result = diffLine(theme, actualLines[actualIndex], expectedLines[expectedIndex], invert)
|
||||
|
||||
if (actualIndex === 0) {
|
||||
actualBuffer.push(lineBuilder.actual.first(theme.string.multiline.start + result[0]))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue