gulp icon indicating copy to clipboard operation
gulp copied to clipboard

Bring in new fs sandboxing system

Open yocontra opened this issue 10 years ago • 8 comments

  • [ ] Update plugin guidelines and documentation to explain this
  • [ ] Open issues on all plugins that need this added linking to the new docs
  • [ ] Add this to a few prominent modules (sass, less, stylus, browserify, require.js)

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.

yocontra avatar Mar 20 '14 01:03 yocontra

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

phated avatar Aug 26 '14 22:08 phated

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

yocontra avatar Aug 26 '14 22:08 yocontra

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

yocontra avatar Aug 26 '14 22:08 yocontra

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

ilanbiala avatar Dec 28 '14 16:12 ilanbiala

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

yocontra avatar Dec 28 '14 17:12 yocontra

Ok, sounds good.

ilanbiala avatar Dec 28 '14 20:12 ilanbiala

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.

spelufo avatar May 18 '15 02:05 spelufo

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

yocontra avatar May 18 '15 07:05 yocontra