{"id":21659564,"url":"https://github.com/bytecodealliance/wac","last_synced_at":"2025-07-12T01:13:12.654Z","repository":{"id":194855881,"uuid":"682401890","full_name":"bytecodealliance/wac","owner":"bytecodealliance","description":"WebAssembly Composition (WAC) tooling","archived":false,"fork":false,"pushed_at":"2025-06-25T19:02:57.000Z","size":1047,"stargazers_count":154,"open_issues_count":30,"forks_count":23,"subscribers_count":8,"default_branch":"main","last_synced_at":"2025-07-12T00:44:55.903Z","etag":null,"topics":["components","composition","webassembly"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bytecodealliance.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-08-24T05:13:50.000Z","updated_at":"2025-07-10T06:34:24.000Z","dependencies_parsed_at":"2023-10-30T17:41:28.617Z","dependency_job_id":"8bc8f4e3-c357-47e7-9587-e6aa115d1a51","html_url":"https://github.com/bytecodealliance/wac","commit_stats":null,"previous_names":["peterhuene/wac"],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/bytecodealliance/wac","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bytecodealliance%2Fwac","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bytecodealliance%2Fwac/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bytecodealliance%2Fwac/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bytecodealliance%2Fwac/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bytecodealliance","download_url":"https://codeload.github.com/bytecodealliance/wac/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bytecodealliance%2Fwac/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264922778,"owners_count":23683688,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["components","composition","webassembly"],"created_at":"2024-11-25T09:31:15.216Z","updated_at":"2025-07-12T01:13:12.634Z","avatar_url":"https://github.com/bytecodealliance.png","language":"Rust","readme":"\u003cdiv align=\"center\"\u003e\n  \u003ch1\u003e\u003ccode\u003eWebAssembly Compositions (WAC)\u003c/code\u003e\u003c/h1\u003e\n\n\u003cstrong\u003eA \u003ca href=\"https://bytecodealliance.org/\"\u003eBytecode Alliance\u003c/a\u003e project\u003c/strong\u003e\n\n  \u003cp\u003e\n    \u003cstrong\u003eA tool for composing \u003ca href=\"https://github.com/WebAssembly/component-model/\"\u003eWebAssembly components\u003c/a\u003e together.\u003c/strong\u003e\n  \u003c/p\u003e\n\n  \u003cp\u003e\n    \u003ca href=\"https://github.com/bytecodealliance/wac/actions?query=workflow%3ACI\"\u003e\u003cimg src=\"https://github.com/bytecodealliance/wac/workflows/CI/badge.svg\" alt=\"build status\" /\u003e\u003c/a\u003e\n    \u003ca href=\"https://crates.io/crates/wac-parser\"\u003e\u003cimg src=\"https://img.shields.io/crates/v/wac-cli.svg?style=flat-square\" alt=\"Crates.io version\" /\u003e\u003c/a\u003e\n    \u003ca href=\"https://crates.io/crates/wac-cli\"\u003e\u003cimg src=\"https://img.shields.io/crates/d/wac-cli.svg?style=flat-square\" alt=\"Download\" /\u003e\u003c/a\u003e\n    \u003ca href=\"https://docs.rs/wac-parser/\"\u003e\u003cimg src=\"https://img.shields.io/badge/docs-latest-blue.svg?style=flat-square\" alt=\"docs.rs docs\" /\u003e\u003c/a\u003e\n  \u003c/p\u003e\n\u003c/div\u003e\n\n## Overview\n\n`wac` is a tool for composing [WebAssembly Components](https://github.com/WebAssembly/component-model)\ntogether.\n\nThe tool uses the WAC (pronounced \"whack\") language to define how components\ncomposed together.\n\n## The `wac` Language\n\nThe `wac` language is a declarative superset of [`wit`](https://component-model.bytecodealliance.org/design/wit.html) \nfor describing how components are composed together.\n\nAs an example, imagine two components name.wasm and greeter.wasm.\n\nThe wit for name.wasm is:\n\n```wit\npackage example:name;\n\nworld name {\n  /// Exporting a 'name' function that returns a name to greet.\n  export name: func() -\u003e string;\n}\n```\n\nAnd the wit for greeter.wasm is:\n\n```wit\npackage example:greeter;\n\nworld greeter {\n  /// Importing a 'name' function that returns the name to greet.\n  import name: func() -\u003e string;\n  /// Exporting a 'greet' function that returns a greeting using the name.\n  export greet: func() -\u003e string;\n}\n```\n\nThe following is an example of a wac file that composes these two components together \nby plugging name.wasm's \"name\" export into greeter.wasm's \"name\" import.\n\n```wac\npackage example:composition;\n\n// Instantiate the `name` component\nlet n = new example:name {};\n\n// Instantiate the `greeter` component by plugging its `name`\n// import with the `name` export of the `name` component.\nlet greeter = new example:greeter {\n  name: n.name,\n};\n\n// Export the greet function from the greeter component\nexport greeter.greet;\n```\n\nThe result of encoding this composition is a single component that\ndoes not import anything and only exports the \"greet\" function.\n\nFor a full description of the `wac` language see [the language guide](LANGUAGE.md).\n\n## Installation\n\nTo install the `wac` CLI from source, run the following command:\n\n```\ncargo install wac-cli\n```\n\nIf you have the [cargo-binstall](https://github.com/cargo-bins/cargo-binstall)\nutility installed, `wac` CLI can also be installed via a prebuilt\nrelease artifact, saving time on the installation:\n\n```\ncargo binstall wac-cli\n```\n\n## Usage\n\nThe `wac` CLI tool has the following commands:\n\n* `wac plug` - Plugs the imports of a component with one or more other components.\n* `wac compose` - Compose WebAssembly components using the provided WAC source file.\n* `wac targets` - Determines whether a given component conforms to the supplied wit world.\n* `wac parse` - Parses a composition into a JSON representation of the AST.\n* `wac resolve` - Resolves a composition into a JSON representation.\n\n### Quick \u0026 Easy Compositions\n\nTo do simple compositions, use the `wac plug` command:\n\n```\nwac plug my-socket.wasm --plug my-plug.wasm -o plugged.wasm\n```\n\nOr mixing in packages published to a Warg registry:\n\n```\nwac plug my-namespace:package-name --plug some-namespace:other-package-name -o plugged.wasm\n```\n\n### Checking Whether a Component Implements a World\n\nTo see whether a given component implements a given world, use the `wac targets` command:\n\n```\nwac targets my-component.wasm my-wit.wit\n```\n\nIf `my-component.wasm` implements the world defined in `my-wit.wit` then the command will succeed. Otherwise, an error will be returned.\n\nIf `my-wit.wit` has multiple world definitions, you can disambiguate using the `--world` flag.\n\n### Encoding Compositions\n\nTo perform a composition, use the `wac compose` command:\n\n```\nwac compose -t input.wac\n```\n\nThis will use `input.wac` to perform the composition and write the text\nrepresentation of the component to stdout.\n\n```\nwac compose -o output.wasm input.wac\n```\n\nThis will perform the composition specified in `input.wac` and output a WebAssembly component named `output.wasm`.\n\n#### Dependencies\n\nBy default, `wac` will create a component that embeds its dependencies (i.e. packages\nreferenced in a WAC source file) inside of itself rather than importing those dependencies;\nto cause dependencies to be imported in the output component, use the\n`--import-dependencies` flag:\n\n```\nwac compose --import-dependencies -o output.wasm input.wac\n```\n\nDependencies may be located within a `deps` subdirectory, with an expected structure of:\n\n```\ndeps/\n├─ \u003cnamespace\u003e/\n│  ├─ \u003cpackage\u003e.wasm\n``````\n\nThe dependency may be also be a WIT file or a directory containing a WIT package:\n\n```\ndeps/\n├─ \u003cnamespace\u003e/\n│  ├─ \u003cpackage\u003e/\n│  │  ├─ a.wit\n│  │  ├─ ...\n```\n\nThe `--deps-dir` CLI option may be used to specify a different directory to\nsearch for dependencies.\n\nThe location of specific dependencies may also be specified with the `--dep` CLI option:\n\n```\nwac compose --dep foo:bar=./baz.wasm -o output.wasm input.wac\n```\n\nBy default, dependencies must be binary-encoded WebAssembly components; to\nenable support for WAT files, use the `wat` build-time feature.\n\nIf built with default features, then dependencies may be\nautomatically resolved from a Warg registry and do not need to exist in the\n`deps` subdirectory or specified via the `--dep` CLI option.\n","funding_links":[],"categories":["Rust","WASM/WASI 🕸️"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbytecodealliance%2Fwac","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbytecodealliance%2Fwac","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbytecodealliance%2Fwac/lists"}