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

Export page utility functions #23521

Open
3 of 4 tasks
BobbieGoede opened this issue Oct 3, 2023 · 5 comments
Open
3 of 4 tasks

Export page utility functions #23521

BobbieGoede opened this issue Oct 3, 2023 · 5 comments

Comments

@BobbieGoede
Copy link
Member

Describe the feature

In @nuxtjs/i18n (v8) we manually sync the implementation of parseSegment and getRoutePath as these are not exported. Not sure if exporting as is, or in @nuxt/kit, or elsewhere would make more sense.

Additional information

  • Would you be willing to help implement this feature?
  • Could this feature be implemented as a module?

Final checks

@danielroe
Copy link
Member

We think it would be good to create a single library we can depend on in Nuxt and in i18n.

If @posva would like to expose it we could depend on it, otherwise I am happy to create a library.

@danielroe danielroe self-assigned this Jan 19, 2024
@posva
Copy link
Collaborator

posva commented Jan 19, 2024

Do you mean the matcher? Or do you have some specific functions in mind? There is already an exposed createMatcher(). It's marked as internal of course as it's not intended for broader usage but it's fine if well-known parts of the ecosystem like Nuxt and i18n use it. A few years ago I started a project to open source the underlying layers of the route parsing but I never made it public 😅

Copy link
Member

I'm meaning a library to convert/parse file system paths into route matching syntax.

@BobbieGoede
Copy link
Member Author

There is already an exposed createMatcher(). It's marked as internal of course as it's not intended for broader usage but it's fine if well-known parts of the ecosystem like Nuxt and i18n use it.

I have been holding off on using this for i18n routing since it was marked internal 😅 .. I'll look into using it.

A few years ago I started a project to open source the underlying layers of the route parsing but I never made it public 😅

I would be interested in this, for i18n routing I keep on wanting to use Vue Router internal utilities like parseURL, parseQuery as well as their stringifying couterparts. We want to match the behaviour of Vue Router, as we internally parse paths and change it a bit to resolve a localized route, especially encoding/decoding paths has been difficult to match, but maybe createRouterMatcher is intended for such use cases.

I'm meaning a library to convert/parse file system paths into route matching syntax.

This would be useful for Nuxt i18n (and other file based i18n routing as well nuxt-modules/i18n#2686 (comment) /cc @kazupon), I don't think https://github.com/posva/unplugin-vue-router exposes this right?

@harlan-zw
Copy link
Contributor

I have also found myself copying these functions in some modules so quite interested in this.

@danielroe danielroe removed the 3.x label Jun 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Discussing
Development

No branches or pull requests

4 participants