Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const { join } = require('path');
const ModuleRewrite = require('babel-plugin-module-rewrite').default;
const ObjectRestSpread = require('@babel/plugin-proposal-object-rest-spread').default;
const ClassProperties = require('@babel/plugin-proposal-class-properties').default;
const ModulesCommonJS = require('@babel/plugin-transform-modules-commonjs').default;
const AddModuleExports = require('babel-plugin-add-module-exports');
const Classes = require('@babel/plugin-transform-classes').default;
const BlockScoping = require('@babel/plugin-transform-block-scoping').default;
const ArrowFunctions = require('@babel/plugin-transform-arrow-functions').default;
const ShorthandProperties = require('@babel/plugin-transform-shorthand-properties').default;
const ObjectDestructuring = require('@babel/plugin-transform-destructuring').default;
const Parameters = require('@babel/plugin-transform-parameters').default;
const Spread = require('@babel/plugin-transform-spread').default;
const TemplateLiterals = require('@babel/plugin-transform-template-literals').default;
const ForOf = require('@babel/plugin-transform-for-of').default;
const ComputedProperties = require('@babel/plugin-transform-computed-properties').default;
const ElementClasses = require('babel-plugin-transform-custom-element-classes');
const esmFunc = join(__dirname, 'utils/replace-esm.js');
const cjsFunc = join(__dirname, 'utils/replace-cjs.js');
const { NODE_ENV } = process.env;
const exportObj = {};
if (NODE_ENV === 'umd' || NODE_ENV === 'min') {
exportObj.plugins = [
ObjectRestSpread,
ClassProperties,
[require('@babel/plugin-transform-arrow-functions').default],
require('@babel/plugin-transform-block-scoped-functions').default,
[require('@babel/plugin-transform-classes').default, { loose }],
require('@babel/plugin-transform-object-super').default,
require('@babel/plugin-transform-shorthand-properties').default,
require('@babel/plugin-transform-duplicate-keys').default,
[
require('@babel/plugin-transform-computed-properties').default,
{ loose },
],
[require('@babel/plugin-transform-for-of').default, { loose }],
require('@babel/plugin-transform-sticky-regex').default,
require('@babel/plugin-transform-unicode-regex').default,
require('@babel/plugin-check-constants').default,
[require('@babel/plugin-transform-spread').default, { loose }],
require('@babel/plugin-transform-parameters').default,
[require('@babel/plugin-transform-destructuring').default, { loose }],
require('@babel/plugin-transform-block-scoping').default,
require('@babel/plugin-transform-property-literals').default,
[
require('@babel/plugin-proposal-object-rest-spread').default,
{ useBuiltIns: true },
],
...require('./transformers'),
...require('./json'),
].filter(Boolean),
});
}
}
}
}
if (!idInRest) {
for (let i = 0; i < params.length; ++i) {
const param = params[i];
if (paramsWithRestElement.has(i)) {
replaceRestElement(param.parentPath, param);
}
}
} else {
const shouldTransformParam = idx => idx >= i - 1 || paramsWithRestElement.has(idx);
(0, _pluginTransformParameters.convertFunctionParams)(path, loose, shouldTransformParam, replaceRestElement);
}
},