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
10 changes: 5 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ serde-wasm-bindgen = "0.6.5"
syn = "2.0.17"
proc-macro2 = "1.0.60"
quote = "1.0.28"
wasm-bindgen = { version = "0.2.108" }
wasm-bindgen-cli-support = { version = "0.2.108" }
wasm-bindgen-futures = { version = "0.4.57" }
wasm-bindgen-macro-support = { version = "0.2.108" }
wasm-bindgen-shared = { version = "0.2.108" }
wasm-bindgen = { version = "0.2.106" }
wasm-bindgen-cli-support = { version = "0.2.106" }
wasm-bindgen-futures = { version = "0.4.56" }
wasm-bindgen-macro-support = { version = "0.2.106" }
wasm-bindgen-shared = { version = "0.2.106" }
wasm-bindgen-test = { version = "0.3.58" }
web-sys = { version = "0.3.85", features = [
"AbortController",
Expand Down
8 changes: 4 additions & 4 deletions worker-build/src/binary.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::build::PBAR;
use crate::emoji::{CONFIG, DOWN_ARROW};
use crate::versions::{CUR_ESBUILD_VERSION, CUR_WASM_BINDGEN_VERSION, CUR_WASM_OPT_VERSION};
use crate::versions::{CUR_ESBUILD_VERSION, CUR_WASM_OPT_VERSION};
use anyhow::{bail, Context, Result};
use flate2::read::GzDecoder;
use heck::ToShoutySnakeCase;
Expand Down Expand Up @@ -260,17 +260,17 @@ impl BinaryDep for WasmOpt {
}
}

pub struct WasmBindgen;
pub struct WasmBindgen<'a>(pub &'a str);

impl BinaryDep for WasmBindgen {
impl BinaryDep for WasmBindgen<'_> {
fn full_name(&self) -> &'static str {
"Wasm Bindgen"
}
fn name(&self) -> &'static str {
"wasm-bindgen"
}
fn version(&self) -> String {
CUR_WASM_BINDGEN_VERSION.to_string()
self.0.to_owned()
}
fn target(&self) -> &'static str {
match (std::env::consts::OS, std::env::consts::ARCH) {
Expand Down
30 changes: 18 additions & 12 deletions worker-build/src/build/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use crate::binary::{GetBinary, WasmOpt};
use crate::emoji;
use crate::lockfile::{DepCheckError, Lockfile};
use crate::versions::{
CUR_WASM_BINDGEN_VERSION, CUR_WORKER_VERSION, MIN_WASM_BINDGEN_LIB_VERSION,
CUR_WORKER_VERSION, LATEST_WASM_BINDGEN_VERSION, MIN_WASM_BINDGEN_LIB_VERSION,
MIN_WORKER_LIB_VERSION,
};

Expand Down Expand Up @@ -47,6 +47,7 @@ pub struct Build {
pub bindgen_override: bool,
pub extra_args: Vec<String>,
pub extra_options: Vec<String>,
pub wasm_bindgen_version: Option<String>,
}

/// What sort of output we're going to be generating and flags we're invoking
Expand Down Expand Up @@ -206,6 +207,7 @@ impl Build {
bindgen_override: false,
extra_args: Vec::new(),
extra_options: build_opts.extra_options,
wasm_bindgen_version: None,
})
}

Expand Down Expand Up @@ -372,23 +374,27 @@ impl Build {
DepCheckError::Error(err) => err,
})?;

lockfile
.require_lib(
"wasm-bindgen",
&MIN_WASM_BINDGEN_LIB_VERSION,
&CUR_WASM_BINDGEN_VERSION,
)
.map_err(|err| match err {
DepCheckError::VersionError(msg, _) => anyhow!(msg),
DepCheckError::Error(err) => anyhow!(err),
})?;
self.wasm_bindgen_version = Some(
lockfile
.require_lib(
"wasm-bindgen",
&MIN_WASM_BINDGEN_LIB_VERSION,
&LATEST_WASM_BINDGEN_VERSION,
)
.map_err(|err| match err {
DepCheckError::VersionError(msg, _) => anyhow!(msg),
DepCheckError::Error(err) => anyhow!(err),
})?
.to_string(),
);
Ok(())
}

fn step_install_wasm_bindgen(&mut self) -> Result<()> {
info!("Installing wasm-bindgen-cli...");
use crate::binary::{GetBinary, WasmBindgen};
let (bindgen, bindgen_override) = WasmBindgen.get_binary(None)?;
let (bindgen, bindgen_override) =
WasmBindgen(self.wasm_bindgen_version.as_ref().unwrap()).get_binary(None)?;
self.bindgen = Some(bindgen);
self.bindgen_override = bindgen_override;
info!("Installing wasm-bindgen-cli was successful.");
Expand Down
8 changes: 4 additions & 4 deletions worker-build/src/lockfile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ impl Lockfile {
lib_name: &str,
min_version: &Version,
cur_version: &Version,
) -> Result<(), DepCheckError> {
) -> Result<Version, DepCheckError> {
let req = VersionReq::parse(&format!("^{min_version}")).unwrap();
if let Some(version) = self
.get_package_version(lib_name)
Expand All @@ -68,16 +68,16 @@ impl Lockfile {
Some(version),
));
}
Ok(version)
} else {
return Err(DepCheckError::VersionError(
Err(DepCheckError::VersionError(
format!(
"Ensure that you have dependency {}",
cargo_dep_error(lib_name, cur_version)
),
None,
));
))
}
Ok(())
}

/// Obtains the package version for the given package
Expand Down
4 changes: 2 additions & 2 deletions worker-build/src/versions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ macro_rules! version {
}

// Current build toolchain, always used exactly for builds, unless overridden by {}_BIN env vars
pub(crate) static CUR_WASM_BINDGEN_VERSION: LazyLock<semver::Version> = version!("0.2.108");
pub(crate) static LATEST_WASM_BINDGEN_VERSION: LazyLock<semver::Version> = version!("0.2.108");
pub(crate) static CUR_WASM_OPT_VERSION: &str = "125";
pub(crate) static CUR_ESBUILD_VERSION: LazyLock<semver::Version> = version!("0.27.2");

// Minimum required libraries, validated before build
pub(crate) static MIN_WASM_BINDGEN_LIB_VERSION: LazyLock<semver::Version> = version!("0.2.108"); // 0.2.108 schema version
pub(crate) static MIN_WASM_BINDGEN_LIB_VERSION: LazyLock<semver::Version> = version!("0.2.106");
pub(crate) static MIN_RUSTC_VERSION: LazyLock<semver::Version> = version!("1.71.0"); // wasm-bindgen MSRV

pub(crate) static MIN_WORKER_LIB_VERSION: LazyLock<semver::Version> = version!(&format!(
Expand Down
Loading