diff --git a/TS.fsx b/TS.fsx index 30d392fd6..75789ee1c 100644 --- a/TS.fsx +++ b/TS.fsx @@ -144,8 +144,19 @@ module InputIdlJson = type InputIdlJsonType = JsonProvider<"inputfiles/sample.webidl.json"> let inputIdl = - File.ReadAllText(GlobalVars.inputFolder + @"/browser.webidl.json") |> InputIdlJsonType.Parse - + let jsons = + DirectoryInfo(GlobalVars.inputFolder + @"/idls").GetFiles() + |> Array.map (fun file -> file.FullName |> File.ReadAllText |> InputIdlJsonType.Parse) + + let inline extractJsonArray f = + jsons |> Array.collect f |> Array.map (fun item -> (^a: (member JsonValue: JsonValue) item)) |> JsonValue.Array; + + let list = [| ("callbackFunctions", extractJsonArray (fun json -> json.CallbackFunctions)); + ("interfaces", extractJsonArray (fun json -> json.Interfaces)); + ("dictionaries", extractJsonArray (fun json -> json.Dictionaries)); + ("typedefs", extractJsonArray (fun json -> json.Typedefs)) |] + InputIdlJsonType.Root(JsonValue.Record list) + let allCallbackFunctionsMap = inputIdl.CallbackFunctions |> toNameMap diff --git a/inputfiles/idls/Encoding.webidl.json b/inputfiles/idls/Encoding.webidl.json new file mode 100644 index 000000000..f573fd6b2 --- /dev/null +++ b/inputfiles/idls/Encoding.webidl.json @@ -0,0 +1,44 @@ +{ + "callbackFunctions": [], "callbackInterfaces": [], "enums": [], "typedefs": [], "namespaces": [], + "dictionaries": [{ + "name": "TextDecodeOptions", + "members": [{ "name": "stream", "type": "boolean", "default": "false" }] + }, { + "name": "TextDecoderOptions", + "members": [ + { "name": "fatal", "type": "boolean", "default": "false" }, + { "name": "ignoreBOM", "type": "boolean", "default": "false" } + ] + }], + "interfaces": [{ + "name": "TextDecoder", + "constructors": [{ + "arguments": [ + { "name": "label", "type": "DOMString", "optional": true, "default": "\"utf-8\"" }, + { "name": "options", "type": "TextDecoderOptions", "optional": true } + ] + }], + "exposed": ["Window", "Worker"], + "operations": [{ + "name": "decode", "type": "USVString", + "arguments": [ + { "name": "input", "type": "BufferSource", "optional": true }, + { "name": "options", "type": "TextDecodeOptions", "optional": true } + ] + }], + "attributes": [ + { "name": "encoding", "type": "DOMString", "readonly": true }, + { "name": "fatal", "type": "boolean", "readonly": true }, + { "name": "ignoreBOM", "type": "boolean", "readonly": true } + ] + }, { + "name": "TextEncoder", + "constructors": [{ "arguments": [] }], + "exposed": ["Window", "Worker"], + "operations": [{ + "name": "encode", "type": "Uint8Array", + "arguments": [{ "name": "input", "type": "USVString", "optional": true, "default": "\"\"" }] + }], + "attributes": [{ "name": "encoding", "type": "DOMString", "readonly": true }] + }] +} \ No newline at end of file diff --git a/inputfiles/browser.webidl.json b/inputfiles/idls/Web IDL.webidl.json similarity index 67% rename from inputfiles/browser.webidl.json rename to inputfiles/idls/Web IDL.webidl.json index c20d4c4c2..b64646e35 100644 --- a/inputfiles/browser.webidl.json +++ b/inputfiles/idls/Web IDL.webidl.json @@ -1,5 +1,5 @@ { - "callbackInterfaces": [], "enums": [], "namespaces": [], + "callbackInterfaces": [], "dictionaries": [], "enums": [], "namespaces": [], "callbackFunctions": [ { "name": "Function", "type": "any", @@ -7,16 +7,6 @@ }, { "name": "VoidFunction", "type": "void", "arguments": [] } ], - "dictionaries": [{ - "name": "TextDecodeOptions", - "members": [{ "name": "stream", "type": "boolean", "default": "false" }] - }, { - "name": "TextDecoderOptions", - "members": [ - { "name": "fatal", "type": "boolean", "default": "false" }, - { "name": "ignoreBOM", "type": "boolean", "default": "false" } - ] - }], "interfaces": [{ "name": "DOMException", "exposed": ["Window", "Worker"], @@ -58,36 +48,6 @@ { "name": "message", "type": "DOMString", "readonly": true }, { "name": "name", "type": "DOMString", "readonly": true } ] - }, { - "name": "TextDecoder", - "constructors": [{ - "arguments": [ - { "name": "label", "type": "DOMString", "optional": true, "default": "\"utf-8\"" }, - { "name": "options", "type": "TextDecoderOptions", "optional": true } - ] - }], - "exposed": ["Window", "Worker"], - "operations": [{ - "name": "decode", "type": "USVString", - "arguments": [ - { "name": "input", "type": "BufferSource", "optional": true }, - { "name": "options", "type": "TextDecodeOptions", "optional": true } - ] - }], - "attributes": [ - { "name": "encoding", "type": "DOMString", "readonly": true }, - { "name": "fatal", "type": "boolean", "readonly": true }, - { "name": "ignoreBOM", "type": "boolean", "readonly": true } - ] - }, { - "name": "TextEncoder", - "constructors": [{ "arguments": [] }], - "exposed": ["Window", "Worker"], - "operations": [{ - "name": "encode", "type": "Uint8Array", - "arguments": [{ "name": "input", "type": "USVString", "optional": true, "default": "\"\"" }] - }], - "attributes": [{ "name": "encoding", "type": "DOMString", "readonly": true }] }], "typedefs": [ { "name": "ArrayBufferView", "type": "(Int8Array or Int16Array or Int32Array or Uint8Array or Uint16Array or Uint32Array or Uint8ClampedArray or Float32Array or Float64Array or DataView)" },