code: func (m *contentChangeMap) resolveAndRemove(filename string) (string, string, bundleDirType) {
  	m.mu.RLock()
  	defer m.mu.RUnlock()
  
  	// Bundles share resources, so we need to start from the virtual root.
  	relPath := m.pathSpec.RelContentDir(filename)
  	dir, name := filepath.Split(relPath)
  	if !strings.HasSuffix(dir, helpers.FilePathSeparator) {
  		dir += helpers.FilePathSeparator
  	}
  
  	fileTp, isContent := classifyBundledFile(name)
  
  	// This may be a member of a bundle. Start with branch bundles, the most specific.
  	if fileTp == bundleBranch || (fileTp == bundleNot && !isContent) {
  		for i, b := range m.branches {
  			if b == dir {
  				m.branches = append(m.branches[:i], m.branches[i+1:]...)
  				return dir, b, bundleBranch
  			}
  		}
  	}
  
  	// And finally the leaf bundles, which can contain anything.
  	for i, l := range m.leafs {
  		if strings.HasPrefix(dir, l) {
  			m.leafs = append(m.leafs[:i], m.leafs[i+1:]...)
  			return dir, l, bundleLeaf
  		}
  	}
  
  	if isContent && fileTp != bundleNot {
  		// A new bundle.
  		return dir, dir, fileTp
  	}
  
  	// Not part of any bundle
  	return dir, filename, bundleNot
  }
docs: // resolveAndRemove resolves the given filename to the root folder of a bundle, if relevant.
  // It also removes the entry from the map. It will be re-added again by the partial
  // build if it still is a bundle.