Skip to content

Commit

Permalink
fix: cache_module_info should accept media type (#526)
Browse files Browse the repository at this point in the history
  • Loading branch information
dsherret committed Sep 5, 2024
1 parent 7078a9c commit 58c838a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3598,17 +3598,18 @@ impl<'a, 'graph> Builder<'a, 'graph> {
specifier,
maybe_headers: _maybe_headers,
} if specifier == item.specifier => {
self.loader.cache_module_info(
&specifier,
&content,
&item.module_info,
);
// fill the existing module slot with the loaded source
let slot = self.graph.module_slots.get_mut(&specifier).unwrap();
match slot {
ModuleSlot::Module(module) => {
match module {
Module::Js(module) => {
self.loader.cache_module_info(
&specifier,
module.media_type,
&content,
&item.module_info,
);
match new_source_with_text(
&module.specifier,
content,
Expand Down
1 change: 1 addition & 0 deletions src/source/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,7 @@ pub trait Loader {
fn cache_module_info(
&self,
_specifier: &ModuleSpecifier,
_media_type: MediaType,
_source: &Arc<[u8]>,
_module_info: &ModuleInfo,
) {
Expand Down

0 comments on commit 58c838a

Please sign in to comment.