svg / svgo

⚙️ Node.js tool for optimizing SVG files
https://svgo.dev/
MIT License
20.77k stars 1.38k forks source link

v4.0 rc - import plugin utils, e.g xast.js #2030

Open vltansky opened 2 months ago

vltansky commented 2 months ago

Hi, i tried to update to v4.0rc version, i have some custom plugins - i'm importing import { querySelector, querySelectorAll } from 'svgo/lib/xast.js'; couldn't find the way in 4.0rc to import it

SethFalco commented 2 months ago

Thanks for trying the release candidate! Helps a lot to get feedback like this before the official release. 🙏🏽

This makes sense. I actually didn't export utilities on purpose to treat them as internal API only, but we can make a few exceptions for instances like these, I overlooked custom plugins.

I'll look into it this week!

By any chance, is your project/plugin open-source or source-accessible? I'm writing draft PRs to help projects migrate to SVGO v4 which gives me more exposure to how it's used and what problems people may encounter. No problem if not, but it could be nice to have the context to help me decide if anything else needs to be adjusted. Otherwise, once v4.0.0-rc.1 is out, just let me know if you have any other issues. 👍🏽

vltansky commented 2 months ago

My project isn't open source, but I can share plugins with you privately for context if you are interested. my mail vl.tansky@gmail.com We also importing types like XastElement, XastRoot, XastChild from svgo/lib/types and import _collections from 'svgo/plugins/_collections';

i actually just migrated our plugins from svgo 2 to 3, so i'll be available during the 4 release candidates iterations so it will be easier for us to migrate :)

SethFalco commented 2 months ago

My project isn't open source, but I can share plugins with you privately for context if you are interested

Normally I'm very open for users to share files with me, (SVGs, SVGO configs, or how they're using SVGO), but in this case we'll set it aside as I don't want me seeing the plugins to impact what I feel I can personally contribute to this repository, or the potential disputes if I ever implement similar ideas.

Thanks for offering, though! <3

i'll be available during the 4 release candidates iterations so it will be easier for us to migrate :)

If you happen to notice any other objects/types from SVGO that you import, feel free to update me. Meanwhile, once v4.0.0-rc.1 is out (this weekend hopefully), you can also just say if you encounter any other problems.

vltansky commented 2 months ago

We actually would be happy to open source plugins, just most of them are very specific for our use cases.