Skip to content

Commit

Permalink
deps: bump diff from 5.2.0 to 6.0.0 (#474)
Browse files Browse the repository at this point in the history
Bumps [diff](https://github.com/kpdecker/jsdiff) from 5.2.0 to 6.0.0.
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/kpdecker/jsdiff/blob/master/release-notes.md">diff's
changelog</a>.</em></p>
<blockquote>
<h2>6.0.0 (currently in beta)</h2>
<p>This is a release containing many, <em>many</em> breaking changes.
The objective of this release was to carry out a mass fix, in one go, of
all the open bugs and design problems that required breaking changes to
fix. A substantial, but exhaustive, changelog is below.</p>
<p><a
href="https://github.com/kpdecker/jsdiff/compare/master...v6.0.0-staging">Commits</a></p>
<ul>
<li>
<p><a
href="https://github.com/kpdecker/jsdiff/pull/497">#497</a>
<strong><code>diffWords</code> behavior has been radically
changed.</strong> Previously, even with <code>ignoreWhitespace:
true</code>, runs of whitespace were tokens, which led to unhelpful and
unintuitive diffing behavior in typical texts. Specifically, even when
two texts contained overlapping passages, <code>diffWords</code> would
sometimes choose to delete all the words from the old text and insert
them anew in their new positions in order to avoid having to delete or
insert whitespace tokens. Whitespace sequences are no longer tokens as
of this release, which affects both the generated diffs and the
<code>count</code>s.</p>
<p>Runs of whitespace are still tokens in
<code>diffWordsWithSpace</code>.</p>
<p>As part of the changes to <code>diffWords</code>, <strong>a new
<code>.postProcess</code> method has been added on the base
<code>Diff</code> type</strong>, which can be overridden in custom
<code>Diff</code> implementations.</p>
<p><strong><code>diffLines</code> with <code>ignoreWhitespace:
true</code> will no longer ignore the insertion or deletion of entire
extra lines of whitespace at the end of the text</strong>. Previously,
these would not show up as insertions or deletions, as a side effect of
a hack in the base diffing algorithm meant to help ignore whitespace in
<code>diffWords</code>. More generally, <strong>the undocumented special
handling in the core algorithm for ignored terminals has been removed
entirely.</strong> (This special case behavior used to rewrite the final
two change objects in a scenario where the final change object was an
addition or deletion and its <code>value</code> was treated as equal to
the empty string when compared using the diff object's
<code>.equals</code> method.)</p>
</li>
<li>
<p><a
href="https://github.com/kpdecker/jsdiff/pull/500">#500</a>
<strong><code>diffChars</code> now diffs Unicode code points</strong>
instead of UTF-16 code units.</p>
</li>
<li>
<p><a
href="https://github.com/kpdecker/jsdiff/pull/508">#508</a>
<strong><code>parsePatch</code> now always runs in what was previously
&quot;strict&quot; mode; the undocumented <code>strict</code> option has
been removed.</strong> Previously, by default, <code>parsePatch</code>
(and other patch functions that use it under the hood to parse patches)
would accept a patch where the line counts in the headers were
inconsistent with the actual patch content - e.g. where a hunk started
with the header <code>@@ -1,3 +1,6 @@</code>, indicating that the
content below spanned 3 lines in the old file and 6 lines in the new
file, but then the actual content below the header consisted of some
different number of lines, say 10 lines of context, 5 deletions, and 1
insertion. Actually trying to work with these patches using
<code>applyPatch</code> or <code>merge</code>, however, would produce
incorrect results instead of just ignoring the incorrect headers, making
this &quot;feature&quot; more of a trap than something actually useful.
It's been ripped out, and now we are always &quot;strict&quot; and will
reject patches where the line counts in the headers aren't consistent
with the actual patch content.</p>
</li>
<li>
<p><a
href="https://github.com/kpdecker/jsdiff/pull/435">#435</a>
<strong>Fix <code>parsePatch</code> handling of control
characters.</strong> <code>parsePatch</code> used to interpret various
unusual control characters - namely vertical tabs, form feeds, lone
carriage returns without a line feed, and EBCDIC NELs - as line breaks
when parsing a patch file. This was inconsistent with the behavior of
both JsDiff's own <code>diffLines</code> method and also the Unix
<code>diff</code> and <code>patch</code> utils, which all simply treat
those control characters as ordinary characters. The result of this
discrepancy was that some well-formed patches - produced either by
<code>diff</code> or by JsDiff itself and handled properly by the
<code>patch</code> util - would be wrongly parsed by
<code>parsePatch</code>, with the effect that it would disregard the
remainder of a hunk after encountering one of these control
characters.</p>
</li>
<li>
<p><a
href="https://github.com/kpdecker/jsdiff/pull/439">#439</a>
<strong>Prefer diffs that order deletions before insertions.</strong>
When faced with a choice between two diffs with an equal total edit
distance, the Myers diff algorithm generally prefers one that does
deletions before insertions rather than insertions before deletions. For
instance, when diffing <code>abcd</code> against <code>acbd</code>, it
will prefer a diff that says to delete the <code>b</code> and then
insert a new <code>b</code> after the <code>c</code>, over a diff that
says to insert a <code>c</code> before the <code>b</code> and then
delete the existing <code>c</code>. JsDiff deviated from the published
Myers algorithm in a way that led to it having the opposite preference
in many cases, including that example. This is now fixed, meaning diffs
output by JsDiff will more accurately reflect what the published Myers
diff algorithm would output.</p>
</li>
<li>
<p><a
href="https://github.com/kpdecker/jsdiff/pull/455">#455</a>
<strong>The <code>added</code> and <code>removed</code> properties of
change objects are now guaranteed to be set to a boolean value.</strong>
(Previously, they would be set to <code>undefined</code> or omitted
entirely instead of setting them to false.)</p>
</li>
<li>
<p><a
href="https://github.com/kpdecker/jsdiff/pull/464">#464</a>
Specifying <code>{maxEditLength: 0}</code> now sets a max edit length of
0 instead of no maximum.</p>
</li>
<li>
<p><a
href="https://github.com/kpdecker/jsdiff/pull/460">#460</a>
<strong>Added <code>oneChangePerToken</code> option.</strong></p>
</li>
<li>
<p><a
href="https://github.com/kpdecker/jsdiff/pull/467">#467</a>
<strong>Consistent ordering of arguments to <code>comparator(left,
right)</code>.</strong> Values from the old array will now consistently
be passed as the first argument (<code>left</code>) and values from the
new array as the second argument (<code>right</code>). Previously this
was almost (but not quite) always the other way round.</p>
</li>
<li>
<p><a
href="https://github.com/kpdecker/jsdiff/pull/480">#480</a>
<strong>Passing <code>maxEditLength</code> to <code>createPatch</code>
&amp; <code>createTwoFilesPatch</code> now works properly</strong> (i.e.
returns undefined if the max edit distance is exceeded; previous
behavior was to crash with a <code>TypeError</code> if the edit distance
was exceeded).</p>
</li>
<li>
<p><a
href="https://github.com/kpdecker/jsdiff/pull/486">#486</a>
<strong>The <code>ignoreWhitespace</code> option of
<code>diffLines</code> behaves more sensibly now.</strong>
<code>value</code>s in returned change objects now include
leading/trailing whitespace even when <code>ignoreWhitespace</code> is
used, just like how with <code>ignoreCase</code> the <code>value</code>s
still reflect the case of one of the original texts instead of being
all-lowercase. <code>ignoreWhitespace</code> is also now compatible with
<code>newlineIsToken</code>. Finally,
<strong><code>diffTrimmedLines</code> is deprecated</strong> (and
removed from the docs) in favour of using <code>diffLines</code> with
<code>ignoreWhitespace: true</code>; the two are, and always have been,
equivalent.</p>
</li>
<li>
<p><a
href="https://github.com/kpdecker/jsdiff/pull/490">#490</a>
<strong>When calling diffing functions in async mode by passing a
<code>callback</code> option, the diff result will now be passed as the
<em>first</em> argument to the callback instead of the second.</strong>
(Previously, the first argument was never used at all and would always
have value <code>undefined</code>.)</p>
</li>
<li>
<p><a
href="https://github.com/kpdecker/jsdiff/blob/master/github.com/kpdecker/jsdiff/pull/489">#489</a>
<strong><code>this.options</code> no longer exists on <code>Diff</code>
objects.</strong> Instead, <code>options</code> is now passed as an
argument to methods that rely on options, like <code>equals(left, right,
options)</code>. This fixes a race condition in async mode, where
diffing behaviour could be changed mid-execution if a concurrent usage
of the same <code>Diff</code> instances overwrote its
<code>options</code>.</p>
</li>
<li>
<p><a
href="https://github.com/kpdecker/jsdiff/pull/518">#518</a>
<strong><code>linedelimiters</code> no longer exists</strong> on patch
objects; instead, when a patch with Windows-style CRLF line endings is
parsed, <strong>the lines in <code>lines</code> will end with
<code>\r</code></strong>. There is now a <strong>new
<code>autoConvertLineEndings</code> option, on by default</strong>,
which makes it so that when a patch with Windows-style line endings is
applied to a source file with Unix style line endings, the patch gets
autoconverted to use Unix-style line endings, and when a patch with
Unix-style line endings is applied to a source file with Windows-style
line endings, it gets autoconverted to use Windows-style line
endings.</p>
</li>
<li>
<p><a
href="https://github.com/kpdecker/jsdiff/pull/521">#521</a>
**the <code>callback</code> option is now supported by
<code>structuredPatch</code>, `createPatch</p>
</li>
<li>
<p><a
href="https://github.com/kpdecker/jsdiff/pull/529">#529</a>
<strong><code>parsePatch</code> can now parse patches where lines
starting with <code>--</code> or <code>++</code> are
deleted/inserted</strong>; previously, there were edge cases where the
parser would choke on valid patches or give wrong results.</p>
</li>
<li>
<p><a
href="https://github.com/kpdecker/jsdiff/pull/530">#530</a>
<strong>Added <code>ignoreNewlineAtEof</code>
option<code>to</code>diffLines`</strong></p>
</li>
<li>
<p><a
href="https://github.com/kpdecker/jsdiff/pull/533">#533</a>
<strong><code>applyPatch</code> uses an entirely new algorithm for fuzzy
matching.</strong> Differences between the old and new algorithm are as
follows:</p>
<ul>
<li>The <code>fuzzFactor</code> now indicates the maximum <a
href="https://en.wikipedia.org/wiki/Levenshtein_distance"><em>Levenshtein</em>
distance</a> that there can be between the context shown in a hunk and
the actual file content at a location where we try to apply the hunk.
(Previously, it represented a maximum <a
href="https://en.wikipedia.org/wiki/Hamming_distance"><em>Hamming</em>
distance</a>, meaning that a single insertion or deletion in the source
file could stop a hunk from applying even with a high
<code>fuzzFactor</code>.)</li>
<li>A hunk containing a deletion can now only be applied in a context
where the line to be deleted actually appears verbatim. (Previously, as
long as enough context lines in the hunk matched,
<code>applyPatch</code> would apply the hunk anyway and delete a
completely different line.)</li>
<li>The context line immediately before and immediately after an
insertion must match exactly between the hunk and the file for a hunk to
apply. (Previously this was not required.)</li>
</ul>
</li>
<li>
<p><a
href="https://github.com/kpdecker/jsdiff/pull/535">#535</a>
<strong>A bug in patch generation functions is now fixed</strong> that
would sometimes previously cause <code>\ No newline at end of
file</code> to appear in the wrong place in the generated patch,
resulting in the patch being invalid.</p>
</li>
<li>
<p><a
href="https://github.com/kpdecker/jsdiff/pull/535">#535</a>
<strong>Passing <code>newlineIsToken: true</code> to
<em>patch</em>-generation functions is no longer allowed.</strong>
(Passing it to <code>diffLines</code> is still supported - it's only
functions like <code>createPatch</code> where passing
<code>newlineIsToken</code> is now an error.) Allowing it to be passed
never really made sense, since in cases where the option had any effect
on the output at all, the effect tended to be causing a garbled patch to
be created that couldn't actually be applied to the source file.</p>
</li>
<li>
<p><a
href="https://github.com/kpdecker/jsdiff/pull/539">#539</a>
<strong><code>diffWords</code> now takes an optional
<code>intlSegmenter</code> option</strong> which should be an
<code>Intl.Segmenter</code> with word-level granularity. This provides
better tokenization of text into words than the default behaviour, even
for English but especially for some other languages for which the
default behaviour is poor.</p>
</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/kpdecker/jsdiff/commit/e80648d06dd3dd967622dc418bcad821b003ed4a"><code>e80648d</code></a>
Release V6.0.0 (<a
href="https://github.com/kpdecker/jsdiff/issues/551">#551</a>)</li>
<li><a
href="https://github.com/kpdecker/jsdiff/commit/a8b639a64fed9f00954b7f3fea18b723a6283317"><code>a8b639a</code></a>
Remove use of regex lookbehind to improve compat with old Safari
versions (<a
href="https://github.com/kpdecker/jsdiff/issues/550">#550</a>)</li>
<li><a
href="https://github.com/kpdecker/jsdiff/commit/e8db85e3e9d8c4f05371c1299df2b1d83aa7653a"><code>e8db85e</code></a>
Bump micromatch from 4.0.5 to 4.0.8 (<a
href="https://github.com/kpdecker/jsdiff/issues/549">#549</a>)</li>
<li><a
href="https://github.com/kpdecker/jsdiff/commit/6b5247d6075bdf633a9dbc5cedf82e882b2bd673"><code>6b5247d</code></a>
Bump webpack from 5.90.3 to 5.94.0 (<a
href="https://github.com/kpdecker/jsdiff/issues/548">#548</a>)</li>
<li><a
href="https://github.com/kpdecker/jsdiff/commit/739bfff946e875b4eefe7df44f3fa9e7f756406b"><code>739bfff</code></a>
Fix reference to no-longer-existent 'rollup.config.js' file (<a
href="https://github.com/kpdecker/jsdiff/issues/544">#544</a>)</li>
<li><a
href="https://github.com/kpdecker/jsdiff/commit/3b1ac533f16c26f99703cb3d6e1fae6982a2bc42"><code>3b1ac53</code></a>
6.0.0-beta (<a
href="https://github.com/kpdecker/jsdiff/issues/543">#543</a>)</li>
<li><a
href="https://github.com/kpdecker/jsdiff/commit/af1e8f89b3cc63651a54d1088e17d1e19f9626d1"><code>af1e8f8</code></a>
Document how diffSentences works, a bit (<a
href="https://github.com/kpdecker/jsdiff/issues/542">#542</a>)</li>
<li><a
href="https://github.com/kpdecker/jsdiff/commit/fc5e7eaddc3f5b9d80af5235c2f7ced1235c5c72"><code>fc5e7ea</code></a>
Stop using old 'import assertions' syntax that was removed in Node 22
(<a
href="https://github.com/kpdecker/jsdiff/issues/540">#540</a>)</li>
<li><a
href="https://github.com/kpdecker/jsdiff/commit/4f0430a307899f813e582a61dd209c76cb439925"><code>4f0430a</code></a>
Add Intl.Segmenter support (<a
href="https://github.com/kpdecker/jsdiff/issues/539">#539</a>)</li>
<li><a
href="https://github.com/kpdecker/jsdiff/commit/244df820a4fccc37fe8c3de272eca70f160cd192"><code>244df82</code></a>
Fix more logic around newlines at EOF - this time stuff I recently broke
in (...</li>
<li>Additional commits viewable in <a
href="https://github.com/kpdecker/jsdiff/compare/v5.2.0...v6.0.0">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=diff&package-manager=npm_and_yarn&previous-version=5.2.0&new-version=6.0.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
  • Loading branch information
dependabot[bot] committed Sep 3, 2024
1 parent eb549a4 commit 3528a02
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"@npmcli/package-json": "^5.0.0",
"@octokit/rest": "^19.0.4",
"dedent": "^1.5.1",
"diff": "^5.0.0",
"diff": "^6.0.0",
"glob": "^10.1.0",
"handlebars": "^4.7.7",
"hosted-git-info": "^7.0.1",
Expand Down

0 comments on commit 3528a02

Please sign in to comment.