builtin-modules
Advanced tools
Comparing version 3.3.0 to 4.0.0
[ | ||
"assert", | ||
"assert/strict", | ||
"async_hooks", | ||
@@ -13,5 +14,7 @@ "buffer", | ||
"dns", | ||
"dns/promises", | ||
"domain", | ||
"events", | ||
"fs", | ||
"fs/promises", | ||
"http", | ||
@@ -21,2 +24,3 @@ "http2", | ||
"inspector", | ||
"inspector/promises", | ||
"module", | ||
@@ -26,2 +30,4 @@ "net", | ||
"path", | ||
"path/posix", | ||
"path/win32", | ||
"perf_hooks", | ||
@@ -32,6 +38,11 @@ "process", | ||
"readline", | ||
"readline/promises", | ||
"repl", | ||
"stream", | ||
"stream/consumers", | ||
"stream/promises", | ||
"stream/web", | ||
"string_decoder", | ||
"timers", | ||
"timers/promises", | ||
"tls", | ||
@@ -42,2 +53,3 @@ "trace_events", | ||
"util", | ||
"util/types", | ||
"v8", | ||
@@ -44,0 +56,0 @@ "vm", |
/** | ||
List of the Node.js builtin modules. | ||
A static list of the Node.js builtin modules from the latest Node.js version. | ||
@example | ||
``` | ||
import builtinModules = require('builtin-modules'); | ||
import builtinModules from 'builtin-modules'; | ||
@@ -14,2 +14,2 @@ console.log(builtinModules); | ||
export = builtinModules; | ||
export default builtinModules; |
12
index.js
@@ -1,11 +0,3 @@ | ||
'use strict'; | ||
const {builtinModules} = require('module'); | ||
import builtinModules from './builtin-modules.json' with {type: 'json'}; | ||
const ignoreList = [ | ||
'sys' | ||
]; | ||
// eslint-disable-next-line node/no-deprecated-api | ||
module.exports = (builtinModules || (process.binding ? Object.keys(process.binding('natives')) : []) || []) | ||
.filter(x => !/^_|^(internal|v8|node-inspect)\/|\//.test(x) && !ignoreList.includes(x)) | ||
.sort(); | ||
export default builtinModules; |
{ | ||
"name": "builtin-modules", | ||
"version": "3.3.0", | ||
"description": "List of the Node.js builtin modules", | ||
"version": "4.0.0", | ||
"description": "A static list of the Node.js builtin modules from the latest Node.js version", | ||
"license": "MIT", | ||
@@ -13,7 +13,14 @@ "repository": "sindresorhus/builtin-modules", | ||
}, | ||
"type": "module", | ||
"exports": { | ||
"types": "./index.d.ts", | ||
"default": "./index.js" | ||
}, | ||
"sideEffects": false, | ||
"engines": { | ||
"node": ">=6" | ||
"node": ">=18.20" | ||
}, | ||
"scripts": { | ||
"test": "xo && ava && tsd", | ||
"//test": "xo && ava && tsd", | ||
"test": "ava && tsd", | ||
"make": "node make.js" | ||
@@ -24,4 +31,2 @@ }, | ||
"index.d.ts", | ||
"static.js", | ||
"static.d.ts", | ||
"builtin-modules.json" | ||
@@ -42,6 +47,6 @@ ], | ||
"devDependencies": { | ||
"ava": "^1.4.1", | ||
"tsd": "^0.7.2", | ||
"xo": "^0.24.0" | ||
"ava": "^6.1.2", | ||
"tsd": "^0.31.0", | ||
"xo": "^0.58.0" | ||
} | ||
} |
# builtin-modules | ||
> List of the Node.js builtin modules | ||
> A static list of the Node.js builtin modules from the latest Node.js version | ||
@@ -9,5 +9,5 @@ The list is just a [JSON file](builtin-modules.json) and can be used anywhere. | ||
```sh | ||
npm install builtin-modules | ||
``` | ||
$ npm install builtin-modules | ||
``` | ||
@@ -17,30 +17,18 @@ ## Usage | ||
```js | ||
const builtinModules = require('builtin-modules'); | ||
import builtinModules from 'builtin-modules'; | ||
console.log(builtinModules); | ||
//=> ['assert', 'buffer', ...] | ||
//=> ['assert', 'buffer', …] | ||
``` | ||
## API | ||
## Tip | ||
Returns an array of builtin modules fetched from the running Node.js version. | ||
To get a list from the current Node.js version, use the built-in API: | ||
### Static list | ||
```js | ||
import {builtinModules} from 'node:module'; | ||
``` | ||
This module also comes bundled with a static array of builtin modules generated from the latest Node.js version. You can get it with `require('builtin-modules/static');` | ||
## Related | ||
- [is-builtin-module](https://github.com/sindresorhus/is-builtin-module) - Check if a string matches the name of a Node.js builtin module | ||
--- | ||
<div align="center"> | ||
<b> | ||
<a href="https://tidelift.com/subscription/pkg/npm-builtin-modules?utm_source=npm-builtin-modules&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a> | ||
</b> | ||
<br> | ||
<sub> | ||
Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies. | ||
</sub> | ||
</div> |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Debug access
Supply chain riskUses debug, reflection and dynamic code execution features.
Found 1 instance in 1 package
1
Yes
3777
6
68
33