diff options
Diffstat (limited to 'node_modules/require-precompiled/readme.md')
-rw-r--r-- | node_modules/require-precompiled/readme.md | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/node_modules/require-precompiled/readme.md b/node_modules/require-precompiled/readme.md new file mode 100644 index 000000000..23fdc751b --- /dev/null +++ b/node_modules/require-precompiled/readme.md @@ -0,0 +1,45 @@ +# require-precompiled [](https://travis-ci.org/jamestalmage/require-precompiled) [](https://coveralls.io/github/jamestalmage/require-precompiled?branch=master) + +> Require extension that allows for caching/precompiling + + +## Install + +``` +$ npm install --save require-precompiled +``` + + +## Usage + +```js +const installPrecompiler = require('require-precompiled'); +const cache = require('my-cache-implementation'); + +installPrecompiler(filename => { + if (cache.hasEntryFor(filename)) { + return cache.getPrecompiledCode(filename); + } + // fall through to underlying extension chain; + return null; +}); + +// Any module required from this point on will be checked against the cache. +const foo = require('some-module'); +``` + + +## API + +### requirePrecompiled(callback) + +#### callback + +Type: `Function(string: filename)` + +Return `string` contents for a cache hit, or `null` for a miss. + + +## License + +MIT © [James Talmage](http://github.com/jamestalmage) |