Skip to content
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

Add WASM Support #1

Merged
merged 9 commits into from
Dec 16, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,7 @@

# Zap Input & Output
/network
net.zap
net.zap

# WASM
zap/pkg
86 changes: 81 additions & 5 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 2 additions & 16 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,16 +1,2 @@
[package]
name = "zap"
authors = ["Redblox Organization"]
description = "A blazingly fast networking solution for Roblox."
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[build-dependencies]
lalrpop = "0.20.0"

[dependencies]
clap = { version = "4.4.11", features = ["derive"] }
lalrpop-util = { version = "0.20.0", features = ["lexer", "unicode"] }
num-traits = "0.2.17"
[workspace]
members = ["zap", "cli"]
17 changes: 17 additions & 0 deletions cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[package]
name = "cli"
authors = ["Redblox Organization"]
description = "A blazingly fast networking solution for Roblox."
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
anyhow = "1.0"
clap = { version = "4.4.11", features = ["derive"] }
zap = { path = "../zap" }

[[bin]]
name = "zap"
path = "src/main.rs"
32 changes: 32 additions & 0 deletions cli/src/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
use std::path::PathBuf;

use anyhow::Result;
use clap::Parser;
use zap::run;

#[derive(Parser, Debug)]
#[command(author, version, about, long_about = None)]
struct Args {
#[arg(default_value = "net.zap")]
config: Option<PathBuf>,

#[arg(short, long, default_value = "network")]
output: Option<PathBuf>,
}

fn main() -> Result<()> {
let args = Args::parse();

let config_path = args.config.unwrap();
let output_dir_path = args.output.unwrap();

let config = std::fs::read_to_string(config_path)?;

let code = run(config.as_str())?;

std::fs::create_dir_all(&output_dir_path)?;
std::fs::write(output_dir_path.join("server.luau"), code.server)?;
std::fs::write(output_dir_path.join("client.luau"), code.client)?;

Ok(())
}
18 changes: 0 additions & 18 deletions src/lib.rs

This file was deleted.

40 changes: 0 additions & 40 deletions src/main.rs

This file was deleted.

20 changes: 20 additions & 0 deletions zap/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[package]
name = "zap"
authors = ["Redblox Organization"]
description = "A blazingly fast networking solution for Roblox."
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[lib]
crate-type = ["lib", "cdylib"]

[build-dependencies]
lalrpop = "0.20.0"

[dependencies]
lalrpop-util = { version = "0.20.0", features = ["lexer", "unicode"] }
num-traits = "0.2.17"
thiserror = "1.0"
wasm-bindgen = "0.2"
File renamed without changes.
Loading