Skip to content

refactor: gen unstable flags to avoid conflicts and desync with js #28888

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

devsnek
Copy link
Member

@devsnek devsnek commented Apr 14, 2025

generate unstable flags from one source to avoid merge conflicts and desync with ids in js

@devsnek devsnek requested a review from littledivy April 14, 2025 10:21
@crowlKats
Copy link
Member

maybe call it "unstable flags" or "feature flags" instead of just "flags", to make it less confusing?

show_in_help: bool,
}

fn main() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should probably add a rerun-if-changed for flags.json

Copy link
Member

@bartlomieju bartlomieju left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gonna mark as "request changes" because I'd like to discuss this during the CLI meeting first.

I like that there's a single source of truth in the form of JSON file 👍

Copy link
Member

@ry ry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A refactor to the feature flag system is welcome!

It should encompass all feature flags tho - for example this PR isn't yet handling unstable-lockfile-v5

deno/cli/args/flags.rs

Lines 4462 to 4494 in 9145492

Arg::new("unstable-sloppy-imports")
.long("unstable-sloppy-imports")
.help("Enable unstable resolving of specifiers by extension probing, .js to .ts, and directory probing")
.env("DENO_UNSTABLE_SLOPPY_IMPORTS")
.value_parser(FalseyValueParser::new())
.action(ArgAction::SetTrue)
.hide(true)
.long_help(match cfg {
UnstableArgsConfig::None => None,
UnstableArgsConfig::ResolutionOnly | UnstableArgsConfig::ResolutionAndRuntime => Some("true")
})
.help_heading(UNSTABLE_HEADING)
.display_order(next_display_order())
).arg(
Arg::new("unstable-npm-lazy-caching")
.long("unstable-npm-lazy-caching")
.help("Enable unstable lazy caching of npm dependencies, downloading them only as needed (disabled: all npm packages in package.json are installed on startup; enabled: only npm packages that are actually referenced in an import are installed")
.env("DENO_UNSTABLE_NPM_LAZY_CACHING")
.value_parser(FalseyValueParser::new())
.action(ArgAction::SetTrue)
.hide(true)
.help_heading(UNSTABLE_HEADING)
.display_order(next_display_order()),
).arg(
Arg::new("unstable-lockfile-v5")
.long("unstable-lockfile-v5")
.help("Enable unstable lockfile v5")
.env("DENO_UNSTABLE_LOCKFILE_V5")
.value_parser(FalseyValueParser::new())
.action(ArgAction::SetTrue)
.help_heading(UNSTABLE_HEADING)
.hide(true)
.display_order(next_display_order()),

or fmt-sql

deno/cli/args/mod.rs

Lines 1129 to 1142 in 9145492

let all_valid_unstable_flags: Vec<&str> = crate::UNSTABLE_GRANULAR_FLAGS
.iter()
.map(|granular_flag| granular_flag.name)
.chain([
"byonm",
"bare-node-builtins",
"detect-cjs",
"fmt-component",
"fmt-sql",
"lazy-dynamic-imports",
"npm-lazy-caching",
"npm-patch",
"sloppy-imports",
"lockfile-v5",

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants