All Projects → Bockit → cacheify

Bockit / cacheify

Licence: other
Browserify transform wrapper that caches the transforms between runs to improve performance

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to cacheify

Phaser Node Kit
Rapid Game Development with PhaserJS and Node for Modern Browsers
Stars: ✭ 39 (+30%)
Mutual labels:  browserify, build-tool
buildozer
🚜 Build tool which simplify your buildprocess. Built with Gulp.js 🥤
Stars: ✭ 22 (-26.67%)
Mutual labels:  build-tool
React Tsx Starter
Universal/Isomorphic React TypeScript Starter Project
Stars: ✭ 97 (+223.33%)
Mutual labels:  browserify
Render Media
Intelligently render media files in the browser
Stars: ✭ 181 (+503.33%)
Mutual labels:  browserify
Frontbook
📖 FrontBook is a small and modern frontend boilerplate, enabling you to write ES201* today in production-ready projects.
Stars: ✭ 102 (+240%)
Mutual labels:  browserify
Minipack
📦 A simplified example of a modern module bundler written in JavaScript
Stars: ✭ 2,625 (+8650%)
Mutual labels:  browserify
Npm Rails
NPM support for Rails with Bundler-like DSL
Stars: ✭ 81 (+170%)
Mutual labels:  browserify
millw
Mill Wrapper Script
Stars: ✭ 40 (+33.33%)
Mutual labels:  build-tool
Routr
A component that provides router related functionalities for both client and server.
Stars: ✭ 241 (+703.33%)
Mutual labels:  browserify
Cssify
Simple middleware for Browserify to add css styles to the browser.
Stars: ✭ 127 (+323.33%)
Mutual labels:  browserify
Serverless Plugin Optimize
Bundle with Browserify, transpile and minify with Babel automatically to your NodeJS runtime compatible JavaScript
Stars: ✭ 122 (+306.67%)
Mutual labels:  browserify
Jus
🍉 An opinionated tool for making static websites with browserify
Stars: ✭ 107 (+256.67%)
Mutual labels:  browserify
Modular Css
A streamlined reinterpretation of CSS Modules via CLI, API, Browserify, Rollup, Webpack, or PostCSS
Stars: ✭ 234 (+680%)
Mutual labels:  browserify
Common Shakeify
browserify tree shaking plugin using `common-shake`
Stars: ✭ 101 (+236.67%)
Mutual labels:  browserify
globify
Run browserify and watchify with globs - even on Windows!
Stars: ✭ 16 (-46.67%)
Mutual labels:  browserify
Npm Pipeline Rails
Use npm as part of your Rails asset pipeline
Stars: ✭ 93 (+210%)
Mutual labels:  browserify
Gulp Bro
👊 gulp + browserify + incremental build, done right.
Stars: ✭ 119 (+296.67%)
Mutual labels:  browserify
Magnet Uri
Parse a magnet URI and return an object of keys/values
Stars: ✭ 183 (+510%)
Mutual labels:  browserify
makeme
Embedthis MakeMe
Stars: ✭ 26 (-13.33%)
Mutual labels:  build-tool
proot-static-build
Build static variants of PRoot
Stars: ✭ 63 (+110%)
Mutual labels:  build-tool

Cacheify

Cacheify is a caching layer for browserify transforms. You specify a transform and a cache and it handles the rest by wrapping everything in its own browserify transform that you'll pass to the bundling process.

You can also specify custom filter and hash functions to be specific about which files get cached, and how a file is decided to be unique.

Example usage

var cacheify = require('cacheify')
  , coffeeify = require('coffeeify')
  , level = require('level')
  , db = level('./cache');

...

var cachingCoffeeify = cacheify(coffeeify, db)

...

b.transform(cachingCoffeeify)

API

cacheify(transform, db)

Creates a new cacheify transform.

  • transform: The transform you want to cache the output of
  • db: A levelup-api compatible database object, or a function that returns such an object. This is where the results of cached transforms are stored.
cacheify.filter(fn)

Replaces the default filter function (always returns true) with a function of your choosing. The filter function is called per file and if it returns a truthy value we will cache the results of the transform of the file, or read from the cache if it's already there. If it returns false we will apply the original transform without caching.

  • fn: The filter function you want to use. It takes one argument, the file path. If fn is a RegExp object, cacheify.filter will wrap it in a function that tests each filename against it.
cacheify.hash(fn)

Replaces the default hash function (md5 of the file's contents) with a function of your choosing. The hash function will be used to generate a unique key for a file, that we will check to see if it exists in the DB before applying the original transform.

  • fn: The hash function you want to use. It takes two arguments, the file contents and the file path.

Changelog

  • 0.4.2 Updates concat-stream to remove a security vulneratbility. Thanks for @puzrin for the report (#11).

  • 0.4.0 Now passes transform options through to cachee streams.

  • 0.3.2 Now handles multiple errors in the cachee stream instead of only one.

  • 0.3.1 the second argument, db, can now be a function that returns a db. Useful if you need to close connections and unlock the leveldb between bundles.

  • 0.2.1: When the filter returns false, instead of passing an empty through pass the original uncached transform. That way it can handle what gets transformed and we only handle what gets cached.

  • 0.2.0: Do not use, has breaking bugs!! 0.2.1 fixes them. Apologies!

    • Changed the API significantly.
    • Added the ability to specify a filter function to be selective about which files are transformed.
    • Because hash is optional like filter, changed how you apply a custom hash function to be similar to how you apply a custom filter function.
    • Changed the order of arguments to cacheify, it takes the transform first and the db second
    • The db argument can now be a function instead of an object. If it is, it will call that function to get the db object. This gives you more flexibility when working in environments with complicated locking orders on the dbs.

License

BSD, see the LICENSE.md for more information.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].