Open TrySound opened 3 years ago
Would it make sense to add the txml parser PR (https://github.com/svg/svgo/pull/1301) to the milestone, too?
Maybe TypeScript?
Maybe. We already started adding jsdoc for ts.
Started covering plugins with tsdoc. Quite handy. https://github.com/svg/svgo/pull/1527
Will this project eventually migrate to TypeScript only? or most files?
Probably no, I'd like to avoid build step. And tsdoc looks like good enough.
With tsdoc/esdoc/jsdoc you might want to generate HTML documentation which you can host on GitHub pages.
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.
Thank you for this! Not sure about timing. Will try to start working on v3 before the end of the year.
Btw @oscarotero svgo provides esm module for browsers https://unpkg.com/browse/svgo@2.7.0/dist/svgo.browser.js
The entry point is this module https://github.com/svg/svgo/blob/master/lib/svgo.js
Instead of https://github.com/svg/svgo/blob/master/lib/svgo-node.js used for node.
Can this help with deno?
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.
SVGs are not stored in globalThis. Just some dependencies rely on globalThis to cache polyfills.
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.
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
That's not a problem. I'll publish types when whole project migrate to TSDoc.
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?
@vanillajonathan You already wrote about this. Types are not ready yet.
I meant when you publish the types and when the project has finished its migration to TSDoc.
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?
https://github.com/svg/svgo/blob/a9834efa1603198ae606765292215462ae193d0d/lib/svgo.js#L16-L19
something like this?
const optimize = (input:string='', config: { [key: string]: string; } | null = null) => {
if (config == null) {
config = {};
}
svgo v3.0 is released. Is this issue still up to date?
Just a list of possible changes
drop commonjs supportenable remove-xlink-ns by default (https://github.com/svg/svgo/pull/1535)