-
Notifications
You must be signed in to change notification settings - Fork 118
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
Migrated code generation logic to it's own crate #890
base: main
Are you sure you want to change the base?
Changes from all commits
3541357
de3827b
6ba99d3
11229c6
ae36df3
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,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.workspace = true | ||
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.7.1" | ||
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.generator(&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 put this in the module docs as well? 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 comment
The reason will be displayed to describe this comment to others. Learn more.
Can we set this to "1.0.0-alpha.1" for now?
I want to version this crate independently of the CLI and
javy
library crate. The programmatic interface and default behaviour of the CLI can change independently of the API of this crate so I'd prefer not to couple the versions together.