geraintluff / uri-templates

JavaScript utility for RFC 6570: URI Templates
138 stars 21 forks source link

Accepting PRs for ESM support? #28

Closed brettz9 closed 8 months ago

brettz9 commented 10 months ago

Would you be open to a PR to add an ESM export (presumably changing source to ESM and then exporting also as UMD)?

geraintluff commented 9 months ago

Is it possible to have the same code work as both (a module, and direct non-module inclusion in the browser)? Or is there an incompatible syntax?

brettz9 commented 9 months ago

They are unfortunately incompatible.

brettz9 commented 9 months ago

The ESM syntax for exporting, e.g.., export default X; or export {x}; do not work for CJS or UMD.

geraintluff commented 9 months ago

Hmm, OK. Perhaps it could be in a separate .mjs file then.

It smells a bit bad to have almost-identical files like that, but I'm unlikely to do much (if any) further development on this library unless there's a major bug, so it's probably not a big deal.

In that case, a PR would be welcome! If you might be interested, I'd be happy to add you as a contributor as well, to streamline any future changes you need.

brettz9 commented 9 months ago

Thanks! I've submitted #29 . It now generates the UMD file from the ESM file, so there is not the code smell I think. And yes, I'd be happy to be added as a contributor (looking to follow whatever procedures you would like for review).

brettz9 commented 8 months ago

Closed by #29.