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

add: centralize exports to svgo #2071

Merged
merged 2 commits into from
Sep 7, 2024
Merged

add: centralize exports to svgo #2071

merged 2 commits into from
Sep 7, 2024

Conversation

SethFalco
Copy link
Member

For SVGO v4, we're changed how we handle exports.

We use the exports field in package.json to define the public interface of the package. This enforces boundaries between the intended public API and any internal structures/helpers that we use internally.

https://github.com/svg/svgo/releases/tag/v4.0.0-rc.0

I had omitted most of the exports before, as they were mostly intended for SVGO itself to consume. However, consumers of the library are using these functions while maintaining their custom plugins, so we're changing how they're exported, but the functions will otherwise still be available in v4.

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

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

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

You get the idea, similar to other libraries like React, we're pretty much exporting everything from our top-level namespace, i.e. svgo and svgo/browser.

@SethFalco SethFalco merged commit 97d7d00 into svg:main Sep 7, 2024
12 checks passed
@SethFalco SethFalco deleted the svgo-2030 branch September 7, 2024 18:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant