Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Synchronous mode #1015

Closed
gregberge opened this issue Aug 16, 2018 · 5 comments
Closed

Synchronous mode #1015

gregberge opened this issue Aug 16, 2018 · 5 comments

Comments

@gregberge
Copy link

gregberge commented Aug 16, 2018

I am the author of SVGR, a library to transform SVG into React Components. It offers build in support of SVGO.

SVGR can be run only in asynchronous mode today. But tomorrow we would like to be able to run it synchronously. It opens new possibility, like a Babel plugin for an example.

I would like to know if synchronous mode is an option for SVGO?

@lencioni
Copy link
Contributor

lencioni commented Oct 9, 2019

We are using an older version of svgo that works synchronously in a babel plugin, but we are getting a lot of people asking to update to a newer version because of a CVE (example). We are unable to update because the newer version cannot be used synchronously.

If it is helpful to contextualize this, here's how the babel plugin is currently using svgo: https://github.com/airbnb/babel-plugin-inline-react-svg/blob/759937bed41bd3d594ba2cc511a554e674283c15/src/optimize.js#L55-L70

@GreLI would you be open to exposing a method like optimizeSync from this package?

@ljharb
Copy link

ljharb commented Jan 5, 2020

ping @GreLI

@remy90
Copy link

remy90 commented Nov 6, 2020

I've noticed some issues have auto issue closing bots, so consider this a wordy bump/+1

TrySound added a commit that referenced this issue Feb 14, 2021
Ref #1015

Looks like `sax` is synchronous and we do not need to listen "end"
event. This allows to avoid all callbacks and make `optimize` method
synchronous.
TrySound added a commit that referenced this issue Feb 14, 2021
Ref #1015

Looks like `sax` is synchronous and we do not need to listen "end"
event. This allows to avoid all callbacks and make `optimize` method
synchronous.
@TrySound
Copy link
Member

API is synchronous in v2

@ljharb
Copy link

ljharb commented Feb 17, 2021

@TrySound thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants