normalize-preset.js 381 B

12345678910111213141516
  1. var babelCore;
  2. try { babelCore = require('babel-core'); } catch(err) {}
  3. module.exports = function normalizePreset(preset, context, options) {
  4. if (!context) context = babelCore;
  5. if (preset && typeof preset==='object' && preset.buildPreset) {
  6. preset = preset.buildPreset;
  7. }
  8. if (typeof preset==='function') {
  9. preset = preset(context, options || {});
  10. }
  11. return preset;
  12. };