Wasmer Manifest (wasmer.toml
)
The manifest file called wasmer.toml
is required to publish to the Wasmer registry (opens in a new tab); This file contains the package's dependencies, metadata, and commands are declared.
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) requiredversion
(semver version (opens in a new tab)) required: a valid Semantic Version.description
(string) requiredlicense
(spdx identifier (opens in a new tab)): can be MIT or GPL, for example.license-file
(path): an override for the license file path used in publishing. Left undefined, theLICENSE
file 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"
[[module]]
name
(string) requiredsource
(path) required: path to the.wasm
file
# ...
[module]
name = "wasmer-pack"
source = "./target/wasm32-unknown-unknown/release/wasmer-pack.wasm"
[module.bindings]
Definitions used by Wasmer Pack (opens in a new tab) when generating bindings for this module.
wai-version
(string) required: The version of WAI (opens in a new tab) being targeted (e.g."0.2.0"
)exports
(string): The path to a*.wai
file defining the interface exposed by the moduleimports
(string[]): A list of*.wai
files 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"]
[[command]]
name
required (string): the name of the command, invoked viawasmer run . --command=<command-name>
module
required (string): the name of the module this command is running.runner
required (string): a URL or well-known name for the runner used to execute this command (e.g."wasi"
,"wcgi"
,"emscripten"
)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 preferrable) 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=value
environment 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"
[command.annotations.emscripten]
main-args
(string[]): command-line arguments passed in on startupenv
(string[]): a list ofkey=value
environment variables passed through to the instance on startup
[[command]]
name = "wasmer-pack"
...
[command.annotations.emscripten]
main-args = ["--port=8080"]
env = ["COMPATIBILITY_MODE=true"]
[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"