picotool icon indicating copy to clipboard operation
picotool copied to clipboard

Plugin support for tools

Open dansanderson opened this issue 7 years ago • 2 comments

The Python libraries are useful for building new tools, but there's currently no good way to extend the behavior of an existing tool without copy-pasting code. There might be opportunities for plugin-like extensions. For example, luafmt/luamin could be given the path to a LuaWriter class that is run in place of the usual writer or in addition as a post-processor.

Feedback welcome on what kinds of plugin APIs would be useful.

dansanderson avatar Feb 22 '17 08:02 dansanderson

Hi Dan,

I would be very interested in this.

I've just tried your luamin tool as my PICO-8 game/engine has blown the compressed count, even though I'm only just over half the token limit! 😕

However, as I plan for my "engine" code to be included in others' carts, I need to "EXCLUDE" (read:most) function names and global variables from minifying. Anything private to functions is all good.

So, unless that sounds like a feature ("minifying scope level") that you plan to implement - I guess a plug-in architecture should allow me to write some kind of custom exclusions list, so that I could re-run luamin from the original source and for the final output to maintain "public" compatibility (just with MUCH less footprint)?

Thx

Liquidream avatar Mar 08 '17 06:03 Liquidream

That's a good idea. Many minifiers have an "externs" list for this purpose. This would be easy to implement in the core tool.

dansanderson avatar Mar 08 '17 16:03 dansanderson