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

Migrate to ES modules #83

Closed
neeschit opened this issue Aug 11, 2020 · 10 comments
Closed

Migrate to ES modules #83

neeschit opened this issue Aug 11, 2020 · 10 comments

Comments

@neeschit
Copy link
Contributor

neeschit commented Aug 11, 2020

With node 10 officially entering maintenance mode, There's no good reason for anyone being on a version of node below 10 now. Converting this to use ES modules would be forward looking, and make this module easier to consume for typescript and Node 10+ users who prefer ESM.

While the community TS project is nice, most people would loathe to diverge too far from the officially supported API interface. Switching this module to ESM would be relatively straightforward as well, and I'd be happy to throw out a PR if the community is bought into this. This would allow us to write a good index.d.ts file as well, which will provide great IDE support without a synthetic default export

@neeschit
Copy link
Contributor Author

neeschit commented Nov 8, 2020

@shlomikushchi - curious on your thoughts on this.

@shlomiku
Copy link
Contributor

shlomiku commented Nov 9, 2020

let's talk. can you contact me on the alpaca slack channels?

@anonrose
Copy link

anonrose commented Dec 3, 2020

Hi, is this moving forward? If not I'll be forking and implementing myself.

@neeschit
Copy link
Contributor Author

neeschit commented Dec 4, 2020

btw have you seen this?

https://github.com/117/alpaca

@anonrose
Copy link

anonrose commented Dec 4, 2020

@neeschit I haven't, I'm going to move forward with that. Thank you!

@neeschit
Copy link
Contributor Author

neeschit commented Dec 7, 2020

Out of curiosity, what versions of Node does this library support? @shlomikushchi

@neeschit
Copy link
Contributor Author

neeschit commented Dec 7, 2020

let's talk. can you contact me on the alpaca slack channels?

To summarize what we spoke offline, maintaining backwards compatibility takes priority over migrating to ESM. We will need to publish a hybrid npm package.

The approach I was looking to use is somewhat detailed here:

https://2ality.com/2019/10/hybrid-npm-packages.html#option-2%3A-bare-import-commonjs%2C-deep-import-esm-(maximum-backward-compatibility)

I will try to create a PR when I have time

@shlomiku
Copy link
Contributor

shlomiku commented Dec 8, 2020

@neeschit I am unaware of any limitations right now, but if you are - let me know so we could document it.

@neeschit
Copy link
Contributor Author

neeschit commented Dec 8, 2020

Ok, it would be great if we could limit support to Node 12+ or even better, Node 14+ which is now LTS/Default recommended on https://nodejs.org/en/.

If we are comfortable doing that @shlomikushchi, I can cut a PR to migrate to ES modules, building on the work by @anonrose to tweak the package.json to support both CJS and ESM

@shlomiku
Copy link
Contributor

shlomiku commented Dec 9, 2020

image

node 10 eol is in a few months, so that makes sense moving forward. node 12 has more than a year, so it is better to keep that

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

4 participants