From ad272eede7aefdfd371088c8d2aa380a320f3fe5 Mon Sep 17 00:00:00 2001 From: Ayush Jha Date: Mon, 12 Feb 2024 14:30:09 +0545 Subject: [PATCH 1/2] Allow specifying packages with `.` in their names this is done by internally replacing all the `.` with `-`. --- CHANGELOG.md | 4 ++++ crates/wasmer-pack/src/types.rs | 7 +++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9c2c46db13..468362c70a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,10 @@ change, where applicable. ## [Unreleased] - ReleaseDate +- Allow packages with `.` in their names. This is useful for packages + `my-website.com`. Internally, the `.` is converted into a `-` to + make it a valid binding name. + ### Added - Added ability to pass in a user-specified name for the generated bindings. This can be done by passing in the `--name` flag in the diff --git a/crates/wasmer-pack/src/types.rs b/crates/wasmer-pack/src/types.rs index 14b29d4239..71504cdf60 100644 --- a/crates/wasmer-pack/src/types.rs +++ b/crates/wasmer-pack/src/types.rs @@ -219,11 +219,10 @@ fn parse_identifier(s: &str) -> Result { ); anyhow::ensure!( s.chars() - .all(|c| c.is_ascii_alphanumeric() || matches!(c, '-' | '_')), - "Identifiers can only contain '-', '_', ascii numbers, and letters" + .all(|c| c.is_ascii_alphanumeric() || matches!(c, '-' | '_' | '.')), + "Identifiers can only contain '-', '_', '.', ascii numbers, and letters" ); - - Ok(s.to_string()) + Ok(s.replace('.', "-")) } /// Information about the [`Package`] being generated. From bafa228c7e6a9d06860517e732aa4ad8b7707369 Mon Sep 17 00:00:00 2001 From: Ayush Jha Date: Mon, 12 Feb 2024 14:46:06 +0545 Subject: [PATCH 2/2] setup rust stable Sometimes the rust toolchain was not properly installed this installs the rust toolchain before running cargo. Fixes errors about rustc being out of date. --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d375b80fc3..486776e27a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -52,7 +52,7 @@ jobs: uses: actions-rs/cargo@v1 with: command: install - args: cargo-wasmer --verbose --debug --version '^0.4' + args: cargo-wasmer --verbose --debug --version '^0.4' --locked - name: Type Checking uses: actions-rs/cargo@v1 with: