Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@visulima/path

visulima6.4kMIT1.3.5TypeScript support: included

Drop-in replacement of the Node.js path module.

visulima, path, binary, extensions, extension, file, json, list, array

readme

Visulima path

Drop-in replacement of the Node.js's path module.


[typescript-image][typescript-url] [![npm-image]][npm-url] [![license-image]][license-url]


Daniel Bannert's open source work is supported by the community on GitHub Sponsors


Why

For historical reasons, windows followed MS-DOS and using backslash for separating paths rather than slash used for macOS, Linux, and other Posix operating systems. Nowadays, Windows supports both Slash and Backslash for paths. Node.js's built in path module in the default operation of the path module varies based on the operating system on which a Node.js application is running. Specifically, when running on a Windows operating system, the path module will assume that Windows-style paths are being used. This makes inconsistent code behavior between Windows and POSIX.

Compared to popular upath, pathe is providing identical exports of Node.js with normalization on all operations and written in modern ESM/Typescript and has no dependency on Node.js!

Install

npm install @visulima/path
yarn add @visulima/path
pnpm add @visulima/path

Usage

// ESM / Typescript
import { resolve } from "@visulima/path";
// or
import path from "@visulima/path";

// CommonJS
const { resolve } = require("@visulima/path");
// or
const path = require("@visulima/path");

Check https://nodejs.org/api/path.html about the exported functions. Note: path.win32 and path.posix are not exported.

Extra utilities

@visulima/path exports some extra utilities that do not exist in standard Node.js path module. In order to use them, you can import from @visulima/path/utils subpath:

// ESM / Typescript
import { filename, normalizeAliases, resolveAlias, reverseResolveAlias, isRelative, isBinaryPath, toPath } from "@visulima/path/utils";

// CommonJS
const { filename, normalizeAliases, resolveAlias, reverseResolveAlias, isRelative, isBinaryPath, toPath } = require("@visulima/path/utils");
  • upath - A proxy to path, replacing \ with / for all results & methods to add, change, default, trim file extensions.
  • pathe - 🛣️ Drop-in replacement of the Node.js's path module, module that ensures paths are normalized.

Supported Node.js Versions

Libraries in this ecosystem make the best effort to track Node.js’ release schedule. Here’s a post on why we think this is important.

Contributing

If you would like to help take a look at the list of issues and check our Contributing guidelines.

Note: please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.

Credits

License

The visulima path is open-sourced software licensed under the [MIT][license-url]

[typescript-url]: https://www.typescriptlang.org/ "TypeScript" "typescript" [license-image]: https://img.shields.io/npm/l/@visulima/path?color=blueviolet&style=for-the-badge [license-url]: LICENSE.md "license" [npm-image]: https://img.shields.io/npm/v/@visulima/path/latest.svg?style=for-the-badge&logo=npm [npm-url]: https://www.npmjs.com/package/@visulima/path/v/latest "npm"

changelog

@visulima/path 1.3.5 (2025-03-07)

Bug Fixes

  • updated @visulima/packem and other dev deps, for better bundling size (e940581)

Miscellaneous Chores

  • fixed issue with pnpm audit, changed browser path (67337cb)
  • updated dev dependencies (487a976)

@visulima/path 1.3.4 (2025-01-25)

Bug Fixes

  • fixed wrong node version range in package.json (4ae2929)

Miscellaneous Chores

  • fixed typescript url (fe65a8c)
  • lock file update, added dedupe lint command (5ba7093)
  • updated all dev dependencies (37fb298)
  • updated all dev dependencies and all dependencies in the app folder (87f4ccb)

@visulima/path 1.3.3 (2025-01-13)

Bug Fixes

  • path: fixed isRelative with ".." syntax (67a63b5)

@visulima/path 1.3.2 (2025-01-12)

Bug Fixes

  • updated @visulima/packem, and all other dev dependencies (7797a1c)

@visulima/path 1.3.1 (2025-01-08)

Bug Fixes

  • path: switched minimatch to zeptomatch (d10d466)

@visulima/path 1.3.0 (2025-01-08)

Features

  • path: preserve normalized unc paths in join (316301d)

@visulima/path 1.2.0 (2024-12-31)

Features

  • added matchesGlob export, added Path type, added posix and win32 exports (2374dad)

Miscellaneous Chores

  • updated dev dependencies (9de2eab)

@visulima/path 1.1.2 (2024-12-12)

Bug Fixes

  • allow node v23 (8ca929a)
  • allowed node 23, updated dev dependencies (f99d34e)
  • updated packem to v1.8.2 (23f869b)
  • updated packem to v1.9.2 (47bdc2d)

Styles

Miscellaneous Chores

  • updated dev dependencies (a916944)

@visulima/path 1.1.1 (2024-10-05)

Bug Fixes

  • path: fixing wrong export of isAbsolute on utils (92148a8)

@visulima/path 1.1.0 (2024-10-05)

Features

  • path: added isAbsolute util (57dac59)

Bug Fixes

  • updated dev dependencies, updated packem to v1.0.7, fixed naming of some lint config files (c071a9c)

@visulima/path 1.0.9 (2024-09-24)

Bug Fixes

  • update packem to v1 (05f3bc9)
  • updated esbuild from v0.23 to v0.24 (3793010)

Miscellaneous Chores

  • updated dev dependencies (05edb67)

@visulima/path 1.0.8 (2024-09-11)

Bug Fixes

Miscellaneous Chores

  • updated dev dependencies (28b5ee5)

@visulima/path 1.0.7 (2024-09-07)

Bug Fixes

  • fixed broken chunk splitting from packem (1aaf277)

@visulima/path 1.0.6 (2024-09-07)

Bug Fixes

  • added types support for node10 (604583f)

Styles

Miscellaneous Chores

  • update dev dependencies (0738f98)

@visulima/path 1.0.5 (2024-08-30)

Bug Fixes

  • updated license content (63e34b3)

Miscellaneous Chores

  • updated dev dependencies (45c2a76)

@visulima/path 1.0.4 (2024-08-04)

Bug Fixes

  • path: fixed delimiter return based on the platform (967f221)

@visulima/path 1.0.3 (2024-08-01)

Bug Fixes

  • path: switched to packem from tsup (0bd94e5)

Styles

Miscellaneous Chores

  • added private true into fixture package.json files (4a9494c)
  • changed typescript version back to 5.4.5 (55d28bb)
  • cs fixes (ab59375)
  • updated all dev deps (ef143ce)
  • updated dev dependencies (ac67ec1)
  • updated dev dependencies (34df456)
  • updated dev dependencies and sorted the package.json (9571572)

Build System

  • fixed found audit error, updated all dev package deps, updated deps in apps and examples (4c51950)

@visulima/path 1.0.2 (2024-06-06)

Bug Fixes

Miscellaneous Chores

  • updated dev dependencies (a2e0504)

@visulima/path 1.0.1 (2024-05-24)

Bug Fixes

Styles

Miscellaneous Chores

  • changed semantic-release-npm to pnpm (b6d100a)
  • fixed wrong named folders to integration, added TEST_PROD_BUILD (1b826f5)

@visulima/path 1.0.0 (2024-05-14)

Features