@samitouri / QOS-React / commits / e97143cca5

Use Closure Compiler for UMD/Node bundles instead of Uglify (#10236)

* Use GCC instead of Uglify for UMD/NODE bundles * Prettier run * Fixes fixtures that were alterated by Pretter and trailing function commas * prettier on prettier * updated prettier config * altered prettier config slightly * Reverted prettier changes * updated results.json

Dominic Gannaway committed Aug 10, 2017 at 11:12 UTC e97143cca5c7e6451013084082dd63f897a44c12
4 files changed +186 -67
package.json
+1
@@ -76,6 +76,7 @@
76 "rollup": "^0.41.6",
77 "rollup-plugin-alias": "^1.2.1",
78 "rollup-plugin-babel": "^2.7.1",
79 + "rollup-plugin-closure-compiler-js": "^1.0.4",
80 "rollup-plugin-commonjs": "^8.0.2",
81 "rollup-plugin-inject": "^2.0.0",
82 "rollup-plugin-node-resolve": "^2.0.0",
scripts/rollup/build.js
+18
@@ -21,6 +21,7 @@ const Stats = require('./stats');
21 const syncReactNative = require('./sync').syncReactNative;
22 const Packaging = require('./packaging');
23 const Header = require('./header');
24 +const closure = require('rollup-plugin-closure-compiler-js');
25
26 const UMD_DEV = Bundles.bundleTypes.UMD_DEV;
27 const UMD_PROD = Bundles.bundleTypes.UMD_PROD;
@@ -333,6 +334,23 @@ function getPlugins(
334 break;
335 case UMD_PROD:
336 case NODE_PROD:
337 + plugins.push(
338 + replace(stripEnvVariables(true)),
339 + // needs to happen after strip env
340 + commonjs(getCommonJsConfig(bundleType)),
341 + closure({
342 + compilationLevel: 'SIMPLE',
343 + languageIn: 'ES5',
344 + languageOut: 'ES5',
345 + env: 'CUSTOM',
346 + warningLevel: 'QUIET',
347 + assumeFunctionWrapper: true,
348 + applyInputSourceMaps: false,
349 + useTypesForOptimization: false,
350 + processCommonJsModules: false,
351 + })
352 + );
353 + break;
354 case FB_PROD:
355 plugins.push(
356 replace(stripEnvVariables(true)),
scripts/rollup/results.json
+86 -62
@@ -1,52 +1,52 @@
1 {
2 "bundleSizes": {
3 "react.development.js (UMD_DEV)": {
4 - "size": 65980,
5 - "gzip": 16788
4 + "size": 65928,
5 + "gzip": 16792
6 },
7 "react.production.min.js (UMD_PROD)": {
8 - "size": 6734,
9 - "gzip": 2757
8 + "size": 6361,
9 + "gzip": 2599
10 },
11 "react.development.js (NODE_DEV)": {
12 - "size": 56302,
13 - "gzip": 14443
12 + "size": 56228,
13 + "gzip": 14438
14 },
15 "react.production.min.js (NODE_PROD)": {
16 - "size": 5596,
17 - "gzip": 2332
16 + "size": 5384,
17 + "gzip": 2231
18 },
19 "React-dev.js (FB_DEV)": {
20 - "size": 53503,
21 - "gzip": 13660
20 + "size": 53485,
21 + "gzip": 13653
22 },
23 "React-prod.js (FB_PROD)": {
24 - "size": 25014,
25 - "gzip": 6703
24 + "size": 25016,
25 + "gzip": 6705
26 },
27 "react-dom.development.js (UMD_DEV)": {
28 - "size": 634292,
29 - "gzip": 144575
28 + "size": 624336,
29 + "gzip": 142708
30 },
31 "react-dom.production.min.js (UMD_PROD)": {
32 - "size": 119041,
33 - "gzip": 37995
32 + "size": 114616,
33 + "gzip": 35769
34 },
35 "react-dom.development.js (NODE_DEV)": {
36 - "size": 593703,
37 - "gzip": 134999
36 + "size": 583734,
37 + "gzip": 133055
38 },
39 "react-dom.production.min.js (NODE_PROD)": {
40 - "size": 116323,
41 - "gzip": 37033
40 + "size": 118288,
41 + "gzip": 37153
42 },
43 "ReactDOMFiber-dev.js (FB_DEV)": {
44 - "size": 590523,
45 - "gzip": 134461
44 + "size": 583017,
45 + "gzip": 133083
46 },
47 "ReactDOMFiber-prod.js (FB_PROD)": {
48 - "size": 423907,
49 - "gzip": 94912
48 + "size": 426172,
49 + "gzip": 96450
50 },
51 "react-dom-test-utils.development.js (NODE_DEV)": {
52 "size": 53332,
@@ -57,28 +57,28 @@
57 "gzip": 13357
58 },
59 "react-dom-unstable-native-dependencies.development.js (UMD_DEV)": {
60 - "size": 88275,
61 - "gzip": 22341
60 + "size": 84047,
61 + "gzip": 21057
62 },
63 "react-dom-unstable-native-dependencies.production.min.js (UMD_PROD)": {
64 - "size": 17748,
65 - "gzip": 5783
64 + "size": 15672,
65 + "gzip": 5027
66 },
67 "react-dom-unstable-native-dependencies.development.js (NODE_DEV)": {
68 - "size": 81723,
69 - "gzip": 20379
68 + "size": 77475,
69 + "gzip": 19101
70 },
71 "react-dom-unstable-native-dependencies.production.min.js (NODE_PROD)": {
72 - "size": 16380,
73 - "gzip": 5252
72 + "size": 14133,
73 + "gzip": 4451
74 },
75 "ReactDOMUnstableNativeDependencies-dev.js (FB_DEV)": {
76 - "size": 81422,
77 - "gzip": 20340
76 + "size": 77189,
77 + "gzip": 19061
78 },
79 "ReactDOMUnstableNativeDependencies-prod.js (FB_PROD)": {
80 - "size": 66066,
81 - "gzip": 15736
80 + "size": 65908,
81 + "gzip": 15704
82 },
83 "react-dom-server.browser.development.js (UMD_DEV)": {
84 "size": 122873,
@@ -97,12 +97,12 @@
97 "gzip": 7604
98 },
99 "ReactDOMServer-dev.js (FB_DEV)": {
100 - "size": 91242,
101 - "gzip": 23555
100 + "size": 89559,
101 + "gzip": 23201
102 },
103 "ReactDOMServer-prod.js (FB_PROD)": {
104 - "size": 49636,
105 - "gzip": 13862
104 + "size": 49640,
105 + "gzip": 13644
106 },
107 "react-dom-server.node.development.js (NODE_DEV)": {
108 "size": 94782,
@@ -113,28 +113,28 @@
113 "gzip": 7964
114 },
115 "react-art.development.js (UMD_DEV)": {
116 - "size": 373518,
117 - "gzip": 82706
116 + "size": 363064,
117 + "gzip": 80610
118 },
119 "react-art.production.min.js (UMD_PROD)": {
120 - "size": 93115,
121 - "gzip": 28802
120 + "size": 88702,
121 + "gzip": 27224
122 },
123 "react-art.development.js (NODE_DEV)": {
124 - "size": 294907,
125 - "gzip": 62698
124 + "size": 284435,
125 + "gzip": 60532
126 },
127 "react-art.production.min.js (NODE_PROD)": {
128 - "size": 55055,
129 - "gzip": 16989
128 + "size": 57226,
129 + "gzip": 17683
130 },
131 "ReactARTFiber-dev.js (FB_DEV)": {
132 - "size": 293848,
133 - "gzip": 62755
132 + "size": 283868,
133 + "gzip": 60453
134 },
135 "ReactARTFiber-prod.js (FB_PROD)": {
136 - "size": 219245,
137 - "gzip": 45443
136 + "size": 217459,
137 + "gzip": 45301
138 },
139 "ReactNativeStack-dev.js (RN_DEV)": {
140 "size": 201024,
@@ -145,20 +145,20 @@
145 "gzip": 26481
146 },
147 "ReactNativeFiber-dev.js (RN_DEV)": {
148 - "size": 306175,
149 - "gzip": 53018
148 + "size": 284667,
149 + "gzip": 51712
150 },
151 "ReactNativeFiber-prod.js (RN_PROD)": {
152 - "size": 222113,
153 - "gzip": 38548
152 + "size": 220270,
153 + "gzip": 38503
154 },
155 "react-test-renderer.development.js (NODE_DEV)": {
156 - "size": 299343,
157 - "gzip": 63142
156 + "size": 281620,
157 + "gzip": 59461
158 },
159 "ReactTestRendererFiber-dev.js (FB_DEV)": {
160 - "size": 298269,
161 - "gzip": 63216
160 + "size": 281044,
161 + "gzip": 59382
162 },
163 "react-test-renderer-shallow.development.js (NODE_DEV)": {
164 "size": 9556,
@@ -169,8 +169,32 @@
169 "gzip": 2338
170 },
171 "react-noop-renderer.development.js (NODE_DEV)": {
172 - "size": 286618,
173 - "gzip": 60007
172 + "size": 275726,
173 + "gzip": 57882
174 + },
175 + "react-dom-server.development.js (UMD_DEV)": {
176 + "size": 120897,
177 + "gzip": 30672
178 + },
179 + "react-dom-server.production.min.js (UMD_PROD)": {
180 + "size": 20136,
181 + "gzip": 7672
182 + },
183 + "react-dom-server.development.js (NODE_DEV)": {
184 + "size": 90047,
185 + "gzip": 23257
186 + },
187 + "react-dom-server.production.min.js (NODE_PROD)": {
188 + "size": 18718,
189 + "gzip": 7197
190 + },
191 + "react-dom-node-stream.development.js (NODE_DEV)": {
192 + "size": 91741,
193 + "gzip": 23757
194 + },
195 + "react-dom-node-stream.production.min.js (NODE_PROD)": {
196 + "size": 19585,
197 + "gzip": 7520
198 }
199 }
200 }
\ No newline at end of file
yarn.lock
+81 -5
@@ -1096,14 +1096,34 @@ cliui@^3.2.0:
1096 strip-ansi "^3.0.1"
1097 wrap-ansi "^2.0.0"
1098
1099 +clone-buffer@^1.0.0:
1100 + version "1.0.0"
1101 + resolved "https://registry.yarnpkg.com/clone-buffer/-/clone-buffer-1.0.0.tgz#e3e25b207ac4e701af721e2cb5a16792cac3dc58"
1102 +
1103 clone-stats@^0.0.1:
1104 version "0.0.1"
1105 resolved "https://registry.yarnpkg.com/clone-stats/-/clone-stats-0.0.1.tgz#b88f94a82cf38b8791d58046ea4029ad88ca99d1"
1106
1107 +clone-stats@^1.0.0:
1108 + version "1.0.0"
1109 + resolved "https://registry.yarnpkg.com/clone-stats/-/clone-stats-1.0.0.tgz#b3782dff8bb5474e18b9b6bf0fdfe782f8777680"
1110 +
1111 clone@^1.0.0:
1112 version "1.0.2"
1113 resolved "https://registry.yarnpkg.com/clone/-/clone-1.0.2.tgz#260b7a99ebb1edfe247538175f783243cb19d149"
1114
1115 +clone@^2.1.1:
1116 + version "2.1.1"
1117 + resolved "https://registry.yarnpkg.com/clone/-/clone-2.1.1.tgz#d217d1e961118e3ac9a4b8bba3285553bf647cdb"
1118 +
1119 +cloneable-readable@^1.0.0:
1120 + version "1.0.0"
1121 + resolved "https://registry.yarnpkg.com/cloneable-readable/-/cloneable-readable-1.0.0.tgz#a6290d413f217a61232f95e458ff38418cfb0117"
1122 + dependencies:
1123 + inherits "^2.0.1"
1124 + process-nextick-args "^1.0.6"
1125 + through2 "^2.0.1"
1126 +
1127 co@^4.6.0:
1128 version "4.6.0"
1129 resolved "https://registry.yarnpkg.com/co/-/co-4.6.0.tgz#6ea6bdf3d853ae54ccb8e47bfa0bf3f9031fb184"
@@ -2050,7 +2070,31 @@ glogg@^1.0.0:
2070 dependencies:
2071 sparkles "^1.0.0"
2072
2053 -graceful-fs@^4.1.11, graceful-fs@^4.1.2, graceful-fs@^4.1.4:
2073 +google-closure-compiler-js@>20170000:
2074 + version "20170626.0.0"
2075 + resolved "https://registry.yarnpkg.com/google-closure-compiler-js/-/google-closure-compiler-js-20170626.0.0.tgz#5df265b277d1ec6fdea12eed131d1491cd8a8d71"
2076 + dependencies:
2077 + minimist "^1.2.0"
2078 + vinyl "^2.0.1"
2079 + webpack-core "^0.6.8"
2080 +
2081 +got@^6.7.1:
2082 + version "6.7.1"
2083 + resolved "https://registry.yarnpkg.com/got/-/got-6.7.1.tgz#240cd05785a9a18e561dc1b44b41c763ef1e8db0"
2084 + dependencies:
2085 + create-error-class "^3.0.0"
2086 + duplexer3 "^0.1.4"
2087 + get-stream "^3.0.0"
2088 + is-redirect "^1.0.0"
2089 + is-retry-allowed "^1.0.0"
2090 + is-stream "^1.0.0"
2091 + lowercase-keys "^1.0.0"
2092 + safe-buffer "^5.0.1"
2093 + timed-out "^4.0.0"
2094 + unzip-response "^2.0.1"
2095 + url-parse-lax "^1.0.0"
2096 +
2097 +graceful-fs@^4.1.11, graceful-fs@^4.1.2, graceful-fs@^4.1.4, graceful-fs@^4.1.6, graceful-fs@^4.1.9:
2098 version "4.1.11"
2099 resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.1.11.tgz#0e8bdfe4d1ddb8854d64e04ea7c00e2a026e5658"
2100
@@ -3533,7 +3577,7 @@ private@^0.1.6, private@~0.1.5:
3577 version "0.1.7"
3578 resolved "https://registry.yarnpkg.com/private/-/private-0.1.7.tgz#68ce5e8a1ef0a23bb570cc28537b5332aba63ef1"
3579
3536 -process-nextick-args@~1.0.6:
3580 +process-nextick-args@^1.0.6, process-nextick-args@~1.0.6:
3581 version "1.0.7"
3582 resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-1.0.7.tgz#150e20b756590ad3f91093f25a4f2ad8bff30ba3"
3583
@@ -3770,7 +3814,11 @@ replace-ext@0.0.1:
3814 version "0.0.1"
3815 resolved "https://registry.yarnpkg.com/replace-ext/-/replace-ext-0.0.1.tgz#29bbd92078a739f0bcce2b4ee41e837953522924"
3816
3773 -request@2.79.0:
3817 +replace-ext@^1.0.0:
3818 + version "1.0.0"
3819 + resolved "https://registry.yarnpkg.com/replace-ext/-/replace-ext-1.0.0.tgz#de63128373fcbf7c3ccfa4de5a480c45a67958eb"
3820 +
3821 +request@2, request@2.79.0:
3822 version "2.79.0"
3823 resolved "https://registry.yarnpkg.com/request/-/request-2.79.0.tgz#4dfe5bf6be8b8cdc37fcf93e04b65577722710de"
3824 dependencies:
@@ -3885,6 +3933,12 @@ rollup-plugin-babel@^2.7.1:
3933 object-assign "^4.1.0"
3934 rollup-pluginutils "^1.5.0"
3935
3936 +rollup-plugin-closure-compiler-js@^1.0.4:
3937 + version "1.0.4"
3938 + resolved "https://registry.yarnpkg.com/rollup-plugin-closure-compiler-js/-/rollup-plugin-closure-compiler-js-1.0.4.tgz#431ff09e13d0f6f6a1ce5ef0e454edcef50b9d00"
3939 + dependencies:
3940 + google-closure-compiler-js ">20170000"
3941 +
3942 rollup-plugin-commonjs@^8.0.2:
3943 version "8.0.2"
3944 resolved "https://registry.yarnpkg.com/rollup-plugin-commonjs/-/rollup-plugin-commonjs-8.0.2.tgz#98b1589bfe32a6c0f67790b60c0b499972afed89"
@@ -4043,6 +4097,10 @@ sntp@1.x.x:
4097 dependencies:
4098 hoek "2.x.x"
4099
4100 +source-list-map@~0.1.7:
4101 + version "0.1.8"
4102 + resolved "https://registry.yarnpkg.com/source-list-map/-/source-list-map-0.1.8.tgz#c550b2ab5427f6b3f21f5afead88c4f5587b2106"
4103 +
4104 source-map-support@^0.2.10:
4105 version "0.2.10"
4106 resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.2.10.tgz#ea5a3900a1c1cb25096a0ae8cc5c2b4b10ded3dc"
@@ -4061,7 +4119,7 @@ source-map@0.1.32:
4119 dependencies:
4120 amdefine ">=0.0.4"
4121
4064 -source-map@^0.4.4, source-map@~0.4.0, source-map@~0.4.2:
4122 +source-map@^0.4.4, source-map@~0.4.0, source-map@~0.4.1, source-map@~0.4.2:
4123 version "0.4.4"
4124 resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.4.4.tgz#eba4f5da9c0dc999de68032d8b4f76173652036b"
4125 dependencies:
@@ -4286,7 +4344,7 @@ through2@^1.0.0:
4344 readable-stream ">=1.1.13-1 <1.2.0-0"
4345 xtend ">=4.0.0 <4.1.0-0"
4346
4289 -through2@^2.0.0, through2@~2.0.0:
4347 +through2@^2.0.0, through2@^2.0.1, through2@~2.0.0:
4348 version "2.0.3"
4349 resolved "https://registry.yarnpkg.com/through2/-/through2-2.0.3.tgz#0004569b37c7c74ba39c43f3ced78d1ad94140be"
4350 dependencies:
@@ -4454,6 +4512,17 @@ vinyl@^0.5.0:
4512 clone-stats "^0.0.1"
4513 replace-ext "0.0.1"
4514
4515 +vinyl@^2.0.1:
4516 + version "2.1.0"
4517 + resolved "https://registry.yarnpkg.com/vinyl/-/vinyl-2.1.0.tgz#021f9c2cf951d6b939943c89eb5ee5add4fd924c"
4518 + dependencies:
4519 + clone "^2.1.1"
4520 + clone-buffer "^1.0.0"
4521 + clone-stats "^1.0.0"
4522 + cloneable-readable "^1.0.0"
4523 + remove-trailing-separator "^1.0.1"
4524 + replace-ext "^1.0.0"
4525 +
4526 vlq@^0.2.1:
4527 version "0.2.2"
4528 resolved "https://registry.yarnpkg.com/vlq/-/vlq-0.2.2.tgz#e316d5257b40b86bb43cb8d5fea5d7f54d6b0ca1"
@@ -4476,6 +4545,13 @@ webidl-conversions@^4.0.0:
4545 version "4.0.1"
4546 resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-4.0.1.tgz#8015a17ab83e7e1b311638486ace81da6ce206a0"
4547
4548 +webpack-core@^0.6.8:
4549 + version "0.6.9"
4550 + resolved "https://registry.yarnpkg.com/webpack-core/-/webpack-core-0.6.9.tgz#fc571588c8558da77be9efb6debdc5a3b172bdc2"
4551 + dependencies:
4552 + source-list-map "~0.1.7"
4553 + source-map "~0.4.1"
4554 +
4555 whatwg-encoding@^1.0.1:
4556 version "1.0.1"
4557 resolved "https://registry.yarnpkg.com/whatwg-encoding/-/whatwg-encoding-1.0.1.tgz#3c6c451a198ee7aec55b1ec61d0920c67801a5f4"