How to use the @babel/register/lib/cache.get function in @babel/register

To help you get started, we’ve selected a few @babel/register examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github awto / effectfuljs / packages / debugger / config / node / register.js View on Github external
const savedConsole = console;

const builtIn = Module.builtinModules.filter(i => {
  switch (i) {
    case "sys":
      return false;
  }
  if (/^(?:v8|node-inspect)\//g.test(i)) return false;
  return true;
});

let cache;

if (config.cache) {
  registerCache.load();
  cache = registerCache.get();
}

let babelOpts = config.babelOpts || {};

babelOpts = {
  ...babelOpts,
  caller: {
    name: "@effectful/debugger",
    ...(babelOpts.caller || {})
  }
};

const log = (...args) => console.log(...args);

function mtime(filename) {
  return +fs.statSync(filename).mtime;
github sane / sails-hook-babel / index.js View on Github external
retrieveSourceMap: function(file) {

              var cache = babelRegisterCache.get(),
                  sourceMap = null;

              Object.keys(cache).some(function(hash) {

                var fileCache = cache[hash];

                if (typeof fileCache == 'undefined' || typeof fileCache.options == 'undefined'
                  || fileCache.options.filename != file
                ) {
                  return false;
                }

                sourceMap = {
                  url: file,
                  map: fileCache.map
                };

@babel/register

babel require hook

MIT
Latest version published 17 days ago

Package Health Score

95 / 100
Full package analysis