SERVER-123038 Use wit-bindgen to create api_component_type.o (#51169)
GitOrigin-RevId: f3f2d305bd51058cdc35540eaa470144ee13fea0
This commit is contained in:
parent
4555f8554c
commit
398b6844e6
42
MODULE.bazel
42
MODULE.bazel
@ -347,6 +347,14 @@ rust.toolchain(
|
||||
versions = ["nightly/2025-12-11"],
|
||||
)
|
||||
|
||||
rust_host = use_extension("@rules_rust//rust:extensions.bzl", "rust_host_tools")
|
||||
rust_host.host_tools(
|
||||
name = "rust_host_tools_nightly",
|
||||
edition = "2024",
|
||||
version = "nightly/2025-12-11",
|
||||
)
|
||||
use_repo(rust_host, "rust_host_tools_nightly")
|
||||
|
||||
crate = use_extension("@rules_rust//crate_universe:extensions.bzl", "crate")
|
||||
crate.spec(
|
||||
package = "wasmtime",
|
||||
@ -454,8 +462,10 @@ crate.annotation_select(
|
||||
)
|
||||
|
||||
# Update the lock file using "CARGO_BAZEL_REPIN=1 bazel sync --only=crates"
|
||||
# You may need to delete the contents of crates.lock first
|
||||
crate.from_specs(
|
||||
cargo_lockfile = "//bazel:crates.toml",
|
||||
host_tools = "@rust_host_tools_nightly",
|
||||
lockfile = "//bazel:crates.lock",
|
||||
supported_platform_triples = [
|
||||
"aarch64-apple-darwin",
|
||||
@ -468,6 +478,38 @@ crate.from_specs(
|
||||
],
|
||||
)
|
||||
use_repo(crate, "crates")
|
||||
|
||||
# wit-bindgen-cli must live in a separate crate extension because
|
||||
# artifact="bin" changes how crate_universe configures exec-platform
|
||||
# toolchain resolution for the entire extension, which breaks Windows
|
||||
# exec builds of other binary targets (e.g. wasmtime-cli). Any other artifact="bin"
|
||||
# should live here.
|
||||
cargo_bindeps = use_extension("@rules_rust//crate_universe:extension.bzl", "crate")
|
||||
cargo_bindeps.spec(
|
||||
artifact = "bin",
|
||||
package = "wit-bindgen-cli",
|
||||
version = "=0.51.0",
|
||||
)
|
||||
cargo_bindeps.annotation(
|
||||
crate = "wit-bindgen-cli",
|
||||
gen_all_binaries = True,
|
||||
)
|
||||
cargo_bindeps.from_specs(
|
||||
name = "cargo_bindeps",
|
||||
cargo_lockfile = "//bazel:cargo_bindeps.toml",
|
||||
host_tools = "@rust_host_tools_nightly",
|
||||
lockfile = "//bazel:cargo_bindeps.lock",
|
||||
supported_platform_triples = [
|
||||
"aarch64-apple-darwin",
|
||||
"aarch64-unknown-linux-gnu",
|
||||
"x86_64-apple-darwin",
|
||||
"x86_64-unknown-linux-gnu",
|
||||
"x86_64-pc-windows-msvc",
|
||||
"powerpc64le-unknown-linux-gnu",
|
||||
"s390x-unknown-linux-gnu",
|
||||
],
|
||||
)
|
||||
use_repo(cargo_bindeps, "cargo_bindeps")
|
||||
#################### END RUST DEPS ####################
|
||||
|
||||
wasi_deps = use_repo_rule(
|
||||
|
||||
@ -34,7 +34,7 @@ PROTO_GEN_SUFFIXES = (".grpc.pb.h", ".pb.h") # order matters only for readabili
|
||||
|
||||
SRC_ROOT_POSIX = SRC_ROOT.as_posix()
|
||||
AUTO_HEADER_PREFIX = f"//{SRC_ROOT_POSIX}/"
|
||||
VERSION_SALT = "autoheader-v7" # bump to force regen
|
||||
VERSION_SALT = "autoheader-v8" # bump to force regen
|
||||
MANIFEST_PATH = SRC_ROOT / AUTO_DIR / "last_run.json"
|
||||
|
||||
# -------- single-pass file lister (cache) --------
|
||||
@ -45,6 +45,7 @@ _FILE_LIST_CACHE: list[str] | None = None
|
||||
# Val: absolute Bazel label of the generator target to depend on.
|
||||
GEN_HEADER_REMAP = {
|
||||
"mongo/config.h": f"//{SRC_ROOT_POSIX}/mongo:mongo_config_header",
|
||||
"mongo/scripting/mozjs/wasm/api.h": f"//{SRC_ROOT_POSIX}/mongo/scripting/mozjs/wasm:api.h",
|
||||
}
|
||||
|
||||
EXCLUDE_HEADERS = {
|
||||
|
||||
7753
bazel/cargo_bindeps.lock
Normal file
7753
bazel/cargo_bindeps.lock
Normal file
File diff suppressed because it is too large
Load Diff
1222
bazel/cargo_bindeps.toml
Normal file
1222
bazel/cargo_bindeps.toml
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -43,9 +43,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "anstream"
|
||||
version = "0.6.21"
|
||||
version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "43d5b281e737544384e969a5ccad3f1cdd24b48086a0fc1b2a5262a26b8f4f4a"
|
||||
checksum = "824a212faf96e9acacdbd09febd34438f8f711fb84e09a8916013cd7815ca28d"
|
||||
dependencies = [
|
||||
"anstyle",
|
||||
"anstyle-parse",
|
||||
@ -64,9 +64,9 @@ checksum = "940b3a0ca603d1eade50a4846a2afffd5ef57a9feac2c0e2ec2e14f9ead76000"
|
||||
|
||||
[[package]]
|
||||
name = "anstyle-parse"
|
||||
version = "0.2.7"
|
||||
version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4e7644824f0aa2c7b9384579234ef10eb7efb6a0deb83f9630a49594dd9c15c2"
|
||||
checksum = "52ce7f38b242319f7cabaa6813055467063ecdc9d355bbb4ce0c68908cd8130e"
|
||||
dependencies = [
|
||||
"utf8parse",
|
||||
]
|
||||
@ -269,9 +269,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "cc"
|
||||
version = "1.2.57"
|
||||
version = "1.2.59"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7a0dd1ca384932ff3641c8718a02769f1698e7563dc6974ffd03346116310423"
|
||||
checksum = "b7a4d3ec6524d28a329fc53654bbadc9bdd7b0431f5d65f1a56ffb28a1ee5283"
|
||||
dependencies = [
|
||||
"find-msvc-tools",
|
||||
"jobserver",
|
||||
@ -663,9 +663,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "env_filter"
|
||||
version = "1.0.0"
|
||||
version = "1.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7a1c3cc8e57274ec99de65301228b537f1e4eedc1b8e0f9411c6caac8ae7308f"
|
||||
checksum = "32e90c2accc4b07a8456ea0debdc2e7587bdd890680d71173a15d4ae604f6eef"
|
||||
dependencies = [
|
||||
"log",
|
||||
"regex",
|
||||
@ -686,9 +686,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "env_logger"
|
||||
version = "0.11.9"
|
||||
version = "0.11.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b2daee4ea451f429a58296525ddf28b45a3b64f1acf6587e2067437bb11e218d"
|
||||
checksum = "0621c04f2196ac3f488dd583365b9c09be011a4ab8b9f37248ffcc8f6198b56a"
|
||||
dependencies = [
|
||||
"anstream",
|
||||
"anstyle",
|
||||
@ -1042,9 +1042,9 @@ checksum = "135b12329e5e3ce057a9f972339ea52bc954fe1e9358ef27f95e89716fbc5424"
|
||||
|
||||
[[package]]
|
||||
name = "hyper"
|
||||
version = "1.8.1"
|
||||
version = "1.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2ab2d4f250c3d7b1c9fcdff1cece94ea4e2dfbec68614f7b87cb205f24ca9d11"
|
||||
checksum = "6299f016b246a94207e63da54dbe807655bf9e00044f73ded42c3ac5305fbcca"
|
||||
dependencies = [
|
||||
"atomic-waker",
|
||||
"bytes",
|
||||
@ -1057,7 +1057,6 @@ dependencies = [
|
||||
"httpdate",
|
||||
"itoa",
|
||||
"pin-project-lite",
|
||||
"pin-utils",
|
||||
"smallvec",
|
||||
"tokio",
|
||||
"want",
|
||||
@ -1089,12 +1088,13 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "icu_collections"
|
||||
version = "2.1.1"
|
||||
version = "2.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4c6b649701667bbe825c3b7e6388cb521c23d88644678e83c0c4d0a621a34b43"
|
||||
checksum = "2984d1cd16c883d7935b9e07e44071dca8d917fd52ecc02c04d5fa0b5a3f191c"
|
||||
dependencies = [
|
||||
"displaydoc",
|
||||
"potential_utf",
|
||||
"utf8_iter",
|
||||
"yoke",
|
||||
"zerofrom",
|
||||
"zerovec",
|
||||
@ -1102,9 +1102,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "icu_locale_core"
|
||||
version = "2.1.1"
|
||||
version = "2.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "edba7861004dd3714265b4db54a3c390e880ab658fec5f7db895fae2046b5bb6"
|
||||
checksum = "92219b62b3e2b4d88ac5119f8904c10f8f61bf7e95b640d25ba3075e6cac2c29"
|
||||
dependencies = [
|
||||
"displaydoc",
|
||||
"litemap",
|
||||
@ -1115,9 +1115,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "icu_normalizer"
|
||||
version = "2.1.1"
|
||||
version = "2.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5f6c8828b67bf8908d82127b2054ea1b4427ff0230ee9141c54251934ab1b599"
|
||||
checksum = "c56e5ee99d6e3d33bd91c5d85458b6005a22140021cc324cea84dd0e72cff3b4"
|
||||
dependencies = [
|
||||
"icu_collections",
|
||||
"icu_normalizer_data",
|
||||
@ -1129,15 +1129,15 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "icu_normalizer_data"
|
||||
version = "2.1.1"
|
||||
version = "2.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7aedcccd01fc5fe81e6b489c15b247b8b0690feb23304303a9e560f37efc560a"
|
||||
checksum = "da3be0ae77ea334f4da67c12f149704f19f81d1adf7c51cf482943e84a2bad38"
|
||||
|
||||
[[package]]
|
||||
name = "icu_properties"
|
||||
version = "2.1.2"
|
||||
version = "2.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "020bfc02fe870ec3a66d93e677ccca0562506e5872c650f893269e08615d74ec"
|
||||
checksum = "bee3b67d0ea5c2cca5003417989af8996f8604e34fb9ddf96208a033901e70de"
|
||||
dependencies = [
|
||||
"icu_collections",
|
||||
"icu_locale_core",
|
||||
@ -1149,15 +1149,15 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "icu_properties_data"
|
||||
version = "2.1.2"
|
||||
version = "2.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "616c294cf8d725c6afcd8f55abc17c56464ef6211f9ed59cccffe534129c77af"
|
||||
checksum = "8e2bbb201e0c04f7b4b3e14382af113e17ba4f63e2c9d2ee626b720cbce54a14"
|
||||
|
||||
[[package]]
|
||||
name = "icu_provider"
|
||||
version = "2.1.1"
|
||||
version = "2.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "85962cf0ce02e1e0a629cc34e7ca3e373ce20dda4c4d7294bbd0bf1fdb59e614"
|
||||
checksum = "139c4cf31c8b5f33d7e199446eff9c1e02decfc2f0eec2c8d71f65befa45b421"
|
||||
dependencies = [
|
||||
"displaydoc",
|
||||
"icu_locale_core",
|
||||
@ -1211,9 +1211,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "indexmap"
|
||||
version = "2.13.0"
|
||||
version = "2.13.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7714e70437a7dc3ac8eb7e6f8df75fd8eb422675fc7678aff7364301092b1017"
|
||||
checksum = "45a8a2b9cb3e0b0c1803dbb0758ffac5de2f425b23c28f518faabd9d805342ff"
|
||||
dependencies = [
|
||||
"equivalent",
|
||||
"hashbrown 0.16.1",
|
||||
@ -1280,9 +1280,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "itoa"
|
||||
version = "1.0.17"
|
||||
version = "1.0.18"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "92ecc6618181def0457392ccd0ee51198e065e016d1d527a7ac1b6dc7c1f09d2"
|
||||
checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682"
|
||||
|
||||
[[package]]
|
||||
name = "ittapi"
|
||||
@ -1340,9 +1340,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "js-sys"
|
||||
version = "0.3.91"
|
||||
version = "0.3.94"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b49715b7073f385ba4bc528e5747d02e66cb39c6146efb66b781f131f0fb399c"
|
||||
checksum = "2e04e2ef80ce82e13552136fabeef8a5ed1f985a96805761cbb9a2c34e7664d9"
|
||||
dependencies = [
|
||||
"once_cell",
|
||||
"wasm-bindgen",
|
||||
@ -1380,9 +1380,9 @@ checksum = "09edd9e8b54e49e587e4f6295a7d29c3ea94d469cb40ab8ca70b288248a81db2"
|
||||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.183"
|
||||
version = "0.2.184"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b5b646652bf6661599e1da8901b3b9522896f01e736bad5f723fe7a3a27f899d"
|
||||
checksum = "48f5d2a454e16a5ea0f4ced81bd44e4cfc7bd3a507b61887c99fd3538b28e4af"
|
||||
|
||||
[[package]]
|
||||
name = "libloading"
|
||||
@ -1402,9 +1402,9 @@ checksum = "b6d2cec3eae94f9f509c767b45932f1ada8350c4bdb85af2fcab4a3c14807981"
|
||||
|
||||
[[package]]
|
||||
name = "libredox"
|
||||
version = "0.1.14"
|
||||
version = "0.1.15"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1744e39d1d6a9948f4f388969627434e31128196de472883b39f148769bfe30a"
|
||||
checksum = "7ddbf48fd451246b1f8c2610bd3b4ac0cc6e149d89832867093ab69a17194f08"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
@ -1434,9 +1434,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "litemap"
|
||||
version = "0.8.1"
|
||||
version = "0.8.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6373607a59f0be73a39b6fe456b8192fcc3585f602af20751600e974dd455e77"
|
||||
checksum = "92daf443525c4cce67b150400bc2316076100ce0b3686209eb8cf3c31612e6f0"
|
||||
|
||||
[[package]]
|
||||
name = "log"
|
||||
@ -1524,9 +1524,9 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
|
||||
|
||||
[[package]]
|
||||
name = "mio"
|
||||
version = "1.1.1"
|
||||
version = "1.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a69bcab0ad47271a0234d9422b131806bf3968021e5dc9328caf2d4cd58557fc"
|
||||
checksum = "50b7e5b27aa02a74bac8c3f23f448f8d87ff11f92d3aac1a6ed369ee08cc56c1"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"wasi",
|
||||
@ -1602,7 +1602,7 @@ version = "0.9.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1ac8d4a70a99d5afb7091e6c0b7c2b2bb509b6b3322877ccb97d2075553f9c01"
|
||||
dependencies = [
|
||||
"env_logger 0.11.9",
|
||||
"env_logger 0.11.10",
|
||||
"libloading",
|
||||
"openvino-finder",
|
||||
]
|
||||
@ -1629,12 +1629,6 @@ version = "0.2.17"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd"
|
||||
|
||||
[[package]]
|
||||
name = "pin-utils"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"
|
||||
|
||||
[[package]]
|
||||
name = "pkg-config"
|
||||
version = "0.3.32"
|
||||
@ -1670,9 +1664,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "potential_utf"
|
||||
version = "0.1.4"
|
||||
version = "0.1.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b73949432f5e2a09657003c25bca5e19a0e9c84f8058ca374f49e0ebe605af77"
|
||||
checksum = "0103b1cef7ec0cf76490e969665504990193874ea05c85ff9bab8b911d0a0564"
|
||||
dependencies = [
|
||||
"zerovec",
|
||||
]
|
||||
@ -1884,9 +1878,9 @@ checksum = "b50b8869d9fc858ce7266cce0194bd74df58b9d0e3f6df3a9fc8eb470d95c09d"
|
||||
|
||||
[[package]]
|
||||
name = "rustc-hash"
|
||||
version = "2.1.1"
|
||||
version = "2.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "357703d41365b4b27c590e3ed91eabb1b663f07c4c084095e60cbed4362dff0d"
|
||||
checksum = "94300abf3f1ae2e2b8ffb7b58043de3d399c73fa6f4b73826402a5c457614dbe"
|
||||
|
||||
[[package]]
|
||||
name = "rustix"
|
||||
@ -2034,9 +2028,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "serde_spanned"
|
||||
version = "1.0.4"
|
||||
version = "1.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f8bbf91e5a4d6315eee45e704372590b30e260ee83af6639d64557f51b067776"
|
||||
checksum = "6662b5879511e06e8999a8a235d848113e942c9124f211511b16466ee2995f26"
|
||||
dependencies = [
|
||||
"serde_core",
|
||||
]
|
||||
@ -2254,9 +2248,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "tinystr"
|
||||
version = "0.8.2"
|
||||
version = "0.8.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "42d3e9c45c09de15d06dd8acf5f4e0e399e85927b7f00711024eb7ae10fa4869"
|
||||
checksum = "c8323304221c2a851516f22236c5722a72eaa19749016521d6dff0824447d96d"
|
||||
dependencies = [
|
||||
"displaydoc",
|
||||
"zerovec",
|
||||
@ -2264,9 +2258,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "tokio"
|
||||
version = "1.50.0"
|
||||
version = "1.51.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "27ad5e34374e03cfffefc301becb44e9dc3c17584f414349ebe29ed26661822d"
|
||||
checksum = "2bd1c4c0fc4a7ab90fc15ef6daaa3ec3b893f004f915f2392557ed23237820cd"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"libc",
|
||||
@ -2280,9 +2274,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "tokio-macros"
|
||||
version = "2.6.1"
|
||||
version = "2.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5c55a2eff8b69ce66c84f85e1da1c233edc36ceb85a2058d11b0d6a3c7e7569c"
|
||||
checksum = "385a6cb71ab9ab790c5fe8d67f1645e6c450a7ce006a33de03daa956cf70a496"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@ -2339,18 +2333,18 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "toml_parser"
|
||||
version = "1.0.10+spec-1.1.0"
|
||||
version = "1.1.2+spec-1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7df25b4befd31c4816df190124375d5a20c6b6921e2cad937316de3fccd63420"
|
||||
checksum = "a2abe9b86193656635d2411dc43050282ca48aa31c2451210f4202550afb7526"
|
||||
dependencies = [
|
||||
"winnow 1.0.0",
|
||||
"winnow 1.0.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "toml_writer"
|
||||
version = "1.0.7+spec-1.1.0"
|
||||
version = "1.1.1+spec-1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f17aaa1c6e3dc22b1da4b6bba97d066e354c7945cac2f7852d4e4e7ca7a6b56d"
|
||||
checksum = "756daf9b1013ebe47a8776667b466417e2d4c5679d441c26230efd9ef78692db"
|
||||
|
||||
[[package]]
|
||||
name = "tracing"
|
||||
@ -2481,9 +2475,9 @@ checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821"
|
||||
|
||||
[[package]]
|
||||
name = "uuid"
|
||||
version = "1.22.0"
|
||||
version = "1.23.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a68d3c8f01c0cfa54a75291d83601161799e4a89a39e0929f4b0354d88757a37"
|
||||
checksum = "5ac8b6f42ead25368cf5b098aeb3dc8a1a2c05a3eee8a9a1a68c640edbfc79d9"
|
||||
dependencies = [
|
||||
"js-sys",
|
||||
"wasm-bindgen",
|
||||
@ -2574,9 +2568,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen"
|
||||
version = "0.2.114"
|
||||
version = "0.2.117"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6532f9a5c1ece3798cb1c2cfdba640b9b3ba884f5db45973a6f442510a87d38e"
|
||||
checksum = "0551fc1bb415591e3372d0bc4780db7e587d84e2a7e79da121051c5c4b89d0b0"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"once_cell",
|
||||
@ -2587,9 +2581,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-macro"
|
||||
version = "0.2.114"
|
||||
version = "0.2.117"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "18a2d50fcf105fb33bb15f00e7a77b772945a2ee45dcf454961fd843e74c18e6"
|
||||
checksum = "7fbdf9a35adf44786aecd5ff89b4563a90325f9da0923236f6104e603c7e86be"
|
||||
dependencies = [
|
||||
"quote",
|
||||
"wasm-bindgen-macro-support",
|
||||
@ -2597,9 +2591,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-macro-support"
|
||||
version = "0.2.114"
|
||||
version = "0.2.117"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "03ce4caeaac547cdf713d280eda22a730824dd11e6b8c3ca9e42247b25c631e3"
|
||||
checksum = "dca9693ef2bab6d4e6707234500350d8dad079eb508dca05530c85dc3a529ff2"
|
||||
dependencies = [
|
||||
"bumpalo",
|
||||
"proc-macro2",
|
||||
@ -2610,9 +2604,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-shared"
|
||||
version = "0.2.114"
|
||||
version = "0.2.117"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "75a326b8c223ee17883a4251907455a2431acc2791c98c26279376490c378c16"
|
||||
checksum = "39129a682a6d2d841b6c429d0c51e5cb0ed1a03829d8b3d1e69a011e62cb3d3b"
|
||||
dependencies = [
|
||||
"unicode-ident",
|
||||
]
|
||||
@ -2660,12 +2654,12 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wasm-encoder"
|
||||
version = "0.245.1"
|
||||
version = "0.246.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3f9dca005e69bf015e45577e415b9af8c67e8ee3c0e38b5b0add5aa92581ed5c"
|
||||
checksum = "61fb705ce81adde29d2a8e99d87995e39a6e927358c91398f374474746070ef7"
|
||||
dependencies = [
|
||||
"leb128fmt",
|
||||
"wasmparser 0.245.1",
|
||||
"wasmparser 0.246.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -2719,9 +2713,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wasmparser"
|
||||
version = "0.245.1"
|
||||
version = "0.246.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4f08c9adee0428b7bddf3890fc27e015ac4b761cc608c822667102b8bfd6995e"
|
||||
checksum = "71cde4757396defafd25417cfb36aa3161027d06d865b0c24baaae229aac005d"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"indexmap",
|
||||
@ -3287,24 +3281,24 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wast"
|
||||
version = "245.0.1"
|
||||
version = "246.0.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "28cf1149285569120b8ce39db8b465e8a2b55c34cbb586bd977e43e2bc7300bf"
|
||||
checksum = "fe3fe8e3bf88ad96d031b4181ddbd64634b17cb0d06dfc3de589ef43591a9a62"
|
||||
dependencies = [
|
||||
"bumpalo",
|
||||
"leb128fmt",
|
||||
"memchr",
|
||||
"unicode-width",
|
||||
"wasm-encoder 0.245.1",
|
||||
"wasm-encoder 0.246.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wat"
|
||||
version = "1.245.1"
|
||||
version = "1.246.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cd48d1679b6858988cb96b154dda0ec5bbb09275b71db46057be37332d5477be"
|
||||
checksum = "4bd7fda1199b94fff395c2d19a153f05dbe7807630316fa9673367666fd2ad8c"
|
||||
dependencies = [
|
||||
"wast 245.0.1",
|
||||
"wast 246.0.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -3617,9 +3611,9 @@ checksum = "df79d97927682d2fd8adb29682d1140b343be4ac0f08fd68b7765d9c059d3945"
|
||||
|
||||
[[package]]
|
||||
name = "winnow"
|
||||
version = "1.0.0"
|
||||
version = "1.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a90e88e4667264a994d34e6d1ab2d26d398dcdca8b7f52bec8668957517fc7d8"
|
||||
checksum = "09dac053f1cd375980747450bfc7250c264eaae0583872e845c0c7cd578872b5"
|
||||
|
||||
[[package]]
|
||||
name = "winx"
|
||||
@ -3751,15 +3745,15 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "writeable"
|
||||
version = "0.6.2"
|
||||
version = "0.6.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9edde0db4769d2dc68579893f2306b26c6ecfbe0ef499b013d731b7b9247e0b9"
|
||||
checksum = "1ffae5123b2d3fc086436f8834ae3ab053a283cfac8fe0a0b8eaae044768a4c4"
|
||||
|
||||
[[package]]
|
||||
name = "yoke"
|
||||
version = "0.8.1"
|
||||
version = "0.8.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "72d6e5c6afb84d73944e5cedb052c4680d5657337201555f9f2a16b7406d4954"
|
||||
checksum = "abe8c5fda708d9ca3df187cae8bfb9ceda00dd96231bed36e445a1a48e66f9ca"
|
||||
dependencies = [
|
||||
"stable_deref_trait",
|
||||
"yoke-derive",
|
||||
@ -3768,9 +3762,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "yoke-derive"
|
||||
version = "0.8.1"
|
||||
version = "0.8.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b659052874eb698efe5b9e8cf382204678a0086ebf46982b79d6ca3182927e5d"
|
||||
checksum = "de844c262c8848816172cef550288e7dc6c7b7814b4ee56b3e1553f275f1858e"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@ -3780,18 +3774,18 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "zerocopy"
|
||||
version = "0.8.47"
|
||||
version = "0.8.48"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "efbb2a062be311f2ba113ce66f697a4dc589f85e78a4aea276200804cea0ed87"
|
||||
checksum = "eed437bf9d6692032087e337407a86f04cd8d6a16a37199ed57949d415bd68e9"
|
||||
dependencies = [
|
||||
"zerocopy-derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zerocopy-derive"
|
||||
version = "0.8.47"
|
||||
version = "0.8.48"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0e8bc7269b54418e7aeeef514aa68f8690b8c0489a06b0136e5f57c4c5ccab89"
|
||||
checksum = "70e3cd084b1788766f53af483dd21f93881ff30d7320490ec3ef7526d203bad4"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@ -3800,18 +3794,18 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "zerofrom"
|
||||
version = "0.1.6"
|
||||
version = "0.1.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "50cc42e0333e05660c3587f3bf9d0478688e15d870fab3346451ce7f8c9fbea5"
|
||||
checksum = "69faa1f2a1ea75661980b013019ed6687ed0e83d069bc1114e2cc74c6c04c4df"
|
||||
dependencies = [
|
||||
"zerofrom-derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zerofrom-derive"
|
||||
version = "0.1.6"
|
||||
version = "0.1.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d71e5d6e06ab090c67b5e44993ec16b72dcbaabc526db883a360057678b48502"
|
||||
checksum = "11532158c46691caf0f2593ea8358fed6bbf68a0315e80aae9bd41fbade684a1"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@ -3827,9 +3821,9 @@ checksum = "b97154e67e32c85465826e8bcc1c59429aaaf107c1e4a9e53c8d8ccd5eff88d0"
|
||||
|
||||
[[package]]
|
||||
name = "zerotrie"
|
||||
version = "0.2.3"
|
||||
version = "0.2.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2a59c17a5562d507e4b54960e8569ebee33bee890c70aa3fe7b97e85a9fd7851"
|
||||
checksum = "0f9152d31db0792fa83f70fb2f83148effb5c1f5b8c7686c3459e361d9bc20bf"
|
||||
dependencies = [
|
||||
"displaydoc",
|
||||
"yoke",
|
||||
@ -3838,9 +3832,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "zerovec"
|
||||
version = "0.11.5"
|
||||
version = "0.11.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6c28719294829477f525be0186d13efa9a3c602f7ec202ca9e353d310fb9a002"
|
||||
checksum = "90f911cbc359ab6af17377d242225f4d75119aec87ea711a880987b18cd7b239"
|
||||
dependencies = [
|
||||
"yoke",
|
||||
"zerofrom",
|
||||
@ -3849,9 +3843,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "zerovec-derive"
|
||||
version = "0.11.2"
|
||||
version = "0.11.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "eadce39539ca5cb3985590102671f2567e659fca9666581ad3411d59207951f3"
|
||||
checksum = "625dc425cab0dca6dc3c3319506e6593dcb08a9f387ea3b284dbd52a92c40555"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
|
||||
43
bazel/wasm_rules/wit_bindgen_c.bzl
Normal file
43
bazel/wasm_rules/wit_bindgen_c.bzl
Normal file
@ -0,0 +1,43 @@
|
||||
"""Rule to generate C bindings from WIT files using wit-bindgen."""
|
||||
|
||||
def _wit_bindgen_c_impl(ctx):
|
||||
tool = ctx.executable.tool
|
||||
wit_file = ctx.file.wit
|
||||
|
||||
out_h = ctx.outputs.out_h
|
||||
out_c = ctx.outputs.out_c
|
||||
out_component_type = ctx.outputs.out_component_type
|
||||
|
||||
ctx.actions.run(
|
||||
inputs = [wit_file],
|
||||
outputs = [out_h, out_c, out_component_type],
|
||||
executable = tool,
|
||||
arguments = [
|
||||
"c",
|
||||
wit_file.dirname,
|
||||
"--out-dir",
|
||||
out_h.dirname,
|
||||
],
|
||||
mnemonic = "WitBindgenC",
|
||||
progress_message = "Generating C bindings from %s" % wit_file.short_path,
|
||||
)
|
||||
|
||||
wit_bindgen_c = rule(
|
||||
implementation = _wit_bindgen_c_impl,
|
||||
attrs = {
|
||||
"tool": attr.label(
|
||||
default = Label("@cargo_bindeps//:wit-bindgen-cli__wit-bindgen"),
|
||||
executable = True,
|
||||
cfg = "exec",
|
||||
doc = "wit-bindgen CLI executable.",
|
||||
),
|
||||
"wit": attr.label(
|
||||
allow_single_file = [".wit"],
|
||||
mandatory = True,
|
||||
doc = "Input .wit file.",
|
||||
),
|
||||
"out_h": attr.output(mandatory = True, doc = "Output C header file."),
|
||||
"out_c": attr.output(mandatory = True, doc = "Output C source file."),
|
||||
"out_component_type": attr.output(mandatory = True, doc = "Output component type .o file."),
|
||||
},
|
||||
)
|
||||
@ -2,6 +2,7 @@ load("//bazel/wasm_rules:wasm_cc_binary.bzl", "wasm_cc_binary")
|
||||
load("//bazel:mongo_src_rules.bzl", "mongo_cc_library", "mongo_cc_unit_test")
|
||||
load("//bazel/wasm_rules:embed_binary.bzl", "embed_binary_obj", "embed_binary_rc")
|
||||
load("//bazel/wasm_rules:wasm_aot_compile.bzl", "aot_compile_wasm")
|
||||
load("//bazel/wasm_rules:wit_bindgen_c.bzl", "wit_bindgen_c")
|
||||
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
@ -12,6 +13,14 @@ exports_files(
|
||||
]),
|
||||
)
|
||||
|
||||
wit_bindgen_c(
|
||||
name = "wit_bindgen_api",
|
||||
out_c = "api.c",
|
||||
out_component_type = "api_component_type.o",
|
||||
out_h = "api.h",
|
||||
wit = "//src/mongo/scripting/mozjs/wasm/wit:mozjs.wit",
|
||||
)
|
||||
|
||||
# Build SpiderMonkey tarball from source (manual, for re-uploading to S3).
|
||||
# If you want to try it locally replace spidermonkey_wasi module url with
|
||||
# file://<local_path>
|
||||
@ -54,18 +63,19 @@ mongo_cc_library(
|
||||
"wasmtime_engine.cpp",
|
||||
],
|
||||
) + [
|
||||
":api.c",
|
||||
"//src/mongo/scripting/mozjs/wasm/engine:api.cpp",
|
||||
"//src/mongo/scripting/mozjs/wasm/engine:engine.cpp",
|
||||
"//src/mongo/scripting/mozjs/wasm/engine:error.cpp",
|
||||
"//src/mongo/scripting/mozjs/wasm/engine:exception_stubs.cpp",
|
||||
"//src/mongo/scripting/mozjs/wasm/wit_gen/generated:api.c",
|
||||
],
|
||||
hdrs = [
|
||||
":api.h",
|
||||
"//src/mongo/scripting/mozjs/wasm/engine:engine.h",
|
||||
"//src/mongo/scripting/mozjs/wasm/engine:error.h",
|
||||
"//src/mongo/scripting/mozjs/wasm/engine:utils.h",
|
||||
"//src/mongo/scripting/mozjs/wasm/wit_gen/generated:api.h",
|
||||
],
|
||||
auto_header = False,
|
||||
copts = [
|
||||
"-include",
|
||||
"js-confdefs.h",
|
||||
@ -87,7 +97,7 @@ wasm_cc_binary(
|
||||
name = "mozjs_wasm_api",
|
||||
out = "mozjs_wasm_api.wasm",
|
||||
additional_linker_inputs = [
|
||||
"//src/mongo/scripting/mozjs/wasm/wit_gen/generated:api_component_type.o",
|
||||
":api_component_type.o",
|
||||
],
|
||||
linkopts = [
|
||||
"-mexec-model=reactor",
|
||||
|
||||
@ -27,7 +27,7 @@
|
||||
* it in the license file.
|
||||
*/
|
||||
|
||||
#include "mongo/scripting/mozjs/wasm/wit_gen/generated/api.h"
|
||||
#include "mongo/scripting/mozjs/wasm/api.h"
|
||||
|
||||
#include "mongo/bson/bsonelement.h"
|
||||
#include "mongo/bson/bsonobj.h"
|
||||
|
||||
@ -1,4 +1,6 @@
|
||||
# Add more methods to public API:
|
||||
# Add more methods to public API
|
||||
|
||||
Edit `mozjs.wit` to add new functions:
|
||||
|
||||
```
|
||||
world api {
|
||||
@ -7,19 +9,6 @@ world api {
|
||||
}
|
||||
```
|
||||
|
||||
# Install wit-gen on your dev VM
|
||||
|
||||
```
|
||||
cargo install --git https://github.com/bytecodealliance/wit-bindgen --locked wit-bindgen-cli
|
||||
```
|
||||
|
||||
# Run the bindgen
|
||||
|
||||
```
|
||||
cd src/mongo/scripting/mozjs/wasm
|
||||
wit-bindgen c ./wit --out-dir wit_gen/generated
|
||||
```
|
||||
|
||||
# Implement the symbol in engine/api.cpp
|
||||
|
||||
```
|
||||
@ -32,4 +21,6 @@ extern "C" int32_t exports_api_mynewfunc(void) {
|
||||
}
|
||||
```
|
||||
|
||||
# Commit the generated files in wit_gen/generated
|
||||
The C bindings (`api.c`, `api.h`, `api_component_type.o`) are generated
|
||||
automatically at build time by the `wit_bindgen_c` rule in
|
||||
`src/mongo/scripting/mozjs/wasm/BUILD.bazel`.
|
||||
|
||||
@ -1,7 +0,0 @@
|
||||
exports_files(
|
||||
glob([
|
||||
"*.h",
|
||||
"*.cpp",
|
||||
"*.defs",
|
||||
]),
|
||||
)
|
||||
@ -1,7 +0,0 @@
|
||||
exports_files(
|
||||
glob([
|
||||
"*.h",
|
||||
"*.c",
|
||||
"*.o",
|
||||
]),
|
||||
)
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,186 +0,0 @@
|
||||
// Generated by `wit-bindgen` 0.51.0. DO NOT EDIT!
|
||||
#ifndef __BINDINGS_API_H
|
||||
#define __BINDINGS_API_H
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
typedef struct api_string_t {
|
||||
uint8_t* ptr;
|
||||
size_t len;
|
||||
} api_string_t;
|
||||
|
||||
// Error codes mirrored from `err_code_t`.
|
||||
typedef uint8_t exports_mongo_mozjs_mozjs_err_code_t;
|
||||
|
||||
#define EXPORTS_MONGO_MOZJS_MOZJS_ERR_CODE_OK 0
|
||||
#define EXPORTS_MONGO_MOZJS_MOZJS_ERR_CODE_E_INVALID_ARG 1
|
||||
#define EXPORTS_MONGO_MOZJS_MOZJS_ERR_CODE_E_BAD_STATE 2
|
||||
#define EXPORTS_MONGO_MOZJS_MOZJS_ERR_CODE_E_NOMEM 3
|
||||
#define EXPORTS_MONGO_MOZJS_MOZJS_ERR_CODE_E_IO 4
|
||||
#define EXPORTS_MONGO_MOZJS_MOZJS_ERR_CODE_E_TIMEOUT 5
|
||||
#define EXPORTS_MONGO_MOZJS_MOZJS_ERR_CODE_E_NOT_SUPPORTED 6
|
||||
#define EXPORTS_MONGO_MOZJS_MOZJS_ERR_CODE_E_INTERNAL 7
|
||||
#define EXPORTS_MONGO_MOZJS_MOZJS_ERR_CODE_E_JSAPI_FAIL 8
|
||||
#define EXPORTS_MONGO_MOZJS_MOZJS_ERR_CODE_E_PENDING_EXCEPTION 9
|
||||
#define EXPORTS_MONGO_MOZJS_MOZJS_ERR_CODE_E_NO_EXCEPTION 10
|
||||
#define EXPORTS_MONGO_MOZJS_MOZJS_ERR_CODE_E_TERMINATED 11
|
||||
#define EXPORTS_MONGO_MOZJS_MOZJS_ERR_CODE_E_OOM 12
|
||||
#define EXPORTS_MONGO_MOZJS_MOZJS_ERR_CODE_E_COMPILE 13
|
||||
#define EXPORTS_MONGO_MOZJS_MOZJS_ERR_CODE_E_RUNTIME 14
|
||||
#define EXPORTS_MONGO_MOZJS_MOZJS_ERR_CODE_E_MODULE 15
|
||||
#define EXPORTS_MONGO_MOZJS_MOZJS_ERR_CODE_E_PROMISE_REJECTION 16
|
||||
#define EXPORTS_MONGO_MOZJS_MOZJS_ERR_CODE_E_STACK_OVERFLOW 17
|
||||
#define EXPORTS_MONGO_MOZJS_MOZJS_ERR_CODE_E_TYPE 18
|
||||
#define EXPORTS_MONGO_MOZJS_MOZJS_ERR_CODE_E_ENCODING 19
|
||||
|
||||
typedef struct {
|
||||
bool is_some;
|
||||
api_string_t val;
|
||||
} api_option_string_t;
|
||||
|
||||
// Mirrors `wasm_mozjs_error_t` (but as owned values).
|
||||
typedef struct exports_mongo_mozjs_mozjs_wasm_mozjs_error_t {
|
||||
exports_mongo_mozjs_mozjs_err_code_t code;
|
||||
api_option_string_t msg;
|
||||
api_option_string_t filename;
|
||||
api_option_string_t stack;
|
||||
uint32_t line;
|
||||
uint32_t column;
|
||||
} exports_mongo_mozjs_mozjs_wasm_mozjs_error_t;
|
||||
|
||||
typedef uint16_t exports_mongo_mozjs_mozjs_ok_t;
|
||||
|
||||
// Opaque function handle.
|
||||
typedef uint64_t exports_mongo_mozjs_mozjs_function_handle_t;
|
||||
|
||||
typedef struct {
|
||||
bool is_err;
|
||||
union {
|
||||
exports_mongo_mozjs_mozjs_ok_t ok;
|
||||
exports_mongo_mozjs_mozjs_wasm_mozjs_error_t err;
|
||||
} val;
|
||||
} exports_mongo_mozjs_mozjs_result_ok_wasm_mozjs_error_t;
|
||||
|
||||
typedef struct {
|
||||
uint8_t* ptr;
|
||||
size_t len;
|
||||
} api_list_u8_t;
|
||||
|
||||
typedef struct {
|
||||
bool is_err;
|
||||
union {
|
||||
exports_mongo_mozjs_mozjs_function_handle_t ok;
|
||||
exports_mongo_mozjs_mozjs_wasm_mozjs_error_t err;
|
||||
} val;
|
||||
} exports_mongo_mozjs_mozjs_result_function_handle_wasm_mozjs_error_t;
|
||||
|
||||
typedef struct {
|
||||
bool is_err;
|
||||
union {
|
||||
bool ok;
|
||||
exports_mongo_mozjs_mozjs_wasm_mozjs_error_t err;
|
||||
} val;
|
||||
} exports_mongo_mozjs_mozjs_result_bool_wasm_mozjs_error_t;
|
||||
|
||||
typedef struct {
|
||||
bool is_err;
|
||||
union {
|
||||
api_list_u8_t ok;
|
||||
exports_mongo_mozjs_mozjs_wasm_mozjs_error_t err;
|
||||
} val;
|
||||
} exports_mongo_mozjs_mozjs_result_list_u8_wasm_mozjs_error_t;
|
||||
|
||||
typedef struct {
|
||||
bool is_some;
|
||||
int64_t val;
|
||||
} api_option_s64_t;
|
||||
|
||||
// Exported Functions from `mongo:mozjs/mozjs`
|
||||
bool exports_mongo_mozjs_mozjs_initialize_engine(exports_mongo_mozjs_mozjs_ok_t* ret,
|
||||
exports_mongo_mozjs_mozjs_wasm_mozjs_error_t* err);
|
||||
bool exports_mongo_mozjs_mozjs_shutdown_engine(exports_mongo_mozjs_mozjs_ok_t* ret,
|
||||
exports_mongo_mozjs_mozjs_wasm_mozjs_error_t* err);
|
||||
bool exports_mongo_mozjs_mozjs_interrupt_current_op(
|
||||
exports_mongo_mozjs_mozjs_ok_t* ret, exports_mongo_mozjs_mozjs_wasm_mozjs_error_t* err);
|
||||
bool exports_mongo_mozjs_mozjs_create_function(api_list_u8_t* source,
|
||||
exports_mongo_mozjs_mozjs_function_handle_t* ret,
|
||||
exports_mongo_mozjs_mozjs_wasm_mozjs_error_t* err);
|
||||
bool exports_mongo_mozjs_mozjs_invoke_function(exports_mongo_mozjs_mozjs_function_handle_t handle,
|
||||
api_list_u8_t* bson,
|
||||
exports_mongo_mozjs_mozjs_ok_t* ret,
|
||||
exports_mongo_mozjs_mozjs_wasm_mozjs_error_t* err);
|
||||
bool exports_mongo_mozjs_mozjs_invoke_predicate(exports_mongo_mozjs_mozjs_function_handle_t handle,
|
||||
api_list_u8_t* document,
|
||||
bool* ret,
|
||||
exports_mongo_mozjs_mozjs_wasm_mozjs_error_t* err);
|
||||
bool exports_mongo_mozjs_mozjs_invoke_map(exports_mongo_mozjs_mozjs_function_handle_t handle,
|
||||
api_list_u8_t* document,
|
||||
exports_mongo_mozjs_mozjs_ok_t* ret,
|
||||
exports_mongo_mozjs_mozjs_wasm_mozjs_error_t* err);
|
||||
bool exports_mongo_mozjs_mozjs_get_return_value_bson(
|
||||
api_list_u8_t* ret, exports_mongo_mozjs_mozjs_wasm_mozjs_error_t* err);
|
||||
bool exports_mongo_mozjs_mozjs_set_global(api_string_t* name,
|
||||
api_list_u8_t* bson_value,
|
||||
exports_mongo_mozjs_mozjs_ok_t* ret,
|
||||
exports_mongo_mozjs_mozjs_wasm_mozjs_error_t* err);
|
||||
bool exports_mongo_mozjs_mozjs_get_global(api_string_t* name,
|
||||
api_list_u8_t* ret,
|
||||
exports_mongo_mozjs_mozjs_wasm_mozjs_error_t* err);
|
||||
bool exports_mongo_mozjs_mozjs_set_global_value(api_string_t* name,
|
||||
api_list_u8_t* bson_element,
|
||||
exports_mongo_mozjs_mozjs_ok_t* ret,
|
||||
exports_mongo_mozjs_mozjs_wasm_mozjs_error_t* err);
|
||||
bool exports_mongo_mozjs_mozjs_setup_emit(int64_t* maybe_byte_limit,
|
||||
exports_mongo_mozjs_mozjs_ok_t* ret,
|
||||
exports_mongo_mozjs_mozjs_wasm_mozjs_error_t* err);
|
||||
bool exports_mongo_mozjs_mozjs_drain_emit_buffer(api_list_u8_t* ret,
|
||||
exports_mongo_mozjs_mozjs_wasm_mozjs_error_t* err);
|
||||
|
||||
// Helper Functions
|
||||
|
||||
void api_option_string_free(api_option_string_t* ptr);
|
||||
|
||||
void exports_mongo_mozjs_mozjs_wasm_mozjs_error_free(
|
||||
exports_mongo_mozjs_mozjs_wasm_mozjs_error_t* ptr);
|
||||
|
||||
void exports_mongo_mozjs_mozjs_result_ok_wasm_mozjs_error_free(
|
||||
exports_mongo_mozjs_mozjs_result_ok_wasm_mozjs_error_t* ptr);
|
||||
|
||||
void api_list_u8_free(api_list_u8_t* ptr);
|
||||
|
||||
void exports_mongo_mozjs_mozjs_result_function_handle_wasm_mozjs_error_free(
|
||||
exports_mongo_mozjs_mozjs_result_function_handle_wasm_mozjs_error_t* ptr);
|
||||
|
||||
void exports_mongo_mozjs_mozjs_result_bool_wasm_mozjs_error_free(
|
||||
exports_mongo_mozjs_mozjs_result_bool_wasm_mozjs_error_t* ptr);
|
||||
|
||||
void exports_mongo_mozjs_mozjs_result_list_u8_wasm_mozjs_error_free(
|
||||
exports_mongo_mozjs_mozjs_result_list_u8_wasm_mozjs_error_t* ptr);
|
||||
|
||||
void api_option_s64_free(api_option_s64_t* ptr);
|
||||
|
||||
// Sets the string `ret` to reference the input string `s` without copying it
|
||||
void api_string_set(api_string_t* ret, const char* s);
|
||||
|
||||
// Creates a copy of the input nul-terminated string `s` and
|
||||
// stores it into the component model string `ret`.
|
||||
void api_string_dup(api_string_t* ret, const char* s);
|
||||
|
||||
// Creates a copy of the input string `s` with length `len` and
|
||||
// stores it into the component model string `ret`.
|
||||
// The length is specified in code units (bytes for UTF-8, 16-bit values for UTF-16).
|
||||
void api_string_dup_n(api_string_t* ret, const char* s, size_t len);
|
||||
|
||||
// Deallocates the string pointed to by `ret`, deallocating
|
||||
// the memory behind the string.
|
||||
void api_string_free(api_string_t* ret);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
Binary file not shown.
Loading…
Reference in New Issue
Block a user