mirror of
https://github.com/denoland/deno.git
synced 2025-08-04 19:08:15 +00:00
fix(core): prevent multiple main module loading (#12128)
This commit fixes a problem where loading and executing multiple modules leads to all of the having "import.meta.main" set to true. Following Rust APIs were deprecated: - deno_core::JsRuntime::load_module - deno_runtime::Worker::execute_module - deno_runtime::WebWorker::execute_module Following Rust APIs were added: - deno_core::JsRuntime::load_main_module - deno_core::JsRuntime::load_side_module - deno_runtime::Worker::execute_main_module - deno_runtime::Worker::execute_side_module - deno_runtime::WebWorker::execute_main_module Trying to load multiple "main" modules into the runtime now results in an error. If user needs to load additional "non-main" modules they should use APIs for "side" module.
This commit is contained in:
parent
7c0173df27
commit
f840906943
8 changed files with 271 additions and 37 deletions
|
@ -57,7 +57,7 @@ async fn main() -> Result<(), AnyError> {
|
|||
let mut worker =
|
||||
MainWorker::from_options(main_module.clone(), permissions, &options);
|
||||
worker.bootstrap(&options);
|
||||
worker.execute_module(&main_module).await?;
|
||||
worker.execute_main_module(&main_module).await?;
|
||||
worker.run_event_loop(false).await?;
|
||||
Ok(())
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue