-
-
Notifications
You must be signed in to change notification settings - Fork 7
feat: add support for nitro v3 #8
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
base: main
Are you sure you want to change the base?
Conversation
|
@schplitt is attempting to deploy a commit to the HRCD Projects Team on Vercel. A member of the Team first needs to authorize it. |
|
Thank you for following the naming conventions! 🙏 |
|
@schplitt I don't know if it's better, but I'd prefer to have an entry point that looks more like 'evlog/nitro/v3'. I don't really like having |
Should the 'complete' playground be like v2 or even more extensive? |
Ideally similar, but otherwise just a little less comprehensive is fine with me too. It's just so we can easily launch the app and quickly test that everything works without having to do too much setup. |
|
Alright |
|
Improved the playground to serve a basic UI to visualize the error aswell Also moved nitrov3 to nitro/v3 in dist 🙂 |
|
I noticed that in v3 the error is transformed into an unhandled We would need to overwrite the entire error handler to be able to handle |
I'll try to see how we can do that too |
commit: |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
I am not sure what the future plans for nuxt and evlog are but as nitro will become framework agnostic and interop with vite plugins, maybe it would be a nice Idea to experiment with nitro modules: So that it could also be used with tanstack, etc.? Let me know what your plans are going forward regarding nitro v3 and I'll see how I can help🙂 |
That's exactly the goal, to allow everyone to use evlog on all frameworks (and standalone) that support Nitro and to have the best possible user experience |
Nitro lets the bundler resolve the plugins by using virtual imports. https://github.com/nitrojs/nitro/blob/main/src/build/virtual/plugins.ts |
|
@schplitt Oh, nice! So I think we should implement it like that, and clean up the repo to have a Nitro v2 playground and a Nitro v3 (update the PR with the latest features I added) |
What about your preferred solution for this? |
So I would lean towards "simplicity" and extend HTTPError |
|
I've looked into this a bit. First, we would make Evlog dependend on H3 v2 Second, the |
|
So I've finally had time to fix up the nitro/v3 functionality. Now it uses H3's
When the plugin for Nitro v3 is bundled, it also bundles the reference to WARN Nitro runtime imports detected without a builder or Nitro plugin. A stub implementation will be used.
Actually I think we can just mark
When the Error is logged, it still says 16:42:33.410 ERROR [app] PUT /api/test/update 403 in 261ms
├─ requestId: b191342e-c394-4d2e-a5b3-b35df0574bb2
├─ user: id=999
├─ action: update_item
├─ item: name=My Item version=2.0
├─ validation: checked=true
├─ permissions: checked=true hasUpdate=false requiredRole=admin
└─ error: name=HTTPError message=Update failed stack=HTTPError: Update failed
at createError (file:///home/schplitt/vsc/evlog/packages/evlog/dist/nitro/v3/plugin.mjs:56:10)
at file:///home/schplitt/vsc/evlog/apps/nitro-v3-playground/node_modules/.nitro/dev/index.mjs:819:9Note: In Nitro v3, every Error besides HTTPError is automatically marked as
|


🔗 Linked issue
resolves #7
📚 Description
This PR adds support for early nitro v3 alpha versions under the
evlog/nitrov3scope.Hope that is alright.
I move shared nitro utilities to a seperate file.
I have adjusted the docs aswell to add a note and a playground.
Nitrov3 currently seems to have issues with runtime config support in monorepos but it should work correctly in a new project.
I am not very familiar with bun so I couldn't get the imports from the node_modules to work and used a relative path instead.
For that reason also please check if I integrated it correctly into the build config.
Please see if you would like to have anything changed!
📝 Checklist