Permalink
Browse files

Upgrade to babel 7

In this diff I moved build to babel 7, removed unused packages and made
babel helpers importable from runtime. This allows to reuse these
helpers across many packages and save a few kilobytes in user bundle.
  • Loading branch information...
TrySound committed Aug 29, 2018
1 parent 86c24c0 commit 9f3470400c2caf0b090abe56819055f1ab1c124e
Showing with 751 additions and 444 deletions.
  1. +0 −14 .babelrc
  2. +7 −0 babel.config.js
  3. +20 −18 package.json
  4. +34 −24 rollup.config.js
  5. +690 −388 yarn.lock

This file was deleted.

Oops, something went wrong.
@@ -0,0 +1,7 @@
module.exports = {
presets: [['@babel/env', { loose: true }], '@babel/flow'],
plugins: [
['@babel/proposal-class-properties', { loose: true }],
'annotate-pure-calls',
],
};
@@ -1,10 +1,8 @@
{
"name": "react-window",
"version": "1.1.1",
"description":
"React components for efficiently rendering large, scrollable lists and tabular data",
"author":
"Brian Vaughn <brian.david.vaughn@gmail.com> (https://github.com/bvaughn/)",
"description": "React components for efficiently rendering large, scrollable lists and tabular data",
"author": "Brian Vaughn <brian.david.vaughn@gmail.com> (https://github.com/bvaughn/)",
"contributors": [
"Brian Vaughn <brian.david.vaughn@gmail.com> (https://github.com/bvaughn/)"
],
@@ -36,7 +34,9 @@
],
"main": "dist/index.cjs.js",
"module": "dist/index.esm.js",
"files": ["dist"],
"files": [
"dist"
],
"scripts": {
"precommit": "lint-staged",
"prettier": "prettier --write '**/*.{js,json,css}'",
@@ -52,24 +52,29 @@
"website:run": "cd website && yarn start"
},
"lint-staged": {
"{website,src}/**/*.{js,json,css}": ["prettier --write", "git add"],
"{website,src}/**/*.{js,json,css}": [
"prettier --write",
"git add"
],
"**/*.js": "eslint --max-warnings 0"
},
"dependencies": {
"@babel/runtime": "^7.0.0",
"memoize-one": "^3.1.1"
},
"peerDependencies": {
"react": "^15.0.0 || ^16.0.0",
"react-dom": "^15.0.0 || ^16.0.0"
},
"devDependencies": {
"babel-core": "^6.26.0",
"babel-eslint": "^8.2.1",
"@babel/core": "^7.0.0",
"@babel/plugin-proposal-class-properties": "^7.0.0",
"@babel/plugin-transform-runtime": "^7.0.0",
"@babel/preset-env": "^7.0.0",
"@babel/preset-flow": "^7.0.0",
"babel-core": "^7.0.0-bridge.0",
"babel-eslint": "^9.0.0",
"babel-plugin-annotate-pure-calls": "^0.3.0",
"babel-plugin-external-helpers": "^6.22.0",
"babel-preset-env": "^1.6.0",
"babel-preset-react": "^6.24.1",
"babel-preset-stage-0": "^6.24.1",
"cross-env": "^5.1.4",
"del-cli": "^1.1.0",
"eslint": "^4.19.1",
@@ -92,12 +97,9 @@
"react-dom": "^16.4.0",
"react-scripts": "^1.1.1",
"react-test-renderer": "^16.4.0",
"rollup": "^0.59.3",
"rollup-plugin-babel": "^3.0.3",
"rollup": "^0.65.0",
"rollup-plugin-babel": "^4.0.2",
"rollup-plugin-commonjs": "^8.2.1",
"rollup-plugin-node-resolve": "^3.0.2",
"rollup-plugin-peer-deps-external": "^2.2.0",
"rollup-plugin-postcss": "^1.1.0",
"rollup-plugin-url": "^1.3.0"
"rollup-plugin-node-resolve": "^3.0.2"
}
}
@@ -1,34 +1,44 @@
import babel from 'rollup-plugin-babel';
import commonjs from 'rollup-plugin-commonjs';
import external from 'rollup-plugin-peer-deps-external';
import postcss from 'rollup-plugin-postcss';
import resolve from 'rollup-plugin-node-resolve';
import url from 'rollup-plugin-url';

import nodeResolve from 'rollup-plugin-node-resolve';
import pkg from './package.json';

export default {
input: 'src/index.js',
output: [
{
const input = './src/index.js';

const external = id => !id.startsWith('.') && !id.startsWith('/');

export default [
{
input,
output: {
file: pkg.main,
format: 'cjs',
},
{
external,
plugins: [
babel({
runtimeHelpers: true,
plugins: ['@babel/transform-runtime'],
}),
nodeResolve(),
commonjs(),
],
},

{
input,
output: {
file: pkg.module,
format: 'esm',
},
],
plugins: [
external({ includeDependencies: true }),
postcss({
modules: true,
}),
url(),
babel({
exclude: 'node_modules/**',
}),
resolve(),
commonjs(),
],
};
external,
plugins: [
babel({
runtimeHelpers: true,
plugins: [['@babel/transform-runtime', { useESModules: true }]],
}),
nodeResolve(),
commonjs(),
],
},
];
Oops, something went wrong.

0 comments on commit 9f34704

Please sign in to comment.