@xyne/xyne-cli-linux-x64 0.2.6 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/node_modules/@opentui/core/node_modules/diff/CONTRIBUTING.md +28 -0
- package/node_modules/@opentui/core/node_modules/diff/LICENSE +29 -0
- package/node_modules/@opentui/core/node_modules/diff/README.md +378 -0
- package/node_modules/@opentui/core/node_modules/diff/dist/diff.js +1674 -0
- package/node_modules/@opentui/core/node_modules/diff/dist/diff.min.js +1 -0
- package/node_modules/@opentui/core/node_modules/diff/eslint.config.mjs +182 -0
- package/node_modules/@opentui/core/node_modules/diff/libcjs/convert/dmp.d.ts +8 -0
- package/node_modules/@opentui/core/node_modules/diff/libcjs/convert/dmp.d.ts.map +1 -0
- package/node_modules/@opentui/core/node_modules/diff/libcjs/convert/dmp.js +24 -0
- package/node_modules/@opentui/core/node_modules/diff/libcjs/convert/xml.d.ts +6 -0
- package/node_modules/@opentui/core/node_modules/diff/libcjs/convert/xml.d.ts.map +1 -0
- package/node_modules/@opentui/core/node_modules/diff/libcjs/convert/xml.js +34 -0
- package/node_modules/@opentui/core/node_modules/diff/libcjs/diff/array.d.ts +19 -0
- package/node_modules/@opentui/core/node_modules/diff/libcjs/diff/array.d.ts.map +1 -0
- package/node_modules/@opentui/core/node_modules/diff/libcjs/diff/array.js +40 -0
- package/node_modules/@opentui/core/node_modules/diff/libcjs/diff/base.d.ts +20 -0
- package/node_modules/@opentui/core/node_modules/diff/libcjs/diff/base.d.ts.map +1 -0
- package/node_modules/@opentui/core/node_modules/diff/libcjs/diff/base.js +265 -0
- package/node_modules/@opentui/core/node_modules/diff/libcjs/diff/character.d.ts +19 -0
- package/node_modules/@opentui/core/node_modules/diff/libcjs/diff/character.d.ts.map +1 -0
- package/node_modules/@opentui/core/node_modules/diff/libcjs/diff/character.js +31 -0
- package/node_modules/@opentui/core/node_modules/diff/libcjs/diff/css.d.ts +18 -0
- package/node_modules/@opentui/core/node_modules/diff/libcjs/diff/css.d.ts.map +1 -0
- package/node_modules/@opentui/core/node_modules/diff/libcjs/diff/css.js +34 -0
- package/node_modules/@opentui/core/node_modules/diff/libcjs/diff/json.d.ts +24 -0
- package/node_modules/@opentui/core/node_modules/diff/libcjs/diff/json.d.ts.map +1 -0
- package/node_modules/@opentui/core/node_modules/diff/libcjs/diff/json.js +105 -0
- package/node_modules/@opentui/core/node_modules/diff/libcjs/diff/line.d.ts +24 -0
- package/node_modules/@opentui/core/node_modules/diff/libcjs/diff/line.d.ts.map +1 -0
- package/node_modules/@opentui/core/node_modules/diff/libcjs/diff/line.js +89 -0
- package/node_modules/@opentui/core/node_modules/diff/libcjs/diff/sentence.d.ts +21 -0
- package/node_modules/@opentui/core/node_modules/diff/libcjs/diff/sentence.d.ts.map +1 -0
- package/node_modules/@opentui/core/node_modules/diff/libcjs/diff/sentence.js +67 -0
- package/node_modules/@opentui/core/node_modules/diff/libcjs/diff/word.d.ts +35 -0
- package/node_modules/@opentui/core/node_modules/diff/libcjs/diff/word.d.ts.map +1 -0
- package/node_modules/@opentui/core/node_modules/diff/libcjs/diff/word.js +307 -0
- package/node_modules/@opentui/core/node_modules/diff/libcjs/index.d.ts +20 -0
- package/node_modules/@opentui/core/node_modules/diff/libcjs/index.d.ts.map +1 -0
- package/node_modules/@opentui/core/node_modules/diff/libcjs/index.js +61 -0
- package/node_modules/@opentui/core/node_modules/diff/libcjs/package.json +1 -0
- package/node_modules/@opentui/core/node_modules/diff/libcjs/patch/apply.d.ts +62 -0
- package/node_modules/@opentui/core/node_modules/diff/libcjs/patch/apply.d.ts.map +1 -0
- package/node_modules/@opentui/core/node_modules/diff/libcjs/patch/apply.js +267 -0
- package/node_modules/@opentui/core/node_modules/diff/libcjs/patch/create.d.ts +100 -0
- package/node_modules/@opentui/core/node_modules/diff/libcjs/patch/create.d.ts.map +1 -0
- package/node_modules/@opentui/core/node_modules/diff/libcjs/patch/create.js +223 -0
- package/node_modules/@opentui/core/node_modules/diff/libcjs/patch/line-endings.d.ts +17 -0
- package/node_modules/@opentui/core/node_modules/diff/libcjs/patch/line-endings.d.ts.map +1 -0
- package/node_modules/@opentui/core/node_modules/diff/libcjs/patch/line-endings.js +61 -0
- package/node_modules/@opentui/core/node_modules/diff/libcjs/patch/parse.d.ts +8 -0
- package/node_modules/@opentui/core/node_modules/diff/libcjs/patch/parse.d.ts.map +1 -0
- package/node_modules/@opentui/core/node_modules/diff/libcjs/patch/parse.js +133 -0
- package/node_modules/@opentui/core/node_modules/diff/libcjs/patch/reverse.d.ts +9 -0
- package/node_modules/@opentui/core/node_modules/diff/libcjs/patch/reverse.d.ts.map +1 -0
- package/node_modules/@opentui/core/node_modules/diff/libcjs/patch/reverse.js +37 -0
- package/node_modules/@opentui/core/node_modules/diff/libcjs/types.d.ts +213 -0
- package/node_modules/@opentui/core/node_modules/diff/libcjs/types.d.ts.map +1 -0
- package/node_modules/@opentui/core/node_modules/diff/libcjs/types.js +2 -0
- package/node_modules/@opentui/core/node_modules/diff/libcjs/util/array.d.ts +3 -0
- package/node_modules/@opentui/core/node_modules/diff/libcjs/util/array.d.ts.map +1 -0
- package/node_modules/@opentui/core/node_modules/diff/libcjs/util/array.js +21 -0
- package/node_modules/@opentui/core/node_modules/diff/libcjs/util/distance-iterator.d.ts +2 -0
- package/node_modules/@opentui/core/node_modules/diff/libcjs/util/distance-iterator.d.ts.map +1 -0
- package/node_modules/@opentui/core/node_modules/diff/libcjs/util/distance-iterator.js +40 -0
- package/node_modules/@opentui/core/node_modules/diff/libcjs/util/params.d.ts +4 -0
- package/node_modules/@opentui/core/node_modules/diff/libcjs/util/params.d.ts.map +1 -0
- package/node_modules/@opentui/core/node_modules/diff/libcjs/util/params.js +17 -0
- package/node_modules/@opentui/core/node_modules/diff/libcjs/util/string.d.ts +18 -0
- package/node_modules/@opentui/core/node_modules/diff/libcjs/util/string.d.ts.map +1 -0
- package/node_modules/@opentui/core/node_modules/diff/libcjs/util/string.js +141 -0
- package/node_modules/@opentui/core/node_modules/diff/libesm/convert/dmp.d.ts +8 -0
- package/node_modules/@opentui/core/node_modules/diff/libesm/convert/dmp.d.ts.map +1 -0
- package/node_modules/@opentui/core/node_modules/diff/libesm/convert/dmp.js +21 -0
- package/node_modules/@opentui/core/node_modules/diff/libesm/convert/xml.d.ts +6 -0
- package/node_modules/@opentui/core/node_modules/diff/libesm/convert/xml.d.ts.map +1 -0
- package/node_modules/@opentui/core/node_modules/diff/libesm/convert/xml.js +31 -0
- package/node_modules/@opentui/core/node_modules/diff/libesm/diff/array.d.ts +19 -0
- package/node_modules/@opentui/core/node_modules/diff/libesm/diff/array.d.ts.map +1 -0
- package/node_modules/@opentui/core/node_modules/diff/libesm/diff/array.js +16 -0
- package/node_modules/@opentui/core/node_modules/diff/libesm/diff/base.d.ts +20 -0
- package/node_modules/@opentui/core/node_modules/diff/libesm/diff/base.d.ts.map +1 -0
- package/node_modules/@opentui/core/node_modules/diff/libesm/diff/base.js +253 -0
- package/node_modules/@opentui/core/node_modules/diff/libesm/diff/character.d.ts +19 -0
- package/node_modules/@opentui/core/node_modules/diff/libesm/diff/character.d.ts.map +1 -0
- package/node_modules/@opentui/core/node_modules/diff/libesm/diff/character.js +7 -0
- package/node_modules/@opentui/core/node_modules/diff/libesm/diff/css.d.ts +18 -0
- package/node_modules/@opentui/core/node_modules/diff/libesm/diff/css.d.ts.map +1 -0
- package/node_modules/@opentui/core/node_modules/diff/libesm/diff/css.js +10 -0
- package/node_modules/@opentui/core/node_modules/diff/libesm/diff/json.d.ts +24 -0
- package/node_modules/@opentui/core/node_modules/diff/libesm/diff/json.d.ts.map +1 -0
- package/node_modules/@opentui/core/node_modules/diff/libesm/diff/json.js +78 -0
- package/node_modules/@opentui/core/node_modules/diff/libesm/diff/line.d.ts +24 -0
- package/node_modules/@opentui/core/node_modules/diff/libesm/diff/line.d.ts.map +1 -0
- package/node_modules/@opentui/core/node_modules/diff/libesm/diff/line.js +65 -0
- package/node_modules/@opentui/core/node_modules/diff/libesm/diff/sentence.d.ts +21 -0
- package/node_modules/@opentui/core/node_modules/diff/libesm/diff/sentence.d.ts.map +1 -0
- package/node_modules/@opentui/core/node_modules/diff/libesm/diff/sentence.js +43 -0
- package/node_modules/@opentui/core/node_modules/diff/libesm/diff/word.d.ts +35 -0
- package/node_modules/@opentui/core/node_modules/diff/libesm/diff/word.d.ts.map +1 -0
- package/node_modules/@opentui/core/node_modules/diff/libesm/diff/word.js +276 -0
- package/node_modules/@opentui/core/node_modules/diff/libesm/index.d.ts +20 -0
- package/node_modules/@opentui/core/node_modules/diff/libesm/index.d.ts.map +1 -0
- package/node_modules/@opentui/core/node_modules/diff/libesm/index.js +30 -0
- package/node_modules/@opentui/core/node_modules/diff/libesm/package.json +1 -0
- package/node_modules/@opentui/core/node_modules/diff/libesm/patch/apply.d.ts +62 -0
- package/node_modules/@opentui/core/node_modules/diff/libesm/patch/apply.d.ts.map +1 -0
- package/node_modules/@opentui/core/node_modules/diff/libesm/patch/apply.js +257 -0
- package/node_modules/@opentui/core/node_modules/diff/libesm/patch/create.d.ts +100 -0
- package/node_modules/@opentui/core/node_modules/diff/libesm/patch/create.d.ts.map +1 -0
- package/node_modules/@opentui/core/node_modules/diff/libesm/patch/create.js +201 -0
- package/node_modules/@opentui/core/node_modules/diff/libesm/patch/line-endings.d.ts +17 -0
- package/node_modules/@opentui/core/node_modules/diff/libesm/patch/line-endings.d.ts.map +1 -0
- package/node_modules/@opentui/core/node_modules/diff/libesm/patch/line-endings.js +44 -0
- package/node_modules/@opentui/core/node_modules/diff/libesm/patch/parse.d.ts +8 -0
- package/node_modules/@opentui/core/node_modules/diff/libesm/patch/parse.d.ts.map +1 -0
- package/node_modules/@opentui/core/node_modules/diff/libesm/patch/parse.js +130 -0
- package/node_modules/@opentui/core/node_modules/diff/libesm/patch/reverse.d.ts +9 -0
- package/node_modules/@opentui/core/node_modules/diff/libesm/patch/reverse.d.ts.map +1 -0
- package/node_modules/@opentui/core/node_modules/diff/libesm/patch/reverse.js +23 -0
- package/node_modules/@opentui/core/node_modules/diff/libesm/types.d.ts +213 -0
- package/node_modules/@opentui/core/node_modules/diff/libesm/types.d.ts.map +1 -0
- package/node_modules/@opentui/core/node_modules/diff/libesm/types.js +1 -0
- package/node_modules/@opentui/core/node_modules/diff/libesm/util/array.d.ts +3 -0
- package/node_modules/@opentui/core/node_modules/diff/libesm/util/array.d.ts.map +1 -0
- package/node_modules/@opentui/core/node_modules/diff/libesm/util/array.js +17 -0
- package/node_modules/@opentui/core/node_modules/diff/libesm/util/distance-iterator.d.ts +2 -0
- package/node_modules/@opentui/core/node_modules/diff/libesm/util/distance-iterator.d.ts.map +1 -0
- package/node_modules/@opentui/core/node_modules/diff/libesm/util/distance-iterator.js +37 -0
- package/node_modules/@opentui/core/node_modules/diff/libesm/util/params.d.ts +4 -0
- package/node_modules/@opentui/core/node_modules/diff/libesm/util/params.d.ts.map +1 -0
- package/node_modules/@opentui/core/node_modules/diff/libesm/util/params.js +14 -0
- package/node_modules/@opentui/core/node_modules/diff/libesm/util/string.d.ts +18 -0
- package/node_modules/@opentui/core/node_modules/diff/libesm/util/string.d.ts.map +1 -0
- package/node_modules/@opentui/core/node_modules/diff/libesm/util/string.js +128 -0
- package/node_modules/@opentui/core/node_modules/diff/package.json +131 -0
- package/node_modules/@opentui/core/node_modules/diff/release-notes.md +397 -0
- package/node_modules/@opentui/core/node_modules/marked/LICENSE.md +44 -0
- package/node_modules/@opentui/core/node_modules/marked/README.md +107 -0
- package/node_modules/@opentui/core/node_modules/marked/bin/main.js +283 -0
- package/node_modules/@opentui/core/node_modules/marked/bin/marked.js +16 -0
- package/node_modules/@opentui/core/node_modules/marked/lib/marked.d.ts +756 -0
- package/node_modules/@opentui/core/node_modules/marked/lib/marked.esm.js +72 -0
- package/node_modules/@opentui/core/node_modules/marked/lib/marked.esm.js.map +7 -0
- package/node_modules/@opentui/core/node_modules/marked/lib/marked.umd.js +74 -0
- package/node_modules/@opentui/core/node_modules/marked/lib/marked.umd.js.map +7 -0
- package/node_modules/@opentui/core/node_modules/marked/man/marked.1 +113 -0
- package/node_modules/@opentui/core/node_modules/marked/man/marked.1.md +93 -0
- package/node_modules/@opentui/core/node_modules/marked/package.json +103 -0
- package/package.json +1 -1
- package/xyne-linux-x64 +0 -0
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import Diff from './base.js';
|
|
2
|
+
import { tokenize } from './line.js';
|
|
3
|
+
class JsonDiff extends Diff {
|
|
4
|
+
constructor() {
|
|
5
|
+
super(...arguments);
|
|
6
|
+
this.tokenize = tokenize;
|
|
7
|
+
}
|
|
8
|
+
get useLongestToken() {
|
|
9
|
+
// Discriminate between two lines of pretty-printed, serialized JSON where one of them has a
|
|
10
|
+
// dangling comma and the other doesn't. Turns out including the dangling comma yields the nicest output:
|
|
11
|
+
return true;
|
|
12
|
+
}
|
|
13
|
+
castInput(value, options) {
|
|
14
|
+
const { undefinedReplacement, stringifyReplacer = (k, v) => typeof v === 'undefined' ? undefinedReplacement : v } = options;
|
|
15
|
+
return typeof value === 'string' ? value : JSON.stringify(canonicalize(value, null, null, stringifyReplacer), null, ' ');
|
|
16
|
+
}
|
|
17
|
+
equals(left, right, options) {
|
|
18
|
+
return super.equals(left.replace(/,([\r\n])/g, '$1'), right.replace(/,([\r\n])/g, '$1'), options);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
export const jsonDiff = new JsonDiff();
|
|
22
|
+
export function diffJson(oldStr, newStr, options) {
|
|
23
|
+
return jsonDiff.diff(oldStr, newStr, options);
|
|
24
|
+
}
|
|
25
|
+
// This function handles the presence of circular references by bailing out when encountering an
|
|
26
|
+
// object that is already on the "stack" of items being processed. Accepts an optional replacer
|
|
27
|
+
export function canonicalize(obj, stack, replacementStack, replacer, key) {
|
|
28
|
+
stack = stack || [];
|
|
29
|
+
replacementStack = replacementStack || [];
|
|
30
|
+
if (replacer) {
|
|
31
|
+
obj = replacer(key === undefined ? '' : key, obj);
|
|
32
|
+
}
|
|
33
|
+
let i;
|
|
34
|
+
for (i = 0; i < stack.length; i += 1) {
|
|
35
|
+
if (stack[i] === obj) {
|
|
36
|
+
return replacementStack[i];
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
let canonicalizedObj;
|
|
40
|
+
if ('[object Array]' === Object.prototype.toString.call(obj)) {
|
|
41
|
+
stack.push(obj);
|
|
42
|
+
canonicalizedObj = new Array(obj.length);
|
|
43
|
+
replacementStack.push(canonicalizedObj);
|
|
44
|
+
for (i = 0; i < obj.length; i += 1) {
|
|
45
|
+
canonicalizedObj[i] = canonicalize(obj[i], stack, replacementStack, replacer, String(i));
|
|
46
|
+
}
|
|
47
|
+
stack.pop();
|
|
48
|
+
replacementStack.pop();
|
|
49
|
+
return canonicalizedObj;
|
|
50
|
+
}
|
|
51
|
+
if (obj && obj.toJSON) {
|
|
52
|
+
obj = obj.toJSON();
|
|
53
|
+
}
|
|
54
|
+
if (typeof obj === 'object' && obj !== null) {
|
|
55
|
+
stack.push(obj);
|
|
56
|
+
canonicalizedObj = {};
|
|
57
|
+
replacementStack.push(canonicalizedObj);
|
|
58
|
+
const sortedKeys = [];
|
|
59
|
+
let key;
|
|
60
|
+
for (key in obj) {
|
|
61
|
+
/* istanbul ignore else */
|
|
62
|
+
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
63
|
+
sortedKeys.push(key);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
sortedKeys.sort();
|
|
67
|
+
for (i = 0; i < sortedKeys.length; i += 1) {
|
|
68
|
+
key = sortedKeys[i];
|
|
69
|
+
canonicalizedObj[key] = canonicalize(obj[key], stack, replacementStack, replacer, key);
|
|
70
|
+
}
|
|
71
|
+
stack.pop();
|
|
72
|
+
replacementStack.pop();
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
canonicalizedObj = obj;
|
|
76
|
+
}
|
|
77
|
+
return canonicalizedObj;
|
|
78
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import Diff from './base.js';
|
|
2
|
+
import type { ChangeObject, CallbackOptionAbortable, CallbackOptionNonabortable, DiffCallbackNonabortable, DiffLinesOptionsAbortable, DiffLinesOptionsNonabortable } from '../types.js';
|
|
3
|
+
declare class LineDiff extends Diff<string, string> {
|
|
4
|
+
tokenize: typeof tokenize;
|
|
5
|
+
equals(left: string, right: string, options: DiffLinesOptionsAbortable | DiffLinesOptionsNonabortable): boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare const lineDiff: LineDiff;
|
|
8
|
+
/**
|
|
9
|
+
* diffs two blocks of text, treating each line as a token.
|
|
10
|
+
* @returns a list of change objects.
|
|
11
|
+
*/
|
|
12
|
+
export declare function diffLines(oldStr: string, newStr: string, options: DiffCallbackNonabortable<string>): undefined;
|
|
13
|
+
export declare function diffLines(oldStr: string, newStr: string, options: DiffLinesOptionsAbortable & CallbackOptionAbortable<string>): undefined;
|
|
14
|
+
export declare function diffLines(oldStr: string, newStr: string, options: DiffLinesOptionsNonabortable & CallbackOptionNonabortable<string>): undefined;
|
|
15
|
+
export declare function diffLines(oldStr: string, newStr: string, options: DiffLinesOptionsAbortable): ChangeObject<string>[] | undefined;
|
|
16
|
+
export declare function diffLines(oldStr: string, newStr: string, options?: DiffLinesOptionsNonabortable): ChangeObject<string>[];
|
|
17
|
+
export declare function diffTrimmedLines(oldStr: string, newStr: string, options: DiffCallbackNonabortable<string>): undefined;
|
|
18
|
+
export declare function diffTrimmedLines(oldStr: string, newStr: string, options: DiffLinesOptionsAbortable & CallbackOptionAbortable<string>): undefined;
|
|
19
|
+
export declare function diffTrimmedLines(oldStr: string, newStr: string, options: DiffLinesOptionsNonabortable & CallbackOptionNonabortable<string>): undefined;
|
|
20
|
+
export declare function diffTrimmedLines(oldStr: string, newStr: string, options: DiffLinesOptionsAbortable): ChangeObject<string>[] | undefined;
|
|
21
|
+
export declare function diffTrimmedLines(oldStr: string, newStr: string, options?: DiffLinesOptionsNonabortable): ChangeObject<string>[];
|
|
22
|
+
export declare function tokenize(value: string, options: DiffLinesOptionsAbortable | DiffLinesOptionsNonabortable): string[];
|
|
23
|
+
export {};
|
|
24
|
+
//# sourceMappingURL=line.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"line.d.ts","sourceRoot":"","sources":["../../src/diff/line.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,KAAK,EAAE,YAAY,EAAE,uBAAuB,EAAE,0BAA0B,EAAE,wBAAwB,EAAE,yBAAyB,EAAE,4BAA4B,EAAC,MAAM,aAAa,CAAC;AAGvL,cAAM,QAAS,SAAQ,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC;IACzC,QAAQ,kBAAY;IAEpB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,yBAAyB,GAAG,4BAA4B;CAyBtG;AAED,eAAO,MAAM,QAAQ,UAAiB,CAAC;AAEvC;;;GAGG;AACH,wBAAgB,SAAS,CACvB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,wBAAwB,CAAC,MAAM,CAAC,GACxC,SAAS,CAAC;AACb,wBAAgB,SAAS,CACvB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,yBAAyB,GAAG,uBAAuB,CAAC,MAAM,CAAC,GACnE,SAAS,CAAA;AACZ,wBAAgB,SAAS,CACvB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,4BAA4B,GAAG,0BAA0B,CAAC,MAAM,CAAC,GACzE,SAAS,CAAA;AACZ,wBAAgB,SAAS,CACvB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,yBAAyB,GACjC,YAAY,CAAC,MAAM,CAAC,EAAE,GAAG,SAAS,CAAA;AACrC,wBAAgB,SAAS,CACvB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE,4BAA4B,GACrC,YAAY,CAAC,MAAM,CAAC,EAAE,CAAA;AAWzB,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,wBAAwB,CAAC,MAAM,CAAC,GACxC,SAAS,CAAC;AACb,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,yBAAyB,GAAG,uBAAuB,CAAC,MAAM,CAAC,GACnE,SAAS,CAAA;AACZ,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,4BAA4B,GAAG,0BAA0B,CAAC,MAAM,CAAC,GACzE,SAAS,CAAA;AACZ,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,yBAAyB,GACjC,YAAY,CAAC,MAAM,CAAC,EAAE,GAAG,SAAS,CAAA;AACrC,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE,4BAA4B,GACrC,YAAY,CAAC,MAAM,CAAC,EAAE,CAAA;AAOzB,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,yBAAyB,GAAG,4BAA4B,YA0BxG"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import Diff from './base.js';
|
|
2
|
+
import { generateOptions } from '../util/params.js';
|
|
3
|
+
class LineDiff extends Diff {
|
|
4
|
+
constructor() {
|
|
5
|
+
super(...arguments);
|
|
6
|
+
this.tokenize = tokenize;
|
|
7
|
+
}
|
|
8
|
+
equals(left, right, options) {
|
|
9
|
+
// If we're ignoring whitespace, we need to normalise lines by stripping
|
|
10
|
+
// whitespace before checking equality. (This has an annoying interaction
|
|
11
|
+
// with newlineIsToken that requires special handling: if newlines get their
|
|
12
|
+
// own token, then we DON'T want to trim the *newline* tokens down to empty
|
|
13
|
+
// strings, since this would cause us to treat whitespace-only line content
|
|
14
|
+
// as equal to a separator between lines, which would be weird and
|
|
15
|
+
// inconsistent with the documented behavior of the options.)
|
|
16
|
+
if (options.ignoreWhitespace) {
|
|
17
|
+
if (!options.newlineIsToken || !left.includes('\n')) {
|
|
18
|
+
left = left.trim();
|
|
19
|
+
}
|
|
20
|
+
if (!options.newlineIsToken || !right.includes('\n')) {
|
|
21
|
+
right = right.trim();
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
else if (options.ignoreNewlineAtEof && !options.newlineIsToken) {
|
|
25
|
+
if (left.endsWith('\n')) {
|
|
26
|
+
left = left.slice(0, -1);
|
|
27
|
+
}
|
|
28
|
+
if (right.endsWith('\n')) {
|
|
29
|
+
right = right.slice(0, -1);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return super.equals(left, right, options);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
export const lineDiff = new LineDiff();
|
|
36
|
+
export function diffLines(oldStr, newStr, options) {
|
|
37
|
+
return lineDiff.diff(oldStr, newStr, options);
|
|
38
|
+
}
|
|
39
|
+
export function diffTrimmedLines(oldStr, newStr, options) {
|
|
40
|
+
options = generateOptions(options, { ignoreWhitespace: true });
|
|
41
|
+
return lineDiff.diff(oldStr, newStr, options);
|
|
42
|
+
}
|
|
43
|
+
// Exported standalone so it can be used from jsonDiff too.
|
|
44
|
+
export function tokenize(value, options) {
|
|
45
|
+
if (options.stripTrailingCr) {
|
|
46
|
+
// remove one \r before \n to match GNU diff's --strip-trailing-cr behavior
|
|
47
|
+
value = value.replace(/\r\n/g, '\n');
|
|
48
|
+
}
|
|
49
|
+
const retLines = [], linesAndNewlines = value.split(/(\n|\r\n)/);
|
|
50
|
+
// Ignore the final empty token that occurs if the string ends with a new line
|
|
51
|
+
if (!linesAndNewlines[linesAndNewlines.length - 1]) {
|
|
52
|
+
linesAndNewlines.pop();
|
|
53
|
+
}
|
|
54
|
+
// Merge the content and line separators into single tokens
|
|
55
|
+
for (let i = 0; i < linesAndNewlines.length; i++) {
|
|
56
|
+
const line = linesAndNewlines[i];
|
|
57
|
+
if (i % 2 && !options.newlineIsToken) {
|
|
58
|
+
retLines[retLines.length - 1] += line;
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
retLines.push(line);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return retLines;
|
|
65
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import Diff from './base.js';
|
|
2
|
+
import type { ChangeObject, CallbackOptionAbortable, CallbackOptionNonabortable, DiffCallbackNonabortable, DiffSentencesOptionsAbortable, DiffSentencesOptionsNonabortable } from '../types.js';
|
|
3
|
+
declare class SentenceDiff extends Diff<string, string> {
|
|
4
|
+
tokenize(value: string): string[];
|
|
5
|
+
}
|
|
6
|
+
export declare const sentenceDiff: SentenceDiff;
|
|
7
|
+
/**
|
|
8
|
+
* diffs two blocks of text, treating each sentence, and the whitespace between each pair of sentences, as a token.
|
|
9
|
+
* The characters `.`, `!`, and `?`, when followed by whitespace, are treated as marking the end of a sentence; nothing else besides the end of the string is considered to mark a sentence end.
|
|
10
|
+
*
|
|
11
|
+
* (For more sophisticated detection of sentence breaks, including support for non-English punctuation, consider instead tokenizing with an [`Intl.Segmenter`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Segmenter) with `granularity: 'sentence'` and passing the result to `diffArrays`.)
|
|
12
|
+
*
|
|
13
|
+
* @returns a list of change objects.
|
|
14
|
+
*/
|
|
15
|
+
export declare function diffSentences(oldStr: string, newStr: string, options: DiffCallbackNonabortable<string>): undefined;
|
|
16
|
+
export declare function diffSentences(oldStr: string, newStr: string, options: DiffSentencesOptionsAbortable & CallbackOptionAbortable<string>): undefined;
|
|
17
|
+
export declare function diffSentences(oldStr: string, newStr: string, options: DiffSentencesOptionsNonabortable & CallbackOptionNonabortable<string>): undefined;
|
|
18
|
+
export declare function diffSentences(oldStr: string, newStr: string, options: DiffSentencesOptionsAbortable): ChangeObject<string>[] | undefined;
|
|
19
|
+
export declare function diffSentences(oldStr: string, newStr: string, options?: DiffSentencesOptionsNonabortable): ChangeObject<string>[];
|
|
20
|
+
export {};
|
|
21
|
+
//# sourceMappingURL=sentence.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sentence.d.ts","sourceRoot":"","sources":["../../src/diff/sentence.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,KAAK,EACV,YAAY,EACZ,uBAAuB,EACvB,0BAA0B,EAC1B,wBAAwB,EACxB,6BAA6B,EAC7B,gCAAgC,EACjC,MAAM,aAAa,CAAC;AAMrB,cAAM,YAAa,SAAQ,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC;IAC7C,QAAQ,CAAC,KAAK,EAAE,MAAM;CAoCvB;AAED,eAAO,MAAM,YAAY,cAAqB,CAAC;AAE/C;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAC3B,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,wBAAwB,CAAC,MAAM,CAAC,GACxC,SAAS,CAAC;AACb,wBAAgB,aAAa,CAC3B,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,6BAA6B,GAAG,uBAAuB,CAAC,MAAM,CAAC,GACvE,SAAS,CAAA;AACZ,wBAAgB,aAAa,CAC3B,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,gCAAgC,GAAG,0BAA0B,CAAC,MAAM,CAAC,GAC7E,SAAS,CAAA;AACZ,wBAAgB,aAAa,CAC3B,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,6BAA6B,GACrC,YAAY,CAAC,MAAM,CAAC,EAAE,GAAG,SAAS,CAAA;AACrC,wBAAgB,aAAa,CAC3B,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE,gCAAgC,GACzC,YAAY,CAAC,MAAM,CAAC,EAAE,CAAA"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import Diff from './base.js';
|
|
2
|
+
function isSentenceEndPunct(char) {
|
|
3
|
+
return char == '.' || char == '!' || char == '?';
|
|
4
|
+
}
|
|
5
|
+
class SentenceDiff extends Diff {
|
|
6
|
+
tokenize(value) {
|
|
7
|
+
var _a;
|
|
8
|
+
// If in future we drop support for environments that don't support lookbehinds, we can replace
|
|
9
|
+
// this entire function with:
|
|
10
|
+
// return value.split(/(?<=[.!?])(\s+|$)/);
|
|
11
|
+
// but until then, for similar reasons to the trailingWs function in string.ts, we are forced
|
|
12
|
+
// to do this verbosely "by hand" instead of using a regex.
|
|
13
|
+
const result = [];
|
|
14
|
+
let tokenStartI = 0;
|
|
15
|
+
for (let i = 0; i < value.length; i++) {
|
|
16
|
+
if (i == value.length - 1) {
|
|
17
|
+
result.push(value.slice(tokenStartI));
|
|
18
|
+
break;
|
|
19
|
+
}
|
|
20
|
+
if (isSentenceEndPunct(value[i]) && value[i + 1].match(/\s/)) {
|
|
21
|
+
// We've hit a sentence break - i.e. a punctuation mark followed by whitespace.
|
|
22
|
+
// We now want to push TWO tokens to the result:
|
|
23
|
+
// 1. the sentence
|
|
24
|
+
result.push(value.slice(tokenStartI, i + 1));
|
|
25
|
+
// 2. the whitespace
|
|
26
|
+
i = tokenStartI = i + 1;
|
|
27
|
+
while ((_a = value[i + 1]) === null || _a === void 0 ? void 0 : _a.match(/\s/)) {
|
|
28
|
+
i++;
|
|
29
|
+
}
|
|
30
|
+
result.push(value.slice(tokenStartI, i + 1));
|
|
31
|
+
// Then the next token (a sentence) starts on the character after the whitespace.
|
|
32
|
+
// (It's okay if this is off the end of the string - then the outer loop will terminate
|
|
33
|
+
// here anyway.)
|
|
34
|
+
tokenStartI = i + 1;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return result;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
export const sentenceDiff = new SentenceDiff();
|
|
41
|
+
export function diffSentences(oldStr, newStr, options) {
|
|
42
|
+
return sentenceDiff.diff(oldStr, newStr, options);
|
|
43
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import Diff from './base.js';
|
|
2
|
+
import type { ChangeObject, CallbackOptionAbortable, CallbackOptionNonabortable, DiffCallbackNonabortable, DiffWordsOptionsAbortable, DiffWordsOptionsNonabortable } from '../types.js';
|
|
3
|
+
declare class WordDiff extends Diff<string, string> {
|
|
4
|
+
equals(left: string, right: string, options: DiffWordsOptionsAbortable | DiffWordsOptionsNonabortable): boolean;
|
|
5
|
+
tokenize(value: string, options?: DiffWordsOptionsAbortable | DiffWordsOptionsNonabortable): string[];
|
|
6
|
+
join(tokens: string[]): string;
|
|
7
|
+
postProcess(changes: ChangeObject<string>[], options: any): ChangeObject<string>[];
|
|
8
|
+
}
|
|
9
|
+
export declare const wordDiff: WordDiff;
|
|
10
|
+
/**
|
|
11
|
+
* diffs two blocks of text, treating each word and each punctuation mark as a token.
|
|
12
|
+
* Whitespace is ignored when computing the diff (but preserved as far as possible in the final change objects).
|
|
13
|
+
*
|
|
14
|
+
* @returns a list of change objects.
|
|
15
|
+
*/
|
|
16
|
+
export declare function diffWords(oldStr: string, newStr: string, options: DiffCallbackNonabortable<string>): undefined;
|
|
17
|
+
export declare function diffWords(oldStr: string, newStr: string, options: DiffWordsOptionsAbortable & CallbackOptionAbortable<string>): undefined;
|
|
18
|
+
export declare function diffWords(oldStr: string, newStr: string, options: DiffWordsOptionsNonabortable & CallbackOptionNonabortable<string>): undefined;
|
|
19
|
+
export declare function diffWords(oldStr: string, newStr: string, options: DiffWordsOptionsAbortable): ChangeObject<string>[] | undefined;
|
|
20
|
+
export declare function diffWords(oldStr: string, newStr: string, options?: DiffWordsOptionsNonabortable): ChangeObject<string>[];
|
|
21
|
+
declare class WordsWithSpaceDiff extends Diff<string, string> {
|
|
22
|
+
tokenize(value: string): [] | RegExpMatchArray;
|
|
23
|
+
}
|
|
24
|
+
export declare const wordsWithSpaceDiff: WordsWithSpaceDiff;
|
|
25
|
+
/**
|
|
26
|
+
* diffs two blocks of text, treating each word, punctuation mark, newline, or run of (non-newline) whitespace as a token.
|
|
27
|
+
* @returns a list of change objects
|
|
28
|
+
*/
|
|
29
|
+
export declare function diffWordsWithSpace(oldStr: string, newStr: string, options: DiffCallbackNonabortable<string>): undefined;
|
|
30
|
+
export declare function diffWordsWithSpace(oldStr: string, newStr: string, options: DiffWordsOptionsAbortable & CallbackOptionAbortable<string>): undefined;
|
|
31
|
+
export declare function diffWordsWithSpace(oldStr: string, newStr: string, options: DiffWordsOptionsNonabortable & CallbackOptionNonabortable<string>): undefined;
|
|
32
|
+
export declare function diffWordsWithSpace(oldStr: string, newStr: string, options: DiffWordsOptionsAbortable): ChangeObject<string>[] | undefined;
|
|
33
|
+
export declare function diffWordsWithSpace(oldStr: string, newStr: string, options?: DiffWordsOptionsNonabortable): ChangeObject<string>[];
|
|
34
|
+
export {};
|
|
35
|
+
//# sourceMappingURL=word.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"word.d.ts","sourceRoot":"","sources":["../../src/diff/word.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,KAAK,EAAE,YAAY,EAAE,uBAAuB,EAAE,0BAA0B,EAAE,wBAAwB,EAAE,yBAAyB,EAAE,4BAA4B,EAAC,MAAM,aAAa,CAAC;AAmDvL,cAAM,QAAS,SAAQ,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC;IACzC,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,yBAAyB,GAAG,4BAA4B;IASrG,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,GAAE,yBAAyB,GAAG,4BAAiC;IAmC9F,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE;IAerB,WAAW,CAAC,OAAO,EAAE,YAAY,CAAC,MAAM,CAAC,EAAE,EAAE,OAAO,EAAE,GAAG;CA6B1D;AAED,eAAO,MAAM,QAAQ,UAAiB,CAAC;AAEvC;;;;;GAKG;AACH,wBAAgB,SAAS,CACvB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,wBAAwB,CAAC,MAAM,CAAC,GACxC,SAAS,CAAC;AACb,wBAAgB,SAAS,CACvB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,yBAAyB,GAAG,uBAAuB,CAAC,MAAM,CAAC,GACnE,SAAS,CAAA;AACZ,wBAAgB,SAAS,CACvB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,4BAA4B,GAAG,0BAA0B,CAAC,MAAM,CAAC,GACzE,SAAS,CAAA;AACZ,wBAAgB,SAAS,CACvB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,yBAAyB,GACjC,YAAY,CAAC,MAAM,CAAC,EAAE,GAAG,SAAS,CAAA;AACrC,wBAAgB,SAAS,CACvB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE,4BAA4B,GACrC,YAAY,CAAC,MAAM,CAAC,EAAE,CAAA;AA8IzB,cAAM,kBAAmB,SAAQ,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC;IACnD,QAAQ,CAAC,KAAK,EAAE,MAAM;CASvB;AAED,eAAO,MAAM,kBAAkB,oBAA2B,CAAC;AAE3D;;;GAGG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,wBAAwB,CAAC,MAAM,CAAC,GACxC,SAAS,CAAC;AACb,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,yBAAyB,GAAG,uBAAuB,CAAC,MAAM,CAAC,GACnE,SAAS,CAAA;AACZ,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,4BAA4B,GAAG,0BAA0B,CAAC,MAAM,CAAC,GACzE,SAAS,CAAA;AACZ,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,yBAAyB,GACjC,YAAY,CAAC,MAAM,CAAC,EAAE,GAAG,SAAS,CAAA;AACrC,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE,4BAA4B,GACrC,YAAY,CAAC,MAAM,CAAC,EAAE,CAAA"}
|
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
import Diff from './base.js';
|
|
2
|
+
import { longestCommonPrefix, longestCommonSuffix, replacePrefix, replaceSuffix, removePrefix, removeSuffix, maximumOverlap, leadingWs, trailingWs } from '../util/string.js';
|
|
3
|
+
// Based on https://en.wikipedia.org/wiki/Latin_script_in_Unicode
|
|
4
|
+
//
|
|
5
|
+
// Ranges and exceptions:
|
|
6
|
+
// Latin-1 Supplement, 0080–00FF
|
|
7
|
+
// - U+00D7 × Multiplication sign
|
|
8
|
+
// - U+00F7 ÷ Division sign
|
|
9
|
+
// Latin Extended-A, 0100–017F
|
|
10
|
+
// Latin Extended-B, 0180–024F
|
|
11
|
+
// IPA Extensions, 0250–02AF
|
|
12
|
+
// Spacing Modifier Letters, 02B0–02FF
|
|
13
|
+
// - U+02C7 ˇ ˇ Caron
|
|
14
|
+
// - U+02D8 ˘ ˘ Breve
|
|
15
|
+
// - U+02D9 ˙ ˙ Dot Above
|
|
16
|
+
// - U+02DA ˚ ˚ Ring Above
|
|
17
|
+
// - U+02DB ˛ ˛ Ogonek
|
|
18
|
+
// - U+02DC ˜ ˜ Small Tilde
|
|
19
|
+
// - U+02DD ˝ ˝ Double Acute Accent
|
|
20
|
+
// Latin Extended Additional, 1E00–1EFF
|
|
21
|
+
const extendedWordChars = 'a-zA-Z0-9_\\u{C0}-\\u{FF}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}';
|
|
22
|
+
// Each token is one of the following:
|
|
23
|
+
// - A punctuation mark plus the surrounding whitespace
|
|
24
|
+
// - A word plus the surrounding whitespace
|
|
25
|
+
// - Pure whitespace (but only in the special case where this the entire text
|
|
26
|
+
// is just whitespace)
|
|
27
|
+
//
|
|
28
|
+
// We have to include surrounding whitespace in the tokens because the two
|
|
29
|
+
// alternative approaches produce horribly broken results:
|
|
30
|
+
// * If we just discard the whitespace, we can't fully reproduce the original
|
|
31
|
+
// text from the sequence of tokens and any attempt to render the diff will
|
|
32
|
+
// get the whitespace wrong.
|
|
33
|
+
// * If we have separate tokens for whitespace, then in a typical text every
|
|
34
|
+
// second token will be a single space character. But this often results in
|
|
35
|
+
// the optimal diff between two texts being a perverse one that preserves
|
|
36
|
+
// the spaces between words but deletes and reinserts actual common words.
|
|
37
|
+
// See https://github.com/kpdecker/jsdiff/issues/160#issuecomment-1866099640
|
|
38
|
+
// for an example.
|
|
39
|
+
//
|
|
40
|
+
// Keeping the surrounding whitespace of course has implications for .equals
|
|
41
|
+
// and .join, not just .tokenize.
|
|
42
|
+
// This regex does NOT fully implement the tokenization rules described above.
|
|
43
|
+
// Instead, it gives runs of whitespace their own "token". The tokenize method
|
|
44
|
+
// then handles stitching whitespace tokens onto adjacent word or punctuation
|
|
45
|
+
// tokens.
|
|
46
|
+
const tokenizeIncludingWhitespace = new RegExp(`[${extendedWordChars}]+|\\s+|[^${extendedWordChars}]`, 'ug');
|
|
47
|
+
class WordDiff extends Diff {
|
|
48
|
+
equals(left, right, options) {
|
|
49
|
+
if (options.ignoreCase) {
|
|
50
|
+
left = left.toLowerCase();
|
|
51
|
+
right = right.toLowerCase();
|
|
52
|
+
}
|
|
53
|
+
return left.trim() === right.trim();
|
|
54
|
+
}
|
|
55
|
+
tokenize(value, options = {}) {
|
|
56
|
+
let parts;
|
|
57
|
+
if (options.intlSegmenter) {
|
|
58
|
+
const segmenter = options.intlSegmenter;
|
|
59
|
+
if (segmenter.resolvedOptions().granularity != 'word') {
|
|
60
|
+
throw new Error('The segmenter passed must have a granularity of "word"');
|
|
61
|
+
}
|
|
62
|
+
parts = Array.from(segmenter.segment(value), segment => segment.segment);
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
parts = value.match(tokenizeIncludingWhitespace) || [];
|
|
66
|
+
}
|
|
67
|
+
const tokens = [];
|
|
68
|
+
let prevPart = null;
|
|
69
|
+
parts.forEach(part => {
|
|
70
|
+
if ((/\s/).test(part)) {
|
|
71
|
+
if (prevPart == null) {
|
|
72
|
+
tokens.push(part);
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
tokens.push(tokens.pop() + part);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
else if (prevPart != null && (/\s/).test(prevPart)) {
|
|
79
|
+
if (tokens[tokens.length - 1] == prevPart) {
|
|
80
|
+
tokens.push(tokens.pop() + part);
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
tokens.push(prevPart + part);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
tokens.push(part);
|
|
88
|
+
}
|
|
89
|
+
prevPart = part;
|
|
90
|
+
});
|
|
91
|
+
return tokens;
|
|
92
|
+
}
|
|
93
|
+
join(tokens) {
|
|
94
|
+
// Tokens being joined here will always have appeared consecutively in the
|
|
95
|
+
// same text, so we can simply strip off the leading whitespace from all the
|
|
96
|
+
// tokens except the first (and except any whitespace-only tokens - but such
|
|
97
|
+
// a token will always be the first and only token anyway) and then join them
|
|
98
|
+
// and the whitespace around words and punctuation will end up correct.
|
|
99
|
+
return tokens.map((token, i) => {
|
|
100
|
+
if (i == 0) {
|
|
101
|
+
return token;
|
|
102
|
+
}
|
|
103
|
+
else {
|
|
104
|
+
return token.replace((/^\s+/), '');
|
|
105
|
+
}
|
|
106
|
+
}).join('');
|
|
107
|
+
}
|
|
108
|
+
postProcess(changes, options) {
|
|
109
|
+
if (!changes || options.oneChangePerToken) {
|
|
110
|
+
return changes;
|
|
111
|
+
}
|
|
112
|
+
let lastKeep = null;
|
|
113
|
+
// Change objects representing any insertion or deletion since the last
|
|
114
|
+
// "keep" change object. There can be at most one of each.
|
|
115
|
+
let insertion = null;
|
|
116
|
+
let deletion = null;
|
|
117
|
+
changes.forEach(change => {
|
|
118
|
+
if (change.added) {
|
|
119
|
+
insertion = change;
|
|
120
|
+
}
|
|
121
|
+
else if (change.removed) {
|
|
122
|
+
deletion = change;
|
|
123
|
+
}
|
|
124
|
+
else {
|
|
125
|
+
if (insertion || deletion) { // May be false at start of text
|
|
126
|
+
dedupeWhitespaceInChangeObjects(lastKeep, deletion, insertion, change);
|
|
127
|
+
}
|
|
128
|
+
lastKeep = change;
|
|
129
|
+
insertion = null;
|
|
130
|
+
deletion = null;
|
|
131
|
+
}
|
|
132
|
+
});
|
|
133
|
+
if (insertion || deletion) {
|
|
134
|
+
dedupeWhitespaceInChangeObjects(lastKeep, deletion, insertion, null);
|
|
135
|
+
}
|
|
136
|
+
return changes;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
export const wordDiff = new WordDiff();
|
|
140
|
+
export function diffWords(oldStr, newStr, options) {
|
|
141
|
+
// This option has never been documented and never will be (it's clearer to
|
|
142
|
+
// just call `diffWordsWithSpace` directly if you need that behavior), but
|
|
143
|
+
// has existed in jsdiff for a long time, so we retain support for it here
|
|
144
|
+
// for the sake of backwards compatibility.
|
|
145
|
+
if ((options === null || options === void 0 ? void 0 : options.ignoreWhitespace) != null && !options.ignoreWhitespace) {
|
|
146
|
+
return diffWordsWithSpace(oldStr, newStr, options);
|
|
147
|
+
}
|
|
148
|
+
return wordDiff.diff(oldStr, newStr, options);
|
|
149
|
+
}
|
|
150
|
+
function dedupeWhitespaceInChangeObjects(startKeep, deletion, insertion, endKeep) {
|
|
151
|
+
// Before returning, we tidy up the leading and trailing whitespace of the
|
|
152
|
+
// change objects to eliminate cases where trailing whitespace in one object
|
|
153
|
+
// is repeated as leading whitespace in the next.
|
|
154
|
+
// Below are examples of the outcomes we want here to explain the code.
|
|
155
|
+
// I=insert, K=keep, D=delete
|
|
156
|
+
// 1. diffing 'foo bar baz' vs 'foo baz'
|
|
157
|
+
// Prior to cleanup, we have K:'foo ' D:' bar ' K:' baz'
|
|
158
|
+
// After cleanup, we want: K:'foo ' D:'bar ' K:'baz'
|
|
159
|
+
//
|
|
160
|
+
// 2. Diffing 'foo bar baz' vs 'foo qux baz'
|
|
161
|
+
// Prior to cleanup, we have K:'foo ' D:' bar ' I:' qux ' K:' baz'
|
|
162
|
+
// After cleanup, we want K:'foo ' D:'bar' I:'qux' K:' baz'
|
|
163
|
+
//
|
|
164
|
+
// 3. Diffing 'foo\nbar baz' vs 'foo baz'
|
|
165
|
+
// Prior to cleanup, we have K:'foo ' D:'\nbar ' K:' baz'
|
|
166
|
+
// After cleanup, we want K'foo' D:'\nbar' K:' baz'
|
|
167
|
+
//
|
|
168
|
+
// 4. Diffing 'foo baz' vs 'foo\nbar baz'
|
|
169
|
+
// Prior to cleanup, we have K:'foo\n' I:'\nbar ' K:' baz'
|
|
170
|
+
// After cleanup, we ideally want K'foo' I:'\nbar' K:' baz'
|
|
171
|
+
// but don't actually manage this currently (the pre-cleanup change
|
|
172
|
+
// objects don't contain enough information to make it possible).
|
|
173
|
+
//
|
|
174
|
+
// 5. Diffing 'foo bar baz' vs 'foo baz'
|
|
175
|
+
// Prior to cleanup, we have K:'foo ' D:' bar ' K:' baz'
|
|
176
|
+
// After cleanup, we want K:'foo ' D:' bar ' K:'baz'
|
|
177
|
+
//
|
|
178
|
+
// Our handling is unavoidably imperfect in the case where there's a single
|
|
179
|
+
// indel between keeps and the whitespace has changed. For instance, consider
|
|
180
|
+
// diffing 'foo\tbar\nbaz' vs 'foo baz'. Unless we create an extra change
|
|
181
|
+
// object to represent the insertion of the space character (which isn't even
|
|
182
|
+
// a token), we have no way to avoid losing information about the texts'
|
|
183
|
+
// original whitespace in the result we return. Still, we do our best to
|
|
184
|
+
// output something that will look sensible if we e.g. print it with
|
|
185
|
+
// insertions in green and deletions in red.
|
|
186
|
+
// Between two "keep" change objects (or before the first or after the last
|
|
187
|
+
// change object), we can have either:
|
|
188
|
+
// * A "delete" followed by an "insert"
|
|
189
|
+
// * Just an "insert"
|
|
190
|
+
// * Just a "delete"
|
|
191
|
+
// We handle the three cases separately.
|
|
192
|
+
if (deletion && insertion) {
|
|
193
|
+
const oldWsPrefix = leadingWs(deletion.value);
|
|
194
|
+
const oldWsSuffix = trailingWs(deletion.value);
|
|
195
|
+
const newWsPrefix = leadingWs(insertion.value);
|
|
196
|
+
const newWsSuffix = trailingWs(insertion.value);
|
|
197
|
+
if (startKeep) {
|
|
198
|
+
const commonWsPrefix = longestCommonPrefix(oldWsPrefix, newWsPrefix);
|
|
199
|
+
startKeep.value = replaceSuffix(startKeep.value, newWsPrefix, commonWsPrefix);
|
|
200
|
+
deletion.value = removePrefix(deletion.value, commonWsPrefix);
|
|
201
|
+
insertion.value = removePrefix(insertion.value, commonWsPrefix);
|
|
202
|
+
}
|
|
203
|
+
if (endKeep) {
|
|
204
|
+
const commonWsSuffix = longestCommonSuffix(oldWsSuffix, newWsSuffix);
|
|
205
|
+
endKeep.value = replacePrefix(endKeep.value, newWsSuffix, commonWsSuffix);
|
|
206
|
+
deletion.value = removeSuffix(deletion.value, commonWsSuffix);
|
|
207
|
+
insertion.value = removeSuffix(insertion.value, commonWsSuffix);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
else if (insertion) {
|
|
211
|
+
// The whitespaces all reflect what was in the new text rather than
|
|
212
|
+
// the old, so we essentially have no information about whitespace
|
|
213
|
+
// insertion or deletion. We just want to dedupe the whitespace.
|
|
214
|
+
// We do that by having each change object keep its trailing
|
|
215
|
+
// whitespace and deleting duplicate leading whitespace where
|
|
216
|
+
// present.
|
|
217
|
+
if (startKeep) {
|
|
218
|
+
const ws = leadingWs(insertion.value);
|
|
219
|
+
insertion.value = insertion.value.substring(ws.length);
|
|
220
|
+
}
|
|
221
|
+
if (endKeep) {
|
|
222
|
+
const ws = leadingWs(endKeep.value);
|
|
223
|
+
endKeep.value = endKeep.value.substring(ws.length);
|
|
224
|
+
}
|
|
225
|
+
// otherwise we've got a deletion and no insertion
|
|
226
|
+
}
|
|
227
|
+
else if (startKeep && endKeep) {
|
|
228
|
+
const newWsFull = leadingWs(endKeep.value), delWsStart = leadingWs(deletion.value), delWsEnd = trailingWs(deletion.value);
|
|
229
|
+
// Any whitespace that comes straight after startKeep in both the old and
|
|
230
|
+
// new texts, assign to startKeep and remove from the deletion.
|
|
231
|
+
const newWsStart = longestCommonPrefix(newWsFull, delWsStart);
|
|
232
|
+
deletion.value = removePrefix(deletion.value, newWsStart);
|
|
233
|
+
// Any whitespace that comes straight before endKeep in both the old and
|
|
234
|
+
// new texts, and hasn't already been assigned to startKeep, assign to
|
|
235
|
+
// endKeep and remove from the deletion.
|
|
236
|
+
const newWsEnd = longestCommonSuffix(removePrefix(newWsFull, newWsStart), delWsEnd);
|
|
237
|
+
deletion.value = removeSuffix(deletion.value, newWsEnd);
|
|
238
|
+
endKeep.value = replacePrefix(endKeep.value, newWsFull, newWsEnd);
|
|
239
|
+
// If there's any whitespace from the new text that HASN'T already been
|
|
240
|
+
// assigned, assign it to the start:
|
|
241
|
+
startKeep.value = replaceSuffix(startKeep.value, newWsFull, newWsFull.slice(0, newWsFull.length - newWsEnd.length));
|
|
242
|
+
}
|
|
243
|
+
else if (endKeep) {
|
|
244
|
+
// We are at the start of the text. Preserve all the whitespace on
|
|
245
|
+
// endKeep, and just remove whitespace from the end of deletion to the
|
|
246
|
+
// extent that it overlaps with the start of endKeep.
|
|
247
|
+
const endKeepWsPrefix = leadingWs(endKeep.value);
|
|
248
|
+
const deletionWsSuffix = trailingWs(deletion.value);
|
|
249
|
+
const overlap = maximumOverlap(deletionWsSuffix, endKeepWsPrefix);
|
|
250
|
+
deletion.value = removeSuffix(deletion.value, overlap);
|
|
251
|
+
}
|
|
252
|
+
else if (startKeep) {
|
|
253
|
+
// We are at the END of the text. Preserve all the whitespace on
|
|
254
|
+
// startKeep, and just remove whitespace from the start of deletion to
|
|
255
|
+
// the extent that it overlaps with the end of startKeep.
|
|
256
|
+
const startKeepWsSuffix = trailingWs(startKeep.value);
|
|
257
|
+
const deletionWsPrefix = leadingWs(deletion.value);
|
|
258
|
+
const overlap = maximumOverlap(startKeepWsSuffix, deletionWsPrefix);
|
|
259
|
+
deletion.value = removePrefix(deletion.value, overlap);
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
class WordsWithSpaceDiff extends Diff {
|
|
263
|
+
tokenize(value) {
|
|
264
|
+
// Slightly different to the tokenizeIncludingWhitespace regex used above in
|
|
265
|
+
// that this one treats each individual newline as a distinct tokens, rather
|
|
266
|
+
// than merging them into other surrounding whitespace. This was requested
|
|
267
|
+
// in https://github.com/kpdecker/jsdiff/issues/180 &
|
|
268
|
+
// https://github.com/kpdecker/jsdiff/issues/211
|
|
269
|
+
const regex = new RegExp(`(\\r?\\n)|[${extendedWordChars}]+|[^\\S\\n\\r]+|[^${extendedWordChars}]`, 'ug');
|
|
270
|
+
return value.match(regex) || [];
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
export const wordsWithSpaceDiff = new WordsWithSpaceDiff();
|
|
274
|
+
export function diffWordsWithSpace(oldStr, newStr, options) {
|
|
275
|
+
return wordsWithSpaceDiff.diff(oldStr, newStr, options);
|
|
276
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import Diff from './diff/base.js';
|
|
2
|
+
import { diffChars, characterDiff } from './diff/character.js';
|
|
3
|
+
import { diffWords, diffWordsWithSpace, wordDiff, wordsWithSpaceDiff } from './diff/word.js';
|
|
4
|
+
import { diffLines, diffTrimmedLines, lineDiff } from './diff/line.js';
|
|
5
|
+
import { diffSentences, sentenceDiff } from './diff/sentence.js';
|
|
6
|
+
import { diffCss, cssDiff } from './diff/css.js';
|
|
7
|
+
import { diffJson, canonicalize, jsonDiff } from './diff/json.js';
|
|
8
|
+
import { diffArrays, arrayDiff } from './diff/array.js';
|
|
9
|
+
import { applyPatch, applyPatches } from './patch/apply.js';
|
|
10
|
+
import type { ApplyPatchOptions, ApplyPatchesOptions } from './patch/apply.js';
|
|
11
|
+
import { parsePatch } from './patch/parse.js';
|
|
12
|
+
import { reversePatch } from './patch/reverse.js';
|
|
13
|
+
import { structuredPatch, createTwoFilesPatch, createPatch, formatPatch } from './patch/create.js';
|
|
14
|
+
import type { StructuredPatchOptionsAbortable, StructuredPatchOptionsNonabortable, CreatePatchOptionsAbortable, CreatePatchOptionsNonabortable } from './patch/create.js';
|
|
15
|
+
import { convertChangesToDMP } from './convert/dmp.js';
|
|
16
|
+
import { convertChangesToXML } from './convert/xml.js';
|
|
17
|
+
import type { ChangeObject, Change, DiffArraysOptionsAbortable, DiffArraysOptionsNonabortable, DiffCharsOptionsAbortable, DiffCharsOptionsNonabortable, DiffLinesOptionsAbortable, DiffLinesOptionsNonabortable, DiffWordsOptionsAbortable, DiffWordsOptionsNonabortable, DiffSentencesOptionsAbortable, DiffSentencesOptionsNonabortable, DiffJsonOptionsAbortable, DiffJsonOptionsNonabortable, DiffCssOptionsAbortable, DiffCssOptionsNonabortable, StructuredPatch, StructuredPatchHunk } from './types.js';
|
|
18
|
+
export { Diff, diffChars, characterDiff, diffWords, wordDiff, diffWordsWithSpace, wordsWithSpaceDiff, diffLines, lineDiff, diffTrimmedLines, diffSentences, sentenceDiff, diffCss, cssDiff, diffJson, jsonDiff, diffArrays, arrayDiff, structuredPatch, createTwoFilesPatch, createPatch, formatPatch, applyPatch, applyPatches, parsePatch, reversePatch, convertChangesToDMP, convertChangesToXML, canonicalize };
|
|
19
|
+
export type { ChangeObject, Change, DiffArraysOptionsAbortable, DiffArraysOptionsNonabortable, DiffCharsOptionsAbortable, DiffCharsOptionsNonabortable, DiffLinesOptionsAbortable, DiffLinesOptionsNonabortable, DiffWordsOptionsAbortable, DiffWordsOptionsNonabortable, DiffSentencesOptionsAbortable, DiffSentencesOptionsNonabortable, DiffJsonOptionsAbortable, DiffJsonOptionsNonabortable, DiffCssOptionsAbortable, DiffCssOptionsNonabortable, StructuredPatch, StructuredPatchHunk, ApplyPatchOptions, ApplyPatchesOptions, StructuredPatchOptionsAbortable, StructuredPatchOptionsNonabortable, CreatePatchOptionsAbortable, CreatePatchOptionsNonabortable };
|
|
20
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAgBA,OAAO,IAAI,MAAM,gBAAgB,CAAC;AAClC,OAAO,EAAC,SAAS,EAAE,aAAa,EAAC,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EAAC,SAAS,EAAE,kBAAkB,EAAE,QAAQ,EAAE,kBAAkB,EAAC,MAAM,gBAAgB,CAAC;AAC3F,OAAO,EAAC,SAAS,EAAE,gBAAgB,EAAE,QAAQ,EAAC,MAAM,gBAAgB,CAAC;AACrE,OAAO,EAAC,aAAa,EAAE,YAAY,EAAC,MAAM,oBAAoB,CAAC;AAE/D,OAAO,EAAC,OAAO,EAAE,OAAO,EAAC,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAC,QAAQ,EAAE,YAAY,EAAE,QAAQ,EAAC,MAAM,gBAAgB,CAAC;AAEhE,OAAO,EAAC,UAAU,EAAE,SAAS,EAAC,MAAM,iBAAiB,CAAC;AAEtD,OAAO,EAAC,UAAU,EAAE,YAAY,EAAC,MAAM,kBAAkB,CAAC;AAC1D,OAAO,KAAK,EAAC,iBAAiB,EAAE,mBAAmB,EAAC,MAAM,kBAAkB,CAAC;AAC7E,OAAO,EAAC,UAAU,EAAC,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAC,YAAY,EAAC,MAAM,oBAAoB,CAAC;AAChD,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,WAAW,EACX,WAAW,EACZ,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EACV,+BAA+B,EAC/B,kCAAkC,EAClC,2BAA2B,EAC3B,8BAA8B,EAC/B,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAC,mBAAmB,EAAC,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAC,mBAAmB,EAAC,MAAM,kBAAkB,CAAC;AACrD,OAAO,KAAK,EACV,YAAY,EACZ,MAAM,EACN,0BAA0B,EAC1B,6BAA6B,EAC7B,yBAAyB,EACzB,4BAA4B,EAC5B,yBAAyB,EACzB,4BAA4B,EAC5B,yBAAyB,EACzB,4BAA4B,EAC5B,6BAA6B,EAC7B,gCAAgC,EAChC,wBAAwB,EACxB,2BAA2B,EAC3B,uBAAuB,EACvB,0BAA0B,EAC1B,eAAe,EACf,mBAAmB,EACpB,MAAM,YAAY,CAAC;AAEpB,OAAO,EACL,IAAI,EAEJ,SAAS,EACT,aAAa,EACb,SAAS,EACT,QAAQ,EACR,kBAAkB,EAClB,kBAAkB,EAClB,SAAS,EACT,QAAQ,EACR,gBAAgB,EAChB,aAAa,EACb,YAAY,EACZ,OAAO,EACP,OAAO,EACP,QAAQ,EACR,QAAQ,EACR,UAAU,EACV,SAAS,EAET,eAAe,EACf,mBAAmB,EACnB,WAAW,EACX,WAAW,EACX,UAAU,EACV,YAAY,EACZ,UAAU,EACV,YAAY,EACZ,mBAAmB,EACnB,mBAAmB,EACnB,YAAY,EACb,CAAC;AAEF,YAAY,EACV,YAAY,EACZ,MAAM,EACN,0BAA0B,EAC1B,6BAA6B,EAC7B,yBAAyB,EACzB,4BAA4B,EAC5B,yBAAyB,EACzB,4BAA4B,EAC5B,yBAAyB,EACzB,4BAA4B,EAC5B,6BAA6B,EAC7B,gCAAgC,EAChC,wBAAwB,EACxB,2BAA2B,EAC3B,uBAAuB,EACvB,0BAA0B,EAC1B,eAAe,EACf,mBAAmB,EAEnB,iBAAiB,EACjB,mBAAmB,EAEnB,+BAA+B,EAC/B,kCAAkC,EAClC,2BAA2B,EAC3B,8BAA8B,EAC/B,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/* See LICENSE file for terms of use */
|
|
2
|
+
/*
|
|
3
|
+
* Text diff implementation.
|
|
4
|
+
*
|
|
5
|
+
* This library supports the following APIs:
|
|
6
|
+
* Diff.diffChars: Character by character diff
|
|
7
|
+
* Diff.diffWords: Word (as defined by \b regex) diff which ignores whitespace
|
|
8
|
+
* Diff.diffLines: Line based diff
|
|
9
|
+
*
|
|
10
|
+
* Diff.diffCss: Diff targeted at CSS content
|
|
11
|
+
*
|
|
12
|
+
* These methods are based on the implementation proposed in
|
|
13
|
+
* "An O(ND) Difference Algorithm and its Variations" (Myers, 1986).
|
|
14
|
+
* http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.4.6927
|
|
15
|
+
*/
|
|
16
|
+
import Diff from './diff/base.js';
|
|
17
|
+
import { diffChars, characterDiff } from './diff/character.js';
|
|
18
|
+
import { diffWords, diffWordsWithSpace, wordDiff, wordsWithSpaceDiff } from './diff/word.js';
|
|
19
|
+
import { diffLines, diffTrimmedLines, lineDiff } from './diff/line.js';
|
|
20
|
+
import { diffSentences, sentenceDiff } from './diff/sentence.js';
|
|
21
|
+
import { diffCss, cssDiff } from './diff/css.js';
|
|
22
|
+
import { diffJson, canonicalize, jsonDiff } from './diff/json.js';
|
|
23
|
+
import { diffArrays, arrayDiff } from './diff/array.js';
|
|
24
|
+
import { applyPatch, applyPatches } from './patch/apply.js';
|
|
25
|
+
import { parsePatch } from './patch/parse.js';
|
|
26
|
+
import { reversePatch } from './patch/reverse.js';
|
|
27
|
+
import { structuredPatch, createTwoFilesPatch, createPatch, formatPatch } from './patch/create.js';
|
|
28
|
+
import { convertChangesToDMP } from './convert/dmp.js';
|
|
29
|
+
import { convertChangesToXML } from './convert/xml.js';
|
|
30
|
+
export { Diff, diffChars, characterDiff, diffWords, wordDiff, diffWordsWithSpace, wordsWithSpaceDiff, diffLines, lineDiff, diffTrimmedLines, diffSentences, sentenceDiff, diffCss, cssDiff, diffJson, jsonDiff, diffArrays, arrayDiff, structuredPatch, createTwoFilesPatch, createPatch, formatPatch, applyPatch, applyPatches, parsePatch, reversePatch, convertChangesToDMP, convertChangesToXML, canonicalize };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"module","sideEffects":false}
|