-
Notifications
You must be signed in to change notification settings - Fork 115
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create plugin-api crate and move most of core's logic into it (#795)
* Create plugin-api crate and move most of core's logic into it * Add rust to example usage Co-authored-by: Saúl Cabrera <[email protected]> * Move dependency out of workspace --------- Co-authored-by: Saúl Cabrera <[email protected]>
- Loading branch information
1 parent
dbb3c32
commit d4d6f07
Showing
12 changed files
with
321 additions
and
193 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
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 was deleted.
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,11 @@ | ||
# Changelog | ||
|
||
All notable changes to this project will be documented in this file. | ||
|
||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), | ||
and this project adheres to [Semantic | ||
Versioning](https://semver.org/spec/v2.0.0.html). | ||
|
||
## [Unreleased] | ||
|
||
Initial release |
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,18 @@ | ||
[package] | ||
name = "javy-plugin-api" | ||
version = "1.0.0-alpha.1" | ||
authors.workspace = true | ||
edition.workspace = true | ||
license.workspace = true | ||
description = "APIs for Javy plugins" | ||
homepage = "https://github.com/bytecodealliance/javy/tree/main/crates/javy-plugin-api" | ||
repository = "https://github.com/bytecodealliance/javy/tree/main/crates/javy-plugin-api" | ||
categories = ["wasm"] | ||
|
||
[dependencies] | ||
anyhow = { workspace = true } | ||
javy = { workspace = true, features = ["export_alloc_fns"] } | ||
|
||
[features] | ||
experimental_event_loop = [] | ||
json = ["javy/json"] |
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,37 @@ | ||
<div align="center"> | ||
<h1><code>javy-plugin-api</code></h1> | ||
<p> | ||
<strong>A crate for creating Javy plugins</strong> | ||
</p> | ||
<p> | ||
<a href="https://docs.rs/javy-plugin-api"><img src="https://docs.rs/javy-plugin-api/badge.svg" alt="Documentation Status" /></a> | ||
<a href="https://crates.io/crates/javy-plugin-api"><img src="https://img.shields.io/crates/v/javy-plugin-api.svg" alt="crates.io status" /></a> | ||
</p> | ||
</div> | ||
|
||
Refer to the [crate level documentation](https://docs.rs/javy-plugin-api) to learn more. | ||
|
||
Example usage: | ||
|
||
```rust | ||
use javy_plugin_api::import_namespace; | ||
use javy_plugin_api::javy::Config; | ||
|
||
// Dynamically linked modules will use `my_javy_plugin_v1` as the import | ||
// namespace. | ||
import_namespace!("my_javy_plugin_v1"); | ||
|
||
#[export_name = "initialize_runtime"] | ||
pub extern "C" fn initialize_runtime() { | ||
let mut config = Config::default(); | ||
config | ||
.text_encoding(true) | ||
.javy_stream_io(true); | ||
|
||
javy_plugin_api::initialize_runtime(config, |runtime| runtime).unwrap(); | ||
} | ||
``` | ||
|
||
## Publishing to crates.io | ||
|
||
To publish this crate to crates.io, run `./publish.sh`. |
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,5 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
|
||
cargo publish --target=wasm32-wasip1 |
Oops, something went wrong.