Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: use Rollup 2 #12010

Merged
merged 6 commits into from Aug 26, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
26 changes: 10 additions & 16 deletions Gulpfile.js
Expand Up @@ -10,14 +10,13 @@ const filter = require("gulp-filter");
const gulp = require("gulp");
const path = require("path");
const rollup = require("rollup");
const rollupBabel = require("rollup-plugin-babel");
const rollupBabel = require("@rollup/plugin-babel").default;
const rollupBabelSource = require("./scripts/rollup-plugin-babel-source");
const rollupCommonJs = require("rollup-plugin-commonjs");
const rollupCommonJs = require("@rollup/plugin-commonjs");
const rollupJson = require("@rollup/plugin-json");
const rollupNodeBuiltins = require("rollup-plugin-node-builtins");
const rollupNodeGlobals = require("rollup-plugin-node-globals");
const rollupNodeResolve = require("rollup-plugin-node-resolve");
const rollupReplace = require("rollup-plugin-replace");
const rollupNodePolyfills = require("rollup-plugin-node-polyfills");
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rollup-plugin-node-polyfills replaces both rollup-plugin-node-globals and rollup-plugin-node-builtins. This has been done on v8 branch and now can be backported since we are not building on node.js 6.

const rollupNodeResolve = require("@rollup/plugin-node-resolve").default;
const rollupReplace = require("@rollup/plugin-replace");
const { terser: rollupTerser } = require("rollup-plugin-terser");

const defaultSourcesGlob = "./@(codemods|packages|eslint)/*/src/**/*.js";
Expand Down Expand Up @@ -102,7 +101,6 @@ function buildRollup(packages) {
if (minify) {
extraPlugins.push(
rollupTerser({
include: /^.+\.min\.js$/,
// workaround https://bugs.webkit.org/show_bug.cgi?id=212725
output: {
ascii_only: true,
Expand Down Expand Up @@ -135,6 +133,7 @@ function buildRollup(packages) {
rollupBabel({
envName: babelEnvName,
babelrc: false,
babelHelpers: "bundled",
extends: "./babel.config.js",
}),
rollupNodeResolve({
Expand All @@ -153,17 +152,12 @@ function buildRollup(packages) {
// Rollup doesn't read export maps, so it loads the cjs fallback
"packages/babel-compat-data/*.js",
],
namedExports: {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

namedExports is removed per suggestions from @rollup/plugin-commonjs@13.

"babel-plugin-dynamic-import-node/utils.js": [
"createDynamicImportTransform",
"getImportSource",
],
"@babel/standalone": ["availablePlugins", "registerPlugin"],
},
}),
rollupJson(),
rollupNodeBuiltins(),
rollupNodeGlobals({ sourceMap: sourcemap }),
rollupNodePolyfills({
sourceMap: sourcemap,
include: "**/*.js",
}),
],
})
.then(bundle => {
Expand Down
17 changes: 8 additions & 9 deletions package.json
Expand Up @@ -27,7 +27,11 @@
"@babel/preset-flow": "^7.10.4",
"@babel/register": "^7.10.5",
"@babel/runtime": "^7.11.0",
"@rollup/plugin-json": "4.0.1",
"@rollup/plugin-babel": "^5.2.0",
"@rollup/plugin-commonjs": "^13.0.0",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The latest commonjs is 15, however I have to pin to 13 due to an upstream issue: rollup/plugins#557

"@rollup/plugin-json": "^4.1.0",
"@rollup/plugin-node-resolve": "^9.0.0",
"@rollup/plugin-replace": "^2.3.3",
"babel-jest": "^24.9.0",
"babel-plugin-transform-charcodes": "^0.2.0",
"chalk": "^2.4.2",
Expand Down Expand Up @@ -55,14 +59,9 @@
"prettier": "^2.0.5",
"pump": "^3.0.0",
"rimraf": "^2.6.3",
"rollup": "1.27.9",
"rollup-plugin-babel": "^4.4.0",
"rollup-plugin-commonjs": "^10.1.0",
"rollup-plugin-node-builtins": "^2.1.2",
"rollup-plugin-node-globals": "^1.4.0",
"rollup-plugin-node-resolve": "^5.0.0",
"rollup-plugin-replace": "^2.2.0",
"rollup-plugin-terser": "^5.3.0",
"rollup": "^2.26.5",
"rollup-plugin-node-polyfills": "^0.2.1",
"rollup-plugin-terser": "^7.0.0",
"test262-stream": "^1.3.0",
"through2": "^2.0.0",
"typescript": "^3.6.3"
Expand Down