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

feat(nuxt): add hook debug mode #7690

Merged
merged 10 commits into from Oct 15, 2022
Merged

feat(nuxt): add hook debug mode #7690

merged 10 commits into from Oct 15, 2022

Conversation

danielroe
Copy link
Member

πŸ”— Linked issue

resolves nuxt/nuxt#13509

❓ 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 adds support for debug: true in your nuxt config (disabled by default). At the moment, it prints out hook names and timings on the server, and logs hook arguments as well in the browser.

Example output

Server

[nuxt] app:created: 2.109ms
[nuxt] vue:setup: 0.035ms
[nuxt] app:rendered: 0.019ms
[nitro] render:html: 0.048ms
[nitro] render:response: 0.01ms

Client

CleanShot 2022-09-20 at 16 33 23

πŸ“ Checklist

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

@danielroe danielroe added enhancement New feature or request 🍰 p2-nice-to-have Priority 2: nothing is broken but it's worth addressing labels Sep 20, 2022
@danielroe danielroe requested a review from pi0 September 20, 2022 15:36
@danielroe danielroe self-assigned this Sep 20, 2022
@netlify
Copy link

netlify bot commented Sep 20, 2022

βœ… Deploy Preview for nuxt3-docs ready!

Name Link
πŸ”¨ Latest commit 4a1759b
πŸ” Latest deploy log https://app.netlify.com/sites/nuxt3-docs/deploys/634a90a88c8f1d000850b038
😎 Deploy Preview https://deploy-preview-7690--nuxt3-docs.netlify.app
πŸ“± Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@pi0
Copy link
Member

pi0 commented Sep 20, 2022

This is a nice improvement but what do you think if we directly add hookable.setupDebugger(hooks, { tag })? We have at least 4 hookable namespace now (nuxt build, nuxt app, nitro build and nitro app). It can consistently add feature.

@danielroe
Copy link
Member Author

danielroe commented Sep 21, 2022

I like the idea. What do you think about enabling a custom handler as well (or 'presets')? I think it's nicer to have a browser API with collapsed/grouped logs and also allow logging all args, which would be unfeasibly verbose in the terminal.

@pi0 pi0 mentioned this pull request Sep 21, 2022
@pi0
Copy link
Member

pi0 commented Sep 21, 2022

Makes sense to inspect only for browser. Moved to #unjs/hookable#50.

@pi0 pi0 added the pending label Sep 21, 2022
@danielroe
Copy link
Member Author

Are we waiting for anything in unjs/hookable#51?

@pi0
Copy link
Member

pi0 commented Oct 13, 2022

hookable@5.4.0 released

@pi0 pi0 removed the pending label Oct 14, 2022
@pi0 pi0 merged commit 6dcff8e into main Oct 15, 2022
@pi0 pi0 deleted the feat/debug-mode branch October 15, 2022 10:56
@danielroe
Copy link
Member Author

danielroe commented Oct 15, 2022

I had some other changes I was going to make when hookable was released. Will check later.

edit - all good

@pi0 pi0 mentioned this pull request Oct 18, 2022
@danielroe danielroe added the 3.x label Jan 19, 2023
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 🍰 p2-nice-to-have Priority 2: nothing is broken but it's worth addressing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

debug hooks
2 participants