From de5b202dfeb12b5ec6e78069f44bea67ca93aede Mon Sep 17 00:00:00 2001 From: Teo Dragovic Date: Wed, 13 May 2020 17:56:03 +0200 Subject: [PATCH] Update rollup babel plugin --- package-lock.json | 42 +++++++++++++++++++++++++++++++---------- package.json | 2 +- src/index.js | 6 ++++-- src/lib/babel-custom.js | 4 ++-- 4 files changed, 39 insertions(+), 15 deletions(-) diff --git a/package-lock.json b/package-lock.json index e0e7c858..43b38fab 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "microbundle", - "version": "0.12.0-next.9", + "version": "0.12.0", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -1554,6 +1554,37 @@ } } }, + "@rollup/plugin-babel": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/@rollup/plugin-babel/-/plugin-babel-5.0.0.tgz", + "integrity": "sha512-YpVnwdUeVj/fDFN75Y3CAzJTMYNcqbH05SJs551wqj+BSwLT9pS3dqJrVDPYl3eH4OrI8ueiEseX5VgUn+0HLA==", + "requires": { + "@babel/helper-module-imports": "^7.7.4", + "@rollup/pluginutils": "^3.0.8" + }, + "dependencies": { + "@rollup/pluginutils": { + "version": "3.0.10", + "resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-3.0.10.tgz", + "integrity": "sha512-d44M7t+PjmMrASHbhgpSbVgtL6EFyX7J4mYxwQ/c5eoaE6N2VgCgEcWVzNnwycIloti+/MpwFr8qfw+nRw00sw==", + "requires": { + "@types/estree": "0.0.39", + "estree-walker": "^1.0.1", + "picomatch": "^2.2.2" + } + }, + "estree-walker": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-1.0.1.tgz", + "integrity": "sha512-1fMXF3YP4pZZVozF8j/ZLfvnR8NSIljt56UhbZ5PeeDmmGHpgpdwQt7ITlGvYaQukCvuBRMLEiKiYC+oeIg4cg==" + }, + "picomatch": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.2.2.tgz", + "integrity": "sha512-q0M/9eZHzmr0AulXyPwNfZjtwZ/RBZlbN3K3CErVrk50T2ASYI7Bye0EvekFY3IP1Nt2DHu0re+V2ZHIpMkuWg==" + } + } + }, "@rollup/plugin-commonjs": { "version": "11.0.2", "resolved": "https://registry.npmjs.org/@rollup/plugin-commonjs/-/plugin-commonjs-11.0.2.tgz", @@ -9210,15 +9241,6 @@ "acorn": "^7.1.0" } }, - "rollup-plugin-babel": { - "version": "4.4.0", - "resolved": "https://registry.npmjs.org/rollup-plugin-babel/-/rollup-plugin-babel-4.4.0.tgz", - "integrity": "sha512-Lek/TYp1+7g7I+uMfJnnSJ7YWoD58ajo6Oarhlex7lvUce+RCKRuGRSgztDO3/MF/PuGKmUL5iTHKf208UNszw==", - "requires": { - "@babel/helper-module-imports": "^7.0.0", - "rollup-pluginutils": "^2.8.1" - } - }, "rollup-plugin-bundle-size": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/rollup-plugin-bundle-size/-/rollup-plugin-bundle-size-1.0.3.tgz", diff --git a/package.json b/package.json index 82507cf8..1495afb6 100644 --- a/package.json +++ b/package.json @@ -69,6 +69,7 @@ "@babel/preset-env": "^7.8.7", "@babel/preset-flow": "^7.7.4", "@rollup/plugin-alias": "^3.0.1", + "@rollup/plugin-babel": "^5.0.0", "@rollup/plugin-commonjs": "^11.0.2", "@rollup/plugin-json": "^4.0.2", "@rollup/plugin-node-resolve": "^6.1.0", @@ -88,7 +89,6 @@ "module-details-from-path": "^1.0.3", "pretty-bytes": "^5.3.0", "rollup": "^1.32.1", - "rollup-plugin-babel": "^4.4.0", "rollup-plugin-bundle-size": "^1.0.1", "rollup-plugin-es3": "^1.1.0", "rollup-plugin-postcss": "^2.4.1", diff --git a/src/index.js b/src/index.js index 5059cd2b..78e59d76 100644 --- a/src/index.js +++ b/src/index.js @@ -7,7 +7,7 @@ import autoprefixer from 'autoprefixer'; import cssnano from 'cssnano'; import { rollup, watch } from 'rollup'; import commonjs from '@rollup/plugin-commonjs'; -import babel from 'rollup-plugin-babel'; +import babel from '@rollup/plugin-babel'; import customBabel from './lib/babel-custom'; import nodeResolve from '@rollup/plugin-node-resolve'; import { terser } from 'rollup-plugin-terser'; @@ -580,9 +580,10 @@ function createConfig(options, entry, format, writeMeta) { // if defines is not set, we shouldn't run babel through node_modules isTruthy(defines) && babel({ + babelHelpers: 'bundled', babelrc: false, - configFile: false, compact: false, + configFile: false, include: 'node_modules/**', plugins: [ [ @@ -592,6 +593,7 @@ function createConfig(options, entry, format, writeMeta) { ], }), customBabel()({ + babelHelpers: 'bundled', extensions: EXTENSIONS, exclude: 'node_modules/**', passPerPreset: true, // @see https://babeljs.io/docs/en/options#passperpreset diff --git a/src/lib/babel-custom.js b/src/lib/babel-custom.js index f5939827..ba477966 100644 --- a/src/lib/babel-custom.js +++ b/src/lib/babel-custom.js @@ -1,5 +1,5 @@ import { createConfigItem } from '@babel/core'; -import babelPlugin from 'rollup-plugin-babel'; +import { createBabelInputPluginFactory } from '@rollup/plugin-babel'; import merge from 'lodash.merge'; import transformFastRest from './transform-fast-rest'; import { isTruthy } from '../utils'; @@ -50,7 +50,7 @@ const createConfigItems = (type, items) => { const presetEnvRegex = RegExp(/@babel\/(preset-)?env/); export default () => { - return babelPlugin.custom(babelCore => { + return createBabelInputPluginFactory(babelCore => { return { // Passed the plugin options. options({ custom: customOptions, ...pluginOptions }) {