Skip to content
This repository has been archived by the owner on Apr 6, 2023. It is now read-only.

fix: improve autoImports deprecation dx #7158

Merged
merged 2 commits into from
Sep 2, 2022
Merged

fix: improve autoImports deprecation dx #7158

merged 2 commits into from
Sep 2, 2022

Conversation

pi0
Copy link
Member

@pi0 pi0 commented Sep 2, 2022

πŸ”— Linked issue

#6864

❓ Type of change

  • πŸ“– Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

This PR tries to reduce breaking change surface and DX with refactor we made in #6864 to rename autoImports to imports and adds some left over refactors.

  • Upgrading unjs/hookable to 5.3:
    • Deprecation warnings with same message are only shown once
    • New hook (name, fn, { allowDeprecated: true } to suppress the warning message
  • Updated kit utils:
    • Soft deprecated (type only) addAutoImport to addImports and addAutoImportDir to addImportsDir for consistency
    • Use autoImport: hook (and suppressed warning) for backward compatibility until new hooks are widely adopted
  • Moved deprecation to the core because it is impossible to use suppress with delayed deprecation
  • Improved deprecation message to advice using @nuxt/kit utils with rc.9 instead of just new hook name.

image

Migration guide for module authors:

  • Update @nuxt/kit dependency to ^3.0.0-rc.9 (this works for users with < rc.9)
  • Use kit utils addImports and addImportsDir instead of directly using hooks

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@netlify
Copy link

netlify bot commented Sep 2, 2022

βœ… Deploy Preview for nuxt3-docs canceled.

Name Link
πŸ”¨ Latest commit a7b2461
πŸ” Latest deploy log https://app.netlify.com/sites/nuxt3-docs/deploys/6311e53e847fe70007aea415

@pi0 pi0 requested a review from antfu September 2, 2022 11:08
@pi0 pi0 added the enhancement New feature or request label Sep 2, 2022
@pi0 pi0 mentioned this pull request Sep 2, 2022
Copy link
Member

@antfu antfu left a comment

Choose a reason for hiding this comment

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

This is nice! Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
3.x enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants