@@ -42,11 +42,13 @@ const {
4242 NODE_PROFILING ,
4343 FB_WWW_DEV ,
4444 FB_WWW_PROD ,
45+ FB_WWW_PROFILING ,
4546 RN_OSS_DEV ,
4647 RN_OSS_PROD ,
4748 RN_OSS_PROFILING ,
4849 RN_FB_DEV ,
4950 RN_FB_PROD ,
51+ RN_FB_PROFILING ,
5052} = Bundles . bundleTypes ;
5153
5254const requestedBundleTypes = ( argv . type || '' )
@@ -87,6 +89,7 @@ function getBabelConfig(updateBabelOptions, bundleType, filename) {
8789 switch ( bundleType ) {
8890 case FB_WWW_DEV :
8991 case FB_WWW_PROD :
92+ case FB_WWW_PROFILING :
9093 return Object . assign ( { } , options , {
9194 plugins : options . plugins . concat ( [
9295 // Minify invariant messages
@@ -100,6 +103,7 @@ function getBabelConfig(updateBabelOptions, bundleType, filename) {
100103 case RN_OSS_PROFILING :
101104 case RN_FB_DEV :
102105 case RN_FB_PROD :
106+ case RN_FB_PROFILING :
103107 return Object . assign ( { } , options , {
104108 plugins : options . plugins . concat ( [
105109 // Wrap warning() calls in a __DEV__ check so they are stripped from production.
@@ -159,11 +163,13 @@ function getFormat(bundleType) {
159163 case NODE_PROFILING :
160164 case FB_WWW_DEV :
161165 case FB_WWW_PROD :
166+ case FB_WWW_PROFILING :
162167 case RN_OSS_DEV :
163168 case RN_OSS_PROD :
164169 case RN_OSS_PROFILING :
165170 case RN_FB_DEV :
166171 case RN_FB_PROD :
172+ case RN_FB_PROFILING :
167173 return `cjs` ;
168174 }
169175}
@@ -190,6 +196,8 @@ function getFilename(name, globalName, bundleType) {
190196 case RN_OSS_PROD :
191197 case RN_FB_PROD :
192198 return `${ globalName } -prod.js` ;
199+ case FB_WWW_PROFILING :
200+ case RN_FB_PROFILING :
193201 case RN_OSS_PROFILING :
194202 return `${ globalName } -profiling.js` ;
195203 }
@@ -207,9 +215,11 @@ function isProductionBundleType(bundleType) {
207215 case NODE_PROD :
208216 case NODE_PROFILING :
209217 case FB_WWW_PROD :
218+ case FB_WWW_PROFILING :
210219 case RN_OSS_PROD :
211220 case RN_OSS_PROFILING :
212221 case RN_FB_PROD :
222+ case RN_FB_PROFILING :
213223 return true ;
214224 default :
215225 throw new Error ( `Unknown type: ${ bundleType } ` ) ;
@@ -229,7 +239,9 @@ function isProfilingBundleType(bundleType) {
229239 case UMD_DEV :
230240 case UMD_PROD :
231241 return false ;
242+ case FB_WWW_PROFILING :
232243 case NODE_PROFILING :
244+ case RN_FB_PROFILING :
233245 case RN_OSS_PROFILING :
234246 return true ;
235247 default :
@@ -267,13 +279,17 @@ function getPlugins(
267279 const isProduction = isProductionBundleType ( bundleType ) ;
268280 const isProfiling = isProfilingBundleType ( bundleType ) ;
269281 const isUMDBundle = bundleType === UMD_DEV || bundleType === UMD_PROD ;
270- const isFBBundle = bundleType === FB_WWW_DEV || bundleType === FB_WWW_PROD ;
282+ const isFBBundle =
283+ bundleType === FB_WWW_DEV ||
284+ bundleType === FB_WWW_PROD ||
285+ bundleType === FB_WWW_PROFILING ;
271286 const isRNBundle =
272287 bundleType === RN_OSS_DEV ||
273288 bundleType === RN_OSS_PROD ||
274289 bundleType === RN_OSS_PROFILING ||
275290 bundleType === RN_FB_DEV ||
276- bundleType === RN_FB_PROD ;
291+ bundleType === RN_FB_PROD ||
292+ bundleType === RN_FB_PROFILING ;
277293 const shouldStayReadable = isFBBundle || isRNBundle || forcePrettyOutput ;
278294 return [
279295 // Extract error codes from invariant() messages into a file.
@@ -404,7 +420,11 @@ async function createBundle(bundle, bundleType) {
404420 const packageName = Packaging . getPackageName ( bundle . entry ) ;
405421
406422 let resolvedEntry = require . resolve ( bundle . entry ) ;
407- if ( bundleType === FB_WWW_DEV || bundleType === FB_WWW_PROD ) {
423+ if (
424+ bundleType === FB_WWW_DEV ||
425+ bundleType === FB_WWW_PROD ||
426+ bundleType === FB_WWW_PROFILING
427+ ) {
408428 const resolvedFBEntry = resolvedEntry . replace ( '.js' , '.fb.js' ) ;
409429 if ( fs . existsSync ( resolvedFBEntry ) ) {
410430 resolvedEntry = resolvedFBEntry ;
@@ -451,7 +471,10 @@ async function createBundle(bundle, bundleType) {
451471 bundle . modulesToStub
452472 ) ,
453473 // We can't use getters in www.
454- legacy : bundleType === FB_WWW_DEV || bundleType === FB_WWW_PROD ,
474+ legacy :
475+ bundleType === FB_WWW_DEV ||
476+ bundleType === FB_WWW_PROD ||
477+ bundleType === FB_WWW_PROFILING ,
455478 } ;
456479 const [ mainOutputPath , ...otherOutputPaths ] = Packaging . getBundleOutputPaths (
457480 bundleType ,
@@ -563,11 +586,13 @@ async function buildEverything() {
563586 await createBundle ( bundle , NODE_PROFILING ) ;
564587 await createBundle ( bundle , FB_WWW_DEV ) ;
565588 await createBundle ( bundle , FB_WWW_PROD ) ;
589+ await createBundle ( bundle , FB_WWW_PROFILING ) ;
566590 await createBundle ( bundle , RN_OSS_DEV ) ;
567591 await createBundle ( bundle , RN_OSS_PROD ) ;
568592 await createBundle ( bundle , RN_OSS_PROFILING ) ;
569593 await createBundle ( bundle , RN_FB_DEV ) ;
570594 await createBundle ( bundle , RN_FB_PROD ) ;
595+ await createBundle ( bundle , RN_FB_PROFILING ) ;
571596 }
572597
573598 await Packaging . copyAllShims ( ) ;
0 commit comments