doesdev / rollup-plugin-analyzer

Mad metrics for your rollup bundles, know all the things
http://rollup-plugin-analyzer.doesdev.com
MIT License
242 stars 4 forks source link

Ensure Rollup 1.0.0 compatibility, deprecate < 0.60.0 #9

Closed doesdev closed 5 years ago

doesdev commented 6 years ago

There appears to have been more plugin API changes since the 0.60.0 release that will go into 1.0.0 as well as deprecation of a couple in use hooks. I think it would be best to try and support 0.60.0 and up, but the plugin should also ensure it's ready for 1.0.0.

jharris4 commented 5 years ago

Hi, the plugin seems to still work now that rollup 1.0.0 has been released, but I'm seeing the following deprecation warnings:

The transformChunk hook used by plugin rollup-plugin-analyzer is deprecated. The renderChunk hook should be used instead. The ongenerate hook used by plugin rollup-plugin-analyzer is deprecated. The generateBundle hook should be used instead.

doesdev commented 5 years ago

Thanks for reporting on that, I had let the 1.0.0 release slip by me. I'll take a look at getting those deprecated options removed from the plugin and report back.

doesdev commented 5 years ago

This isn't going particularly well :/

At present, I'm unable to get the plugin working at all (not at feature parity) with 1.0.0 with the deprecated hooks removed. Hopefully I'm overlooking something. I'll look at it some more tomorrow, but it's failing 70% of the tests at present against 1.0.0, and it only gets worse when I remove the deprecated hooks as it breaks everything below 1.0.0 as well.

jharris4 commented 5 years ago

Sorry to hear that! Anything I can do to help?

doesdev commented 5 years ago

Nothing just yet, I was getting close last night but still missing some key data (dependency relationships). If I can't figure it out locally tonight I may make a separate branch and push which I could use help in. Will let you know how it turns out.

I'm glad to see the 1.0.0 release as that should hopefully signify more API stability for plugins. I'll probably end up adding a compatibility flag so the old versions can be supported as well as the new API basically requires that I change all the details of how I gather and correlate the data. So with a flag the old methods and hooks could still be exposed without prompting deprecation notices.

jharris4 commented 5 years ago

ok, let me know!

the compatibility flag idea sounds smart, although I wonder if it's really worth the effort/complexity as opposed to just releasing a new version that only supports rollup >= 1.0.0 ...

doesdev commented 5 years ago

Alright, the relationship info should be pretty easy to correlate via the resolveId hook. Hopefully I can finish that up tomorrow and get a fully 1.0.0 compatible version pushed out. Perhaps you're right and I should just leave support for previous versions to the last release. I'll think on that one a bit more.

Thanks for all the input, it's helpful not working in a silo so I really appreciate the feedback.

jharris4 commented 5 years ago

Haha, I barely offered any input, but I get what you mean about the silo feeling!

Interesting that you're using a hook that wasn't one of the 2 hooks mentioned in the deprecation warnings. I'm curious to see your solution!

doesdev commented 5 years ago

Turned out I didn't need any extra hooks. I had overlooked the plugin context utilities being available, which allowed me to get everything needed from the generateBundle hook.

Master has all tests passing with 1.0.0 and removes support for anything lower than that. I'm going to ruminate on it a bit more before pushing out the next release. Plan to do that over the weekend.

jharris4 commented 5 years ago

Sounds awesome! I’ll try to take a look over the weekend

doesdev commented 5 years ago

Saw your comments, I did remove it, then added it back. However, I only added it to test that a warning is produced when a rollup version < 1.0.0 is being used. Technically that warning will only work in 0.60.0 and up as the hook I used for that is only available starting in that version.

Anyway, this is published as version 3.0.0. Thanks again for the input, it really is very appreciated.

jharris4 commented 5 years ago

Awesome, thanks for your work on this!