Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
process: function(src, filename) {
// Allow the stage to be configured by an environment
// variable, but use Babel's default stage (2) if
// no environment variable is specified.
var stage = process.env.BABEL_JEST_STAGE || 0;
// Ignore all files within node_modules
// babel files can be .js, .es, .jsx or .es6
if (filename.indexOf("node_modules") === -1 && babel.canCompile(filename)) {
return babel.transform(src, { filename: filename, stage: stage, retainLines: true }).code;
}
return src;
}
}
process: function(src, filename) {
// Ignore files other than .js, .es, .jsx or .es6
if (!babel.canCompile(filename)) {
return '';
}
// Ignore all files within node_modules
if (filename.indexOf('node_modules') === -1) {
return babel.transform(src, {filename: filename}).code;
}
return src;
}
};
process: function (src, filename) {
var stage = 0;
// Ignore all files within node_modules
// babel files can be .js, .es, .jsx or .es6
if (filename.indexOf("node_modules") === -1 && babel.canCompile(filename)) {
return babel.transform(
src.toString().replace(/((var|let|const)[\s]*[a-zA-Z0-9\-\_]+[\s]*=[\s]*)?require\('[a-zA-Z0-9\.\/\-\_]+\.s?css\'\);?/gm, ''),
{ filename: filename,
stage: stage,
retainLines: true,
auxiliaryCommentBefore: "istanbul ignore next"
}
).code;
}
return src;
}
};
process: function(src, filename) {
// Ignore files other than .js, .es, .jsx or .es6
if (!babel.canCompile(filename)) {
return '';
}
// Ignore all files within node_modules
if (filename.indexOf('node_modules') === -1) {
return babel.transform(src, {filename: filename}).code;
}
return src;
}
};
process: function(src, filename) {
// Ignore files other than .js, .es, .jsx or .es6
if (!babel.canCompile(filename)) {
return '';
}
// Ignore all files within node_modules
if (filename.indexOf('node_modules') === -1) {
return babel.transform(src, { filename: filename }).code;
}
return src;
}
};
process: function (src, filename) {
if (filename.indexOf('node_modules') === -1 && babel.canCompile(filename)) {
var option = {
filename: filename,
stage: 0
}
return babel.transform(src, option).code;
}
return src;
}
};
transpile(pathname, callback) {
pathname = slash(pathname);
if (this.config.babelIgnoreRegexes.some((re) => re.test(pathname))) return callback();
if (!babelCore.canCompile(pathname)) return callback();
const src = path.join(this.config.root, pathname);
const opts = objectAssign({ sourceFileName: '/source/' + pathname }, this.config.babelConfig);
babelCore.transformFile(src, opts, callback);
}
function babelTranspile(pathname, callback) {
if (babelIgnoreRegexes.some(function (re) { return re.test(pathname); })) return callback();
if (!babelCore.canCompile(pathname)) return callback();
var src = path.join(transpilationConfig.root, pathname);
var opts = objectAssign({ sourceFileName: '/source/' + pathname }, transpilationConfig.babelConfig);
babelCore.transformFile(src, opts, callback);
}
process: function (src, filename) {
if ((filename.indexOf('node_modules') === -1 || filename.indexOf('admin-config')) && babel.canCompile(filename)) {
return babel.transform(src, { filename: filename, stage: 1, retainLines: true, compact: false }).code;
}
return src;
}
};
process: function(src, file) {
if (!file.match(/.*\/(__tests__|scripts|react-router|StubRouterContext).*/)) {
return src;
}
var stage = process.env.BABEL_JEST_STAGE || 2;
var canCompile = babel.canCompile(file);
if (!canCompile) {
return "";
}
if (file.indexOf("node_modules") === -1) {
return babel.transform(src, {filename: file, stage: stage}).code;
}
return src;
}
};