require-precompiled
Require extension that allows for caching/precompiling
Last updated 10 years ago by jamestalmage .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install require-precompiled 
SYNC missed versions from official npm registry.

require-precompiled Build Status Coverage Status

Require extension that allows for caching/precompiling

Install

$ npm install --save require-precompiled

Usage

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

Current Tags

  • 0.1.0                                ...           latest (10 years ago)

1 Versions

  • 0.1.0                                ...           10 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 1
Dependencies (0)
None
Dev Dependencies (5)
Dependents (2)

Copyright 2013 - present © cnpmjs.org | Home |