{"id":19584783,"url":"https://github.com/flex-development/builtin-modules","last_synced_at":"2026-02-14T08:03:23.959Z","repository":{"id":65556906,"uuid":"594643283","full_name":"flex-development/builtin-modules","owner":"flex-development","description":"Universal drop-in replacement for module.builtinModules","archived":false,"fork":false,"pushed_at":"2024-11-06T19:32:58.000Z","size":3871,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-11-06T20:31:30.510Z","etag":null,"topics":["builtin","builtin-modules","node","nodejs","typescript"],"latest_commit_sha":null,"homepage":"https://github.com/flex-development/builtin-modules","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/flex-development.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":".github/funding.yml","license":"LICENSE.md","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["flex-development"]}},"created_at":"2023-01-29T07:14:03.000Z","updated_at":"2024-11-06T19:31:32.000Z","dependencies_parsed_at":"2024-09-23T23:01:23.245Z","dependency_job_id":"43d0224e-493f-4c3a-ba58-5da7f82d2228","html_url":"https://github.com/flex-development/builtin-modules","commit_stats":{"total_commits":206,"total_committers":2,"mean_commits":103.0,"dds":"0.21359223300970875","last_synced_commit":"d4086414f327190ad667c8524d512fe1244e3dbd"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flex-development%2Fbuiltin-modules","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flex-development%2Fbuiltin-modules/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flex-development%2Fbuiltin-modules/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flex-development%2Fbuiltin-modules/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/flex-development","download_url":"https://codeload.github.com/flex-development/builtin-modules/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224069554,"owners_count":17250454,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["builtin","builtin-modules","node","nodejs","typescript"],"created_at":"2024-11-11T07:49:44.045Z","updated_at":"2026-02-14T08:03:18.941Z","avatar_url":"https://github.com/flex-development.png","language":"JavaScript","funding_links":["https://github.com/sponsors/flex-development"],"categories":[],"sub_categories":[],"readme":"# builtin-modules\n\n[![github release](https://img.shields.io/github/v/release/flex-development/builtin-modules.svg?include_prereleases\\\u0026sort=semver)](https://github.com/flex-development/builtin-modules/releases/latest)\n[![npm](https://img.shields.io/npm/v/@flex-development/builtin-modules.svg)](https://npmjs.com/package/@flex-development/builtin-modules)\n[![codecov](https://codecov.io/github/flex-development/builtin-modules/branch/main/graph/badge.svg?token=Rh9xvcgqdD)](https://codecov.io/github/flex-development/builtin-modules)\n[![module type: esm](https://img.shields.io/badge/module%20type-esm-brightgreen)](https://github.com/voxpelli/badges-cjs-esm)\n[![license](https://img.shields.io/github/license/flex-development/builtin-modules.svg)](LICENSE.md)\n[![conventional commits](https://img.shields.io/badge/-conventional%20commits-fe5196?logo=conventional-commits\\\u0026logoColor=ffffff)](https://conventionalcommits.org)\n[![typescript](https://img.shields.io/badge/-typescript-3178c6?logo=typescript\\\u0026logoColor=ffffff)](https://typescriptlang.org)\n[![vitest](https://img.shields.io/badge/-vitest-6e9f18?style=flat\\\u0026logo=vitest\\\u0026logoColor=ffffff)](https://vitest.dev)\n[![yarn](https://img.shields.io/badge/-yarn-2c8ebb?style=flat\\\u0026logo=yarn\\\u0026logoColor=ffffff)](https://yarnpkg.com)\n\nUniversal drop-in replacement for [`module.builtinModules`][modulebuiltinmodules]\n\n## Contents\n\n- [What is this?](#what-is-this)\n- [When should I use this?](#when-should-i-use-this)\n- [Install](#install)\n- [Use](#use)\n- [API](#api)\n  - [`builtinModules`](#builtinmodules)\n- [Types](#types)\n- [Related](#related)\n- [Contribute](#contribute)\n\n## What is this?\n\nThis package is a universal drop-in replacement for the [`builtinModules`][modulebuiltinmodules] constant exported by\n[`node:module`][node-module].\n\n## When should I use this?\n\nThis package exports an array containing the names of modules provided by Node.js.\nIt can be used to not only verify that a module is maintained by Node.js, but to also determine if a module can be\nimported using a [`node:` URL][node-imports].\n\n## Install\n\nThis package is [ESM only][esm].\n\nIn Node.js (version 18+) with [yarn][]:\n\n```sh\nyarn add @flex-development/builtin-modules\n```\n\n\u003cblockquote\u003e\n  \u003csmall\u003e\n    See \u003ca href='https://yarnpkg.com/protocol/git'\u003eGit - Protocols | Yarn\u003c/a\u003e\n    \u0026nbsp;for details regarding installing from Git.\n  \u003c/small\u003e\n\u003c/blockquote\u003e\n\nIn Deno with [`esm.sh`][esmsh]:\n\n```ts\nimport { builtinModules } from 'https://esm.sh/@flex-development/builtin-modules'\n```\n\nIn browsers with [`esm.sh`][esmsh]:\n\n```html\n\u003cscript type=\"module\"\u003e\n  import { builtinModules } from 'https://esm.sh/@flex-development/builtin-modules'\n\u003c/script\u003e\n```\n\n## Use\n\n```ts\nimport { builtinModules } from '@flex-development/builtin-modules'\n\n/**\n * List of all modules provided by Node.js.\n *\n * \u003e 👉 **Note**: Includes modules available only under the `node:` scheme (i.e.\n * \u003e `node:sea`, `node:sqlite`, `node:test`).\n *\n * @const {string[]} builtins\n */\nconst builtins: string[] = [\n  ...builtinModules,\n  'node:sea',\n  'node:test',\n  'node:sqlite'\n]\n\n/**\n * Set of all modules provided by Node.js.\n *\n * \u003e 👉 **Note**: Includes `node:` URLs.\n *\n * @const {Set\u003cstring\u003e} BUILTIN_MODULES\n */\nconst BUILTIN_MODULES: Set\u003cstring\u003e = new Set(builtins.flatMap(m =\u003e {\n  return m.startsWith('node:') ? [m] : [m, 'node:' + m]\n}).sort((a, b) =\u003e a.localeCompare(b)))\n\n/**\n * Check if `m` references a [builtin module][builtin-module].\n *\n * [builtin-module]: https://nodejs.org/api/esm.html#builtin-modules\n *\n * @example\n *  isBuiltin('@flex-development/builtin-modules') // false\n * @example\n *  isBuiltin('assert') // true\n * @example\n *  isBuiltin('fs/promises') // true\n * @example\n *  isBuiltin(new URL('node:os')) // true\n * @example\n *  isBuiltin('node:module') // true\n * @example\n *  isBuiltin('node:test/reporters') // true\n * @example\n *  isBuiltin('test') // false\n *\n * @param {unknown} m\n *  The thing to check\n * @return {boolean}\n *  `true` if `m` references builtin module, `false` otherwise\n */\nfunction isBuiltin(m: unknown): boolean {\n  return BUILTIN_MODULES.has(String(m))\n}\n\nconsole.log(isBuiltin('@flex-development/builtin-modules'))\nconsole.log(isBuiltin('assert'))\nconsole.log(isBuiltin('fs/promises'))\nconsole.log(isBuiltin('node:module'))\nconsole.log(isBuiltin('node:test/reporters'))\nconsole.log(isBuiltin('test'))\n```\n\n## API\n\nThis package exports the identifier [`builtinModules`](#builtinmodules).\n\nThe default export is also `builtinModules`.\n\n### `builtinModules`\n\nList of all modules provided by Node.js.\n\nThe list is a **superset** of [`module.builtinModules`][modulebuiltinmodules] given the running version of Node.js.\n\n\u003e 👉 **Note**: Modules available only under the `node:` scheme (i.e. `node:sea`, `node:sqlite`, `node:test`) are not\n\u003e listed.\n\n## Types\n\nThis package is fully typed with [TypeScript][].\n\n## Related\n\n- [`is-builtin`][is-builtin] — Universal drop-in replacement for [`module.isBuiltin`][node-module-is-builtin]\n\n## Contribute\n\nSee [`CONTRIBUTING.md`](./CONTRIBUTING.md).\n\nThis project has a [code of conduct](./CODE_OF_CONDUCT.md). By interacting with this repository, organization, or\ncommunity you agree to abide by its terms.\n\n[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c\n\n[esmsh]: https://esm.sh\n\n[is-builtin]: https://github.com/flex-development/is-builtin\n\n[modulebuiltinmodules]: https://nodejs.org/api/module.html#modulebuiltinmodules\n\n[node-imports]: https://nodejs.org/api/esm.html#node-imports\n\n[node-module-is-builtin]: https://nodejs.org/api/module.html#moduleisbuiltinmodulename\n\n[node-module]: https://nodejs.org/api/module.html\n\n[typescript]: https://www.typescriptlang.org\n\n[yarn]: https://yarnpkg.com\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflex-development%2Fbuiltin-modules","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fflex-development%2Fbuiltin-modules","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflex-development%2Fbuiltin-modules/lists"}