Releases: thecodrr/fdir
v6.5.0
This release brings a lot of cool stuff:
ESM support
fdir now includes esm builds in addition to the commonjs build.
Thanks to @TheAlexLichter in #147
Node v12 support (is back!)
fdir v6.4.6 broke Node v12 & v14 compatibility as it made use of AbortController. We have now replaced AbortController with an in-house solution that should bring back support for Node v12.
Additionally, fdir now has the engines
field set to >=12
to make it super clear what versions of Node we support.
Thanks to @SuperchupuDev & @benmccann for bringing this up and helping me test this!
Custom FS
Huge thanks to @43081j for adding support for this. You can now pass a custom FS module and fdir will make use of it instead of the Node.js fs
module.
You can use it like so:
const api = new fdir({
fs: fakeFs,
}).crawl("node_modules");
The fs
property expects the following methods:
export type FSLike = {
readdir: typeof nativeFs.readdir;
readdirSync: typeof nativeFs.readdirSync;
realpath: typeof nativeFs.realpath;
realpathSync: typeof nativeFs.realpathSync;
stat: typeof nativeFs.stat;
statSync: typeof nativeFs.statSync;
};
Other changes
- perf: use
slice
instead ofreplace
when joining path by @SuperchupuDev in #152 - fix: support
@types/picomatch
v4 by @SuperchupuDev in #156
New Contributors
- @TheAlexLichter made their first contribution in #147
Full Changelog: v6.4.6...v6.5.0
v6.4.6
What's Changed
- fix: do not stop crawling at
currentDepth
0 by @SuperchupuDev in #149
Full Changelog: v6.4.5...v6.4.6
v6.4.5
v6.4.4
What's Changed
- Update documentation for withCallback() by @dave-swift in #133
- Fix hang when crawling root with direct symlinks by @pralkarz in #137
- Add prettier and run format by @43081j in #140
New Contributors
- @dave-swift made their first contribution in #133
- @pralkarz made their first contribution in #137
Full Changelog: v6.4.3...v6.4.4
v6.4.3
v6.4.2
v6.4.1
Fixes
Recursive symlinks handling (#125)
Previously, fdir left it up to the OS to handle recursive symlinks. Unfortunately, this resulted in an infinite loop that'd either cause a crash or take too long to resolve (each OS has a different limit on resolving recursive symlinks). This has been fixed now in #126.
Recursive symlinks with resolvePaths: true
When resolvePaths
is set to true
, fdir
does not crawl a directory it has already visited. To figure out whether we have visited a directory or not, fdir
maintains a list of all the directories it has visited. This might result in slightly higher memory usage than before.
For a directory that looks like this:
/dir/
file
symlink -> /dir/
fdir will return:
[ "/dir/file" ]
In short, you won't see duplicated paths in the output which is the expected behavior when working with file systems since paths are unique.
Recursive symlinks with resolvePaths: false
When you set resolvePaths
to false
, the behavior differs because now all symlinks become part of the path.
For a directory that looks like this:
/dir/
file
symlink -> /dir/
fdir will return:
[ "/dir/file", "/dir/symlink/file" ]
To prevent recursion, all recursive symlinks are only resolved a single level deep making sure you never see something like /dir/symlink/symlink/symlink/file
. This allows for glob patterns to work with recursive symlinks without creating a performance issue.
Relative recursive symlinks
Relative recursive symlinks work exactly as above except the returned paths are relative to the root. Everything else is exactly the same.
Thanks to @SuperchupuDev for bringing this to my attention.
v6.4.0
Features
Exclude symlinks
You can now specifically exclude symlinks from the crawling process. Here's how you can do that:
new fdir({ excludeSymlinks: true }).crawl().sync();
Thanks to @SuperchupuDev in #115
Custom glob functions
Previously, fdir only supported picomatch
for globbing disallowing any customization in this area. While that worked really well for most people, it wasn't super flexible. Starting from this version, fdir supports changing the default glob function:
// using a custom function
const customGlob = (patterns: string | string[]) => {
return (test: string): boolean => test.endsWith('.js');
};
const crawler = new fdir().withGlobFunction(customGlob).globWithOptions("**/*.js");
withGlobFunction
accepts a glob
factory function which you can use to perform intensive work only once. For example, picomatch
provides a glob factory that optimizes and preprocesses your glob patterns increasing match significantly.
Fixes
- Support symlinks with relative paths enabled by @SuperchupuDev in #114
- Do not return an empty string for the root by @SuperchupuDev in #123
Other
- Add Video Hub App to "Used by" section of README by @whyboris in #121
- docs: update symlinks support by @SuperchupuDev in #119
- chore(deps): bump vite from 5.0.2 to 5.4.8 by @dependabot in #117
- chore(deps): bump braces from 3.0.2 to 3.0.3 by @dependabot in #118
- docs: list more packages using
fdir
by @benmccann in #112
New Contributors
- @benmccann made their first contribution in #112
- @43081j made their first contribution in #98
- @whyboris made their first contribution in #121
Full Changelog: v6.3.0...v6.4.0
6.3.0
Added
withSymlinks
now supports theresolvePaths
argument again. It was accidentally removed when migrating to TypeScript. Thanks to @SuperchupuDev (#104)
Fixes
- Symlink paths no longer end with a leading slash when
withSymlinks
is enabled.
Other
- chore: exclude irrelevant files from published bundle by @SuperchupuDev in #105
- fix(docs): remove Immich CLI by @etnoy in #108
- docs: document missing options by @SuperchupuDev in #110
- chore: fix import in benchmark scripts by @SuperchupuDev in #111
New Contributors
Full Changelog: v6.2.0...v6.3.0