Earlier quoted context omitted.
I'd say safely merging YAML diffs however could be trouble. I don't know how restricted their YAML subset is, but in my experience it's so loose a format the only way to be sure YAML says what you think it says is to run it through a parser.
I think if you're merging lockfile diffs, you're doing something wrong! Merge the package.json diffs and regenerate the lockfile.
Fortunately as someone else replied, both yarn and npm have safe and easy ways to resolve merge conflicts in their lock files.