This project provides machine-readable, auto-generated data on support for Web APIs and JavaScript features across non-browser JavaScript runtimes.
The data powers https://runtime-compat.unjs.io/ and is published in the same format is the same as MDN's browser-compat-data
. It is generated using the runtime tests from mdn-bcd-collector
. It includes most runtimes that are members of the WinterCG project.
Currently this tracks the following JavaScript runtimes (shown with their WinterCG runtime key):
- Bun (
bun
) - Deno (
deno
) - Vercel Edge Runtime (
edge-light
) - Fastly JS Compute Runtime (
fastly
) - Amazon Web Services LLRT (
llrt
) - Netlify Edge Functions (
netlify
) - Node.js (
node
) - Wasmer [WinterJS]https://github.com/wasmerio/winterjs) (
wasmer
) - Cloudflare workerd (
workerd
)
The module exports a JSON file, and it can be imported directly using ESM with import assertions, or using a CommonJS require statement. There is also a wrapper for ESM in older versions of Node.js that do not support import assertions.
It is published to npm, but can also be loaded from a CDN.
Install the package:
# npm
npm install runtime-compat-data
# yarn
yarn add runtime-compat-data
# pnpm
pnpm install runtime-compat-data
# bun
bun install runtime-compat-data
// ESM with Import Assertions (Node.js 16+)
import data from "runtime-compat-data" with { type: "json" };
// ...or...
const { default: data } = await import("runtime-compat-data", {
with: { type: "json" },
});
// ...or...
// ESM Wrapper for older Node.js versions (Node.js v12+)
import data from "runtime-compat-data/forLegacyNode";
// ...or...
const { default: data } = await import("runtime-compat-data/forLegacyNode");
// ...or...
// CommonJS Module (Any Node.js)
const data = require("runtime-compat-data");
For Deno or the browser, you can load the data from a CDN:
import data from "https://unpkg.com/runtime-compat-data" with { type: "json" };
// ...or...
const { default: data } = await import(
"https://unpkg.com/runtime-compat-data",
{
with: { type: "json" },
}
);
The data follows the same format as MDN's browser-compat-data
, but only includes the javascript
, webassembly
and api
keys. Instead of the browser keys in MDN's data, this project uses the runtime keys from the WinterCG runtime key proposal where available. The data doesn't currently track versions where the feature was added, and just includes a boolean for whether the feature is supported in the current runtime.
Example data:
{
"__version": {
"__package": "0.0.5",
"bun": "1.0.32",
"deno": "1.41.2",
"edge-light": "2.5.9",
"fastly": "3.11.0",
"llrt": "0.1.11-beta",
"netlify": "17.20.1",
"node": "20.11.1",
"wasmer": "0.4.4",
"workerd": "2024-03-12"
},
"api": {
"URLPattern": {
"__compat": {
"mdn_url": "https://developer.mozilla.org/docs/Web/API/URLPattern",
"source_file": "api/URLPattern.json",
"spec_url": "https://urlpattern.spec.whatwg.org/#urlpattern",
"status": {
"deprecated": false,
"experimental": true,
"standard_track": true
},
"support": {
"bun": { "version_added": false },
"deno": { "version_added": true },
"edge-light": { "version_added": true },
"fastly": { "version_added": false },
"llrt": { "version_added": false },
"netlify": { "version_added": true },
"node": { "version_added": false },
"workerd": { "version_added": true }
}
}
}
}
}
The data is heirarchical, with the feature at the top level and then properties nested below it. Each level has a __compat
key that contains the compatibility data for that item. The support
key in that contains the compatibility data for each runtime.
For example, the TextEncoder
key has this structure:
TextEncoder
__compat
(shows compatibility for the feature itself)TextEncoder
__compat
(shows compatibility for theTextEncoder
object)
encodeInto
__compat
(shows compatibility for theencodeInto
method)
encode
__compat
(shows compatibility for theencode
method)
The data also includes a __version
key, which includes the version numbers for all runtimes, as well as the package itself.