-
Notifications
You must be signed in to change notification settings - Fork 5.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Include limited metadata in 'DirEntry' objects #4941
Conversation
For consistency, this PR also renames the `filename` field in std's `WalkEntry` interface to just `name`. `WalkEntry` and `DirEntry` now have identical definitions, although `WalkEntry` contains full paths whereas `DirEntry` just contains the file name itself. Closes: denoland#4932
std/fs/walk.ts
Outdated
return false; | ||
} | ||
return true; | ||
} | ||
|
||
export interface WalkEntry { | ||
filename: string; | ||
name: string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it should be path
?
For consistency, this PR also renames the `filename` field in std's `WalkEntry` interface to just `name`. `WalkEntry` and `DirEntry` now have identical definitions, although `WalkEntry` contains full paths whereas `DirEntry` just contains the file name itself.
cli/js/lib.deno.ns.d.ts
Outdated
name: string; | ||
info: FileInfo; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I remember correctly we want to make stat
optional - so this field would be optional as well; is that correct @piscisaureus? If so we should do that before 1.0 as making it info?
is breaking change
std/fs/expand_glob.ts
Outdated
@@ -73,8 +73,8 @@ export async function* expandGlob( | |||
const excludePatterns = exclude | |||
.map(resolveFromRoot) | |||
.map((s: string): RegExp => globToRegExp(s, globOptions)); | |||
const shouldInclude = (filename: string): boolean => | |||
!excludePatterns.some((p: RegExp): boolean => !!filename.match(p)); | |||
const shouldInclude = (name: string): boolean => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure why we're changing filename
to name
...
I wonder if we can restrict Also this API is quite ugly in TypeScript since you have a lot of |
For consistency, this PR also modifies std's `WalkEntry` interface to extend `DirEntry` with an additional `path` field.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This change is to prevent needed a separate stat syscall for each file when using readdir. For consistency, this PR also modifies std's `WalkEntry` interface to extend `DirEntry` with an additional `path` field.
…no#4941) This change is to prevent needed a separate stat syscall for each file when using readdir. For consistency, this PR also modifies std's `WalkEntry` interface to extend `DirEntry` with an additional `path` field.
…no#4941) This change is to prevent needed a separate stat syscall for each file when using readdir. For consistency, this PR also modifies std's `WalkEntry` interface to extend `DirEntry` with an additional `path` field.
…no#4941) This change is to prevent needed a separate stat syscall for each file when using readdir. For consistency, this PR also modifies std's `WalkEntry` interface to extend `DirEntry` with an additional `path` field.
…no#4941) This change is to prevent needed a separate stat syscall for each file when using readdir. For consistency, this PR also modifies std's `WalkEntry` interface to extend `DirEntry` with an additional `path` field.
…no#4941) This change is to prevent needed a separate stat syscall for each file when using readdir. For consistency, this PR also modifies std's `WalkEntry` interface to extend `DirEntry` with an additional `path` field.
…no#4941) This change is to prevent needed a separate stat syscall for each file when using readdir. For consistency, this PR also modifies std's `WalkEntry` interface to extend `DirEntry` with an additional `path` field.
…no#4941) This change is to prevent needed a separate stat syscall for each file when using readdir. For consistency, this PR also modifies std's `WalkEntry` interface to extend `DirEntry` with an additional `path` field.
…no#4941) This change is to prevent needed a separate stat syscall for each file when using readdir. For consistency, this PR also modifies std's `WalkEntry` interface to extend `DirEntry` with an additional `path` field.
…no#4941) This change is to prevent needed a separate stat syscall for each file when using readdir. For consistency, this PR also modifies std's `WalkEntry` interface to extend `DirEntry` with an additional `path` field.
For consistency, this PR also modifies std's
WalkEntry
interface to extendDirEntry
with an additionalpath
field.