cube-babel
Advanced tools
Comparing version 0.0.1 to 0.0.2
23
index.js
@@ -15,3 +15,3 @@ 'use strict'; | ||
this.cube = cube; | ||
this.config = config; | ||
this.config = this.prepareConfig(config); | ||
let ignore = this.config.ignore; | ||
@@ -49,2 +49,23 @@ let ignoreRules = []; | ||
} | ||
prepareConfig(config) { | ||
try { | ||
config.presets && config.presets.forEach((v, i, a) => { | ||
if (Array.isArray(v) && typeof v[0] === 'string') { | ||
v[0] = require('bable-preset-' + v[0]); | ||
} else { | ||
a[i] = require('bable-preset-' + v); | ||
} | ||
}); | ||
config.plugins && config.plugins.forEach((v, i, a) => { | ||
if (Array.isArray(v) && typeof v[0] === 'string') { | ||
v[0] = require('babel-plugin-transform-' + v[0]); | ||
} else { | ||
a[i] = require('babel-plugin-transform-' + v); | ||
} | ||
}); | ||
} catch (e) { | ||
e.message = 'cube-babel config error:' + e.message; | ||
throw e; | ||
} | ||
} | ||
} | ||
@@ -51,0 +72,0 @@ |
{ | ||
"name": "cube-babel", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "cube babel processor", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
4393
70
4