The onwarn handler is supposed to be passed the warning object as the first argument and the default warning handler as the second argument, so that the custom handler can easily fall back on the default handling when desired. However, this second argument does not seem to be present for the warnings for renamed option deprecations.
According to this line, the second argument is passed in via an arrow function before the onwarn handler is used for deprecations. Can you give a more explicit example where this does not work?
Ah. Actually, it looks like this is only happening with the API - the default onwarn is passed in fine when using the CLI and rollup.config.js.
const { rollup } = require('rollup')
rollup({
entry: './test.js',
onwarn(warning, onwarn) {
console.log(warning, onwarn)
},
})
It's not just deprecation warnings that aren't passed along with a second argument.
I'm not positive that there really is a bug here, just maybe an API nuance. Does is make sense for there to be a default onwarn handler when using Rollup via the API? I'm not sure.
Please, go ahead! 馃憤