ast-metadata-inferer is a JavaScript library designed to provide comprehensive metadata about browser APIs, primarily for static analysis tools. It aggregates crucial information from sources like `@mdn/browser-compat-data`, offering insights into an API's AST node type (e.g., `MemberExpression`, `CallExpression`), whether it's statically invoked, and its classification as a CSS or JS API. The current stable version is 0.8.1. The package maintains a moderately active release cadence, frequently updating dependencies and refining its build processes. Its key differentiators include a curated, programmatically accessible dataset of browser API characteristics combined with detailed compatibility data, making it an invaluable resource for linters, bundlers, and other tools that need to understand browser API usage patterns and compatibility across various environments.
npm install ast-metadata-infererVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to import and access the `AstMetadata` array, which contains detailed information about various browser APIs and their compatibility data.
Ensure your project uses ES Module syntax (`import`) for consuming the library. If using Node.js, ensure your environment supports ESM or use a transpiler like Babel with appropriate configuration for `node_modules`.
Upgrade to version 0.8.1 or later to benefit from fixes addressing proper Puppeteer browser instance closure and forced Node process exits.
Review the structure of the `compat` object in your application after upgrading to versions 0.5.0+. Consult the `@mdn/browser-compat-data` schema for detailed changes if necessary.
Use ES Module import syntax: `import AstMetadata from 'ast-metadata-inferer';`. If you must use CommonJS, ensure your environment handles ESM interoperability or consider dynamic import: `async function load() { const AstMetadata = (await import('ast-metadata-inferer')).default; ... }`Upgrade to `ast-metadata-inferer@0.8.1` or newer. These versions include fixes to ensure all internal resources are properly cleaned up.
Ensure your Node.js project is configured to use ES Modules by adding `"type": "module"` to your `package.json`, and use `import AstMetadata from 'ast-metadata-inferer';`. Alternatively, use dynamic `import()` within an `async` function for CommonJS environments if possible.