diff options
author | 2023-10-05 16:03:21 -0700 | |
---|---|---|
committer | 2023-10-05 16:03:21 -0700 | |
commit | 323ae0f2a3977327da55273733f947985eea9b8f (patch) | |
tree | 15e9b00420a01299c6fe6cbd3635f354f7228404 | |
parent | 7ef4cd26ac1e8c3527ff95621497dd77273b299b (diff) | |
download | bun-323ae0f2a3977327da55273733f947985eea9b8f.tar.gz bun-323ae0f2a3977327da55273733f947985eea9b8f.tar.zst bun-323ae0f2a3977327da55273733f947985eea9b8f.zip |
Update Node.js compat docs (#6282)
* Update nodejs-apis
* No commas
* Updates
-rw-r--r-- | docs/runtime/nodejs-apis.md | 38 | ||||
-rw-r--r-- | src/js/node/dns.js | 2 |
2 files changed, 21 insertions, 19 deletions
diff --git a/docs/runtime/nodejs-apis.md b/docs/runtime/nodejs-apis.md index 5c6b858da..f128e0cd2 100644 --- a/docs/runtime/nodejs-apis.md +++ b/docs/runtime/nodejs-apis.md @@ -1,12 +1,12 @@ Bun aims for complete Node.js API compatibility. Most `npm` packages intended for `Node.js` environments will work with Bun out of the box; the best way to know for certain is to try it. -This page is updated regularly to reflect compatibility status of the latest version of Bun. If you run into any bugs with a particular package, please [open an issue](https://bun.sh/issues). Opening issues for compatibility bugs helps us prioritize what to work on next. +This page is updated regularly to reflect compatibility status of the latest version of Bun. The information below reflects Bun's compatibility with _Node.js v20_. If you run into any bugs with a particular package, please [open an issue](https://bun.sh/issues). Opening issues for compatibility bugs helps us prioritize what to work on next. ## Built-in modules ### [`node:assert`](https://nodejs.org/api/assert.html) -🟢 Fully implemented. +🟡 Missing `doesNotMatch` ### [`node:async_hooks`](https://nodejs.org/api/async_hooks.html) @@ -18,7 +18,7 @@ This page is updated regularly to reflect compatibility status of the latest ver ### [`node:child_process`](https://nodejs.org/api/child_process.html) -🟡 Missing `Stream` stdio, `proc.gid`, `proc.uid`. IPC has partial support and only current only works with other `bun` processes. +🟡 Missing `Stream` stdio, `proc.gid` `proc.uid`. IPC has partial support and only current only works with other `bun` processes. ### [`node:cluster`](https://nodejs.org/api/cluster.html) @@ -30,7 +30,9 @@ This page is updated regularly to reflect compatibility status of the latest ver ### [`node:crypto`](https://nodejs.org/api/crypto.html) -🟡 Missing `crypto.Certificate` `crypto.ECDH` `crypto.KeyObject` `crypto.X509Certificate` `crypto.checkPrime{Sync}` `crypto.createPrivateKey` `crypto.createPublicKey` `crypto.createSecretKey` `crypto.diffieHellman` `crypto.generateKey{Sync}` `crypto.generateKeyPair{Sync}` `crypto.generatePrime{Sync}` `crypto.getCipherInfo` `crypto.{get|set}Fips` `crypto.hkdf` `crypto.hkdfSync` `crypto.secureHeapUsed` `crypto.setEngine` `crypto.sign` `crypto.verify`. Some methods are not optimized yet. +🟡 Missing `Certificate` `ECDH` `KeyObject` `X509Certificate` `checkPrime` `checkPrimeSync` `createPrivateKey` `createPublicKey` `createSecretKey` `diffieHellman` `generateKey` `generateKeyPair` `generateKeyPairSync` `generateKeySync` `generatePrime` `generatePrimeSync` `getCipherInfo` `getFips` `hkdf` `hkdfSync` `secureHeapUsed` `setEngine` `setFips` `sign` `verify` + +Some methods are not optimized yet. ### [`node:dgram`](https://nodejs.org/api/dgram.html) @@ -42,19 +44,19 @@ This page is updated regularly to reflect compatibility status of the latest ver ### [`node:dns`](https://nodejs.org/api/dns.html) -🟢 Fully implemented. +🟡 Missing `cancel` `setServers` `getDefaultResultOrder` ### [`node:domain`](https://nodejs.org/api/domain.html) -🟢 Fully implemented. +🟡 Missing `Domain` `active` ### [`node:events`](https://nodejs.org/api/events.html) -🟡 Missing `require('node:events').on`. +🟡 Missing `on` `addAbortListener` `getMaxListeners` ### [`node:fs`](https://nodejs.org/api/fs.html) -🟡 Missing `fs.fdatasync{Sync}` `fs.opendir{Sync}`, `fs.statfs{Sync}`. `fs.promises.open` incorrectly returns a file descriptor instead of a `FileHandle`. +🟡 Missing `Dir` `fdatasync` `fdatasyncSync` `openAsBlob` `opendir` `opendirSync` `statfs` `statfsSync`. `fs.promises.open` incorrectly returns a file descriptor instead of a `FileHandle`. ### [`node:http`](https://nodejs.org/api/http.html) @@ -74,11 +76,11 @@ This page is updated regularly to reflect compatibility status of the latest ver ### [`node:module`](https://nodejs.org/api/module.html) -🟢 Fully implemented. +🟢 Missing `runMain` `syncBuiltinESMExports`, `Module#load()`. Attempts to override or patch the module cache will fail. ### [`node:net`](https://nodejs.org/api/net.html) -🟡 Missing `net.{get|set}DefaultAutoSelectFamily` `net.SocketAddress` `net.BlockList` `net.Server.ref()` `net.Server.unref()` `net.Socket.ref()` `net.Socket.unref()`. +🟡 Missing `BlockList` `SocketAddress` `Stream` `getDefaultAutoSelectFamily` `getDefaultAutoSelectFamilyAttemptTimeout` `setDefaultAutoSelectFamily` `setDefaultAutoSelectFamilyAttemptTimeout` `Server#ref()` `Server#unref()` `Socket#ref()` `Socket#unref()`. ### [`node:os`](https://nodejs.org/api/os.html) @@ -90,7 +92,7 @@ This page is updated regularly to reflect compatibility status of the latest ver ### [`node:perf_hooks`](https://nodejs.org/api/perf_hooks.html) -🟡 Only `perf_hooks.performance.now()` and `perf_hooks.performance.timeOrigin` are implemented. Recommended to use `performance` global instead of `perf_hooks.performance`. +🟡 Only `perf_hooks.performance.now()` and `perf_hooks.performance.timeOrigin` are implemented. Missing `Performance` `PerformanceMark` `PerformanceMeasure` `PerformanceObserverEntryList` `PerformanceResourceTiming` `createHistogram` `monitorEventLoopDelay`. It's recommended to use `performance` global instead of `perf_hooks.performance`. ### [`node:process`](https://nodejs.org/api/process.html) @@ -114,7 +116,7 @@ This page is updated regularly to reflect compatibility status of the latest ver ### [`node:stream`](https://nodejs.org/api/stream.html) -🟢 Fully implemented. +🟡 Missing `getDefaultHighWaterMark` `setDefaultHighWaterMark` ### [`node:string_decoder`](https://nodejs.org/api/string_decoder.html) @@ -142,11 +144,11 @@ This page is updated regularly to reflect compatibility status of the latest ver ### [`node:url`](https://nodejs.org/api/url.html) -🟡 Missing `url.domainTo{ASCII|Unicode}`. Recommended to use `URL` and `URLSearchParams` globals instead. +🟡 Missing `domainToASCII` `domainToUnicode`. It's recommended to use `URL` and `URLSearchParams` globals instead. ### [`node:util`](https://nodejs.org/api/util.html) -🟡 Missing `util.MIMEParams` `util.MIMEType` `util.getSystemErrorMap()` `util.getSystemErrorName()` `util.parseArgs()` `util.stripVTControlCharacters()` `util.transferableAbortController()` `util.transferableAbortSignal()`. +🟡 Missing `MIMEParams` `MIMEType` `aborted` `debug` `getSystemErrorMap` `getSystemErrorName` `parseArgs` `transferableAbortController` `transferableAbortSignal` `stripVTControlCharacters` ### [`node:v8`](https://nodejs.org/api/v8.html) @@ -154,7 +156,7 @@ This page is updated regularly to reflect compatibility status of the latest ver ### [`node:vm`](https://nodejs.org/api/vm.html) -🟡 Core functionality works, but VM modules are not implemented. `ShadowRealm` can be used. +🟡 Core functionality works, but VM modules are not implemented. Missing `createScript`. `ShadowRealm` can be used. ### [`node:wasi`](https://nodejs.org/api/wasi.html) @@ -162,11 +164,11 @@ This page is updated regularly to reflect compatibility status of the latest ver ### [`node:worker_threads`](https://nodejs.org/api/worker_threads.html) -🟡 `Worker` doesn't support the following options: `eval`, `argv`, `execArgv`, `stdin`, `stdout`, `stderr`, `trackedUnmanagedFds`, `resourceLimits`. Missing `markAsUntransferable`, `moveMessagePortToContext`, `getHeapSnapshot`. +🟡 `Worker` doesn't support the following options: `eval` `argv` `execArgv` `stdin` `stdout` `stderr` `trackedUnmanagedFds` `resourceLimits`. Missing `markAsUntransferable` `moveMessagePortToContext` `getHeapSnapshot`. ### [`node:zlib`](https://nodejs.org/api/zlib.html) -🟡 Missing `zlib.brotli*`. Has not been optimized. +🟡 Missing `BrotliCompress` `BrotliDecompress` `brotliCompressSync` `brotliDecompress` `brotliDecompressSync` `createBrotliCompress` `createBrotliDecompress`. Unoptimized. ## Globals @@ -334,7 +336,7 @@ The table below lists all globals implemented by Node.js and Bun's current compa ### [`process`](https://nodejs.org/api/process.html) -🟡 Missing `process.allowedNodeEnvironmentFlags` `process.channel` `process.getActiveResourcesInfo/setActiveResourcesInfo()` `process.setuid/setgid/setegid/seteuid/setgroups()` `process.hasUncaughtExceptionCaptureCallback` `process.initGroups()` `process.report` `process.resourceUsage()`. `process.binding` is partially implemented. +🟡 Missing `domain` `hasUncaughtExceptionCaptureCallback` `initgroups` `report` `resourceUsage` `setUncaughtExceptionCaptureCallback` `setegid` `seteuid` `setgid` `setgroups` `setuid` `allowedNodeEnvironmentFlags` `getActiveResourcesInfo` `setActiveResourcesInfo` `moduleLoadList` `setSourceMapsEnabled` `channel`. `process.binding` is partially implemented. ### [`queueMicrotask()`](https://developer.mozilla.org/en-US/docs/Web/API/queueMicrotask) diff --git a/src/js/node/dns.js b/src/js/node/dns.js index 7e6fc97dd..2dc3895a2 100644 --- a/src/js/node/dns.js +++ b/src/js/node/dns.js @@ -1,5 +1,5 @@ // Hardcoded module "node:dns" -// only resolve4, resolve, lookup, resolve6 and resolveSrv are implemented. +// only resolve4, resolve, lookup, resolve6, resolveSrv, and reverse are implemented. const dns = Bun.dns; function getServers() { |