rollup-preset-esnext
Version:
ES.Next transpile preset for Rollup by Harald Rudell
80 lines (69 loc) • 2.15 kB
JavaScript
import presetEsNext from 'babel-preset-7-esnext';
import { eslint } from 'rollup-plugin-eslint';
import resolve from 'rollup-plugin-node-resolve';
import babel from 'rollup-plugin-babel';
import json from 'rollup-plugin-json';
import commonjs from 'rollup-plugin-commonjs';
function _defineProperty(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
function _objectSpread(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i] != null ? arguments[i] : {};
var ownKeys = Object.keys(source);
if (typeof Object.getOwnPropertySymbols === 'function') {
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) {
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
}));
}
ownKeys.forEach(function (key) {
_defineProperty(target, key, source[key]);
});
}
return target;
}
const eslintPath = require.resolve('eslint');
var rollupPresetEsNext = (options => {
options = _objectSpread({}, options);
const jail = options.jail !== undefined ? options.jail : process.cwd();
if (options.env == null) options.env = {
targets: {
node: '8.5'
}
};
const compact = options.compact != null ? options.compact : false;
return [eslint({
include: ['**/*.js', '**/*.mjs'],
exclude: 'node_modules/**',
eslintPath,
ignore: false
}), resolve({
extensions: ['.mjs', '.js', '.json'],
customResolveOptions: {
jail
}
}), json(), babel({
babelrc: false,
configFile: false,
include: ['**/*.js', '**/*.mjs'],
exclude: 'node_modules/**',
presets: [[presetEsNext, options]],
runtimeHelpers: true,
compact
}), commonjs()];
});
/*
© 2017-present Harald Rudell <harald.rudell@gmail.com> (http://www.haraldrudell.com)
This source code is licensed under the ISC-style license found in the LICENSE file in the root directory of this source tree.
*/
export default rollupPresetEsNext;