API reference
On this page
Configuration
- Build configuration
Choose engine features and module resolution options. - C library contracts
Declare how to find and bind a C library. - CLI
Look up commands, flags, defaults, and output paths.
Modules
- maligator:application
Notify the development supervisor when startup is complete. - maligator:workers
Run isolated modules and exchange messages with them. - maligator:assets
Declare files and directory trees the build embeds. - maligator:http
Serve Fetch API handlers and embedded assets. - maligator:fs
Read and write files through lazy handles. - maligator:test
Write tests with suites, hooks, and assertions. - maligator:process
Read immutable compile-time command and configuration values.
Symbols
Build configuration
MaligatorIntlFeature
Service selections used when Intl is enabled; an empty list includes every service.MaligatorFfiLibrary
A C library the program imports asmaligator:ffi/<name>.MaligatorBuildConfig
Trusted, strictly validated configuration evaluated for each CLI invocation.defineBuild
Preserve the inferred config type. Validation happens when the CLI loads the config.typescriptimport { defineBuild } from "@maligator/cli"; export default defineBuild({ entry: "src/index.ts" });
Members and options
C library contracts
MaligatorFfiFind
How the build finds a C library's headers and binaries. Relative paths resolve against the file that declares them. Name at leastpkgConfig,libraries, orsources; the other fields add to what those provide.MaligatorFfiHandle
A C resource or caller-owned state struct. Its handles close on[Symbol.dispose]()or when passed todestroy; a closed handle throws instead of reaching C.MaligatorFfiTypeFacts
Facts about one C type, keyed by its typedef or tag.MaligatorFfiFieldFacts
A resource, callable or counted array field, or a range retained by caller-owned state.MaligatorFfiEvidence
A declaration whose documentation supports a fact, independent of its source location.MaligatorFfiCount
The C parameter or state field carrying a byte or element count.MaligatorFfiShape
Select active C union storage explicitly or through an integer discriminator.MaligatorFfiValueFacts
Facts about a parameter or a result.MaligatorFfiCallable
A C function whose code and referenced state remain valid for its lifetime.MaligatorFfiCallback
A callback the library calls before the function returns, such as an iteration or comparison function, until it releases the callback, until the next call replaces it, or to complete a handle's close. An exception it throws skips later calls and rethrows when the C function the library runs in returns.MaligatorFfiCallbackResult
A callback result's value shape, or the lifetime of a returned pointer.MaligatorFfiFunctionFacts
Facts about one C function, keyed by its name.MaligatorFfiVariant
One way to call a variadic function: the C types of the arguments after the fixed ones.MaligatorFfiGlobalValueFacts
Representation of a library-owned global, shared by its read and write accessors.MaligatorFfiGlobalFacts
Explicit access to a library-owned C object. Accessors run on the calling thread.MaligatorLibraryContract
Facts about a C library that hold wherever it is installed. The binding comes from the headers plus these facts.defineLibrary
Preserve the inferred contract type. Validation happens when the CLI loads the contract.typescriptimport { defineLibrary } from "@maligator/cli"; export default defineLibrary({ headers: ["raylib.h"], find: [{ pkgConfig: "raylib" }] });
Members and options
MaligatorFfiFind.pkgConfigMaligatorFfiFind.includeDirsMaligatorFfiFind.definesMaligatorFfiFind.libraryDirsMaligatorFfiFind.librariesMaligatorFfiFind.frameworksMaligatorFfiFind.sourcesMaligatorFfiHandle.storageMaligatorFfiHandle.trailingMaligatorFfiHandle.layoutMaligatorFfiHandle.layout.sizeMaligatorFfiHandle.layout.alignmentMaligatorFfiHandle.viewsMaligatorFfiHandle.destroyMaligatorFfiHandle.destroy.functionMaligatorFfiHandle.destroy.successMaligatorFfiHandle.collectMaligatorFfiTypeFacts.representationMaligatorFfiTypeFacts.handleMaligatorFfiTypeFacts.shapeMaligatorFfiTypeFacts.fieldsMaligatorFfiTypeFacts.evidenceMaligatorFfiEvidence.kindMaligatorFfiEvidence.nameMaligatorFfiCount.lengthMaligatorFfiValueFacts.shapeMaligatorFfiValueFacts.nullableMaligatorFfiValueFacts.borrowedMaligatorFfiValueFacts.freshMaligatorFfiValueFacts.outMaligatorFfiValueFacts.inoutMaligatorFfiValueFacts.stringMaligatorFfiValueFacts.bytesMaligatorFfiValueFacts.arrayMaligatorFfiValueFacts.array.capacityMaligatorFfiValueFacts.array.elementMaligatorFfiValueFacts.array.element.stringMaligatorFfiValueFacts.array.element.bytesMaligatorFfiValueFacts.array.writableMaligatorFfiValueFacts.freeMaligatorFfiValueFacts.callbackMaligatorFfiValueFacts.callableMaligatorFfiValueFacts.constantMaligatorFfiValueFacts.sizeofMaligatorFfiValueFacts.pointeeMaligatorFfiValueFacts.endMaligatorFfiCallable.lifetimeMaligatorFfiCallable.paramsMaligatorFfiCallable.returnsMaligatorFfiCallback.ownerMaligatorFfiCallback.returnsMaligatorFfiCallback.dataMaligatorFfiCallback.releaseMaligatorFfiCallback.replacedMaligatorFfiCallback.closesMaligatorFfiCallback.lookupMaligatorFfiCallback.lookup.functionMaligatorFfiCallback.lookup.paramMaligatorFfiCallback.queuedMaligatorFfiCallback.paramsMaligatorFfiCallback.onceMaligatorFfiCallback.fieldMaligatorFfiCallback.constantsMaligatorFfiFunctionFacts.callsJavaScriptMaligatorFfiFunctionFacts.evidenceMaligatorFfiFunctionFacts.paramsMaligatorFfiFunctionFacts.returnsMaligatorFfiFunctionFacts.initializesMaligatorFfiFunctionFacts.initializes.paramMaligatorFfiFunctionFacts.initializes.successMaligatorFfiFunctionFacts.variantsMaligatorFfiFunctionFacts.dispatchMaligatorFfiFunctionFacts.asyncMaligatorFfiVariant.argsMaligatorFfiVariant.paramsMaligatorFfiGlobalValueFacts.shapeMaligatorFfiGlobalValueFacts.borrowedMaligatorFfiGlobalValueFacts.callableMaligatorFfiGlobalValueFacts.stringMaligatorFfiGlobalValueFacts.bytesMaligatorFfiGlobalValueFacts.lifetimeMaligatorFfiGlobalFacts.getMaligatorFfiGlobalFacts.setMaligatorFfiGlobalFacts.valueMaligatorFfiGlobalFacts.evidenceMaligatorLibraryContract.headersMaligatorLibraryContract.findMaligatorLibraryContract.typesMaligatorLibraryContract.functionsMaligatorLibraryContract.globals
CLI
init
Command and flag reference.doctor
Command and flag reference.build
Command and flag reference.run
Command and flag reference.dev
Command and flag reference.test
Command and flag reference.--profile
Command and flag reference.cache
Command and flag reference.ffi inspect
Command and flag reference.ffi types
Command and flag reference.ffi check
Command and flag reference.Diagnostic build options
Command and flag reference.--compile-concurrency
Production total job limit, integer 1..3. Default is at most 3, bounded by host CPU capacity. Profiling is serial.--compile-concurrency- Positive integer compilation budget.
--target
Read the headers for a cross-build target through Zig.
maligator:application
ready
Notify the development supervisor that this application is ready. Repeated calls are harmless. Returns true in a supervised application and false in a standalone application or ordinary worker. Call after resources such as a server listener are accepting work; this does not reserve ports or transfer traffic.
maligator:workers
createPool
Create a bounded pool of persistent workers for a declared entry. Submission failures throw synchronously; admitted tasks settle asynchronously. Await ready before submitting startup-dependent work and close the pool when finished. Throws NotSupportedError without threads and RangeError for invalid bounds.createWorkerUrl
Declare an entry using a static string literal and explicit import.meta.url base. The immutable href projection can be passed to existing worker libraries.transfer
Wrap a result for transfer when the worker publishes it.Worker
Start a declared isolated module and expose its ordered port and complete lifecycle.MessageChannel
Create two transferable endpoints independently of worker startup.MessagePort
The port prototype for type and identity checks. Ports are created by channels and workers.receiveMessageOnPort
Synchronously dequeue one pending message without running unrelated callbacks.capabilities
Report the running host's worker facilities and capacity.parentPort
The worker's parent endpoint; null in the main isolate.workerData
The worker-owned clone of startup data.WorkerUrl
An immutable image-local worker entry declaration. The compiler resolves the declaration independently of how libraries pass the descriptor or its href onward. Erased module types express the caller's assertion; runtime entry identity is validated.Transferable
ArrayBuffer stores move at admission. MessagePort endpoints transfer ownership. SharedArrayBuffer is cloned by sharing its backing and cannot be transferred.TaskContext
Cancellation is cooperative while a pool task runs. The worker remains occupied until the task's returned promise settles.TransferResult
An opaque result envelope. Constructing it does not detach buffers; publication commits transfers.TaskNames
Names of context-first exported task functions.TaskArgs
The task's argument tuple, excluding its local cancellation context.TaskValue
The settled task result after unwrapping an explicit transfer envelope.PoolOptions
Fixed persistent worker count and admission bounds. Every worker has independent module state. A size-one pool dispatches admitted tasks serially.RunOptions
The transfer list commits synchronously when run returns normally. Validation, saturation, closed pools and already-aborted signals throw before admission.MapOptions
The window bounds pulled inputs and buffered results together. Results are yielded in input order; iterator return cancels this map's work and closes its input.PoolStats
A snapshot of this pool's scheduling and settled operations.WorkerPool
A bounded task scheduler over isolated persistent workers. Each worker executes one task through asynchronous settlement. No accepted task is replayed after worker failure.WorkerExit
A terminal record published only after the native worker is joined and its slot is released.WorkerOptions
Worker data is snapshotted before startup. The native host bounds live workers and message admission process-wide.MessageChannelOptions
Each endpoint bounds its pending message count and bytes. Rejection leaves the sender's transferables unchanged.MessagePort
An ordered bidirectional endpoint with transactional transfer and bounded queues. Message listeners and values are owned by the receiving isolate.MessageChannel
A standalone channel whose endpoints may be transferred to workers.Worker
A long-lived isolated module and its parent communication port. Startup completes after module evaluation; shutdown completes after native thread reaping.
Members and options
WorkerUrl.hrefWorkerUrl.__workerModuleTaskContext.signalTaskContext.throwIfCancelledTransferResult.valueTransferResult.__transferResultPoolOptions.sizePoolOptions.maxQueuedTasksPoolOptions.maxQueuedBytesPoolOptions.maxMessageBytesPoolOptions.nameRunOptions.signalRunOptions.transferMapOptions.signalMapOptions.windowMapOptions.transferPoolStats.sizePoolStats.activePoolStats.queuedPoolStats.completedPoolStats.failedPoolStats.cancelledWorkerPool.readyWorkerPool.runWorkerPool.mapWorkerPool.closeWorkerPool.terminateWorkerPool.statsWorkerPool.refWorkerPool.unrefWorkerPool.hasRefWorkerExit.idWorkerExit.codeWorkerExit.reasonWorkerExit.errorWorkerOptions.nameWorkerOptions.dataWorkerOptions.transferWorkerOptions.maxQueuedMessagesWorkerOptions.maxQueuedBytesWorkerOptions.maxMessageBytesMessageChannelOptions.maxQueuedMessagesMessageChannelOptions.maxQueuedBytesMessageChannelOptions.maxMessageBytesMessagePort.postMessageMessagePort.onmessageMessagePort.onmessageerrorMessagePort.startMessagePort.closeMessagePort.refMessagePort.unrefMessagePort.hasRefMessageChannel.port1MessageChannel.port2Worker.idWorker.readyWorker.closedWorker.portWorker.terminateWorker.refWorker.unrefWorker.hasRef
maligator:assets
embedFile
Declare a file to embed and return its handle. Repeated declarations of the same file share one handle.embedDirectory
Declare a directory tree to embed and return its handle. Repeated declarations with the same options share one handle.MaterializeOptions
Where an embedded copy is written. Outsidemaligator buildthe source file is used in place and this option is ignored.EmbeddedFile
A file the build embeds.maligator buildfixes its contents; other commands read the source file each time.EmbeddedDirectory
A directory tree the build embeds.maligator buildfixes its member files; other commands list the source directory each time.EmbedProducer
A command that writes the declared files.EmbedWatchProducer
A long-running command that keeps the declared files current, such as a frontend dev server.EmbedProducerUse
Which producer each command runs.existinguses the files already on disk; a selected producer must be declared.EmbedFileOptions
How the declared files are produced. Only the project's own modules may name commands; they never reach a built executable.EmbedDirectoryOptions
Which files of the directory belong to the declaration, and how they are produced. Patterns are relative to the directory and use/separators.
Members and options
MaterializeOptions.baseDirectoryEmbeddedFile.pathEmbeddedFile.sizeEmbeddedFile.digestEmbeddedFile.typeEmbeddedFile.bytesEmbeddedFile.textEmbeddedFile.jsonEmbeddedFile.materializeEmbeddedDirectory.filesEmbeddedDirectory.getEmbeddedDirectory.materializeEmbedProducer.commandEmbedProducer.cwdEmbedWatchProducer.urlEmbedProducerUse.buildEmbedProducerUse.runEmbedProducerUse.testEmbedProducerUse.devEmbedFileOptions.buildEmbedFileOptions.watchEmbedFileOptions.useEmbedDirectoryOptions.includeEmbedDirectoryOptions.excludeEmbedDirectoryOptions.dot
maligator:http
serve
Listen and answer each request withfetch. Invalid options and bind failures throw.serveAsset
A handler that serves an embedded file or directory with its media type, ETag, cache headers, conditional and range requests, and precompressed copies in production builds. While a declaration's watcher runs, the handler forwards to the watcher's URL instead.proxy
A handler that forwards each request to the same path belowtargetand returns the answer.fetch
The Fetch API'sfetch, the same function as the global one. Importing it links the HTTP client without installing the global.Handler
Answers a buffered request. A thrown error or rejection reaches the server's error handler.ErrorHandler
Turns a handler failure into a response.ServeOptions
Where to listen and how to answer. Limits are integers from 0 through 2147483647.Server
A listening server.await usingcloses it at the end of a scope.ServeAssetOptions
How request paths map onto the asset. A path ending in/serves itsindex.html.
Members and options
ServeOptions.fetchServeOptions.errorServeOptions.hostnameServeOptions.portServeOptions.signalServeOptions.headersTimeoutServeOptions.requestTimeoutServeOptions.keepAliveTimeoutServeOptions.maxConnectionsServer.portServer.hostnameServer.urlServer.closeServer.[Symbol.asyncDispose]ServeAssetOptions.prefixServeAssetOptions.fallbackServeAssetOptions.immutable
maligator:fs
file
A handle for the file atpath. It does no I/O, so the file need not exist yet. Throws a TypeError for an empty path, a path with a null byte or a URL that is not afile:URL.directory
A handle for the directory atpath. It does no I/O, so the directory need not exist yet. Throws a TypeError for an empty path, a path with a null byte or a URL that is not afile:URL.realpath
Return the absolute path of an existing entry after resolving symbolic links.readlink
Read the target stored in a symbolic link, keeping relative targets relative.symlink
Create a symbolic link totarget. A relative target resolves from the link's parent. The target can be missing.temporaryDirectory
Create a directory accessible only by its owner and return its absolute handle. Calldelete()when done.watch
Watch a file or directory using an async iterator. The firstnext()starts the watch. Breaking out of the loop, callingreturn(), or aborting the signal closes it.FileSystemError
The class of every rejection a failed filesystem operation causes.FilePath
A path, or afile:URL. A relative path resolves against the working directory when an operation runs.FileData
Contents to write. Strings are written as UTF-8; views write the bytes they cover.WriteOptions
Howwritestores the contents.AppendOptions
Howappendcreates a missing file.FileStreamOptions
Byte range and read size forDiskFile.stream().FileWriterOptions
HowDiskFile.writer()opens its file.FileWriter
A sink that opens the file on its first operation and queues operations in call order. Await a write before reusing its input buffer.WatchOptions
Howwatch()observes changes.FileChange
A filesystem notification. The OS can coalesce changes and may report a move as creation or deletion.TransferOptions
HowcopyToandmoveTotreat an existing destination.StatOptions
Which entrystatdescribes.FileStat
Metadata of a filesystem entry.DiskFile
A file on disk. Creating a handle does no I/O; each method reads or changes the file when called. Failed operations reject with aFileSystemError.DirectoryListOptions
Which entries to list. Patterns use*,?and whole-segment**on slash-separated paths relative to the directory. A pattern can match zero entries.DirectoryEntry
An entry returned byDiskDirectory.entries().CreateDirectoryOptions
HowDiskDirectory.create()creates a directory.DeleteOptions
How a delete handles a missing entry.DeleteDirectoryOptions
HowDiskDirectory.delete()removes a directory.TemporaryDirectoryOptions
Where to create a private temporary directory and how to name it.DiskDirectory
A directory on disk. Creating a handle does no I/O. Directory walks report symbolic links as entries and skip descending into them.FileSystemError
A failed filesystem operation. The message reads like Node's: the code, a description, the system call and the paths.
Members and options
WriteOptions.atomicWriteOptions.createDirectoriesWriteOptions.exclusiveWriteOptions.modeAppendOptions.createDirectoriesAppendOptions.modeFileStreamOptions.startFileStreamOptions.endFileStreamOptions.chunkSizeFileWriterOptions.appendFileWriter.writeFileWriter.flushFileWriter.closeFileWriter.endFileWriter.[Symbol.asyncDispose]WatchOptions.recursiveWatchOptions.signalFileChange.kindFileChange.pathTransferOptions.overwriteStatOptions.followSymlinksFileStat.sizeFileStat.mtimeFileStat.isFileFileStat.isDirectoryFileStat.isSymbolicLinkFileStat.modeDiskFile.pathDiskFile.typeDiskFile.existsDiskFile.statDiskFile.bytesDiskFile.textDiskFile.jsonDiskFile.streamDiskFile.writerDiskFile.writeDiskFile.appendDiskFile.chmodDiskFile.deleteDiskFile.copyToDiskFile.moveToDirectoryListOptions.includeDirectoryListOptions.excludeDirectoryListOptions.dotDirectoryListOptions.recursiveDirectoryEntry.nameDirectoryEntry.pathDirectoryEntry.kindCreateDirectoryOptions.recursiveCreateDirectoryOptions.modeDeleteOptions.missingOkDeleteDirectoryOptions.recursiveTemporaryDirectoryOptions.parentTemporaryDirectoryOptions.prefixDiskDirectory.pathDiskDirectory.existsDiskDirectory.statDiskDirectory.fileDiskDirectory.directoryDiskDirectory.getDiskDirectory.filesDiskDirectory.entriesDiskDirectory.createDiskDirectory.chmodDiskDirectory.deleteDiskDirectory.moveToFileSystemError.codeFileSystemError.syscallFileSystemError.pathFileSystemError.destination
maligator:test
test
Register a test in the current suite.describe
Register a nested suite in the current suite.expect
Create fluent matchers for a received value.beforeAll
Run once before tests in the current suite.afterAll
Run once after tests in the current suite, including after test failures.beforeEach
Run before every selected descendant test. Ancestor hooks run before hooks declared by a nested suite.afterEach
Run after every selected descendant test. Nested-suite hooks run before ancestor hooks.TestCallback
A test or hook body. Maligator waits for a returned promise or thenable before advancing the lifecycle.HookCallback
A lifecycle hook body, with the same async completion contract as a test.Constructor
A constructable value accepted byexpect.any.AsymmetricMatcher
Opaque partial-match value produced by helpers such asexpect.objectContaining. It may be nested insidetoEqual,toStrictEqual, andtoMatchObjectexpectations.Matchers
Matchers for a synchronously received value.AsyncMatchers
Promise-returning matcher surface exposed byMatchers.resolvesandMatchers.rejects. Await these calls so the test cannot finish before the assertion.ExpectFunction
Assertion entrypoint and Maligator-owned asymmetric matcher factories.TestFunction
Register tests in the current suite during module evaluation.DescribeFunction
Register nested suites synchronously during module evaluation.
Members and options
AsymmetricMatcher.__maligator_asymmetric__Matchers.notMatchers.resolvesMatchers.rejectsMatchers.toBeMatchers.toEqualMatchers.toStrictEqualMatchers.toBeDefinedMatchers.toBeUndefinedMatchers.toBeNullMatchers.toBeTruthyMatchers.toBeFalsyMatchers.toContainMatchers.toHaveLengthMatchers.toMatchMatchers.toMatchObjectMatchers.toThrowAsyncMatchers.notAsyncMatchers.toBeAsyncMatchers.toEqualAsyncMatchers.toStrictEqualAsyncMatchers.toBeDefinedAsyncMatchers.toBeUndefinedAsyncMatchers.toBeNullAsyncMatchers.toBeTruthyAsyncMatchers.toBeFalsyAsyncMatchers.toContainAsyncMatchers.toHaveLengthAsyncMatchers.toMatchAsyncMatchers.toMatchObjectAsyncMatchers.toThrowexpect.anyexpect.anythingexpect.stringMatchingexpect.objectContainingexpect.arrayContainingtest.skiptest.todotest.onlytest.eachdescribe.skipdescribe.only
maligator:process
execution
An immutable snapshot of the workflow, target, and resolved configuration, fixed before compilation. Known property reads can specialize application branches. Runtime arguments, environment, working directory, and PID are outside this snapshot. Profiling does not change production intent. Static and dynamic imports share its identity, and reflection sees the complete deeply frozen shape.ExecutionProfile
Profiling instrumentation: none by default; sampling for --profile; compiler for --profile=compiler. Both profiling modes select full optimization without selecting production application behavior.ExecutionTarget
The fixed platform contract of the application image.ExecutionOptions
Options shared by build, run, and dev. Output paths, verbosity, and compiler scheduling are tool settings and are not exposed.TestExecutionOptions
Normalized test settings, fixed for the application image. Changing these values invalidates specialized test artifacts.ExecutionEngineConfig
Resolved engine policies. These describe build inputs, never post-DCE native feature inclusion.ExecutionConfig
Resolved application engine and module policies. Excludes build-host paths, asset declarations, and output controls.ExecutionCommon
Fields shared by every execution workflow. All nested objects and arrays are deeply frozen at runtime.Execution
An immutable application-image description, discriminated by command. The command describes the workflow that prepared the image, not a transient process phase.
Members and options
ExecutionTarget.platformExecutionTarget.archExecutionTarget.tripleExecutionOptions.profileTestExecutionOptions.profileTestExecutionOptions.nameFilterTestExecutionOptions.repeatTestExecutionOptions.bailTestExecutionOptions.timeoutMsTestExecutionOptions.shuffleSeedExecutionEngineConfig.primordialsExecutionEngineConfig.evalExecutionEngineConfig.realmsExecutionEngineConfig.regexpExecutionEngineConfig.temporalExecutionEngineConfig.intlExecutionEngineConfig.intl.enabledExecutionEngineConfig.intl.featuresExecutionEngineConfig.intl.languagesExecutionConfig.engineExecutionConfig.modulesExecutionConfig.modules.aliasesExecutionCommon.productionExecutionCommon.compiledExecutionCommon.optimizationExecutionCommon.targetExecutionCommon.config