npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

runtime-compat-data

v0.0.5

Published

JavaScript runtime compatibility data

Downloads

25

Readme

runtime-compat-data

npm version npm downloads

This project provides machine-readable data on support for Web APIs and JavaScript features across non-browser JavaScript runtimes. The data format is the same as MDN's browser-compat-data, and it uses the runtime tests from mdn-bcd-collector. It includes most runtimes that are members of the WinterCG project, and can be used to track the goal of improving web-interoperability across different runtimes.

Supported runtimes

Currently this tracks the following JavaScript runtimes (shown with their WinterCG runtime key):

Usage

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.

npm

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" assert { type: "json" };
// ...or...
const { default: data } = await import("runtime-compat-data", {
  assert: { 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");

CDN

For Deno or the browser, you can load the data from a CDN:

import data from "https://unpkg.com/runtime-compat-data" assert { type: "json" };
// ...or...
const { default: data } = await import(
  "https://unpkg.com/runtime-compat-data",
  {
    assert: { type: "json" },
  }
);

Data format

The data follows the same format as MDN's browser-compat-data, but only includes the javascript and api keys. Instead of the browser keys in MDN's data, this project uses the runtime keys from the WinterCG runtime key proposal. 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:

{
  "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 },
          "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 the TextEncoder object)
    • encodeInto
      • __compat (shows compatibility for the encodeInto method)
    • encode
      • __compat (shows compatibility for the encode method)

License

Created by Matt Kane. Includes data from MDN.

Published under the CC0 (no rights reserved).