Repository navigation
Backlog
Labels
feature requestIssues requesting new Node.js features.
Description
What is the problem this feature will solve?
brief
-
python + uv already support inline script metadata
-
nightly rust + cargo already support inline script metadata
inline script metadata
- hide package management internals
- hide build process internals
- keep cwd clean
search keyword
- node_modules
- package.json
- Inline script metadata
- cargo script
python
https://peps.python.org/pep-0723/#example
https://packaging.python.org/en/latest/specifications/inline-script-metadata/#inline-script-metadata
https://docs.astral.sh/uv/guides/scripts/#declaring-script-dependencies
# /// script
# dependencies = [
# "requests<3",
# "rich",
# ]
# ///
import requests
from rich.pretty import pprint
resp = requests.get("https://peps.python.org/api/peps.json")
data = resp.json()
pprint([(k, v["title"]) for k, v in data.items()][:10])reproduce
$ cd $(mktemp -d)
$ # save as ./x.py
$ uv run ./x.py && echo OK
Installed ... packages in ...ms
[
│ ...
]
OKKeeps the CWD clean.
$ ls -A
x.pyrust
https://rust-lang.github.io/rfcs/3424-cargo-script.html
https://rust-lang.github.io/rfcs/3424-cargo-script.html#adding-a-dependency
$ cargo update --manifest-path hello_world.rsreproduce
#!/usr/bin/env -S cargo +nightly -Zscript
---cargo
[package]
edition = "2024"
[dependencies]
clap = { version = "4.2", features = ["derive"] }
---
use clap::Parser;
#[derive(Parser, Debug)]
#[clap(version)]
struct Args {
#[clap(short, long, help = "Path to config")]
config: Option<std::path::PathBuf>,
}
fn main() {
let args = Args::parse();
println!("{:?}", args);
}$ cd $(mktemp -d)
$ # save as ./x.rs
$ cargo +nightly -Zscript ./x.rs --config value && echo OK
Updating crates.io index
Locking {{number}} packages to highest Rust {{version}}-nightly compatible versions
Downloaded {{pkg}} v{{semver}}
...
Downloaded {{number}} crates ({{number}}KiB) in {{number}}s
Compiling {{pkg}} v{{semver}}
...
Compiling x v0.0.0 (/tmp/tmp.xxx/x.rs)
Finished `dev` profile [unoptimized + partial debuginfo] target(s) in {{number}}s
Running `/home/xxx/.cargo/build/xxx/xxx/target/debug/x`
Args { config: Some("value") }
OKKeeps the CWD clean.
$ ls -A
x.rsWhat is the feature you are proposing to solve the problem?
also support inline script metadata
What alternatives have you considered?
No response
Related
Metadata
Metadata
Assignees
Labels
feature requestIssues requesting new Node.js features.
Type
Projects
- StatusShow more project fieldsAwaiting Triage
Activity
[-][feat] inline metadata script[/-][+][feat] inline script metadata[/+]Renegade334 commentedon Dec 4, 2026
For context, this is effectively the same proposal as the stale #64809.
Bear in mind that the Node.js runtime does not perform package management.
loynoir commentedon Dec 4, 2026
I think at least two languages and their package managers have adopted this. This prior art can therefore be considered mature, so it would be nice to see it happen in the Node.js ecosystem as well.
loynoir commentedon Dec 4, 2026
And
pep-0723inline-script-metadatastated on the Python official website.cargo scriptstated on the Rust official website.Thus, I open FR in Node.js repo first.