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

Support allowing rewrite_imports to rewrite to URLs #483

Closed
NfNitLoop opened this issue May 7, 2023 · 2 comments
Closed

Support allowing rewrite_imports to rewrite to URLs #483

NfNitLoop opened this issue May 7, 2023 · 2 comments

Comments

@NfNitLoop
Copy link

NfNitLoop commented May 7, 2023

I believe @marekbuild told me to create this issue in slack.

While buf supports a rewrite_imports option, it currently uses the : character to separate the search/replace terms of the rewrite. This means you can't rewrite to a URL, which is what I would like to be able to do in Deno. example code.

Right now, my workaround is to rewrite to a relative import, (which has its own bug), and then import and re-export the library from there.

Possible solutions:

  • Only split on the first :, thus allowing there to be : characters in the replace.
  • Allow escaping : characters. (But this might get a bit ugly because you might end up having to double-escape in yaml?)
@smaye81
Copy link
Member

smaye81 commented May 8, 2023

The rewrite_imports option was actually written with only npm in mind. We don't officially support Deno yet, so that's why this option doesn't support rewriting to a URL.

However, we know this is something that may be required in the future for full Deno support, so we will keep this open. When we address Deno at a later date, we will make sure this is part of the implementation.

@smaye81 smaye81 changed the title rewrite_imports: Please support rewriting to URLs Support allow rewrite_imports to rewrite to URLs May 8, 2023
@smaye81 smaye81 changed the title Support allow rewrite_imports to rewrite to URLs Support allowing rewrite_imports to rewrite to URLs May 8, 2023
@smaye81
Copy link
Member

smaye81 commented May 24, 2023

I am going to merge this one into #293, since that one is that main Deno support PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants