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

feat: type nitro app runtime hooks #1316

Merged
merged 4 commits into from
Jun 18, 2023
Merged

feat: type nitro app runtime hooks #1316

merged 4 commits into from
Jun 18, 2023

Conversation

danielroe
Copy link
Member

πŸ”— Linked issue

nuxt/nuxt#21593 (comment)

❓ 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)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

This addresses a TODO comment to allow nitroApp hooks to be typed (and extended via module augmentation).

πŸ“ Checklist

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

@danielroe danielroe added the bug Something isn't working label Jun 17, 2023
@danielroe danielroe requested a review from pi0 June 17, 2023 07:31
@danielroe danielroe self-assigned this Jun 17, 2023
@codecov
Copy link

codecov bot commented Jun 17, 2023

Codecov Report

Merging #1316 (e0e47d6) into main (88b4e11) will increase coverage by 0.03%.
The diff coverage is 100.00%.

❗ Current head e0e47d6 differs from pull request most recent head 18d12a9. Consider uploading reports for the commit 18d12a9 to get more accurate results

@@            Coverage Diff             @@
##             main    #1316      +/-   ##
==========================================
+ Coverage   77.00%   77.03%   +0.03%     
==========================================
  Files          68       68              
  Lines        6848     6859      +11     
  Branches      686      686              
==========================================
+ Hits         5273     5284      +11     
  Misses       1574     1574              
  Partials        1        1              
Impacted Files Coverage Ξ”
src/runtime/types.ts 100.00% <100.00%> (ΓΈ)

@@ -16,3 +19,11 @@ declare module "h3" {
$fetch: typeof globalThis.fetch;
}
}

export interface RuntimeNitroHooks {
"render:response": (
Copy link
Contributor

Choose a reason for hiding this comment

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

There's "render:html" too right ?

Copy link
Member Author

Choose a reason for hiding this comment

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

Quite right! But that is Nuxt-specific and so Nuxt would augment this interface with that hook, as well as the island render hook.

https://github.com/nuxt/nuxt/blob/71ef8bd3ff207fd51c2ca18d5a8c7140476780c7/packages/nuxt/src/core/runtime/nitro/renderer.ts#L228

@pi0 pi0 changed the title fix: type nitro runtime hooks feat: type nitro app runtime hooks Jun 18, 2023
Copy link
Member

@pi0 pi0 left a comment

Choose a reason for hiding this comment

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

πŸ‘πŸΌ

@pi0 pi0 merged commit 3c446ad into main Jun 18, 2023
@pi0 pi0 deleted the feat/typed-runtime-hooks branch June 18, 2023 10:18
@danielroe
Copy link
Member Author

Just FYI, I picked previous interface name to align with Nuxt's RuntimeNuxtHooks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants