-
-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
fix #14: make resolve
synchronous
#15
Conversation
resolve
synchronous
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Gil for working on this! Much appreciated!
Some notes!
Better return value description Co-authored-by: Titus <tituswormer@gmail.com> Signed-off-by: Gil Tayar <gil@tayar.org>
Co-authored-by: Titus <tituswormer@gmail.com> Signed-off-by: Gil Tayar <gil@tayar.org>
Thinking more about https://github.com/wooorm/import-meta-resolve/pull/15/files#r1165850902, how strongly do you feel about releasing this now? Given that: a) this isn’t supported anywhere yet, b) this is a major, c) Node 16 is dropped at the end of the month, we could also wait until April 30, and drop Node 16 too? |
I think you're right and waiting until end of April and dropping support of 16 is a good idea. And maybe release this only when the change really is in Node and we can check the baseline against it. BTW, my guess is that this change to Note that while this is a breaking change, it won't really break any code, given that TL;DR. I suggest we wait for two things:
|
Node 20 is out and |
I implemented (and manually tested on 16, 18, 20) the synchronous baseline test, and added an async one that runs for versions < 20. I changed the action |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really appreciate your continued work Gil! Some tiny nits and then it’s ready I think!
Co-authored-by: Titus <tituswormer@gmail.com> Signed-off-by: Gil Tayar <gil@tayar.org>
Thanks! Are you now going to create a release (I think you should 🙏). I know that @nicolo-ribaudo is waiting to use this version instead of inlining the code (see the issue linked above). I also did the same in the https://github.com/eslint-community/eslint-plugin-n code (this is what brought me here to help here 😁), so I can also now kill the inlining hack there too. |
Yes! Anything else you want to get in the release? |
Thank you both! |
Is there a major need to drop <18 if I can just not upgrade, of course; 2.2.2 works fine, but dropping Node 14/16 before they're EOL seems quite strong! 😄 |
I made a mistake with 16 being EOL, that is supposed to be in a year, but is instead in 6 months. However, Node 14 is EOL this week. That is intentional |
@jakebailey Given that 14 is EOL in 5 days, why do you think this project should support that for the foreseeable future? (reference: https://github.com/nodejs/Release#release-schedule) |
Well, if the current code supports it, I really only meant that Node 14 could be run in CI and probably continue to work until it doesn't. And maybe if it does break, the fix will be small, or if it isn't, then 14 can be dropped. But, it's your library! I'm content just using 2.2.2 which works back to Node 12. Thankfully you aren't using |
The problem for me is that there aren’t really good reasons to switch the code style to depend on a new Node version, for example, But there are good reasons to switch the infra to depend on a new Node version. E.g., Hence why I am currently thinking that the best way to go about it is, if a major is going to happen anyway, to drop support for unmaintained Node versions. And describe that as such. Even if the code might currently work, it allows for future patch/minor releases with new/changed dependencies or more modern syntax that only work in those versions too. Open to ideas! I’ve updated the readme/actions to check Node 16 again, and amended the release notes to specify Node 16 too. |
It's totally fine to drop 14 if you don't want to deal with it. I'm just being a little more conservative for TS given there are always people who can't migrate up. But, realisticaly, those people are probably not running TS 5.x either. Based on the linked thread, seems like babel is dropping it too, though whether or not that's because of the change in this library, I'm unsure. |
Babel already has a build step around this library, so the choice here doesn't really affect our choice. It's possible that we'll keep Node.js 14 compatibility, in which case we'll just transpile usages of JS functions introduced in Node.js 16 to something that works in Node.js 14. |
As described in issue #14,
import.meta.resolve
is becoming synchronous both in the browser and in Node.js:You can see it here: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/import.meta/resolve
And also in Node.js, where a PR just changed it to be synchronous: nodejs/node#44710
This PR makes
resolve
synchronous to fit the above.Note that the baseline test calling
import.meta.resolve
was not changed to be synchronous,because that change will probably be merged into Node v19,
and so for 18
import.meta.resolve
is still synchronous.