Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function transform(code, file) {
// 转换 jsx 代码
if (code.indexOf('/** @jsx React.DOM */') > -1) {
code = ReactTools.transform(code);
}
// 依赖转换
code = crequire(code, function(item) {
return 'window[\'' + normalizeDep(item.path, file) + '\']';
});
return code;
}
function transform(filename) {
if (shouldStub(filename)) {
delete require.cache[filename];
return reactStub;
} else {
var content = fs.readFileSync(filename, 'utf8');
return ReactTools.transform(content, {harmony: true});
}
}
req.on('end', () => {
const js = ReactTools.transform(b);
console.log('cors client transform', {
req: b,
res: js,
});
res.type('application/javascript');
res.send(js);
});
}
convert(js, html, function (err, jsx) {
if (err) {
throw err;
}
if (app.type === 'js') {
jsx = react.transform(jsx);
}
if (app.target === 'stdout') {
console.log(jsx);
}
else {
fs.writeFileSync(fileJsx, jsx);
}
});
function flowES6toES5(code) {
return beautify(
reactTools.transform(code, {
harmony: true,
stripTypes: true
}), {
indent_size: 4
});
}
process: function(source) {
return ReactTools.transform(source, {
harmony: true
});
}
};
process: function(source) {
return ReactTools.transform(source, {
harmony: true
});
}
};
process: function(src) {
return ReactTools.transform(src);
}
};
process: function(src, filename) {
return filename.indexOf("node_modules") === -1
? ReactTools.transform(src, {harmony: true})
: src;
}
};