diff options
author | Bartek Iwańczuk <biwanczuk@gmail.com> | 2024-09-04 11:49:31 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-04 10:49:31 +0000 |
commit | 5ee671311a174b5461483db788f732fe736b6549 (patch) | |
tree | 7313593110d31be8d102a5a499c29abce8f4ebe1 | |
parent | 31ecc09b5ae38531cb63680cc40b89d01d8635df (diff) |
chore: remove some dead code around DENO_FUTURE env var (#25418)
These codepaths were not used anymore.
-rw-r--r-- | cli/worker.rs | 5 | ||||
-rw-r--r-- | runtime/js/99_main.js | 20 | ||||
-rw-r--r-- | runtime/lib.rs | 1 | ||||
-rw-r--r-- | runtime/shared.rs | 23 | ||||
-rw-r--r-- | runtime/web_worker.rs | 9 | ||||
-rw-r--r-- | runtime/worker.rs | 10 | ||||
-rw-r--r-- | runtime/worker_bootstrap.rs | 5 |
7 files changed, 11 insertions, 62 deletions
diff --git a/cli/worker.rs b/cli/worker.rs index 7000fd204..64400af20 100644 --- a/cli/worker.rs +++ b/cli/worker.rs @@ -138,7 +138,6 @@ struct SharedWorkerState { maybe_inspector_server: Option<Arc<InspectorServer>>, maybe_lockfile: Option<Arc<CliLockfile>>, feature_checker: Arc<FeatureChecker>, - enable_future_features: bool, code_cache: Option<Arc<dyn code_cache::CodeCache>>, } @@ -453,8 +452,6 @@ impl CliMainWorkerFactory { maybe_inspector_server, maybe_lockfile, feature_checker, - // TODO(2.0): remove? - enable_future_features: true, code_cache, }), } @@ -591,7 +588,6 @@ impl CliMainWorkerFactory { argv0: shared.options.argv0.clone(), node_debug: shared.options.node_debug.clone(), node_ipc_fd: shared.options.node_ipc, - future: shared.enable_future_features, mode, serve_port: shared.options.serve_port, serve_host: shared.options.serve_host.clone(), @@ -787,7 +783,6 @@ fn create_web_worker_callback( argv0: shared.options.argv0.clone(), node_debug: shared.options.node_debug.clone(), node_ipc_fd: None, - future: shared.enable_future_features, mode: WorkerExecutionMode::Worker, serve_port: shared.options.serve_port, serve_host: shared.options.serve_host.clone(), diff --git a/runtime/js/99_main.js b/runtime/js/99_main.js index 1ffb4f6e3..6dd75b415 100644 --- a/runtime/js/99_main.js +++ b/runtime/js/99_main.js @@ -576,12 +576,11 @@ function bootstrapMainRuntime(runtimeOptions, warmup = false) { 6: hasNodeModulesDir, 7: argv0, 8: nodeDebug, - 9: future, - 10: mode, - 11: servePort, - 12: serveHost, - 13: serveIsMain, - 14: serveWorkerCount, + 9: mode, + 10: servePort, + 11: serveHost, + 12: serveIsMain, + 13: serveWorkerCount, } = runtimeOptions; if (mode === executionModes.serve) { @@ -668,7 +667,7 @@ function bootstrapMainRuntime(runtimeOptions, warmup = false) { // TODO(iuioiua): remove in Deno v2. This allows us to dynamically delete // class properties within constructors for classes that are not defined // within the Deno namespace. - internals.future = future; + internals.future = true; removeImportedOps(); @@ -798,7 +797,7 @@ function bootstrapMainRuntime(runtimeOptions, warmup = false) { nodeDebug, }); } - if (future) { + if (internals.future) { delete globalThis.window; delete Deno.Buffer; delete Deno.File; @@ -835,13 +834,12 @@ function bootstrapWorkerRuntime( 6: hasNodeModulesDir, 7: argv0, 8: nodeDebug, - 9: future, } = runtimeOptions; // TODO(iuioiua): remove in Deno v2. This allows us to dynamically delete // class properties within constructors for classes that are not defined // within the Deno namespace. - internals.future = future; + internals.future = true; performance.setTimeOrigin(DateNow()); globalThis_ = globalThis; @@ -964,7 +962,7 @@ function bootstrapWorkerRuntime( }); } - if (future) { + if (internals.future) { delete Deno.Buffer; delete Deno.File; delete Deno.FsFile.prototype.rid; diff --git a/runtime/lib.rs b/runtime/lib.rs index daa55f773..ed3f9fbc6 100644 --- a/runtime/lib.rs +++ b/runtime/lib.rs @@ -44,7 +44,6 @@ pub use worker_bootstrap::WorkerExecutionMode; pub use worker_bootstrap::WorkerLogLevel; mod shared; -pub use shared::import_assertion_callback; pub use shared::runtime; pub struct UnstableGranularFlag { diff --git a/runtime/shared.rs b/runtime/shared.rs index c52521690..1b2136c63 100644 --- a/runtime/shared.rs +++ b/runtime/shared.rs @@ -116,26 +116,3 @@ pub fn maybe_transpile_source( Ok((source_text.into(), maybe_source_map)) } - -pub fn import_assertion_callback( - args: deno_core::ImportAssertionsSupportCustomCallbackArgs, -) { - let mut msg = deno_terminal::colors::yellow("⚠️ Import assertions are deprecated. Use `with` keyword, instead of 'assert' keyword.").to_string(); - if let Some(specifier) = args.maybe_specifier { - if let Some(source_line) = args.maybe_source_line { - msg.push_str("\n\n"); - msg.push_str(&source_line); - msg.push_str("\n\n"); - } - msg.push_str(&format!( - " at {}:{}:{}\n", - specifier, - args.maybe_line_number.unwrap(), - args.column_number - )); - #[allow(clippy::print_stderr)] - { - eprintln!("{}", msg); - } - } -} diff --git a/runtime/web_worker.rs b/runtime/web_worker.rs index ad0ac5a3f..e14328861 100644 --- a/runtime/web_worker.rs +++ b/runtime/web_worker.rs @@ -545,13 +545,6 @@ impl WebWorker { options.bootstrap.enable_op_summary_metrics, options.strace_ops, ); - let import_assertions_support = if options.bootstrap.future { - deno_core::ImportAssertionsSupport::Error - } else { - deno_core::ImportAssertionsSupport::CustomCallback(Box::new( - crate::shared::import_assertion_callback, - )) - }; let mut js_runtime = JsRuntime::new(RuntimeOptions { module_loader: Some(options.module_loader.clone()), @@ -572,7 +565,7 @@ impl WebWorker { validate_import_attributes_cb: Some(Box::new( validate_import_attributes_callback, )), - import_assertions_support, + import_assertions_support: deno_core::ImportAssertionsSupport::Error, ..Default::default() }); diff --git a/runtime/worker.rs b/runtime/worker.rs index c0d839166..02749e7c1 100644 --- a/runtime/worker.rs +++ b/runtime/worker.rs @@ -477,14 +477,6 @@ impl MainWorker { } }); - let import_assertions_support = if options.bootstrap.future { - deno_core::ImportAssertionsSupport::Error - } else { - deno_core::ImportAssertionsSupport::CustomCallback(Box::new( - crate::shared::import_assertion_callback, - )) - }; - let mut js_runtime = JsRuntime::new(RuntimeOptions { module_loader: Some(options.module_loader.clone()), startup_snapshot: options.startup_snapshot, @@ -510,7 +502,7 @@ impl MainWorker { validate_import_attributes_cb: Some(Box::new( validate_import_attributes_callback, )), - import_assertions_support, + import_assertions_support: deno_core::ImportAssertionsSupport::Error, eval_context_code_cache_cbs: options.v8_code_cache.map(|cache| { let cache_clone = cache.clone(); ( diff --git a/runtime/worker_bootstrap.rs b/runtime/worker_bootstrap.rs index b6ede466e..b137efae2 100644 --- a/runtime/worker_bootstrap.rs +++ b/runtime/worker_bootstrap.rs @@ -116,7 +116,6 @@ pub struct BootstrapOptions { pub argv0: Option<String>, pub node_debug: Option<String>, pub node_ipc_fd: Option<i64>, - pub future: bool, pub mode: WorkerExecutionMode, // Used by `deno serve` pub serve_port: Option<u16>, @@ -153,7 +152,6 @@ impl Default for BootstrapOptions { argv0: None, node_debug: None, node_ipc_fd: None, - future: false, mode: WorkerExecutionMode::None, serve_port: Default::default(), serve_host: Default::default(), @@ -190,8 +188,6 @@ struct BootstrapV8<'a>( Option<&'a str>, // node_debug Option<&'a str>, - // future - bool, // mode i32, // serve port @@ -224,7 +220,6 @@ impl BootstrapOptions { self.has_node_modules_dir, self.argv0.as_deref(), self.node_debug.as_deref(), - self.future, self.mode.discriminant() as _, self.serve_port.unwrap_or_default(), self.serve_host.as_deref(), |