diff options
| author | Divy Srivastava <dj.srivastava23@gmail.com> | 2024-02-15 10:20:17 +0530 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-02-15 04:50:17 +0000 |
| commit | b72f0be27c382f2d4e5d272ce9ed2211af584d80 (patch) | |
| tree | 6b896e59f63cbe0f49d47f58832d5c3440e6ef03 /cli | |
| parent | 1ad754b4123009e01dbecb3b880e7f0545e46c2f (diff) | |
chore: add DENO_FUTURE env var (#22318)
Closes https://github.com/denoland/deno/issues/22315
```
~> DENO_FUTURE=1 target/debug/deno
> globalThis.window
undefined
```
Diffstat (limited to 'cli')
| -rw-r--r-- | cli/args/mod.rs | 4 | ||||
| -rw-r--r-- | cli/factory.rs | 1 | ||||
| -rw-r--r-- | cli/standalone/mod.rs | 1 | ||||
| -rw-r--r-- | cli/worker.rs | 5 |
4 files changed, 11 insertions, 0 deletions
diff --git a/cli/args/mod.rs b/cli/args/mod.rs index 6aafd0ea6..d7ff91b84 100644 --- a/cli/args/mod.rs +++ b/cli/args/mod.rs @@ -987,6 +987,10 @@ impl CliOptions { } } + pub fn enable_future_features(&self) -> bool { + std::env::var("DENO_FUTURE").is_ok() + } + pub fn resolve_main_module(&self) -> Result<ModuleSpecifier, AnyError> { match &self.flags.subcommand { DenoSubcommand::Bundle(bundle_flags) => { diff --git a/cli/factory.rs b/cli/factory.rs index be2dc677d..2236e6090 100644 --- a/cli/factory.rs +++ b/cli/factory.rs @@ -775,6 +775,7 @@ impl CliFactory { self.feature_checker().clone(), self.create_cli_main_worker_options()?, self.options.node_ipc_fd(), + self.options.enable_future_features(), // TODO(bartlomieju): temporarily disabled // self.options.disable_deprecated_api_warning, true, diff --git a/cli/standalone/mod.rs b/cli/standalone/mod.rs index ecbb0be82..d1b90ecee 100644 --- a/cli/standalone/mod.rs +++ b/cli/standalone/mod.rs @@ -551,6 +551,7 @@ pub async fn run( create_coverage_collector: None, }, None, + false, // TODO(bartlomieju): temporarily disabled // metadata.disable_deprecated_api_warning, true, diff --git a/cli/worker.rs b/cli/worker.rs index 3f75ebc5c..5c252e92c 100644 --- a/cli/worker.rs +++ b/cli/worker.rs @@ -144,6 +144,7 @@ struct SharedWorkerState { maybe_lockfile: Option<Arc<Mutex<Lockfile>>>, feature_checker: Arc<FeatureChecker>, node_ipc: Option<i64>, + enable_future_features: bool, disable_deprecated_api_warning: bool, verbose_deprecated_api_warning: bool, } @@ -424,6 +425,7 @@ impl CliMainWorkerFactory { feature_checker: Arc<FeatureChecker>, options: CliMainWorkerOptions, node_ipc: Option<i64>, + enable_future_features: bool, disable_deprecated_api_warning: bool, verbose_deprecated_api_warning: bool, ) -> Self { @@ -446,6 +448,7 @@ impl CliMainWorkerFactory { maybe_lockfile, feature_checker, node_ipc, + enable_future_features, disable_deprecated_api_warning, verbose_deprecated_api_warning, }), @@ -612,6 +615,7 @@ impl CliMainWorkerFactory { node_ipc_fd: shared.node_ipc, disable_deprecated_api_warning: shared.disable_deprecated_api_warning, verbose_deprecated_api_warning: shared.verbose_deprecated_api_warning, + future: shared.enable_future_features, }, extensions: custom_extensions, startup_snapshot: crate::js::deno_isolate_init(), @@ -818,6 +822,7 @@ fn create_web_worker_callback( node_ipc_fd: None, disable_deprecated_api_warning: shared.disable_deprecated_api_warning, verbose_deprecated_api_warning: shared.verbose_deprecated_api_warning, + future: false, }, extensions: vec![], startup_snapshot: crate::js::deno_isolate_init(), |
