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

feat(nuxt): add hook debug mode - #7690

Merged
pi0 merged 10 commits into
mainfrom
feat/debug-mode
Oct 15, 2022
Merged

feat(nuxt): add hook debug mode#7690
pi0 merged 10 commits into
mainfrom
feat/debug-mode

Conversation

@danielroe

Copy link
Copy Markdown
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

netlify Bot commented Sep 20, 2022

Copy link
Copy Markdown

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

pi0 commented Sep 20, 2022

Copy link
Copy Markdown
Member

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

danielroe commented Sep 21, 2022

Copy link
Copy Markdown
Member Author

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

pi0 commented Sep 21, 2022

Copy link
Copy Markdown
Member

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

@pi0 pi0 added the pending label Sep 21, 2022
@danielroe

Copy link
Copy Markdown
Member Author

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

@pi0

pi0 commented Oct 13, 2022

Copy link
Copy Markdown
Member

hookable@5.4.0 released

@pi0 pi0 removed the pending label Oct 14, 2022
Comment thread packages/nuxt/src/core/nitro.ts Outdated
@pi0
pi0 merged commit 6dcff8e into main Oct 15, 2022
@pi0
pi0 deleted the feat/debug-mode branch October 15, 2022 10:56
@danielroe

danielroe commented Oct 15, 2022

Copy link
Copy Markdown
Member Author

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