Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,12 @@ register_toolchains("@go_toolchains//:all")

# WASI WIT interface definitions
wasi_wit_ext = use_extension("//wasm:extensions.bzl", "wasi_wit")
wasi_wit_ext.init()
wasi_wit_ext.init(include_p3 = True)
use_repo(
wasi_wit_ext,
# WASI 0.2.3 (default)
"wasi_cli",
"wasi_p3",
"wasi_clocks",
"wasi_filesystem",
"wasi_http",
Expand Down
39 changes: 25 additions & 14 deletions MODULE.bazel.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 24 additions & 1 deletion test/p3/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,25 @@ build_test(
targets = [":hello_p3"],
)

# ============================================================================
# WASI 0.3 interface WIT (stable v0.3.0) — covers wasi_p3_deps.bzl
# ============================================================================

# Builds the per-proposal WASI 0.3.0 wit_library targets so the stable-tag
# retarget (proposals/<name>/wit/) stays green. Requires the wasi_wit
# extension with include_p3 = True (set in MODULE.bazel).
build_test(
name = "wasi_p3_wit_build_test",
targets = [
"@wasi_p3//:cli",
"@wasi_p3//:clocks",
"@wasi_p3//:filesystem",
"@wasi_p3//:http",
"@wasi_p3//:random",
"@wasi_p3//:sockets",
],
)

# ============================================================================
# Test suites
# ============================================================================
Expand All @@ -66,13 +85,17 @@ test_suite(

test_suite(
name = "p3",
tests = [":p3_build_test"],
tests = [
":p3_build_test",
":wasi_p3_wit_build_test",
],
)

test_suite(
name = "all",
tests = [
":p2_build_test",
":p3_build_test",
":wasi_p3_wit_build_test",
],
)
35 changes: 17 additions & 18 deletions wit/private/wasi_p3_deps.bzl
Original file line number Diff line number Diff line change
@@ -1,24 +1,23 @@
"""WASI P3 (Preview 3) WIT interface dependencies — experimental
"""WASI P3 (Preview 3) WIT interface dependencies

Provides WASI 0.3.0-rc WIT definitions for async WebAssembly components.
Provides WASI 0.3.0 WIT definitions for async WebAssembly components.

Key P3 changes from P2:
- async func keyword in WIT
- stream<T> and future<T> as Component Model built-in types
- wasi:io eliminated (streams/poll absorbed into Component Model)
- All core interfaces redesigned around async primitives

Source: WebAssembly/WASI monorepo tag v0.3.0-rc-2026-03-15
WIT files live in proposals/<name>/wit-0.3.0-draft/ directories.

NOTE: This is experimental. The P3 spec is in RC phase, not finalized.
Source: WebAssembly/WASI monorepo tag v0.3.0 (ratified 2026-06-11).
WIT files live in proposals/<name>/wit/ directories (the RC used
wit-0.3.0-draft/; the stable tag renamed it to wit/).
"""

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

# The RC snapshot we track — update this when new RCs ship
WASI_P3_RC = "0.3.0-rc-2026-03-15"
WASI_P3_TAG = "v" + WASI_P3_RC
# The ratified WASI 0.3.0 release.
WASI_P3_VERSION = "0.3.0"
WASI_P3_TAG = "v" + WASI_P3_VERSION

# Build file content for the monorepo — exposes per-proposal wit_library targets
_WASI_P3_BUILD_FILE = """
Expand All @@ -27,7 +26,7 @@ load("@rules_wasm_component//wit:defs.bzl", "wit_library")
# WASI CLI P3 — run is async, stdio uses stream<u8>
wit_library(
name = "cli",
srcs = glob(["proposals/cli/wit-0.3.0-draft/*.wit"]),
srcs = glob(["proposals/cli/wit/*.wit"]),
package_name = "wasi:cli@0.3.0",
deps = [":clocks", ":filesystem", ":sockets", ":random"],
visibility = ["//visibility:public"],
Expand All @@ -36,7 +35,7 @@ wit_library(
# WASI HTTP P3 — handle/send are async, bodies are stream<u8>
wit_library(
name = "http",
srcs = glob(["proposals/http/wit-0.3.0-draft/*.wit"]),
srcs = glob(["proposals/http/wit/*.wit"]),
package_name = "wasi:http@0.3.0",
deps = [":cli", ":clocks"],
visibility = ["//visibility:public"],
Expand All @@ -45,15 +44,15 @@ wit_library(
# WASI Clocks P3 — wait-until/wait-for are async (replaces subscribe+pollable)
wit_library(
name = "clocks",
srcs = glob(["proposals/clocks/wit-0.3.0-draft/*.wit"]),
srcs = glob(["proposals/clocks/wit/*.wit"]),
package_name = "wasi:clocks@0.3.0",
visibility = ["//visibility:public"],
)

# WASI Filesystem P3 — all ops async, read/write use stream<u8>+future
wit_library(
name = "filesystem",
srcs = glob(["proposals/filesystem/wit-0.3.0-draft/*.wit"]),
srcs = glob(["proposals/filesystem/wit/*.wit"]),
package_name = "wasi:filesystem@0.3.0",
deps = [":clocks"],
visibility = ["//visibility:public"],
Expand All @@ -62,7 +61,7 @@ wit_library(
# WASI Sockets P3 — TCP connect/send/receive async with stream<u8>
wit_library(
name = "sockets",
srcs = glob(["proposals/sockets/wit-0.3.0-draft/*.wit"]),
srcs = glob(["proposals/sockets/wit/*.wit"]),
package_name = "wasi:sockets@0.3.0",
deps = [":clocks"],
visibility = ["//visibility:public"],
Expand All @@ -71,7 +70,7 @@ wit_library(
# WASI Random P3 — minimal changes from P2
wit_library(
name = "random",
srcs = glob(["proposals/random/wit-0.3.0-draft/*.wit"]),
srcs = glob(["proposals/random/wit/*.wit"]),
package_name = "wasi:random@0.3.0",
visibility = ["//visibility:public"],
)
Expand All @@ -80,7 +79,7 @@ wit_library(
def wasi_wit_p3_dependencies():
"""Load WASI P3 WIT interface definitions from the WASI monorepo.

Downloads the entire WASI monorepo at the P3 RC tag and exposes
Downloads the entire WASI monorepo at the stable v0.3.0 tag and exposes
per-proposal wit_library targets:
- @wasi_p3//:cli
- @wasi_p3//:http
Expand All @@ -96,7 +95,7 @@ def wasi_wit_p3_dependencies():
http_archive(
name = "wasi_p3",
urls = ["https://github.com/WebAssembly/WASI/archive/refs/tags/{}.tar.gz".format(WASI_P3_TAG)],
sha256 = "29db1f783ae7624d1c453cebcd1e53eabd16723fc57c56556778fc11c0a9471d",
strip_prefix = "WASI-{}".format(WASI_P3_RC),
sha256 = "619928e4754a14db106ae42318daa5c7e29b842ab884662d6d86d8d1ac9a76fd",
strip_prefix = "WASI-{}".format(WASI_P3_VERSION),
build_file_content = _WASI_P3_BUILD_FILE,
)
Loading