Skip to content

Commit

Permalink
Allow specifying packages with . in their names
Browse files Browse the repository at this point in the history
this is done by internally replacing all the `.` with `-`.
  • Loading branch information
ayys committed Feb 12, 2024
1 parent dcf446e commit c22e03a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 3 additions & 4 deletions crates/wasmer-pack/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -219,11 +219,10 @@ fn parse_identifier(s: &str) -> Result<String, Error> {
);
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.
Expand Down

0 comments on commit c22e03a

Please sign in to comment.