diff options
author | Bartek Iwańczuk <biwanczuk@gmail.com> | 2024-01-23 15:33:07 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-23 15:33:07 +0100 |
commit | 427b73c3ec1e01ca8c670d403a85fcf31777d253 (patch) | |
tree | be2fca19021b892c4137abca8f7bfc35f87f72ca /cli/factory.rs | |
parent | ebe4c1421e13e61295221982900ac5b77c848227 (diff) |
feat: warn when using --unstable, prefer granular flags (#21452)
This commit deprecates "--unstable" flag.
When "--unstable" flag is encountered a warning like this is printed:
```
The `--unstable` flag is deprecated, use granular `--unstable-*` flags instead.
Learn more at: https://docs.deno.com/runtime/manual/tools/unstable_flags
```
When "--unstable" flag is used and an unstable API is called an
additional warning like this is printed for each API call:
```
The `Deno.dlopen` API was used with `--unstable` flag. The `--unstable` flag is deprecated, use granular `--unstable-ffi` instead.
Learn more at: https://docs.deno.com/runtime/manual/tools/unstable_flags
```
When no "--unstable-*" flag is provided and an unstable API is called
following
warning is issued before exiting:
```
Unstable API 'Deno.dlopen'. The `--unstable-ffi` flag must be provided.
```
---------
Signed-off-by: Divy Srivastava <dj.srivastava23@gmail.com>
Signed-off-by: Bartek Iwańczuk <biwanczuk@gmail.com>
Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
Co-authored-by: Asher Gomez <ashersaupingomez@gmail.com>
Diffstat (limited to 'cli/factory.rs')
-rw-r--r-- | cli/factory.rs | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/cli/factory.rs b/cli/factory.rs index bee805215..a82cd3ab9 100644 --- a/cli/factory.rs +++ b/cli/factory.rs @@ -678,11 +678,10 @@ impl CliFactory { self.services.feature_checker.get_or_init(|| { let mut checker = FeatureChecker::default(); checker.set_exit_cb(Box::new(crate::unstable_exit_cb)); - // TODO(bartlomieju): enable, once we deprecate `--unstable` in favor - // of granular --unstable-* flags. - // feature_checker.set_warn_cb(Box::new(crate::unstable_warn_cb)); + checker.set_warn_cb(Box::new(crate::unstable_warn_cb)); if self.options.legacy_unstable_flag() { checker.enable_legacy_unstable(); + checker.warn_on_legacy_unstable(); } let unstable_features = self.options.unstable_features(); for (flag_name, _, _) in crate::UNSTABLE_GRANULAR_FLAGS { |