| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
There is no reason for this to be in C++. Using JavaScript means that the code is more accessible to more developers, which is important for any Node.js feature. This also simplifies the code significantly in some areas. On the technical side, this potentially also enables making some of the file system operations that are involved asynchronous.
|
@addaleax thanks much for this awesome work. It seems like the work might overlap a bit with some error improvements I was trying to do in #32052 (which ended up being complicated due to the split logic between js + c++) Would it make sense to fold the logic from my PR into here? |
Sorry, something went wrong.
|
Note: last time we benchmarked this, sync fs ops were significantly faster during resolution. We should benchmark before jumping onto async. |
Sorry, something went wrong.
There was a problem hiding this comment.
Thanks so much for taking this on! I did an initial pass and it LGTM overall.
Sorry, something went wrong.
|
@addaleax This should use primordials and cached builtins. If desired, I can make the changes and push them onto this PR. |
Sorry, something went wrong.
There was a problem hiding this comment.
Sorry only some of these are suggestions; it’s really hard to type them out on mobile :-)
Sorry, something went wrong.
|
@MylesBorins If you want, I can try to integrate your changes – at the moment, I was trying to go for a 1:1 conversion from ESM, but if there’s consensus for further changes, I’m okay with that. |
Sorry, something went wrong.
|
@bmeck I’ve added primordials usage where I could find it – let me know if there’s anything else. (You can feel free to push changes if you think that they make sense, too.) |
Sorry, something went wrong.
There was a problem hiding this comment.
some nits, will need to re-review due to size
Sorry, something went wrong.
|
@addaleax there was consensus on the behavior in the PR I mentioned, just needed work to ensure it covered both CJS + ESM loader. LMK if you prefer I try and add it to this PR and push a commit, since it seems like you have your work cut out for you here |
Sorry, something went wrong.
Yeah, that would be great. To be honest, I’m not clear on the exact semantics here everywhere, although it’s easy enough to translate the code into JS. |
Sorry, something went wrong.
Co-Authored-By: Jordan Harband <ljharb@gmail.com>
Co-Authored-By: Bradley Farias <bradley.meck@gmail.com>
Sorry, something went wrong.
|
CI: https://ci.nodejs.org/job/node-test-pull-request/29786/ (:white_check_mark:) |
Sorry, something went wrong.
| } | ||
| } | ||
|
|
||
| function getPackageConfig(path, base) { |
There was a problem hiding this comment.
It should be possible to update this to be shared with https://github.com/nodejs/node/blob/master/lib/internal/modules/cjs/loader.js#L245 now. That can be a further refactoring certainly, but it's ripe to share the package.json caches and C++ JSON parser code optimized for package.json reading.
Sorry, something went wrong.
There was a problem hiding this comment.
I think I'd like to move that refactoring to a later point. In a similar vein: We could also share the exports logic now!
Sorry, something went wrong.
There is no reason for this to be in C++. Using JavaScript means that the code is more accessible to more developers, which is important for any Node.js feature. This also simplifies the code significantly in some areas. On the technical side, this potentially also enables making some of the file system operations that are involved asynchronous. PR-URL: #32201 Reviewed-By: Bradley Farias <bradley.meck@gmail.com> Reviewed-By: Guy Bedford <guybedford@gmail.com>
There is no reason for this to be in C++. Using JavaScript means that the code is more accessible to more developers, which is important for any Node.js feature. This also simplifies the code significantly in some areas. On the technical side, this potentially also enables making some of the file system operations that are involved asynchronous. PR-URL: #32201 Reviewed-By: Bradley Farias <bradley.meck@gmail.com> Reviewed-By: Guy Bedford <guybedford@gmail.com>
There is no reason for this to be in C++. Using JavaScript means that the code is more accessible to more developers, which is important for any Node.js feature. This also simplifies the code significantly in some areas. On the technical side, this potentially also enables making some of the file system operations that are involved asynchronous. PR-URL: #32201 Reviewed-By: Bradley Farias <bradley.meck@gmail.com> Reviewed-By: Guy Bedford <guybedford@gmail.com>
|
hey @addaleax do you think we should backport this to 12.x? Seems to me like if we don't future module updates will be hard to land. |
Sorry, something went wrong.
There is no reason for this to be in C++. Using JavaScript means that the code is more accessible to more developers, which is important for any Node.js feature. This also simplifies the code significantly in some areas. On the technical side, this potentially also enables making some of the file system operations that are involved asynchronous. PR-URL: nodejs#32201 Reviewed-By: Bradley Farias <bradley.meck@gmail.com> Reviewed-By: Guy Bedford <guybedford@gmail.com>
There is no reason for this to be in C++. Using JavaScript means that the code is more accessible to more developers, which is important for any Node.js feature. This also simplifies the code significantly in some areas. On the technical side, this potentially also enables making some of the file system operations that are involved asynchronous. PR-URL: #32201 Reviewed-By: Bradley Farias <bradley.meck@gmail.com> Reviewed-By: Guy Bedford <guybedford@gmail.com>
| Back | FazBrowse Home | New Git URL |
There is no reason for this to be in C++. Using JavaScript means that
the code is more accessible to more developers, which is important
for any Node.js feature. This also simplifies the code significantly
in some areas. On the technical side, this potentially also enables
making some of the file system operations that are involved
asynchronous.
@nodejs/modules-active-members
Checklist