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

SVGO v3 #1429

Open
9 of 18 tasks
TrySound opened this issue Mar 15, 2021 · 20 comments
Open
9 of 18 tasks

SVGO v3 #1429

TrySound opened this issue Mar 15, 2021 · 20 comments

Comments

@TrySound
Copy link
Member

TrySound commented Mar 15, 2021

Just a list of possible changes

  • replace JSAPI class with set of utilities
  • drop createContentItem which creates JSAPI instance from public api
  • remove extendDefaultPlugins in favour of "preset-default" plugin
  • accept only visitor plugins
  • replace stable with native sorting which is stable since node v12
  • replace default params object with default params syntax in destructuring
  • enable sortAttrs plugin in default preset
  • replace convertPathData applyTransforms option with applyTransforms plugin
  • throw errors instead of putting into result.error
  • split cdata -> text optimisation from minifyStyles into separate plugin (194058b)
  • drop commonjs support
  • support both es modules and commonjs in loadConfig utility
  • remove global floatPrecision in favour of "preset-default" plugin option
  • merge removeHiddenElems options
  • enable remove-xlink-ns by default ([new plugin] remove-xlink-ns #1535)
  • remove multipass option and make all plugins deterministic and idempotent
  • remove cleanupIds prefix option in favour of prefxIds plugin (ref 'prefix' option of cleanupIDs does not seem to work #595)
  • combine inlineStyles and convertStyleToAttrs into one mature plugin
@TrySound TrySound changed the title SVGO v4 SVGO v3 Mar 15, 2021
@strarsis
Copy link
Contributor

strarsis commented Mar 19, 2021

Would it make sense to add the txml parser PR (#1301) to the milestone, too?

@vanillajonathan
Copy link

Maybe TypeScript?

@TrySound
Copy link
Member Author

Maybe. We already started adding jsdoc for ts.

@TrySound
Copy link
Member Author

Started covering plugins with tsdoc. Quite handy.
#1527

@septs
Copy link

septs commented Aug 15, 2021

Will this project eventually migrate to TypeScript only? or most files?

@TrySound
Copy link
Member Author

Probably no, I'd like to avoid build step. And tsdoc looks like good enough.

@vanillajonathan
Copy link

With tsdoc/esdoc/jsdoc you might want to generate HTML documentation which you can host on GitHub pages.

@oscarotero
Copy link

Typescript or, at least, ES modules would be great. I created a fork to provide support for Deno some time ago (https://github.com/lumeland/svgo) but it's hard to maintain and update every new version. If the SVGO core used ESM it would be much more easy to adapt for Deno.

@TrySound
Copy link
Member Author

Thank you for this! Not sure about timing. Will try to start working on v3 before the end of the year.

@TrySound
Copy link
Member Author

@oscarotero
Copy link

Yes, It's the same entry point that I've used in the Deno fork https://github.com/lumeland/svgo/blob/deno/mod.js
But the browser dist stores the SVG in globalThis (or window), and to use it in Deno it must be imported as module.

@TrySound
Copy link
Member Author

SVGs are not stored in globalThis. Just some dependencies rely on globalThis to cache polyfills.

@oscarotero
Copy link

Sorry, you're right. I didn't know SVGO exports ES modules. Just tested it and seems to work fine. Thanks!

I'd love to have some official Deno support (to take advantage of types for configuration and stuff) but, for now, the browser dist just works.

@vanillajonathan
Copy link

If you decide not to use TypeScript you might be interested to generate TypeScript defintion files (*.d.ts).

https://www.typescriptlang.org/docs/handbook/declaration-files/dts-from-js.html
https://github.com/microsoft/dts-gen

@TrySound
Copy link
Member Author

That's not a problem. I'll publish types when whole project migrate to TSDoc.

@vanillajonathan
Copy link

That's not a problem. I'll publish types when whole project migrate to TSDoc.

Maybe you could generate HTML docs and host it on GitHub Pages then also?

@TrySound
Copy link
Member Author

@vanillajonathan You already wrote about this. Types are not ready yet.

@vanillajonathan
Copy link

I meant when you publish the types and when the project has finished its migration to TSDoc.

@amareshsm
Copy link

Hey @TrySound,
I would like to contribute to replace default params object with default params syntax in destructuring change Can you give some examples for this?

svgo/lib/svgo.js

Lines 16 to 19 in a9834ef

const optimize = (input, config) => {
if (config == null) {
config = {};
}

something like this?

const optimize = (input:string='', config: { [key: string]: string; } | null = null) => { 
  if (config == null) { 
    config = {}; 
  } 

@JoKalliauer
Copy link

svgo v3.0 is released. Is this issue still up to date?

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

7 participants