Refactor URL builder #61
Labels
enhancement
New feature or request
good first issue
Good for newcomers
help wanted
Extra attention is needed
As discovered while trying to implement a new parameter, our URL building is not ideal. In this particular case, we URL-encode stuff twice: when we pass parameters to the builder and then in the builders themselves.
Most share pages use URL parameters, so wouldn't it be better for each social network to only define its main URL along with the needed parameters? Then, we can take the built-in
URL
andURLSearchParams
to build the final URL.A while ago, Dario did a similar thing, also adding a lot of other stuff. Since then, Shareon lost TypeScript, switched bundlers, heck, even the default branch is different. It might make more sense to re-implement this.
It is very important that the final size remains as small as possible, ideally under 1 kB for the ESM bundle. Use
pnpm test
to build and test for size. See also #62The text was updated successfully, but these errors were encountered: