@xyne/xyne-cli-linux-x64 0.4.6 → 0.4.7

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.
Files changed (138) hide show
  1. package/package.json +1 -1
  2. package/xyne-linux-x64 +0 -0
  3. package/node_modules/@opentui/core/node_modules/diff/CONTRIBUTING.md +0 -28
  4. package/node_modules/@opentui/core/node_modules/diff/LICENSE +0 -29
  5. package/node_modules/@opentui/core/node_modules/diff/README.md +0 -378
  6. package/node_modules/@opentui/core/node_modules/diff/dist/diff.js +0 -1674
  7. package/node_modules/@opentui/core/node_modules/diff/dist/diff.min.js +0 -1
  8. package/node_modules/@opentui/core/node_modules/diff/eslint.config.mjs +0 -182
  9. package/node_modules/@opentui/core/node_modules/diff/libcjs/convert/dmp.d.ts +0 -8
  10. package/node_modules/@opentui/core/node_modules/diff/libcjs/convert/dmp.d.ts.map +0 -1
  11. package/node_modules/@opentui/core/node_modules/diff/libcjs/convert/dmp.js +0 -24
  12. package/node_modules/@opentui/core/node_modules/diff/libcjs/convert/xml.d.ts +0 -6
  13. package/node_modules/@opentui/core/node_modules/diff/libcjs/convert/xml.d.ts.map +0 -1
  14. package/node_modules/@opentui/core/node_modules/diff/libcjs/convert/xml.js +0 -34
  15. package/node_modules/@opentui/core/node_modules/diff/libcjs/diff/array.d.ts +0 -19
  16. package/node_modules/@opentui/core/node_modules/diff/libcjs/diff/array.d.ts.map +0 -1
  17. package/node_modules/@opentui/core/node_modules/diff/libcjs/diff/array.js +0 -40
  18. package/node_modules/@opentui/core/node_modules/diff/libcjs/diff/base.d.ts +0 -20
  19. package/node_modules/@opentui/core/node_modules/diff/libcjs/diff/base.d.ts.map +0 -1
  20. package/node_modules/@opentui/core/node_modules/diff/libcjs/diff/base.js +0 -265
  21. package/node_modules/@opentui/core/node_modules/diff/libcjs/diff/character.d.ts +0 -19
  22. package/node_modules/@opentui/core/node_modules/diff/libcjs/diff/character.d.ts.map +0 -1
  23. package/node_modules/@opentui/core/node_modules/diff/libcjs/diff/character.js +0 -31
  24. package/node_modules/@opentui/core/node_modules/diff/libcjs/diff/css.d.ts +0 -18
  25. package/node_modules/@opentui/core/node_modules/diff/libcjs/diff/css.d.ts.map +0 -1
  26. package/node_modules/@opentui/core/node_modules/diff/libcjs/diff/css.js +0 -34
  27. package/node_modules/@opentui/core/node_modules/diff/libcjs/diff/json.d.ts +0 -24
  28. package/node_modules/@opentui/core/node_modules/diff/libcjs/diff/json.d.ts.map +0 -1
  29. package/node_modules/@opentui/core/node_modules/diff/libcjs/diff/json.js +0 -105
  30. package/node_modules/@opentui/core/node_modules/diff/libcjs/diff/line.d.ts +0 -24
  31. package/node_modules/@opentui/core/node_modules/diff/libcjs/diff/line.d.ts.map +0 -1
  32. package/node_modules/@opentui/core/node_modules/diff/libcjs/diff/line.js +0 -89
  33. package/node_modules/@opentui/core/node_modules/diff/libcjs/diff/sentence.d.ts +0 -21
  34. package/node_modules/@opentui/core/node_modules/diff/libcjs/diff/sentence.d.ts.map +0 -1
  35. package/node_modules/@opentui/core/node_modules/diff/libcjs/diff/sentence.js +0 -67
  36. package/node_modules/@opentui/core/node_modules/diff/libcjs/diff/word.d.ts +0 -35
  37. package/node_modules/@opentui/core/node_modules/diff/libcjs/diff/word.d.ts.map +0 -1
  38. package/node_modules/@opentui/core/node_modules/diff/libcjs/diff/word.js +0 -307
  39. package/node_modules/@opentui/core/node_modules/diff/libcjs/index.d.ts +0 -20
  40. package/node_modules/@opentui/core/node_modules/diff/libcjs/index.d.ts.map +0 -1
  41. package/node_modules/@opentui/core/node_modules/diff/libcjs/index.js +0 -61
  42. package/node_modules/@opentui/core/node_modules/diff/libcjs/package.json +0 -1
  43. package/node_modules/@opentui/core/node_modules/diff/libcjs/patch/apply.d.ts +0 -62
  44. package/node_modules/@opentui/core/node_modules/diff/libcjs/patch/apply.d.ts.map +0 -1
  45. package/node_modules/@opentui/core/node_modules/diff/libcjs/patch/apply.js +0 -267
  46. package/node_modules/@opentui/core/node_modules/diff/libcjs/patch/create.d.ts +0 -100
  47. package/node_modules/@opentui/core/node_modules/diff/libcjs/patch/create.d.ts.map +0 -1
  48. package/node_modules/@opentui/core/node_modules/diff/libcjs/patch/create.js +0 -223
  49. package/node_modules/@opentui/core/node_modules/diff/libcjs/patch/line-endings.d.ts +0 -17
  50. package/node_modules/@opentui/core/node_modules/diff/libcjs/patch/line-endings.d.ts.map +0 -1
  51. package/node_modules/@opentui/core/node_modules/diff/libcjs/patch/line-endings.js +0 -61
  52. package/node_modules/@opentui/core/node_modules/diff/libcjs/patch/parse.d.ts +0 -8
  53. package/node_modules/@opentui/core/node_modules/diff/libcjs/patch/parse.d.ts.map +0 -1
  54. package/node_modules/@opentui/core/node_modules/diff/libcjs/patch/parse.js +0 -133
  55. package/node_modules/@opentui/core/node_modules/diff/libcjs/patch/reverse.d.ts +0 -9
  56. package/node_modules/@opentui/core/node_modules/diff/libcjs/patch/reverse.d.ts.map +0 -1
  57. package/node_modules/@opentui/core/node_modules/diff/libcjs/patch/reverse.js +0 -37
  58. package/node_modules/@opentui/core/node_modules/diff/libcjs/types.d.ts +0 -213
  59. package/node_modules/@opentui/core/node_modules/diff/libcjs/types.d.ts.map +0 -1
  60. package/node_modules/@opentui/core/node_modules/diff/libcjs/types.js +0 -2
  61. package/node_modules/@opentui/core/node_modules/diff/libcjs/util/array.d.ts +0 -3
  62. package/node_modules/@opentui/core/node_modules/diff/libcjs/util/array.d.ts.map +0 -1
  63. package/node_modules/@opentui/core/node_modules/diff/libcjs/util/array.js +0 -21
  64. package/node_modules/@opentui/core/node_modules/diff/libcjs/util/distance-iterator.d.ts +0 -2
  65. package/node_modules/@opentui/core/node_modules/diff/libcjs/util/distance-iterator.d.ts.map +0 -1
  66. package/node_modules/@opentui/core/node_modules/diff/libcjs/util/distance-iterator.js +0 -40
  67. package/node_modules/@opentui/core/node_modules/diff/libcjs/util/params.d.ts +0 -4
  68. package/node_modules/@opentui/core/node_modules/diff/libcjs/util/params.d.ts.map +0 -1
  69. package/node_modules/@opentui/core/node_modules/diff/libcjs/util/params.js +0 -17
  70. package/node_modules/@opentui/core/node_modules/diff/libcjs/util/string.d.ts +0 -18
  71. package/node_modules/@opentui/core/node_modules/diff/libcjs/util/string.d.ts.map +0 -1
  72. package/node_modules/@opentui/core/node_modules/diff/libcjs/util/string.js +0 -141
  73. package/node_modules/@opentui/core/node_modules/diff/libesm/convert/dmp.d.ts +0 -8
  74. package/node_modules/@opentui/core/node_modules/diff/libesm/convert/dmp.d.ts.map +0 -1
  75. package/node_modules/@opentui/core/node_modules/diff/libesm/convert/dmp.js +0 -21
  76. package/node_modules/@opentui/core/node_modules/diff/libesm/convert/xml.d.ts +0 -6
  77. package/node_modules/@opentui/core/node_modules/diff/libesm/convert/xml.d.ts.map +0 -1
  78. package/node_modules/@opentui/core/node_modules/diff/libesm/convert/xml.js +0 -31
  79. package/node_modules/@opentui/core/node_modules/diff/libesm/diff/array.d.ts +0 -19
  80. package/node_modules/@opentui/core/node_modules/diff/libesm/diff/array.d.ts.map +0 -1
  81. package/node_modules/@opentui/core/node_modules/diff/libesm/diff/array.js +0 -16
  82. package/node_modules/@opentui/core/node_modules/diff/libesm/diff/base.d.ts +0 -20
  83. package/node_modules/@opentui/core/node_modules/diff/libesm/diff/base.d.ts.map +0 -1
  84. package/node_modules/@opentui/core/node_modules/diff/libesm/diff/base.js +0 -253
  85. package/node_modules/@opentui/core/node_modules/diff/libesm/diff/character.d.ts +0 -19
  86. package/node_modules/@opentui/core/node_modules/diff/libesm/diff/character.d.ts.map +0 -1
  87. package/node_modules/@opentui/core/node_modules/diff/libesm/diff/character.js +0 -7
  88. package/node_modules/@opentui/core/node_modules/diff/libesm/diff/css.d.ts +0 -18
  89. package/node_modules/@opentui/core/node_modules/diff/libesm/diff/css.d.ts.map +0 -1
  90. package/node_modules/@opentui/core/node_modules/diff/libesm/diff/css.js +0 -10
  91. package/node_modules/@opentui/core/node_modules/diff/libesm/diff/json.d.ts +0 -24
  92. package/node_modules/@opentui/core/node_modules/diff/libesm/diff/json.d.ts.map +0 -1
  93. package/node_modules/@opentui/core/node_modules/diff/libesm/diff/json.js +0 -78
  94. package/node_modules/@opentui/core/node_modules/diff/libesm/diff/line.d.ts +0 -24
  95. package/node_modules/@opentui/core/node_modules/diff/libesm/diff/line.d.ts.map +0 -1
  96. package/node_modules/@opentui/core/node_modules/diff/libesm/diff/line.js +0 -65
  97. package/node_modules/@opentui/core/node_modules/diff/libesm/diff/sentence.d.ts +0 -21
  98. package/node_modules/@opentui/core/node_modules/diff/libesm/diff/sentence.d.ts.map +0 -1
  99. package/node_modules/@opentui/core/node_modules/diff/libesm/diff/sentence.js +0 -43
  100. package/node_modules/@opentui/core/node_modules/diff/libesm/diff/word.d.ts +0 -35
  101. package/node_modules/@opentui/core/node_modules/diff/libesm/diff/word.d.ts.map +0 -1
  102. package/node_modules/@opentui/core/node_modules/diff/libesm/diff/word.js +0 -276
  103. package/node_modules/@opentui/core/node_modules/diff/libesm/index.d.ts +0 -20
  104. package/node_modules/@opentui/core/node_modules/diff/libesm/index.d.ts.map +0 -1
  105. package/node_modules/@opentui/core/node_modules/diff/libesm/index.js +0 -30
  106. package/node_modules/@opentui/core/node_modules/diff/libesm/package.json +0 -1
  107. package/node_modules/@opentui/core/node_modules/diff/libesm/patch/apply.d.ts +0 -62
  108. package/node_modules/@opentui/core/node_modules/diff/libesm/patch/apply.d.ts.map +0 -1
  109. package/node_modules/@opentui/core/node_modules/diff/libesm/patch/apply.js +0 -257
  110. package/node_modules/@opentui/core/node_modules/diff/libesm/patch/create.d.ts +0 -100
  111. package/node_modules/@opentui/core/node_modules/diff/libesm/patch/create.d.ts.map +0 -1
  112. package/node_modules/@opentui/core/node_modules/diff/libesm/patch/create.js +0 -201
  113. package/node_modules/@opentui/core/node_modules/diff/libesm/patch/line-endings.d.ts +0 -17
  114. package/node_modules/@opentui/core/node_modules/diff/libesm/patch/line-endings.d.ts.map +0 -1
  115. package/node_modules/@opentui/core/node_modules/diff/libesm/patch/line-endings.js +0 -44
  116. package/node_modules/@opentui/core/node_modules/diff/libesm/patch/parse.d.ts +0 -8
  117. package/node_modules/@opentui/core/node_modules/diff/libesm/patch/parse.d.ts.map +0 -1
  118. package/node_modules/@opentui/core/node_modules/diff/libesm/patch/parse.js +0 -130
  119. package/node_modules/@opentui/core/node_modules/diff/libesm/patch/reverse.d.ts +0 -9
  120. package/node_modules/@opentui/core/node_modules/diff/libesm/patch/reverse.d.ts.map +0 -1
  121. package/node_modules/@opentui/core/node_modules/diff/libesm/patch/reverse.js +0 -23
  122. package/node_modules/@opentui/core/node_modules/diff/libesm/types.d.ts +0 -213
  123. package/node_modules/@opentui/core/node_modules/diff/libesm/types.d.ts.map +0 -1
  124. package/node_modules/@opentui/core/node_modules/diff/libesm/types.js +0 -1
  125. package/node_modules/@opentui/core/node_modules/diff/libesm/util/array.d.ts +0 -3
  126. package/node_modules/@opentui/core/node_modules/diff/libesm/util/array.d.ts.map +0 -1
  127. package/node_modules/@opentui/core/node_modules/diff/libesm/util/array.js +0 -17
  128. package/node_modules/@opentui/core/node_modules/diff/libesm/util/distance-iterator.d.ts +0 -2
  129. package/node_modules/@opentui/core/node_modules/diff/libesm/util/distance-iterator.d.ts.map +0 -1
  130. package/node_modules/@opentui/core/node_modules/diff/libesm/util/distance-iterator.js +0 -37
  131. package/node_modules/@opentui/core/node_modules/diff/libesm/util/params.d.ts +0 -4
  132. package/node_modules/@opentui/core/node_modules/diff/libesm/util/params.d.ts.map +0 -1
  133. package/node_modules/@opentui/core/node_modules/diff/libesm/util/params.js +0 -14
  134. package/node_modules/@opentui/core/node_modules/diff/libesm/util/string.d.ts +0 -18
  135. package/node_modules/@opentui/core/node_modules/diff/libesm/util/string.d.ts.map +0 -1
  136. package/node_modules/@opentui/core/node_modules/diff/libesm/util/string.js +0 -128
  137. package/node_modules/@opentui/core/node_modules/diff/package.json +0 -131
  138. package/node_modules/@opentui/core/node_modules/diff/release-notes.md +0 -397
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xyne/xyne-cli-linux-x64",
3
- "version": "0.4.6",
3
+ "version": "0.4.7",
4
4
  "description": "Prebuilt Linux x64 binary for @xyne/xyne-cli",
5
5
  "os": [
6
6
  "linux"
package/xyne-linux-x64 CHANGED
Binary file
@@ -1,28 +0,0 @@
1
- ## Building and testing
2
-
3
- ```
4
- yarn
5
- yarn test
6
- ```
7
-
8
- To run tests in a *browser* (for instance to test compatibility with Firefox, with Safari, or with old browser versions), run `yarn karma start`, then open http://localhost:9876/ in the browser you want to test in. Results of the test run will appear in the terminal where `yarn karma start` is running.
9
-
10
- If you notice any problems, please report them to the GitHub issue tracker at
11
- [http://github.com/kpdecker/jsdiff/issues](http://github.com/kpdecker/jsdiff/issues).
12
-
13
- ## Releasing
14
-
15
- Run a test in Firefox via the procedure above before releasing.
16
-
17
- A full release may be completed by first updating the `"version"` property in package.json, then running the following:
18
-
19
- ```
20
- yarn clean
21
- yarn build
22
- yarn publish
23
- ```
24
-
25
- After releasing, remember to:
26
- * commit the `package.json` change and push it to GitHub
27
- * create a new version tag on GitHub
28
- * update `diff.js` on the `gh-pages` branch to the latest built version from the `dist/` folder.
@@ -1,29 +0,0 @@
1
- BSD 3-Clause License
2
-
3
- Copyright (c) 2009-2015, Kevin Decker <kpdecker@gmail.com>
4
- All rights reserved.
5
-
6
- Redistribution and use in source and binary forms, with or without
7
- modification, are permitted provided that the following conditions are met:
8
-
9
- 1. Redistributions of source code must retain the above copyright notice, this
10
- list of conditions and the following disclaimer.
11
-
12
- 2. Redistributions in binary form must reproduce the above copyright notice,
13
- this list of conditions and the following disclaimer in the documentation
14
- and/or other materials provided with the distribution.
15
-
16
- 3. Neither the name of the copyright holder nor the names of its
17
- contributors may be used to endorse or promote products derived from
18
- this software without specific prior written permission.
19
-
20
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21
- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23
- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24
- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26
- SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27
- CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28
- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -1,378 +0,0 @@
1
- # jsdiff
2
-
3
- A JavaScript text differencing implementation. Try it out in the **[online demo](https://kpdecker.github.io/jsdiff)**.
4
-
5
- Based on the algorithm proposed in
6
- ["An O(ND) Difference Algorithm and its Variations" (Myers, 1986)](http://www.xmailserver.org/diff2.pdf).
7
-
8
- ## Installation
9
- ```bash
10
- npm install diff --save
11
- ```
12
-
13
- ## Getting started
14
-
15
- ### Imports
16
-
17
- In an environment where you can use imports, everything you need can be imported directly from `diff`. e.g.
18
-
19
- ESM:
20
-
21
- ```
22
- import {diffChars, createPatch} from 'diff';
23
- ```
24
-
25
- CommonJS
26
-
27
- ```
28
- const {diffChars, createPatch} = require('diff');
29
- ```
30
-
31
- If you want to serve jsdiff to a web page without using a module system, you can use `dist/diff.js` or `dist/diff.min.js`. These create a global called `Diff` that contains the entire JsDiff API as its properties.
32
-
33
- ### Usage
34
-
35
- jsdiff's diff functions all take an old text and a new text and perform three steps:
36
-
37
- 1. Split both texts into arrays of "tokens". What constitutes a token varies; in `diffChars`, each character is a token, while in `diffLines`, each line is a token.
38
-
39
- 2. Find the smallest set of single-token *insertions* and *deletions* needed to transform the first array of tokens into the second.
40
-
41
- This step depends upon having some notion of a token from the old array being "equal" to one from the new array, and this notion of equality affects the results. Usually two tokens are equal if `===` considers them equal, but some of the diff functions use an alternative notion of equality or have options to configure it. For instance, by default `diffChars("Foo", "FOOD")` will require two deletions (`o`, `o`) and three insertions (`O`, `O`, `D`), but `diffChars("Foo", "FOOD", {ignoreCase: true})` will require just one insertion (of a `D`), since `ignoreCase` causes `o` and `O` to be considered equal.
42
-
43
- 3. Return an array representing the transformation computed in the previous step as a series of [change objects](#change-objects). The array is ordered from the start of the input to the end, and each change object represents *inserting* one or more tokens, *deleting* one or more tokens, or *keeping* one or more tokens.
44
-
45
- ## API
46
-
47
- * `diffChars(oldStr, newStr[, options])` - diffs two blocks of text, treating each character as a token.
48
-
49
- ("Characters" here means Unicode code points - the elements you get when you loop over a string with a `for ... of ...` loop.)
50
-
51
- Returns a list of [change objects](#change-objects).
52
-
53
- Options
54
- * `ignoreCase`: If `true`, the uppercase and lowercase forms of a character are considered equal. Defaults to `false`.
55
-
56
- * `diffWords(oldStr, newStr[, options])` - diffs two blocks of text, treating each word and each punctuation mark as a token. Whitespace is ignored when computing the diff (but preserved as far as possible in the final change objects).
57
-
58
- Returns a list of [change objects](#change-objects).
59
-
60
- Options
61
- * `ignoreCase`: Same as in `diffChars`. Defaults to false.
62
- * `intlSegmenter`: 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.
63
-
64
- 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.
65
-
66
- 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.
67
-
68
- * `diffWordsWithSpace(oldStr, newStr[, options])` - diffs two blocks of text, treating each word, punctuation mark, newline, or run of (non-newline) whitespace as a token.
69
-
70
- * `diffLines(oldStr, newStr[, options])` - diffs two blocks of text, treating each line as a token.
71
-
72
- Options
73
- * `ignoreWhitespace`: `true` to ignore leading and trailing whitespace characters when checking if two lines are equal. Defaults to `false`.
74
- * `ignoreNewlineAtEof`: `true` to ignore a missing newline character at the end of the last line when comparing it to other lines. (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.) Ignored if `ignoreWhitespace` or `newlineIsToken` are also true.
75
- * `stripTrailingCr`: `true` to remove all trailing CR (`\r`) characters before performing the diff. Defaults to `false`.
76
- This helps to get a useful diff when diffing UNIX text files against Windows text files.
77
- * `newlineIsToken`: `true` to treat the newline character at the end of each line as its own token. This allows for changes to the newline structure to occur independently of the line content and to be treated as such. 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. Defaults to `false`.
78
-
79
- Note that while using `ignoreWhitespace` in combination with `newlineIsToken` is not an error, results may not be as expected. 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. This is because the content of a completely blank line is not a token at all in `newlineIsToken` mode.
80
-
81
- Returns a list of [change objects](#change-objects).
82
-
83
- * `diffSentences(oldStr, newStr[, options])` - diffs two blocks of text, treating each sentence, and the whitespace between each pair of sentences, as a token. The characters `.`, `!`, and `?`, when followed by whitespace, are treated as marking the end of a sentence; nothing else besides the end of the string is considered to mark a sentence end.
84
-
85
- (For more sophisticated detection of sentence breaks, including support for non-English punctuation, consider instead tokenizing with an [`Intl.Segmenter`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Segmenter) with `granularity: 'sentence'` and passing the result to `diffArrays`.)
86
-
87
- Returns a list of [change objects](#change-objects).
88
-
89
- * `diffCss(oldStr, newStr[, options])` - diffs two blocks of text, comparing CSS tokens.
90
-
91
- Returns a list of [change objects](#change-objects).
92
-
93
- * `diffJson(oldObj, newObj[, options])` - diffs two JSON-serializable objects by first serializing them to prettily-formatted JSON and then treating each line of the JSON as a token. Object properties are ordered alphabetically in the serialized JSON, so the order of properties in the objects being compared doesn't affect the result.
94
-
95
- Returns a list of [change objects](#change-objects).
96
-
97
- Options
98
- * `stringifyReplacer`: A custom replacer function. 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.
99
- * `undefinedReplacement`: A value to replace `undefined` with. Ignored if a `stringifyReplacer` is provided.
100
-
101
- * `diffArrays(oldArr, newArr[, options])` - diffs two arrays of tokens, comparing each item for strict equality (===).
102
-
103
- Options
104
- * `comparator`: `function(left, right)` for custom equality checks
105
-
106
- Returns a list of [change objects](#change-objects).
107
-
108
- * `createTwoFilesPatch(oldFileName, newFileName, oldStr, newStr[, oldHeader[, newHeader[, options]]])` - creates a unified diff patch by first computing a diff with `diffLines` and then serializing it to unified diff format.
109
-
110
- Parameters:
111
- * `oldFileName` : String to be output in the filename section of the patch for the removals
112
- * `newFileName` : String to be output in the filename section of the patch for the additions
113
- * `oldStr` : Original string value
114
- * `newStr` : New string value
115
- * `oldHeader` : Optional additional information to include in the old file header. Default: `undefined`.
116
- * `newHeader` : Optional additional information to include in the new file header. Default: `undefined`.
117
- * `options` : An object with options.
118
- - `context` describes how many lines of context should be included. You can set this to `Number.MAX_SAFE_INTEGER` or `Infinity` to include the entire file content in one hunk.
119
- - `ignoreWhitespace`: Same as in `diffLines`. Defaults to `false`.
120
- - `stripTrailingCr`: Same as in `diffLines`. Defaults to `false`.
121
-
122
- * `createPatch(fileName, oldStr, newStr[, oldHeader[, newHeader[, options]]])` - creates a unified diff patch.
123
-
124
- Just like createTwoFilesPatch, but with oldFileName being equal to newFileName.
125
-
126
- * `formatPatch(patch)` - creates a unified diff patch.
127
-
128
- `patch` may be either a single structured patch object (as returned by `structuredPatch`) or an array of them (as returned by `parsePatch`).
129
-
130
- * `structuredPatch(oldFileName, newFileName, oldStr, newStr[, oldHeader[, newHeader[, options]]])` - returns an object with an array of hunk objects.
131
-
132
- This method is similar to createTwoFilesPatch, but returns a data structure
133
- suitable for further processing. Parameters are the same as createTwoFilesPatch. The data structure returned may look like this:
134
-
135
- ```js
136
- {
137
- oldFileName: 'oldfile', newFileName: 'newfile',
138
- oldHeader: 'header1', newHeader: 'header2',
139
- hunks: [{
140
- oldStart: 1, oldLines: 3, newStart: 1, newLines: 3,
141
- lines: [' line2', ' line3', '-line4', '+line5', '\'],
142
- }]
143
- }
144
- ```
145
-
146
- * `applyPatch(source, patch[, options])` - attempts to apply a unified diff patch.
147
-
148
- Hunks are applied first to last. `applyPatch` first tries to apply the first hunk at the line number specified in the hunk header, and with all context lines matching exactly. If that fails, it tries scanning backwards and forwards, one line at a time, to find a place to apply the hunk where the context lines match exactly. If that still fails, and `fuzzFactor` is greater than zero, it increments the maximum number of mismatches (missing, extra, or changed context lines) that there can be between the hunk context and a region where we are trying to apply the patch such that the hunk will still be considered to match. Regardless of `fuzzFactor`, lines to be deleted in the hunk *must* be present for a hunk to match, and the context lines *immediately* before and after an insertion must match exactly.
149
-
150
- Once a hunk is successfully fitted, the process begins again with the next hunk. Regardless of `fuzzFactor`, later hunks must be applied later in the file than earlier hunks.
151
-
152
- If a hunk cannot be successfully fitted *anywhere* with fewer than `fuzzFactor` mismatches, `applyPatch` fails and returns `false`.
153
-
154
- If a hunk is successfully fitted but not at the line number specified by the hunk header, all subsequent hunks have their target line number adjusted accordingly. (e.g. if the first hunk is applied 10 lines below where the hunk header said it should fit, `applyPatch` will *start* looking for somewhere to apply the second hunk 10 lines below where its hunk header says it goes.)
155
-
156
- If the patch was applied successfully, returns a string containing the patched text. If the patch could not be applied (because some hunks in the patch couldn't be fitted to the text in `source`), `applyPatch` returns false.
157
-
158
- `patch` may be a string diff or the output from the `parsePatch` or `structuredPatch` methods.
159
-
160
- The optional `options` object may have the following keys:
161
-
162
- - `fuzzFactor`: Maximum Levenshtein distance (in lines deleted, added, or subtituted) between the context shown in a patch hunk and the lines found in the file. Defaults to 0.
163
- - `autoConvertLineEndings`: If `true`, and if the file to be patched consistently uses different line endings to the patch (i.e. either the file always uses Unix line endings while the patch uses Windows ones, or vice versa), then `applyPatch` will behave as if the line endings in the patch were the same as those in the source file. (If `false`, the patch will usually fail to apply in such circumstances since lines deleted in the patch won't be considered to match those in the source file.) Defaults to `true`.
164
- - `compareLine(lineNumber, line, operation, patchContent)`: Callback used to compare to given lines to determine if they should be considered equal when patching. Defaults to strict equality but may be overridden to provide fuzzier comparison. Should return false if the lines should be rejected.
165
-
166
- * `applyPatches(patch, options)` - applies one or more patches.
167
-
168
- `patch` may be either an array of structured patch objects, or a string representing a patch in unified diff format (which may patch one or more files).
169
-
170
- This method will iterate over the contents of the patch and apply to data provided through callbacks. The general flow for each patch index is:
171
-
172
- - `options.loadFile(index, callback)` is called. The caller should then load the contents of the file and then pass that to the `callback(err, data)` callback. Passing an `err` will terminate further patch execution.
173
- - `options.patched(index, content, callback)` is called once the patch has been applied. `content` will be the return value from `applyPatch`. When it's ready, the caller should call `callback(err)` callback. Passing an `err` will terminate further patch execution.
174
-
175
- Once all patches have been applied or an error occurs, the `options.complete(err)` callback is made.
176
-
177
- * `parsePatch(diffStr)` - Parses a patch into structured data
178
-
179
- Return a JSON object representation of the a patch, suitable for use with the `applyPatch` method. This parses to the same structure returned by `structuredPatch`.
180
-
181
- * `reversePatch(patch)` - Returns a new structured patch which when applied will undo the original `patch`.
182
-
183
- `patch` may be either a single structured patch object (as returned by `structuredPatch`) or an array of them (as returned by `parsePatch`).
184
-
185
- * `convertChangesToXML(changes)` - converts a list of change objects to a serialized XML format
186
-
187
- * `convertChangesToDMP(changes)` - converts a list of change objects to the format returned by Google's [diff-match-patch](https://github.com/google/diff-match-patch) library
188
-
189
- #### Universal `options`
190
-
191
- Certain options can be provided in the `options` object of *any* method that calculates a diff (including `diffChars`, `diffLines` etc. as well as `structuredPatch`, `createPatch`, and `createTwoFilesPatch`):
192
-
193
- * `callback`: if provided, the diff will be computed in async mode to avoid blocking the event loop while the diff is calculated. The value of the `callback` option should be a function and will be passed the computed diff or patch as its first argument.
194
-
195
- (Note that if the ONLY option you want to provide is a callback, you can pass the callback function directly as the `options` parameter instead of passing an object with a `callback` property.)
196
-
197
- * `maxEditLength`: a number specifying the maximum edit distance to consider between the old and new texts. 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. 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.
198
-
199
- * `timeout`: a number of milliseconds after which the diffing algorithm will abort and return `undefined`. Supported by the same functions as `maxEditLength`.
200
-
201
- * `oneChangePerToken`: 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.
202
-
203
- ### Defining custom diffing behaviors
204
-
205
- If you need behavior a little different to what any of the text diffing functions above offer, you can roll your own by customizing both the tokenization behavior used and the notion of equality used to determine if two tokens are equal.
206
-
207
- The simplest way to customize tokenization behavior is to simply tokenize the texts you want to diff yourself, with your own code, then pass the arrays of tokens to `diffArrays`. For instance, if you wanted a semantically-aware diff of some code, you could try tokenizing it using a parser specific to the programming language the code is in, then passing the arrays of tokens to `diffArrays`.
208
-
209
- To customize the notion of token equality used, use the `comparator` option to `diffArrays`.
210
-
211
- For even more customisation of the diffing behavior, you can extend the `Diff()` class, override its `castInput`, `tokenize`, `removeEmpty`, `equals`, and `join` properties with your own functions, then call its `diff(oldString, newString[, options])` method. The methods you can override are used as follows:
212
-
213
- * `castInput(value, options)`: used to transform the `oldString` and `newString` before any other steps in the diffing algorithm happen. For instance, `diffJson` uses `castInput` to serialize the objects being diffed to JSON. Defaults to a no-op.
214
- * `tokenize(value, options)`: used to convert each of `oldString` and `newString` (after they've gone through `castInput`) to an array of tokens. Defaults to returning `value.split('')` (returning an array of individual characters).
215
- * `removeEmpty(array)`: called on the arrays of tokens returned by `tokenize` and can be used to modify them. Defaults to stripping out falsey tokens, such as empty strings. `diffArrays` overrides this to simply return the `array`, which means that falsey values like empty strings can be handled like any other token by `diffArrays`.
216
- * `equals(left, right, options)`: called to determine if two tokens (one from the old string, one from the new string) should be considered equal. Defaults to comparing them with `===`.
217
- * `join(tokens)`: gets called with an array of consecutive tokens that have either all been added, all been removed, or are all common. Needs to join them into a single value that can be used as the `value` property of the [change object](#change-objects) for these tokens. Defaults to simply returning `tokens.join('')` (and therefore by default will error out if your tokens are not strings; differs that support non-string tokens like `diffArrays` should override it to be a no-op to fix this).
218
- * `postProcess(changeObjects, options)`: gets called at the end of the algorithm with the [change objects](#change-objects) produced, and can do final cleanups on them. Defaults to simply returning `changeObjects` unchanged.
219
-
220
- ### Change Objects
221
- Many of the methods above return change objects. These objects consist of the following fields:
222
-
223
- * `value`: 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. 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.
224
- * `added`: true if the value was inserted into the new string, otherwise false
225
- * `removed`: true if the value was removed from the old string, otherwise false
226
- * `count`: How many tokens (e.g. chars for `diffChars`, lines for `diffLines`) the value in the change object consists of
227
-
228
- (Change objects where `added` and `removed` are both false represent content that is common to the old and new strings.)
229
-
230
- ## Examples
231
-
232
- #### Basic example in Node
233
-
234
- ```js
235
- require('colors');
236
- const {diffChars} = require('diff');
237
-
238
- const one = 'beep boop';
239
- const other = 'beep boob blah';
240
-
241
- const diff = diffChars(one, other);
242
-
243
- diff.forEach((part) => {
244
- // green for additions, red for deletions
245
- let text = part.added ? part.value.bgGreen :
246
- part.removed ? part.value.bgRed :
247
- part.value;
248
- process.stderr.write(text);
249
- });
250
-
251
- console.log();
252
- ```
253
- Running the above program should yield
254
-
255
- <img src="images/node_example.png" alt="Node Example">
256
-
257
- #### Basic example in a web page
258
-
259
- ```html
260
- <pre id="display"></pre>
261
- <script src="diff.js"></script>
262
- <script>
263
- const one = 'beep boop',
264
- other = 'beep boob blah',
265
- color = '';
266
-
267
- let span = null;
268
-
269
- const diff = Diff.diffChars(one, other),
270
- display = document.getElementById('display'),
271
- fragment = document.createDocumentFragment();
272
-
273
- diff.forEach((part) => {
274
- // green for additions, red for deletions
275
- // grey for common parts
276
- const color = part.added ? 'green' :
277
- part.removed ? 'red' : 'grey';
278
- span = document.createElement('span');
279
- span.style.color = color;
280
- span.appendChild(document
281
- .createTextNode(part.value));
282
- fragment.appendChild(span);
283
- });
284
-
285
- display.appendChild(fragment);
286
- </script>
287
- ```
288
-
289
- Open the above .html file in a browser and you should see
290
-
291
- <img src="images/web_example.png" alt="Node Example">
292
-
293
- #### Example of generating a patch from Node
294
-
295
- The code below is roughly equivalent to the Unix command `diff -u file1.txt file2.txt > mydiff.patch`:
296
-
297
- ```
298
- const {createTwoFilesPatch} = require('diff');
299
- const file1Contents = fs.readFileSync("file1.txt").toString();
300
- const file2Contents = fs.readFileSync("file2.txt").toString();
301
- const patch = createTwoFilesPatch("file1.txt", "file2.txt", file1Contents, file2Contents);
302
- fs.writeFileSync("mydiff.patch", patch);
303
- ```
304
-
305
- #### Examples of parsing and applying a patch from Node
306
-
307
- ##### Applying a patch to a specified file
308
-
309
- The code below is roughly equivalent to the Unix command `patch file1.txt mydiff.patch`:
310
-
311
- ```
312
- const {applyPatch} = require('diff');
313
- const file1Contents = fs.readFileSync("file1.txt").toString();
314
- const patch = fs.readFileSync("mydiff.patch").toString();
315
- const patchedFile = applyPatch(file1Contents, patch);
316
- fs.writeFileSync("file1.txt", patchedFile);
317
- ```
318
-
319
- ##### Applying a multi-file patch to the files specified by the patch file itself
320
-
321
- The code below is roughly equivalent to the Unix command `patch < mydiff.patch`:
322
-
323
- ```
324
- const {applyPatches} = require('diff');
325
- const patch = fs.readFileSync("mydiff.patch").toString();
326
- applyPatches(patch, {
327
- loadFile: (patch, callback) => {
328
- let fileContents;
329
- try {
330
- fileContents = fs.readFileSync(patch.oldFileName).toString();
331
- } catch (e) {
332
- callback(`No such file: ${patch.oldFileName}`);
333
- return;
334
- }
335
- callback(undefined, fileContents);
336
- },
337
- patched: (patch, patchedContent, callback) => {
338
- if (patchedContent === false) {
339
- callback(`Failed to apply patch to ${patch.oldFileName}`)
340
- return;
341
- }
342
- fs.writeFileSync(patch.oldFileName, patchedContent);
343
- callback();
344
- },
345
- complete: (err) => {
346
- if (err) {
347
- console.log("Failed with error:", err);
348
- }
349
- }
350
- });
351
- ```
352
-
353
- ## Compatibility
354
-
355
- jsdiff should support all ES5 environments. If you find one that it doesn't support, please [open an issue](https://github.com/kpdecker/jsdiff/issues).
356
-
357
- ## TypeScript
358
-
359
- As of version 8, JsDiff ships with type definitions. From version 8 onwards, you should not depend on the `@types/diff` package.
360
-
361
- One tricky pattern pervades the type definitions and is worth explaining here. Most diff-generating and patch-generating functions (`diffChars`, `diffWords`, `structuredPatch`, etc) can be run in async mode (by providing a `callback` option), in abortable mode (by passing a `timeout` or `maxEditLength` property), or both. This is awkward for typing, because these modes have different call signatures:
362
- * in abortable mode, the result *might* be `undefined`, and
363
- * in async mode, the result (which *might* be allowed to be `undefined`, depending upon whether we're in abortable mode) is passed to the provide callback instead of being returned, and the return value is always `undefined`
364
-
365
- Our type definitions handle this as best they can by declaring different types for multiple [overload signatures](https://www.typescriptlang.org/docs/handbook/2/functions.html#function-overloads) for each such function - and also by declaring different types for abortable and nonabortable options objects. For instance, an object of type `DiffCharsOptionsAbortable` is valid to pass as the `options` argument to `diffChars` and represents an *abortable* call (whose result may be `undefined`) since it necessarily contains either the `timeout` or `maxEditLength` property.
366
-
367
- This approach, while probably the least bad way available to add types to JsDiff without radically refactoring the library's API, does not yield perfect results. *As long as* TypeScript is able to statically determine the type of your options, and therefore which overload signature is appropriate, everything should work fine. This should always be the case if you are passing an object literal as the `options` argument and inlining the definition of any `callback` function within that literal. But in cases where TypeScript *cannot* manage to do this - as may often be the case if you, say, define an `options: any = {}` object, build up your options programmatically, and then pass the result to a JsDiff function - then it is likely to fail to match the correct overload signature (probably defaulting to assuming you are calling the function in non-abortable, non-async mode), potentially causing type errors. You can either ignore (e.g. with `@ts-expect-error`) any such errors, or try to avoid them by refactoring your code so that TypeScript can always statically determine the type of the options you pass.
368
-
369
- ## License
370
-
371
- See [LICENSE](https://github.com/kpdecker/jsdiff/blob/master/LICENSE).
372
-
373
- ## Deviations from the published Myers diff algorithm
374
-
375
- jsdiff deviates from the published algorithm in a couple of ways that don't affect results but do affect performance:
376
-
377
- * jsdiff keeps track of the diff for each diagonal using a linked list of change objects for each diagonal, rather than the historical array of furthest-reaching D-paths on each diagonal contemplated on page 8 of Myers's paper.
378
- * jsdiff skips considering diagonals where the furthest-reaching D-path would go off the edge of the edit graph. This dramatically reduces the time cost (from quadratic to linear) in cases where the new text just appends or truncates content at the end of the old text.