Skip to content

Commit 7d06ae9

Browse files
authored
feat: Add dcore bin target (#525)
This commit adds minimal binary target to "deno_core" crate. It is now possible to "cargo run ./path/to/file.ts" to execute a file. This feature is being added for development and testing purposes only and is not meant for end-users. The API is minimal and the binary can't do anything interesting. "fs_module_loader" example has been removed in favor of binary target. Closes #412 Once #415 lands we can extend functionality further.
1 parent 58b9ef4 commit 7d06ae9

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

core/Cargo.toml

+7-3
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ readme = "README.md"
1010
repository.workspace = true
1111
description = "A modern JavaScript/TypeScript runtime built with V8, Rust, and Tokio"
1212

13+
[[bin]]
14+
name = "dcore"
15+
path = "main.rs"
16+
1317
[lib]
1418
path = "lib.rs"
1519

@@ -32,9 +36,9 @@ bit-set.workspace = true
3236
bit-vec.workspace = true
3337
bytes.workspace = true
3438
cooked-waker.workspace = true
39+
deno_core_icudata = { workspace = true, optional = true }
3540
deno_ops.workspace = true
3641
deno_unsync.workspace = true
37-
deno_core_icudata = { workspace = true, optional = true }
3842
futures.workspace = true
3943
libc.workspace = true
4044
log.workspace = true
@@ -52,11 +56,11 @@ url.workspace = true
5256
v8.workspace = true
5357

5458
[dev-dependencies]
55-
deno_ast.workspace = true
5659
bencher.workspace = true
60+
deno_ast.workspace = true
61+
fastrand.workspace = true
5762
pretty_assertions.workspace = true
5863
rstest.workspace = true
59-
fastrand.workspace = true
6064
unicycle = "0"
6165

6266
[[bench]]

core/examples/fs_module_loader.rs core/main.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,11 @@ fn text_module(
7272

7373
fn main() -> Result<(), Error> {
7474
let args: Vec<String> = std::env::args().collect();
75+
eprintln!(
76+
"🛑 deno_core binary is meant for development and testing purposes."
77+
);
7578
if args.len() < 2 {
76-
println!("Usage: target/examples/debug/fs_module_loader <path_to_module>");
79+
println!("Usage: cargo run -- <path_to_module>");
7780
std::process::exit(1);
7881
}
7982
let main_url = &args[1];

0 commit comments

Comments
 (0)