Skip to content

Commit

Permalink
Bump diff from 4.0.2 to 5.0.0 (#191)
Browse files Browse the repository at this point in the history
* Bump diff from 4.0.2 to 5.0.0

Bumps [diff](https://github.com/kpdecker/jsdiff) from 4.0.2 to 5.0.0.
- [Release notes](https://github.com/kpdecker/jsdiff/releases)
- [Changelog](https://github.com/kpdecker/jsdiff/blob/master/release-notes.md)
- [Commits](kpdecker/jsdiff@v4.0.2...v5.0.0)

Signed-off-by: dependabot[bot] <support@github.com>

* fixed tests, the changes to the expected test files' content is minimal
and there is no best solution.

Breaking change is:
kpdecker/jsdiff#217

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Tobias Sorn <tobias.sorn@sap.com>
  • Loading branch information
dependabot[bot] and tobiasso85 committed Apr 1, 2022
1 parent 5ae6904 commit 294c040
Show file tree
Hide file tree
Showing 7 changed files with 251 additions and 225 deletions.
34 changes: 31 additions & 3 deletions npm-shrinkwrap.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -97,7 +97,7 @@
"url": "git@github.com:SAP/ui5-migration.git"
},
"dependencies": {
"diff": "^4.0.2",
"diff": "^5.0.0",
"esprima": "^4.0.1",
"globals": "^13.13.0",
"graceful-fs": "^4.2.9",
Expand Down
11 changes: 7 additions & 4 deletions src/util/whitespace/DiffStringOptimizeStrategy.ts
Expand Up @@ -58,12 +58,12 @@ export class DiffStringOptimizeStrategy implements StringOptimizeStrategy {
aResult.forEach(oChange => {
iIndex = sIgnoreWhitespaceChanges.length;
if (oChange.removed === undefined && oChange.added === undefined) {
// neither added nor removed
// safely apply the changes
sIgnoreWhitespaceChanges += oChange.value;
} else if (oChange.added && oChange.removed === undefined) {
// add non-whitespace changes
if (!StringWhitespaceUtils.isWhitespace(oChange.value)) {
sIgnoreWhitespaceChanges += oChange.value;
} else {
// skip whitespaces
if (StringWhitespaceUtils.isWhitespace(oChange.value)) {
if (this.reporter) {
this.reporter.collect(
"DiffStringOptimizeStrategy.skipped",
Expand All @@ -76,6 +76,9 @@ export class DiffStringOptimizeStrategy implements StringOptimizeStrategy {
)}`
);
}
} else {
// add non-whitespace changes
sIgnoreWhitespaceChanges += oChange.value;
}
} else if (oChange.removed && oChange.added === undefined) {
// add whitespace change if it was removed
Expand Down

0 comments on commit 294c040

Please sign in to comment.