Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow Node.js-like runtimes to identify as Node.js as well. (#2357)
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 was `node`. 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 fact that 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 own `process.versions.nsolid`). By relaxing the string comparison on `process.release.name`, we should still be able to accurately detect the environment we want - which is "Close enough to Node.js!". Fixes #2356
- Loading branch information