Comments (8)
I prefer solution with is-glob
with strict
mode. In this case we needs have a separated tasks for static
and dynamic
patterns (just like the dynamic
property in the ITask
interface). Then, when processing a task, simply pass them to the correct adapters (fs
and readdir-enhanced
).
I've already started working on this issue.
from fast-glob.
Hello, @pvdlg,
Good catch! Yeap, this is due to the fact that we first try to read the directory, and then try to apply patterns.
So we need fix this behaviour. Thanks for reporting!
from fast-glob.
Would a check for file existence on each glob work?
const strippedGlobs = []
const results = [];
globs.forEach(glob =>{
fs.access(glob, fs.constants.R_OK, err => {
// file doesn't exist, add to the list of globs
if(err){
strippedGlobs.push(glob);
} else {
// file does exist, add to the result set
results.push(glob);
}
})
})
from fast-glob.
Must be fixed by [email protected]
. Please, read release notes for more details.
Thanks for reporting ❤️!
from fast-glob.
Just a few thoughts.
We can extract only constant patterns from all patterns, for example, using a is-glob
package and run them as a separate task with different types (something like glob
and regular
). This requires changes in the task
manager, creating adapters
(glob
, regular
) and some magic in the base reader
class. But this is first view.
from fast-glob.
Yeap, good idea!
I think it's possible. Now the task manager doesn't know anything about the File System and i think he shouldn't know anything about it. We can create a new manager
, provider
or something
and check whether the pattern exists on the file system. We need to think about how to solve this problem correctly.
I'll invest time to this issue in the near future.
from fast-glob.
If you can point me in the right direction I can take a look as well. I looked around but I couldn't wrap my head around how all the pieces fit together.
from fast-glob.
By checking for each string passed in the patterns
wouldn't we loose performances for cases in which the pattern is an actual glob?
Passing a non glob path is still less common than passing a glob.
Maybe we should still use is-glob
before testing on the FS.
from fast-glob.
Related Issues (20)
- TypeError: patterns.reduce is not a function HOT 10
- Breaking changes in v3.3.0 HOT 1
- Type definitions erroneously disallow passing an explicitly readonly array of strings HOT 1
- Use `os.availableParallelism` instead of `os.cpus().length` when available HOT 1
- Merging DEFAULT_FILE_SYSTEM_ADAPTER to fs HOT 4
- Regression in v3.3.1 HOT 3
- Case sensitive file paths are returned as potentially the wrong case when using WSL with window's paths HOT 1
- Inconsistent File Format Handling Between Windows and POSIX in fast-glob HOT 7
- Unable to match correctly HOT 1
- fast glob ramdisk issue
- [doc] what is the behaviour of passing an array of patterns?
- Allow abort glob progress
- In Node.js v20.11.0, it's not possible to match directories containing emojis.
- Directory globs with and without trailing slash in ignore patterns have different results
- No results returned if the file is a socket HOT 1
- [QUESTION] - Awilix.fast-glob Fails to Autoload Modules in Tests with TypeScript Setup
- Inconsistent file count HOT 1
- Ignore patterns are applied to the absolute path instead of relative to the working directory HOT 4
- New fast-glob version required due to dependency CVE in micromatch HOT 3
- Matching failed when adding drive's name in Windows
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fast-glob.