Comments (3)
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.
@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:
- http://jmm.github.io/browserify-pipeline-docs/
- browserify/browserify#1162
- browserify/browserify#1203
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.
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)
- Cannot set detective opts from module-deps and browserify HOT 1
- Transforms broken when use ES7 Decorators or YAML HOT 12
- pass pkg.__dirname to transform functions
- Process hangs when pass module-deps options to transforms HOT 7
- Pass ecmaVersion to detective (To enable support for async/await +) HOT 6
- _isTopLevel() check for "node_modules" transform exclusion is too "loose", should be more specific HOT 3
- Non-package.json conform json file causes an infinite loop HOT 1
- Recent Commit is Crashing Build HOT 2
- persistent cache does not support watchify 'file' transform events
- module-deps seems incompatible with node-resolve
- options.paths not used for transforms HOT 4
- Incompatibility with global-style HOT 6
- Use native Object.assign instead of xtend
- Project dead?
- How to retrieve the file where an error occurred? HOT 3
- Are module-deps options passed as parameter to the transforms? HOT 1
- File content randomly truncated in large projects HOT 4
- [email protected] asyncWrite is not a function HOT 2
- Unexpected token with ?.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from module-deps.