Allow Node.js-like runtimes to identify as Node.js as well. #2357
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.
Previously, in order to only load dependencies which only work on Node.js and fail in non-Node.js environments, we introduced a check which did a string-comparison of
process.release.name
to see if it is wasnode
.This was first introduced in 9c563fa as part of #2054, but has gone on to be useful for other purposes as well.
Some Node.js forks such as NodeSource's N|Solid, which is a fork of Node.js which follows-up each Node.js release with a custom build that includes additional native addons but is otherwise the same, override this value with their own name. This means that N|Source returns
nsolid
, despite the factthat it is almost entirely the same as Node.js.
Luckily, N|Solid leaves the base version of its Node.js in
process.versions.node
(and additionally adds its ownprocess.versions.nsolid
). By relaxing the string comparison onprocess.release.name
, we should still be able to accurately detect the environment we want - which is "Close enough to Node.js!".Fixes #2356