[Security Solution] JSON diff view PoC (react-diff-view, DMP-only) #172293
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
It's a modified version of this original PR #172124. The goal is to check how getting rid of one of the diffing libs affect the bundle size.
The original PR adds 107.8KB to bundle size.
The original PR uses both "diff" and "diff-match-patch" libraries for computing the diff, depending on which algorithm is used.
In this PR I tried to use only
diff-match-patch
without usingdiff
.Looks like it's not possible to completely get rid of the
diff
library, because we need to use library calledunidiff
, which listsdiff
as it dependency.unidiff
is used to convert two strings (old and new) to a single "unified diff"-formatted string. Sinceunidiff
usesdiff
under the hood,diff
still gets bundled.I tried relying on
diff-match-patch
methods to produce "unified diff" out of two strings. It didn't work, because the diff format returned bydiff-match-patch
is slightly different from whatunidiff
produces.react-diff-view
supports onlyunidiff
/diff
formatted diff strings.Another version of this PR that uses only
diff
and doesn't usediff-match-match
: #172299