Giter Site home page Giter Site logo

post transform file cache about module-deps HOT 3 OPEN

browserify avatar browserify commented on September 28, 2024
post transform file cache

from module-deps.

Comments (3)

DonutEspresso avatar DonutEspresso commented on September 28, 2024

Update: I captured the raw records being emitted by the transform stream on the data event, and saved those record objects. You can then feed those records into a new module-deps instance as the cache object and that seems to do the trick.

Is there any concern around this approach? AFAICT, this seems to work correctly and significantly speeds up subsequent runs of module-deps.

from module-deps.

jmm avatar jmm commented on September 28, 2024

@DonutEspresso I can't answer all of your questions, but I've been wanting that stuff to be better documented and more consistent for a long time. file|id are some of the worst offenders. See for example:

Certain properties of those record objects are meaningful at certain phases of the pipeline (module-deps being one of the phases). I think package is the object represented by package.json. entry means is it an "entry" file, i.e. will it be executed when the bundle executes. Normally a b.add()ed file is an entry whereas a b.required() one isn't, for example.

You could also take a look at what watchify does, as I think it monkeys with that cache data, and its purpose is to speed up subsequent browserify bundling operations on mostly the same set of files.

Related: #72

from module-deps.

DonutEspresso avatar DonutEspresso commented on September 28, 2024

Thanks @jmm, appreciate the info and the links. I had a lot of trouble trying to "recreate" the records. I'd get inconsistent output from the stream when doing so, probably because I was feeding it bad data. Good to know I'm not the only one confused. :) In the end, I simply captured the emitted records "as-is" without changing them (all fields intact), then feeding them back in next time. That got me the consistent output from run to run, so it appears to be working so far

AFAICT, all the records emitted appeared to have id, source, file, deps. entry: true is there for all files I suspect that are added directly to module-deps via write() or end(). entry seems to be missing only when the file is located in node_modules, or is an unparseable file (i.e., require('./random.ext')), then random.ext would get emitted, but without the entry value.

I think it might be worthwhile delineating out what things are specific to module-deps, vs in the context of browserify.

from module-deps.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.