diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2023-11-01 23:15:08 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-01 23:15:08 +0100 |
commit | 24c3c9695865bb478f5651da4982b7e0a34afc72 (patch) | |
tree | 5afe78a8c67bb9e9c1cd69d56a9a0c68bca67515 /runtime/worker_bootstrap.rs | |
parent | 42c426e7695a0037032d1ac5237830800eeaaed4 (diff) |
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.
Diffstat (limited to 'runtime/worker_bootstrap.rs')
-rw-r--r-- | runtime/worker_bootstrap.rs | 7 |
1 files changed, 7 insertions, 0 deletions
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<i32>, 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(), |