summaryrefslogtreecommitdiff
path: root/core/snapshot_util.rs
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2022-11-27 00:58:23 +0100
committerGitHub <noreply@github.com>2022-11-27 00:58:23 +0100
commit28b5a7e2ec519e6c1ff928d57368c0d8741a8bb4 (patch)
tree791f02bb6b41cfa250e56a07c64a1d75010de033 /core/snapshot_util.rs
parentd4f659d1d3caa550dfc15ca9e62d4ad6a31db7ac (diff)
feat(core): support initializing extensions with and without JS (#16789)
This commit allows to execute more JS code from extensions when creating a snapshot from an existing snapshot. "deno_core::RuntimeOptions::extensions_with_js" field was added that is used to pass a list of extensions whose both "ops" and associated JS source should be executed upon start. Co-authored-by: crowlkats <crowlkats@toaxl.com>
Diffstat (limited to 'core/snapshot_util.rs')
-rw-r--r--core/snapshot_util.rs2
1 files changed, 2 insertions, 0 deletions
diff --git a/core/snapshot_util.rs b/core/snapshot_util.rs
index b408bad56..bacc0c6ae 100644
--- a/core/snapshot_util.rs
+++ b/core/snapshot_util.rs
@@ -12,6 +12,7 @@ pub struct CreateSnapshotOptions {
pub snapshot_path: PathBuf,
pub startup_snapshot: Option<Snapshot>,
pub extensions: Vec<Extension>,
+ pub extensions_with_js: Vec<Extension>,
pub additional_files: Vec<PathBuf>,
pub compression_cb: Option<Box<CompressionCb>>,
}
@@ -21,6 +22,7 @@ pub fn create_snapshot(create_snapshot_options: CreateSnapshotOptions) {
will_snapshot: true,
startup_snapshot: create_snapshot_options.startup_snapshot,
extensions: create_snapshot_options.extensions,
+ extensions_with_js: create_snapshot_options.extensions_with_js,
..Default::default()
});