-
-
Notifications
You must be signed in to change notification settings - Fork 93
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
feat: add ESM support for named exports #214
feat: add ESM support for named exports #214
Conversation
Signed-off-by: Jérôme Benoit <[email protected]>
Signed-off-by: Jérôme Benoit <[email protected]>
Signed-off-by: Jérôme Benoit <[email protected]>
I think the CommonJS export for set ops is not correct and will collide with |
@jerome-benoit I like your PR but I will need some kind of proof it does not break backwards compatibility whatsoever. I attempted such a change on another library of mine lately, it broke a lot of things and people were angry at me (which they should not feel entitled to, but this is how the Internet works it seems). What's more, this library is very heavily depended upon. An issue that arised for instance was that the obliterator library is not ESM-first either and that some package managers seem to consider ESM-first as "viral" where all the dependency chain must abide or break. It also broke some older TS for instance.
What do you mean? |
module.exports = {
...
Set: require('./set.js'),
...
} export Set symbol to access the named exports in |
Did you do it as part of a breaking changes version bump with some pre-releases? Testing CommonJS, ESM default exports files will be added in that PR, but I prefer to early show the code to project maintainers. TS tests are overkill. The changes done are the only way to achieve node.js support for CommonJS and ESM without breaking backward compatibility.
Basically mnemonist miss the second point and Anyhow, at some points, you will have to drop support for unsupported node.js version in your librairies and make a major version bump. |
Signed-off-by: Jérôme Benoit <[email protected]>
Hello again @jerome-benoit
Of course. But some people just want to watch the world burn regarding their way to handle version dependencies :). Regarding this PR, this would be part of v0.40.0 of course.
This seems to be an error on my end. The other endpoint correctly exports as lowercased
I am willing to go forward with this, so if you know how to add those tests and are willing to do so, let's proceed? Regarding ESM-first virality, can you confirm that the fact that Regarding the fact that single files will not be able to be imported using ESM, I guess this is not an issue since tree-shaking should now be sufficiently performant (it was not the case when this library was first developped). Which means the documentation will probably need to be updated wrt imports (which is totally fine with me). |
I'm a bit busy lately, but feel free to code on that branch until I'm able to finish the PR.
As long as you do not switch that repo to ESM (
ESM module can consume CommonJS most of the time but some configurations will not work, like enforcing Node16 module resolution. |
Signed-off-by: Jérôme Benoit <[email protected]>
Signed-off-by: Jérôme Benoit <[email protected]>
…nto esm-support
Signed-off-by: Jérôme Benoit <[email protected]>
Signed-off-by: Jérôme Benoit <[email protected]>
Signed-off-by: Jérôme Benoit <[email protected]>
Signed-off-by: Jérôme Benoit <[email protected]>
Signed-off-by: Jérôme Benoit <[email protected]>
Signed-off-by: Jérôme Benoit <[email protected]>
Signed-off-by: Jérôme Benoit <[email protected]>
Signed-off-by: Jérôme Benoit <[email protected]>
Signed-off-by: Jérôme Benoit <[email protected]>
Signed-off-by: Jérôme Benoit <[email protected]>
…nto esm-support
Signed-off-by: Jérôme Benoit <[email protected]>
Signed-off-by: Jérôme Benoit <[email protected]>
@Yomguithereal: The PR is now in mergeable state. The TODO bullet points are targeted to other PRs. |
Signed-off-by: Jérôme Benoit <[email protected]>
closes Yomguithereal#218 Signed-off-by: Jérôme Benoit <[email protected]>
Signed-off-by: Jérôme Benoit <[email protected]>
Signed-off-by: Jérôme Benoit <[email protected]>
Signed-off-by: Jérôme Benoit <[email protected]>
Signed-off-by: Jérôme Benoit <[email protected]>
Signed-off-by: Jérôme Benoit <[email protected]>
Signed-off-by: Jérôme Benoit <[email protected]>
Signed-off-by: Jérôme Benoit <[email protected]>
Signed-off-by: Jérôme Benoit <[email protected]>
Signed-off-by: Jérôme Benoit <[email protected]>
Signed-off-by: Jérôme Benoit <[email protected]>
Signed-off-by: Jérôme Benoit <[email protected]>
Signed-off-by: Jérôme Benoit <[email protected]>
Signed-off-by: Jérôme Benoit <[email protected]>
@Yomguithereal: is it possible to schedule a 0.40.0-0 prerelease with that PR in? |
@jerome-benoit I have committed a merge with current master. Will merge your PR soon and publish a release candidate on npm. Should be in the afternoon, or beginning of next week. |
@jerome-benoit v0.40.0-rc1 is live on npm. I am wondering whether |
Will test it soon to see if now bundlers works as intended in an ESM project with
First I've not commited it. Then I thought having a strict versioning for deps in test would provide better reproducibility. But I do not think minor or patch version only updates done under the hood would harm. Fixing deps for non major version and a testing purpose is debatable anyways. |
Tested successfully on various repos using mnemonist. Maybe you can announce the prerelease on GitHub to give it more visibility and testing before promoting the rc(s) as final. |
Would you do this as a tag+issue? I am not entirely convinced a lot of people use |
An issue? GitHub allows to create a release flagged as a prerelease associated with a git tag. That will work if the repo GitHub actions does not include a releasing workflow based on tag addition since the npm package is already pushed on the registry. I do not know how you add a new release on GitHub, but that's the same except with the prerelease checkbox on.
Sure, but I think having a link to the GitHub prerelease announcement with the changelog will help you to communicate a bit on it. |
ESM import with direct access to CommonJS files is still not supported.
Changelog:
Set
export collisionTODO:
Closes #169
Closes #218