Use protocol_dts_generator.ts from Chromium checkout - #361
Merged
OrKoN merged 1 commit intoSep 25, 2026
Merged
Conversation
Chromium has its own copy of this repo's .d.ts generator, at //third_party/blink/public/devtools_protocol/scripts/protocol_dts_generator.ts, which it uses in-tree to produce CDP TypeScript definitions for inspector-protocol tests and for chromium-bidi. Two copies of the same generator will drift apart. Make Chromium the single source of truth and delete the copy here. update-to-latest.sh already sparse-checks out /third_party/blink/public/devtools_protocol/, so the generator arrives with the .pdl files at no extra cost: no new fetch, no new dependency. - Delete scripts/protocol-dts-generator.ts and scripts/protocol-schema.d.ts. - Add scripts/build-protocol-dts.mjs, which locates the generator in the Chromium checkout and runs it. It exits with an actionable message rather than an ENOENT when the checkout is absent, and honours CHROMIUM_PROTOCOL_SCRIPTS_DIR so that anyone with a local Chromium checkout can regenerate types/ without running the full roll script. - Generate the types in update-to-latest.sh directly after convert_protocol_to_json.py, rather than later inside the git diff block. A generator-only change in Chromium, with no .pdl change, therefore now produces a diff and rolls a release. - Point the type-check in scripts/tsconfig.json at the published types/*.d.ts, since the generator it used to check no longer lives here. - Document in README.md that the generator lives in Chromium and that changes to it belong there. Regenerating with the Chromium script produces three differences in types/: the Chromium copyright header, "import Protocol from './protocol.js'" in place of "./protocol", and an additional "export type binary = string". The specifier change was verified against a consumer importing devtools-protocol, devtools-protocol/types/protocol-mapping.js and devtools-protocol/types/protocol-proxy-api.js under moduleResolution node10, node16 and bundler with skipLibCheck disabled; all three resolve ./protocol.js to protocol.d.ts. The remainder of types/ is byte-for-byte unchanged.
Contributor
Author
|
@OrKoN could you please review? This is the follow-up you suggested — the .d.ts generator now lives in Chromium, so this drops the duplicate copy here and reuses it. update-to-latest.sh already sparse-checks out third_party/blink/public/devtools_protocol/, so the generator comes along with the .pdl files at no extra cost. |
Sergei-Rudenkov
force-pushed
the
use-chromium-dts-generator
branch
from
September 23, 2026 15:32
986fff6 to
e667731
Compare
Contributor
|
CC @paulirish, I was you had some changes ready to be merged here. |
Contributor
|
Another thing that we can do is archive this repo and just publish from LUCI, like we plan to do with |
Contributor
This is not strictly necessary so we are not going to do it right now. Maybe later. |
OrKoN
approved these changes
Sep 24, 2026
Lightning00Blade
approved these changes
Sep 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Generate types/ with Chromium's protocol_dts_generator.ts
Chromium has its own copy of this repo's .d.ts generator, at
//third_party/blink/public/devtools_protocol/scripts/protocol_dts_generator.ts,
which it uses in-tree to produce CDP TypeScript definitions for
inspector-protocol tests and for chromium-bidi. Two copies of the same
generator will drift apart.
Make Chromium the single source of truth and delete the copy here.
update-to-latest.sh already sparse-checks out
/third_party/blink/public/devtools_protocol/, so the generator arrives
with the .pdl files at no extra cost: no new fetch, no new dependency.
Chromium checkout and runs it. It exits with an actionable message rather
than an ENOENT when the checkout is absent, and honours
CHROMIUM_PROTOCOL_SCRIPTS_DIR so that anyone with a local Chromium
checkout can regenerate types/ without running the full roll script.
convert_protocol_to_json.py, rather than later inside the git diff block.
A generator-only change in Chromium, with no .pdl change, therefore now
produces a diff and rolls a release.
types/*.d.ts, since the generator it used to check no longer lives here.
changes to it belong there.
Regenerating with the Chromium script produces three differences in types/:
the Chromium copyright header, "import Protocol from './protocol.js'" in
place of "./protocol", and an additional "export type binary = string".
The specifier change was verified against a consumer importing
devtools-protocol, devtools-protocol/types/protocol-mapping.js and
devtools-protocol/types/protocol-proxy-api.js under moduleResolution
node10, node16 and bundler with skipLibCheck disabled; all three resolve
./protocol.js to protocol.d.ts. The remainder of types/ is byte-for-byte
unchanged.