diff options
author | 2023-07-06 13:02:29 -0700 | |
---|---|---|
committer | 2023-07-06 13:02:29 -0700 | |
commit | 109ebc14fda92bc2c84459b9911bef03b08f1b0a (patch) | |
tree | af707758802715fcb567ac88225e0c23e2974dbd /docs/runtime | |
parent | 95ddfcc4377350b1d604c39c36562bde45fad2a9 (diff) | |
download | bun-109ebc14fda92bc2c84459b9911bef03b08f1b0a.tar.gz bun-109ebc14fda92bc2c84459b9911bef03b08f1b0a.tar.zst bun-109ebc14fda92bc2c84459b9911bef03b08f1b0a.zip |
Various docs updates (#3437)
* Various docs updates
* Add mocks page
* Fix make
* WebKit instructions
* Update instructions
* Updates
* Update nodejs compat table
* Document trusted deps
* Tweak trustedDependencies docs
* Document --exact
* Update test docs
* Tweaks
* Boring
* Remove redundant j
* Undo makefile changes
* Undo makefile changes
* Update page title
* Regen
* Undo changes
Diffstat (limited to '')
-rw-r--r-- | docs/runtime/nodejs-apis.md | 6 | ||||
-rw-r--r-- | docs/runtime/typescript.md | 11 |
2 files changed, 14 insertions, 3 deletions
diff --git a/docs/runtime/nodejs-apis.md b/docs/runtime/nodejs-apis.md index ac42559a0..593954aae 100644 --- a/docs/runtime/nodejs-apis.md +++ b/docs/runtime/nodejs-apis.md @@ -51,7 +51,7 @@ This page is updated regularly to reflect compatibility status of the latest ver - {% anchor id="node_crypto" %} [`node:crypto`](https://nodejs.org/api/crypto.html) {% /anchor %} - 🟡 -- 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.getCurves` `crypto.{get|set}Fips` `crypto.hkdf` `crypto.hkdfSync` `crypto.randomInt` `crypto.secureHeapUsed` `crypto.setEngine` `crypto.sign` `crypto.verify` +- 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.getCurves` `crypto.{get|set}Fips` `crypto.hkdf` `crypto.hkdfSync` `crypto.secureHeapUsed` `crypto.setEngine` `crypto.sign` `crypto.verify` --- @@ -87,7 +87,7 @@ This page is updated regularly to reflect compatibility status of the latest ver - {% anchor id="node_fs" %} [`node:fs`](https://nodejs.org/api/fs.html) {% /anchor %} - 🟡 -- Missing `fs.fdatasync{Sync}` `fs.opendir{Sync}` `fs.readv{Sync}` `fs.{watch|watchFile|unwatchFile}` `fs.writev{Sync}`. +- Missing `fs.fdatasync{Sync}` `fs.opendir{Sync}` `fs.{watchFile|unwatchFile}` `fs.{cp|cpSync}`. --- @@ -558,7 +558,7 @@ The table below lists all globals implemented by Node.js and Bun's current compa - {% anchor id="node_require" %} [`require()`](https://nodejs.org/api/globals.html#require) {% /anchor %} - 🟢 -- Fully implemented. +- Fully implemented, as well as [`require.main`](https://nodejs.org/api/modules.html#requiremain), [`require.cache`](https://nodejs.org/api/modules.html#requirecache), and [`require.resolve`](https://nodejs.org/api/modules.html#requireresolverequest-options) --- diff --git a/docs/runtime/typescript.md b/docs/runtime/typescript.md index d466bb016..b79b1ec6d 100644 --- a/docs/runtime/typescript.md +++ b/docs/runtime/typescript.md @@ -93,6 +93,17 @@ These are the recommended `compilerOptions` for a Bun project. } ``` +### Add DOM types + +Settings `"types": ["bun-types"]` means TypeScript will ignore other global type definitions, including `lib: ["dom"]`. To add DOM types into your project, add the following [triple-slash directives](https://www.typescriptlang.org/docs/handbook/triple-slash-directives.html) at the top of any TypeScript file in your project. + +```ts +/// <reference lib="dom" /> +/// <reference lib="dom.iterable" /> +``` + +The same applies to other global type definition _libs_ like `webworker`. + ## Path mapping When resolving modules, Bun's runtime respects path mappings defined in [`compilerOptions.paths`](https://www.typescriptlang.org/tsconfig#paths) in your `tsconfig.json`. No other runtime does this. |