Home / Function/ encodePathChars() — vite Function Reference

encodePathChars() — vite Function Reference

Architecture documentation for the encodePathChars() function in utils.ts from the vite codebase.

Entity Profile

Dependency Diagram

graph TD
  4c45fe85_e616_b54f_b767_19224269b055["encodePathChars()"]
  81939ddb_795d_a69b_d1ea_fb1af459ccc2["utils.ts"]
  4c45fe85_e616_b54f_b767_19224269b055 -->|defined in| 81939ddb_795d_a69b_d1ea_fb1af459ccc2
  b4ab10d7_7a96_e400_2c45_786b44953214["posixPathToFileHref()"]
  b4ab10d7_7a96_e400_2c45_786b44953214 -->|calls| 4c45fe85_e616_b54f_b767_19224269b055
  style 4c45fe85_e616_b54f_b767_19224269b055 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/vite/src/module-runner/utils.ts lines 20–33

function encodePathChars(filepath: string) {
  if (filepath.indexOf('%') !== -1)
    filepath = filepath.replace(percentRegEx, '%25')
  // In posix, backslash is a valid character in paths:
  if (!isWindows && filepath.indexOf('\\') !== -1)
    filepath = filepath.replace(backslashRegEx, '%5C')
  if (filepath.indexOf('\n') !== -1)
    filepath = filepath.replace(newlineRegEx, '%0A')
  if (filepath.indexOf('\r') !== -1)
    filepath = filepath.replace(carriageReturnRegEx, '%0D')
  if (filepath.indexOf('\t') !== -1)
    filepath = filepath.replace(tabRegEx, '%09')
  return filepath
}

Domain

Subdomains

Frequently Asked Questions

What does encodePathChars() do?
encodePathChars() is a function in the vite codebase, defined in packages/vite/src/module-runner/utils.ts.
Where is encodePathChars() defined?
encodePathChars() is defined in packages/vite/src/module-runner/utils.ts at line 20.
What calls encodePathChars()?
encodePathChars() is called by 1 function(s): posixPathToFileHref.

Analyze Your Own Codebase

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

Try Supermodel Free