
Security News
Happy Birthday, Shai-Hulud
It has been one year since Shai-Hulud made its first appearance on npm.
is-core-module
Advanced tools
Is this specifier a node.js core module? Optionally provide a node version to check; defaults to the current node version.
var isCore = require('is-core-module');
var assert = require('assert');
assert(isCore('fs'));
assert(!isCore('butts'));
isCore accepts any string. isCore.Module is the union of every specifier in core.json, regardless of node version, so editors can suggest them.
The types import core.json, so resolveJsonModule, esModuleInterop, and allowSyntheticDefaultImports must be enabled; some module and moduleResolution settings enable them by default, but node16 does not enable resolveJsonModule.
Without them, TypeScript reports an error in this package's index.d.ts, or, with skipLibCheck, isCore.Module silently widens to string | number | symbol.
import isCore = require('is-core-module');
function isBuiltin(specifier: string): boolean {
return isCore(specifier); // any string is accepted
}
const name: isCore.Module = 'node:fs'; // only specifiers listed in `core.json`
isCore(name, '16.0.0'); // true
Clone the repo, npm install, and run npm test
The builtin-modules package provides a list of the Node.js built-in modules. It is similar to is-core-module in that it helps identify core modules, but instead of checking a module name, it provides the full list of built-in modules for direct use.
The resolve package is a more complex module resolution library that can be used to resolve the path of a module like require.resolve does. It can also be used to check if a module is a core module by resolving its path and checking if it is null, which would indicate a core module. It offers more features than is-core-module but can be used for a similar purpose in some cases.
FAQs
Is this specifier a node.js core module?
The npm package is-core-module receives a total of 97,188,061 weekly downloads. As such, is-core-module popularity was classified as popular.
We found that is-core-module 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.

Security News
It has been one year since Shai-Hulud made its first appearance on npm.

Research
/Security News
Operators behind PolinRider used a compromised GitHub account to plant malware in four development versions of a Packagist package with 700,000+ downloads.

Security News
GitHub Actions now supports cache-mode, a least-privilege control on the Actions cache aimed at the cache poisoning technique behind recent compromises.