Ref #1476
The issue is that a path command may have multiple arcs, and the space optimization was only applied to the first one. Modified a test to check it.
Co-authored-by: Josep del Río <joseprio@fb.com>
Co-authored-by: Bogdan Chadkin <trysound@yandex.ru>
Changed the TS config file to include all relevant folders and explicitly exclude those files that fail the type checks. In this way new files will be automatically type checked and we can see the list of files that need types improvements.
In this pass I also fixed some js files.
Ref https://github.com/svg/svgo/issues/32
Added `stringifyPathData` utility to produce small as possible path by
- matching leading moveto and line to commands (m -> l, M -> L)
- combining moveto and lineto commands
- avoiding space before decimal numbers if possible
Regexps are quite leaky for complex parsing. Regression tests caught
a few issues related to path parser.
In this diff I implemented the new spec-compliant parser which solves
2 regression cases and covers many edge cases hard to handle with
regexps.