gulpjs / gulp

A toolkit to automate & enhance your workflow
https://gulpjs.com
MIT License
33.01k stars 4.23k forks source link

Bring in new fs sandboxing system #357

Open yocontra opened 10 years ago

yocontra commented 10 years ago

To describe the problem, look at browserify. It likes to read all of it's own dependencies in. We prefer to do the IO so we can pass virtual files to these modules. Currently this isn't possible without writing to a tmp folder and then giving the tmp folder to browserify so it can load the modifications that a plugin up the pipeline made. Instead we can trick browserify into thinking the set of virtual files (purely in memory) are the real fs by wrapping it in a contextify sandbox where fs = a set of virtual files. This will be a module that plugin authors use under the hood to help deal with these modules.

phated commented 10 years ago

Is the webpack memory-fs module at all useful for this?

yocontra commented 10 years ago

Looks good - there is no stream support though. I can send a PR when I have a minute

yocontra commented 10 years ago

If anyone is interested you can monitor progress here https://github.com/wearefractal/vinyl-fs-tree

ilanbiala commented 9 years ago

@contra any changes happening for this? I saw vinyl-fs-tree hasn't been touched much.

yocontra commented 9 years ago

@ilanbiala It got put on the backburner, might get moved to 4.1 since its just a tool to make plugins easier to write

ilanbiala commented 9 years ago

Ok, sounds good.

spelufo commented 9 years ago

I've been trying to figure out how watching in gulp works, and my understanding so far is that every time a file that matches the glob changes, you orchestrator.prototype.start the task passed as argument. So if that task returns gulp.src('glob').pipe()....dest(), a new stream that emits vinyl-fs objects is created, and all the files matching the src glob are emited and read, not only those that changed. Is this right? And what is being proposed here is to cache the files, right?

Wouldn't it be better if gulp.watch returned a readable stream that emits the vfs objects of the files that change? Then it would be interchangable with gulp.src, I think.

yocontra commented 9 years ago

@spelufo streams/tasks that never end is an anti-pattern