{"id":11097,"library":"is-bun-module","title":"Bun Module Identifier","description":"is-bun-module is a TypeScript utility library designed to programmatically identify and list modules within the Bun runtime environment. It distinguishes between Bun's native core modules (e.g., `bun:test`) and Node.js built-in modules that Bun has implemented (e.g., `fs`, `path`). The library provides functions to check individual module specifiers as well as retrieve comprehensive lists of all supported modules, optionally filtered by a specific Bun version string (e.g., '1.0.0' or 'latest'). As of version 2.0.0, the package is actively maintained with regular updates to reflect changes in Bun's module landscape, and it ships with full TypeScript type definitions for robust development.","status":"active","version":"2.0.0","language":"javascript","source_language":"en","source_url":"https://github.com/SunsetTechuila/is-bun-module","tags":["javascript","core","modules","module","node","dependencies","bun","typescript"],"install":[{"cmd":"npm install is-bun-module","lang":"bash","label":"npm"},{"cmd":"yarn add is-bun-module","lang":"bash","label":"yarn"},{"cmd":"pnpm add is-bun-module","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Primary function for checking Bun-specific modules. This package is primarily ESM.","wrong":"const isBunModule = require('is-bun-module').isBunModule;","symbol":"isBunModule","correct":"import { isBunModule } from 'is-bun-module';"},{"note":"Checks for Node.js modules implemented by Bun. Renamed from `isSupportedNodeModule` in v2.0.0.","wrong":"import { isSupportedNodeModule } from 'is-bun-module';","symbol":"isBunImplementedNodeModule","correct":"import { isBunImplementedNodeModule } from 'is-bun-module';"},{"note":"Retrieves a combined list of all Bun and Bun-implemented Node.js modules.","wrong":"const getBunBuiltinModules = require('is-bun-module').getBunBuiltinModules;","symbol":"getBunBuiltinModules","correct":"import { getBunBuiltinModules } from 'is-bun-module';"},{"note":"Type definition for Bun version specifiers. Renamed from `Version` to `BunVersion` in v2.0.0.","wrong":"import type { Version } from 'is-bun-module';","symbol":"BunVersion","correct":"import type { BunVersion } from 'is-bun-module';"}],"quickstart":{"code":"import { \n  isBunModule,\n  isBunImplementedNodeModule,\n  getBunBuiltinModules,\n  BunVersion \n} from 'is-bun-module';\n\n// Check specific Bun modules\nconsole.log('Is \"bun\" a Bun module?', isBunModule('bun'));\nconsole.log('Is \"bun:test\" a Bun module (Bun v1.0.0)?', isBunModule('bun:test', '1.0.0' as BunVersion));\nconsole.log('Is \"notBunModule\" a Bun module?', isBunModule('notBunModule'));\n\n// Check Node.js modules implemented in Bun\nconsole.log('Is \"fs\" a Bun-implemented Node module?', isBunImplementedNodeModule('fs'));\nconsole.log('Is \"node:http2\" a Bun-implemented Node module (Bun v1.0.0)?', isBunImplementedNodeModule('node:http2', '1.0.0' as BunVersion));\n\n// Get a list of all builtin modules for the latest Bun version\nconst latestBuiltins = getBunBuiltinModules('latest');\nconsole.log('First 5 builtin modules (latest Bun):', latestBuiltins.slice(0, 5));\n\n// Example with an older Bun version\nconst bunV1_0_0Builtins = getBunBuiltinModules('1.0.0' as BunVersion);\nconsole.log('Number of builtin modules in Bun v1.0.0:', bunV1_0_0Builtins.length);\n\n// Type assertion for clarity when passing string literals as BunVersion\nconst currentBunVersion: BunVersion = '1.0.13';\nconsole.log(`Checking 'crypto' against Bun ${currentBunVersion}:`, isBunImplementedNodeModule('crypto', currentBunVersion));","lang":"typescript","description":"Demonstrates how to use `isBunModule`, `isBunImplementedNodeModule`, and `getBunBuiltinModules` to identify and list modules, including specifying Bun versions."},"warnings":[{"fix":"Update all calls from `isSupportedNodeModule` to `isBunImplementedNodeModule`.","message":"The function `isSupportedNodeModule` was renamed to `isBunImplementedNodeModule`.","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Change all type references from `Version` to `BunVersion`.","message":"The TypeScript type `Version` was renamed to `BunVersion` to avoid naming conflicts and improve clarity.","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Ensure your Bun environment is at least v1.0.0. When querying for module support, pass the exact `bunVersion` string matching your target Bun runtime for accurate results.","message":"This library explicitly supports Bun v1.0.0 and newer. Using it with older Bun versions or expecting support for modules not yet implemented in v1.0.0+ may lead to unexpected results.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Always pass a valid semantic version string or 'latest' to the `bunVersion` parameter.","message":"The `bunVersion` parameter accepts semantic version strings (e.g., '1.0.0', '1.0.13') or the literal string 'latest'. Providing an invalid format will result in unpredictable behavior.","severity":"gotcha","affected_versions":">=1.2.0"}],"env_vars":null,"last_verified":"2026-04-19T00:00:00.000Z","next_check":"2026-07-18T00:00:00.000Z","problems":[{"fix":"Rename `isSupportedNodeModule` to `isBunImplementedNodeModule`.","cause":"Attempting to use the old function name `isSupportedNodeModule` after upgrading to v2.0.0 or higher.","error":"TypeError: isSupportedNodeModule is not a function"},{"fix":"Use ES module import syntax: `import { functionName } from 'is-bun-module';`.","cause":"This package is distributed as an ES Module (ESM). Using CommonJS `require()` syntax in an ESM context (e.g., a `.js` file with `\"type\": \"module\"` or a `.mjs` file) will fail.","error":"ReferenceError: require is not defined"},{"fix":"Update the type import from `import type { Version }` to `import type { BunVersion }`.","cause":"Attempting to import the `Version` type after upgrading to v2.0.0 or higher.","error":"TypeError: Module 'is-bun-module' has no exported member 'Version'"}],"ecosystem":"npm"}