jest-diff
Advanced tools
Comparing version 27.5.1 to 28.0.0-alpha.0
@@ -13,16 +13,2 @@ 'use strict'; | ||
function _defineProperty(obj, key, value) { | ||
if (key in obj) { | ||
Object.defineProperty(obj, key, { | ||
value: value, | ||
enumerable: true, | ||
configurable: true, | ||
writable: true | ||
}); | ||
} else { | ||
obj[key] = value; | ||
} | ||
return obj; | ||
} | ||
/** | ||
@@ -83,7 +69,6 @@ * Diff Match and Patch | ||
class Diff { | ||
0; | ||
1; | ||
constructor(op, text) { | ||
_defineProperty(this, 0, void 0); | ||
_defineProperty(this, 1, void 0); | ||
this[0] = op; | ||
@@ -90,0 +75,0 @@ this[1] = text; |
@@ -10,16 +10,8 @@ 'use strict'; | ||
function _defineProperty(obj, key, value) { | ||
if (key in obj) { | ||
Object.defineProperty(obj, key, { | ||
value: value, | ||
enumerable: true, | ||
configurable: true, | ||
writable: true | ||
}); | ||
} else { | ||
obj[key] = value; | ||
} | ||
return obj; | ||
} | ||
/** | ||
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
// Given change op and array of diffs, return concatenated string: | ||
@@ -42,13 +34,10 @@ // * include common strings | ||
class ChangeBuffer { | ||
// incomplete line | ||
// complete lines | ||
constructor(op, changeColor) { | ||
_defineProperty(this, 'op', void 0); | ||
op; | ||
line; // incomplete line | ||
_defineProperty(this, 'line', void 0); | ||
lines; // complete lines | ||
_defineProperty(this, 'lines', void 0); | ||
changeColor; | ||
_defineProperty(this, 'changeColor', void 0); | ||
constructor(op, changeColor) { | ||
this.op = op; | ||
@@ -127,9 +116,7 @@ this.line = []; | ||
class CommonBuffer { | ||
deleteBuffer; | ||
insertBuffer; | ||
lines; | ||
constructor(deleteBuffer, insertBuffer) { | ||
_defineProperty(this, 'deleteBuffer', void 0); | ||
_defineProperty(this, 'insertBuffer', void 0); | ||
_defineProperty(this, 'lines', void 0); | ||
this.deleteBuffer = deleteBuffer; | ||
@@ -136,0 +123,0 @@ this.insertBuffer = insertBuffer; |
@@ -7,10 +7,88 @@ /** | ||
*/ | ||
import { DIFF_DELETE, DIFF_EQUAL, DIFF_INSERT, Diff } from './cleanupSemantic'; | ||
import { diffLinesRaw, diffLinesUnified, diffLinesUnified2 } from './diffLines'; | ||
import { diffStringsRaw, diffStringsUnified } from './printDiffs'; | ||
import type { DiffOptions } from './types'; | ||
export type { DiffOptions, DiffOptionsColor } from './types'; | ||
export { diffLinesRaw, diffLinesUnified, diffLinesUnified2 }; | ||
export { diffStringsRaw, diffStringsUnified }; | ||
export { DIFF_DELETE, DIFF_EQUAL, DIFF_INSERT, Diff }; | ||
export declare function diff(a: any, b: any, options?: DiffOptions): string | null; | ||
import type {CompareKeys} from 'pretty-format'; | ||
/** | ||
* Class representing one diff tuple. | ||
* Attempts to look like a two-element array (which is what this used to be). | ||
* @param {number} op Operation, one of: DIFF_DELETE, DIFF_INSERT, DIFF_EQUAL. | ||
* @param {string} text Text to be deleted, inserted, or retained. | ||
* @constructor | ||
*/ | ||
export declare class Diff { | ||
0: number; | ||
1: string; | ||
constructor(op: number, text: string); | ||
} | ||
export declare function diff( | ||
a: any, | ||
b: any, | ||
options?: DiffOptions, | ||
): string | null; | ||
/** | ||
* The data structure representing a diff is an array of tuples: | ||
* [[DIFF_DELETE, 'Hello'], [DIFF_INSERT, 'Goodbye'], [DIFF_EQUAL, ' world.']] | ||
* which means: delete 'Hello', add 'Goodbye' and keep ' world.' | ||
*/ | ||
export declare var DIFF_DELETE: number; | ||
export declare var DIFF_EQUAL: number; | ||
export declare var DIFF_INSERT: number; | ||
export declare const diffLinesRaw: ( | ||
aLines: Array<string>, | ||
bLines: Array<string>, | ||
) => Array<Diff>; | ||
export declare const diffLinesUnified: ( | ||
aLines: Array<string>, | ||
bLines: Array<string>, | ||
options?: DiffOptions | undefined, | ||
) => string; | ||
export declare const diffLinesUnified2: ( | ||
aLinesDisplay: Array<string>, | ||
bLinesDisplay: Array<string>, | ||
aLinesCompare: Array<string>, | ||
bLinesCompare: Array<string>, | ||
options?: DiffOptions | undefined, | ||
) => string; | ||
export declare type DiffOptions = { | ||
aAnnotation?: string; | ||
aColor?: DiffOptionsColor; | ||
aIndicator?: string; | ||
bAnnotation?: string; | ||
bColor?: DiffOptionsColor; | ||
bIndicator?: string; | ||
changeColor?: DiffOptionsColor; | ||
changeLineTrailingSpaceColor?: DiffOptionsColor; | ||
commonColor?: DiffOptionsColor; | ||
commonIndicator?: string; | ||
commonLineTrailingSpaceColor?: DiffOptionsColor; | ||
contextLines?: number; | ||
emptyFirstOrLastLinePlaceholder?: string; | ||
expand?: boolean; | ||
includeChangeCounts?: boolean; | ||
omitAnnotationLines?: boolean; | ||
patchColor?: DiffOptionsColor; | ||
compareKeys?: CompareKeys; | ||
}; | ||
export declare type DiffOptionsColor = (arg: string) => string; | ||
export declare const diffStringsRaw: ( | ||
a: string, | ||
b: string, | ||
cleanup: boolean, | ||
) => Array<Diff>; | ||
export declare const diffStringsUnified: ( | ||
a: string, | ||
b: string, | ||
options?: DiffOptions | undefined, | ||
) => string; | ||
export {}; |
{ | ||
"name": "jest-diff", | ||
"version": "27.5.1", | ||
"version": "28.0.0-alpha.0", | ||
"repository": { | ||
@@ -21,12 +21,12 @@ "type": "git", | ||
"chalk": "^4.0.0", | ||
"diff-sequences": "^27.5.1", | ||
"jest-get-type": "^27.5.1", | ||
"pretty-format": "^27.5.1" | ||
"diff-sequences": "^28.0.0-alpha.0", | ||
"jest-get-type": "^28.0.0-alpha.0", | ||
"pretty-format": "^28.0.0-alpha.0" | ||
}, | ||
"devDependencies": { | ||
"@jest/test-utils": "^27.5.1", | ||
"@jest/test-utils": "^28.0.0-alpha.0", | ||
"strip-ansi": "^6.0.0" | ||
}, | ||
"engines": { | ||
"node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" | ||
"node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0" | ||
}, | ||
@@ -36,3 +36,3 @@ "publishConfig": { | ||
}, | ||
"gitHead": "67c1aa20c5fec31366d733e901fee2b981cb1850" | ||
"gitHead": "89275b08977065d98e42ad71fcf223f4ad169f09" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
78984
14
1703
2
+ Added@jest/schemas@28.1.3(transitive)
+ Added@sinclair/typebox@0.24.51(transitive)
+ Addeddiff-sequences@28.1.1(transitive)
+ Addedjest-get-type@28.0.2(transitive)
+ Addedpretty-format@28.1.3(transitive)
+ Addedreact-is@18.3.1(transitive)
- Removeddiff-sequences@27.5.1(transitive)
- Removedjest-get-type@27.5.1(transitive)
- Removedpretty-format@27.5.1(transitive)
- Removedreact-is@17.0.2(transitive)