From 3493b05b9ae68b9cfcfaddcfb11bfa37091e6eac Mon Sep 17 00:00:00 2001 From: Pooya Parsa Date: Sat, 4 Jan 2025 00:41:40 +0100 Subject: [PATCH] chore: update readme --- README.md | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 0575b62..d4ca112 100644 --- a/README.md +++ b/README.md @@ -7,8 +7,9 @@ [![size][size-src]][size-href] > **❓ Why** -> -> For [historical reasons](https://docs.microsoft.com/en-us/archive/blogs/larryosterman/why-is-the-dos-path-character), windows followed MS-DOS and using backslash for separating paths rather than slash used for macOS, Linux, and other Posix operating systems. Nowadays, [Windows](https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file?redirectedfrom=MSDN) supports both Slash and Backslash for paths. [Node.js's built in `path` module](https://nodejs.org/api/path.html) 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.** + +For [historical reasons](https://docs.microsoft.com/en-us/archive/blogs/larryosterman/why-is-the-dos-path-character), windows followed MS-DOS and using backslash for separating paths rather than slash used for macOS, Linux, and other Posix operating systems. Nowadays, [Windows](https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file?redirectedfrom=MSDN) supports both Slash and Backslash for paths. [Node.js's built in `path` module](https://nodejs.org/api/path.html) 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](https://github.com/anodynos/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**! This package is a drop-in replacement of the Node.js's [path module](https://nodejs.org/api/path.html) module and ensures paths are normalized with slash `/` and work in environments including Node.js. @@ -32,13 +33,13 @@ Import: ```js // ESM / Typescript -import { resolve } from 'pathe' +import { resolve, matchesGlob } from "pathe"; // CommonJS -const { resolve } = require('pathe') +const { resolve, matchesGlob } = require("pathe"); ``` -Read more about path utils from [Node.js documentation](https://nodejs.org/api/path.html) and rest assured behavior is ALWAYS like POSIX regardless of your input paths format and running platform! +Read more about path utils from [Node.js documentation](https://nodejs.org/api/path.html) and rest assured behavior is consistently like POSIX regardless of your input paths format and running platform (only exception is `delimiter` constant export, it will be set to `;` on windows platform). ### Extra utilities @@ -46,24 +47,27 @@ Pathe exports some extra utilities that do not exist in standard Node.js [path m In order to use them, you can import from `pathe/utils` subpath: ```js -import { filename, normalizeAliases, resolveAlias, reverseResolveAlias } from 'pathe/utils' +import { + filename, + normalizeAliases, + resolveAlias, + reverseResolveAlias, +} from "pathe/utils"; ``` ## License -MIT. Made with 💖 +Made with 💛 Published under the [MIT](./LICENSE) license. -Some code used from Node.js project. See [LICENSE](./LICENSE). +Some code used from Node.js project. Glob supported is powered by [zeptomatch](https://github.com/fabiospampinato/zeptomatch). + [npm-v-src]: https://img.shields.io/npm/v/pathe?style=flat-square [npm-v-href]: https://npmjs.com/package/pathe - [npm-d-src]: https://img.shields.io/npm/dm/pathe?style=flat-square [npm-d-href]: https://npmjs.com/package/pathe - [github-actions-src]: https://img.shields.io/github/workflow/status/unjs/pathe/ci/main?style=flat-square [github-actions-href]: https://github.com/unjs/pathe/actions?query=workflow%3Aci - [size-src]: https://packagephobia.now.sh/badge?p=pathe [size-href]: https://packagephobia.now.sh/result?p=pathe