deno
85b4cb5f - refactor: extract CLI flag types into deno_cli_parser crate (#35333)

Commit
66 days ago
refactor: extract CLI flag types into deno_cli_parser crate (#35333) This is the first step in splitting the effort to replace clap with a zero-cost CLI argument parser (originally proposed as one ~35k-line change in #33325) into small, independently reviewable pieces that can land one at a time. This change introduces a new `libs/cli_parser` (`deno_cli_parser`) crate that holds the canonical CLI flag type definitions: `Flags`, `DenoSubcommand`, `PermissionFlags`, every `*Flags` struct/enum, and their pure data impls. `cli/args/flags.rs` now re-exports those types via `pub use deno_cli_parser::flags::*` and keeps all of its existing clap-based parsing untouched. It is a pure refactor with no behavior change: clap still does all argument parsing, only the type definitions moved. This gives later PRs a place to grow the actual parser without touching the CLI's parsing path yet. A handful of helper methods cannot live in the parser crate because they depend on clap, deno_graph, deno_telemetry, or the CLI build environment (`env!("TARGET")`), so they become extension traits in `cli/args/flags.rs` (`FileFlagsExt`, `CompileFlagsExt`, `DenoSubcommandExt`, `TypeCheckModeExt`, `FlagsExt`) and consumers gain the matching imports. `HelpFlags.help` changes from `clap::builder::StyledStr` to `String` (the ansi-rendered string is stored at construction) so the crate stays clap-free, and the `From<BundleOptions>` conversion moves next to `BundleFlags` to satisfy the orphan rule.
Author
Parents
Loading