| 29 | } |
| 30 | |
| 31 | fn try_load_script_module( |
| 32 | &self, |
| 33 | module_specifier: &deno_core::ModuleSpecifier, |
| 34 | ) -> Option<ModuleSource> { |
| 35 | let mut store = self.guild_scripts.borrow_mut(); |
| 36 | if let Some(script) = store |
| 37 | .scripts |
| 38 | .iter_mut() |
| 39 | .find(|v| &v.url == module_specifier) |
| 40 | { |
| 41 | if let Some(compiled) = &script.compiled { |
| 42 | script.state = ScriptLoadState::Loaded; |
| 43 | |
| 44 | return Some(ModuleSource::new( |
| 45 | ModuleType::JavaScript, |
| 46 | deno_core::ModuleSourceCode::Bytes(deno_core::ModuleCodeBytes::Boxed( |
| 47 | Box::from(compiled.output.as_bytes()), |
| 48 | )), |
| 49 | module_specifier, |
| 50 | None, |
| 51 | )); |
| 52 | } |
| 53 | } |
| 54 | |
| 55 | None |
| 56 | } |
| 57 | } |
| 58 | |
| 59 | // TODO: make a formal spec for this behavior |