Wasmer Manifest (wasmer.toml)
The manifest file called wasmer.toml is required to publish to the Wasmer registry . This file contains the package’s dependencies, metadata, and command declarations.
If you want to get assistance creating the wasmer.toml file you can simply
run wasmer init in your directory and the CLI will guide you!
[package]
Valid keys are:
name(string): the package name, as<namespace>/<name>. Only required when publishing a named package to the registry; unnamed packages can be published without it.version(semver version ): a valid Semantic Version. Only required when publishing a named package to the registry.description(string)private(bool): mark the package as private. Defaults tofalse.license(spdx identifier ): can be MIT or GPL, for example.license-file(path): an override for the license file path used in publishing. Left undefined, theLICENSEfile will be implicitly included in the package.readme(path)repository(url)homepage(url)entrypoint(string): The command to use by default
[package]
name = "wasmer/wasm-pack"
version = "0.7.1"
description = "A code generator that lets you treat WebAssembly modules like native dependencies."
license = "MIT" # OR license-file = "./LICENSE.md"
readme = "./README.md"
repository = "https://github.com/wasmerio/wasmer-pack"
homepage = "https://wasmer.io/"
entrypoint = "wasmer-pack"
# ...[dependencies]
"<namespace>/<name>" = "<version>"
# ...
[dependencies]
"sharrattj/coreutils" = "1.0.16"Dependencies can provide modules for your own commands. To use a module from a
dependency, set module to "<namespace>/<package>:<module-name>" in the
command declaration.
[package]
name = "myuser/python-tool"
version = "0.1.0"
description = "Run a Python snippet from a dependency"
entrypoint = "python"
[dependencies]
"python/python" = "3.12"
[[command]]
name = "python"
module = "python/python:python"
runner = "wasi"
[command.annotations.wasi]
main-args = ["-c", "print('Hello from a dependency module')"][[module]]
name(string) requiredsource(path) required: path to the.wasmfileabi(string): the ABI the module targets. One of"wasi","wasm4", or"none".
# ...
[module]
name = "wasmer-pack"
source = "./target/wasm32-unknown-unknown/release/wasmer-pack.wasm"[module.bindings]
Declares the interface definitions used to generate bindings for this module.
Bindings come in two forms, WAI or WIT ,
and exactly one of wai-version or wit-bindgen must be set.
WAI form:
wai-version(string): The version of WAI being targeted (e.g."0.2.0")exports(string): The path to a*.waifile defining the interface exposed by the moduleimports(string[]): A list of*.waifiles defining functionality the host will provide to the module
[[module]]
name = "wasmer-pack"
...
[module.bindings]
wai-version = "0.2.0"
exports = "./wasmer-pack.wai"
imports = ["http-client.wai", "logging.wai"]WIT form:
wit-bindgen(string): The version ofwit-bindgenbeing targeted (e.g."0.1.0")wit-exports(string): The path to a*.witfile defining the interface exposed by the module
[module.bindings]
wit-bindgen = "0.1.0"
wit-exports = "./exports.wit"[[command]]
namerequired (string): the name of the command, invoked viawasmer run . --command=<command-name>modulerequired (string): the name of the module this command is running.runnerrequired (string): a URL or well-known name for the runner used to execute this command (e.g."wasi","wcgi","wasm4")annotations: free-form command metadata that will be passed through to the runner as-is
Note that the module may be either the name of a [[module]] in the current wasmer.toml, or it might come from a dependency. For example, module = "python/python:python" indicates the command uses the python module from the package’s python/python dependency.
It is valid (and often preferable) for a [command] and [module] to have the same name.
# ...
[[command]]
name = "wasmer-pack"
module = "wasmer-pack"
runner = "wasi"[command.annotations.wasi]
Annotations specific to the WASI runner.
main-args(string[]): command-line arguments passed to a command on startupenv(string[]): a list ofkey=valueenvironment variables passed through to the command on startup
[[command]]
name = "wasmer-pack"
...
[command.annotations.wasi]
main-args = ["--verbose"]
env = ["RUST_LOG=debug"][command.annotations.wcgi]
dialect(string): the name of the CGI dialect being implemented. May be either"rfc-3875"(the default) or"wcgi".
The WCGI runner also respects the [command.annotations.wasi] annotations.
[[command]]
name = "wasmer-pack"
...
[command.annotations.wcgi]
dialect = "wcgi"[fs]
"location/on/wasm"="location/on/publishing/machine": bundle local files into the package and make them available on the WASI filesystem
# ...
[fs]
"/cpython" = "./build"
"/lib/python3.12" = "./lib"