https://github.com/googlechrome/chrome-types
Code to parse Chrome's internal extension type definitions—published on NPM as chrome-types
https://github.com/googlechrome/chrome-types
Last synced: 8 months ago
JSON representation
Code to parse Chrome's internal extension type definitions—published on NPM as chrome-types
- Host: GitHub
- URL: https://github.com/googlechrome/chrome-types
- Owner: GoogleChrome
- License: apache-2.0
- Created: 2020-10-22T03:46:34.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2024-11-19T06:52:11.000Z (about 1 year ago)
- Last Synced: 2024-12-06T20:56:53.978Z (about 1 year ago)
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/chrome-types
- Size: 1.86 MB
- Stars: 200
- Watchers: 19
- Forks: 31
- Open Issues: 41
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# chrome-types
[](https://codecov.io/gh/GoogleChrome/chrome-types)
⚠️ **If you're looking for TypeScript definitions for Chrome's extensions, you should depend on [chrome-types](https://www.npmjs.com/package/chrome-types) in your project.**
This repo contains JS which parses Chrome's internal extension definitions and outputs TypeScript Definition files.
You shouldn't depend on this code: rather, the _generated_ types file is published at [chrome-types](https://www.npmjs.com/package/chrome-types).
Depend on it for your Chrome extensions projects (MV3 and above).
## Design
This repo's design is documented in [the wiki](https://github.com/GoogleChrome/chrome-types/wiki).
Broadly, it reads Chromium's source code to find the internal extensions definitions (in IDL and JSON) and traverses them to generate ".d.ts" files—one for modern extension development (MV3+), and one for all extensions (including the deprecated Platform Apps APIs).
## Deploy
This code is run automatically on a daily basis by GitHub Actions.
It prepares a ".d.ts" file for Chrome's HEAD revision, annotated with information about the public Chrome release API first became available in, and publishes a new version if the output differs from the previous release.
## Usage
This repository is mostly intended as an implementation detail of the https://developer.chrome.com site and for publishing [chrome-types](https://www.npmjs.com/package/chrome-types) on NPM, which happens automaticalty as part of a GitHub Action.
You can run it yourself, but if you're just interested in the generated types, you don't need to.
Run "tools/prepare.js" to generate a bundle of JSON representing Chrome's extensions at a specific release.
You can then pass this bundle to other tools like "tools/render-tsd.js".
See [the wiki](https://github.com/GoogleChrome/chrome-types/wiki) for more.
Running the code requires Node 16+ as well as a working version of Python (3 is preferred, but 2.7+ should work) installed on your system.
This has only been tested on Linux and macOS.
Python is used to convert Chromium's internal IDL format to JSON.