From 24c3c9695865bb478f5651da4982b7e0a34afc72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Wed, 1 Nov 2023 23:15:08 +0100 Subject: feat: granular --unstable-* flags (#20968) This commit adds granular `--unstable-*` flags: - "--unstable-broadcast-channel" - "--unstable-ffi" - "--unstable-fs" - "--unstable-http" - "--unstable-kv" - "--unstable-net" - "--unstable-worker-options" - "--unstable-cron" These flags are meant to replace a "catch-all" flag - "--unstable", that gives a binary control whether unstable features are enabled or not. The downside of this flag that allowing eg. Deno KV API also enables the FFI API (though the latter is still gated with a permission). These flags can also be specified in `deno.json` file under `unstable` key. Currently, "--unstable" flag works the same way - I will open a follow up PR that will print a warning when using "--unstable" and suggest to use concrete "--unstable-*" flag instead. We plan to phase out "--unstable" completely in Deno 2. --- runtime/worker_bootstrap.rs | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'runtime/worker_bootstrap.rs') diff --git a/runtime/worker_bootstrap.rs b/runtime/worker_bootstrap.rs index 0f533344f..b21b4aa21 100644 --- a/runtime/worker_bootstrap.rs +++ b/runtime/worker_bootstrap.rs @@ -54,7 +54,10 @@ pub struct BootstrapOptions { pub runtime_version: String, /// Sets `Deno.version.typescript` in JS runtime. pub ts_version: String, + // --unstable flag, deprecated pub unstable: bool, + // --unstable-* flags + pub unstable_features: Vec, pub user_agent: String, pub inspect: bool, pub has_node_modules_dir: bool, @@ -82,6 +85,7 @@ impl Default for BootstrapOptions { locale: "en".to_string(), location: Default::default(), unstable: Default::default(), + unstable_features: Default::default(), inspect: Default::default(), args: Default::default(), has_node_modules_dir: Default::default(), @@ -121,6 +125,8 @@ struct BootstrapV8<'a>( &'a str, // unstable bool, + // granular unstable flags + &'a [i32], // process_id i32, // env!("TARGET") @@ -159,6 +165,7 @@ impl BootstrapOptions { self.is_tty, &self.ts_version, self.unstable, + self.unstable_features.as_ref(), std::process::id() as _, env!("TARGET"), deno_core::v8_version(), -- cgit v1.2.3