Last active
September 27, 2021 01:52
-
-
Save petamoriken/3802602b8e93d89e5b4c21e36683cadb to your computer and use it in GitHub Desktop.
This file contains 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
import idl from "@webref/idl"; | |
const serializables = []; | |
const transferables = []; | |
const all = await idl.parseAll(); | |
for (const file of Object.values(all)) { | |
for (const obj of file) { | |
if (obj.type !== "interface") { | |
continue; | |
} | |
let name = obj.name; | |
let isSerializable = false; | |
let isTransferable = false; | |
for (const attr of obj.extAttrs) { | |
switch (attr.name) { | |
case "LegacyNamespace": | |
name = `${attr.rhs.value}.${obj.name}`; | |
break; | |
case "Serializable": | |
isSerializable = true; | |
break; | |
case "Transferable": | |
isTransferable = true; | |
break; | |
} | |
} | |
/** @see https://webassembly.github.io/spec/web-api/index.html#serialization */ | |
if (name === "WebAssembly.Module") { | |
isSerializable = true; | |
} | |
if (isSerializable) { | |
serializables.push(name); | |
} | |
if (isTransferable) { | |
transferables.push(name); | |
} | |
} | |
} | |
console.log("## Serializable\n"); | |
for (const name of serializables) { | |
console.log(`* \`${name}\``); | |
} | |
console.log(""); | |
console.log("## Transferable\n"); | |
for (const name of transferables) { | |
console.log(`* \`${name}\``); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Serializable
Blob
File
FileList
CryptoKey
DOMException
FileSystemHandle
FileSystemFileHandle
FileSystemDirectoryHandle
DOMPointReadOnly
DOMPoint
DOMRectReadOnly
DOMRect
DOMQuad
DOMMatrixReadOnly
DOMMatrix
ImageData
ImageBitmap
WebAssembly.Module
AudioData
VideoFrame
GPUCompilationMessage
GPUCompilationInfo
RTCCertificate
Transferable
OffscreenCanvas
ImageBitmap
MessagePort
ReadableStream
WritableStream
TransformStream
AudioData
VideoFrame