Update Rollup (#11427)

* Update Rollup

* Strip "use strict" in individual modules

* Record sizes
This commit is contained in:
Dan Abramov 2017-11-02 16:56:12 +00:00 committed by GitHub
parent f302a6a334
commit fbf617a263
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 120 additions and 96 deletions

View File

@ -76,11 +76,11 @@
"prettier": "1.2.2",
"prop-types": "^15.6.0",
"rimraf": "^2.6.1",
"rollup": "^0.41.6",
"rollup": "^0.49.3",
"rollup-plugin-alias": "^1.2.1",
"rollup-plugin-babel": "^2.7.1",
"rollup-plugin-closure-compiler-js": "^1.0.4",
"rollup-plugin-commonjs": "^8.0.2",
"rollup-plugin-commonjs": "^8.2.6",
"rollup-plugin-inject": "^2.0.0",
"rollup-plugin-node-resolve": "^2.0.0",
"rollup-plugin-replace": "^1.1.1",

View File

@ -237,7 +237,7 @@ function getRollupOutputOptions(
{
banner: getBanner(bundleType, globalName, filename, moduleType),
destDir: 'build/',
dest: 'build/' +
file: 'build/' +
Packaging.getOutputPathRelativeToBuildFolder(
bundleType,
filename,
@ -247,8 +247,8 @@ function getRollupOutputOptions(
format,
globals,
interop: false,
moduleName: globalName,
sourceMap: false,
name: globalName,
sourcemap: false,
}
);
}
@ -372,6 +372,17 @@ function rewriteFBReactImport() {
};
}
// Strip 'use strict' directives in individual modules
// because we always emit them in the file headers.
// The whole bundle is strict.
function stripUseStrict() {
return {
transform(source) {
return source.replace(/['"]use strict['"']/g, '');
},
};
}
// Plugin that writes to the error code file so that by the time it is picked
// up by Babel, the errors are already extracted.
function writeErrorCodes() {
@ -403,6 +414,7 @@ function getPlugins(
skip: externals,
}),
babel(getBabelConfig(updateBabelOptions, bundleType)),
stripUseStrict(),
].filter(Boolean);
const headerSanityCheck = getHeaderSanityCheck(bundleType, globalName);
@ -535,7 +547,7 @@ function createBundle(bundle, bundleType) {
console.log(`${chalk.bgYellow.black(' BUILDING ')} ${logKey}`);
return rollup({
entry: resolvedEntry,
input: resolvedEntry,
external(id) {
const containsThisModule = pkg => id === pkg || id.startsWith(pkg + '/');
const isProvidedByDependency = externals.some(containsThisModule);

View File

@ -1,208 +1,208 @@
{
"bundleSizes": {
"react.development.js (UMD_DEV)": {
"size": 57801,
"gzip": 15092
"size": 60014,
"gzip": 15266
},
"react.production.min.js (UMD_PROD)": {
"size": 6833,
"gzip": 2793
},
"react.development.js (NODE_DEV)": {
"size": 48705,
"gzip": 12829
"size": 50504,
"gzip": 12978
},
"react.production.min.js (NODE_PROD)": {
"size": 5810,
"gzip": 2397
},
"React-dev.js (FB_DEV)": {
"size": 45559,
"gzip": 11962
"size": 47342,
"gzip": 12109
},
"React-prod.js (FB_PROD)": {
"size": 25284,
"gzip": 6818
"size": 25195,
"gzip": 6775
},
"react-dom.development.js (UMD_DEV)": {
"size": 609859,
"gzip": 139935
"size": 627487,
"gzip": 140353
},
"react-dom.production.min.js (UMD_PROD)": {
"size": 103841,
"gzip": 32439
},
"react-dom.development.js (NODE_DEV)": {
"size": 592196,
"gzip": 135632
"size": 609023,
"gzip": 135899
},
"react-dom.production.min.js (NODE_PROD)": {
"size": 107507,
"gzip": 33239
},
"ReactDOM-dev.js (FB_DEV)": {
"size": 592099,
"gzip": 135900
"size": 609049,
"gzip": 136235
},
"ReactDOM-prod.js (FB_PROD)": {
"size": 421332,
"gzip": 93627
"size": 422543,
"gzip": 93634
},
"react-dom-test-utils.development.js (NODE_DEV)": {
"size": 41544,
"gzip": 11072
"size": 42927,
"gzip": 11123
},
"react-dom-test-utils.production.min.js (NODE_PROD)": {
"size": 11600,
"gzip": 4242
},
"ReactTestUtils-dev.js (FB_DEV)": {
"size": 41162,
"gzip": 11036
"size": 42537,
"gzip": 11084
},
"react-dom-unstable-native-dependencies.development.js (UMD_DEV)": {
"size": 84853,
"gzip": 21148
"size": 87597,
"gzip": 21191
},
"react-dom-unstable-native-dependencies.production.min.js (UMD_PROD)": {
"size": 14441,
"gzip": 4652
},
"react-dom-unstable-native-dependencies.development.js (NODE_DEV)": {
"size": 80634,
"gzip": 19920
"size": 83185,
"gzip": 19958
},
"react-dom-unstable-native-dependencies.production.min.js (NODE_PROD)": {
"size": 14002,
"gzip": 4509
},
"ReactDOMUnstableNativeDependencies-dev.js (FB_DEV)": {
"size": 80127,
"gzip": 19865
"size": 82662,
"gzip": 19896
},
"ReactDOMUnstableNativeDependencies-prod.js (FB_PROD)": {
"size": 65135,
"gzip": 15542
"size": 65698,
"gzip": 15563
},
"react-dom-server.browser.development.js (UMD_DEV)": {
"size": 106084,
"gzip": 27905
"size": 110696,
"gzip": 28081
},
"react-dom-server.browser.production.min.js (UMD_PROD)": {
"size": 15612,
"gzip": 6067
},
"react-dom-server.browser.development.js (NODE_DEV)": {
"size": 96070,
"gzip": 25231
"size": 99885,
"gzip": 25360
},
"react-dom-server.browser.production.min.js (NODE_PROD)": {
"size": 15340,
"gzip": 5985
},
"ReactDOMServer-dev.js (FB_DEV)": {
"size": 95546,
"gzip": 25176
"size": 99347,
"gzip": 25283
},
"ReactDOMServer-prod.js (FB_PROD)": {
"size": 43775,
"gzip": 12037
"size": 44385,
"gzip": 12018
},
"react-dom-server.node.development.js (NODE_DEV)": {
"size": 98343,
"gzip": 25770
"size": 102342,
"gzip": 25902
},
"react-dom-server.node.production.min.js (NODE_PROD)": {
"size": 16264,
"gzip": 6314
},
"react-art.development.js (UMD_DEV)": {
"size": 375506,
"gzip": 82485
"size": 380741,
"gzip": 82697
},
"react-art.production.min.js (UMD_PROD)": {
"size": 85627,
"gzip": 26501
},
"react-art.development.js (NODE_DEV)": {
"size": 301272,
"gzip": 63673
"size": 306108,
"gzip": 63796
},
"react-art.production.min.js (NODE_PROD)": {
"size": 54751,
"gzip": 17093
},
"ReactART-dev.js (FB_DEV)": {
"size": 299806,
"gzip": 63594
"size": 304608,
"gzip": 63722
},
"ReactART-prod.js (FB_PROD)": {
"size": 223978,
"gzip": 46106
"size": 223549,
"gzip": 46009
},
"ReactNativeRenderer-dev.js (RN_DEV)": {
"size": 288447,
"gzip": 49547
"size": 288535,
"gzip": 49541
},
"ReactNativeRenderer-prod.js (RN_PROD)": {
"size": 224942,
"gzip": 38550
"size": 224626,
"gzip": 38486
},
"ReactRTRenderer-dev.js (RN_DEV)": {
"size": 219451,
"gzip": 37090
"size": 219434,
"gzip": 37080
},
"ReactRTRenderer-prod.js (RN_PROD)": {
"size": 165813,
"gzip": 27635
"size": 165404,
"gzip": 27562
},
"ReactCSRenderer-dev.js (RN_DEV)": {
"size": 205992,
"gzip": 34497
"size": 205961,
"gzip": 34476
},
"ReactCSRenderer-prod.js (RN_PROD)": {
"size": 153977,
"gzip": 25225
"size": 153554,
"gzip": 25147
},
"react-test-renderer.development.js (NODE_DEV)": {
"size": 305130,
"gzip": 64110
"size": 310373,
"gzip": 64233
},
"react-test-renderer.production.min.js (NODE_PROD)": {
"size": 56345,
"gzip": 17428
},
"ReactTestRenderer-dev.js (FB_DEV)": {
"size": 303654,
"gzip": 64031
"size": 308861,
"gzip": 64158
},
"react-test-renderer-shallow.development.js (NODE_DEV)": {
"size": 9246,
"gzip": 2306
"size": 9638,
"gzip": 2313
},
"react-test-renderer-shallow.production.min.js (NODE_PROD)": {
"size": 4634,
"gzip": 1667
},
"ReactShallowRenderer-dev.js (FB_DEV)": {
"size": 8958,
"gzip": 2250
"size": 9344,
"gzip": 2258
},
"react-noop-renderer.development.js (NODE_DEV)": {
"size": 294464,
"gzip": 61371
"size": 299390,
"gzip": 61718
},
"react-reconciler.development.js (NODE_DEV)": {
"size": 280011,
"gzip": 58128
"size": 284277,
"gzip": 58250
},
"react-reconciler.production.min.js (NODE_PROD)": {
"size": 41103,
"gzip": 12766
},
"react-call-return.development.js (NODE_DEV)": {
"size": 2700,
"gzip": 937
"size": 2915,
"gzip": 944
},
"react-call-return.production.min.js (NODE_PROD)": {
"size": 845,

View File

@ -37,7 +37,7 @@ acorn@^3.0.4:
version "3.3.0"
resolved "https://registry.yarnpkg.com/acorn/-/acorn-3.3.0.tgz#45e37fb39e8da3f25baee3ff5369e2bb5f22017a"
acorn@^4.0.1, acorn@^4.0.3, acorn@^4.0.4:
acorn@^4.0.3, acorn@^4.0.4:
version "4.0.11"
resolved "https://registry.yarnpkg.com/acorn/-/acorn-4.0.11.tgz#edcda3bd937e7556410d42ed5860f67399c794c0"
@ -45,6 +45,10 @@ acorn@^5.0.1:
version "5.0.3"
resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.0.3.tgz#c460df08491463f028ccb82eab3730bf01087b3d"
acorn@^5.2.1:
version "5.2.1"
resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.2.1.tgz#317ac7821826c22c702d66189ab8359675f135d7"
ajv-keywords@^1.0.0:
version "1.5.1"
resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-1.5.1.tgz#314dd0a4b3368fad3dfcdc54ede6171b886daf3c"
@ -1732,6 +1736,10 @@ estree-walker@^0.3.0:
version "0.3.1"
resolved "https://registry.yarnpkg.com/estree-walker/-/estree-walker-0.3.1.tgz#e6b1a51cf7292524e7237c312e5fe6660c1ce1aa"
estree-walker@^0.5.0:
version "0.5.0"
resolved "https://registry.yarnpkg.com/estree-walker/-/estree-walker-0.5.0.tgz#aae3b57c42deb8010e349c892462f0e71c5dd1aa"
esutils@2.0.2, esutils@^2.0.0, esutils@^2.0.2:
version "2.0.2"
resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.2.tgz#0abf4f1caa5bcb1f7a9d8acc6dea4faaa04bac9b"
@ -3246,9 +3254,9 @@ magic-string@^0.16.0:
dependencies:
vlq "^0.2.1"
magic-string@^0.19.0:
version "0.19.0"
resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.19.0.tgz#198948217254e3e0b93080e01146b7c73b2a06b2"
magic-string@^0.22.4:
version "0.22.4"
resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.22.4.tgz#31039b4e40366395618c1d6cf8193c53917475ff"
dependencies:
vlq "^0.2.1"
@ -4062,12 +4070,18 @@ resolve@1.1.7:
version "1.1.7"
resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.1.7.tgz#203114d82ad2c5ed9e8e0411b3932875e889e97b"
resolve@^1.1.6, resolve@^1.1.7:
resolve@^1.1.6:
version "1.3.3"
resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.3.3.tgz#655907c3469a8680dc2de3a275a8fdd69691f0e5"
dependencies:
path-parse "^1.0.5"
resolve@^1.4.0:
version "1.5.0"
resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.5.0.tgz#1f09acce796c9a762579f31b2c1cc4c3cddf9f36"
dependencies:
path-parse "^1.0.5"
restore-cursor@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/restore-cursor/-/restore-cursor-1.0.1.tgz#34661f46886327fed2991479152252df92daa541"
@ -4114,14 +4128,14 @@ rollup-plugin-closure-compiler-js@^1.0.4:
dependencies:
google-closure-compiler-js ">20170000"
rollup-plugin-commonjs@^8.0.2:
version "8.0.2"
resolved "https://registry.yarnpkg.com/rollup-plugin-commonjs/-/rollup-plugin-commonjs-8.0.2.tgz#98b1589bfe32a6c0f67790b60c0b499972afed89"
rollup-plugin-commonjs@^8.2.6:
version "8.2.6"
resolved "https://registry.yarnpkg.com/rollup-plugin-commonjs/-/rollup-plugin-commonjs-8.2.6.tgz#27e5b9069ff94005bb01e01bb46a1e4873784677"
dependencies:
acorn "^4.0.1"
estree-walker "^0.3.0"
magic-string "^0.19.0"
resolve "^1.1.7"
acorn "^5.2.1"
estree-walker "^0.5.0"
magic-string "^0.22.4"
resolve "^1.4.0"
rollup-pluginutils "^2.0.1"
rollup-plugin-inject@^2.0.0:
@ -4169,11 +4183,9 @@ rollup-pluginutils@^2.0.1:
estree-walker "^0.3.0"
micromatch "^2.3.11"
rollup@^0.41.6:
version "0.41.6"
resolved "https://registry.yarnpkg.com/rollup/-/rollup-0.41.6.tgz#e0d05497877a398c104d816d2733a718a7a94e2a"
dependencies:
source-map-support "^0.4.0"
rollup@^0.49.3:
version "0.49.3"
resolved "https://registry.yarnpkg.com/rollup/-/rollup-0.49.3.tgz#4cce32643dd8cf2154c69ff0e43470067db0adbf"
run-async@^0.1.0:
version "0.1.0"
@ -4288,7 +4300,7 @@ source-map-support@^0.2.10:
dependencies:
source-map "0.1.32"
source-map-support@^0.4.0, source-map-support@^0.4.2:
source-map-support@^0.4.2:
version "0.4.14"
resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.4.14.tgz#9d4463772598b86271b4f523f6c1f4e02a7d6aef"
dependencies: