Skip to content

v4.0.0-rc.1

Pre-release
Pre-release
Compare
Choose a tag to compare
@SethFalco SethFalco released this 07 Sep 19:15
· 3 commits to main since this release
97d7d00

Release Candidate

This is a release candidate. We are still working on v4.0.0, and API stability isn't guaranteed, though we'll aim to keep it fairly consistent.

You can try this build by installing or depending on svgo@4.0.0-rc.1, or svgo@rc.

Please report any problems you encounter in the GitHub issue tracker. 👍🏽

Refer to the release notes of previous v4.0.0 release candidates to get the full context, this will only describe the differences since the previous release candidate.

Imports/Exports

We now use the exports field in package.json to define the public interface of the package. However, we received feedback from users who make custom plugins that they depended on some of our other types and helpers.

The types (XastNode, etc.) should've been exported, which has now been resolved.

Some of our functions like querySelector and querySelectorAll were not actually intended to be part of our public API. As our README.md suggests, the API usage primarily entails optimize and loadConfig. However, there are valid use cases for this, so we'll export the ones that are frequently used and continue and ensure backward compatibility to make plugin development easier, and for ease of migration between v3 and v4.

This means users that develop custom plugins will have stronger API guarantees when using querySelector, querySelectorAll, and _collections. However, they should be imported from svgo or svgo/browser now.

- import { querySelector, querySelectorAll } from 'svgo/lib/xast.js';
+ import { querySelector, querySelectorAll } from 'svgo';

- import _collections from 'svgo/plugins/_collections';
+ import { _collections } from 'svgo';

// For TypeScript users!
- import type { XastElement, XastRoot, XastChild } from 'svgo/lib/types';
+ import type { XastElement, XastRoot, XastChild } from 'svgo';