Closed darsain closed 8 years ago
Can we move forward on this? I have path normalization PR in the works (to resolve #80), with tests rewrite so they pass on windows, but it requires .isCustomProp()
to be already implemented, or I'm gonna be working over merge conflicts.
Won't be able to look at this for awhile. Real life...
@darsain are you going to make the changes to inline the built-in fields into the isCustomProp
method? I think that is the best solution so far.
@darsain I really like your last solution, so I agree with @phated. :)
This is perfect! Would love to get this merged and released soon if possible.
I'd wait with the release for my next PR, which will normalize paths so they don't cause issues on windows. Even Vinyl's own tests don't pass on windows because of that.
But I need this merged before I finish it, so I'm not working/submitting over merge conflicts.
@darsain just realized I forgot about this PR. It looks good but needs docs.
Will this do?
Yeah, those look good.
Published this and your previous change as 1.2.0
Cool. Needed this to get merged to start working on path normalization PR. Hopefully I'll get to it tomorrow :)
@darsain awesome. I'll probably be very nitpick-y about the normalization stuff because we've had a few problems recently - see: https://github.com/gulpjs/vinyl-fs/blob/master/lib/prepare-write.js#L47-L49 which needs to be moved into vinyl and most of the path stuff needs to be normalized (e.g. directory returning properties should always end in a path.sep
, if file.isDirectory()
the file.path
should also end in path.sep
and other things like that)
keep up the great work!
Currently, when doing this:
sourceMap
and any other custom properties are ignored. This PR will make constructor extendthis
with all custom props passed in the configuration object.It'll make creating Vinyl files a bit faster and more comfy.
I'm also moving check for custom properties from that multiline
if
statement to a dedicated static methodFile.isCustomProp(key)
which relies onFile.builtInFields
array to check if a key is a custom property.This is than used in
#clone()
, as well as constructor, and could be used in#toJSON()
method from other PR.It also allows anyone that extends from
Vinyl
to extend theirExtendedVinyl.builtInFields
with their own props that shouldn't be cloned.