Conversation
metcoder95
reviewed
Sep 16, 2025
Comment on lines
+11
to
+21
| function detectRuntimeFeatureByNodeModule (moduleName) { | ||
| try { | ||
| require(moduleName) | ||
| return true | ||
| } catch (err) { | ||
| if (err.code !== 'ERR_UNKNOWN_BUILTIN_MODULE') { | ||
| throw err | ||
| } | ||
| return false | ||
| } | ||
| } |
Member
There was a problem hiding this comment.
Could it be better to return the module itself as well?
Contributor
Author
There was a problem hiding this comment.
I would actually try to avoid to have a second require cache or something like that.
I actually think also about a check for zsdt or maybe markAsClonable.
It could help have us to test branches which are supported by the engine.
Contributor
Author
|
@metcoder95 |
metcoder95
approved these changes
Sep 17, 2025
4 tasks
Merged
slagiewka
pushed a commit
to slagiewka/undici
that referenced
this pull request
Feb 14, 2026
* feat: add runtime feature "detection" * more features
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Basically centralizes the detection of crypto and sqlite. Also I rewrote some code to avoid the loading of crypto and sqlite module to early.
Maybe it makes sense to have some smaller PRs, if you dont think runtimeFeatures instance/class is a good solution. But with runtimeFeatures Instance, we could actually disable specific features and test it.
We could actually also have a little crypto ponyfill
This relates to...
Rationale
Changes
Features
Bug Fixes
Breaking Changes and Deprecations
Status