2024-01-01 14:58:21 -05:00
|
|
|
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
2020-12-13 13:45:53 -05:00
|
|
|
|
2021-05-22 12:08:24 -04:00
|
|
|
pub use deno_broadcast_channel;
|
2022-09-28 08:11:12 -04:00
|
|
|
pub use deno_cache;
|
2024-01-22 06:08:01 -05:00
|
|
|
pub use deno_canvas;
|
2021-03-12 15:23:59 -05:00
|
|
|
pub use deno_console;
|
2021-11-28 13:07:32 -05:00
|
|
|
pub use deno_core;
|
2023-11-01 14:57:55 -04:00
|
|
|
pub use deno_cron;
|
2020-12-13 13:45:53 -05:00
|
|
|
pub use deno_crypto;
|
|
|
|
pub use deno_fetch;
|
2021-08-06 17:28:10 -04:00
|
|
|
pub use deno_ffi;
|
2023-03-07 04:13:44 -05:00
|
|
|
pub use deno_fs;
|
2021-07-12 06:44:49 -04:00
|
|
|
pub use deno_http;
|
2023-03-04 19:39:48 -05:00
|
|
|
pub use deno_io;
|
2023-03-22 00:13:24 -04:00
|
|
|
pub use deno_kv;
|
2022-10-05 10:06:44 -04:00
|
|
|
pub use deno_napi;
|
2021-06-28 19:43:03 -04:00
|
|
|
pub use deno_net;
|
2022-08-09 15:06:01 -04:00
|
|
|
pub use deno_node;
|
2024-03-12 13:42:26 -04:00
|
|
|
pub use deno_permissions;
|
|
|
|
pub use deno_terminal::colors;
|
2021-08-07 08:49:38 -04: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 10:17:18 -05:00
|
|
|
pub use deno_url;
|
2020-12-13 13:45:53 -05:00
|
|
|
pub use deno_web;
|
2023-12-08 19:19:16 -05: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 10:17:18 -05:00
|
|
|
pub use deno_webidl;
|
2021-01-06 10:57:28 -05:00
|
|
|
pub use deno_websocket;
|
2021-05-10 06:02:47 -04:00
|
|
|
pub use deno_webstorage;
|
2020-12-13 13:45:53 -05:00
|
|
|
|
2024-04-17 10:19:55 -04:00
|
|
|
pub mod code_cache;
|
2020-12-13 13:45:53 -05:00
|
|
|
pub mod errors;
|
2022-09-02 16:53:23 -04:00
|
|
|
pub mod fmt_errors;
|
2020-12-13 13:45:53 -05:00
|
|
|
pub mod fs_util;
|
2021-05-26 15:07:12 -04:00
|
|
|
pub mod inspector_server;
|
2020-12-13 13:45:53 -05:00
|
|
|
pub mod js;
|
|
|
|
pub mod ops;
|
2024-09-16 16:39:37 -04:00
|
|
|
pub mod permissions;
|
2023-11-14 07:15:49 -05:00
|
|
|
pub mod snapshot;
|
2024-11-15 04:33:03 -05:00
|
|
|
pub mod sys_info;
|
2020-12-13 13:45:53 -05:00
|
|
|
pub mod tokio_util;
|
|
|
|
pub mod web_worker;
|
|
|
|
pub mod worker;
|
2021-10-05 16:41:14 -04:00
|
|
|
|
|
|
|
mod worker_bootstrap;
|
|
|
|
pub use worker_bootstrap::BootstrapOptions;
|
2024-04-24 15:45:49 -04:00
|
|
|
pub use worker_bootstrap::WorkerExecutionMode;
|
2023-05-30 11:34:50 -04:00
|
|
|
pub use worker_bootstrap::WorkerLogLevel;
|
2023-08-28 17:30:46 -04:00
|
|
|
|
|
|
|
mod shared;
|
|
|
|
pub use shared::runtime;
|
2024-01-23 09:33:07 -05:00
|
|
|
|
2024-08-27 07:45:27 -04:00
|
|
|
pub struct UnstableGranularFlag {
|
|
|
|
pub name: &'static str,
|
|
|
|
pub help_text: &'static str,
|
|
|
|
pub show_in_help: bool,
|
2024-01-23 09:33:07 -05:00
|
|
|
// id to enable it in runtime/99_main.js
|
2024-08-27 07:45:27 -04: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 05:11:41 -04:00
|
|
|
show_in_help: false,
|
2024-08-27 07:45:27 -04:00
|
|
|
id: 3,
|
|
|
|
},
|
|
|
|
UnstableGranularFlag {
|
|
|
|
name: deno_fs::UNSTABLE_FEATURE_NAME,
|
|
|
|
help_text: "Enable unstable file system APIs",
|
2024-09-03 05:11:41 -04:00
|
|
|
show_in_help: false,
|
2024-08-27 07:45:27 -04:00
|
|
|
id: 4,
|
|
|
|
},
|
|
|
|
UnstableGranularFlag {
|
|
|
|
name: ops::http::UNSTABLE_FEATURE_NAME,
|
|
|
|
help_text: "Enable unstable HTTP APIs",
|
2024-09-11 20:46:48 -04:00
|
|
|
show_in_help: false,
|
2024-08-27 07:45:27 -04: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 08:11:29 -05:00
|
|
|
UnstableGranularFlag {
|
|
|
|
name: "node-globals",
|
|
|
|
help_text: "Expose Node globals everywhere",
|
|
|
|
show_in_help: true,
|
|
|
|
id: 8,
|
|
|
|
},
|
2024-11-13 05:38:46 -05:00
|
|
|
UnstableGranularFlag {
|
|
|
|
name: "otel",
|
|
|
|
help_text: "Enable unstable OpenTelemetry features",
|
|
|
|
show_in_help: false,
|
2024-11-14 08:11:29 -05:00
|
|
|
id: 9,
|
2024-11-13 05:38:46 -05:00
|
|
|
},
|
2024-09-03 05:07:02 -04:00
|
|
|
// TODO(bartlomieju): consider removing it
|
2024-08-27 07:45:27 -04:00
|
|
|
UnstableGranularFlag {
|
|
|
|
name: ops::process::UNSTABLE_FEATURE_NAME,
|
|
|
|
help_text: "Enable unstable process APIs",
|
2024-09-03 05:07:02 -04:00
|
|
|
show_in_help: false,
|
2024-11-14 08:11:29 -05:00
|
|
|
id: 10,
|
2024-08-27 07:45:27 -04:00
|
|
|
},
|
|
|
|
UnstableGranularFlag {
|
|
|
|
name: "temporal",
|
|
|
|
help_text: "Enable unstable Temporal API",
|
|
|
|
show_in_help: true,
|
2024-11-14 08:11:29 -05:00
|
|
|
id: 11,
|
2024-08-27 07:45:27 -04:00
|
|
|
},
|
|
|
|
UnstableGranularFlag {
|
|
|
|
name: "unsafe-proto",
|
|
|
|
help_text: "Enable unsafe __proto__ support. This is a security risk.",
|
|
|
|
show_in_help: true,
|
2024-01-23 09:33:07 -05:00
|
|
|
// This number is used directly in the JS code. Search
|
|
|
|
// for "unstableIds" to see where it's used.
|
2024-11-14 08:11:29 -05:00
|
|
|
id: 12,
|
2024-08-27 07:45:27 -04:00
|
|
|
},
|
|
|
|
UnstableGranularFlag {
|
|
|
|
name: deno_webgpu::UNSTABLE_FEATURE_NAME,
|
2024-09-24 10:04:52 -04:00
|
|
|
help_text: "Enable unstable `WebGPU` APIs",
|
|
|
|
show_in_help: true,
|
2024-11-14 08:11:29 -05:00
|
|
|
id: 13,
|
2024-08-27 07:45:27 -04:00
|
|
|
},
|
|
|
|
UnstableGranularFlag {
|
|
|
|
name: ops::worker_host::UNSTABLE_FEATURE_NAME,
|
|
|
|
help_text: "Enable unstable Web Worker APIs",
|
|
|
|
show_in_help: true,
|
2024-11-14 08:11:29 -05:00
|
|
|
id: 14,
|
2024-08-27 07:45:27 -04:00
|
|
|
},
|
2024-01-23 09:33:07 -05:00
|
|
|
];
|
|
|
|
|
2024-11-14 07:16:28 -05:00
|
|
|
pub fn exit(code: i32) -> ! {
|
|
|
|
crate::ops::otel::flush();
|
|
|
|
#[allow(clippy::disallowed_methods)]
|
|
|
|
std::process::exit(code);
|
|
|
|
}
|
|
|
|
|
2024-01-23 09:33:07 -05:00
|
|
|
#[cfg(test)]
|
|
|
|
mod test {
|
|
|
|
use super::*;
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn unstable_granular_flag_names_sorted() {
|
|
|
|
let flags = UNSTABLE_GRANULAR_FLAGS
|
|
|
|
.iter()
|
2024-08-27 07:45:27 -04:00
|
|
|
.map(|granular_flag| granular_flag.name.to_string())
|
2024-01-23 09:33:07 -05: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);
|
|
|
|
}
|
|
|
|
}
|