2024-01-01 19:58:21 +00:00
|
|
|
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
2020-12-13 18:45:53 +00:00
|
|
|
|
2021-05-22 16:08:24 +00:00
|
|
|
pub use deno_broadcast_channel;
|
2022-09-28 12:11:12 +00:00
|
|
|
pub use deno_cache;
|
2024-01-22 11:08:01 +00:00
|
|
|
pub use deno_canvas;
|
2021-03-12 20:23:59 +00:00
|
|
|
pub use deno_console;
|
2021-11-28 18:07:32 +00:00
|
|
|
pub use deno_core;
|
2023-11-01 18:57:55 +00:00
|
|
|
pub use deno_cron;
|
2020-12-13 18:45:53 +00:00
|
|
|
pub use deno_crypto;
|
|
|
|
pub use deno_fetch;
|
2021-08-06 21:28:10 +00:00
|
|
|
pub use deno_ffi;
|
2023-03-07 09:13:44 +00:00
|
|
|
pub use deno_fs;
|
2021-07-12 10:44:49 +00:00
|
|
|
pub use deno_http;
|
2023-03-05 00:39:48 +00:00
|
|
|
pub use deno_io;
|
2023-03-22 04:13:24 +00:00
|
|
|
pub use deno_kv;
|
2022-10-05 14:06:44 +00:00
|
|
|
pub use deno_napi;
|
2021-06-28 23:43:03 +00:00
|
|
|
pub use deno_net;
|
2022-08-09 19:06:01 +00:00
|
|
|
pub use deno_node;
|
2024-03-12 17:42:26 +00:00
|
|
|
pub use deno_permissions;
|
|
|
|
pub use deno_terminal::colors;
|
2021-08-07 12:49:38 +00:00
|
|
|
pub use deno_tls;
|
chore: split web op crate (#9635)
This commit starts splitting out the deno_web op crate into multiple
smaller crates. This commit splits out WebIDL and URL API, but in the
future I want to split out each spec into its own crate. That means we
will have (in rough order of loading): `webidl`, `dom`, `streams`,
`console`, `encoding`, `url`, `file`, `fetch`, `websocket`, and
`webgpu` crates.
2021-03-12 15:17:18 +00:00
|
|
|
pub use deno_url;
|
2020-12-13 18:45:53 +00:00
|
|
|
pub use deno_web;
|
2023-12-09 00:19:16 +00:00
|
|
|
pub use deno_webgpu;
|
chore: split web op crate (#9635)
This commit starts splitting out the deno_web op crate into multiple
smaller crates. This commit splits out WebIDL and URL API, but in the
future I want to split out each spec into its own crate. That means we
will have (in rough order of loading): `webidl`, `dom`, `streams`,
`console`, `encoding`, `url`, `file`, `fetch`, `websocket`, and
`webgpu` crates.
2021-03-12 15:17:18 +00:00
|
|
|
pub use deno_webidl;
|
2021-01-06 15:57:28 +00:00
|
|
|
pub use deno_websocket;
|
2021-05-10 10:02:47 +00:00
|
|
|
pub use deno_webstorage;
|
2020-12-13 18:45:53 +00:00
|
|
|
|
2024-04-17 14:19:55 +00:00
|
|
|
pub mod code_cache;
|
2020-12-13 18:45:53 +00:00
|
|
|
pub mod errors;
|
2022-09-02 20:53:23 +00:00
|
|
|
pub mod fmt_errors;
|
2020-12-13 18:45:53 +00:00
|
|
|
pub mod fs_util;
|
2021-05-26 19:07:12 +00:00
|
|
|
pub mod inspector_server;
|
2020-12-13 18:45:53 +00:00
|
|
|
pub mod js;
|
|
|
|
pub mod ops;
|
2024-09-16 20:39:37 +00:00
|
|
|
pub mod permissions;
|
2023-11-14 12:15:49 +00:00
|
|
|
pub mod snapshot;
|
2024-11-15 09:33:03 +00:00
|
|
|
pub mod sys_info;
|
2020-12-13 18:45:53 +00:00
|
|
|
pub mod tokio_util;
|
|
|
|
pub mod web_worker;
|
|
|
|
pub mod worker;
|
2021-10-05 20:41:14 +00:00
|
|
|
|
|
|
|
mod worker_bootstrap;
|
|
|
|
pub use worker_bootstrap::BootstrapOptions;
|
2024-04-24 19:45:49 +00:00
|
|
|
pub use worker_bootstrap::WorkerExecutionMode;
|
2023-05-30 15:34:50 +00:00
|
|
|
pub use worker_bootstrap::WorkerLogLevel;
|
2023-08-28 21:30:46 +00:00
|
|
|
|
|
|
|
mod shared;
|
|
|
|
pub use shared::runtime;
|
2024-01-23 14:33:07 +00:00
|
|
|
|
2024-08-27 11:45:27 +00:00
|
|
|
pub struct UnstableGranularFlag {
|
|
|
|
pub name: &'static str,
|
|
|
|
pub help_text: &'static str,
|
|
|
|
pub show_in_help: bool,
|
2024-01-23 14:33:07 +00:00
|
|
|
// id to enable it in runtime/99_main.js
|
2024-08-27 11:45:27 +00:00
|
|
|
pub id: i32,
|
|
|
|
}
|
|
|
|
|
|
|
|
// NOTE(bartlomieju): keep IDs in sync with `runtime/90_deno_ns.js` (search for `unstableFeatures`)
|
|
|
|
pub static UNSTABLE_GRANULAR_FLAGS: &[UnstableGranularFlag] = &[
|
|
|
|
UnstableGranularFlag {
|
|
|
|
name: deno_broadcast_channel::UNSTABLE_FEATURE_NAME,
|
|
|
|
help_text: "Enable unstable `BroadcastChannel` API",
|
|
|
|
show_in_help: true,
|
|
|
|
id: 1,
|
|
|
|
},
|
|
|
|
UnstableGranularFlag {
|
|
|
|
name: deno_cron::UNSTABLE_FEATURE_NAME,
|
|
|
|
help_text: "Enable unstable Deno.cron API",
|
|
|
|
show_in_help: true,
|
|
|
|
id: 2,
|
|
|
|
},
|
|
|
|
UnstableGranularFlag {
|
|
|
|
name: deno_ffi::UNSTABLE_FEATURE_NAME,
|
|
|
|
help_text: "Enable unstable FFI APIs",
|
2024-09-03 09:11:41 +00:00
|
|
|
show_in_help: false,
|
2024-08-27 11:45:27 +00:00
|
|
|
id: 3,
|
|
|
|
},
|
|
|
|
UnstableGranularFlag {
|
|
|
|
name: deno_fs::UNSTABLE_FEATURE_NAME,
|
|
|
|
help_text: "Enable unstable file system APIs",
|
2024-09-03 09:11:41 +00:00
|
|
|
show_in_help: false,
|
2024-08-27 11:45:27 +00:00
|
|
|
id: 4,
|
|
|
|
},
|
|
|
|
UnstableGranularFlag {
|
|
|
|
name: ops::http::UNSTABLE_FEATURE_NAME,
|
|
|
|
help_text: "Enable unstable HTTP APIs",
|
2024-09-12 00:46:48 +00:00
|
|
|
show_in_help: false,
|
2024-08-27 11:45:27 +00:00
|
|
|
id: 5,
|
|
|
|
},
|
|
|
|
UnstableGranularFlag {
|
|
|
|
name: deno_kv::UNSTABLE_FEATURE_NAME,
|
|
|
|
help_text: "Enable unstable Key-Value store APIs",
|
|
|
|
show_in_help: true,
|
|
|
|
id: 6,
|
|
|
|
},
|
|
|
|
UnstableGranularFlag {
|
|
|
|
name: deno_net::UNSTABLE_FEATURE_NAME,
|
|
|
|
help_text: "Enable unstable net APIs",
|
|
|
|
show_in_help: true,
|
|
|
|
id: 7,
|
|
|
|
},
|
2024-11-14 13:11:29 +00:00
|
|
|
UnstableGranularFlag {
|
|
|
|
name: "node-globals",
|
|
|
|
help_text: "Expose Node globals everywhere",
|
|
|
|
show_in_help: true,
|
|
|
|
id: 8,
|
|
|
|
},
|
2024-11-13 10:38:46 +00:00
|
|
|
UnstableGranularFlag {
|
|
|
|
name: "otel",
|
|
|
|
help_text: "Enable unstable OpenTelemetry features",
|
|
|
|
show_in_help: false,
|
2024-11-14 13:11:29 +00:00
|
|
|
id: 9,
|
2024-11-13 10:38:46 +00:00
|
|
|
},
|
2024-09-03 09:07:02 +00:00
|
|
|
// TODO(bartlomieju): consider removing it
|
2024-08-27 11:45:27 +00:00
|
|
|
UnstableGranularFlag {
|
|
|
|
name: ops::process::UNSTABLE_FEATURE_NAME,
|
|
|
|
help_text: "Enable unstable process APIs",
|
2024-09-03 09:07:02 +00:00
|
|
|
show_in_help: false,
|
2024-11-14 13:11:29 +00:00
|
|
|
id: 10,
|
2024-08-27 11:45:27 +00:00
|
|
|
},
|
|
|
|
UnstableGranularFlag {
|
|
|
|
name: "temporal",
|
|
|
|
help_text: "Enable unstable Temporal API",
|
|
|
|
show_in_help: true,
|
2024-11-14 13:11:29 +00:00
|
|
|
id: 11,
|
2024-08-27 11:45:27 +00:00
|
|
|
},
|
|
|
|
UnstableGranularFlag {
|
|
|
|
name: "unsafe-proto",
|
|
|
|
help_text: "Enable unsafe __proto__ support. This is a security risk.",
|
|
|
|
show_in_help: true,
|
2024-01-23 14:33:07 +00:00
|
|
|
// This number is used directly in the JS code. Search
|
|
|
|
// for "unstableIds" to see where it's used.
|
2024-11-14 13:11:29 +00:00
|
|
|
id: 12,
|
2024-08-27 11:45:27 +00:00
|
|
|
},
|
|
|
|
UnstableGranularFlag {
|
|
|
|
name: deno_webgpu::UNSTABLE_FEATURE_NAME,
|
2024-09-24 14:04:52 +00:00
|
|
|
help_text: "Enable unstable `WebGPU` APIs",
|
|
|
|
show_in_help: true,
|
2024-11-14 13:11:29 +00:00
|
|
|
id: 13,
|
2024-08-27 11:45:27 +00:00
|
|
|
},
|
|
|
|
UnstableGranularFlag {
|
|
|
|
name: ops::worker_host::UNSTABLE_FEATURE_NAME,
|
|
|
|
help_text: "Enable unstable Web Worker APIs",
|
|
|
|
show_in_help: true,
|
2024-11-14 13:11:29 +00:00
|
|
|
id: 14,
|
2024-08-27 11:45:27 +00:00
|
|
|
},
|
2024-01-23 14:33:07 +00:00
|
|
|
];
|
|
|
|
|
2024-11-14 12:16:28 +00:00
|
|
|
pub fn exit(code: i32) -> ! {
|
|
|
|
crate::ops::otel::flush();
|
|
|
|
#[allow(clippy::disallowed_methods)]
|
|
|
|
std::process::exit(code);
|
|
|
|
}
|
|
|
|
|
2024-01-23 14:33:07 +00:00
|
|
|
#[cfg(test)]
|
|
|
|
mod test {
|
|
|
|
use super::*;
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn unstable_granular_flag_names_sorted() {
|
|
|
|
let flags = UNSTABLE_GRANULAR_FLAGS
|
|
|
|
.iter()
|
2024-08-27 11:45:27 +00:00
|
|
|
.map(|granular_flag| granular_flag.name.to_string())
|
2024-01-23 14:33:07 +00:00
|
|
|
.collect::<Vec<_>>();
|
|
|
|
let mut sorted_flags = flags.clone();
|
|
|
|
sorted_flags.sort();
|
|
|
|
// sort the flags by name so they appear nicely in the help text
|
|
|
|
assert_eq!(flags, sorted_flags);
|
|
|
|
}
|
|
|
|
}
|