Skip to content

Commit 486378b

Browse files
committed
fixup: add rust executable variant
1 parent c384a8a commit 486378b

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

packages/async-rewriter3/Cargo.toml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@ version = "0.1.0"
44
edition = "2021"
55

66
[lib]
7-
crate-type = ["cdylib"]
7+
crate-type = ["cdylib", "rlib"]
8+
9+
[[bin]]
10+
name = "async-rewriter3"
11+
path = "src/main.rs"
812

913
# adapted from https://github.com/rustwasm/rust-webpack-template/blob/24f3af83206b52e0241d95ee10cebf930ec8bf08/template/Cargo.toml
1014
[dependencies]

packages/async-rewriter3/src/main.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
use std::io::Read;
2+
use async_rewriter3::async_rewrite;
3+
4+
fn main() {
5+
let mut input = String::new();
6+
7+
//std::fs::File::open("../../node_modules/sinon/pkg/sinon.js").unwrap()
8+
std::io::stdin().read_to_string(&mut input).unwrap();
9+
println!("{}", async_rewrite(input.as_str(), false).unwrap());
10+
}

0 commit comments

Comments
 (0)