Home / Function/ normalizePathBase() — tailwindcss Function Reference

normalizePathBase() — tailwindcss Function Reference

Architecture documentation for the normalizePathBase() function in normalize-path.ts from the tailwindcss codebase.

Entity Profile

Dependency Diagram

graph TD
  71103892_16d8_ab76_b988_676d687093c4["normalizePathBase()"]
  fafe253f_5b0a_82ac_9823_6d2c3e638dbd["normalizePath()"]
  fafe253f_5b0a_82ac_9823_6d2c3e638dbd -->|calls| 71103892_16d8_ab76_b988_676d687093c4
  style 71103892_16d8_ab76_b988_676d687093c4 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/@tailwindcss-node/src/normalize-path.ts lines 4–31

function normalizePathBase(path: string, stripTrailing?: boolean) {
  if (typeof path !== 'string') {
    throw new TypeError('expected path to be a string')
  }

  if (path === '\\' || path === '/') return '/'

  var len = path.length
  if (len <= 1) return path

  // ensure that win32 namespaces has two leading slashes, so that the path is
  // handled properly by the win32 version of path.parse() after being normalized
  // https://msdn.microsoft.com/library/windows/desktop/aa365247(v=vs.85).aspx#namespaces
  var prefix = ''
  if (len > 4 && path[3] === '\\') {
    var ch = path[2]
    if ((ch === '?' || ch === '.') && path.slice(0, 2) === '\\\\') {
      path = path.slice(2)
      prefix = '//'
    }
  }

  var segs = path.split(/[/\\]+/)
  if (stripTrailing !== false && segs[segs.length - 1] === '') {
    segs.pop()
  }
  return prefix + segs.join('/')
}

Subdomains

Called By

Frequently Asked Questions

What does normalizePathBase() do?
normalizePathBase() is a function in the tailwindcss codebase.
What calls normalizePathBase()?
normalizePathBase() is called by 1 function(s): normalizePath.

Analyze Your Own Codebase

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

Try Supermodel Free