Files
58c2c80401 Migrate from Yarn to pnpm (#246)
* Migrate from Yarn to pnpm

- Replace Yarn 4.0.2 with pnpm 10.29.3 as the package manager
- Add pnpm-workspace.yaml and .npmrc configuration
- Update all scripts to use pnpm commands
- Rename getYarnWorkspaces() to getWorkspaces() in scripts/helpers.ts
- Update CI workflow to use pnpm/action-setup@v4 with Node 22
- Add @jitl/tsconfig as root devDependency for proper resolution
- Add variant packages as devDependencies for test resolution
- Fix TypeScript 5.9 compatibility in memory.ts (Int32Array<ArrayBuffer>)
- Upgrade typedoc to 0.28.17 for TypeScript 5.9 support
- Upgrade typedoc-plugin-markdown to 4.10.0
- Regenerate documentation with new typedoc version

* Clarify git commit --amend rule in CLAUDE.md

* CI: Add --ignore-scripts to pnpm install

Equivalent to yarn's YARN_ENABLE_SCRIPTS=0 - prevents prepare scripts
from running during install, which would fail on a fresh checkout.

* Fix pnpm tarball naming in smoketest scripts

pnpm pack generates tarball names like jitl-quickjs-ffi-types-0.32.0.tgz
(without @ prefix, with version) instead of @jitl-quickjs-ffi-types.tgz

* Update examples to TypeScript 5.9 for compatibility

The library now requires TypeScript 5.9+ due to stricter typed array
generics (Int32Array<ArrayBuffer>). Update all TypeScript-using examples.

* Use --legacy-peer-deps for create-react-app smoketest

react-scripts@5 only supports TypeScript 3.x/4.x, but our library now
requires TypeScript 5.9+ for typed array generics. Use --legacy-peer-deps
to work around the peer dependency conflict.

* Fix formatting issues

* Fix remaining formatting issues

* Add reminder to run prettier and lint before pushing

* Document CI workflow in CLAUDE.md

* Add typedoc.json and remark plugins for in-page table of contents

- Add typedoc-plugin-remark, remark-toc, and remark-insert-headings
- Configure remark plugins to generate "Contents" section for Class,
  Interface, Enum, TypeAlias, and Function pages
- This restores the in-page TOC that lists methods/properties that was
  removed in typedoc-plugin-markdown 4.3.0

* Use custom remark plugin for headless TOC in docs

Replace remark-insert-headings + remark-toc with a custom plugin that
inserts the table of contents directly after the class description,
without a separate "Contents" heading.

* Revert to standard remark plugins for TOC with Contents heading

Use remark-insert-headings + remark-toc instead of custom plugin.
Remove mdast-util-toc dependency and custom remark-toc-headless.mjs.

* Fix lockfile - remove mdast-util-toc

* Ignore pnpm-lock.yaml in prettier, update .yarn to .pnpm

---------

Co-authored-by: Hanzo Dev <[email protected]>
2026-02-16 20:35:52 +00:00

9.9 KiB
Raw Permalink Blame History

quickjs-emscripten


quickjs-emscripten / quickjs-emscripten-core / EmscriptenModule

Interface: EmscriptenModule

Defined in: packages/quickjs-ffi-types/src/emscripten-types.ts:131

Typings for the features we use to interface with our Emscripten build of QuickJS.

Contents

Extends

Extended by

Properties

FAST_MEMORY

FAST_MEMORY: number

Defined in: packages/quickjs-ffi-types/src/emscripten-types.ts:169


HEAP16

HEAP16: Int16Array

Defined in: packages/quickjs-ffi-types/src/emscripten-types.ts:159


HEAP32

HEAP32: Int32Array

Defined in: packages/quickjs-ffi-types/src/emscripten-types.ts:160


HEAP8

HEAP8: Int8Array

Defined in: packages/quickjs-ffi-types/src/emscripten-types.ts:158


HEAPF32

HEAPF32: Float32Array

Defined in: packages/quickjs-ffi-types/src/emscripten-types.ts:164


HEAPF64

HEAPF64: Float64Array

Defined in: packages/quickjs-ffi-types/src/emscripten-types.ts:165


HEAPU16

HEAPU16: Uint16Array

Defined in: packages/quickjs-ffi-types/src/emscripten-types.ts:162


HEAPU32

HEAPU32: Uint32Array

Defined in: packages/quickjs-ffi-types/src/emscripten-types.ts:163


HEAPU8

HEAPU8: Uint8Array

Defined in: packages/quickjs-ffi-types/src/emscripten-types.ts:161


TOTAL_MEMORY

TOTAL_MEMORY: number

Defined in: packages/quickjs-ffi-types/src/emscripten-types.ts:168


TOTAL_STACK

TOTAL_STACK: number

Defined in: packages/quickjs-ffi-types/src/emscripten-types.ts:167


wasmBinary?

optional wasmBinary: ArrayBuffer

Defined in: packages/quickjs-ffi-types/src/emscripten-types.ts:105

Compile this to WebAssembly.Module

Inherited from

EmscriptenModuleLoaderOptions.wasmBinary


wasmMemory?

optional wasmMemory: Memory

Defined in: packages/quickjs-ffi-types/src/emscripten-types.ts:108

If provided, use this WebAssembly.Memory instead of an automatically created one.

Inherited from

EmscriptenModuleLoaderOptions.wasmMemory

Methods

_free()

_free(ptr): void

Defined in: packages/quickjs-ffi-types/src/emscripten-types.ts:149

Parameters

ptr

number

Returns

void


_malloc()

_malloc(size): number

Defined in: packages/quickjs-ffi-types/src/emscripten-types.ts:148

Parameters

size

number

Returns

number


cwrap()

cwrap(ident, returnType, argTypes, opts?): (...args) => any

Defined in: packages/quickjs-ffi-types/src/emscripten-types.ts:150

Parameters

ident

string

returnType

ValueType | null

argTypes

ValueType[]

opts?

CCallOpts

Returns

(...args): any

Parameters
args

...any[]

Returns

any


instantiateWasm()?

optional instantiateWasm(imports, onSuccess): Exports | Promise<Exports>

Defined in: packages/quickjs-ffi-types/src/emscripten-types.ts:111

Create an instance of the WASM module, call onSuccess(instance), then return instance.exports

Parameters

imports

WebAssembly.Imports

onSuccess

(instance) => void

Returns

Exports | Promise<Exports>

Inherited from

EmscriptenModuleLoaderOptions.instantiateWasm


lengthBytesUTF8()

lengthBytesUTF8(str): number

Defined in: packages/quickjs-ffi-types/src/emscripten-types.ts:146

Parameters

str

string

Returns

number


locateFile()?

optional locateFile(fileName, prefix): string

Defined in: packages/quickjs-ffi-types/src/emscripten-types.ts:98

If set, this method will be called when the runtime needs to load a file, such as a .wasm WebAssembly file, .mem memory init file, or a file generated by the file packager.

The function receives two parameters:

  • fileName, the relative path to the file as configured in build process, eg "emscripten-module.wasm".
  • prefix (path to the main JavaScript file’s directory). This may be '' (empty string) in some cases if the Emscripten Javascript code can't locate itself. Try logging it in your environment.

It should return the actual URI or path to the requested file.

This lets you host file packages on a different location than the directory of the JavaScript file (which is the default expectation), for example if you want to host them on a CDN.

Parameters

fileName

string

prefix

string

Often '' (empty string)

Returns

string

Inherited from

EmscriptenModuleLoaderOptions.locateFile


monitorRunDependencies()?

optional monitorRunDependencies(left): void

Defined in: packages/quickjs-ffi-types/src/emscripten-types.ts:117

Called by emscripten as dependencies blocking initialization are added or fulfilled. May only be called in debug builds.

Parameters

left

number

Returns

void

Inherited from

EmscriptenModuleLoaderOptions.monitorRunDependencies


stringToUTF8()

stringToUTF8(str, outPtr, maxBytesToRead?): void

Defined in: packages/quickjs-ffi-types/src/emscripten-types.ts:140

Write JS str to HeapChar pointer. https://emscripten.org/docs/api_reference/preamble.js.html#stringToUTF8

Parameters

str

string

outPtr

OwnedHeapCharPointer

maxBytesToRead?

number

Returns

void


UTF8ToString()

UTF8ToString(ptr, maxBytesToRead?): string

Defined in: packages/quickjs-ffi-types/src/emscripten-types.ts:145

HeapChar to JS string. https://emscripten.org/docs/api_reference/preamble.js.html#UTF8ToString

Parameters

ptr

BorrowedHeapCharPointer

maxBytesToRead?

number

Returns

string