is-bun-module
Is this specifier a Bun core module or supported Node one?
Last updated 2 years ago by sunset_techuila .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install is-bun-module 
SYNC missed versions from official npm registry.

is-bun-module

A utility library to check if a module is a Bun built-in module or a Node.js module implemented in Bun.

API

Module Checking Functions

isBunModule(moduleName, bunVersion?)

Checks if a specifier is a Bun module.

import { isBunModule } from "is-bun-module";
isBunModule("bun"); // true
isBunModule("bun:test", "1.0.0"); // true
isBunModule("notBunModule"); // false

isBunImplementedNodeModule(moduleName, bunVersion?)

Checks if a specifier is a Node module implemented in Bun.

import { isBunImplementedNodeModule } from "is-bun-module";
isBunImplementedNodeModule("fs"); // true
isBunImplementedNodeModule("node:fs"); // true
isBunImplementedNodeModule("node:notNodeModule"); // false
isBunImplementedNodeModule("node:http2", "1.0.0"); // false, added in 1.0.13

isBunBuiltin(moduleName, bunVersion?)

Checks if a specifier is either a Bun module or a Node.js module implemented in Bun.

import { isBunBuiltin } from "is-bun-module";
isBunBuiltin("bun"); // true
isBunBuiltin("fs"); // true
isBunBuiltin("notBunModule"); // false

Module Listing Functions

getBunModules(bunVersion?)

Returns an array of all Bun modules available in the specified version.

import { getBunModules } from "is-bun-module";
getBunModules(); // ["bun", "bun:ffi", ...]
getBunModules("1.0.0"); // Returns modules available in version 1.0.0

getBunImplementedNodeModules(bunVersion?)

Returns an array of all Node.js modules implemented in Bun for the specified version.

import { getBunImplementedNodeModules } from "is-bun-module";
getBunImplementedNodeModules(); // ["fs", "path", ...]
getBunImplementedNodeModules("1.0.0"); // Returns implemented Node.js modules in version 1.0.0

getBunBuiltinModules(bunVersion?)

Returns an array of all builtin modules (both Bun modules and implemented Node.js modules).

import { getBunBuiltinModules } from "is-bun-module";
getBunBuiltinModules(); // ["bun", "bun:ffi", "fs", "path", ...]

Notes

Current Tags

  • 2.0.0                                ...           latest (2 years ago)

7 Versions

  • 2.0.0                                ...           2 years ago
  • 1.3.0                                ...           2 years ago
  • 1.2.1                                ...           2 years ago
  • 1.2.0                                ...           2 years ago
  • 1.1.0                                ...           2 years ago
  • 1.0.2                                ...           2 years ago
  • 1.0.1                                ...           2 years ago
Maintainers (1)
Downloads
Total 19
Today 0
This Week 0
This Month 3
Last Day 0
Last Week 0
Last Month 10
Dependencies (1)
Dev Dependencies (15)

© 2010 - cnpmjs.org x YWFE | Home | YWFE