@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,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.unixToWin = unixToWin;
|
|
15
|
+
exports.winToUnix = winToUnix;
|
|
16
|
+
exports.isUnix = isUnix;
|
|
17
|
+
exports.isWin = isWin;
|
|
18
|
+
function unixToWin(patch) {
|
|
19
|
+
if (Array.isArray(patch)) {
|
|
20
|
+
// It would be cleaner if instead of the line below we could just write
|
|
21
|
+
// return patch.map(unixToWin)
|
|
22
|
+
// but mysteriously TypeScript (v5.7.3 at the time of writing) does not like this and it will
|
|
23
|
+
// refuse to compile, thinking that unixToWin could then return StructuredPatch[][] and the
|
|
24
|
+
// result would be incompatible with the overload signatures.
|
|
25
|
+
// See bug report at https://github.com/microsoft/TypeScript/issues/61398.
|
|
26
|
+
return patch.map(function (p) { return unixToWin(p); });
|
|
27
|
+
}
|
|
28
|
+
return __assign(__assign({}, patch), { hunks: patch.hunks.map(function (hunk) { return (__assign(__assign({}, hunk), { lines: hunk.lines.map(function (line, i) {
|
|
29
|
+
var _a;
|
|
30
|
+
return (line.startsWith('\\') || line.endsWith('\r') || ((_a = hunk.lines[i + 1]) === null || _a === void 0 ? void 0 : _a.startsWith('\\')))
|
|
31
|
+
? line
|
|
32
|
+
: line + '\r';
|
|
33
|
+
}) })); }) });
|
|
34
|
+
}
|
|
35
|
+
function winToUnix(patch) {
|
|
36
|
+
if (Array.isArray(patch)) {
|
|
37
|
+
// (See comment above equivalent line in unixToWin)
|
|
38
|
+
return patch.map(function (p) { return winToUnix(p); });
|
|
39
|
+
}
|
|
40
|
+
return __assign(__assign({}, patch), { hunks: patch.hunks.map(function (hunk) { return (__assign(__assign({}, hunk), { lines: hunk.lines.map(function (line) { return line.endsWith('\r') ? line.substring(0, line.length - 1) : line; }) })); }) });
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Returns true if the patch consistently uses Unix line endings (or only involves one line and has
|
|
44
|
+
* no line endings).
|
|
45
|
+
*/
|
|
46
|
+
function isUnix(patch) {
|
|
47
|
+
if (!Array.isArray(patch)) {
|
|
48
|
+
patch = [patch];
|
|
49
|
+
}
|
|
50
|
+
return !patch.some(function (index) { return index.hunks.some(function (hunk) { return hunk.lines.some(function (line) { return !line.startsWith('\\') && line.endsWith('\r'); }); }); });
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Returns true if the patch uses Windows line endings and only Windows line endings.
|
|
54
|
+
*/
|
|
55
|
+
function isWin(patch) {
|
|
56
|
+
if (!Array.isArray(patch)) {
|
|
57
|
+
patch = [patch];
|
|
58
|
+
}
|
|
59
|
+
return patch.some(function (index) { return index.hunks.some(function (hunk) { return hunk.lines.some(function (line) { return line.endsWith('\r'); }); }); })
|
|
60
|
+
&& patch.every(function (index) { return index.hunks.every(function (hunk) { return hunk.lines.every(function (line, i) { var _a; return line.startsWith('\\') || line.endsWith('\r') || ((_a = hunk.lines[i + 1]) === null || _a === void 0 ? void 0 : _a.startsWith('\\')); }); }); });
|
|
61
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { StructuredPatch } from '../types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Parses a patch into structured data, in the same structure returned by `structuredPatch`.
|
|
4
|
+
*
|
|
5
|
+
* @return a JSON object representation of the a patch, suitable for use with the `applyPatch` method.
|
|
6
|
+
*/
|
|
7
|
+
export declare function parsePatch(uniDiff: string): StructuredPatch[];
|
|
8
|
+
//# sourceMappingURL=parse.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../../src/patch/parse.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,eAAe,EAAE,CAiJ7D"}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parsePatch = parsePatch;
|
|
4
|
+
/**
|
|
5
|
+
* Parses a patch into structured data, in the same structure returned by `structuredPatch`.
|
|
6
|
+
*
|
|
7
|
+
* @return a JSON object representation of the a patch, suitable for use with the `applyPatch` method.
|
|
8
|
+
*/
|
|
9
|
+
function parsePatch(uniDiff) {
|
|
10
|
+
var diffstr = uniDiff.split(/\n/), list = [];
|
|
11
|
+
var i = 0;
|
|
12
|
+
function parseIndex() {
|
|
13
|
+
var index = {};
|
|
14
|
+
list.push(index);
|
|
15
|
+
// Parse diff metadata
|
|
16
|
+
while (i < diffstr.length) {
|
|
17
|
+
var line = diffstr[i];
|
|
18
|
+
// File header found, end parsing diff metadata
|
|
19
|
+
if ((/^(---|\+\+\+|@@)\s/).test(line)) {
|
|
20
|
+
break;
|
|
21
|
+
}
|
|
22
|
+
// Diff index
|
|
23
|
+
var header = (/^(?:Index:|diff(?: -r \w+)+)\s+(.+?)\s*$/).exec(line);
|
|
24
|
+
if (header) {
|
|
25
|
+
index.index = header[1];
|
|
26
|
+
}
|
|
27
|
+
i++;
|
|
28
|
+
}
|
|
29
|
+
// Parse file headers if they are defined. Unified diff requires them, but
|
|
30
|
+
// there's no technical issues to have an isolated hunk without file header
|
|
31
|
+
parseFileHeader(index);
|
|
32
|
+
parseFileHeader(index);
|
|
33
|
+
// Parse hunks
|
|
34
|
+
index.hunks = [];
|
|
35
|
+
while (i < diffstr.length) {
|
|
36
|
+
var line = diffstr[i];
|
|
37
|
+
if ((/^(Index:\s|diff\s|---\s|\+\+\+\s|===================================================================)/).test(line)) {
|
|
38
|
+
break;
|
|
39
|
+
}
|
|
40
|
+
else if ((/^@@/).test(line)) {
|
|
41
|
+
index.hunks.push(parseHunk());
|
|
42
|
+
}
|
|
43
|
+
else if (line) {
|
|
44
|
+
throw new Error('Unknown line ' + (i + 1) + ' ' + JSON.stringify(line));
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
i++;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
// Parses the --- and +++ headers, if none are found, no lines
|
|
52
|
+
// are consumed.
|
|
53
|
+
function parseFileHeader(index) {
|
|
54
|
+
var fileHeader = (/^(---|\+\+\+)\s+(.*)\r?$/).exec(diffstr[i]);
|
|
55
|
+
if (fileHeader) {
|
|
56
|
+
var data = fileHeader[2].split('\t', 2), header = (data[1] || '').trim();
|
|
57
|
+
var fileName = data[0].replace(/\\\\/g, '\\');
|
|
58
|
+
if ((/^".*"$/).test(fileName)) {
|
|
59
|
+
fileName = fileName.substr(1, fileName.length - 2);
|
|
60
|
+
}
|
|
61
|
+
if (fileHeader[1] === '---') {
|
|
62
|
+
index.oldFileName = fileName;
|
|
63
|
+
index.oldHeader = header;
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
index.newFileName = fileName;
|
|
67
|
+
index.newHeader = header;
|
|
68
|
+
}
|
|
69
|
+
i++;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
// Parses a hunk
|
|
73
|
+
// This assumes that we are at the start of a hunk.
|
|
74
|
+
function parseHunk() {
|
|
75
|
+
var _a;
|
|
76
|
+
var chunkHeaderIndex = i, chunkHeaderLine = diffstr[i++], chunkHeader = chunkHeaderLine.split(/@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/);
|
|
77
|
+
var hunk = {
|
|
78
|
+
oldStart: +chunkHeader[1],
|
|
79
|
+
oldLines: typeof chunkHeader[2] === 'undefined' ? 1 : +chunkHeader[2],
|
|
80
|
+
newStart: +chunkHeader[3],
|
|
81
|
+
newLines: typeof chunkHeader[4] === 'undefined' ? 1 : +chunkHeader[4],
|
|
82
|
+
lines: []
|
|
83
|
+
};
|
|
84
|
+
// Unified Diff Format quirk: If the chunk size is 0,
|
|
85
|
+
// the first number is one lower than one would expect.
|
|
86
|
+
// https://www.artima.com/weblogs/viewpost.jsp?thread=164293
|
|
87
|
+
if (hunk.oldLines === 0) {
|
|
88
|
+
hunk.oldStart += 1;
|
|
89
|
+
}
|
|
90
|
+
if (hunk.newLines === 0) {
|
|
91
|
+
hunk.newStart += 1;
|
|
92
|
+
}
|
|
93
|
+
var addCount = 0, removeCount = 0;
|
|
94
|
+
for (; i < diffstr.length && (removeCount < hunk.oldLines || addCount < hunk.newLines || ((_a = diffstr[i]) === null || _a === void 0 ? void 0 : _a.startsWith('\\'))); i++) {
|
|
95
|
+
var operation = (diffstr[i].length == 0 && i != (diffstr.length - 1)) ? ' ' : diffstr[i][0];
|
|
96
|
+
if (operation === '+' || operation === '-' || operation === ' ' || operation === '\\') {
|
|
97
|
+
hunk.lines.push(diffstr[i]);
|
|
98
|
+
if (operation === '+') {
|
|
99
|
+
addCount++;
|
|
100
|
+
}
|
|
101
|
+
else if (operation === '-') {
|
|
102
|
+
removeCount++;
|
|
103
|
+
}
|
|
104
|
+
else if (operation === ' ') {
|
|
105
|
+
addCount++;
|
|
106
|
+
removeCount++;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
throw new Error("Hunk at line ".concat(chunkHeaderIndex + 1, " contained invalid line ").concat(diffstr[i]));
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
// Handle the empty block count case
|
|
114
|
+
if (!addCount && hunk.newLines === 1) {
|
|
115
|
+
hunk.newLines = 0;
|
|
116
|
+
}
|
|
117
|
+
if (!removeCount && hunk.oldLines === 1) {
|
|
118
|
+
hunk.oldLines = 0;
|
|
119
|
+
}
|
|
120
|
+
// Perform sanity checking
|
|
121
|
+
if (addCount !== hunk.newLines) {
|
|
122
|
+
throw new Error('Added line count did not match for hunk at line ' + (chunkHeaderIndex + 1));
|
|
123
|
+
}
|
|
124
|
+
if (removeCount !== hunk.oldLines) {
|
|
125
|
+
throw new Error('Removed line count did not match for hunk at line ' + (chunkHeaderIndex + 1));
|
|
126
|
+
}
|
|
127
|
+
return hunk;
|
|
128
|
+
}
|
|
129
|
+
while (i < diffstr.length) {
|
|
130
|
+
parseIndex();
|
|
131
|
+
}
|
|
132
|
+
return list;
|
|
133
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { StructuredPatch } from '../types.js';
|
|
2
|
+
/**
|
|
3
|
+
* @param patch either a single structured patch object (as returned by `structuredPatch`) or an array of them (as returned by `parsePatch`).
|
|
4
|
+
* @returns a new structured patch which when applied will undo the original `patch`.
|
|
5
|
+
*/
|
|
6
|
+
export declare function reversePatch(structuredPatch: StructuredPatch): StructuredPatch;
|
|
7
|
+
export declare function reversePatch(structuredPatch: StructuredPatch[]): StructuredPatch[];
|
|
8
|
+
export declare function reversePatch(structuredPatch: StructuredPatch | StructuredPatch[]): StructuredPatch | StructuredPatch[];
|
|
9
|
+
//# sourceMappingURL=reverse.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reverse.d.ts","sourceRoot":"","sources":["../../src/patch/reverse.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD;;;GAGG;AACH,wBAAgB,YAAY,CAAC,eAAe,EAAE,eAAe,GAAG,eAAe,CAAC;AAChF,wBAAgB,YAAY,CAAC,eAAe,EAAE,eAAe,EAAE,GAAG,eAAe,EAAE,CAAC;AACpF,wBAAgB,YAAY,CAAC,eAAe,EAAE,eAAe,GAAG,eAAe,EAAE,GAAG,eAAe,GAAG,eAAe,EAAE,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.reversePatch = reversePatch;
|
|
15
|
+
function reversePatch(structuredPatch) {
|
|
16
|
+
if (Array.isArray(structuredPatch)) {
|
|
17
|
+
// (See comment in unixToWin for why we need the pointless-looking anonymous function here)
|
|
18
|
+
return structuredPatch.map(function (patch) { return reversePatch(patch); }).reverse();
|
|
19
|
+
}
|
|
20
|
+
return __assign(__assign({}, structuredPatch), { oldFileName: structuredPatch.newFileName, oldHeader: structuredPatch.newHeader, newFileName: structuredPatch.oldFileName, newHeader: structuredPatch.oldHeader, hunks: structuredPatch.hunks.map(function (hunk) {
|
|
21
|
+
return {
|
|
22
|
+
oldLines: hunk.newLines,
|
|
23
|
+
oldStart: hunk.newStart,
|
|
24
|
+
newLines: hunk.oldLines,
|
|
25
|
+
newStart: hunk.oldStart,
|
|
26
|
+
lines: hunk.lines.map(function (l) {
|
|
27
|
+
if (l.startsWith('-')) {
|
|
28
|
+
return "+".concat(l.slice(1));
|
|
29
|
+
}
|
|
30
|
+
if (l.startsWith('+')) {
|
|
31
|
+
return "-".concat(l.slice(1));
|
|
32
|
+
}
|
|
33
|
+
return l;
|
|
34
|
+
})
|
|
35
|
+
};
|
|
36
|
+
}) });
|
|
37
|
+
}
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
export interface ChangeObject<ValueT> {
|
|
2
|
+
/**
|
|
3
|
+
* The concatenated content of all the tokens represented by this change object - i.e. generally the text that is either added, deleted, or common, as a single string.
|
|
4
|
+
* In cases where tokens are considered common but are non-identical (e.g. because an option like `ignoreCase` or a custom `comparator` was used), the value from the *new* string will be provided here.
|
|
5
|
+
*/
|
|
6
|
+
value: ValueT;
|
|
7
|
+
/**
|
|
8
|
+
* true if the value was inserted into the new string, otherwise false
|
|
9
|
+
*/
|
|
10
|
+
added: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* true if the value was removed from the old string, otherwise false
|
|
13
|
+
*/
|
|
14
|
+
removed: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* How many tokens (e.g. chars for `diffChars`, lines for `diffLines`) the value in the change object consists of
|
|
17
|
+
*/
|
|
18
|
+
count: number;
|
|
19
|
+
}
|
|
20
|
+
export type Change = ChangeObject<string>;
|
|
21
|
+
export type ArrayChange = ChangeObject<any[]>;
|
|
22
|
+
export interface CommonDiffOptions {
|
|
23
|
+
/**
|
|
24
|
+
* If `true`, the array of change objects returned will contain one change object per token (e.g. one per line if calling `diffLines`), instead of runs of consecutive tokens that are all added / all removed / all conserved being combined into a single change object.
|
|
25
|
+
*/
|
|
26
|
+
oneChangePerToken?: boolean;
|
|
27
|
+
}
|
|
28
|
+
export interface TimeoutOption {
|
|
29
|
+
/**
|
|
30
|
+
* A number of milliseconds after which the diffing algorithm will abort and return `undefined`.
|
|
31
|
+
* Supported by the same functions as `maxEditLength`.
|
|
32
|
+
*/
|
|
33
|
+
timeout: number;
|
|
34
|
+
}
|
|
35
|
+
export interface MaxEditLengthOption {
|
|
36
|
+
/**
|
|
37
|
+
* A number specifying the maximum edit distance to consider between the old and new texts.
|
|
38
|
+
* You can use this to limit the computational cost of diffing large, very different texts by giving up early if the cost will be huge.
|
|
39
|
+
* This option can be passed either to diffing functions (`diffLines`, `diffChars`, etc) or to patch-creation function (`structuredPatch`, `createPatch`, etc), all of which will indicate that the max edit length was reached by returning `undefined` instead of whatever they'd normally return.
|
|
40
|
+
*/
|
|
41
|
+
maxEditLength: number;
|
|
42
|
+
}
|
|
43
|
+
export type AbortableDiffOptions = TimeoutOption | MaxEditLengthOption;
|
|
44
|
+
export type DiffCallbackNonabortable<T> = (result: ChangeObject<T>[]) => void;
|
|
45
|
+
export type DiffCallbackAbortable<T> = (result: ChangeObject<T>[] | undefined) => void;
|
|
46
|
+
export interface CallbackOptionNonabortable<T> {
|
|
47
|
+
/**
|
|
48
|
+
* If provided, the diff will be computed in async mode to avoid blocking the event loop while the diff is calculated.
|
|
49
|
+
* The value of the `callback` option should be a function and will be passed the computed diff or patch as its first argument.
|
|
50
|
+
*/
|
|
51
|
+
callback: DiffCallbackNonabortable<T>;
|
|
52
|
+
}
|
|
53
|
+
export interface CallbackOptionAbortable<T> {
|
|
54
|
+
/**
|
|
55
|
+
* If provided, the diff will be computed in async mode to avoid blocking the event loop while the diff is calculated.
|
|
56
|
+
* The value of the `callback` option should be a function and will be passed the computed diff or patch as its first argument.
|
|
57
|
+
*/
|
|
58
|
+
callback: DiffCallbackAbortable<T>;
|
|
59
|
+
}
|
|
60
|
+
interface DiffArraysOptions<T> extends CommonDiffOptions {
|
|
61
|
+
comparator?: (a: T, b: T) => boolean;
|
|
62
|
+
}
|
|
63
|
+
export interface DiffArraysOptionsNonabortable<T> extends DiffArraysOptions<T> {
|
|
64
|
+
/**
|
|
65
|
+
* If provided, the diff will be computed in async mode to avoid blocking the event loop while the diff is calculated.
|
|
66
|
+
* The value of the `callback` option should be a function and will be passed the computed diff or patch as its first argument.
|
|
67
|
+
*/
|
|
68
|
+
callback?: DiffCallbackNonabortable<T[]>;
|
|
69
|
+
}
|
|
70
|
+
export type DiffArraysOptionsAbortable<T> = DiffArraysOptions<T> & AbortableDiffOptions & Partial<CallbackOptionAbortable<T[]>>;
|
|
71
|
+
interface DiffCharsOptions extends CommonDiffOptions {
|
|
72
|
+
/**
|
|
73
|
+
* If `true`, the uppercase and lowercase forms of a character are considered equal.
|
|
74
|
+
* @default false
|
|
75
|
+
*/
|
|
76
|
+
ignoreCase?: boolean;
|
|
77
|
+
}
|
|
78
|
+
export interface DiffCharsOptionsNonabortable extends DiffCharsOptions {
|
|
79
|
+
/**
|
|
80
|
+
* If provided, the diff will be computed in async mode to avoid blocking the event loop while the diff is calculated.
|
|
81
|
+
* The value of the `callback` option should be a function and will be passed the computed diff or patch as its first argument.
|
|
82
|
+
*/
|
|
83
|
+
callback?: DiffCallbackNonabortable<string>;
|
|
84
|
+
}
|
|
85
|
+
export type DiffCharsOptionsAbortable = DiffCharsOptions & AbortableDiffOptions & Partial<CallbackOptionAbortable<string>>;
|
|
86
|
+
interface DiffLinesOptions extends CommonDiffOptions {
|
|
87
|
+
/**
|
|
88
|
+
* `true` to remove all trailing CR (`\r`) characters before performing the diff.
|
|
89
|
+
* This helps to get a useful diff when diffing UNIX text files against Windows text files.
|
|
90
|
+
* @default false
|
|
91
|
+
*/
|
|
92
|
+
stripTrailingCr?: boolean;
|
|
93
|
+
/**
|
|
94
|
+
* `true` to treat the newline character at the end of each line as its own token.
|
|
95
|
+
* This allows for changes to the newline structure to occur independently of the line content and to be treated as such.
|
|
96
|
+
* In general this is the more human friendly form of `diffLines`; the default behavior with this option turned off is better suited for patches and other computer friendly output.
|
|
97
|
+
*
|
|
98
|
+
* Note that while using `ignoreWhitespace` in combination with `newlineIsToken` is not an error, results may not be as expected.
|
|
99
|
+
* With `ignoreWhitespace: true` and `newlineIsToken: false`, changing a completely empty line to contain some spaces is treated as a non-change, but with `ignoreWhitespace: true` and `newlineIsToken: true`, it is treated as an insertion.
|
|
100
|
+
* This is because the content of a completely blank line is not a token at all in `newlineIsToken` mode.
|
|
101
|
+
*
|
|
102
|
+
* @default false
|
|
103
|
+
*/
|
|
104
|
+
newlineIsToken?: boolean;
|
|
105
|
+
/**
|
|
106
|
+
* `true` to ignore a missing newline character at the end of the last line when comparing it to other lines.
|
|
107
|
+
* (By default, the line `'b\n'` in text `'a\nb\nc'` is not considered equal to the line `'b'` in text `'a\nb'`; this option makes them be considered equal.)
|
|
108
|
+
* Ignored if `ignoreWhitespace` or `newlineIsToken` are also true.
|
|
109
|
+
* @default false
|
|
110
|
+
*/
|
|
111
|
+
ignoreNewlineAtEof?: boolean;
|
|
112
|
+
/**
|
|
113
|
+
* `true` to ignore leading and trailing whitespace characters when checking if two lines are equal.
|
|
114
|
+
* @default false
|
|
115
|
+
*/
|
|
116
|
+
ignoreWhitespace?: boolean;
|
|
117
|
+
}
|
|
118
|
+
export interface DiffLinesOptionsNonabortable extends DiffLinesOptions {
|
|
119
|
+
/**
|
|
120
|
+
* If provided, the diff will be computed in async mode to avoid blocking the event loop while the diff is calculated.
|
|
121
|
+
* The value of the `callback` option should be a function and will be passed the computed diff or patch as its first argument.
|
|
122
|
+
*/
|
|
123
|
+
callback?: DiffCallbackNonabortable<string>;
|
|
124
|
+
}
|
|
125
|
+
export type DiffLinesOptionsAbortable = DiffLinesOptions & AbortableDiffOptions & Partial<CallbackOptionAbortable<string>>;
|
|
126
|
+
interface DiffWordsOptions extends CommonDiffOptions {
|
|
127
|
+
/**
|
|
128
|
+
* Same as in `diffChars`.
|
|
129
|
+
* @default false
|
|
130
|
+
*/
|
|
131
|
+
ignoreCase?: boolean;
|
|
132
|
+
/**
|
|
133
|
+
* An optional [`Intl.Segmenter`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Segmenter) object (which must have a `granularity` of `'word'`) for `diffWords` to use to split the text into words.
|
|
134
|
+
*
|
|
135
|
+
* Note that this is (deliberately) incorrectly typed as `any` to avoid users whose `lib` & `target` settings in tsconfig.json are older than es2022 getting type errors when they build about `Intl.Segmenter` not existing.
|
|
136
|
+
* This is kind of ugly, since it makes the type declarations worse for users who genuinely use this feature, but seemed worth it to avoid the majority of the library's users (who probably do not use this particular option) getting confusing errors and being forced to change their `lib` to es2022 (even if their own code doesn't use any es2022 functions).
|
|
137
|
+
*
|
|
138
|
+
* By default, `diffWords` does not use an `Intl.Segmenter`, just some regexes for splitting text into words. This will tend to give worse results than `Intl.Segmenter` would, but ensures the results are consistent across environments; `Intl.Segmenter` behaviour is only loosely specced and the implementations in browsers could in principle change dramatically in future. If you want to use `diffWords` with an `Intl.Segmenter` but ensure it behaves the same whatever environment you run it in, use an `Intl.Segmenter` polyfill instead of the JavaScript engine's native `Intl.Segmenter` implementation.
|
|
139
|
+
*
|
|
140
|
+
* Using an `Intl.Segmenter` should allow better word-level diffing of non-English text than the default behaviour. For instance, `Intl.Segmenter`s can generally identify via built-in dictionaries which sequences of adjacent Chinese characters form words, allowing word-level diffing of Chinese. By specifying a language when instantiating the segmenter (e.g. `new Intl.Segmenter('sv', {granularity: 'word'})`) you can also support language-specific rules, like treating Swedish's colon separated contractions (like *k:a* for *kyrka*) as single words; by default this would be seen as two words separated by a colon.
|
|
141
|
+
*/
|
|
142
|
+
intlSegmenter?: any;
|
|
143
|
+
}
|
|
144
|
+
export interface DiffWordsOptionsNonabortable extends DiffWordsOptions {
|
|
145
|
+
/**
|
|
146
|
+
* If provided, the diff will be computed in async mode to avoid blocking the event loop while the diff is calculated.
|
|
147
|
+
* The value of the `callback` option should be a function and will be passed the computed diff or patch as its first argument.
|
|
148
|
+
*/
|
|
149
|
+
callback?: DiffCallbackNonabortable<string>;
|
|
150
|
+
}
|
|
151
|
+
export type DiffWordsOptionsAbortable = DiffWordsOptions & AbortableDiffOptions & Partial<CallbackOptionAbortable<string>>;
|
|
152
|
+
interface DiffSentencesOptions extends CommonDiffOptions {
|
|
153
|
+
}
|
|
154
|
+
export interface DiffSentencesOptionsNonabortable extends DiffSentencesOptions {
|
|
155
|
+
/**
|
|
156
|
+
* If provided, the diff will be computed in async mode to avoid blocking the event loop while the diff is calculated.
|
|
157
|
+
* The value of the `callback` option should be a function and will be passed the computed diff or patch as its first argument.
|
|
158
|
+
*/
|
|
159
|
+
callback?: DiffCallbackNonabortable<string>;
|
|
160
|
+
}
|
|
161
|
+
export type DiffSentencesOptionsAbortable = DiffSentencesOptions & AbortableDiffOptions & Partial<CallbackOptionAbortable<string>>;
|
|
162
|
+
interface DiffJsonOptions extends CommonDiffOptions {
|
|
163
|
+
/**
|
|
164
|
+
* A value to replace `undefined` with. Ignored if a `stringifyReplacer` is provided.
|
|
165
|
+
*/
|
|
166
|
+
undefinedReplacement?: any;
|
|
167
|
+
/**
|
|
168
|
+
* A custom replacer function.
|
|
169
|
+
* Operates similarly to the `replacer` parameter to [`JSON.stringify()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#the_replacer_parameter), but must be a function.
|
|
170
|
+
*/
|
|
171
|
+
stringifyReplacer?: (k: string, v: any) => any;
|
|
172
|
+
}
|
|
173
|
+
export interface DiffJsonOptionsNonabortable extends DiffJsonOptions {
|
|
174
|
+
/**
|
|
175
|
+
* If provided, the diff will be computed in async mode to avoid blocking the event loop while the diff is calculated.
|
|
176
|
+
* The value of the `callback` option should be a function and will be passed the computed diff or patch as its first argument.
|
|
177
|
+
*/
|
|
178
|
+
callback?: DiffCallbackNonabortable<string>;
|
|
179
|
+
}
|
|
180
|
+
export type DiffJsonOptionsAbortable = DiffJsonOptions & AbortableDiffOptions & Partial<CallbackOptionAbortable<string>>;
|
|
181
|
+
interface DiffCssOptions extends CommonDiffOptions {
|
|
182
|
+
}
|
|
183
|
+
export interface DiffCssOptionsNonabortable extends DiffCssOptions {
|
|
184
|
+
/**
|
|
185
|
+
* If provided, the diff will be computed in async mode to avoid blocking the event loop while the diff is calculated.
|
|
186
|
+
* The value of the `callback` option should be a function and will be passed the computed diff or patch as its first argument.
|
|
187
|
+
*/
|
|
188
|
+
callback?: DiffCallbackNonabortable<string>;
|
|
189
|
+
}
|
|
190
|
+
export type DiffCssOptionsAbortable = DiffJsonOptions & AbortableDiffOptions & Partial<CallbackOptionAbortable<string>>;
|
|
191
|
+
/**
|
|
192
|
+
* Note that this contains the union of ALL options accepted by any of the built-in diffing
|
|
193
|
+
* functions. The README notes which options are usable which functions. Using an option with a
|
|
194
|
+
* diffing function that doesn't support it might yield unreasonable results.
|
|
195
|
+
*/
|
|
196
|
+
export type AllDiffOptions = DiffArraysOptions<unknown> & DiffCharsOptions & DiffWordsOptions & DiffLinesOptions & DiffJsonOptions;
|
|
197
|
+
export interface StructuredPatch {
|
|
198
|
+
oldFileName: string;
|
|
199
|
+
newFileName: string;
|
|
200
|
+
oldHeader: string | undefined;
|
|
201
|
+
newHeader: string | undefined;
|
|
202
|
+
hunks: StructuredPatchHunk[];
|
|
203
|
+
index?: string;
|
|
204
|
+
}
|
|
205
|
+
export interface StructuredPatchHunk {
|
|
206
|
+
oldStart: number;
|
|
207
|
+
oldLines: number;
|
|
208
|
+
newStart: number;
|
|
209
|
+
newLines: number;
|
|
210
|
+
lines: string[];
|
|
211
|
+
}
|
|
212
|
+
export {};
|
|
213
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,YAAY,CAAC,MAAM;IAClC;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,KAAK,EAAE,OAAO,CAAC;IACf;;OAEG;IACH,OAAO,EAAE,OAAO,CAAC;IACjB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;CACf;AAMD,MAAM,MAAM,MAAM,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC;AAC1C,MAAM,MAAM,WAAW,GAAG,YAAY,CAAC,GAAG,EAAE,CAAC,CAAC;AAE9C,MAAM,WAAW,iBAAiB;IAChC;;OAEG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED,MAAM,WAAW,aAAa;IA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AAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"array.d.ts","sourceRoot":"","sources":["../../src/util/array.ts"],"names":[],"mappings":"AAAA,wBAAgB,UAAU,CAAC,CAAC,EAAE,GAAG,EAAE,EAAE,CAAC,EAAE,GAAG,EAAE,GAAG,OAAO,CAMtD;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,OAAO,CAYnE"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.arrayEqual = arrayEqual;
|
|
4
|
+
exports.arrayStartsWith = arrayStartsWith;
|
|
5
|
+
function arrayEqual(a, b) {
|
|
6
|
+
if (a.length !== b.length) {
|
|
7
|
+
return false;
|
|
8
|
+
}
|
|
9
|
+
return arrayStartsWith(a, b);
|
|
10
|
+
}
|
|
11
|
+
function arrayStartsWith(array, start) {
|
|
12
|
+
if (start.length > array.length) {
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
15
|
+
for (var i = 0; i < start.length; i++) {
|
|
16
|
+
if (start[i] !== array[i]) {
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return true;
|
|
21
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"distance-iterator.d.ts","sourceRoot":"","sources":["../../src/util/distance-iterator.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,OAAO,WAAU,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,MAAM,GAAG,SAAS,CA0CjG"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = default_1;
|
|
4
|
+
// Iterator that traverses in the range of [min, max], stepping
|
|
5
|
+
// by distance from a given start position. I.e. for [0, 4], with
|
|
6
|
+
// start of 2, this will iterate 2, 3, 1, 4, 0.
|
|
7
|
+
function default_1(start, minLine, maxLine) {
|
|
8
|
+
var wantForward = true, backwardExhausted = false, forwardExhausted = false, localOffset = 1;
|
|
9
|
+
return function iterator() {
|
|
10
|
+
if (wantForward && !forwardExhausted) {
|
|
11
|
+
if (backwardExhausted) {
|
|
12
|
+
localOffset++;
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
15
|
+
wantForward = false;
|
|
16
|
+
}
|
|
17
|
+
// Check if trying to fit beyond text length, and if not, check it fits
|
|
18
|
+
// after offset location (or desired location on first iteration)
|
|
19
|
+
if (start + localOffset <= maxLine) {
|
|
20
|
+
return start + localOffset;
|
|
21
|
+
}
|
|
22
|
+
forwardExhausted = true;
|
|
23
|
+
}
|
|
24
|
+
if (!backwardExhausted) {
|
|
25
|
+
if (!forwardExhausted) {
|
|
26
|
+
wantForward = true;
|
|
27
|
+
}
|
|
28
|
+
// Check if trying to fit before text beginning, and if not, check it fits
|
|
29
|
+
// before offset location
|
|
30
|
+
if (minLine <= start - localOffset) {
|
|
31
|
+
return start - localOffset++;
|
|
32
|
+
}
|
|
33
|
+
backwardExhausted = true;
|
|
34
|
+
return iterator();
|
|
35
|
+
}
|
|
36
|
+
// We tried to fit hunk before text beginning and beyond text length, then
|
|
37
|
+
// hunk can't fit on the text. Return undefined
|
|
38
|
+
return undefined;
|
|
39
|
+
};
|
|
40
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"params.d.ts","sourceRoot":"","sources":["../../src/util/params.ts"],"names":[],"mappings":"AAAA,wBAAgB,eAAe,CAC7B,OAAO,EAAE;IAAC,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC,EACtD,QAAQ,EAAE,GAAG,GACZ,MAAM,CAYR"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.generateOptions = generateOptions;
|
|
4
|
+
function generateOptions(options, defaults) {
|
|
5
|
+
if (typeof options === 'function') {
|
|
6
|
+
defaults.callback = options;
|
|
7
|
+
}
|
|
8
|
+
else if (options) {
|
|
9
|
+
for (var name in options) {
|
|
10
|
+
/* istanbul ignore else */
|
|
11
|
+
if (Object.prototype.hasOwnProperty.call(options, name)) {
|
|
12
|
+
defaults[name] = options[name];
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
return defaults;
|
|
17
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export declare function longestCommonPrefix(str1: string, str2: string): string;
|
|
2
|
+
export declare function longestCommonSuffix(str1: string, str2: string): string;
|
|
3
|
+
export declare function replacePrefix(string: string, oldPrefix: string, newPrefix: string): string;
|
|
4
|
+
export declare function replaceSuffix(string: string, oldSuffix: string, newSuffix: string): string;
|
|
5
|
+
export declare function removePrefix(string: string, oldPrefix: string): string;
|
|
6
|
+
export declare function removeSuffix(string: string, oldSuffix: string): string;
|
|
7
|
+
export declare function maximumOverlap(string1: string, string2: string): string;
|
|
8
|
+
/**
|
|
9
|
+
* Returns true if the string consistently uses Windows line endings.
|
|
10
|
+
*/
|
|
11
|
+
export declare function hasOnlyWinLineEndings(string: string): boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Returns true if the string consistently uses Unix line endings.
|
|
14
|
+
*/
|
|
15
|
+
export declare function hasOnlyUnixLineEndings(string: string): boolean;
|
|
16
|
+
export declare function trailingWs(string: string): string;
|
|
17
|
+
export declare function leadingWs(string: string): string;
|
|
18
|
+
//# sourceMappingURL=string.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"string.d.ts","sourceRoot":"","sources":["../../src/util/string.ts"],"names":[],"mappings":"AAAA,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAQtE;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAgBtE;AAED,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAK1F;AAED,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAS1F;AAED,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAEtE;AAED,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAEtE;AAED,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAEvE;AAkCD;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAE7D;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAE9D;AAED,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAmBjD;AAED,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAIhD"}
|