fn visit(
    &mut self,
    requested_specifier: ModuleSpecifier,
    response: LoadResponse,
  ) {
    let maybe_headers = response.maybe_headers;
    let specifier = response.specifier.clone();

    // If the response was redirected, then we add the module to the redirects
    if requested_specifier != specifier {
      // remove a potentially pending redirect that will never resolve
      if let Some(slot) = self.graph.modules.get(&requested_specifier) {
        if matches!(slot, ModuleSlot::Pending) {
          self.graph.modules.remove(&requested_specifier);
        }
      }
      // if the root has been redirected, update the root
      if self.graph.root == requested_specifier {
        self.graph.root = specifier.clone();
      }
      self
        .graph
        .redirects
        .insert(requested_specifier, specifier.clone());
    }

    let module_slot = parse_module(
      &specifier,
      &maybe_headers,
      &response.content,
      &self.maybe_resolver,
    );

    if let ModuleSlot::Module(module) = &module_slot {
      for dep in module.dependencies.values() {
        if let Resolved::Specifier(specifier, _) = &dep.maybe_code {
          self.load(specifier, dep.is_dynamic);
        }
        if let Resolved::Specifier(specifier, _) = &dep.maybe_type {
          self.load(specifier, dep.is_dynamic);
        }
      }

      if let Some((_, Resolved::Specifier(specifier, _))) =
        &module.maybe_types_dependency
      {
        self.load(specifier, false);
      }
    }
    self.graph.modules.insert(specifier, module_slot);
  }
/// Visit a module, parsing it and resolving any dependencies.
Visit a module, parsing it and resolving any dependencies.
Visit a module parsing it and resolving any dependencies .
fn visit(
    &mut self,
    requested_specifier: ModuleSpecifier,
    response: LoadResponse,
  ) {
    let maybe_headers = response.maybe_headers;
    let specifier = response.specifier.clone();
    // If the response was redirected, then we add the module to the redirects
    if requested_specifier != specifier {
      // remove a potentially pending redirect that will never resolve
      if let Some(slot) = self.graph.modules.get(&requested_specifier) {
        if matches!(slot, ModuleSlot::Pending) {
          self.graph.modules.remove(&requested_specifier);
        }
      }
      // if the root has been redirected, update the root
      if self.graph.root == requested_specifier {
        self.graph.root = specifier.clone();
      }
      self
        .graph
        .redirects
        .insert(requested_specifier, specifier.clone());
    }
    let module_slot = parse_module(
      &specifier,
      &maybe_headers,
      &response.content,
      &self.maybe_resolver,
    );
    if let ModuleSlot::Module(module) = &module_slot {
      for dep in module.dependencies.values() {
        if let Resolved::Specifier(specifier, _) = &dep.maybe_code {
          self.load(specifier, dep.is_dynamic);
        }
        if let Resolved::Specifier(specifier, _) = &dep.maybe_type {
          self.load(specifier, dep.is_dynamic);
        }
      }
      if let Some((_, Resolved::Specifier(specifier, _))) =
        &module.maybe_types_dependency
      {
        self.load(specifier, false);
      }
    }
    self.graph.modules.insert(specifier, module_slot);
  }
fn visit ( & mut self , requested_specifier : ModuleSpecifier , response : LoadResponse , ) { let maybe_headers = response . maybe_headers ; let specifier = response . specifier . clone ( ) ; // If the response was redirected, then we add the module to the redirects if requested_specifier != specifier { // remove a potentially pending redirect that will never resolve if let Some ( slot ) = self . graph . modules . get ( & requested_specifier ) { if matches ! ( slot ModuleSlot Pending ) { self . graph . modules . remove ( & requested_specifier ) ; } } // if the root has been redirected, update the root if self . graph . root == requested_specifier { self . graph . root = specifier . clone ( ) ; } self . graph . redirects . insert ( requested_specifier , specifier . clone ( ) ) ; } let module_slot = parse_module ( & specifier , & maybe_headers , & response . content , & self . maybe_resolver , ) ; if let ModuleSlot :: Module ( module ) = & module_slot { for dep in module . dependencies . values ( ) { if let Resolved :: Specifier ( specifier , _ ) = & dep . maybe_code { self . load ( specifier , dep . is_dynamic ) ; } if let Resolved :: Specifier ( specifier , _ ) = & dep . maybe_type { self . load ( specifier , dep . is_dynamic ) ; } } if let Some ( ( _ , Resolved :: Specifier ( specifier , _ ) ) ) = & module . maybe_types_dependency { self . load ( specifier , false ) ; } } self . graph . modules . insert ( specifier , module_slot ) ; }
Visit a module, parsing it and resolving any dependencies.
Visit a module parsing it and resolving any dependencies .
&mut self
requested_specifier
ModuleSpecifier
response
LoadResponse
&mut self
requested_specifier
ModuleSpecifier
response
LoadResponse