https://github.com/amilajack/ast-metadata-inferer
Given a list of API's, return their AST node type
https://github.com/amilajack/ast-metadata-inferer
Last synced: 17 days ago
JSON representation
Given a list of API's, return their AST node type
- Host: GitHub
- URL: https://github.com/amilajack/ast-metadata-inferer
- Owner: amilajack
- Created: 2018-06-15T18:11:20.000Z (almost 7 years ago)
- Default Branch: main
- Last Pushed: 2024-12-11T19:42:44.000Z (4 months ago)
- Last Synced: 2025-03-29T06:01:44.523Z (24 days ago)
- Language: TypeScript
- Homepage:
- Size: 1.44 MB
- Stars: 9
- Watchers: 1
- Forks: 8
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
Awesome Lists containing this project
README
# ast-metadata-inferer
[](https://github.com/amilajack/ast-metadata-inferer/actions/workflows/test.yml)
A collection of metadata about browser API's. This collection is intended for tools that analyze JS. It currently supports more than 6,000 compatibility records.
For all the API's it supports, it gives the
- AST node type of the API (`MemberExpression`, `NewExpression`, or `CallExpression`)
- Determines if an API is statically invoked (ex. `document.querySelector()`)
- Determines if an API is a CSS or JS API
- Provides compatibility information from `@mdn/browser-compat-data`## Usage
```js
import AstMetadata from "ast-metadata-inferer";const [firstRecord] = AstMetadata;
console.log(firstRecord);
// {
// "language":"js-api",
// "protoChain":["document","querySelector"],
// "protoChainId":"document.querySelector",
// "astNodeTypes":["MemberExpression"],
// "isStatic":true,
// "compat": {
// support: {
// chrome: {
// version_added: "14"
// },
// chrome_android: { version_added: "18" },
// ...
// }
// }
// }
```## Related
- [eslint-plugin-compat](https://github.com/amilajack/eslint-plugin-compat)
- [compat-db](https://github.com/amilajack/compat-db)