Skip to content

Commit

Permalink
Merge branch 'bytecodealliance:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
TheEdward162 authored Jan 2, 2024
2 parents 2d3f568 + 0df708e commit 5faecee
Show file tree
Hide file tree
Showing 9 changed files with 364 additions and 164 deletions.
251 changes: 177 additions & 74 deletions Cargo.lock

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions crates/cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,24 @@ structopt = "0.3"
anyhow = { workspace = true }
binaryen = { git = "https://github.com/pepyakin/binaryen-rs", rev = "00c98174843f957681ba0bc5cdcc9d15f5d0cb23" }
brotli = "3.4.0"
wasmprinter = { version = "0.2.71", optional = true }
wasmprinter = { version = "0.2.75", optional = true }
wasmtime = { workspace = true }
wasmtime-wasi = { workspace = true }
wasi-common = { workspace = true }
walrus = "0.20.1"
swc_core = { version = "0.86.29", features = ["common_sourcemap", "ecma_ast", "ecma_parser"] }
wit-parser = "0.12.2"
walrus = "0.20.3"
swc_core = { version = "0.86.39", features = ["common_sourcemap", "ecma_ast", "ecma_parser"] }
wit-parser = "0.13.0"
convert_case = "0.6.0"

[dev-dependencies]
serde_json = "1.0"
uuid = { version = "1.5", features = ["v4"] }
uuid = { version = "1.6", features = ["v4"] }
lazy_static = "1.4"
serde = { version = "1.0", default-features = false, features = ["derive"] }
criterion = "0.5"
num-format = "0.4.4"
tempfile = "3.8.0"
wasmparser = "0.116.0"
wasmparser = "0.118.1"

[build-dependencies]
anyhow = "1.0.75"
Expand Down
24 changes: 22 additions & 2 deletions crates/cli/src/exports.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use anyhow::{anyhow, Result};
use convert_case::{Case, Casing};
use std::path::Path;
use std::{env, path::Path};

use crate::{js::JS, wit};

Expand All @@ -11,7 +11,7 @@ pub struct Export {

pub fn process_exports(js: &JS, wit: &Path, wit_world: &str) -> Result<Vec<Export>> {
let js_exports = js.exports()?;
wit::parse_exports(wit, wit_world)?
parse_wit_exports(wit, wit_world)?
.into_iter()
.map(|wit_export| {
let export = wit_export.from_case(Case::Kebab).to_case(Case::Camel);
Expand All @@ -26,3 +26,23 @@ pub fn process_exports(js: &JS, wit: &Path, wit_world: &str) -> Result<Vec<Expor
})
.collect::<Result<Vec<Export>>>()
}

fn parse_wit_exports(wit: &Path, wit_world: &str) -> Result<Vec<String>> {
// Configure wit-parser to not require semicolons but only if the relevant
// environment variable is not already set.
const SEMICOLONS_OPTIONAL_ENV_VAR: &str = "WIT_REQUIRE_SEMICOLONS";
let semicolons_env_var_already_set = env::var(SEMICOLONS_OPTIONAL_ENV_VAR).is_ok();
if !semicolons_env_var_already_set {
env::set_var(SEMICOLONS_OPTIONAL_ENV_VAR, "0");
}

let exports = wit::parse_exports(wit, wit_world);

// If we set the environment variable to not require semicolons, remove
// that environment variable now that we no longer need it set.
if !semicolons_env_var_already_set {
env::remove_var(SEMICOLONS_OPTIONAL_ENV_VAR);
}

exports
}
8 changes: 5 additions & 3 deletions crates/quickjs-wasm-sys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ cc = "1.0"
bindgen = "0.69.1"
walkdir = "2"
anyhow.workspace = true
tokio = { version = "1.33", default-features = false, features = ["rt", "macros"] }
hyper = { version = "0.14.27", features = ["client", "http1"] }
hyper-tls = "0.5.0"
tokio = { version = "1.34", default-features = false, features = ["rt", "macros"] }
http-body-util = "0.1.0"
hyper = "1.0"
hyper-tls = "0.6.0"
hyper-util = { version = "0.1.0", features = ["http1"] }
24 changes: 15 additions & 9 deletions crates/quickjs-wasm-sys/build.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
use anyhow::{anyhow, bail, Result};
use hyper::body::HttpBody;
use hyper::{Body, Client, Response};
use anyhow::{anyhow, bail, Error, Result};
use http_body_util::combinators::BoxBody;
use http_body_util::BodyExt;
use hyper::body::{Bytes, Incoming};
use hyper::Response;
use hyper_tls::HttpsConnector;
use hyper_util::client::legacy::Client;
use hyper_util::rt::TokioExecutor;
use std::io::Write;
use std::path::{Path, PathBuf};
use std::{env, fs, process};
Expand Down Expand Up @@ -41,8 +45,9 @@ async fn download_wasi_sdk() -> Result<PathBuf> {

let mut uri = format!("https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-{major_version}/wasi-sdk-{major_version}.{minor_version}-{file_suffix}.tar.gz");

let client = Client::builder().build::<_, hyper::Body>(HttpsConnector::new());
let mut response: Response<Body> = loop {
let client = Client::builder(TokioExecutor::new())
.build::<_, BoxBody<Bytes, Error>>(HttpsConnector::new());
let mut response: Response<Incoming> = loop {
let response = client.get(uri.try_into()?).await?;
let status = response.status();
if status.is_redirection() {
Expand All @@ -61,10 +66,11 @@ async fn download_wasi_sdk() -> Result<PathBuf> {

let mut archive = fs::File::create(&archive_path)?;

while let Some(chunk) = response.body_mut().data().await {
archive.write_all(&chunk.map_err(|err| {
anyhow!("Something went wrong when downloading the WASI SDK: {err}")
})?)?;
while let Some(next) = response.frame().await {
let frame = next?;
if let Some(chunk) = frame.data_ref() {
archive.write_all(chunk)?;
}
}
}

Expand Down
44 changes: 22 additions & 22 deletions npm/javy/package-lock.json

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

18 changes: 18 additions & 0 deletions supply-chain/audits.toml
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,12 @@ user-id = 359 # Sean McArthur (seanmonstar)
start = "2019-03-19"
end = "2024-10-27"

[[trusted.hyper-util]]
criteria = "safe-to-deploy"
user-id = 359 # Sean McArthur (seanmonstar)
start = "2022-01-15"
end = "2024-12-01"

[[trusted.io-extras]]
criteria = "safe-to-deploy"
user-id = 6825 # Dan Gohman (sunfishcode)
Expand Down Expand Up @@ -339,6 +345,18 @@ user-id = 189 # Andrew Gallant (BurntSushi)
start = "2019-06-04"
end = "2024-10-03"

[[trusted.tokio]]
criteria = "safe-to-deploy"
user-id = 10 # Carl Lerche (carllerche)
start = "2019-03-02"
end = "2024-12-04"

[[trusted.tokio-macros]]
criteria = "safe-to-deploy"
user-id = 10 # Carl Lerche (carllerche)
start = "2019-04-24"
end = "2024-12-04"

[[trusted.unicode-ident]]
criteria = "safe-to-deploy"
user-id = 3618 # David Tolnay (dtolnay)
Expand Down
46 changes: 23 additions & 23 deletions supply-chain/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -277,10 +277,6 @@ criteria = "safe-to-deploy"
version = "0.3.1"
criteria = "safe-to-deploy"

[[exemptions.http-body]]
version = "0.4.5"
criteria = "safe-to-deploy"

[[exemptions.humantime]]
version = "2.1.0"
criteria = "safe-to-deploy"
Expand Down Expand Up @@ -405,6 +401,14 @@ criteria = "safe-to-deploy"
version = "0.10.0"
criteria = "safe-to-deploy"

[[exemptions.pin-project]]
version = "1.1.3"
criteria = "safe-to-deploy"

[[exemptions.pin-project-internal]]
version = "1.1.3"
criteria = "safe-to-deploy"

[[exemptions.pin-project-lite]]
version = "0.2.13"
criteria = "safe-to-deploy"
Expand Down Expand Up @@ -521,10 +525,6 @@ criteria = "safe-to-deploy"
version = "1.0.1"
criteria = "safe-to-deploy"

[[exemptions.socket2]]
version = "0.4.10"
criteria = "safe-to-deploy"

[[exemptions.socket2]]
version = "0.5.5"
criteria = "safe-to-deploy"
Expand Down Expand Up @@ -574,31 +574,31 @@ version = "0.6.0"
criteria = "safe-to-deploy"

[[exemptions.swc_common]]
version = "0.33.2"
version = "0.33.4"
criteria = "safe-to-deploy"

[[exemptions.swc_core]]
version = "0.86.29"
version = "0.86.39"
criteria = "safe-to-deploy"

[[exemptions.swc_ecma_ast]]
version = "0.110.2"
version = "0.110.5"
criteria = "safe-to-deploy"

[[exemptions.swc_ecma_parser]]
version = "0.141.7"
version = "0.141.13"
criteria = "safe-to-deploy"

[[exemptions.swc_ecma_transforms_base]]
version = "0.134.14"
version = "0.134.21"
criteria = "safe-to-deploy"

[[exemptions.swc_ecma_utils]]
version = "0.124.12"
version = "0.124.18"
criteria = "safe-to-deploy"

[[exemptions.swc_ecma_visit]]
version = "0.96.2"
version = "0.96.5"
criteria = "safe-to-deploy"

[[exemptions.swc_eq_ignore_macros]]
Expand Down Expand Up @@ -637,16 +637,16 @@ criteria = "safe-to-deploy"
version = "1.2.1"
criteria = "safe-to-run"

[[exemptions.tokio]]
version = "1.33.0"
[[exemptions.toml]]
version = "0.5.8"
criteria = "safe-to-deploy"

[[exemptions.tokio-macros]]
version = "1.7.0"
[[exemptions.tower]]
version = "0.4.13"
criteria = "safe-to-deploy"

[[exemptions.toml]]
version = "0.5.8"
[[exemptions.tower-layer]]
version = "0.3.2"
criteria = "safe-to-deploy"

[[exemptions.tower-service]]
Expand Down Expand Up @@ -682,15 +682,15 @@ version = "0.3.3"
criteria = "safe-to-deploy"

[[exemptions.uuid]]
version = "1.5.0"
version = "1.6.1"
criteria = "safe-to-deploy"

[[exemptions.vergen]]
version = "7.5.1"
criteria = "safe-to-deploy"

[[exemptions.walrus]]
version = "0.20.1"
version = "0.20.3"
criteria = "safe-to-deploy"

[[exemptions.walrus-macro]]
Expand Down
Loading

0 comments on commit 5faecee

Please sign in to comment.