Created
September 10, 2021 08:09
-
-
Save dontcallmedom/4ce7183bd1ac9d6bf79ae11da12f1898 to your computer and use it in GitHub Desktop.
Revisions
-
dontcallmedom created this gist
Sep 10, 2021 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,22 @@ const fs = require("fs").promises; // @@@ download latest tagged version of @webref/idl repo const webrefPath = "../../webref/ed/"; (async function () { const interfaceData = {}; const index = JSON.parse(await fs.readFile(webrefPath + "idlnames.json", "utf-8")); (await Promise.all( Object.entries(index) .sort(([k1, v1], [k2, v2]) => k1.localeCompare(k2)) .map(async ([,{parsed: jsonIdlPath}]) => await fs.readFile(webrefPath + jsonIdlPath, "utf-8")) )).forEach(jsonData => { const jsonIdl = JSON.parse(jsonData); if (jsonIdl.type === "interface" || jsonIdl.type === "interface mixin") { interfaceData[jsonIdl.name] = { inh: jsonIdl.inheritance?.name || "", impl: jsonIdl.includes.map(i => i.name) }; } }); console.log(JSON.stringify(interfaceData, null, 2)); })();