-
Notifications
You must be signed in to change notification settings - Fork 108
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fix multiword exports * Rename exports function
- Loading branch information
1 parent
34de4ed
commit f83174e
Showing
11 changed files
with
73 additions
and
36 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
use anyhow::{anyhow, Result}; | ||
use convert_case::{Case, Casing}; | ||
use std::path::Path; | ||
|
||
use crate::{js::JS, wit}; | ||
|
||
pub struct Export { | ||
pub wit: String, | ||
pub js: String, | ||
} | ||
|
||
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)? | ||
.into_iter() | ||
.map(|wit_export| { | ||
let export = wit_export.from_case(Case::Kebab).to_case(Case::Camel); | ||
if !js_exports.contains(&export) { | ||
Err(anyhow!("JS module does not export {export}")) | ||
} else { | ||
Ok(Export { | ||
wit: wit_export, | ||
js: export, | ||
}) | ||
} | ||
}) | ||
.collect::<Result<Vec<Export>>>() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,4 +3,5 @@ package local:test | |
world exported-fn { | ||
export foo: func() | ||
export bar: func() | ||
export foo-bar: func() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1130,6 +1130,12 @@ who = "Johan Andersson <[email protected]>" | |
criteria = "safe-to-deploy" | ||
version = "1.0.58" | ||
|
||
[[audits.embark-studios.audits.convert_case]] | ||
who = "Johan Andersson <[email protected]>" | ||
criteria = "safe-to-deploy" | ||
version = "0.4.0" | ||
notes = "No unsafe usage or ambient capabilities" | ||
|
||
[[audits.embark-studios.audits.epaint]] | ||
who = "Johan Andersson <[email protected]>" | ||
criteria = "safe-to-deploy" | ||
|