@xyne/xyne-cli-linux-x64 0.4.4 → 0.4.5
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/index-4kfx7p6q.js +47 -9
- package/package.json +1 -1
- package/xyne-linux-x64 +0 -0
- package/node_modules/@opentui/core/node_modules/diff/CONTRIBUTING.md +0 -28
- package/node_modules/@opentui/core/node_modules/diff/LICENSE +0 -29
- package/node_modules/@opentui/core/node_modules/diff/README.md +0 -378
- package/node_modules/@opentui/core/node_modules/diff/dist/diff.js +0 -1674
- package/node_modules/@opentui/core/node_modules/diff/dist/diff.min.js +0 -1
- package/node_modules/@opentui/core/node_modules/diff/eslint.config.mjs +0 -182
- package/node_modules/@opentui/core/node_modules/diff/libcjs/convert/dmp.d.ts +0 -8
- package/node_modules/@opentui/core/node_modules/diff/libcjs/convert/dmp.d.ts.map +0 -1
- package/node_modules/@opentui/core/node_modules/diff/libcjs/convert/dmp.js +0 -24
- package/node_modules/@opentui/core/node_modules/diff/libcjs/convert/xml.d.ts +0 -6
- package/node_modules/@opentui/core/node_modules/diff/libcjs/convert/xml.d.ts.map +0 -1
- package/node_modules/@opentui/core/node_modules/diff/libcjs/convert/xml.js +0 -34
- package/node_modules/@opentui/core/node_modules/diff/libcjs/diff/array.d.ts +0 -19
- package/node_modules/@opentui/core/node_modules/diff/libcjs/diff/array.d.ts.map +0 -1
- package/node_modules/@opentui/core/node_modules/diff/libcjs/diff/array.js +0 -40
- package/node_modules/@opentui/core/node_modules/diff/libcjs/diff/base.d.ts +0 -20
- package/node_modules/@opentui/core/node_modules/diff/libcjs/diff/base.d.ts.map +0 -1
- package/node_modules/@opentui/core/node_modules/diff/libcjs/diff/base.js +0 -265
- package/node_modules/@opentui/core/node_modules/diff/libcjs/diff/character.d.ts +0 -19
- package/node_modules/@opentui/core/node_modules/diff/libcjs/diff/character.d.ts.map +0 -1
- package/node_modules/@opentui/core/node_modules/diff/libcjs/diff/character.js +0 -31
- package/node_modules/@opentui/core/node_modules/diff/libcjs/diff/css.d.ts +0 -18
- package/node_modules/@opentui/core/node_modules/diff/libcjs/diff/css.d.ts.map +0 -1
- package/node_modules/@opentui/core/node_modules/diff/libcjs/diff/css.js +0 -34
- package/node_modules/@opentui/core/node_modules/diff/libcjs/diff/json.d.ts +0 -24
- package/node_modules/@opentui/core/node_modules/diff/libcjs/diff/json.d.ts.map +0 -1
- package/node_modules/@opentui/core/node_modules/diff/libcjs/diff/json.js +0 -105
- package/node_modules/@opentui/core/node_modules/diff/libcjs/diff/line.d.ts +0 -24
- package/node_modules/@opentui/core/node_modules/diff/libcjs/diff/line.d.ts.map +0 -1
- package/node_modules/@opentui/core/node_modules/diff/libcjs/diff/line.js +0 -89
- package/node_modules/@opentui/core/node_modules/diff/libcjs/diff/sentence.d.ts +0 -21
- package/node_modules/@opentui/core/node_modules/diff/libcjs/diff/sentence.d.ts.map +0 -1
- package/node_modules/@opentui/core/node_modules/diff/libcjs/diff/sentence.js +0 -67
- package/node_modules/@opentui/core/node_modules/diff/libcjs/diff/word.d.ts +0 -35
- package/node_modules/@opentui/core/node_modules/diff/libcjs/diff/word.d.ts.map +0 -1
- package/node_modules/@opentui/core/node_modules/diff/libcjs/diff/word.js +0 -307
- package/node_modules/@opentui/core/node_modules/diff/libcjs/index.d.ts +0 -20
- package/node_modules/@opentui/core/node_modules/diff/libcjs/index.d.ts.map +0 -1
- package/node_modules/@opentui/core/node_modules/diff/libcjs/index.js +0 -61
- package/node_modules/@opentui/core/node_modules/diff/libcjs/package.json +0 -1
- package/node_modules/@opentui/core/node_modules/diff/libcjs/patch/apply.d.ts +0 -62
- package/node_modules/@opentui/core/node_modules/diff/libcjs/patch/apply.d.ts.map +0 -1
- package/node_modules/@opentui/core/node_modules/diff/libcjs/patch/apply.js +0 -267
- package/node_modules/@opentui/core/node_modules/diff/libcjs/patch/create.d.ts +0 -100
- package/node_modules/@opentui/core/node_modules/diff/libcjs/patch/create.d.ts.map +0 -1
- package/node_modules/@opentui/core/node_modules/diff/libcjs/patch/create.js +0 -223
- package/node_modules/@opentui/core/node_modules/diff/libcjs/patch/line-endings.d.ts +0 -17
- package/node_modules/@opentui/core/node_modules/diff/libcjs/patch/line-endings.d.ts.map +0 -1
- package/node_modules/@opentui/core/node_modules/diff/libcjs/patch/line-endings.js +0 -61
- package/node_modules/@opentui/core/node_modules/diff/libcjs/patch/parse.d.ts +0 -8
- package/node_modules/@opentui/core/node_modules/diff/libcjs/patch/parse.d.ts.map +0 -1
- package/node_modules/@opentui/core/node_modules/diff/libcjs/patch/parse.js +0 -133
- package/node_modules/@opentui/core/node_modules/diff/libcjs/patch/reverse.d.ts +0 -9
- package/node_modules/@opentui/core/node_modules/diff/libcjs/patch/reverse.d.ts.map +0 -1
- package/node_modules/@opentui/core/node_modules/diff/libcjs/patch/reverse.js +0 -37
- package/node_modules/@opentui/core/node_modules/diff/libcjs/types.d.ts +0 -213
- package/node_modules/@opentui/core/node_modules/diff/libcjs/types.d.ts.map +0 -1
- package/node_modules/@opentui/core/node_modules/diff/libcjs/types.js +0 -2
- package/node_modules/@opentui/core/node_modules/diff/libcjs/util/array.d.ts +0 -3
- package/node_modules/@opentui/core/node_modules/diff/libcjs/util/array.d.ts.map +0 -1
- package/node_modules/@opentui/core/node_modules/diff/libcjs/util/array.js +0 -21
- package/node_modules/@opentui/core/node_modules/diff/libcjs/util/distance-iterator.d.ts +0 -2
- package/node_modules/@opentui/core/node_modules/diff/libcjs/util/distance-iterator.d.ts.map +0 -1
- package/node_modules/@opentui/core/node_modules/diff/libcjs/util/distance-iterator.js +0 -40
- package/node_modules/@opentui/core/node_modules/diff/libcjs/util/params.d.ts +0 -4
- package/node_modules/@opentui/core/node_modules/diff/libcjs/util/params.d.ts.map +0 -1
- package/node_modules/@opentui/core/node_modules/diff/libcjs/util/params.js +0 -17
- package/node_modules/@opentui/core/node_modules/diff/libcjs/util/string.d.ts +0 -18
- package/node_modules/@opentui/core/node_modules/diff/libcjs/util/string.d.ts.map +0 -1
- package/node_modules/@opentui/core/node_modules/diff/libcjs/util/string.js +0 -141
- package/node_modules/@opentui/core/node_modules/diff/libesm/convert/dmp.d.ts +0 -8
- package/node_modules/@opentui/core/node_modules/diff/libesm/convert/dmp.d.ts.map +0 -1
- package/node_modules/@opentui/core/node_modules/diff/libesm/convert/dmp.js +0 -21
- package/node_modules/@opentui/core/node_modules/diff/libesm/convert/xml.d.ts +0 -6
- package/node_modules/@opentui/core/node_modules/diff/libesm/convert/xml.d.ts.map +0 -1
- package/node_modules/@opentui/core/node_modules/diff/libesm/convert/xml.js +0 -31
- package/node_modules/@opentui/core/node_modules/diff/libesm/diff/array.d.ts +0 -19
- package/node_modules/@opentui/core/node_modules/diff/libesm/diff/array.d.ts.map +0 -1
- package/node_modules/@opentui/core/node_modules/diff/libesm/diff/array.js +0 -16
- package/node_modules/@opentui/core/node_modules/diff/libesm/diff/base.d.ts +0 -20
- package/node_modules/@opentui/core/node_modules/diff/libesm/diff/base.d.ts.map +0 -1
- package/node_modules/@opentui/core/node_modules/diff/libesm/diff/base.js +0 -253
- package/node_modules/@opentui/core/node_modules/diff/libesm/diff/character.d.ts +0 -19
- package/node_modules/@opentui/core/node_modules/diff/libesm/diff/character.d.ts.map +0 -1
- package/node_modules/@opentui/core/node_modules/diff/libesm/diff/character.js +0 -7
- package/node_modules/@opentui/core/node_modules/diff/libesm/diff/css.d.ts +0 -18
- package/node_modules/@opentui/core/node_modules/diff/libesm/diff/css.d.ts.map +0 -1
- package/node_modules/@opentui/core/node_modules/diff/libesm/diff/css.js +0 -10
- package/node_modules/@opentui/core/node_modules/diff/libesm/diff/json.d.ts +0 -24
- package/node_modules/@opentui/core/node_modules/diff/libesm/diff/json.d.ts.map +0 -1
- package/node_modules/@opentui/core/node_modules/diff/libesm/diff/json.js +0 -78
- package/node_modules/@opentui/core/node_modules/diff/libesm/diff/line.d.ts +0 -24
- package/node_modules/@opentui/core/node_modules/diff/libesm/diff/line.d.ts.map +0 -1
- package/node_modules/@opentui/core/node_modules/diff/libesm/diff/line.js +0 -65
- package/node_modules/@opentui/core/node_modules/diff/libesm/diff/sentence.d.ts +0 -21
- package/node_modules/@opentui/core/node_modules/diff/libesm/diff/sentence.d.ts.map +0 -1
- package/node_modules/@opentui/core/node_modules/diff/libesm/diff/sentence.js +0 -43
- package/node_modules/@opentui/core/node_modules/diff/libesm/diff/word.d.ts +0 -35
- package/node_modules/@opentui/core/node_modules/diff/libesm/diff/word.d.ts.map +0 -1
- package/node_modules/@opentui/core/node_modules/diff/libesm/diff/word.js +0 -276
- package/node_modules/@opentui/core/node_modules/diff/libesm/index.d.ts +0 -20
- package/node_modules/@opentui/core/node_modules/diff/libesm/index.d.ts.map +0 -1
- package/node_modules/@opentui/core/node_modules/diff/libesm/index.js +0 -30
- package/node_modules/@opentui/core/node_modules/diff/libesm/package.json +0 -1
- package/node_modules/@opentui/core/node_modules/diff/libesm/patch/apply.d.ts +0 -62
- package/node_modules/@opentui/core/node_modules/diff/libesm/patch/apply.d.ts.map +0 -1
- package/node_modules/@opentui/core/node_modules/diff/libesm/patch/apply.js +0 -257
- package/node_modules/@opentui/core/node_modules/diff/libesm/patch/create.d.ts +0 -100
- package/node_modules/@opentui/core/node_modules/diff/libesm/patch/create.d.ts.map +0 -1
- package/node_modules/@opentui/core/node_modules/diff/libesm/patch/create.js +0 -201
- package/node_modules/@opentui/core/node_modules/diff/libesm/patch/line-endings.d.ts +0 -17
- package/node_modules/@opentui/core/node_modules/diff/libesm/patch/line-endings.d.ts.map +0 -1
- package/node_modules/@opentui/core/node_modules/diff/libesm/patch/line-endings.js +0 -44
- package/node_modules/@opentui/core/node_modules/diff/libesm/patch/parse.d.ts +0 -8
- package/node_modules/@opentui/core/node_modules/diff/libesm/patch/parse.d.ts.map +0 -1
- package/node_modules/@opentui/core/node_modules/diff/libesm/patch/parse.js +0 -130
- package/node_modules/@opentui/core/node_modules/diff/libesm/patch/reverse.d.ts +0 -9
- package/node_modules/@opentui/core/node_modules/diff/libesm/patch/reverse.d.ts.map +0 -1
- package/node_modules/@opentui/core/node_modules/diff/libesm/patch/reverse.js +0 -23
- package/node_modules/@opentui/core/node_modules/diff/libesm/types.d.ts +0 -213
- package/node_modules/@opentui/core/node_modules/diff/libesm/types.d.ts.map +0 -1
- package/node_modules/@opentui/core/node_modules/diff/libesm/types.js +0 -1
- package/node_modules/@opentui/core/node_modules/diff/libesm/util/array.d.ts +0 -3
- package/node_modules/@opentui/core/node_modules/diff/libesm/util/array.d.ts.map +0 -1
- package/node_modules/@opentui/core/node_modules/diff/libesm/util/array.js +0 -17
- package/node_modules/@opentui/core/node_modules/diff/libesm/util/distance-iterator.d.ts +0 -2
- package/node_modules/@opentui/core/node_modules/diff/libesm/util/distance-iterator.d.ts.map +0 -1
- package/node_modules/@opentui/core/node_modules/diff/libesm/util/distance-iterator.js +0 -37
- package/node_modules/@opentui/core/node_modules/diff/libesm/util/params.d.ts +0 -4
- package/node_modules/@opentui/core/node_modules/diff/libesm/util/params.d.ts.map +0 -1
- package/node_modules/@opentui/core/node_modules/diff/libesm/util/params.js +0 -14
- package/node_modules/@opentui/core/node_modules/diff/libesm/util/string.d.ts +0 -18
- package/node_modules/@opentui/core/node_modules/diff/libesm/util/string.d.ts.map +0 -1
- package/node_modules/@opentui/core/node_modules/diff/libesm/util/string.js +0 -128
- package/node_modules/@opentui/core/node_modules/diff/package.json +0 -131
- package/node_modules/@opentui/core/node_modules/diff/release-notes.md +0 -397
- package/node_modules/@opentui/core/node_modules/marked/LICENSE.md +0 -44
- package/node_modules/@opentui/core/node_modules/marked/README.md +0 -107
- package/node_modules/@opentui/core/node_modules/marked/bin/main.js +0 -283
- package/node_modules/@opentui/core/node_modules/marked/bin/marked.js +0 -16
- package/node_modules/@opentui/core/node_modules/marked/lib/marked.d.ts +0 -756
- package/node_modules/@opentui/core/node_modules/marked/lib/marked.esm.js +0 -72
- package/node_modules/@opentui/core/node_modules/marked/lib/marked.esm.js.map +0 -7
- package/node_modules/@opentui/core/node_modules/marked/lib/marked.umd.js +0 -74
- package/node_modules/@opentui/core/node_modules/marked/lib/marked.umd.js.map +0 -7
- package/node_modules/@opentui/core/node_modules/marked/man/marked.1 +0 -113
- package/node_modules/@opentui/core/node_modules/marked/man/marked.1.md +0 -93
- package/node_modules/@opentui/core/node_modules/marked/package.json +0 -103
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.longestCommonPrefix = longestCommonPrefix;
|
|
4
|
-
exports.longestCommonSuffix = longestCommonSuffix;
|
|
5
|
-
exports.replacePrefix = replacePrefix;
|
|
6
|
-
exports.replaceSuffix = replaceSuffix;
|
|
7
|
-
exports.removePrefix = removePrefix;
|
|
8
|
-
exports.removeSuffix = removeSuffix;
|
|
9
|
-
exports.maximumOverlap = maximumOverlap;
|
|
10
|
-
exports.hasOnlyWinLineEndings = hasOnlyWinLineEndings;
|
|
11
|
-
exports.hasOnlyUnixLineEndings = hasOnlyUnixLineEndings;
|
|
12
|
-
exports.trailingWs = trailingWs;
|
|
13
|
-
exports.leadingWs = leadingWs;
|
|
14
|
-
function longestCommonPrefix(str1, str2) {
|
|
15
|
-
var i;
|
|
16
|
-
for (i = 0; i < str1.length && i < str2.length; i++) {
|
|
17
|
-
if (str1[i] != str2[i]) {
|
|
18
|
-
return str1.slice(0, i);
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
return str1.slice(0, i);
|
|
22
|
-
}
|
|
23
|
-
function longestCommonSuffix(str1, str2) {
|
|
24
|
-
var i;
|
|
25
|
-
// Unlike longestCommonPrefix, we need a special case to handle all scenarios
|
|
26
|
-
// where we return the empty string since str1.slice(-0) will return the
|
|
27
|
-
// entire string.
|
|
28
|
-
if (!str1 || !str2 || str1[str1.length - 1] != str2[str2.length - 1]) {
|
|
29
|
-
return '';
|
|
30
|
-
}
|
|
31
|
-
for (i = 0; i < str1.length && i < str2.length; i++) {
|
|
32
|
-
if (str1[str1.length - (i + 1)] != str2[str2.length - (i + 1)]) {
|
|
33
|
-
return str1.slice(-i);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
return str1.slice(-i);
|
|
37
|
-
}
|
|
38
|
-
function replacePrefix(string, oldPrefix, newPrefix) {
|
|
39
|
-
if (string.slice(0, oldPrefix.length) != oldPrefix) {
|
|
40
|
-
throw Error("string ".concat(JSON.stringify(string), " doesn't start with prefix ").concat(JSON.stringify(oldPrefix), "; this is a bug"));
|
|
41
|
-
}
|
|
42
|
-
return newPrefix + string.slice(oldPrefix.length);
|
|
43
|
-
}
|
|
44
|
-
function replaceSuffix(string, oldSuffix, newSuffix) {
|
|
45
|
-
if (!oldSuffix) {
|
|
46
|
-
return string + newSuffix;
|
|
47
|
-
}
|
|
48
|
-
if (string.slice(-oldSuffix.length) != oldSuffix) {
|
|
49
|
-
throw Error("string ".concat(JSON.stringify(string), " doesn't end with suffix ").concat(JSON.stringify(oldSuffix), "; this is a bug"));
|
|
50
|
-
}
|
|
51
|
-
return string.slice(0, -oldSuffix.length) + newSuffix;
|
|
52
|
-
}
|
|
53
|
-
function removePrefix(string, oldPrefix) {
|
|
54
|
-
return replacePrefix(string, oldPrefix, '');
|
|
55
|
-
}
|
|
56
|
-
function removeSuffix(string, oldSuffix) {
|
|
57
|
-
return replaceSuffix(string, oldSuffix, '');
|
|
58
|
-
}
|
|
59
|
-
function maximumOverlap(string1, string2) {
|
|
60
|
-
return string2.slice(0, overlapCount(string1, string2));
|
|
61
|
-
}
|
|
62
|
-
// Nicked from https://stackoverflow.com/a/60422853/1709587
|
|
63
|
-
function overlapCount(a, b) {
|
|
64
|
-
// Deal with cases where the strings differ in length
|
|
65
|
-
var startA = 0;
|
|
66
|
-
if (a.length > b.length) {
|
|
67
|
-
startA = a.length - b.length;
|
|
68
|
-
}
|
|
69
|
-
var endB = b.length;
|
|
70
|
-
if (a.length < b.length) {
|
|
71
|
-
endB = a.length;
|
|
72
|
-
}
|
|
73
|
-
// Create a back-reference for each index
|
|
74
|
-
// that should be followed in case of a mismatch.
|
|
75
|
-
// We only need B to make these references:
|
|
76
|
-
var map = Array(endB);
|
|
77
|
-
var k = 0; // Index that lags behind j
|
|
78
|
-
map[0] = 0;
|
|
79
|
-
for (var j = 1; j < endB; j++) {
|
|
80
|
-
if (b[j] == b[k]) {
|
|
81
|
-
map[j] = map[k]; // skip over the same character (optional optimisation)
|
|
82
|
-
}
|
|
83
|
-
else {
|
|
84
|
-
map[j] = k;
|
|
85
|
-
}
|
|
86
|
-
while (k > 0 && b[j] != b[k]) {
|
|
87
|
-
k = map[k];
|
|
88
|
-
}
|
|
89
|
-
if (b[j] == b[k]) {
|
|
90
|
-
k++;
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
// Phase 2: use these references while iterating over A
|
|
94
|
-
k = 0;
|
|
95
|
-
for (var i = startA; i < a.length; i++) {
|
|
96
|
-
while (k > 0 && a[i] != b[k]) {
|
|
97
|
-
k = map[k];
|
|
98
|
-
}
|
|
99
|
-
if (a[i] == b[k]) {
|
|
100
|
-
k++;
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
return k;
|
|
104
|
-
}
|
|
105
|
-
/**
|
|
106
|
-
* Returns true if the string consistently uses Windows line endings.
|
|
107
|
-
*/
|
|
108
|
-
function hasOnlyWinLineEndings(string) {
|
|
109
|
-
return string.includes('\r\n') && !string.startsWith('\n') && !string.match(/[^\r]\n/);
|
|
110
|
-
}
|
|
111
|
-
/**
|
|
112
|
-
* Returns true if the string consistently uses Unix line endings.
|
|
113
|
-
*/
|
|
114
|
-
function hasOnlyUnixLineEndings(string) {
|
|
115
|
-
return !string.includes('\r\n') && string.includes('\n');
|
|
116
|
-
}
|
|
117
|
-
function trailingWs(string) {
|
|
118
|
-
// Yes, this looks overcomplicated and dumb - why not replace the whole function with
|
|
119
|
-
// return string match(/\s*$/)[0]
|
|
120
|
-
// you ask? Because:
|
|
121
|
-
// 1. the trap described at https://markamery.com/blog/quadratic-time-regexes/ would mean doing
|
|
122
|
-
// this would cause this function to take O(n²) time in the worst case (specifically when
|
|
123
|
-
// there is a massive run of NON-TRAILING whitespace in `string`), and
|
|
124
|
-
// 2. the fix proposed in the same blog post, of using a negative lookbehind, is incompatible
|
|
125
|
-
// with old Safari versions that we'd like to not break if possible (see
|
|
126
|
-
// https://github.com/kpdecker/jsdiff/pull/550)
|
|
127
|
-
// It feels absurd to do this with an explicit loop instead of a regex, but I really can't see a
|
|
128
|
-
// better way that doesn't result in broken behaviour.
|
|
129
|
-
var i;
|
|
130
|
-
for (i = string.length - 1; i >= 0; i--) {
|
|
131
|
-
if (!string[i].match(/\s/)) {
|
|
132
|
-
break;
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
return string.substring(i + 1);
|
|
136
|
-
}
|
|
137
|
-
function leadingWs(string) {
|
|
138
|
-
// Thankfully the annoying considerations described in trailingWs don't apply here:
|
|
139
|
-
var match = string.match(/^\s*/);
|
|
140
|
-
return match ? match[0] : '';
|
|
141
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { ChangeObject } from '../types.js';
|
|
2
|
-
type DmpOperation = 1 | 0 | -1;
|
|
3
|
-
/**
|
|
4
|
-
* converts a list of change objects to the format returned by Google's [diff-match-patch](https://github.com/google/diff-match-patch) library
|
|
5
|
-
*/
|
|
6
|
-
export declare function convertChangesToDMP<ValueT>(changes: ChangeObject<ValueT>[]): [DmpOperation, ValueT][];
|
|
7
|
-
export {};
|
|
8
|
-
//# sourceMappingURL=dmp.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dmp.d.ts","sourceRoot":"","sources":["../../src/convert/dmp.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,aAAa,CAAC;AAE9C,KAAK,YAAY,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;AAE/B;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,OAAO,EAAE,YAAY,CAAC,MAAM,CAAC,EAAE,GAAG,CAAC,YAAY,EAAE,MAAM,CAAC,EAAE,CAiBrG"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* converts a list of change objects to the format returned by Google's [diff-match-patch](https://github.com/google/diff-match-patch) library
|
|
3
|
-
*/
|
|
4
|
-
export function convertChangesToDMP(changes) {
|
|
5
|
-
const ret = [];
|
|
6
|
-
let change, operation;
|
|
7
|
-
for (let i = 0; i < changes.length; i++) {
|
|
8
|
-
change = changes[i];
|
|
9
|
-
if (change.added) {
|
|
10
|
-
operation = 1;
|
|
11
|
-
}
|
|
12
|
-
else if (change.removed) {
|
|
13
|
-
operation = -1;
|
|
14
|
-
}
|
|
15
|
-
else {
|
|
16
|
-
operation = 0;
|
|
17
|
-
}
|
|
18
|
-
ret.push([operation, change.value]);
|
|
19
|
-
}
|
|
20
|
-
return ret;
|
|
21
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"xml.d.ts","sourceRoot":"","sources":["../../src/convert/xml.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,aAAa,CAAC;AAE9C;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,YAAY,CAAC,MAAM,CAAC,EAAE,GAAG,MAAM,CAmB3E"}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* converts a list of change objects to a serialized XML format
|
|
3
|
-
*/
|
|
4
|
-
export function convertChangesToXML(changes) {
|
|
5
|
-
const ret = [];
|
|
6
|
-
for (let i = 0; i < changes.length; i++) {
|
|
7
|
-
const change = changes[i];
|
|
8
|
-
if (change.added) {
|
|
9
|
-
ret.push('<ins>');
|
|
10
|
-
}
|
|
11
|
-
else if (change.removed) {
|
|
12
|
-
ret.push('<del>');
|
|
13
|
-
}
|
|
14
|
-
ret.push(escapeHTML(change.value));
|
|
15
|
-
if (change.added) {
|
|
16
|
-
ret.push('</ins>');
|
|
17
|
-
}
|
|
18
|
-
else if (change.removed) {
|
|
19
|
-
ret.push('</del>');
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
return ret.join('');
|
|
23
|
-
}
|
|
24
|
-
function escapeHTML(s) {
|
|
25
|
-
let n = s;
|
|
26
|
-
n = n.replace(/&/g, '&');
|
|
27
|
-
n = n.replace(/</g, '<');
|
|
28
|
-
n = n.replace(/>/g, '>');
|
|
29
|
-
n = n.replace(/"/g, '"');
|
|
30
|
-
return n;
|
|
31
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import Diff from './base.js';
|
|
2
|
-
import type { ChangeObject, DiffArraysOptionsNonabortable, CallbackOptionNonabortable, DiffArraysOptionsAbortable, DiffCallbackNonabortable, CallbackOptionAbortable } from '../types.js';
|
|
3
|
-
declare class ArrayDiff<T> extends Diff<T, Array<T>> {
|
|
4
|
-
tokenize(value: Array<T>): T[];
|
|
5
|
-
join(value: Array<T>): T[];
|
|
6
|
-
removeEmpty(value: Array<T>): T[];
|
|
7
|
-
}
|
|
8
|
-
export declare const arrayDiff: ArrayDiff<unknown>;
|
|
9
|
-
/**
|
|
10
|
-
* diffs two arrays of tokens, comparing each item for strict equality (===).
|
|
11
|
-
* @returns a list of change objects.
|
|
12
|
-
*/
|
|
13
|
-
export declare function diffArrays<T>(oldArr: T[], newArr: T[], options: DiffCallbackNonabortable<T[]>): undefined;
|
|
14
|
-
export declare function diffArrays<T>(oldArr: T[], newArr: T[], options: DiffArraysOptionsAbortable<T> & CallbackOptionAbortable<T[]>): undefined;
|
|
15
|
-
export declare function diffArrays<T>(oldArr: T[], newArr: T[], options: DiffArraysOptionsNonabortable<T> & CallbackOptionNonabortable<T[]>): undefined;
|
|
16
|
-
export declare function diffArrays<T>(oldArr: T[], newArr: T[], options: DiffArraysOptionsAbortable<T>): ChangeObject<T[]>[] | undefined;
|
|
17
|
-
export declare function diffArrays<T>(oldArr: T[], newArr: T[], options?: DiffArraysOptionsNonabortable<T>): ChangeObject<T[]>[];
|
|
18
|
-
export {};
|
|
19
|
-
//# sourceMappingURL=array.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"array.d.ts","sourceRoot":"","sources":["../../src/diff/array.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,KAAK,EAAC,YAAY,EAAE,6BAA6B,EAAE,0BAA0B,EAAE,0BAA0B,EAAE,wBAAwB,EAAE,uBAAuB,EAAC,MAAM,aAAa,CAAC;AAExL,cAAM,SAAS,CAAC,CAAC,CAAE,SAAQ,IAAI,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;IAC1C,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC;IAIxB,IAAI,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC;IAIpB,WAAW,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC;CAG5B;AAED,eAAO,MAAM,SAAS,oBAAkB,CAAC;AAEzC;;;GAGG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAC1B,MAAM,EAAE,CAAC,EAAE,EACX,MAAM,EAAE,CAAC,EAAE,EACX,OAAO,EAAE,wBAAwB,CAAC,CAAC,EAAE,CAAC,GACrC,SAAS,CAAC;AACb,wBAAgB,UAAU,CAAC,CAAC,EAC1B,MAAM,EAAE,CAAC,EAAE,EACX,MAAM,EAAE,CAAC,EAAE,EACX,OAAO,EAAE,0BAA0B,CAAC,CAAC,CAAC,GAAG,uBAAuB,CAAC,CAAC,EAAE,CAAC,GACpE,SAAS,CAAA;AACZ,wBAAgB,UAAU,CAAC,CAAC,EAC1B,MAAM,EAAE,CAAC,EAAE,EACX,MAAM,EAAE,CAAC,EAAE,EACX,OAAO,EAAE,6BAA6B,CAAC,CAAC,CAAC,GAAG,0BAA0B,CAAC,CAAC,EAAE,CAAC,GAC1E,SAAS,CAAA;AACZ,wBAAgB,UAAU,CAAC,CAAC,EAC1B,MAAM,EAAE,CAAC,EAAE,EACX,MAAM,EAAE,CAAC,EAAE,EACX,OAAO,EAAE,0BAA0B,CAAC,CAAC,CAAC,GACrC,YAAY,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,SAAS,CAAA;AAClC,wBAAgB,UAAU,CAAC,CAAC,EAC1B,MAAM,EAAE,CAAC,EAAE,EACX,MAAM,EAAE,CAAC,EAAE,EACX,OAAO,CAAC,EAAE,6BAA6B,CAAC,CAAC,CAAC,GACzC,YAAY,CAAC,CAAC,EAAE,CAAC,EAAE,CAAA"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import Diff from './base.js';
|
|
2
|
-
class ArrayDiff extends Diff {
|
|
3
|
-
tokenize(value) {
|
|
4
|
-
return value.slice();
|
|
5
|
-
}
|
|
6
|
-
join(value) {
|
|
7
|
-
return value;
|
|
8
|
-
}
|
|
9
|
-
removeEmpty(value) {
|
|
10
|
-
return value;
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
export const arrayDiff = new ArrayDiff();
|
|
14
|
-
export function diffArrays(oldArr, newArr, options) {
|
|
15
|
-
return arrayDiff.diff(oldArr, newArr, options);
|
|
16
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import type { ChangeObject, AllDiffOptions, AbortableDiffOptions, DiffCallbackNonabortable, CallbackOptionAbortable, CallbackOptionNonabortable } from '../types.js';
|
|
2
|
-
export default class Diff<TokenT, ValueT extends Iterable<TokenT> = Iterable<TokenT>, InputValueT = ValueT> {
|
|
3
|
-
diff(oldStr: InputValueT, newStr: InputValueT, options: DiffCallbackNonabortable<ValueT>): undefined;
|
|
4
|
-
diff(oldStr: InputValueT, newStr: InputValueT, options: AllDiffOptions & AbortableDiffOptions & CallbackOptionAbortable<ValueT>): undefined;
|
|
5
|
-
diff(oldStr: InputValueT, newStr: InputValueT, options: AllDiffOptions & CallbackOptionNonabortable<ValueT>): undefined;
|
|
6
|
-
diff(oldStr: InputValueT, newStr: InputValueT, options: AllDiffOptions & AbortableDiffOptions): ChangeObject<ValueT>[] | undefined;
|
|
7
|
-
diff(oldStr: InputValueT, newStr: InputValueT, options?: AllDiffOptions): ChangeObject<ValueT>[];
|
|
8
|
-
private diffWithOptionsObj;
|
|
9
|
-
private addToPath;
|
|
10
|
-
private extractCommon;
|
|
11
|
-
equals(left: TokenT, right: TokenT, options: AllDiffOptions): boolean;
|
|
12
|
-
removeEmpty(array: TokenT[]): TokenT[];
|
|
13
|
-
castInput(value: InputValueT, options: AllDiffOptions): ValueT;
|
|
14
|
-
tokenize(value: ValueT, options: AllDiffOptions): TokenT[];
|
|
15
|
-
join(chars: TokenT[]): ValueT;
|
|
16
|
-
postProcess(changeObjects: ChangeObject<ValueT>[], options: AllDiffOptions): ChangeObject<ValueT>[];
|
|
17
|
-
get useLongestToken(): boolean;
|
|
18
|
-
private buildValues;
|
|
19
|
-
}
|
|
20
|
-
//# sourceMappingURL=base.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../src/diff/base.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,YAAY,EAAE,cAAc,EAAE,oBAAoB,EAAE,wBAAwB,EAAE,uBAAuB,EAAE,0BAA0B,EAA4D,MAAM,aAAa,CAAC;AAuB9N,MAAM,CAAC,OAAO,OAAO,IAAI,CACvB,MAAM,EACN,MAAM,SAAS,QAAQ,CAAC,MAAM,CAAC,GAAG,QAAQ,CAAC,MAAM,CAAC,EAClD,WAAW,GAAG,MAAM;IAEpB,IAAI,CACF,MAAM,EAAE,WAAW,EACnB,MAAM,EAAE,WAAW,EACnB,OAAO,EAAE,wBAAwB,CAAC,MAAM,CAAC,GACxC,SAAS;IACZ,IAAI,CACF,MAAM,EAAE,WAAW,EACnB,MAAM,EAAE,WAAW,EACnB,OAAO,EAAE,cAAc,GAAG,oBAAoB,GAAG,uBAAuB,CAAC,MAAM,CAAC,GAC/E,SAAS;IACZ,IAAI,CACF,MAAM,EAAE,WAAW,EACnB,MAAM,EAAE,WAAW,EACnB,OAAO,EAAE,cAAc,GAAG,0BAA0B,CAAC,MAAM,CAAC,GAC3D,SAAS;IACZ,IAAI,CACF,MAAM,EAAE,WAAW,EACnB,MAAM,EAAE,WAAW,EACnB,OAAO,EAAE,cAAc,GAAG,oBAAoB,GAC7C,YAAY,CAAC,MAAM,CAAC,EAAE,GAAG,SAAS;IACrC,IAAI,CACF,MAAM,EAAE,WAAW,EACnB,MAAM,EAAE,WAAW,EACnB,OAAO,CAAC,EAAE,cAAc,GACvB,YAAY,CAAC,MAAM,CAAC,EAAE;IAwBzB,OAAO,CAAC,kBAAkB;IA0I1B,OAAO,CAAC,SAAS;IAqBjB,OAAO,CAAC,aAAa;IA8BrB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,GAAG,OAAO;IASrE,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE;IAWtC,SAAS,CAAC,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,cAAc,GAAG,MAAM;IAK9D,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,GAAG,MAAM,EAAE;IAI1D,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM;IAQ7B,WAAW,CACT,aAAa,EAAE,YAAY,CAAC,MAAM,CAAC,EAAE,EAErC,OAAO,EAAE,cAAc,GACtB,YAAY,CAAC,MAAM,CAAC,EAAE;IAIzB,IAAI,eAAe,IAAI,OAAO,CAE7B;IAED,OAAO,CAAC,WAAW;CAkDpB"}
|
|
@@ -1,253 +0,0 @@
|
|
|
1
|
-
export default class Diff {
|
|
2
|
-
diff(oldStr, newStr,
|
|
3
|
-
// Type below is not accurate/complete - see above for full possibilities - but it compiles
|
|
4
|
-
options = {}) {
|
|
5
|
-
let callback;
|
|
6
|
-
if (typeof options === 'function') {
|
|
7
|
-
callback = options;
|
|
8
|
-
options = {};
|
|
9
|
-
}
|
|
10
|
-
else if ('callback' in options) {
|
|
11
|
-
callback = options.callback;
|
|
12
|
-
}
|
|
13
|
-
// Allow subclasses to massage the input prior to running
|
|
14
|
-
const oldString = this.castInput(oldStr, options);
|
|
15
|
-
const newString = this.castInput(newStr, options);
|
|
16
|
-
const oldTokens = this.removeEmpty(this.tokenize(oldString, options));
|
|
17
|
-
const newTokens = this.removeEmpty(this.tokenize(newString, options));
|
|
18
|
-
return this.diffWithOptionsObj(oldTokens, newTokens, options, callback);
|
|
19
|
-
}
|
|
20
|
-
diffWithOptionsObj(oldTokens, newTokens, options, callback) {
|
|
21
|
-
var _a;
|
|
22
|
-
const done = (value) => {
|
|
23
|
-
value = this.postProcess(value, options);
|
|
24
|
-
if (callback) {
|
|
25
|
-
setTimeout(function () { callback(value); }, 0);
|
|
26
|
-
return undefined;
|
|
27
|
-
}
|
|
28
|
-
else {
|
|
29
|
-
return value;
|
|
30
|
-
}
|
|
31
|
-
};
|
|
32
|
-
const newLen = newTokens.length, oldLen = oldTokens.length;
|
|
33
|
-
let editLength = 1;
|
|
34
|
-
let maxEditLength = newLen + oldLen;
|
|
35
|
-
if (options.maxEditLength != null) {
|
|
36
|
-
maxEditLength = Math.min(maxEditLength, options.maxEditLength);
|
|
37
|
-
}
|
|
38
|
-
const maxExecutionTime = (_a = options.timeout) !== null && _a !== void 0 ? _a : Infinity;
|
|
39
|
-
const abortAfterTimestamp = Date.now() + maxExecutionTime;
|
|
40
|
-
const bestPath = [{ oldPos: -1, lastComponent: undefined }];
|
|
41
|
-
// Seed editLength = 0, i.e. the content starts with the same values
|
|
42
|
-
let newPos = this.extractCommon(bestPath[0], newTokens, oldTokens, 0, options);
|
|
43
|
-
if (bestPath[0].oldPos + 1 >= oldLen && newPos + 1 >= newLen) {
|
|
44
|
-
// Identity per the equality and tokenizer
|
|
45
|
-
return done(this.buildValues(bestPath[0].lastComponent, newTokens, oldTokens));
|
|
46
|
-
}
|
|
47
|
-
// Once we hit the right edge of the edit graph on some diagonal k, we can
|
|
48
|
-
// definitely reach the end of the edit graph in no more than k edits, so
|
|
49
|
-
// there's no point in considering any moves to diagonal k+1 any more (from
|
|
50
|
-
// which we're guaranteed to need at least k+1 more edits).
|
|
51
|
-
// Similarly, once we've reached the bottom of the edit graph, there's no
|
|
52
|
-
// point considering moves to lower diagonals.
|
|
53
|
-
// We record this fact by setting minDiagonalToConsider and
|
|
54
|
-
// maxDiagonalToConsider to some finite value once we've hit the edge of
|
|
55
|
-
// the edit graph.
|
|
56
|
-
// This optimization is not faithful to the original algorithm presented in
|
|
57
|
-
// Myers's paper, which instead pointlessly extends D-paths off the end of
|
|
58
|
-
// the edit graph - see page 7 of Myers's paper which notes this point
|
|
59
|
-
// explicitly and illustrates it with a diagram. This has major performance
|
|
60
|
-
// implications for some common scenarios. For instance, to compute a diff
|
|
61
|
-
// where the new text simply appends d characters on the end of the
|
|
62
|
-
// original text of length n, the true Myers algorithm will take O(n+d^2)
|
|
63
|
-
// time while this optimization needs only O(n+d) time.
|
|
64
|
-
let minDiagonalToConsider = -Infinity, maxDiagonalToConsider = Infinity;
|
|
65
|
-
// Main worker method. checks all permutations of a given edit length for acceptance.
|
|
66
|
-
const execEditLength = () => {
|
|
67
|
-
for (let diagonalPath = Math.max(minDiagonalToConsider, -editLength); diagonalPath <= Math.min(maxDiagonalToConsider, editLength); diagonalPath += 2) {
|
|
68
|
-
let basePath;
|
|
69
|
-
const removePath = bestPath[diagonalPath - 1], addPath = bestPath[diagonalPath + 1];
|
|
70
|
-
if (removePath) {
|
|
71
|
-
// No one else is going to attempt to use this value, clear it
|
|
72
|
-
// @ts-expect-error - perf optimisation. This type-violating value will never be read.
|
|
73
|
-
bestPath[diagonalPath - 1] = undefined;
|
|
74
|
-
}
|
|
75
|
-
let canAdd = false;
|
|
76
|
-
if (addPath) {
|
|
77
|
-
// what newPos will be after we do an insertion:
|
|
78
|
-
const addPathNewPos = addPath.oldPos - diagonalPath;
|
|
79
|
-
canAdd = addPath && 0 <= addPathNewPos && addPathNewPos < newLen;
|
|
80
|
-
}
|
|
81
|
-
const canRemove = removePath && removePath.oldPos + 1 < oldLen;
|
|
82
|
-
if (!canAdd && !canRemove) {
|
|
83
|
-
// If this path is a terminal then prune
|
|
84
|
-
// @ts-expect-error - perf optimisation. This type-violating value will never be read.
|
|
85
|
-
bestPath[diagonalPath] = undefined;
|
|
86
|
-
continue;
|
|
87
|
-
}
|
|
88
|
-
// Select the diagonal that we want to branch from. We select the prior
|
|
89
|
-
// path whose position in the old string is the farthest from the origin
|
|
90
|
-
// and does not pass the bounds of the diff graph
|
|
91
|
-
if (!canRemove || (canAdd && removePath.oldPos < addPath.oldPos)) {
|
|
92
|
-
basePath = this.addToPath(addPath, true, false, 0, options);
|
|
93
|
-
}
|
|
94
|
-
else {
|
|
95
|
-
basePath = this.addToPath(removePath, false, true, 1, options);
|
|
96
|
-
}
|
|
97
|
-
newPos = this.extractCommon(basePath, newTokens, oldTokens, diagonalPath, options);
|
|
98
|
-
if (basePath.oldPos + 1 >= oldLen && newPos + 1 >= newLen) {
|
|
99
|
-
// If we have hit the end of both strings, then we are done
|
|
100
|
-
return done(this.buildValues(basePath.lastComponent, newTokens, oldTokens)) || true;
|
|
101
|
-
}
|
|
102
|
-
else {
|
|
103
|
-
bestPath[diagonalPath] = basePath;
|
|
104
|
-
if (basePath.oldPos + 1 >= oldLen) {
|
|
105
|
-
maxDiagonalToConsider = Math.min(maxDiagonalToConsider, diagonalPath - 1);
|
|
106
|
-
}
|
|
107
|
-
if (newPos + 1 >= newLen) {
|
|
108
|
-
minDiagonalToConsider = Math.max(minDiagonalToConsider, diagonalPath + 1);
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
editLength++;
|
|
113
|
-
};
|
|
114
|
-
// Performs the length of edit iteration. Is a bit fugly as this has to support the
|
|
115
|
-
// sync and async mode which is never fun. Loops over execEditLength until a value
|
|
116
|
-
// is produced, or until the edit length exceeds options.maxEditLength (if given),
|
|
117
|
-
// in which case it will return undefined.
|
|
118
|
-
if (callback) {
|
|
119
|
-
(function exec() {
|
|
120
|
-
setTimeout(function () {
|
|
121
|
-
if (editLength > maxEditLength || Date.now() > abortAfterTimestamp) {
|
|
122
|
-
return callback(undefined);
|
|
123
|
-
}
|
|
124
|
-
if (!execEditLength()) {
|
|
125
|
-
exec();
|
|
126
|
-
}
|
|
127
|
-
}, 0);
|
|
128
|
-
}());
|
|
129
|
-
}
|
|
130
|
-
else {
|
|
131
|
-
while (editLength <= maxEditLength && Date.now() <= abortAfterTimestamp) {
|
|
132
|
-
const ret = execEditLength();
|
|
133
|
-
if (ret) {
|
|
134
|
-
return ret;
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
addToPath(path, added, removed, oldPosInc, options) {
|
|
140
|
-
const last = path.lastComponent;
|
|
141
|
-
if (last && !options.oneChangePerToken && last.added === added && last.removed === removed) {
|
|
142
|
-
return {
|
|
143
|
-
oldPos: path.oldPos + oldPosInc,
|
|
144
|
-
lastComponent: { count: last.count + 1, added: added, removed: removed, previousComponent: last.previousComponent }
|
|
145
|
-
};
|
|
146
|
-
}
|
|
147
|
-
else {
|
|
148
|
-
return {
|
|
149
|
-
oldPos: path.oldPos + oldPosInc,
|
|
150
|
-
lastComponent: { count: 1, added: added, removed: removed, previousComponent: last }
|
|
151
|
-
};
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
extractCommon(basePath, newTokens, oldTokens, diagonalPath, options) {
|
|
155
|
-
const newLen = newTokens.length, oldLen = oldTokens.length;
|
|
156
|
-
let oldPos = basePath.oldPos, newPos = oldPos - diagonalPath, commonCount = 0;
|
|
157
|
-
while (newPos + 1 < newLen && oldPos + 1 < oldLen && this.equals(oldTokens[oldPos + 1], newTokens[newPos + 1], options)) {
|
|
158
|
-
newPos++;
|
|
159
|
-
oldPos++;
|
|
160
|
-
commonCount++;
|
|
161
|
-
if (options.oneChangePerToken) {
|
|
162
|
-
basePath.lastComponent = { count: 1, previousComponent: basePath.lastComponent, added: false, removed: false };
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
if (commonCount && !options.oneChangePerToken) {
|
|
166
|
-
basePath.lastComponent = { count: commonCount, previousComponent: basePath.lastComponent, added: false, removed: false };
|
|
167
|
-
}
|
|
168
|
-
basePath.oldPos = oldPos;
|
|
169
|
-
return newPos;
|
|
170
|
-
}
|
|
171
|
-
equals(left, right, options) {
|
|
172
|
-
if (options.comparator) {
|
|
173
|
-
return options.comparator(left, right);
|
|
174
|
-
}
|
|
175
|
-
else {
|
|
176
|
-
return left === right
|
|
177
|
-
|| (!!options.ignoreCase && left.toLowerCase() === right.toLowerCase());
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
removeEmpty(array) {
|
|
181
|
-
const ret = [];
|
|
182
|
-
for (let i = 0; i < array.length; i++) {
|
|
183
|
-
if (array[i]) {
|
|
184
|
-
ret.push(array[i]);
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
return ret;
|
|
188
|
-
}
|
|
189
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
190
|
-
castInput(value, options) {
|
|
191
|
-
return value;
|
|
192
|
-
}
|
|
193
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
194
|
-
tokenize(value, options) {
|
|
195
|
-
return Array.from(value);
|
|
196
|
-
}
|
|
197
|
-
join(chars) {
|
|
198
|
-
// Assumes ValueT is string, which is the case for most subclasses.
|
|
199
|
-
// When it's false, e.g. in diffArrays, this method needs to be overridden (e.g. with a no-op)
|
|
200
|
-
// Yes, the casts are verbose and ugly, because this pattern - of having the base class SORT OF
|
|
201
|
-
// assume tokens and values are strings, but not completely - is weird and janky.
|
|
202
|
-
return chars.join('');
|
|
203
|
-
}
|
|
204
|
-
postProcess(changeObjects,
|
|
205
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
206
|
-
options) {
|
|
207
|
-
return changeObjects;
|
|
208
|
-
}
|
|
209
|
-
get useLongestToken() {
|
|
210
|
-
return false;
|
|
211
|
-
}
|
|
212
|
-
buildValues(lastComponent, newTokens, oldTokens) {
|
|
213
|
-
// First we convert our linked list of components in reverse order to an
|
|
214
|
-
// array in the right order:
|
|
215
|
-
const components = [];
|
|
216
|
-
let nextComponent;
|
|
217
|
-
while (lastComponent) {
|
|
218
|
-
components.push(lastComponent);
|
|
219
|
-
nextComponent = lastComponent.previousComponent;
|
|
220
|
-
delete lastComponent.previousComponent;
|
|
221
|
-
lastComponent = nextComponent;
|
|
222
|
-
}
|
|
223
|
-
components.reverse();
|
|
224
|
-
const componentLen = components.length;
|
|
225
|
-
let componentPos = 0, newPos = 0, oldPos = 0;
|
|
226
|
-
for (; componentPos < componentLen; componentPos++) {
|
|
227
|
-
const component = components[componentPos];
|
|
228
|
-
if (!component.removed) {
|
|
229
|
-
if (!component.added && this.useLongestToken) {
|
|
230
|
-
let value = newTokens.slice(newPos, newPos + component.count);
|
|
231
|
-
value = value.map(function (value, i) {
|
|
232
|
-
const oldValue = oldTokens[oldPos + i];
|
|
233
|
-
return oldValue.length > value.length ? oldValue : value;
|
|
234
|
-
});
|
|
235
|
-
component.value = this.join(value);
|
|
236
|
-
}
|
|
237
|
-
else {
|
|
238
|
-
component.value = this.join(newTokens.slice(newPos, newPos + component.count));
|
|
239
|
-
}
|
|
240
|
-
newPos += component.count;
|
|
241
|
-
// Common case
|
|
242
|
-
if (!component.added) {
|
|
243
|
-
oldPos += component.count;
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
else {
|
|
247
|
-
component.value = this.join(oldTokens.slice(oldPos, oldPos + component.count));
|
|
248
|
-
oldPos += component.count;
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
return components;
|
|
252
|
-
}
|
|
253
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import Diff from './base.js';
|
|
2
|
-
import type { ChangeObject, CallbackOptionAbortable, CallbackOptionNonabortable, DiffCallbackNonabortable, DiffCharsOptionsAbortable, DiffCharsOptionsNonabortable } from '../types.js';
|
|
3
|
-
declare class CharacterDiff extends Diff<string, string> {
|
|
4
|
-
}
|
|
5
|
-
export declare const characterDiff: CharacterDiff;
|
|
6
|
-
/**
|
|
7
|
-
* diffs two blocks of text, treating each character as a token.
|
|
8
|
-
*
|
|
9
|
-
* ("Characters" here means Unicode code points - the elements you get when you loop over a string with a `for ... of ...` loop.)
|
|
10
|
-
*
|
|
11
|
-
* @returns a list of change objects.
|
|
12
|
-
*/
|
|
13
|
-
export declare function diffChars(oldStr: string, newStr: string, options: DiffCallbackNonabortable<string>): undefined;
|
|
14
|
-
export declare function diffChars(oldStr: string, newStr: string, options: DiffCharsOptionsAbortable & CallbackOptionAbortable<string>): undefined;
|
|
15
|
-
export declare function diffChars(oldStr: string, newStr: string, options: DiffCharsOptionsNonabortable & CallbackOptionNonabortable<string>): undefined;
|
|
16
|
-
export declare function diffChars(oldStr: string, newStr: string, options: DiffCharsOptionsAbortable): ChangeObject<string>[] | undefined;
|
|
17
|
-
export declare function diffChars(oldStr: string, newStr: string, options?: DiffCharsOptionsNonabortable): ChangeObject<string>[];
|
|
18
|
-
export {};
|
|
19
|
-
//# sourceMappingURL=character.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"character.d.ts","sourceRoot":"","sources":["../../src/diff/character.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;AAEvL,cAAM,aAAc,SAAQ,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC;CAAG;AAEnD,eAAO,MAAM,aAAa,eAAsB,CAAC;AAEjD;;;;;;GAMG;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"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import Diff from './base.js';
|
|
2
|
-
import type { ChangeObject, CallbackOptionAbortable, CallbackOptionNonabortable, DiffCallbackNonabortable, DiffCssOptionsAbortable, DiffCssOptionsNonabortable } from '../types.js';
|
|
3
|
-
declare class CssDiff extends Diff<string, string> {
|
|
4
|
-
tokenize(value: string): string[];
|
|
5
|
-
}
|
|
6
|
-
export declare const cssDiff: CssDiff;
|
|
7
|
-
/**
|
|
8
|
-
* diffs two blocks of text, comparing CSS tokens.
|
|
9
|
-
*
|
|
10
|
-
* @returns a list of change objects.
|
|
11
|
-
*/
|
|
12
|
-
export declare function diffCss(oldStr: string, newStr: string, options: DiffCallbackNonabortable<string>): undefined;
|
|
13
|
-
export declare function diffCss(oldStr: string, newStr: string, options: DiffCssOptionsAbortable & CallbackOptionAbortable<string>): undefined;
|
|
14
|
-
export declare function diffCss(oldStr: string, newStr: string, options: DiffCssOptionsNonabortable & CallbackOptionNonabortable<string>): undefined;
|
|
15
|
-
export declare function diffCss(oldStr: string, newStr: string, options: DiffCssOptionsAbortable): ChangeObject<string>[] | undefined;
|
|
16
|
-
export declare function diffCss(oldStr: string, newStr: string, options?: DiffCssOptionsNonabortable): ChangeObject<string>[];
|
|
17
|
-
export {};
|
|
18
|
-
//# sourceMappingURL=css.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"css.d.ts","sourceRoot":"","sources":["../../src/diff/css.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,KAAK,EAAE,YAAY,EAAE,uBAAuB,EAAE,0BAA0B,EAAE,wBAAwB,EAAE,uBAAuB,EAAE,0BAA0B,EAAC,MAAM,aAAa,CAAC;AAEnL,cAAM,OAAQ,SAAQ,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC;IACxC,QAAQ,CAAC,KAAK,EAAE,MAAM;CAGvB;AAED,eAAO,MAAM,OAAO,SAAgB,CAAC;AAErC;;;;GAIG;AACH,wBAAgB,OAAO,CACrB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,wBAAwB,CAAC,MAAM,CAAC,GACxC,SAAS,CAAC;AACb,wBAAgB,OAAO,CACrB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,uBAAuB,GAAG,uBAAuB,CAAC,MAAM,CAAC,GACjE,SAAS,CAAA;AACZ,wBAAgB,OAAO,CACrB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,0BAA0B,GAAG,0BAA0B,CAAC,MAAM,CAAC,GACvE,SAAS,CAAA;AACZ,wBAAgB,OAAO,CACrB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,uBAAuB,GAC/B,YAAY,CAAC,MAAM,CAAC,EAAE,GAAG,SAAS,CAAA;AACrC,wBAAgB,OAAO,CACrB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE,0BAA0B,GACnC,YAAY,CAAC,MAAM,CAAC,EAAE,CAAA"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import Diff from './base.js';
|
|
2
|
-
class CssDiff extends Diff {
|
|
3
|
-
tokenize(value) {
|
|
4
|
-
return value.split(/([{}:;,]|\s+)/);
|
|
5
|
-
}
|
|
6
|
-
}
|
|
7
|
-
export const cssDiff = new CssDiff();
|
|
8
|
-
export function diffCss(oldStr, newStr, options) {
|
|
9
|
-
return cssDiff.diff(oldStr, newStr, options);
|
|
10
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import Diff from './base.js';
|
|
2
|
-
import type { ChangeObject, CallbackOptionAbortable, CallbackOptionNonabortable, DiffCallbackNonabortable, DiffJsonOptionsAbortable, DiffJsonOptionsNonabortable } from '../types.js';
|
|
3
|
-
import { tokenize } from './line.js';
|
|
4
|
-
declare class JsonDiff extends Diff<string, string, string | object> {
|
|
5
|
-
get useLongestToken(): boolean;
|
|
6
|
-
tokenize: typeof tokenize;
|
|
7
|
-
castInput(value: string | object, options: DiffJsonOptionsNonabortable | DiffJsonOptionsAbortable): string;
|
|
8
|
-
equals(left: string, right: string, options: DiffJsonOptionsNonabortable | DiffJsonOptionsAbortable): boolean;
|
|
9
|
-
}
|
|
10
|
-
export declare const jsonDiff: JsonDiff;
|
|
11
|
-
/**
|
|
12
|
-
* diffs two JSON-serializable objects by first serializing them to prettily-formatted JSON and then treating each line of the JSON as a token.
|
|
13
|
-
* Object properties are ordered alphabetically in the serialized JSON, so the order of properties in the objects being compared doesn't affect the result.
|
|
14
|
-
*
|
|
15
|
-
* @returns a list of change objects.
|
|
16
|
-
*/
|
|
17
|
-
export declare function diffJson(oldStr: string | object, newStr: string | object, options: DiffCallbackNonabortable<string>): undefined;
|
|
18
|
-
export declare function diffJson(oldStr: string | object, newStr: string | object, options: DiffJsonOptionsAbortable & CallbackOptionAbortable<string>): undefined;
|
|
19
|
-
export declare function diffJson(oldStr: string | object, newStr: string | object, options: DiffJsonOptionsNonabortable & CallbackOptionNonabortable<string>): undefined;
|
|
20
|
-
export declare function diffJson(oldStr: string | object, newStr: string | object, options: DiffJsonOptionsAbortable): ChangeObject<string>[] | undefined;
|
|
21
|
-
export declare function diffJson(oldStr: string | object, newStr: string | object, options?: DiffJsonOptionsNonabortable): ChangeObject<string>[];
|
|
22
|
-
export declare function canonicalize(obj: any, stack: Array<any> | null, replacementStack: Array<any> | null, replacer: (k: string, v: any) => any, key?: string): any;
|
|
23
|
-
export {};
|
|
24
|
-
//# sourceMappingURL=json.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"json.d.ts","sourceRoot":"","sources":["../../src/diff/json.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,KAAK,EAAE,YAAY,EAAE,uBAAuB,EAAE,0BAA0B,EAAE,wBAAwB,EAAE,wBAAwB,EAAE,2BAA2B,EAAC,MAAM,aAAa,CAAC;AACrL,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAErC,cAAM,QAAS,SAAQ,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC;IAC1D,IAAI,eAAe,YAIlB;IAED,QAAQ,kBAAY;IAEpB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,OAAO,EAAE,2BAA2B,GAAG,wBAAwB;IAMjG,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,2BAA2B,GAAG,wBAAwB;CAGpG;AAED,eAAO,MAAM,QAAQ,UAAiB,CAAC;AAEvC;;;;;GAKG;AACH,wBAAgB,QAAQ,CACtB,MAAM,EAAE,MAAM,GAAG,MAAM,EACvB,MAAM,EAAE,MAAM,GAAG,MAAM,EACvB,OAAO,EAAE,wBAAwB,CAAC,MAAM,CAAC,GACxC,SAAS,CAAC;AACb,wBAAgB,QAAQ,CACtB,MAAM,EAAE,MAAM,GAAG,MAAM,EACvB,MAAM,EAAE,MAAM,GAAG,MAAM,EACvB,OAAO,EAAE,wBAAwB,GAAG,uBAAuB,CAAC,MAAM,CAAC,GAClE,SAAS,CAAA;AACZ,wBAAgB,QAAQ,CACtB,MAAM,EAAE,MAAM,GAAG,MAAM,EACvB,MAAM,EAAE,MAAM,GAAG,MAAM,EACvB,OAAO,EAAE,2BAA2B,GAAG,0BAA0B,CAAC,MAAM,CAAC,GACxE,SAAS,CAAA;AACZ,wBAAgB,QAAQ,CACtB,MAAM,EAAE,MAAM,GAAG,MAAM,EACvB,MAAM,EAAE,MAAM,GAAG,MAAM,EACvB,OAAO,EAAE,wBAAwB,GAChC,YAAY,CAAC,MAAM,CAAC,EAAE,GAAG,SAAS,CAAA;AACrC,wBAAgB,QAAQ,CACtB,MAAM,EAAE,MAAM,GAAG,MAAM,EACvB,MAAM,EAAE,MAAM,GAAG,MAAM,EACvB,OAAO,CAAC,EAAE,2BAA2B,GACpC,YAAY,CAAC,MAAM,CAAC,EAAE,CAAA;AAQzB,wBAAgB,YAAY,CAC1B,GAAG,EAAE,GAAG,EACR,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG,IAAI,EAAE,gBAAgB,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG,IAAI,EAC7D,QAAQ,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,GAAG,KAAK,GAAG,EACpC,GAAG,CAAC,EAAE,MAAM,OA0Db"}
|