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
  a4dc036d_4e5e_3840_615b_adda0567006d["normalizePathBase()"]
  342c0afc_3173_535b_9e25_ef41f6768585["normalize-path.ts"]
  a4dc036d_4e5e_3840_615b_adda0567006d -->|defined in| 342c0afc_3173_535b_9e25_ef41f6768585
  df397cc3_5766_b5b5_66f1_04e0e5873574["normalizePath()"]
  df397cc3_5766_b5b5_66f1_04e0e5873574 -->|calls| a4dc036d_4e5e_3840_615b_adda0567006d
  style a4dc036d_4e5e_3840_615b_adda0567006d 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('/')
}

Domain

Subdomains

Called By

Frequently Asked Questions

What does normalizePathBase() do?
normalizePathBase() is a function in the tailwindcss codebase, defined in packages/@tailwindcss-node/src/normalize-path.ts.
Where is normalizePathBase() defined?
normalizePathBase() is defined in packages/@tailwindcss-node/src/normalize-path.ts at line 4.
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