gulpjs / plugin-error

Error handling for vinyl plugins. Just an abstraction of what's in gulp-util with minor reformatting.
MIT License
19 stars 13 forks source link

fix!: Avoid modifying arguments #21

Closed fasttime closed 2 years ago

fasttime commented 2 years ago

Currently, plugin-error modifies the arguments provided to it (errors or option objects) by adding a plugin property and sometimes a error or message property to them. This is inconvenient because sometimes you would like to reuse an argument later without having it modified after the first usage of plugin-error.

This PR changes the current behavior by ensuring that the argument interpreted as an options object is shallow-cloned before any additional properties are set.

yocontra commented 2 years ago

This seems fine to me - sorry that we were modifying the input object in the first place!

phated commented 2 years ago

Even if this was bad, we need to treat it as a breaking fix because people might be relying on the inappropriate behavior

If we're doing a breaking release, we'll also want to upgrade the repo scaffold.

phated commented 2 years ago

Thanks @fasttime 🎉

fasttime commented 2 years ago

Thanks @yocontra and @phated for reviewing and merging this. Happy I could help!