-
Notifications
You must be signed in to change notification settings - Fork 122
Migrated code generation logic to it's own crate #890
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
Changes from all commits
3541357
de3827b
6ba99d3
11229c6
ae36df3
6ff11b8
2c30f30
45e3084
770e96d
736f01f
0830fc9
64a04b6
a1a8511
edfb5c6
fc91898
7c3799b
5bb8aae
File filter
Filter by extension
Conversations
Jump to
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.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
[workspace] | ||
members = [ | ||
"crates/cli", | ||
"crates/codegen", | ||
"crates/javy", | ||
"crates/plugin", | ||
"crates/plugin-api", | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
default_plugin.wasm |
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). | ||
|
||
## [1.0.0] - 2025-2-15 | ||
|
||
Initial release |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
[package] | ||
name = "javy-codegen" | ||
version = "1.0.0-alpha.1" | ||
authors.workspace = true | ||
edition.workspace = true | ||
license.workspace = true | ||
description = "Wasm generation library for use with Javy" | ||
homepage = "https://github.com/bytecodealliance/javy/tree/main/crates/codegen" | ||
repository = "https://github.com/bytecodealliance/javy/tree/main/crates/codegen" | ||
categories = ["wasm"] | ||
|
||
[features] | ||
plugin_internal = [] | ||
dump_wat = ["dep:wasmprinter"] | ||
|
||
[dependencies] | ||
wizer = { workspace = true } | ||
anyhow = { workspace = true } | ||
brotli = "7.0.0" | ||
wasmprinter = { version = "0.224.0", optional = true } | ||
wasmtime = { workspace = true } | ||
wasmtime-wasi = { workspace = true } | ||
wasi-common = { workspace = true } | ||
walrus = "0.23.3" | ||
swc_core = { version = "10.7.0", features = [ | ||
"common_sourcemap", | ||
"ecma_ast", | ||
"ecma_parser", | ||
] } | ||
wit-parser = "0.212.0" | ||
convert_case = "0.8.0" | ||
wasm-opt = "0.116.1" | ||
tempfile = { workspace = true } |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<div align="center"> | ||
<h1><code>javy-codegen</code></h1> | ||
<p> | ||
<strong>A crate for generating Wasm modules using Javy</strong> | ||
</p> | ||
<p> | ||
<a href="https://docs.rs/javy-codegen"><img src="https://docs.rs/javy-codegen/badge.svg" alt="Documentation Status" /></a> | ||
<a href="https://crates.io/crates/javy-codegen"><img src="https://img.shields.io/crates/v/javy-codegen" alt="crates.io status" /></a> | ||
</p> | ||
</div> | ||
|
||
Refer to the [crate level documentation](https://docs.rs/javy-codegen) to learn more. | ||
|
||
Example usage: | ||
|
||
```rust | ||
use std::path::Path; | ||
use javy_codegen::{Generator, LinkingKind, Plugin, JS}; | ||
|
||
fn main() { | ||
// Load your target Javascript. | ||
let js = JS::from_file(Path::new("example.js")); | ||
|
||
// Load existing pre-initialized Javy plugin. | ||
let plugin = Plugin::new_from_path(Path::new("example-plugin.wasm")); | ||
|
||
// Configure code generator. | ||
let mut generator = Generator::new(); | ||
generator.plugin(plugin); | ||
generator.linking(LinkingKind::Static); | ||
|
||
// Generate your Wasm module. | ||
let wasm = generator.generate(&js)?; | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we also add an automated integration test for this example code in this crate? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For the integration tests (and I suppose some of the unit tests too) how would you prefer that we deal with the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could we run |
||
``` |
Uh oh!
There was an error while loading. Please reload this page.