gulpjs / vinyl

Virtual file format.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Enhanced stat object

phated opened this issue · comments

Opening this as the solution to a bunch of other issues.

This to achieve:

  • *nix-like behavior for atime/mtime/etc properties (#72)
  • Virtual directories (#100)
  • User-friendly mode property (gulpjs/vinyl-fs#112)
  • Construct with always-valid properties (new fs.Stats doesn't do this)
  • Flag remote files (isRemote) and avoid path normalization or do URI normalization (#127)
  • More?
commented

Do we have a status update on this issue @phated? How close to complete is this?

I'm running into some issues where we are trying to pass around a Vinyl stat object into existing fs based interfaces that expect a regular fs based stat object.

@Marak Approximately 0% - Vinyl's stat object is still just constructed by fs.Stat. I created a repository at https://github.com/gulpjs/better-stats but no one was interested in helping out so this will fall to the future.

Quoting "steps" as outlined in gulp-community/gulp-less#303 (comment)

Basically the way I see it working is:

  • better-stats would be created to do exactly that - a better stats object, and it would handle the ctime (mode change) attribute automatically any time it was changed
  • a vinyl instance would handle updating its stats atime (access time) and mtime (modify time) whenever the contents attribute was modified (Buffer.is to compare), or stream was piped to something (would be tricky to determine if the output as actually changed or not, but possible). Would probably want to use a proxy here.
  • vinyl-fs would need to be modified to work with the new stat objects, and support setting ctime/mtime/atime properly on write in dest.

I'm pretty sure we'd need to work on a BetterBuffer object that would interact with BetterStats but I'm not sure, as I haven't looked into it at all.

Picking this one up and assigning to myself. @phated I noticed a lot of work has been done on better-stats, can you give a quick update on what is still missing + your plans for that? I want to make sure I don't reinvent the wheel if you've already made API decisions for that.

Any news on this? We just ran into problems caused by gulp (4.0.2) not updating the last-modified property on overwritten/updated files (on Node.js 12.18.3).

Unfortunately, no one has begun work on this yet. @VividVisions would you want to help out?

@phated I'm sorry, but I fear I don't have the necessary time to dive into this. :(