JSPM

require-precompiled

0.1.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 44776
  • Score
    100M100P100Q153712F
  • License MIT

Require extension that allows for caching/precompiling

Package Exports

  • require-precompiled

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (require-precompiled) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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