Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,51 @@

All notable changes to this project will be documented in this file.

## 3.0.0 - 2025-12-16
### Breaking changes
- This package now does only provide an ES module, the CJS entry point is removed.
- The behavior of `basename` and `dirname` was fixed to behave similar
to the methods from the Node.js `paths` module and the PHP methods.
This mainly affects special cases:
- trailing slash on `basename` is ignored
```diff
basename('subdir/')
- ""
+ "subdir"
```
- `dirname` always respects the root path:
```diff
dirname('/')
- ""
+ "/"
```
```diff
dirname('')
- ""
+ "."
```
```diff
dirname('/file')
- ""
+ "/"
```
```diff
dirname('file')
- ""
+ "."
```

### Added
* feat(basename): add support for removing an extension \([#843](https://github.com/nextcloud-libraries/nextcloud-paths/pull/843)\)

### Fixed
* fix!: make `dirname` and `basename` behave like PHP and Node \([#839](https://github.com/nextcloud-libraries/nextcloud-paths/pull/839)\)

### Changed
* chore!: drop commonJs entry points
* chore!: remove deprecated `joinPaths` in favor of `join`
* test: add unit tests for `encodePath`

## 2.4.0 - 2025-11-14
### Added
* feat: add `extname` method
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ import { basename, dirname, extname, encodePath, isSamePath, join } from '@nextc
basename('/my/file.txt')
// -> 'file.txt'

basename('/my/file.txt', '.txt')
// -> 'file'

dirname('/my/file.txt')
// -> '/my'

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nextcloud/paths",
"version": "2.4.0",
"version": "3.0.0",
"description": "Helper functions for working with paths in Nextcloud apps",
"keywords": [
"nextcloud",
Expand Down