Home / Function/ normalizeGitUrl() — vite Function Reference

normalizeGitUrl() — vite Function Reference

Architecture documentation for the normalizeGitUrl() function in rollupLicensePlugin.ts from the vite codebase.

Entity Profile

Dependency Diagram

graph TD
  70b428e0_ea83_5f27_8d43_7bf824f11e88["normalizeGitUrl()"]
  8c8944ff_c444_0ebb_8419_eb691db97f08["rollupLicensePlugin.ts"]
  70b428e0_ea83_5f27_8d43_7bf824f11e88 -->|defined in| 8c8944ff_c444_0ebb_8419_eb691db97f08
  98fcdafd_b9c2_b494_7b17_6cf19b372f35["getDependencyInformation()"]
  98fcdafd_b9c2_b494_7b17_6cf19b372f35 -->|calls| 70b428e0_ea83_5f27_8d43_7bf824f11e88
  style 70b428e0_ea83_5f27_8d43_7bf824f11e88 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/vite/rollupLicensePlugin.ts lines 184–203

function normalizeGitUrl(url: string): string {
  url = url
    .replace(/^git\+/, '')
    .replace(/\.git$/, '')
    .replace(/(^|\/)[^/]+?@/, '$1') // remove "user@" from "ssh://user@host.com:..."
    .replace(/(\.[^.]+?):/, '$1/') // change ".com:" to ".com/" from "ssh://user@host.com:..."
    .replace(/^git:\/\//, 'https://')
    .replace(/^ssh:\/\//, 'https://')
  if (url.startsWith('github:')) {
    return `https://github.com/${url.slice(7)}`
  } else if (url.startsWith('gitlab:')) {
    return `https://gitlab.com/${url.slice(7)}`
  } else if (url.startsWith('bitbucket:')) {
    return `https://bitbucket.org/${url.slice(10)}`
  } else if (!url.includes(':') && url.split('/').length === 2) {
    return `https://github.com/${url}`
  } else {
    return url.includes('://') ? url : `https://${url}`
  }
}

Domain

Subdomains

Frequently Asked Questions

What does normalizeGitUrl() do?
normalizeGitUrl() is a function in the vite codebase, defined in packages/vite/rollupLicensePlugin.ts.
Where is normalizeGitUrl() defined?
normalizeGitUrl() is defined in packages/vite/rollupLicensePlugin.ts at line 184.
What calls normalizeGitUrl()?
normalizeGitUrl() is called by 1 function(s): getDependencyInformation.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free