@webref/idl (original) (raw)

3.62.0 • Public • Published 4 days ago

Web IDL definitions of the web platform

This package contains Web IDL scraped from the latest versions of web platform specifications in webref, with fixes applied to ensure all definitions can be parsed and are internally consistent.

API

The async listAll() method resolves with an object where the keys are spec shortnames, and the values are objects with async text() and parse() methods to get the raw text and the result of parsing that with WebIDL2.parse, respectively. Example:

const idl = require('@webref/idl');

const files = await idl.listAll(); for (const [shortname, file] of Object.entries(files)) { const text = await file.text(); const ast = await file.parse(); // do something with text or ast }

As a shorthand, the async parseAll() method resolves with an object where the keys are spec shortnames and the values are the result of parsing the IDL with WebIDL2.parse. Example:

const idl = require('@webref/idl');

const parsedFiles = await idl.parseAll(); for (const [shortname, ast] of Object.entries(parsedFiles)) { // do something with the ast }

Guarantees

The following guarantees are provided by this package:

The following guarantees are not provided: