Crate turbo_unix_path

Source
Expand description

Utilities for lexical manipulation of unix-style (/-separated) paths represented as unicode strings.

These paths types are frequently used for JS imports, and are used within Turbopack to represent platform-agnostic relative paths.

This crate does not perform any IO, and does not depend on turbo-tasks. Most users should prefer the turbo-tasks-fs crate.

Functions§

get_parent_path
get_relative_path_to
join_path
Joins two /-separated paths into a normalized path. Paths are concatenated with /.
normalize_path
Normalizes a /-separated path into a form that contains no leading /, no double /, no “.” segment, no “..” segment.
normalize_request
Normalizes a /-separated request into a form that contains no leading /, no double /, and no “.” or “..” segments in the middle of the request.
sys_to_unix
Converts system paths into Unix paths. This is a noop on Unix systems, and replaces backslash directory separators with forward slashes on Windows.
unix_to_sys
Converts Unix paths into system paths. This is a noop on Unix systems, and replaces forward slash directory separators with backslashes on Windows.