Skip to content

Commit

Permalink
Upgrade dependencies and Rollup config
Browse files Browse the repository at this point in the history
  • Loading branch information
kitten committed Feb 20, 2021
1 parent 344904f commit 8ddafda
Show file tree
Hide file tree
Showing 6 changed files with 2,345 additions and 2,464 deletions.
60 changes: 0 additions & 60 deletions .babelrc

This file was deleted.

76 changes: 48 additions & 28 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,49 +21,69 @@
"format": "prettier --write 'src/**/*.js'",
"prepublishOnly": "run-p flow build"
},
"babel": {
"presets": [
"@babel/preset-flow",
"@babel/preset-react",
[
"@babel/preset-env",
{
"loose": true,
"modules": "commonjs"
}
]
],
"plugins": [
[
"@babel/plugin-proposal-class-properties",
{
"loose": true
}
],
"babel-plugin-macros"
]
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"lint-staged": {
"src/**/*.js": [
"prettier --write",
"git add"
"prettier --write"
]
},
"peerDependencies": {
"react": ">=0.14.9"
},
"devDependencies": {
"@babel/core": "^7.9.0",
"@babel/plugin-proposal-class-properties": "^7.8.3",
"@babel/plugin-transform-flow-strip-types": "^7.9.0",
"@babel/plugin-transform-object-assign": "^7.8.3",
"@babel/plugin-transform-react-jsx": "^7.9.4",
"@babel/preset-env": "^7.9.5",
"@babel/preset-flow": "^7.9.0",
"@babel/preset-react": "^7.9.4",
"@testing-library/react": "^10.0.3",
"@babel/core": "^7.12.17",
"@babel/plugin-proposal-class-properties": "^7.12.13",
"@babel/plugin-transform-flow-strip-types": "^7.12.13",
"@babel/plugin-transform-object-assign": "^7.12.13",
"@babel/plugin-transform-react-jsx": "^7.12.17",
"@babel/preset-env": "^7.12.17",
"@babel/preset-flow": "^7.12.13",
"@babel/preset-react": "^7.12.13",
"@rollup/plugin-babel": "^5.3.0",
"@rollup/plugin-buble": "^0.21.3",
"@rollup/plugin-commonjs": "^17.1.0",
"@rollup/plugin-node-resolve": "^11.2.0",
"@testing-library/react": "^11.2.5",
"babel-core": "^7.0.0-bridge.0",
"babel-jest": "^25.4.0",
"babel-plugin-macros": "^2.8.0",
"codegen.macro": "^4.0.0",
"flow-bin": "^0.123.0",
"globby": "^11.0.0",
"babel-jest": "^26.6.3",
"babel-plugin-macros": "^3.0.1",
"codegen.macro": "^4.1.0",
"flow-bin": "^0.145.0",
"globby": "^11.0.2",
"husky": "^4.2.5",
"jest": "^25.4.0",
"lint-staged": "^10.1.7",
"jest": "^26.6.3",
"lint-staged": "^10.5.4",
"npm-run-all": "^4.1.5",
"prettier": "^2.0.5",
"prismjs": "^1.20.0",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"rollup": "^2.7.2",
"rollup-plugin-babel": "^4.4.0",
"rollup-plugin-buble": "^0.19.8",
"rollup-plugin-commonjs": "^10.1.0",
"rollup-plugin-node-resolve": "^5.2.0",
"rollup-plugin-replace": "^2.2.0"
"prettier": "^2.2.1",
"prismjs": "^1.23.0",
"react": "^17.0.1",
"react-dom": "^17.0.1",
"rollup": "^2.39.0"
}
}
35 changes: 23 additions & 12 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,23 @@ import * as globby from 'globby';
import * as path from 'path';
import * as fs from 'fs';

import commonjs from 'rollup-plugin-commonjs';
import nodeResolve from 'rollup-plugin-node-resolve';
import buble from 'rollup-plugin-buble';
import babel from 'rollup-plugin-babel';
import commonjs from '@rollup/plugin-commonjs';
import resolve from '@rollup/plugin-node-resolve';
import buble from '@rollup/plugin-buble';
import babel from '@rollup/plugin-babel';

const pkgInfo = require('./package.json');
const pkg = require('./package.json');

let external = ['dns', 'fs', 'path', 'url'];
if (pkgInfo.peerDependencies)
external.push(...Object.keys(pkgInfo.peerDependencies));
if (pkgInfo.dependencies)
external.push(...Object.keys(pkgInfo.dependencies));
const externalModules = [
'dns',
'fs',
'path',
'url',
...Object.keys(pkg.peerDependencies || {}),
...Object.keys(pkg.dependencies || {}),
];

const externalPredicate = new RegExp(`^(${external.join('|')})($|/)`);
const externalPredicate = new RegExp(`^(${externalModules.join('|')})($|/)`);
const bundlePredicate = /\/themes\//;
const externalTest = id => externalPredicate.test(id) || bundlePredicate.test(id);

Expand All @@ -24,8 +27,10 @@ const config = {
treeshake: { propertyReadSideEffects: false },
external: externalTest,
plugins: [
nodeResolve({
resolve({
dedupe: externalModules,
mainFields: ['module', 'jsnext', 'main'],
preferBuiltins: false,
browser: true,
}),
commonjs({
Expand All @@ -37,6 +42,9 @@ const config = {
}),
babel({
babelrc: false,
babelHelpers: 'bundled',
exclude: 'node_modules/**',
presets: [],
plugins: [
'babel-plugin-macros',
'@babel/plugin-transform-flow-strip-types',
Expand All @@ -54,6 +62,9 @@ const config = {
}),
babel({
babelrc: false,
babelHelpers: 'bundled',
exclude: 'node_modules/**',
presets: [],
plugins: [
'@babel/plugin-transform-object-assign',
['@babel/plugin-transform-react-jsx', {
Expand Down
Loading

0 comments on commit 8ddafda

Please sign in to comment.