summaryrefslogtreecommitdiff
path: root/runtime
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2023-03-09 20:22:27 -0400
committerGitHub <noreply@github.com>2023-03-09 19:22:27 -0500
commitd1685b120bf7da5ba384806153f65d90ef156b77 (patch)
tree155c87f1beae810f52fb2a9ef9ab7526fa1af990 /runtime
parent78d430103a8f6931154ddbbe19d36f3b8630286d (diff)
refactor(core): remove RuntimeOptions::extensions_with_js (#18099)
This commit removes "deno_core::RuntimeOptions::extensions_with_js". Now it's embedders' responsibility to properly register extensions that will not contains JavaScript sources when running from an existing snapshot. Prerequisite for https://github.com/denoland/deno/pull/18080
Diffstat (limited to 'runtime')
-rw-r--r--runtime/build.rs7
-rw-r--r--runtime/examples/hello_runtime.rs1
-rw-r--r--runtime/worker.rs20
3 files changed, 7 insertions, 21 deletions
diff --git a/runtime/build.rs b/runtime/build.rs
index 784e46d4f..2bb2b4cf1 100644
--- a/runtime/build.rs
+++ b/runtime/build.rs
@@ -250,7 +250,7 @@ mod startup_snapshot {
))
.build();
- let mut extensions_with_js: Vec<Extension> = vec![
+ let mut extensions: Vec<Extension> = vec![
deno_webidl::init_esm(),
deno_console::init_esm(),
deno_url::init_ops_and_esm(),
@@ -291,15 +291,14 @@ mod startup_snapshot {
];
if let Some(additional_extension) = maybe_additional_extension {
- extensions_with_js.push(additional_extension);
+ extensions.push(additional_extension);
}
create_snapshot(CreateSnapshotOptions {
cargo_manifest_dir: env!("CARGO_MANIFEST_DIR"),
snapshot_path,
startup_snapshot: None,
- extensions: vec![],
- extensions_with_js,
+ extensions,
compression_cb: Some(Box::new(|vec, snapshot_slice| {
lzzzz::lz4_hc::compress_to_vec(
snapshot_slice,
diff --git a/runtime/examples/hello_runtime.rs b/runtime/examples/hello_runtime.rs
index a47e9c908..1f09551a6 100644
--- a/runtime/examples/hello_runtime.rs
+++ b/runtime/examples/hello_runtime.rs
@@ -43,7 +43,6 @@ async fn main() -> Result<(), AnyError> {
inspect: false,
},
extensions: vec![],
- extensions_with_js: vec![],
startup_snapshot: None,
unsafely_ignore_certificate_errors: None,
root_cert_store: None,
diff --git a/runtime/worker.rs b/runtime/worker.rs
index ff55e27cc..7ce6eb58d 100644
--- a/runtime/worker.rs
+++ b/runtime/worker.rs
@@ -72,21 +72,11 @@ pub struct WorkerOptions {
pub bootstrap: BootstrapOptions,
/// JsRuntime extensions, not to be confused with ES modules.
- /// Only ops registered by extensions will be initialized. If you need
- /// to execute JS code from extensions, use `extensions_with_js` options
- /// instead.
- pub extensions: Vec<Extension>,
-
- /// JsRuntime extensions, not to be confused with ES modules.
- /// Ops registered by extensions will be initialized and JS code will be
- /// executed. If you don't need to execute JS code from extensions, use
- /// `extensions` option instead.
///
- /// This is useful when creating snapshots, in such case you would pass
- /// extensions using `extensions_with_js`, later when creating a runtime
- /// from the snapshot, you would pass these extensions using `extensions`
- /// option.
- pub extensions_with_js: Vec<Extension>,
+ /// Extensions register "ops" and JavaScript sources provided in `js` or `esm`
+ /// configuration. If you are using a snapshot, then extensions shouldn't
+ /// provide JavaScript sources that were already snapshotted.
+ pub extensions: Vec<Extension>,
/// V8 snapshot that should be loaded on startup.
pub startup_snapshot: Option<Snapshot>,
@@ -174,7 +164,6 @@ impl Default for WorkerOptions {
npm_resolver: Default::default(),
blob_store: Default::default(),
extensions: Default::default(),
- extensions_with_js: Default::default(),
startup_snapshot: Default::default(),
bootstrap: Default::default(),
stdio: Default::default(),
@@ -299,7 +288,6 @@ impl MainWorker {
shared_array_buffer_store: options.shared_array_buffer_store.clone(),
compiled_wasm_module_store: options.compiled_wasm_module_store.clone(),
extensions,
- extensions_with_js: options.extensions_with_js,
inspector: options.maybe_inspector_server.is_some(),
is_main: true,
leak_isolate: options.leak_isolate,