Repository navigation
Conversation
Some core modules introduced in recent Node versions (such as node:sqlite,
node:sea, node:test) are listed in require('module').builtinModules
directly with the 'node:' prefix and lack bare module names.
When checking whether a 'node:'-prefixed module is built-in, check
both the full moduleName and the stripped substring against BUILTIN_MODULES.
Fixes node-red#5991
Signed-off-by: shubhamrai9122-creator <[email protected]>
|
|
Member
|
The unit tests are failing for the code in this area: |
module.builtinModules does not list prefix-only modules such as node:test on Node 22, so use isBuiltin() which handles both forms.
knolleary
approved these changes
Oct 13, 2026
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.
Summary
When checking if a module is a Node.js built-in,
parseModuleNamepreviously stripped thenode:prefix and checkedBUILTIN_MODULES.includes(moduleName.substring(5)).However, core modules introduced in recent Node versions (such as
node:sqlite,node:sea,node:test,node:test/reporters) are listed inrequire('module').builtinModulesdirectly with thenode:prefix and lack bare module aliases. Stripping the prefix causedisBuiltInto evaluate tofalse, causing Node-RED to treat them as external npm packages and fail validation because:is not a valid npm package name character.This change checks both
BUILTIN_MODULES.includes(moduleName)andBUILTIN_MODULES.includes(moduleName.substring(5))when the module starts withnode:.Unit tests have been added to verify that
node:prefixed built-in modules are recognized as built-ins without triggering npm installation or erroring.