kytta/shareon

Refactor URL builder

开放

#61 创建于 2023年7月11日

 (1 条评论) (0 个反应) (0 位负责人)JavaScript (25 个派生)auto 404
enhancementgood first issuehelp wanted

仓库指标

星标
 (477 个星标)
PR 合并指标
 (30 天内没有已合并 PR)

描述

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 and URLSearchParams 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 https://github.com/kytta/shareon/issues/62

贡献者指南