mirror of
https://github.com/denoland/deno.git
synced 2024-11-21 15:04:11 -05:00
BREAKING: Remove --unstable
flag (#25522)
This commit effectively removes the --unstable flag. It's still being parsed, but it only prints a warning that a granular flag should be used instead and doesn't actually enable any unstable feature. Closes https://github.com/denoland/deno/issues/25485 Closes https://github.com/denoland/deno/issues/23237
This commit is contained in:
parent
560ad0331b
commit
064a73f7a0
15 changed files with 60 additions and 179 deletions
|
@ -570,6 +570,7 @@ fn parse_packages_allowed_scripts(s: &str) -> Result<String, AnyError> {
|
||||||
Clone, Default, Debug, Eq, PartialEq, serde::Serialize, serde::Deserialize,
|
Clone, Default, Debug, Eq, PartialEq, serde::Serialize, serde::Deserialize,
|
||||||
)]
|
)]
|
||||||
pub struct UnstableConfig {
|
pub struct UnstableConfig {
|
||||||
|
// TODO(bartlomieju): remove in Deno 2.5
|
||||||
pub legacy_flag_enabled: bool, // --unstable
|
pub legacy_flag_enabled: bool, // --unstable
|
||||||
pub bare_node_builtins: bool, // --unstable-bare-node-builts
|
pub bare_node_builtins: bool, // --unstable-bare-node-builts
|
||||||
pub sloppy_imports: bool,
|
pub sloppy_imports: bool,
|
||||||
|
@ -5476,6 +5477,7 @@ fn unstable_args_parse(
|
||||||
matches: &mut ArgMatches,
|
matches: &mut ArgMatches,
|
||||||
cfg: UnstableArgsConfig,
|
cfg: UnstableArgsConfig,
|
||||||
) {
|
) {
|
||||||
|
// TODO(bartlomieju): remove in Deno 2.5
|
||||||
if matches.get_flag("unstable") {
|
if matches.get_flag("unstable") {
|
||||||
flags.unstable_config.legacy_flag_enabled = true;
|
flags.unstable_config.legacy_flag_enabled = true;
|
||||||
}
|
}
|
||||||
|
@ -8765,7 +8767,7 @@ mod tests {
|
||||||
#[test]
|
#[test]
|
||||||
fn test_with_flags() {
|
fn test_with_flags() {
|
||||||
#[rustfmt::skip]
|
#[rustfmt::skip]
|
||||||
let r = flags_from_vec(svec!["deno", "test", "--unstable", "--no-npm", "--no-remote", "--trace-leaks", "--no-run", "--filter", "- foo", "--coverage=cov", "--clean", "--location", "https:foo", "--allow-net", "--permit-no-files", "dir1/", "dir2/", "--", "arg1", "arg2"]);
|
let r = flags_from_vec(svec!["deno", "test", "--no-npm", "--no-remote", "--trace-leaks", "--no-run", "--filter", "- foo", "--coverage=cov", "--clean", "--location", "https:foo", "--allow-net", "--permit-no-files", "dir1/", "dir2/", "--", "arg1", "arg2"]);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
r.unwrap(),
|
r.unwrap(),
|
||||||
Flags {
|
Flags {
|
||||||
|
@ -8789,10 +8791,6 @@ mod tests {
|
||||||
junit_path: None,
|
junit_path: None,
|
||||||
hide_stacktraces: false,
|
hide_stacktraces: false,
|
||||||
}),
|
}),
|
||||||
unstable_config: UnstableConfig {
|
|
||||||
legacy_flag_enabled: true,
|
|
||||||
..Default::default()
|
|
||||||
},
|
|
||||||
no_npm: true,
|
no_npm: true,
|
||||||
no_remote: true,
|
no_remote: true,
|
||||||
location: Some(Url::parse("https://foo/").unwrap()),
|
location: Some(Url::parse("https://foo/").unwrap()),
|
||||||
|
@ -10200,7 +10198,6 @@ mod tests {
|
||||||
"deno",
|
"deno",
|
||||||
"bench",
|
"bench",
|
||||||
"--json",
|
"--json",
|
||||||
"--unstable",
|
|
||||||
"--no-npm",
|
"--no-npm",
|
||||||
"--no-remote",
|
"--no-remote",
|
||||||
"--no-run",
|
"--no-run",
|
||||||
|
@ -10228,10 +10225,6 @@ mod tests {
|
||||||
},
|
},
|
||||||
watch: Default::default(),
|
watch: Default::default(),
|
||||||
}),
|
}),
|
||||||
unstable_config: UnstableConfig {
|
|
||||||
legacy_flag_enabled: true,
|
|
||||||
..Default::default()
|
|
||||||
},
|
|
||||||
no_npm: true,
|
no_npm: true,
|
||||||
no_remote: true,
|
no_remote: true,
|
||||||
type_check_mode: TypeCheckMode::Local,
|
type_check_mode: TypeCheckMode::Local,
|
||||||
|
@ -10802,10 +10795,10 @@ mod tests {
|
||||||
conn_file: None,
|
conn_file: None,
|
||||||
}),
|
}),
|
||||||
unstable_config: UnstableConfig {
|
unstable_config: UnstableConfig {
|
||||||
legacy_flag_enabled: false,
|
|
||||||
bare_node_builtins: true,
|
bare_node_builtins: true,
|
||||||
sloppy_imports: false,
|
sloppy_imports: false,
|
||||||
features: svec!["ffi", "worker-options"],
|
features: svec!["ffi", "worker-options"],
|
||||||
|
..Default::default()
|
||||||
},
|
},
|
||||||
..Flags::default()
|
..Flags::default()
|
||||||
}
|
}
|
||||||
|
|
|
@ -1548,10 +1548,6 @@ impl CliOptions {
|
||||||
&self.flags.unsafely_ignore_certificate_errors
|
&self.flags.unsafely_ignore_certificate_errors
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn legacy_unstable_flag(&self) -> bool {
|
|
||||||
self.flags.unstable_config.legacy_flag_enabled
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn unstable_bare_node_builtins(&self) -> bool {
|
pub fn unstable_bare_node_builtins(&self) -> bool {
|
||||||
self.flags.unstable_config.bare_node_builtins
|
self.flags.unstable_config.bare_node_builtins
|
||||||
|| self.workspace().has_unstable("bare-node-builtins")
|
|| self.workspace().has_unstable("bare-node-builtins")
|
||||||
|
|
|
@ -714,10 +714,6 @@ impl CliFactory {
|
||||||
let mut checker = FeatureChecker::default();
|
let mut checker = FeatureChecker::default();
|
||||||
checker.set_exit_cb(Box::new(crate::unstable_exit_cb));
|
checker.set_exit_cb(Box::new(crate::unstable_exit_cb));
|
||||||
checker.set_warn_cb(Box::new(crate::unstable_warn_cb));
|
checker.set_warn_cb(Box::new(crate::unstable_warn_cb));
|
||||||
if cli_options.legacy_unstable_flag() {
|
|
||||||
checker.enable_legacy_unstable();
|
|
||||||
checker.warn_on_legacy_unstable();
|
|
||||||
}
|
|
||||||
let unstable_features = cli_options.unstable_features();
|
let unstable_features = cli_options.unstable_features();
|
||||||
for granular_flag in crate::UNSTABLE_GRANULAR_FLAGS {
|
for granular_flag in crate::UNSTABLE_GRANULAR_FLAGS {
|
||||||
if unstable_features.contains(&granular_flag.name.to_string()) {
|
if unstable_features.contains(&granular_flag.name.to_string()) {
|
||||||
|
@ -856,7 +852,6 @@ impl CliFactory {
|
||||||
unsafely_ignore_certificate_errors: cli_options
|
unsafely_ignore_certificate_errors: cli_options
|
||||||
.unsafely_ignore_certificate_errors()
|
.unsafely_ignore_certificate_errors()
|
||||||
.clone(),
|
.clone(),
|
||||||
unstable: cli_options.legacy_unstable_flag(),
|
|
||||||
create_hmr_runner,
|
create_hmr_runner,
|
||||||
create_coverage_collector,
|
create_coverage_collector,
|
||||||
node_ipc: cli_options.node_ipc_fd(),
|
node_ipc: cli_options.node_ipc_fd(),
|
||||||
|
|
25
cli/main.rs
25
cli/main.rs
|
@ -478,25 +478,14 @@ fn resolve_flags_and_init(
|
||||||
Err(err) => exit_for_error(AnyError::from(err)),
|
Err(err) => exit_for_error(AnyError::from(err)),
|
||||||
};
|
};
|
||||||
|
|
||||||
// TODO(bartlomieju): remove when `--unstable` flag is removed.
|
// TODO(bartlomieju): remove in Deno v2.5 and hard error then.
|
||||||
if flags.unstable_config.legacy_flag_enabled {
|
if flags.unstable_config.legacy_flag_enabled {
|
||||||
#[allow(clippy::print_stderr)]
|
log::warn!(
|
||||||
if matches!(flags.subcommand, DenoSubcommand::Check(_)) {
|
"⚠️ {}",
|
||||||
// can't use log crate because that's not setup yet
|
colors::yellow(
|
||||||
eprintln!(
|
"The `--unstable` flag has been removed in Deno 2.0. Use granular `--unstable-*` flags instead.\nLearn more at: https://docs.deno.com/runtime/manual/tools/unstable_flags"
|
||||||
"⚠️ {}",
|
)
|
||||||
colors::yellow(
|
);
|
||||||
"The `--unstable` flag is not needed for `deno check` anymore."
|
|
||||||
)
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
eprintln!(
|
|
||||||
"⚠️ {}",
|
|
||||||
colors::yellow(
|
|
||||||
"The `--unstable` flag is deprecated and will be removed in Deno 2.0. Use granular `--unstable-*` flags instead.\nLearn more at: https://docs.deno.com/runtime/manual/tools/unstable_flags"
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let default_v8_flags = match flags.subcommand {
|
let default_v8_flags = match flags.subcommand {
|
||||||
|
|
|
@ -624,7 +624,7 @@ impl<'a> DenoCompileBinaryWriter<'a> {
|
||||||
},
|
},
|
||||||
node_modules,
|
node_modules,
|
||||||
unstable_config: UnstableConfig {
|
unstable_config: UnstableConfig {
|
||||||
legacy_flag_enabled: cli_options.legacy_unstable_flag(),
|
legacy_flag_enabled: false,
|
||||||
bare_node_builtins: cli_options.unstable_bare_node_builtins(),
|
bare_node_builtins: cli_options.unstable_bare_node_builtins(),
|
||||||
sloppy_imports: cli_options.unstable_sloppy_imports(),
|
sloppy_imports: cli_options.unstable_sloppy_imports(),
|
||||||
features: cli_options.unstable_features(),
|
features: cli_options.unstable_features(),
|
||||||
|
|
|
@ -682,12 +682,6 @@ pub async fn run(
|
||||||
let feature_checker = Arc::new({
|
let feature_checker = Arc::new({
|
||||||
let mut checker = FeatureChecker::default();
|
let mut checker = FeatureChecker::default();
|
||||||
checker.set_exit_cb(Box::new(crate::unstable_exit_cb));
|
checker.set_exit_cb(Box::new(crate::unstable_exit_cb));
|
||||||
// TODO(bartlomieju): enable, once we deprecate `--unstable` in favor
|
|
||||||
// of granular --unstable-* flags.
|
|
||||||
// feature_checker.set_warn_cb(Box::new(crate::unstable_warn_cb));
|
|
||||||
if metadata.unstable_config.legacy_flag_enabled {
|
|
||||||
checker.enable_legacy_unstable();
|
|
||||||
}
|
|
||||||
for feature in metadata.unstable_config.features {
|
for feature in metadata.unstable_config.features {
|
||||||
// `metadata` is valid for the whole lifetime of the program, so we
|
// `metadata` is valid for the whole lifetime of the program, so we
|
||||||
// can leak the string here.
|
// can leak the string here.
|
||||||
|
@ -733,7 +727,6 @@ pub async fn run(
|
||||||
seed: metadata.seed,
|
seed: metadata.seed,
|
||||||
unsafely_ignore_certificate_errors: metadata
|
unsafely_ignore_certificate_errors: metadata
|
||||||
.unsafely_ignore_certificate_errors,
|
.unsafely_ignore_certificate_errors,
|
||||||
unstable: metadata.unstable_config.legacy_flag_enabled,
|
|
||||||
create_hmr_runner: None,
|
create_hmr_runner: None,
|
||||||
create_coverage_collector: None,
|
create_coverage_collector: None,
|
||||||
node_ipc: None,
|
node_ipc: None,
|
||||||
|
|
|
@ -490,10 +490,6 @@ async fn resolve_shim_data(
|
||||||
TypeCheckMode::Local => executable_args.push("--check".to_string()),
|
TypeCheckMode::Local => executable_args.push("--check".to_string()),
|
||||||
}
|
}
|
||||||
|
|
||||||
if flags.unstable_config.legacy_flag_enabled {
|
|
||||||
executable_args.push("--unstable".to_string());
|
|
||||||
}
|
|
||||||
|
|
||||||
for feature in &flags.unstable_config.features {
|
for feature in &flags.unstable_config.features {
|
||||||
executable_args.push(format!("--unstable-{}", feature));
|
executable_args.push(format!("--unstable-{}", feature));
|
||||||
}
|
}
|
||||||
|
@ -822,13 +818,7 @@ mod tests {
|
||||||
|
|
||||||
create_install_shim(
|
create_install_shim(
|
||||||
&HttpClientProvider::new(None, None),
|
&HttpClientProvider::new(None, None),
|
||||||
&Flags {
|
&Flags::default(),
|
||||||
unstable_config: UnstableConfig {
|
|
||||||
legacy_flag_enabled: true,
|
|
||||||
..Default::default()
|
|
||||||
},
|
|
||||||
..Flags::default()
|
|
||||||
},
|
|
||||||
InstallFlagsGlobal {
|
InstallFlagsGlobal {
|
||||||
module_url: "http://localhost:4545/echo_server.ts".to_string(),
|
module_url: "http://localhost:4545/echo_server.ts".to_string(),
|
||||||
args: vec![],
|
args: vec![],
|
||||||
|
@ -850,12 +840,11 @@ mod tests {
|
||||||
let content = fs::read_to_string(file_path).unwrap();
|
let content = fs::read_to_string(file_path).unwrap();
|
||||||
if cfg!(windows) {
|
if cfg!(windows) {
|
||||||
assert!(content.contains(
|
assert!(content.contains(
|
||||||
r#""run" "--unstable" "--no-config" "http://localhost:4545/echo_server.ts""#
|
r#""run" "--no-config" "http://localhost:4545/echo_server.ts""#
|
||||||
));
|
));
|
||||||
} else {
|
} else {
|
||||||
assert!(content.contains(
|
assert!(content
|
||||||
r#"run --unstable --no-config 'http://localhost:4545/echo_server.ts'"#
|
.contains(r#"run --no-config 'http://localhost:4545/echo_server.ts'"#));
|
||||||
));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -886,13 +875,7 @@ mod tests {
|
||||||
async fn install_unstable_legacy() {
|
async fn install_unstable_legacy() {
|
||||||
let shim_data = resolve_shim_data(
|
let shim_data = resolve_shim_data(
|
||||||
&HttpClientProvider::new(None, None),
|
&HttpClientProvider::new(None, None),
|
||||||
&Flags {
|
&Default::default(),
|
||||||
unstable_config: UnstableConfig {
|
|
||||||
legacy_flag_enabled: true,
|
|
||||||
..Default::default()
|
|
||||||
},
|
|
||||||
..Default::default()
|
|
||||||
},
|
|
||||||
&InstallFlagsGlobal {
|
&InstallFlagsGlobal {
|
||||||
module_url: "http://localhost:4545/echo_server.ts".to_string(),
|
module_url: "http://localhost:4545/echo_server.ts".to_string(),
|
||||||
args: vec![],
|
args: vec![],
|
||||||
|
@ -907,12 +890,7 @@ mod tests {
|
||||||
assert_eq!(shim_data.name, "echo_server");
|
assert_eq!(shim_data.name, "echo_server");
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
shim_data.args,
|
shim_data.args,
|
||||||
vec![
|
vec!["run", "--no-config", "http://localhost:4545/echo_server.ts",]
|
||||||
"run",
|
|
||||||
"--unstable",
|
|
||||||
"--no-config",
|
|
||||||
"http://localhost:4545/echo_server.ts",
|
|
||||||
]
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -112,7 +112,6 @@ pub struct CliMainWorkerOptions {
|
||||||
pub origin_data_folder_path: Option<PathBuf>,
|
pub origin_data_folder_path: Option<PathBuf>,
|
||||||
pub seed: Option<u64>,
|
pub seed: Option<u64>,
|
||||||
pub unsafely_ignore_certificate_errors: Option<Vec<String>>,
|
pub unsafely_ignore_certificate_errors: Option<Vec<String>>,
|
||||||
pub unstable: bool,
|
|
||||||
pub skip_op_registration: bool,
|
pub skip_op_registration: bool,
|
||||||
pub create_hmr_runner: Option<CreateHmrRunnerCb>,
|
pub create_hmr_runner: Option<CreateHmrRunnerCb>,
|
||||||
pub create_coverage_collector: Option<CreateCoverageCollectorCb>,
|
pub create_coverage_collector: Option<CreateCoverageCollectorCb>,
|
||||||
|
@ -580,7 +579,6 @@ impl CliMainWorkerFactory {
|
||||||
is_stdout_tty: deno_terminal::is_stdout_tty(),
|
is_stdout_tty: deno_terminal::is_stdout_tty(),
|
||||||
is_stderr_tty: deno_terminal::is_stderr_tty(),
|
is_stderr_tty: deno_terminal::is_stderr_tty(),
|
||||||
color_level: colors::get_color_level(),
|
color_level: colors::get_color_level(),
|
||||||
unstable: shared.options.unstable,
|
|
||||||
unstable_features,
|
unstable_features,
|
||||||
user_agent: version::DENO_VERSION_INFO.user_agent.to_string(),
|
user_agent: version::DENO_VERSION_INFO.user_agent.to_string(),
|
||||||
inspect: shared.options.is_inspecting,
|
inspect: shared.options.is_inspecting,
|
||||||
|
@ -775,7 +773,6 @@ fn create_web_worker_callback(
|
||||||
color_level: colors::get_color_level(),
|
color_level: colors::get_color_level(),
|
||||||
is_stdout_tty: deno_terminal::is_stdout_tty(),
|
is_stdout_tty: deno_terminal::is_stdout_tty(),
|
||||||
is_stderr_tty: deno_terminal::is_stderr_tty(),
|
is_stderr_tty: deno_terminal::is_stderr_tty(),
|
||||||
unstable: shared.options.unstable,
|
|
||||||
unstable_features,
|
unstable_features,
|
||||||
user_agent: version::DENO_VERSION_INFO.user_agent.to_string(),
|
user_agent: version::DENO_VERSION_INFO.user_agent.to_string(),
|
||||||
inspect: shared.options.is_inspecting,
|
inspect: shared.options.is_inspecting,
|
||||||
|
|
|
@ -194,27 +194,4 @@ denoNsUnstableById[unstableIds.webgpu] = {
|
||||||
|
|
||||||
// denoNsUnstableById[unstableIds.workerOptions] = { __proto__: null }
|
// denoNsUnstableById[unstableIds.workerOptions] = { __proto__: null }
|
||||||
|
|
||||||
// when editing this list, also update unstableDenoProps in cli/tsc/99_main_compiler.js
|
export { denoNs, denoNsUnstableById, unstableIds };
|
||||||
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 };
|
|
||||||
|
|
|
@ -37,7 +37,6 @@ const {
|
||||||
ObjectKeys,
|
ObjectKeys,
|
||||||
ObjectPrototypeIsPrototypeOf,
|
ObjectPrototypeIsPrototypeOf,
|
||||||
ObjectSetPrototypeOf,
|
ObjectSetPrototypeOf,
|
||||||
ObjectValues,
|
|
||||||
PromisePrototypeThen,
|
PromisePrototypeThen,
|
||||||
PromiseResolve,
|
PromiseResolve,
|
||||||
StringPrototypePadEnd,
|
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 * as messagePort from "ext:deno_web/13_message_port.js";
|
||||||
import {
|
import {
|
||||||
denoNs,
|
denoNs,
|
||||||
denoNsUnstable,
|
|
||||||
denoNsUnstableById,
|
denoNsUnstableById,
|
||||||
unstableIds,
|
unstableIds,
|
||||||
} from "ext:runtime/90_deno_ns.js";
|
} 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
|
// Set up global properties shared by main and worker runtime that are exposed
|
||||||
// by unstable features if those are enabled.
|
// by unstable features if those are enabled.
|
||||||
function exposeUnstableFeaturesForWindowOrWorkerGlobalScope(options) {
|
function exposeUnstableFeaturesForWindowOrWorkerGlobalScope(unstableFeatures) {
|
||||||
const { unstableFlag, unstableFeatures } = options;
|
const featureIds = ArrayPrototypeMap(
|
||||||
if (unstableFlag) {
|
ObjectKeys(
|
||||||
const all = ObjectValues(unstableForWindowOrWorkerGlobalScope);
|
unstableForWindowOrWorkerGlobalScope,
|
||||||
for (let i = 0; i <= all.length; i++) {
|
),
|
||||||
const props = all[i];
|
(k) => k | 0,
|
||||||
ObjectDefineProperties(globalThis, { ...props });
|
);
|
||||||
}
|
|
||||||
} else {
|
|
||||||
const featureIds = ArrayPrototypeMap(
|
|
||||||
ObjectKeys(
|
|
||||||
unstableForWindowOrWorkerGlobalScope,
|
|
||||||
),
|
|
||||||
(k) => k | 0,
|
|
||||||
);
|
|
||||||
|
|
||||||
for (let i = 0; i <= featureIds.length; i++) {
|
for (let i = 0; i <= featureIds.length; i++) {
|
||||||
const featureId = featureIds[i];
|
const featureId = featureIds[i];
|
||||||
if (ArrayPrototypeIncludes(unstableFeatures, featureId)) {
|
if (ArrayPrototypeIncludes(unstableFeatures, featureId)) {
|
||||||
const props = unstableForWindowOrWorkerGlobalScope[featureId];
|
const props = unstableForWindowOrWorkerGlobalScope[featureId];
|
||||||
ObjectDefineProperties(globalThis, { ...props });
|
ObjectDefineProperties(globalThis, { ...props });
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -572,17 +561,16 @@ function bootstrapMainRuntime(runtimeOptions, warmup = false) {
|
||||||
const {
|
const {
|
||||||
0: denoVersion,
|
0: denoVersion,
|
||||||
1: location_,
|
1: location_,
|
||||||
2: unstableFlag,
|
2: unstableFeatures,
|
||||||
3: unstableFeatures,
|
3: inspectFlag,
|
||||||
4: inspectFlag,
|
5: hasNodeModulesDir,
|
||||||
6: hasNodeModulesDir,
|
6: argv0,
|
||||||
7: argv0,
|
7: nodeDebug,
|
||||||
8: nodeDebug,
|
8: mode,
|
||||||
9: mode,
|
9: servePort,
|
||||||
10: servePort,
|
10: serveHost,
|
||||||
11: serveHost,
|
11: serveIsMain,
|
||||||
12: serveIsMain,
|
12: serveWorkerCount,
|
||||||
13: serveWorkerCount,
|
|
||||||
} = runtimeOptions;
|
} = runtimeOptions;
|
||||||
|
|
||||||
if (mode === executionModes.serve) {
|
if (mode === executionModes.serve) {
|
||||||
|
@ -692,10 +680,7 @@ function bootstrapMainRuntime(runtimeOptions, warmup = false) {
|
||||||
location.setLocationHref(location_);
|
location.setLocationHref(location_);
|
||||||
}
|
}
|
||||||
|
|
||||||
exposeUnstableFeaturesForWindowOrWorkerGlobalScope({
|
exposeUnstableFeaturesForWindowOrWorkerGlobalScope(unstableFeatures);
|
||||||
unstableFlag,
|
|
||||||
unstableFeatures,
|
|
||||||
});
|
|
||||||
ObjectDefineProperties(globalThis, mainRuntimeGlobalProperties);
|
ObjectDefineProperties(globalThis, mainRuntimeGlobalProperties);
|
||||||
ObjectDefineProperties(globalThis, {
|
ObjectDefineProperties(globalThis, {
|
||||||
// TODO(bartlomieju): in the future we might want to change the
|
// TODO(bartlomieju): in the future we might want to change the
|
||||||
|
@ -742,14 +727,9 @@ function bootstrapMainRuntime(runtimeOptions, warmup = false) {
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
// TODO(bartlomieju): deprecate --unstable
|
for (let i = 0; i <= unstableFeatures.length; i++) {
|
||||||
if (unstableFlag) {
|
const id = unstableFeatures[i];
|
||||||
ObjectAssign(finalDenoNs, denoNsUnstable);
|
ObjectAssign(finalDenoNs, denoNsUnstableById[id]);
|
||||||
} else {
|
|
||||||
for (let i = 0; i <= unstableFeatures.length; i++) {
|
|
||||||
const id = unstableFeatures[i];
|
|
||||||
ObjectAssign(finalDenoNs, denoNsUnstableById[id]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ArrayPrototypeIncludes(unstableFeatures, unstableIds.unsafeProto)) {
|
if (!ArrayPrototypeIncludes(unstableFeatures, unstableIds.unsafeProto)) {
|
||||||
|
@ -825,12 +805,11 @@ function bootstrapWorkerRuntime(
|
||||||
const {
|
const {
|
||||||
0: denoVersion,
|
0: denoVersion,
|
||||||
1: location_,
|
1: location_,
|
||||||
2: unstableFlag,
|
2: unstableFeatures,
|
||||||
3: unstableFeatures,
|
4: enableTestingFeaturesFlag,
|
||||||
5: enableTestingFeaturesFlag,
|
5: hasNodeModulesDir,
|
||||||
6: hasNodeModulesDir,
|
6: argv0,
|
||||||
7: argv0,
|
7: nodeDebug,
|
||||||
8: nodeDebug,
|
|
||||||
} = runtimeOptions;
|
} = runtimeOptions;
|
||||||
|
|
||||||
// TODO(iuioiua): remove in Deno v2. This allows us to dynamically delete
|
// TODO(iuioiua): remove in Deno v2. This allows us to dynamically delete
|
||||||
|
@ -846,10 +825,7 @@ function bootstrapWorkerRuntime(
|
||||||
delete globalThis.bootstrap;
|
delete globalThis.bootstrap;
|
||||||
hasBootstrapped = true;
|
hasBootstrapped = true;
|
||||||
|
|
||||||
exposeUnstableFeaturesForWindowOrWorkerGlobalScope({
|
exposeUnstableFeaturesForWindowOrWorkerGlobalScope(unstableFeatures);
|
||||||
unstableFlag,
|
|
||||||
unstableFeatures,
|
|
||||||
});
|
|
||||||
ObjectDefineProperties(globalThis, workerRuntimeGlobalProperties);
|
ObjectDefineProperties(globalThis, workerRuntimeGlobalProperties);
|
||||||
ObjectDefineProperties(globalThis, {
|
ObjectDefineProperties(globalThis, {
|
||||||
name: core.propWritable(name),
|
name: core.propWritable(name),
|
||||||
|
@ -891,14 +867,9 @@ function bootstrapWorkerRuntime(
|
||||||
globalThis.pollForMessages = pollForMessages;
|
globalThis.pollForMessages = pollForMessages;
|
||||||
globalThis.hasMessageEventListener = hasMessageEventListener;
|
globalThis.hasMessageEventListener = hasMessageEventListener;
|
||||||
|
|
||||||
// TODO(bartlomieju): deprecate --unstable
|
for (let i = 0; i <= unstableFeatures.length; i++) {
|
||||||
if (unstableFlag) {
|
const id = unstableFeatures[i];
|
||||||
ObjectAssign(finalDenoNs, denoNsUnstable);
|
ObjectAssign(finalDenoNs, denoNsUnstableById[id]);
|
||||||
} else {
|
|
||||||
for (let i = 0; i <= unstableFeatures.length; i++) {
|
|
||||||
const id = unstableFeatures[i];
|
|
||||||
ObjectAssign(finalDenoNs, denoNsUnstableById[id]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Not available in workers
|
// Not available in workers
|
||||||
|
|
|
@ -95,11 +95,7 @@ pub fn op_bootstrap_user_agent(state: &mut OpState) -> String {
|
||||||
#[serde]
|
#[serde]
|
||||||
pub fn op_bootstrap_unstable_args(state: &mut OpState) -> Vec<String> {
|
pub fn op_bootstrap_unstable_args(state: &mut OpState) -> Vec<String> {
|
||||||
let options = state.borrow::<BootstrapOptions>();
|
let options = state.borrow::<BootstrapOptions>();
|
||||||
if options.unstable {
|
let mut flags = Vec::with_capacity(options.unstable_features.len());
|
||||||
return vec!["--unstable".to_string()];
|
|
||||||
}
|
|
||||||
|
|
||||||
let mut flags = Vec::new();
|
|
||||||
for granular_flag in crate::UNSTABLE_GRANULAR_FLAGS.iter() {
|
for granular_flag in crate::UNSTABLE_GRANULAR_FLAGS.iter() {
|
||||||
if options.unstable_features.contains(&granular_flag.id) {
|
if options.unstable_features.contains(&granular_flag.id) {
|
||||||
flags.push(format!("--unstable-{}", granular_flag.name));
|
flags.push(format!("--unstable-{}", granular_flag.name));
|
||||||
|
|
|
@ -106,8 +106,6 @@ pub struct BootstrapOptions {
|
||||||
pub is_stdout_tty: bool,
|
pub is_stdout_tty: bool,
|
||||||
pub is_stderr_tty: bool,
|
pub is_stderr_tty: bool,
|
||||||
pub color_level: deno_terminal::colors::ColorLevel,
|
pub color_level: deno_terminal::colors::ColorLevel,
|
||||||
// --unstable flag, deprecated
|
|
||||||
pub unstable: bool,
|
|
||||||
// --unstable-* flags
|
// --unstable-* flags
|
||||||
pub unstable_features: Vec<i32>,
|
pub unstable_features: Vec<i32>,
|
||||||
pub user_agent: String,
|
pub user_agent: String,
|
||||||
|
@ -144,7 +142,6 @@ impl Default for BootstrapOptions {
|
||||||
log_level: Default::default(),
|
log_level: Default::default(),
|
||||||
locale: "en".to_string(),
|
locale: "en".to_string(),
|
||||||
location: Default::default(),
|
location: Default::default(),
|
||||||
unstable: Default::default(),
|
|
||||||
unstable_features: Default::default(),
|
unstable_features: Default::default(),
|
||||||
inspect: Default::default(),
|
inspect: Default::default(),
|
||||||
args: Default::default(),
|
args: Default::default(),
|
||||||
|
@ -174,8 +171,6 @@ struct BootstrapV8<'a>(
|
||||||
&'a str,
|
&'a str,
|
||||||
// location
|
// location
|
||||||
Option<&'a str>,
|
Option<&'a str>,
|
||||||
// unstable
|
|
||||||
bool,
|
|
||||||
// granular unstable flags
|
// granular unstable flags
|
||||||
&'a [i32],
|
&'a [i32],
|
||||||
// inspect
|
// inspect
|
||||||
|
@ -213,7 +208,6 @@ impl BootstrapOptions {
|
||||||
let bootstrap = BootstrapV8(
|
let bootstrap = BootstrapV8(
|
||||||
&self.deno_version,
|
&self.deno_version,
|
||||||
self.location.as_ref().map(|l| l.as_str()),
|
self.location.as_ref().map(|l| l.as_str()),
|
||||||
self.unstable,
|
|
||||||
self.unstable_features.as_ref(),
|
self.unstable_features.as_ref(),
|
||||||
self.inspect,
|
self.inspect,
|
||||||
self.enable_testing_features,
|
self.enable_testing_features,
|
||||||
|
|
|
@ -111,7 +111,9 @@ fn node_unit_test(test: String) {
|
||||||
.arg("--config")
|
.arg("--config")
|
||||||
.arg(deno_config_path())
|
.arg(deno_config_path())
|
||||||
.arg("--no-lock")
|
.arg("--no-lock")
|
||||||
.arg("--unstable")
|
.arg("--unstable-broadcast-channel")
|
||||||
|
.arg("--unstable-http")
|
||||||
|
.arg("--unstable-net")
|
||||||
// TODO(kt3k): This option is required to pass tls_test.ts,
|
// TODO(kt3k): This option is required to pass tls_test.ts,
|
||||||
// but this shouldn't be necessary. tls.connect currently doesn't
|
// but this shouldn't be necessary. tls.connect currently doesn't
|
||||||
// pass hostname option correctly and it causes cert errors.
|
// pass hostname option correctly and it causes cert errors.
|
||||||
|
|
|
@ -4338,7 +4338,7 @@ async fn websocketstream_ping() {
|
||||||
|
|
||||||
let child = util::deno_cmd()
|
let child = util::deno_cmd()
|
||||||
.arg("test")
|
.arg("test")
|
||||||
.arg("--unstable")
|
.arg("--unstable-net")
|
||||||
.arg("--allow-net")
|
.arg("--allow-net")
|
||||||
.arg("--cert")
|
.arg("--cert")
|
||||||
.arg(root_ca)
|
.arg(root_ca)
|
||||||
|
|
|
@ -108,7 +108,7 @@ async function testFetchProgrammaticProxy() {
|
||||||
"--quiet",
|
"--quiet",
|
||||||
"--reload",
|
"--reload",
|
||||||
"--allow-net=localhost:4545,localhost:4555",
|
"--allow-net=localhost:4545,localhost:4555",
|
||||||
"--unstable",
|
"--unstable-http",
|
||||||
"programmatic_proxy_client.ts",
|
"programmatic_proxy_client.ts",
|
||||||
],
|
],
|
||||||
}).output();
|
}).output();
|
||||||
|
|
Loading…
Reference in a new issue