nodeBuiltins.js 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /*
  2. MIT License http://www.opensource.org/licenses/mit-license.php
  3. Author sheo13666q @sheo13666q
  4. */
  5. "use strict";
  6. // node.js built-in modules externalized by the node/deno/bun target presets.
  7. const builtins = [
  8. "assert",
  9. "assert/strict",
  10. "async_hooks",
  11. "buffer",
  12. "child_process",
  13. "cluster",
  14. "console",
  15. "constants",
  16. "crypto",
  17. "dgram",
  18. "diagnostics_channel",
  19. "dns",
  20. "dns/promises",
  21. "domain",
  22. "events",
  23. "fs",
  24. "fs/promises",
  25. "http",
  26. "http2",
  27. "https",
  28. "inspector",
  29. "inspector/promises",
  30. "module",
  31. "net",
  32. "os",
  33. "path",
  34. "path/posix",
  35. "path/win32",
  36. "perf_hooks",
  37. "process",
  38. "punycode",
  39. "querystring",
  40. "readline",
  41. "readline/promises",
  42. "repl",
  43. "stream",
  44. "stream/consumers",
  45. "stream/promises",
  46. "stream/web",
  47. "string_decoder",
  48. "sys",
  49. "timers",
  50. "timers/promises",
  51. "tls",
  52. "trace_events",
  53. "tty",
  54. "url",
  55. "util",
  56. "util/types",
  57. "v8",
  58. "vm",
  59. "wasi",
  60. "worker_threads",
  61. "zlib",
  62. /^node:/,
  63. // cspell:word pnpapi
  64. // Yarn PnP adds pnpapi as "builtin"
  65. "pnpapi"
  66. ];
  67. // Bare core module names (no `node:` prefix, no regex, no pnpapi), used to
  68. // recognize a request that has a `node:`-prefixed equivalent.
  69. const coreModules = new Set(
  70. builtins.filter(
  71. (builtin) => typeof builtin === "string" && builtin !== "pnpapi"
  72. )
  73. );
  74. module.exports.builtins = builtins;
  75. module.exports.coreModules = coreModules;