Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump diff from 4.0.2 to 5.0.0 #191

Merged
merged 4 commits into from Apr 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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