Add support for generating custom messages

Summary:
Until now we've generated scaffolding entirely based on the official devtools
protocol spec. This diff adds support for defining custom domains in `custom.json`
which will be merged with the upstream protocol JSON definition.

ChangeLog: [Internal] Add support for Hermes-specific CDP messages

Reviewed By: bestander

Differential Revision: D20754605

fbshipit-source-id: a8075f81816a40114d1a3332192c7aa076b17848
This commit is contained in:
Will Holen
2020-04-20 14:03:25 -07:00
committed by Facebook GitHub Bot
parent 854f63701d
commit 04bc315eba
2 changed files with 13 additions and 1 deletions
@@ -0,0 +1,3 @@
{
"domains": []
}
@@ -24,7 +24,10 @@ import {HeaderWriter} from './HeaderWriter';
import {ImplementationWriter} from './ImplementationWriter';
// $FlowFixMe: this isn't a module, just a JSON file.
const proto = require('devtools-protocol/json/js_protocol.json');
const standard = require('devtools-protocol/json/js_protocol.json');
// $FlowFixMe: this isn't a module, also just a JSON file.
const custom = require('../src/custom.json');
type Descriptor = {|
types: Array<Type>,
@@ -32,6 +35,12 @@ type Descriptor = {|
events: Array<Event>,
|};
function mergeDomains(original, extra) {
return {...original, domains: original.domains.concat(extra.domains)};
}
const proto = mergeDomains(standard, custom);
function parseDomains(
domainObjs: Array<any>,
ignoreExperimental: boolean,