mirror of
https://github.com/denoland/deno.git
synced 2025-08-04 10:59:13 +00:00
refactor(core): cleanup feature flags for js source inclusion (#19463)
Remove `ExtensionFileSourceCode::LoadedFromFsDuringSnapshot` and feature `include_js_for_snapshotting` since they leak paths that are only applicable in this repo to embedders. Replace with feature `exclude_js_sources`. Additionally the feature `force_include_js_sources` allows negating it, if both features are set. We need both of these because features are additive and there must be a way of force including sources for snapshot creation while still having the `exclude_js_sources` feature. `force_include_js_sources` is only set for build deps, so sources are still excluded from the final binary. You can also specify `force_include_js_sources` on any extension to override the above features for that extension. Towards #19398. But there was still the snapshot-from-snapshot situation where code could be executed twice, I addressed that by making `mod_evaluate()` and scripts like `core/01_core.js` behave idempotently. This allowed unifying `ext::init_ops()` and `ext::init_ops_and_esm()` into `ext::init()`.
This commit is contained in:
parent
5348778666
commit
ceb03cfb03
33 changed files with 251 additions and 381 deletions
|
@ -235,14 +235,14 @@ impl MainWorker {
|
|||
// `runtime/build.rs`, `runtime/web_worker.rs` and `cli/build.rs`!
|
||||
let mut extensions = vec![
|
||||
// Web APIs
|
||||
deno_webidl::deno_webidl::init_ops(),
|
||||
deno_console::deno_console::init_ops(),
|
||||
deno_url::deno_url::init_ops(),
|
||||
deno_web::deno_web::init_ops::<PermissionsContainer>(
|
||||
deno_webidl::deno_webidl::init(),
|
||||
deno_console::deno_console::init(),
|
||||
deno_url::deno_url::init(),
|
||||
deno_web::deno_web::init::<PermissionsContainer>(
|
||||
options.blob_store.clone(),
|
||||
options.bootstrap.location.clone(),
|
||||
),
|
||||
deno_fetch::deno_fetch::init_ops::<PermissionsContainer>(
|
||||
deno_fetch::deno_fetch::init::<PermissionsContainer>(
|
||||
deno_fetch::Options {
|
||||
user_agent: options.bootstrap.user_agent.clone(),
|
||||
root_cert_store_provider: options.root_cert_store_provider.clone(),
|
||||
|
@ -253,60 +253,60 @@ impl MainWorker {
|
|||
..Default::default()
|
||||
},
|
||||
),
|
||||
deno_cache::deno_cache::init_ops::<SqliteBackedCache>(create_cache),
|
||||
deno_websocket::deno_websocket::init_ops::<PermissionsContainer>(
|
||||
deno_cache::deno_cache::init::<SqliteBackedCache>(create_cache),
|
||||
deno_websocket::deno_websocket::init::<PermissionsContainer>(
|
||||
options.bootstrap.user_agent.clone(),
|
||||
options.root_cert_store_provider.clone(),
|
||||
options.unsafely_ignore_certificate_errors.clone(),
|
||||
),
|
||||
deno_webstorage::deno_webstorage::init_ops(
|
||||
deno_webstorage::deno_webstorage::init(
|
||||
options.origin_storage_dir.clone(),
|
||||
),
|
||||
deno_crypto::deno_crypto::init_ops(options.seed),
|
||||
deno_broadcast_channel::deno_broadcast_channel::init_ops(
|
||||
deno_crypto::deno_crypto::init(options.seed),
|
||||
deno_broadcast_channel::deno_broadcast_channel::init(
|
||||
options.broadcast_channel.clone(),
|
||||
unstable,
|
||||
),
|
||||
deno_ffi::deno_ffi::init_ops::<PermissionsContainer>(unstable),
|
||||
deno_net::deno_net::init_ops::<PermissionsContainer>(
|
||||
deno_ffi::deno_ffi::init::<PermissionsContainer>(unstable),
|
||||
deno_net::deno_net::init::<PermissionsContainer>(
|
||||
options.root_cert_store_provider.clone(),
|
||||
unstable,
|
||||
options.unsafely_ignore_certificate_errors.clone(),
|
||||
),
|
||||
deno_tls::deno_tls::init_ops(),
|
||||
deno_kv::deno_kv::init_ops(
|
||||
deno_tls::deno_tls::init(),
|
||||
deno_kv::deno_kv::init(
|
||||
SqliteDbHandler::<PermissionsContainer>::new(
|
||||
options.origin_storage_dir.clone(),
|
||||
),
|
||||
unstable,
|
||||
),
|
||||
deno_napi::deno_napi::init_ops::<PermissionsContainer>(),
|
||||
deno_http::deno_http::init_ops::<DefaultHttpPropertyExtractor>(),
|
||||
deno_io::deno_io::init_ops(Some(options.stdio)),
|
||||
deno_fs::deno_fs::init_ops::<PermissionsContainer>(
|
||||
deno_napi::deno_napi::init::<PermissionsContainer>(),
|
||||
deno_http::deno_http::init::<DefaultHttpPropertyExtractor>(),
|
||||
deno_io::deno_io::init(Some(options.stdio)),
|
||||
deno_fs::deno_fs::init::<PermissionsContainer>(
|
||||
unstable,
|
||||
options.fs.clone(),
|
||||
),
|
||||
deno_node::deno_node::init_ops::<PermissionsContainer>(
|
||||
deno_node::deno_node::init::<PermissionsContainer>(
|
||||
options.npm_resolver,
|
||||
options.fs,
|
||||
),
|
||||
// Ops from this crate
|
||||
ops::runtime::deno_runtime::init_ops(main_module.clone()),
|
||||
ops::worker_host::deno_worker_host::init_ops(
|
||||
ops::runtime::deno_runtime::init(main_module.clone()),
|
||||
ops::worker_host::deno_worker_host::init(
|
||||
options.create_web_worker_cb.clone(),
|
||||
options.web_worker_preload_module_cb.clone(),
|
||||
options.web_worker_pre_execute_module_cb.clone(),
|
||||
options.format_js_error_fn.clone(),
|
||||
),
|
||||
ops::fs_events::deno_fs_events::init_ops(),
|
||||
ops::os::deno_os::init_ops(exit_code.clone()),
|
||||
ops::permissions::deno_permissions::init_ops(),
|
||||
ops::process::deno_process::init_ops(),
|
||||
ops::signal::deno_signal::init_ops(),
|
||||
ops::tty::deno_tty::init_ops(),
|
||||
ops::http::deno_http_runtime::init_ops(),
|
||||
deno_permissions_worker::init_ops(
|
||||
ops::fs_events::deno_fs_events::init(),
|
||||
ops::os::deno_os::init(exit_code.clone()),
|
||||
ops::permissions::deno_permissions::init(),
|
||||
ops::process::deno_process::init(),
|
||||
ops::signal::deno_signal::init(),
|
||||
ops::tty::deno_tty::init(),
|
||||
ops::http::deno_http_runtime::init(),
|
||||
deno_permissions_worker::init(
|
||||
permissions,
|
||||
unstable,
|
||||
enable_testing_features,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue