diff options
author | Divy Srivastava <dj.srivastava23@gmail.com> | 2023-11-14 13:06:00 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-14 22:06:00 +0100 |
commit | ab0c637425c3219c2a5f59c25ae8ea593018568b (patch) | |
tree | e8c3275e39a43e81a89386f9bcbb530185c24eb9 /cli/worker.rs | |
parent | d342c0df71bd3da75330af3dbf2949e8dab36c2b (diff) |
perf: move jupyter esm out of main snapshot (#21163)
Towards https://github.com/denoland/deno/issues/21136
Diffstat (limited to 'cli/worker.rs')
-rw-r--r-- | cli/worker.rs | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/cli/worker.rs b/cli/worker.rs index 957055d0a..2ae7bade4 100644 --- a/cli/worker.rs +++ b/cli/worker.rs @@ -46,6 +46,7 @@ use deno_semver::package::PackageReqReference; use tokio::select; use crate::args::package_json::PackageJsonDeps; +use crate::args::DenoSubcommand; use crate::args::StorageKeyResolver; use crate::emit::Emitter; use crate::errors; @@ -107,6 +108,7 @@ pub struct CliMainWorkerOptions { struct SharedWorkerState { options: CliMainWorkerOptions, + subcommand: DenoSubcommand, storage_key_resolver: StorageKeyResolver, npm_resolver: Arc<dyn CliNpmResolver>, node_resolver: Arc<NodeResolver>, @@ -372,6 +374,7 @@ impl CliMainWorkerFactory { #[allow(clippy::too_many_arguments)] pub fn new( storage_key_resolver: StorageKeyResolver, + subcommand: DenoSubcommand, npm_resolver: Arc<dyn CliNpmResolver>, node_resolver: Arc<NodeResolver>, blob_store: Arc<BlobStore>, @@ -388,6 +391,7 @@ impl CliMainWorkerFactory { Self { shared: Arc::new(SharedWorkerState { options, + subcommand, storage_key_resolver, npm_resolver, node_resolver, @@ -600,12 +604,19 @@ impl CliMainWorkerFactory { skip_op_registration: shared.options.skip_op_registration, }; - let worker = MainWorker::bootstrap_from_options( + let mut worker = MainWorker::bootstrap_from_options( main_module.clone(), permissions, options, ); + if self.shared.subcommand.is_test_or_jupyter() { + worker.js_runtime.execute_script_static( + "40_jupyter.js", + include_str!("js/40_jupyter.js"), + )?; + } + Ok(CliMainWorker { main_module, is_main_cjs, |