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

refactor: use named export for schema package #4144

Merged
merged 1 commit into from
Jan 31, 2023

Conversation

rexxars
Copy link
Member

@rexxars rexxars commented Jan 31, 2023

Description

We want to move away from default exports, as they are hard to work with in a dual CommonJS/ESM environment. The schema package currently only exposes the Schema class on the default export. This PR moves the default Schema class export to a named export (Schema), and introduces a "deprecated" class for the default export, which only exists to warn about the deprecated default export.

I decided to warn with a stack trace to make it easier to find where the warning is appearing from.

Notes for release

  • Use named export for the @sanity/schema module - the default export is now deprecated and will give a warning when used

@rexxars rexxars requested a review from bjoerge January 31, 2023 15:56
@vercel
Copy link

vercel bot commented Jan 31, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated
test-studio ✅ Ready (Inspect) Visit Preview 💬 Add your feedback Jan 31, 2023 at 5:20PM (UTC)
1 Ignored Deployment
Name Status Preview Comments Updated
studio-workshop ⬜️ Ignored (Inspect) Jan 31, 2023 at 5:20PM (UTC)

Copy link
Member

@bjoerge bjoerge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯 🙇🏼

@rexxars rexxars force-pushed the refactor/schema-named-export branch from 0a21d76 to 1746698 Compare January 31, 2023 17:13
@rexxars rexxars merged commit 25dcc57 into next Jan 31, 2023
@rexxars rexxars deleted the refactor/schema-named-export branch January 31, 2023 19:48
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.

2 participants