-
Notifications
You must be signed in to change notification settings - Fork 115
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create plugin-api crate and move most of core's logic into it #795
Merged
+321
−193
Merged
Changes from 1 commit
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it intended to have this dependency at the workspace level? I think it's not shared across any other crates in the workspace, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can move it out of the workspace into
javy-core
. For some reason I thought thejavy
crate was only used byjavy-core
but I can see after looking that the fuzzer also uses it.