Skip to content

Commit

Permalink
Migrate from rollup-plugin-babel to @rollup/plugin-babel
Browse files Browse the repository at this point in the history
BREAKING: requires Node 10+

- was getting a warning on install:
  - "npm WARN deprecated [email protected]: This package has been deprecated and is no longer maintained. Please use @rollup/plugin-babel."

- c.f. https://github.com/rollup/plugins/blob/master/packages/babel/CHANGELOG.md#breaking-changes
  - `babelPlugin.custom` is now a separate export,
    `createBabelInputPluginFactory`
  - `babelHelpers: 'bundled'` was added
    - this is the default and backward-compatible with 4.x, but they
      recommended explicitly configuring it as such

- c.f. https://github.com/rollup/plugins/blob/master/packages/babel/CHANGELOG.md#v510
  - typings have been added to the package directly, no need to declare
    module to workaround lack of typings anymore

- remove old commented out line referring to rollup-plugin-babel as well

Co-Authored-By: Anton Gilgur <[email protected]>
  • Loading branch information
vladdy-moses and agilgur5 committed Sep 21, 2020
1 parent 6ba173f commit edfc7f0
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 20 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
"@babel/helper-module-imports": "^7.0.0",
"@babel/plugin-proposal-class-properties": "^7.4.4",
"@babel/preset-env": "^7.11.0",
"@rollup/plugin-babel": "^5.1.0",
"@rollup/plugin-commonjs": "^11.0.0",
"@rollup/plugin-json": "^4.0.0",
"@rollup/plugin-node-resolve": "^7.1.0",
Expand Down Expand Up @@ -86,7 +87,6 @@
"progress-estimator": "^0.2.2",
"regenerator-runtime": "^0.13.7",
"rollup": "^1.32.1",
"rollup-plugin-babel": "^4.3.2",
"rollup-plugin-sourcemaps": "^0.5.0",
"rollup-plugin-terser": "^5.1.2",
"rollup-plugin-typescript2": "^0.26.0",
Expand Down
4 changes: 2 additions & 2 deletions src/babelPluginTsdx.ts
Original file line number Diff line number Diff line change
@@ -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';

export const isTruthy = (obj?: any) => {
Expand Down Expand Up @@ -47,7 +47,7 @@ export const createConfigItems = (type: any, items: any[]) => {
});
};

export const babelPluginTsdx = babelPlugin.custom(() => ({
export const babelPluginTsdx = createBabelInputPluginFactory(() => ({
// Passed the plugin options.
options({ custom: customOptions, ...pluginOptions }: any) {
return {
Expand Down
2 changes: 1 addition & 1 deletion src/createRollupConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { paths } from './constants';
import { RollupOptions } from 'rollup';
import { terser } from 'rollup-plugin-terser';
import { DEFAULT_EXTENSIONS } from '@babel/core';
// import babel from 'rollup-plugin-babel';
import commonjs from '@rollup/plugin-commonjs';
import json from '@rollup/plugin-json';
import replace from '@rollup/plugin-replace';
Expand Down Expand Up @@ -193,6 +192,7 @@ export async function createRollupConfig(
extractErrors: opts.extractErrors,
format: opts.format,
},
babelHelpers: 'bundled',
}),
opts.env !== undefined &&
replace({
Expand Down
1 change: 0 additions & 1 deletion src/env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ declare module '@babel/core' {
}

// Rollup plugins
declare module 'rollup-plugin-babel';
declare module 'rollup-plugin-terser';
declare module 'babel-traverse';
declare module 'babylon';
Expand Down
30 changes: 15 additions & 15 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@
dependencies:
"@babel/types" "^7.11.0"

"@babel/helper-module-imports@^7.0.0", "@babel/helper-module-imports@^7.10.4":
"@babel/helper-module-imports@^7.0.0", "@babel/helper-module-imports@^7.10.4", "@babel/helper-module-imports@^7.7.4":
version "7.10.4"
resolved "https://registry.yarnpkg.com/@babel/helper-module-imports/-/helper-module-imports-7.10.4.tgz#4c5c54be04bd31670a7382797d75b9fa2e5b5620"
integrity sha512-nEQJHqYavI217oD9+s5MUBzk6x1IlvoS9WTPfgG43CbMEeStE0v+r+TucWdx8KFGowPGvyOkDT9+7DHedIDnVw==
Expand Down Expand Up @@ -1063,6 +1063,14 @@
"@types/yargs" "^15.0.0"
chalk "^3.0.0"

"@rollup/plugin-babel@^5.1.0":
version "5.1.0"
resolved "https://registry.yarnpkg.com/@rollup/plugin-babel/-/plugin-babel-5.1.0.tgz#ad8b5803fa6e1feb0f168984edc040b90d966450"
integrity sha512-zXBEYmfiLAMvB+ZBa6m/q9hsQYAq1sUFdjuP1F6C2pf6uQcpHwAWQveZgzS63zXdKPUYHD3Dr7BhjCqcr0bbLw==
dependencies:
"@babel/helper-module-imports" "^7.7.4"
"@rollup/pluginutils" "^3.0.8"

"@rollup/plugin-commonjs@^11.0.0":
version "11.0.0"
resolved "https://registry.yarnpkg.com/@rollup/plugin-commonjs/-/plugin-commonjs-11.0.0.tgz#a6675e56094ac9c797c19a3986378289396a9dd5"
Expand Down Expand Up @@ -1100,14 +1108,14 @@
magic-string "^0.25.2"
rollup-pluginutils "^2.6.0"

"@rollup/pluginutils@^3.0.0", "@rollup/pluginutils@^3.0.1", "@rollup/pluginutils@^3.0.6":
version "3.0.9"
resolved "https://registry.yarnpkg.com/@rollup/pluginutils/-/pluginutils-3.0.9.tgz#aa6adca2c45e5a1b950103a999e3cddfe49fd775"
integrity sha512-TLZavlfPAZYI7v33wQh4mTP6zojne14yok3DNSLcjoG/Hirxfkonn6icP5rrNWRn8nZsirJBFFpijVOJzkUHDg==
"@rollup/pluginutils@^3.0.0", "@rollup/pluginutils@^3.0.1", "@rollup/pluginutils@^3.0.6", "@rollup/pluginutils@^3.0.8":
version "3.1.0"
resolved "https://registry.yarnpkg.com/@rollup/pluginutils/-/pluginutils-3.1.0.tgz#706b4524ee6dc8b103b3c995533e5ad680c02b9b"
integrity sha512-GksZ6pr6TpIjHm8h9lSQ8pi8BE9VeubNT0OMJ3B5uZJ8pz73NPiqOtCog/x2/QzM1ENChPKxMDhiQuRHsqc+lg==
dependencies:
"@types/estree" "0.0.39"
estree-walker "^1.0.1"
micromatch "^4.0.2"
picomatch "^2.2.2"

"@samverschueren/stream-to-observable@^0.3.0":
version "0.3.0"
Expand Down Expand Up @@ -6305,7 +6313,7 @@ performance-now@^2.1.0:
resolved "https://registry.yarnpkg.com/performance-now/-/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b"
integrity sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=

picomatch@^2.0.4, picomatch@^2.0.5:
picomatch@^2.0.4, picomatch@^2.0.5, picomatch@^2.2.2:
version "2.2.2"
resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.2.2.tgz#21f333e9b6b8eaff02468f5146ea406d345f4dad"
integrity sha512-q0M/9eZHzmr0AulXyPwNfZjtwZ/RBZlbN3K3CErVrk50T2ASYI7Bye0EvekFY3IP1Nt2DHu0re+V2ZHIpMkuWg==
Expand Down Expand Up @@ -7231,14 +7239,6 @@ rimraf@^3.0.0:
dependencies:
glob "^7.1.3"

rollup-plugin-babel@^4.3.2:
version "4.3.3"
resolved "https://registry.yarnpkg.com/rollup-plugin-babel/-/rollup-plugin-babel-4.3.3.tgz#7eb5ac16d9b5831c3fd5d97e8df77ba25c72a2aa"
integrity sha512-tKzWOCmIJD/6aKNz0H1GMM+lW1q9KyFubbWzGiOG540zxPPifnEAHTZwjo0g991Y+DyOZcLqBgqOdqazYE5fkw==
dependencies:
"@babel/helper-module-imports" "^7.0.0"
rollup-pluginutils "^2.8.1"

rollup-plugin-postcss@^2.5.0:
version "2.5.0"
resolved "https://registry.yarnpkg.com/rollup-plugin-postcss/-/rollup-plugin-postcss-2.5.0.tgz#54ef2487cda498d8bca69aaca3b55b30dee0106b"
Expand Down

0 comments on commit edfc7f0

Please sign in to comment.