# devtools-protocol [![devtools-protocol on npm](https://img.shields.io/npm/v/devtools-protocol)](https://www.npmjs.com/package/devtools-protocol)

:warning:
This repository is related to Chrome DevTools Protocol, but does not track issues regarding its definition or implementation.
If you want to file an issue for the Chrome DevTools Protocol, please open an issue on https://crbug.com under [`component: Platform>DevTools>Platform`](https://bugs.chromium.org/p/chromium/issues/entry?components=Platform%3EDevTools%3EPlatform).

Use the [protocol viewer](https://chromedevtools.github.io/devtools-protocol/) for navigating the protocol.

TypeScript definitions for the protocol's types are available in ['types/protocol.d.ts'](https://github.com/ChromeDevTools/devtools-protocol/tree/master/types). Mappings from Commands and events to these types are available in either generated `DomainApi` style in [`types/protocol-proxy-api.d.ts`](https://github.com/ChromeDevTools/devtools-protocol/blob/master/types/protocol-proxy-api.d.ts) or in simple name-to-type-interface style in [`types/protocol-mapping.d.ts`](https://github.com/ChromeDevTools/devtools-protocol/blob/master/types/protocol-mapping.d.ts).

Also, this repo is published as the [`devtools-protocol`](https://www.npmjs.com/package/devtools-protocol) npm module.

## Development

The `.pdl` files, the `json/` files and the TypeScript definitions in `types/`
are all generated by [`scripts/update-to-latest.sh`](scripts/update-to-latest.sh),
which runs daily. Do not edit them by hand.

The TypeScript generator itself lives in Chromium, at
[`//third_party/blink/public/devtools_protocol/scripts/protocol_dts_generator.ts`](https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/public/devtools_protocol/scripts/protocol_dts_generator.ts),
so that Chromium and this repo share a single source of truth. It is fetched
into `tmp/chromium/` by the sparse checkout in `update-to-latest.sh`. Changes to
the generator should be made in Chromium.

To regenerate `types/` against an existing local Chromium checkout:

```sh
cd scripts
CHROMIUM_PROTOCOL_SCRIPTS_DIR=/path/to/src/third_party/blink/public/devtools_protocol/scripts \
  npm run build-protocol-dts
```
