Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
builtin-modules
Advanced tools
A static list of the Node.js builtin modules from the latest Node.js version
The builtin-modules package provides a list of the modules that come pre-packaged with Node.js. These are modules that you can require in your code without needing to install them separately, as they are built into the Node.js runtime. This package is useful for developers who want to ensure they are using only core modules or need to check if a module name corresponds to a built-in module.
List of all builtin modules
This feature allows you to retrieve an array of all the builtin module names in Node.js. The code sample shows how to require the package and log the list of module names to the console.
const builtinModules = require('builtin-modules');
console.log(builtinModules);
List of builtin modules as of a specific Node.js version
This feature provides a list of builtin modules for a specific version of Node.js. The 'static' import gives you a list that corresponds to a particular Node.js release, which is useful when working with environments that may not be up-to-date with the latest Node.js version.
const builtinModules = require('builtin-modules/static');
console.log(builtinModules);
The 'is-core-module' package is similar to 'builtin-modules' in that it allows you to check if a given module name is a Node.js core module. However, instead of providing a list of modules, it offers a function that returns a boolean indicating whether the module is built-in or not. This can be more convenient for certain use cases where you need to check modules on a case-by-case basis.
While 'resolve' is not exclusively focused on built-in modules, it is a package that can resolve the path of a module, including core Node.js modules. It can be used to find the absolute path of a module, which includes checking if a module is a built-in module. This package offers more general module resolution capabilities compared to 'builtin-modules', which is specifically tailored to list Node.js built-in modules.
A static list of the Node.js builtin modules from the latest Node.js version
The list is just a JSON file and can be used anywhere.
npm install builtin-modules
import builtinModules from 'builtin-modules';
console.log(builtinModules);
//=> ['assert', 'buffer', …]
To get a list from the current Node.js version, use the built-in API:
import {builtinModules} from 'node:module';
FAQs
A static list of the Node.js builtin modules from the latest Node.js version
The npm package builtin-modules receives a total of 9,073,101 weekly downloads. As such, builtin-modules popularity was classified as popular.
We found that builtin-modules demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.