code: static String normalize(String path, Iterable<String> moduleRootPaths) {
      String normalizedPath = path;
      if (isAmbiguousIdentifier(normalizedPath)) {
        normalizedPath = MODULE_SLASH + normalizedPath;
      }
  
      // Find a moduleRoot that this URI is under. If none, use as is.
      for (String moduleRoot : moduleRootPaths) {
        if (normalizedPath.startsWith(moduleRoot)) {
          // Make sure that e.g. path "foobar/test.js" is not matched by module "foo", by checking for
          // a leading slash.
          String trailing = normalizedPath.substring(moduleRoot.length());
          if (trailing.startsWith(MODULE_SLASH)) {
            return trailing.substring(MODULE_SLASH.length());
          }
        }
      }
      // Not underneath any of the roots.
      return path;
    }
docs: Normalizes the name and resolves it against the module roots.