Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function svelte(infile, outfile) {
console.log(DEPRECATED_FEATURES); // eslint-disable-line no-console
const babel = require('babel-core'); // eslint-disable-line node/no-extraneous-require
let { code } = babel.transformFileSync(infile, {
plugins: [
[
'debug-macros',
{
debugTools: {
source: '@ember/debug',
assertPredicateIndex: 1,
isDebug: false,
},
svelte: {
'ember-source': '3.3.0',
},
flags: [
{
source: '@glimmer/env',
flags: { DEBUG: false },
lsrSync(cwd + '/lib').forEach(entry => {
if (entry.isFile() && /\.jsx?$/.test(entry.path)) {
const isPublic = /\@public\b/.test(readFileSync(entry.fullPath, 'utf8'));
writeFileSync(
entry.fullPath.replace(/\.jsx$/, '.js'),
babel.transformFileSync(entry.fullPath, {
babelrc: false,
presets: [
pkg['@authentication/target'] === 'browser'
? require.resolve('@moped/babel-preset/browser')
: require.resolve('@moped/babel-preset/server'),
],
}).code,
);
if (/\.jsx$/.test(entry.fullPath)) {
unlinkSync(entry.fullPath);
}
if (isPublic) {
writeFileSync(
cwd + '/' + entry.path.substr(2).replace(/\.jsx$/, '.js'),
"// @autogenerated\n\nmodule.exports = require('./lib/" +
entry.path.substr(2).replace(/\.jsx?$/, '') +
it(`should ${caseName.split('-').join(' ')}`, () => {
const fixtureDir = path.join(fixturesDir, caseName);
const actualPath = path.join(fixtureDir, 'actual.js');
const optionsPath = path.join(fixtureDir, 'options.json');
const options = fs.existsSync(optionsPath) ? JSON.parse(fs.readFileSync(optionsPath).toString()) : {};
const actual = transformFileSync(actualPath, fixturesBabelConfig(options)).code;
const expected = fs.readFileSync(
path.join(fixtureDir, 'expected.js')
).toString();
assert.equal(normalize(actual), normalize(expected));
});
});
var babel = require('babel-core');
var transform = babel.transform;
var path = require('path');
var result = babel.transformFileSync(path.resolve(__dirname) + "/test.js", {
presets: ['env'],
plugins: ['transform-runtime'],
});
console.log(result, 'res');
glob.sync(path.join(__dirname, '../src/manage/**/*.js')).map(file => {
if (file === path.join(__dirname, '../src/manage/dummy-components.js')) return
babel.transformFileSync(file, options)
})
console.log(sources)
const transfromWrite = (input, output, plugin) => {
try {
const { code } = transformFileSync(input, {
babelrc: false,
plugins: [plugin],
})
const fomattedCode = prettier.format(code, {
semi: false,
singleQuote: true,
trailingComma: 'es5',
})
fs.writeFileSync(output, fomattedCode, 'utf-8')
} catch (err) {
console.log(err)
}
}
function transpile (src, target) {
const code = babel.transformFileSync(path.resolve(src), {
sourceRoot: path.join(process.cwd(), 'node_modules'),
plugins: ['styled-jsx/babel', 'transform-react-jsx', 'transform-es2015-destructuring', 'transform-object-rest-spread'],
presets: ['react', 'env']
}).code
if (fs.existsSync(target)) {
fs.removeSync(target)
}
if (!fs.existsSync(path.dirname(target))) {
fs.mkdirsSync(path.dirname(target))
}
fs.writeFileSync(target, code)
}
const transformFile = filePath => {
let content = babel.transformFileSync(filePath, {
presets: ['react', 'stage-2']
}).code
content = content.replace('"use strict";', '')
content = content.replace(';', '')
content = insertBeforeChar(content, '{', 'Object.assign(')
content = insertAfterChar(
content,
'}',
", filterReactProps(props, { tagName: 'svg' }))"
)
content = content.replace('fill-rule', 'fillRule')
content = content.replace('clip-rule', 'clipRule')
return content
require.extensions['.js'] = (module, filename) => {
if (filename.indexOf(path) < 0) {
defaultLoader(module, filename);
return;
}
const { code } = require('babel-core').transformFileSync(
filename,
babelConfig,
);
module._compile(code, filename);
return;
};
};