diff options
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/js/90_deno_ns.js | 25 | ||||
-rw-r--r-- | runtime/js/99_main.js | 99 | ||||
-rw-r--r-- | runtime/ops/bootstrap.rs | 6 | ||||
-rw-r--r-- | runtime/worker_bootstrap.rs | 6 |
4 files changed, 37 insertions, 99 deletions
diff --git a/runtime/js/90_deno_ns.js b/runtime/js/90_deno_ns.js index e14dc506e..23f7da95c 100644 --- a/runtime/js/90_deno_ns.js +++ b/runtime/js/90_deno_ns.js @@ -194,27 +194,4 @@ denoNsUnstableById[unstableIds.webgpu] = { // denoNsUnstableById[unstableIds.workerOptions] = { __proto__: null } -// when editing this list, also update unstableDenoProps in cli/tsc/99_main_compiler.js -const denoNsUnstable = { - listenDatagram: net.createListenDatagram( - op_net_listen_udp, - op_net_listen_unixpacket, - ), - umask: fs.umask, - HttpClient: httpClient.HttpClient, - createHttpClient: httpClient.createHttpClient, - dlopen: ffi.dlopen, - UnsafeCallback: ffi.UnsafeCallback, - UnsafePointer: ffi.UnsafePointer, - UnsafePointerView: ffi.UnsafePointerView, - UnsafeFnPointer: ffi.UnsafeFnPointer, - UnsafeWindowSurface: webgpuSurface.UnsafeWindowSurface, - openKv: kv.openKv, - AtomicOperation: kv.AtomicOperation, - Kv: kv.Kv, - KvU64: kv.KvU64, - KvListIterator: kv.KvListIterator, - cron: cron.cron, -}; - -export { denoNs, denoNsUnstable, denoNsUnstableById, unstableIds }; +export { denoNs, denoNsUnstableById, unstableIds }; diff --git a/runtime/js/99_main.js b/runtime/js/99_main.js index 2d5c96f6a..f81ab3d8f 100644 --- a/runtime/js/99_main.js +++ b/runtime/js/99_main.js @@ -37,7 +37,6 @@ const { ObjectKeys, ObjectPrototypeIsPrototypeOf, ObjectSetPrototypeOf, - ObjectValues, PromisePrototypeThen, PromiseResolve, StringPrototypePadEnd, @@ -67,7 +66,6 @@ import * as fetch from "ext:deno_fetch/26_fetch.js"; import * as messagePort from "ext:deno_web/13_message_port.js"; import { denoNs, - denoNsUnstable, denoNsUnstableById, unstableIds, } from "ext:runtime/90_deno_ns.js"; @@ -439,28 +437,19 @@ ObjectDefineProperties(globalThis, windowOrWorkerGlobalScope); // Set up global properties shared by main and worker runtime that are exposed // by unstable features if those are enabled. -function exposeUnstableFeaturesForWindowOrWorkerGlobalScope(options) { - const { unstableFlag, unstableFeatures } = options; - if (unstableFlag) { - const all = ObjectValues(unstableForWindowOrWorkerGlobalScope); - for (let i = 0; i <= all.length; i++) { - const props = all[i]; - ObjectDefineProperties(globalThis, { ...props }); - } - } else { - const featureIds = ArrayPrototypeMap( - ObjectKeys( - unstableForWindowOrWorkerGlobalScope, - ), - (k) => k | 0, - ); +function exposeUnstableFeaturesForWindowOrWorkerGlobalScope(unstableFeatures) { + const featureIds = ArrayPrototypeMap( + ObjectKeys( + unstableForWindowOrWorkerGlobalScope, + ), + (k) => k | 0, + ); - for (let i = 0; i <= featureIds.length; i++) { - const featureId = featureIds[i]; - if (ArrayPrototypeIncludes(unstableFeatures, featureId)) { - const props = unstableForWindowOrWorkerGlobalScope[featureId]; - ObjectDefineProperties(globalThis, { ...props }); - } + for (let i = 0; i <= featureIds.length; i++) { + const featureId = featureIds[i]; + if (ArrayPrototypeIncludes(unstableFeatures, featureId)) { + const props = unstableForWindowOrWorkerGlobalScope[featureId]; + ObjectDefineProperties(globalThis, { ...props }); } } } @@ -572,17 +561,16 @@ function bootstrapMainRuntime(runtimeOptions, warmup = false) { const { 0: denoVersion, 1: location_, - 2: unstableFlag, - 3: unstableFeatures, - 4: inspectFlag, - 6: hasNodeModulesDir, - 7: argv0, - 8: nodeDebug, - 9: mode, - 10: servePort, - 11: serveHost, - 12: serveIsMain, - 13: serveWorkerCount, + 2: unstableFeatures, + 3: inspectFlag, + 5: hasNodeModulesDir, + 6: argv0, + 7: nodeDebug, + 8: mode, + 9: servePort, + 10: serveHost, + 11: serveIsMain, + 12: serveWorkerCount, } = runtimeOptions; if (mode === executionModes.serve) { @@ -692,10 +680,7 @@ function bootstrapMainRuntime(runtimeOptions, warmup = false) { location.setLocationHref(location_); } - exposeUnstableFeaturesForWindowOrWorkerGlobalScope({ - unstableFlag, - unstableFeatures, - }); + exposeUnstableFeaturesForWindowOrWorkerGlobalScope(unstableFeatures); ObjectDefineProperties(globalThis, mainRuntimeGlobalProperties); ObjectDefineProperties(globalThis, { // TODO(bartlomieju): in the future we might want to change the @@ -742,14 +727,9 @@ function bootstrapMainRuntime(runtimeOptions, warmup = false) { }, }); - // TODO(bartlomieju): deprecate --unstable - if (unstableFlag) { - ObjectAssign(finalDenoNs, denoNsUnstable); - } else { - for (let i = 0; i <= unstableFeatures.length; i++) { - const id = unstableFeatures[i]; - ObjectAssign(finalDenoNs, denoNsUnstableById[id]); - } + for (let i = 0; i <= unstableFeatures.length; i++) { + const id = unstableFeatures[i]; + ObjectAssign(finalDenoNs, denoNsUnstableById[id]); } if (!ArrayPrototypeIncludes(unstableFeatures, unstableIds.unsafeProto)) { @@ -825,12 +805,11 @@ function bootstrapWorkerRuntime( const { 0: denoVersion, 1: location_, - 2: unstableFlag, - 3: unstableFeatures, - 5: enableTestingFeaturesFlag, - 6: hasNodeModulesDir, - 7: argv0, - 8: nodeDebug, + 2: unstableFeatures, + 4: enableTestingFeaturesFlag, + 5: hasNodeModulesDir, + 6: argv0, + 7: nodeDebug, } = runtimeOptions; // TODO(iuioiua): remove in Deno v2. This allows us to dynamically delete @@ -846,10 +825,7 @@ function bootstrapWorkerRuntime( delete globalThis.bootstrap; hasBootstrapped = true; - exposeUnstableFeaturesForWindowOrWorkerGlobalScope({ - unstableFlag, - unstableFeatures, - }); + exposeUnstableFeaturesForWindowOrWorkerGlobalScope(unstableFeatures); ObjectDefineProperties(globalThis, workerRuntimeGlobalProperties); ObjectDefineProperties(globalThis, { name: core.propWritable(name), @@ -891,14 +867,9 @@ function bootstrapWorkerRuntime( globalThis.pollForMessages = pollForMessages; globalThis.hasMessageEventListener = hasMessageEventListener; - // TODO(bartlomieju): deprecate --unstable - if (unstableFlag) { - ObjectAssign(finalDenoNs, denoNsUnstable); - } else { - for (let i = 0; i <= unstableFeatures.length; i++) { - const id = unstableFeatures[i]; - ObjectAssign(finalDenoNs, denoNsUnstableById[id]); - } + for (let i = 0; i <= unstableFeatures.length; i++) { + const id = unstableFeatures[i]; + ObjectAssign(finalDenoNs, denoNsUnstableById[id]); } // Not available in workers diff --git a/runtime/ops/bootstrap.rs b/runtime/ops/bootstrap.rs index a60544534..bbbddc61b 100644 --- a/runtime/ops/bootstrap.rs +++ b/runtime/ops/bootstrap.rs @@ -95,11 +95,7 @@ pub fn op_bootstrap_user_agent(state: &mut OpState) -> String { #[serde] pub fn op_bootstrap_unstable_args(state: &mut OpState) -> Vec<String> { let options = state.borrow::<BootstrapOptions>(); - if options.unstable { - return vec!["--unstable".to_string()]; - } - - let mut flags = Vec::new(); + let mut flags = Vec::with_capacity(options.unstable_features.len()); for granular_flag in crate::UNSTABLE_GRANULAR_FLAGS.iter() { if options.unstable_features.contains(&granular_flag.id) { flags.push(format!("--unstable-{}", granular_flag.name)); diff --git a/runtime/worker_bootstrap.rs b/runtime/worker_bootstrap.rs index b137efae2..3f3c25c5e 100644 --- a/runtime/worker_bootstrap.rs +++ b/runtime/worker_bootstrap.rs @@ -106,8 +106,6 @@ pub struct BootstrapOptions { pub is_stdout_tty: bool, pub is_stderr_tty: bool, pub color_level: deno_terminal::colors::ColorLevel, - // --unstable flag, deprecated - pub unstable: bool, // --unstable-* flags pub unstable_features: Vec<i32>, pub user_agent: String, @@ -144,7 +142,6 @@ impl Default for BootstrapOptions { log_level: Default::default(), locale: "en".to_string(), location: Default::default(), - unstable: Default::default(), unstable_features: Default::default(), inspect: Default::default(), args: Default::default(), @@ -174,8 +171,6 @@ struct BootstrapV8<'a>( &'a str, // location Option<&'a str>, - // unstable - bool, // granular unstable flags &'a [i32], // inspect @@ -213,7 +208,6 @@ impl BootstrapOptions { let bootstrap = BootstrapV8( &self.deno_version, self.location.as_ref().map(|l| l.as_str()), - self.unstable, self.unstable_features.as_ref(), self.inspect, self.enable_testing_features, |