Options
All
  • Public
  • Public/Protected
  • All
Menu

wasup

Index

Enumerations

Classes

Interfaces

Type aliases

Variables

Functions

Type aliases

BlockType

BlockType: { valueType: ValueBlockType } | { typeIndex: number }

CodeSection

CodeSection: Section<10, Code>

Data

Data: { bytes: Uint8Array; id: 0; offsetExpr: Expr } | { bytes: Uint8Array; id: 1 } | { bytes: Uint8Array; id: 2; memoryIndex: number; offsetExpr: Expr }

DataSection

DataSection: Section<11, Data>

Element

Element: { functionIds: FuncId[]; id: 0; offsetExpr: Expr } | { functionIds: FuncId[]; id: 1; kind: ElementKind } | { functionIds: FuncId[]; id: 2; kind: ElementKind; offsetExpr: Expr; tableIndex: number } | { functionIds: FuncId[]; id: 3; kind: ElementKind } | { id: 4; initExprs: Expr[]; offsetExpr: Expr } | { id: 5; initExprs: Expr[]; refType: RefType } | { id: 6; initExprs: Expr[]; offsetExpr: Expr; refType: RefType; tableIndex: number } | { id: 7; initExprs: Expr[]; refType: RefType }

ElementSection

ElementSection: Section<9, Element>

ExportSection

ExportSection: Section<7, Export>

Expr

Expr: Instruction[]

FuncId

FuncId: number

FunctionSection

FunctionSection: Section<3, number>

GlobalSection

GlobalSection: Section<6, Global>

ImportSection

ImportSection: Section<2, Import>

Instruction

Instruction: [Unreachable] | [Nop] | [Return] | [RefIsNull] | [Drop] | [Select] | [I32EqZ] | [I32Eq] | [I32Ne] | [I32LtS] | [I32LtU] | [I32GtS] | [I32GtU] | [I32LeS] | [I32LeU] | [I32GeS] | [I32GeU] | [I64EqZ] | [I64Eq] | [I64Ne] | [I64LtS] | [I64LtU] | [I64GtS] | [I64GtU] | [I64LeS] | [I64LeU] | [I64GeS] | [I64GeU] | [F32Eq] | [F32Ne] | [F32Lt] | [F32Gt] | [F32Le] | [F32Ge] | [F64Eq] | [F64Ne] | [F64Lt] | [F64Gt] | [F64Le] | [F64Ge] | [I32Clz] | [I32Ctz] | [I32Popcnt] | [I32Add] | [I32Sub] | [I32Mul] | [I32DivS] | [I32DivU] | [I32RemS] | [I32RemU] | [I32And] | [I32Or] | [I32Xor] | [I32Shl] | [I32ShrS] | [I32ShrU] | [I32Rotl] | [I32Rotr] | [I64Clz] | [I64Ctz] | [I64Popcnt] | [I64Add] | [I64Sub] | [I64Mul] | [I64DivS] | [I64DivU] | [I64RemS] | [I64RemU] | [I64And] | [I64Or] | [I64Xor] | [I64Shl] | [I64ShrS] | [I64ShrU] | [I64Rotl] | [I64Rotr] | [F32Abs] | [F32Neg] | [F32Ceil] | [F32Floor] | [F32Trunc] | [F32Nearest] | [F32Sqrt] | [F32Add] | [F32Sub] | [F32Mul] | [F32Div] | [F32Min] | [F32Max] | [F32CopySign] | [F64Abs] | [F64Neg] | [F64Ceil] | [F64Floor] | [F64Trunc] | [F64Nearest] | [F64Sqrt] | [F64Add] | [F64Sub] | [F64Mul] | [F64Div] | [F64Min] | [F64Max] | [F64CopySign] | [I32WrapI64] | [I32TruncF32S] | [I32TruncF32U] | [I32TruncF64S] | [I32TruncF64U] | [I64ExtendI32S] | [I64ExtendI32U] | [I64TruncF32S] | [I64TruncF32U] | [I64TruncF64S] | [I64TruncF64U] | [F32ConvertI32S] | [F32ConvertI32U] | [F32ConvertI64S] | [F32ConvertI64U] | [F32DemoteF64] | [F64ConvertI32S] | [F64ConvertI32U] | [F64ConvertI64S] | [F64ConvertI64U] | [F64PromoteF32] | [I32ReinterpretF32] | [I64ReinterpretF64] | [F32ReinterpretI32] | [F64ReinterpretI64] | [I32Extend8S] | [I32Extend16S] | [I64Extend8S] | [I64Extend16S] | [I64Extend32S] | [Block, BlockType, Expr] | [Loop, BlockType, Expr] | [If, BlockType, Expr] | [If, BlockType, Expr, Expr] | [Br, number] | [BrIf, number] | [BrTable, number[], number] | [Call, number] | [CallIndirect, number, number] | [RefNull, RefType] | [RefFunc, number] | [SelectT, ValueType[]] | [LocalGet, number] | [LocalSet, number] | [LocalTee, number] | [GlobalGet, number] | [GlobalSet, number] | [TableGet, number] | [TableSet, number] | [Other, I32TruncSatF32S] | [Other, I32TruncSatF32U] | [Other, I32TruncSatF64S] | [Other, I32TruncSatF64U] | [Other, I64TruncSatF32S] | [Other, I64TruncSatF32U] | [Other, I64TruncSatF64S] | [Other, I64TruncSatF64U] | [Other, MemoryInit, number] | [Other, DataDrop, number] | [Other, MemoryCopy] | [Other, MemoryFill] | [Other, TableInit, number, number] | [Other, ElemDrop, number] | [Other, TableCopy, number, number] | [Other, TableGrow, number] | [Other, TableSize, number] | [Other, TableFill, number] | [I32Load, number, number] | [I64Load, number, number] | [F32Load, number, number] | [F64Load, number, number] | [I32Load8S, number, number] | [I32Load8U, number, number] | [I32Load16S, number, number] | [I32Load16U, number, number] | [I64Load8S, number, number] | [I64Load8U, number, number] | [I64Load16S, number, number] | [I64Load16U, number, number] | [I64Load32S, number, number] | [I64Load32U, number, number] | [I32Store, number, number] | [I64Store, number, number] | [F32Store, number, number] | [F64Store, number, number] | [I32Store8, number, number] | [I32Store16, number, number] | [I64Store8, number, number] | [I64Store16, number, number] | [I64Store32, number, number] | [MemorySize] | [MemoryGrow] | [I32Const, number] | [I64Const, number] | [F32Const, number] | [F64Const, number]

LocalVariables

LocalVariables: { count: number; type: ValueType }[]

MemorySection

MemorySection: Section<5, ResizableLimits>

TableSection

TableSection: Section<4, TableType>

TypeSection

TypeSection: Section<1, FuncType>

ValueType

ValueType: RefType | NumType

Variables

Const SECTION_NAMES

SECTION_NAMES: string[] = ['custom','types','imports','functions','tables','memories','globals','exports','start','elements','code','data','data count',]

Const VERSION

VERSION: 1 = 1

Functions

addFunction

  • Takes in a module and adds a function to it.

    Note: Once a function is added to a module, you cannot reuse it. This is to prevent users from adding it to a module then editing the function further and wondering why the changes are not showing up.

    If a name is provided, we generate an export with that name

    Parameters

    • module: Module

      A WebAssembly Module

    • func: Func

      The function

    Returns Module

    Module with new function.

addLocal

buf2hex

  • buf2hex(buffer: Uint8Array): string

createEncoder

createFunction

createModule

decodeBlockType

decodeByte

  • decodeByte(decoder: Decoder): number

decodeByteVector

  • decodeByteVector(decoder: Decoder): Uint8Array

decodeCode

decodeData

decodeElement

decodeElementKind

decodeExport

decodeExpr

decodeFloat32

  • decodeFloat32(decoder: Decoder): number

decodeFloat64

  • decodeFloat64(decoder: Decoder): number

decodeFuncType

decodeGlobal

decodeGlobalType

decodeImport

decodeInstruction

decodeLEB128S

  • decodeLEB128S(decoder: Decoder): number

decodeLEB128U

  • decodeLEB128U(decoder: Decoder): number

decodeModule

  • decodeModule(encodedModule: Uint8Array): Module

decodeModulePreamble

  • decodeModulePreamble(decoder: Decoder): void

decodeRefType

decodeResizableLimits

decodeSection

decodeString

  • decodeString(decoder: Decoder): string

decodeTableType

decodeValueType

decodeVector

  • decodeVector<T>(decoder: Decoder, decodeFn: (decoder: Decoder) => T): T[]

encodeBlockType

encodeByte

  • encodeByte(encoder: Encoder, byte: number): void

encodeByteArray

  • encodeByteArray(encoder: Encoder, bytes: Uint8Array): void

encodeCode

encodeCodeSection

encodeData

encodeDataCountSection

encodeDataSection

encodeElement

encodeElementSection

encodeExport

encodeExportSection

encodeExpr

encodeFloat32

  • encodeFloat32(encoder: Encoder, float: number): void

encodeFloat64

  • encodeFloat64(encoder: Encoder, float: number): void

encodeFuncType

encodeFunctionSection

encodeGlobal

encodeGlobalSection

encodeGlobalType

encodeImportEntry

encodeImportSection

encodeInstruction

encodeLEB128S

  • encodeLEB128S(encoder: Encoder, int: number): void

encodeLEB128U

  • encodeLEB128U(encoder: Encoder, int: number): void

encodeMemorySection

encodeModule

  • encodeModule(module: Module): Uint8Array

encodePreamble

  • encodePreamble(encoder: Encoder): void

encodeResizableLimits

encodeSection

  • encodeSection<T, Id, Item>(encoder: Encoder, section: T, sectionSize: number, encodeFn: (encoder: Encoder, item: Item) => void): void
  • Type parameters

    • T: Section<Id, Item>

    • Id: number

    • Item

    Parameters

    • encoder: Encoder
    • section: T
    • sectionSize: number
    • encodeFn: (encoder: Encoder, item: Item) => void
        • (encoder: Encoder, item: Item): void
        • Parameters

          Returns void

    Returns void

encodeStartSection

encodeString

  • encodeString(encoder: Encoder, s: string): void

encodeTableSection

encodeTableType

encodeTypeSection

encodeVector

  • encodeVector<T>(encoder: Encoder, vec: T[], encodeFn: (encoder: Encoder, e: T) => void): void

fromLEB128S

  • fromLEB128S(buffer: Uint8Array, index: number): { index: number; value: number }
  • Converts a signed LEB128 number to a JavaScript number, returns the number and the updated buffer index

    Parameters

    • buffer: Uint8Array

      Byte array for encoded values.

    • index: number

      Where we read the value

    Returns { index: number; value: number }

    The integer value at buffer[index] along with the end index + 1.

    • index: number
    • value: number

fromLEB128U

  • fromLEB128U(buffer: Uint8Array, index: number): { index: number; value: number }
  • Converts an unsigned LEB128 number to a JavaScript number, along with the new end index

    Parameters

    • buffer: Uint8Array

      Byte array for encoded values.

    • index: number

      Where we read the value

    Returns { index: number; value: number }

    The integer value at buffer[index] along with the end index + 1.

    • index: number
    • value: number

getBlockTypeSize

  • getBlockTypeSize(blockType: BlockType): number

getCodeSectionSize

  • Gets size of code section, excluding the standard section preamble

    Parameters

    Returns number

    Size of code section in bytes

getCodeSize

  • getCodeSize(body: Code): number

getCustomSectionsSize

  • Gets size of custom sections, excluding the standard section preamble

    Parameters

    Returns number

    Size of custom section in bytes

getDataCountSection

  • Gets size of data count section, excluding the standard section preamble

    Parameters

    Returns number

    Size of data count section in bytes

getDataSectionSize

  • Gets size of data section, excluding the standard section preamble

    Parameters

    Returns number

    Size of data section in bytes

getDataSize

  • getDataSize(data: Data): number

getElementSectionSize

  • Gets size of element section, excluding the standard section preamble

    Parameters

    Returns number

    Size of element section in bytes

getElementSize

  • getElementSize(element: Element): number

getExportSectionSize

  • Gets size of export section, excluding the standard section preamble

    Parameters

    Returns number

    Size of export section in bytes

getExportSize

  • getExportSize(exportEntry: Export): number

getExprSize

  • getExprSize(expr: Expr): number

getFuncTypeSize

  • getFuncTypeSize(funcType: FuncType): number

getFunctionSectionSize

  • Gets size of function section, excluding the standard section preamble

    Parameters

    Returns number

    Size of function section in bytes

getGlobalSectionSize

  • Gets size of global section, excluding the standard section preamble

    Parameters

    Returns number

    Size of global section in bytes

getGlobalSize

  • getGlobalSize(global: Global): number

getHighestBit

  • getHighestBit(n: number): number

getImportEntrySize

  • getImportEntrySize(importEntry: Import): number

getImportSectionSize

  • Gets size of import section, excluding the standard section preamble

    Parameters

    Returns number

    Size of import section in bytes

getInstructionSize

getLEB128SSize

  • getLEB128SSize(n: number): number
  • Gets the size of a number if it were to be encoded in signed LEB128

    Parameters

    • n: number

      Number not encoded.

    Returns number

    Width of the encoded number in bytes.

getLEB128USize

  • getLEB128USize(n: number): number
  • Gets the size of a number if it were to be encoded in unsigned LEB128

    Parameters

    • n: number

      Number not encoded.

    Returns number

    Width of the encoded number in bytes.

getMemorySectionSize

  • Gets size of memory section, excluding the standard section preamble

    Parameters

    Returns number

    Size of memory section in bytes

getModuleSize

getRandomInt

  • getRandomInt(max: number): number

getRandomIntArray

  • getRandomIntArray(len: number): number[]

getRandomLEB128U

  • getRandomLEB128U(): number

getResizableLimitsSize

getStartSectionSize

  • Gets size of start section, excluding the standard section preamble

    Parameters

    Returns number

    Size of start section in bytes

getTableSectionSize

  • Gets size of table section, excluding the standard section preamble

    Parameters

    Returns number

    Size of table section in bytes

getTableTypeSize

  • getTableTypeSize(tableType: TableType): number

getTypeSectionSize

  • Gets size of type section, excluding the standard section preamble

    Parameters

    Returns number

    Size of types section in bytes

getVecSize

  • getVecSize<T>(entries: T[], sizeFn: (e: T) => number): number
  • Type parameters

    • T

    Parameters

    • entries: T[]
    • sizeFn: (e: T) => number
        • (e: T): number
        • Parameters

          • e: T

          Returns number

    Returns number

peekByte

  • peekByte(decoder: Decoder): number

printBlockType

  • printBlockType(blockType: BlockType): string

printHeapType

  • printHeapType(heapType: RefType): string

printInstrType

  • printInstrType(instrType: InstrType): string

printInstruction

toLEB128S

  • toLEB128S(n: number, buffer: Uint8Array, startIndex: number): number
  • Converts a number n to signed LEB128

    Parameters

    • n: number

      Must be an integer.

    • buffer: Uint8Array

      Buffer to write into

    • startIndex: number

      Start index for writing

    Returns number

    End index for encoder.

toLEB128U

  • toLEB128U(n: number, buffer: Uint8Array, startIndex: number): number
  • Converts a number n to unsigned LEB128

    Parameters

    • n: number

      Must be an integer.

    • buffer: Uint8Array

      Buffer to write into

    • startIndex: number

      Start index for writing

    Returns number

    End index for encoder.

Generated using TypeDoc