From 9bdb95c9e34cef640534e5e5a1e2225a80442000 Mon Sep 17 00:00:00 2001 From: HelenHuang <LinHuang@pollex.com.tw> Date: 星期四, 09 六月 2022 15:48:15 +0800 Subject: [PATCH] TODO#139894 [ footer -最下方說明與保經代合作 ] 文案修改 --- PAMapp/node_modules/jest-diff/build/joinAlignedDiffs.js | 116 ++++++++++++++++++++++++++++++++++++++++++++++------------ 1 files changed, 92 insertions(+), 24 deletions(-) diff --git a/PAMapp/node_modules/jest-diff/build/joinAlignedDiffs.js b/PAMapp/node_modules/jest-diff/build/joinAlignedDiffs.js index 647f714..6b72c9c 100644 --- a/PAMapp/node_modules/jest-diff/build/joinAlignedDiffs.js +++ b/PAMapp/node_modules/jest-diff/build/joinAlignedDiffs.js @@ -3,11 +3,9 @@ Object.defineProperty(exports, '__esModule', { value: true }); -exports.joinAlignedDiffsExpand = exports.joinAlignedDiffsNoExpand = void 0; +exports.joinAlignedDiffsNoExpand = exports.joinAlignedDiffsExpand = void 0; var _cleanupSemantic = require('./cleanupSemantic'); - -var _printDiffs = require('./printDiffs'); /** * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. @@ -15,10 +13,92 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ -// jest --no-expand +const formatTrailingSpaces = (line, trailingSpaceFormatter) => + line.replace(/\s+$/, match => trailingSpaceFormatter(match)); + +const printDiffLine = ( + line, + isFirstOrLast, + color, + indicator, + trailingSpaceFormatter, + emptyFirstOrLastLinePlaceholder +) => + line.length !== 0 + ? color( + indicator + ' ' + formatTrailingSpaces(line, trailingSpaceFormatter) + ) + : indicator !== ' ' + ? color(indicator) + : isFirstOrLast && emptyFirstOrLastLinePlaceholder.length !== 0 + ? color(indicator + ' ' + emptyFirstOrLastLinePlaceholder) + : ''; + +const printDeleteLine = ( + line, + isFirstOrLast, + { + aColor, + aIndicator, + changeLineTrailingSpaceColor, + emptyFirstOrLastLinePlaceholder + } +) => + printDiffLine( + line, + isFirstOrLast, + aColor, + aIndicator, + changeLineTrailingSpaceColor, + emptyFirstOrLastLinePlaceholder + ); + +const printInsertLine = ( + line, + isFirstOrLast, + { + bColor, + bIndicator, + changeLineTrailingSpaceColor, + emptyFirstOrLastLinePlaceholder + } +) => + printDiffLine( + line, + isFirstOrLast, + bColor, + bIndicator, + changeLineTrailingSpaceColor, + emptyFirstOrLastLinePlaceholder + ); + +const printCommonLine = ( + line, + isFirstOrLast, + { + commonColor, + commonIndicator, + commonLineTrailingSpaceColor, + emptyFirstOrLastLinePlaceholder + } +) => + printDiffLine( + line, + isFirstOrLast, + commonColor, + commonIndicator, + commonLineTrailingSpaceColor, + emptyFirstOrLastLinePlaceholder + ); // In GNU diff format, indexes are one-based instead of zero-based. + +const createPatchMark = (aStart, aEnd, bStart, bEnd, {patchColor}) => + patchColor( + `@@ -${aStart + 1},${aEnd - aStart} +${bStart + 1},${bEnd - bStart} @@` + ); // jest --no-expand // // Given array of aligned strings with inverse highlight formatting, // return joined lines with diff formatting (and patch marks, if needed). + const joinAlignedDiffsNoExpand = (diffs, options) => { const iLength = diffs.length; const nContextLines = options.contextLines; @@ -93,26 +173,20 @@ const pushCommonLine = line => { const j = lines.length; - lines.push( - (0, _printDiffs.printCommonLine)(line, j === 0 || j === jLast, options) - ); + lines.push(printCommonLine(line, j === 0 || j === jLast, options)); aEnd += 1; bEnd += 1; }; const pushDeleteLine = line => { const j = lines.length; - lines.push( - (0, _printDiffs.printDeleteLine)(line, j === 0 || j === jLast, options) - ); + lines.push(printDeleteLine(line, j === 0 || j === jLast, options)); aEnd += 1; }; const pushInsertLine = line => { const j = lines.length; - lines.push( - (0, _printDiffs.printInsertLine)(line, j === 0 || j === jLast, options) - ); + lines.push(printInsertLine(line, j === 0 || j === jLast, options)); bEnd += 1; }; // Second pass: push lines with diff formatting (and patch marks, if needed). @@ -157,7 +231,7 @@ pushCommonLine(diffs[iCommon][1]); } - lines[jPatchMark] = (0, _printDiffs.createPatchMark)( + lines[jPatchMark] = createPatchMark( aStart, aEnd, bStart, @@ -196,13 +270,7 @@ } if (hasPatch) { - lines[jPatchMark] = (0, _printDiffs.createPatchMark)( - aStart, - aEnd, - bStart, - bEnd, - options - ); + lines[jPatchMark] = createPatchMark(aStart, aEnd, bStart, bEnd, options); } return lines.join('\n'); @@ -221,13 +289,13 @@ switch (diff[0]) { case _cleanupSemantic.DIFF_DELETE: - return (0, _printDiffs.printDeleteLine)(line, isFirstOrLast, options); + return printDeleteLine(line, isFirstOrLast, options); case _cleanupSemantic.DIFF_INSERT: - return (0, _printDiffs.printInsertLine)(line, isFirstOrLast, options); + return printInsertLine(line, isFirstOrLast, options); default: - return (0, _printDiffs.printCommonLine)(line, isFirstOrLast, options); + return printCommonLine(line, isFirstOrLast, options); } }) .join('\n'); -- Gitblit v1.8.0