Skip to content

Commit 8ddafda

Browse files
committed
Upgrade dependencies and Rollup config
1 parent 344904f commit 8ddafda

File tree

6 files changed

+2345
-2464
lines changed

6 files changed

+2345
-2464
lines changed

.babelrc

Lines changed: 0 additions & 60 deletions
This file was deleted.

package.json

Lines changed: 48 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -21,49 +21,69 @@
2121
"format": "prettier --write 'src/**/*.js'",
2222
"prepublishOnly": "run-p flow build"
2323
},
24+
"babel": {
25+
"presets": [
26+
"@babel/preset-flow",
27+
"@babel/preset-react",
28+
[
29+
"@babel/preset-env",
30+
{
31+
"loose": true,
32+
"modules": "commonjs"
33+
}
34+
]
35+
],
36+
"plugins": [
37+
[
38+
"@babel/plugin-proposal-class-properties",
39+
{
40+
"loose": true
41+
}
42+
],
43+
"babel-plugin-macros"
44+
]
45+
},
2446
"husky": {
2547
"hooks": {
2648
"pre-commit": "lint-staged"
2749
}
2850
},
2951
"lint-staged": {
3052
"src/**/*.js": [
31-
"prettier --write",
32-
"git add"
53+
"prettier --write"
3354
]
3455
},
3556
"peerDependencies": {
3657
"react": ">=0.14.9"
3758
},
3859
"devDependencies": {
39-
"@babel/core": "^7.9.0",
40-
"@babel/plugin-proposal-class-properties": "^7.8.3",
41-
"@babel/plugin-transform-flow-strip-types": "^7.9.0",
42-
"@babel/plugin-transform-object-assign": "^7.8.3",
43-
"@babel/plugin-transform-react-jsx": "^7.9.4",
44-
"@babel/preset-env": "^7.9.5",
45-
"@babel/preset-flow": "^7.9.0",
46-
"@babel/preset-react": "^7.9.4",
47-
"@testing-library/react": "^10.0.3",
60+
"@babel/core": "^7.12.17",
61+
"@babel/plugin-proposal-class-properties": "^7.12.13",
62+
"@babel/plugin-transform-flow-strip-types": "^7.12.13",
63+
"@babel/plugin-transform-object-assign": "^7.12.13",
64+
"@babel/plugin-transform-react-jsx": "^7.12.17",
65+
"@babel/preset-env": "^7.12.17",
66+
"@babel/preset-flow": "^7.12.13",
67+
"@babel/preset-react": "^7.12.13",
68+
"@rollup/plugin-babel": "^5.3.0",
69+
"@rollup/plugin-buble": "^0.21.3",
70+
"@rollup/plugin-commonjs": "^17.1.0",
71+
"@rollup/plugin-node-resolve": "^11.2.0",
72+
"@testing-library/react": "^11.2.5",
4873
"babel-core": "^7.0.0-bridge.0",
49-
"babel-jest": "^25.4.0",
50-
"babel-plugin-macros": "^2.8.0",
51-
"codegen.macro": "^4.0.0",
52-
"flow-bin": "^0.123.0",
53-
"globby": "^11.0.0",
74+
"babel-jest": "^26.6.3",
75+
"babel-plugin-macros": "^3.0.1",
76+
"codegen.macro": "^4.1.0",
77+
"flow-bin": "^0.145.0",
78+
"globby": "^11.0.2",
5479
"husky": "^4.2.5",
55-
"jest": "^25.4.0",
56-
"lint-staged": "^10.1.7",
80+
"jest": "^26.6.3",
81+
"lint-staged": "^10.5.4",
5782
"npm-run-all": "^4.1.5",
58-
"prettier": "^2.0.5",
59-
"prismjs": "^1.20.0",
60-
"react": "^16.13.1",
61-
"react-dom": "^16.13.1",
62-
"rollup": "^2.7.2",
63-
"rollup-plugin-babel": "^4.4.0",
64-
"rollup-plugin-buble": "^0.19.8",
65-
"rollup-plugin-commonjs": "^10.1.0",
66-
"rollup-plugin-node-resolve": "^5.2.0",
67-
"rollup-plugin-replace": "^2.2.0"
83+
"prettier": "^2.2.1",
84+
"prismjs": "^1.23.0",
85+
"react": "^17.0.1",
86+
"react-dom": "^17.0.1",
87+
"rollup": "^2.39.0"
6888
}
6989
}

rollup.config.js

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,23 @@ import * as globby from 'globby';
22
import * as path from 'path';
33
import * as fs from 'fs';
44

5-
import commonjs from 'rollup-plugin-commonjs';
6-
import nodeResolve from 'rollup-plugin-node-resolve';
7-
import buble from 'rollup-plugin-buble';
8-
import babel from 'rollup-plugin-babel';
5+
import commonjs from '@rollup/plugin-commonjs';
6+
import resolve from '@rollup/plugin-node-resolve';
7+
import buble from '@rollup/plugin-buble';
8+
import babel from '@rollup/plugin-babel';
99

10-
const pkgInfo = require('./package.json');
10+
const pkg = require('./package.json');
1111

12-
let external = ['dns', 'fs', 'path', 'url'];
13-
if (pkgInfo.peerDependencies)
14-
external.push(...Object.keys(pkgInfo.peerDependencies));
15-
if (pkgInfo.dependencies)
16-
external.push(...Object.keys(pkgInfo.dependencies));
12+
const externalModules = [
13+
'dns',
14+
'fs',
15+
'path',
16+
'url',
17+
...Object.keys(pkg.peerDependencies || {}),
18+
...Object.keys(pkg.dependencies || {}),
19+
];
1720

18-
const externalPredicate = new RegExp(`^(${external.join('|')})($|/)`);
21+
const externalPredicate = new RegExp(`^(${externalModules.join('|')})($|/)`);
1922
const bundlePredicate = /\/themes\//;
2023
const externalTest = id => externalPredicate.test(id) || bundlePredicate.test(id);
2124

@@ -24,8 +27,10 @@ const config = {
2427
treeshake: { propertyReadSideEffects: false },
2528
external: externalTest,
2629
plugins: [
27-
nodeResolve({
30+
resolve({
31+
dedupe: externalModules,
2832
mainFields: ['module', 'jsnext', 'main'],
33+
preferBuiltins: false,
2934
browser: true,
3035
}),
3136
commonjs({
@@ -37,6 +42,9 @@ const config = {
3742
}),
3843
babel({
3944
babelrc: false,
45+
babelHelpers: 'bundled',
46+
exclude: 'node_modules/**',
47+
presets: [],
4048
plugins: [
4149
'babel-plugin-macros',
4250
'@babel/plugin-transform-flow-strip-types',
@@ -54,6 +62,9 @@ const config = {
5462
}),
5563
babel({
5664
babelrc: false,
65+
babelHelpers: 'bundled',
66+
exclude: 'node_modules/**',
67+
presets: [],
5768
plugins: [
5869
'@babel/plugin-transform-object-assign',
5970
['@babel/plugin-transform-react-jsx', {

0 commit comments

Comments
 (0)