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

feat: upgrade rollup to 2 #274

Merged
merged 6 commits into from
Nov 24, 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
4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -400,10 +400,6 @@ export default {

配置 rollup-plugin-commonjs 的 [include][https://github.com/rollup/rollup-plugin-commonjs#usage]。

#### namedExports

配置 rollup-plugin-commonjs 的 [namedExports](https://github.com/rollup/rollup-plugin-commonjs#usage)。

#### nodeResolveOpts

配置 [rollup-plugin-node-resolve](https://github.com/rollup/rollup-plugin-node-resolve) 参数。
Expand Down
22 changes: 11 additions & 11 deletions packages/father-build/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,14 @@
"@babel/preset-react": "7.12.1",
"@babel/preset-typescript": "7.12.1",
"@babel/register": "7.12.1",
"@svgr/rollup": "^4.3.0",
"@rollup/plugin-babel": "5.2.1",
"@rollup/plugin-commonjs": "16.0.0",
"@rollup/plugin-inject": "4.0.2",
"@rollup/plugin-json": "4.1.0",
"@rollup/plugin-node-resolve": "10.0.0",
"@rollup/plugin-replace": "2.3.4",
"@rollup/plugin-url": "5.0.1",
"@svgr/rollup": "5.4.0",
"ajv": "6.10.0",
"autoprefixer": "9.6.0",
"babel-plugin-istanbul": "^5.2.0",
Expand All @@ -39,17 +46,10 @@
"less-plugin-npm-import": "2.1.0",
"lodash": "4.17.19",
"rimraf": "2.6.3",
"rollup": "1.27.8",
"rollup-plugin-babel": "4.3.3",
"rollup-plugin-commonjs": "10.0.0",
"rollup-plugin-inject": "3.0.1",
"rollup-plugin-json": "4.0.0",
"rollup-plugin-node-resolve": "5.0.1",
"rollup-plugin-postcss-umi": "2.0.3",
"rollup-plugin-replace": "2.2.0",
"rollup-plugin-terser": "5.1.3",
"rollup": "2.33.3",
"rollup-plugin-postcss": "3.1.8",
"rollup-plugin-terser": "7.0.2",
"rollup-plugin-typescript2": "0.29.0",
"rollup-plugin-url": "^2.2.2",
"signale": "1.4.0",
"slash2": "2.0.0",
"temp-dir": "2.0.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
(global = global || self, global.foo = factory());
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.foo = factory());
}(this, (function () { 'use strict';

var index = (function () {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,23 @@
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
(global = global || self, global.foo = factory());
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.foo = factory());
}(this, (function () { 'use strict';

var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};

function createCommonjsModule(fn, module) {
return module = { exports: {} }, fn(module, module.exports), module.exports;
function createCommonjsModule(fn, basedir, module) {
return module = {
path: basedir,
exports: {},
require: function (path, base) {
return commonjsRequire(path, (base === undefined || base === null) ? module.path : base);
}
}, fn(module, module.exports), module.exports;
}

function commonjsRequire () {
throw new Error('Dynamic requires are not currently supported by @rollup/plugin-commonjs');
}

var lib = createCommonjsModule(function (module) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

export default {
umd: {
minFile: false,
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
(function (factory) {
typeof define === 'function' && define.amd ? define(factory) :
factory();
}((function () { 'use strict';

function createCommonjsModule(fn, basedir, module) {
return module = {
path: basedir,
exports: {},
require: function (path, base) {
return commonjsRequire(path, (base === undefined || base === null) ? module.path : base);
}
}, fn(module, module.exports), module.exports;
}

function commonjsRequire () {
throw new Error('Dynamic requires are not currently supported by @rollup/plugin-commonjs');
}

var foo_1 = createCommonjsModule(function (module, exports) {
var foo = exports;

foo.a = function () {
return 'a';
};
foo.b = function () {
return 'b';
};
});

console.log(foo_1.a());
console.log(foo_1.b());

})));

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,8 @@
return 'b';
},
};
var foo_1 = foo.a;
var foo_2 = foo.b;

console.log(foo_1());
console.log(foo_2());
console.log(foo.a());
console.log(foo.b());

})));
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function styleInject(css, ref) {
}
}

var css = "\n.a {\n display: -webkit-box;\n display: -webkit-flex;\n display: -ms-flexbox;\n display: flex;\n}\n";
styleInject(css);
var css_248z = "\n.a {\n display: -webkit-box;\n display: -webkit-flex;\n display: -ms-flexbox;\n display: flex;\n}\n";
styleInject(css_248z);

console.log('foo');
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
var css = "\n.a { color: green; }\n";
var css_248z = "\n.a { color: green; }\n";

console.log(css);
console.log(css_248z);
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ function styleInject(css, ref) {
}
}

var css = "\n.foo_a__3z5g- { color: green; }\n";
var css_248z = "\n.foo_a__3z5g- { color: green; }\n";
var styles = {"a":"foo_a__3z5g-"};
styleInject(css);
styleInject(css_248z);

console.log('foo', styles.a);
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function styleInject(css, ref) {
}
}

var css = "\n.a { color: green; }\n";
styleInject(css);
var css_248z = "\n.a { color: green; }\n";
styleInject(css_248z);

console.log('foo');
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export default function(){console.log("foo")}
function o(){console.log("foo")}export default o;
Original file line number Diff line number Diff line change
@@ -1 +1 @@
console.log("bar");export default function(){}
function o(){}console.log("bar");export default o;
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ function styleInject(css, ref) {
}
}

var css = ".foo_a__1JvkR {\n color: green;\n}\n";
var css_248z = ".foo_a__1JvkR {\n color: green;\n}\n";
var styles = {"a":"foo_a__1JvkR"};
styleInject(css);
styleInject(css_248z);

console.log('foo', styles.a);
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function styleInject(css, ref) {
}
}

var css = ".bar {\n color: red;\n}\n.a {\n color: green;\n}\n";
styleInject(css);
var css_248z = ".bar {\n color: red;\n}\n.a {\n color: green;\n}\n";
styleInject(css_248z);

console.log('foo');
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function styleInject(css, ref) {
}
}

var css = ".a {\n color: green;\n}\n";
styleInject(css);
var css_248z = ".a {\n color: green;\n}\n";
styleInject(css_248z);

console.log('foo');
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function styleInject(css, ref) {
}
}

var css = ".a {\n color: green; }\n";
styleInject(css);
var css_248z = ".a {\n color: green; }\n";
styleInject(css_248z);

console.log('foo');

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
import React from 'react';
import React, { createElement } from 'react';

function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }

var _ref = /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("style", null));
var _ref = /*#__PURE__*/createElement("defs", null, /*#__PURE__*/createElement("style", null));

var _ref2 = /*#__PURE__*/React.createElement("path", {
var _ref2 = /*#__PURE__*/createElement("path", {
d: "M656 512h160c8.8 0 16-7.2 16-16v-96c0-8.8-7.2-16-16-16H656c-8.8 0-16 7.2-16 16v22H346V320h86c8.8 0 16-7.2 16-16v-96c0-8.8-7.2-16-16-16H208c-8.8 0-16 7.2-16 16v96c0 8.8 7.2 16 16 16h86v378c0 17.7 14.3 32 32 32h314v22c0 8.8 7.2 16 16 16h160c8.8 0 16-7.2 16-16v-96c0-8.8-7.2-16-16-16H656c-8.8 0-16 7.2-16 16v22H346V474h294v22c0 8.8 7.2 16 16 16z"
});

var SvgMenu = function SvgMenu(props) {
return /*#__PURE__*/React.createElement("svg", _extends({
function SvgMenu(props) {
return /*#__PURE__*/createElement("svg", _extends({
className: "menu_svg__icon",
viewBox: "0 0 1024 1024",
width: 200,
height: 200
}, props), _ref, _ref2);
};
}

var svgUrl = "data:image/svg+xml,%3C%3Fxml%20version%3D%221.0%22%20standalone%3D%22no%22%3F%3E%3C!DOCTYPE%20svg%20PUBLIC%20%22-%2F%2FW3C%2F%2FDTD%20SVG%201.1%2F%2FEN%22%20%20%22http%3A%2F%2Fwww.w3.org%2FGraphics%2FSVG%2F1.1%2FDTD%2Fsvg11.dtd%22%3E%3Csvg%20t%3D%221558949630117%22%20class%3D%22icon%22%20style%3D%22%22%20viewBox%3D%220%200%201024%201024%22%20version%3D%221.1%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20%20%20%20%20p-id%3D%2233994%22%20%20%20%20%20width%3D%22200%22%20height%3D%22200%22%3E%20%20%3Cdefs%3E%20%20%20%20%3Cstyle%20type%3D%22text%2Fcss%22%3E%3C%2Fstyle%3E%20%20%3C%2Fdefs%3E%20%20%3Cpath%20%20%20%20d%3D%22M656%20512h160c8.8%200%2016-7.2%2016-16v-96c0-8.8-7.2-16-16-16H656c-8.8%200-16%207.2-16%2016v22H346V320h86c8.8%200%2016-7.2%2016-16v-96c0-8.8-7.2-16-16-16H208c-8.8%200-16%207.2-16%2016v96c0%208.8%207.2%2016%2016%2016h86v378c0%2017.7%2014.3%2032%2032%2032h314v22c0%208.8%207.2%2016%2016%2016h160c8.8%200%2016-7.2%2016-16v-96c0-8.8-7.2-16-16-16H656c-8.8%200-16%207.2-16%2016v22H346V474h294v22c0%208.8%207.2%2016%2016%2016z%22%20%20%20%20p-id%3D%2233995%22%3E%3C%2Fpath%3E%3C%2Fsvg%3E";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
(global = global || self, global.fooBar = factory());
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.fooBar = factory());
}(this, (function () { 'use strict';

function index () {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('foo')) :
typeof define === 'function' && define.amd ? define(['foo'], factory) :
(global = global || self, factory(global.$));
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.$));
}(this, (function (foo) { 'use strict';

foo = foo && foo.hasOwnProperty('default') ? foo['default'] : foo;
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }

foo.bar();
var foo__default = /*#__PURE__*/_interopDefaultLegacy(foo);

foo__default['default'].bar();

})));
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
(global = global || self, global.foo = factory());
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.foo = factory());
}(this, (function () { 'use strict';

function index () {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
(global = global || self, (global.foo = global.foo || {}, global.foo.fetch = factory()));
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, (global.foo = global.foo || {}, global.foo.fetch = factory()));
}(this, (function () { 'use strict';

function fetch () {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
(global = global || self, global.foo = factory());
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.foo = factory());
}(this, (function () { 'use strict';

function index () {
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.