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
  33c2c092_3617_d6cb_4dd3_fe7816312546["normalizePathBase()"]
  d00d78c4_d3a9_d8f8_31c1_110fc660f105["normalizePath()"]
  d00d78c4_d3a9_d8f8_31c1_110fc660f105 -->|calls| 33c2c092_3617_d6cb_4dd3_fe7816312546
  style 33c2c092_3617_d6cb_4dd3_fe7816312546 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.
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