How to use the babel-core.OptionManager function in babel-core

To help you get started, we’ve selected a few babel-core 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 fnando / babel-schmooze-sprockets / node_modules / babel-register / lib / node.js View on Github external
function compile(filename) {
  var result = /*istanbul ignore next*/void 0;

  // merge in base options and resolve all the plugins and presets relative to this file
  var opts = new /*istanbul ignore next*/_babelCore.OptionManager().init( /*istanbul ignore next*/(0, _extend2.default)( /*istanbul ignore next*/(0, _cloneDeep2.default)(transformOpts), {
    filename: filename
  }));

  var cacheKey = /*istanbul ignore next*/ /*istanbul ignore next*/(0, _stringify2.default)(opts) + ":" + babel.version;

  var env = process.env.BABEL_ENV || process.env.NODE_ENV;
  if (env) cacheKey += /*istanbul ignore next*/":" + env;

  if (cache) {
    var cached = cache[cacheKey];
    if (cached && cached.mtime === mtime(filename)) {
      result = cached;
    }
  }

  if (!result) {
github mendersoftware / gui / node_modules / babel-register / src / node.js View on Github external
function compile(filename) {
  let result;

  // merge in base options and resolve all the plugins and presets relative to this file
  let opts = new OptionManager().init(extend(deepClone(transformOpts), {
    filename
  }));

  let cacheKey = `${JSON.stringify(opts)}:${babel.version}`;

  let env = process.env.BABEL_ENV || process.env.NODE_ENV;
  if (env) cacheKey += `:${env}`;

  if (cache) {
    let cached = cache[cacheKey];
    if (cached && cached.mtime === mtime(filename)) {
      result = cached;
    }
  }

  if (!result) {
github mathieuancelin / js-repaint-perfs / motorcycle / node_modules / babel-register / lib / node.js View on Github external
function compile(filename) {
  var result = undefined;

  // merge in base options and resolve all the plugins and presets relative to this file
  var opts = new _babelCore.OptionManager().init(_lodashObjectExtend2["default"](_lodashLangCloneDeep2["default"](transformOpts), {
    filename: filename
  }));

  var cacheKey = JSON.stringify(opts) + ":" + babel.version;

  var env = process.env.BABEL_ENV || process.env.NODE_ENV;
  if (env) cacheKey += ":" + env;

  if (cache) {
    var cached = cache[cacheKey];
    if (cached && cached.mtime === mtime(filename)) {
      result = cached;
    }
  }

  if (!result) {
github sjsyrek / maryamyriameliamurphies.js / node_modules / babel-register / lib / node.js View on Github external
function compile(filename) {
  var result = undefined;

  // merge in base options and resolve all the plugins and presets relative to this file
  var opts = new _babelCore.OptionManager().init(_lodashObjectExtend2["default"](_lodashLangCloneDeep2["default"](transformOpts), {
    filename: filename
  }));

  var cacheKey = JSON.stringify(opts) + ":" + babel.version;

  var env = process.env.BABEL_ENV || process.env.NODE_ENV;
  if (env) cacheKey += ":" + env;

  if (cache) {
    var cached = cache[cacheKey];
    if (cached && cached.mtime === mtime(filename)) {
      result = cached;
    }
  }

  if (!result) {
github joshuaslate / saas-tutorial / node_modules / babel-register / src / node.js View on Github external
function compile(filename) {
  let result;

  let optsManager = new OptionManager;

  // merge in base options and resolve all the plugins and presets relative to this file
  optsManager.mergeOptions(deepClone(transformOpts), "base", null, path.dirname(filename));

  let opts = optsManager.init({ filename });

  let cacheKey = `${JSON.stringify(opts)}:${babel.version}`;

  let env = process.env.BABEL_ENV || process.env.NODE_ENV;
  if (env) cacheKey += `:${env}`;

  if (cache) {
    let cached = cache[cacheKey];
    if (cached && cached.mtime === mtime(filename)) {
      result = cached;
    }
github Dajust / reduxTrello / node_modules / babel-register / lib / node.js View on Github external
function compile(filename) {
  var result = void 0;

  var opts = new _babelCore.OptionManager().init((0, _extend2.default)({ sourceRoot: _path2.default.dirname(filename) }, (0, _cloneDeep2.default)(transformOpts), { filename: filename }));

  var cacheKey = (0, _stringify2.default)(opts) + ":" + babel.version;

  var env = process.env.BABEL_ENV || process.env.NODE_ENV;
  if (env) cacheKey += ":" + env;

  if (cache) {
    var cached = cache[cacheKey];
    if (cached && cached.mtime === mtime(filename)) {
      result = cached;
    }
  }

  if (!result) {
    result = babel.transformFileSync(filename, (0, _extend2.default)(opts, {
      babelrc: false,
github mendersoftware / gui / node_modules / babel-register / lib / node.js View on Github external
function compile(filename) {
  var result = void 0;

  var opts = new _babelCore.OptionManager().init((0, _extend2.default)({ sourceRoot: _path2.default.dirname(filename) }, (0, _cloneDeep2.default)(transformOpts), { filename: filename }));

  var cacheKey = (0, _stringify2.default)(opts) + ":" + babel.version;

  var env = process.env.BABEL_ENV || process.env.NODE_ENV;
  if (env) cacheKey += ":" + env;

  if (cache) {
    var cached = cache[cacheKey];
    if (cached && cached.mtime === mtime(filename)) {
      result = cached;
    }
  }

  if (!result) {
    result = babel.transformFileSync(filename, (0, _extend2.default)(opts, {
      babelrc: false,
github elyukai / optolith-client / node_modules / babel-register / lib / node.js View on Github external
function compile(filename) {
  var result = void 0;

  var opts = new _babelCore.OptionManager().init((0, _extend2.default)({ sourceRoot: _path2.default.dirname(filename) }, (0, _cloneDeep2.default)(transformOpts), { filename: filename }));

  var cacheKey = (0, _stringify2.default)(opts) + ":" + babel.version;

  var env = process.env.BABEL_ENV || process.env.NODE_ENV;
  if (env) cacheKey += ":" + env;

  if (cache) {
    var cached = cache[cacheKey];
    if (cached && cached.mtime === mtime(filename)) {
      result = cached;
    }
  }

  if (!result) {
    result = babel.transformFileSync(filename, (0, _extend2.default)(opts, {
      babelrc: false,