1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-21 15:04:11 -05:00

chore: remove some dead code around DENO_FUTURE env var (#25418)

These codepaths were not used anymore.
This commit is contained in:
Bartek Iwańczuk 2024-09-04 11:49:31 +01:00 committed by GitHub
parent 31ecc09b5a
commit 5ee671311a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 11 additions and 62 deletions

View file

@ -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(),

View file

@ -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;

View file

@ -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 {

View file

@ -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);
}
}
}

View file

@ -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()
});

View file

@ -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();
(

View file

@ -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(),