-
Notifications
You must be signed in to change notification settings - Fork 47.4k
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
Add IIFE bundle for SSR instruction streaming runtime #25459
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
// SSR instruction streaming runtime | ||
// will be added by https://github.com/facebook/react/pull/25437 | ||
|
||
const message = 'SSR instruction streaming runtime'; | ||
// eslint-disable-next-line react-internal/no-production-logging | ||
console.assert(false, message); |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,6 +25,10 @@ const bundleTypes = { | |
RN_FB_DEV: 'RN_FB_DEV', | ||
RN_FB_PROD: 'RN_FB_PROD', | ||
RN_FB_PROFILING: 'RN_FB_PROFILING', | ||
IIFE_DEV: 'IIFE_DEV', | ||
IIFE_PROD: 'IIFE_PROD', | ||
FB_IIFE_DEV: 'FB_IIFE_DEV', | ||
FB_IIFE_PROD: 'FB_IIFE_PROD', | ||
}; | ||
|
||
const { | ||
|
@@ -45,6 +49,10 @@ const { | |
RN_FB_DEV, | ||
RN_FB_PROD, | ||
RN_FB_PROFILING, | ||
IIFE_DEV, | ||
IIFE_PROD, | ||
FB_IIFE_DEV, | ||
FB_IIFE_PROD, | ||
} = bundleTypes; | ||
|
||
const moduleTypes = { | ||
|
@@ -330,6 +338,19 @@ const bundles = [ | |
externals: ['react', 'react-dom'], | ||
}, | ||
|
||
{ | ||
bundleTypes: __EXPERIMENTAL__ | ||
? [IIFE_DEV, IIFE_PROD, FB_IIFE_DEV, FB_IIFE_PROD] | ||
: [], | ||
moduleType: RENDERER, | ||
entry: 'react-dom/instruction-streaming-runtime', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should probably prefix this with |
||
name: 'instruction-streaming-runtime', | ||
global: 'ReactDOMInstructionStreamingRuntime', | ||
minifyWithProdErrorCodes: true, | ||
wrapWithModuleBoundaries: false, | ||
externals: [], | ||
}, | ||
|
||
/******* React DOM Fizz Static *******/ | ||
{ | ||
bundleTypes: __EXPERIMENTAL__ ? [NODE_DEV, NODE_PROD] : [], | ||
|
@@ -1006,6 +1027,8 @@ function getOriginalFilename(bundle, bundleType) { | |
return `${name}.js`; | ||
case NODE_ESM: | ||
return `${name}.js`; | ||
case IIFE_DEV: | ||
return `${name}.development.js`; | ||
case UMD_DEV: | ||
return `${name}.development.js`; | ||
case UMD_PROD: | ||
|
@@ -1018,13 +1041,17 @@ function getOriginalFilename(bundle, bundleType) { | |
return `${name}.production.min.js`; | ||
case NODE_PROFILING: | ||
return `${name}.profiling.min.js`; | ||
case IIFE_PROD: | ||
return `${name}.production.min.js`; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Similarly here, I don't think we should bother with the So let's just output the exact filename. |
||
case FB_WWW_DEV: | ||
case RN_OSS_DEV: | ||
case RN_FB_DEV: | ||
case FB_IIFE_DEV: | ||
return `${globalName}-dev.js`; | ||
case FB_WWW_PROD: | ||
case RN_OSS_PROD: | ||
case RN_FB_PROD: | ||
case FB_IIFE_PROD: | ||
return `${globalName}-prod.js`; | ||
case FB_WWW_PROFILING: | ||
case RN_FB_PROFILING: | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,6 +33,10 @@ const { | |
RN_FB_DEV, | ||
RN_FB_PROD, | ||
RN_FB_PROFILING, | ||
IIFE_DEV, | ||
IIFE_PROD, | ||
FB_IIFE_DEV, | ||
FB_IIFE_PROD, | ||
} = Bundles.bundleTypes; | ||
|
||
function getPackageName(name) { | ||
|
@@ -59,6 +63,8 @@ function getBundleOutputPath(bundleType, filename, packageName) { | |
case FB_WWW_DEV: | ||
case FB_WWW_PROD: | ||
case FB_WWW_PROFILING: | ||
case FB_IIFE_DEV: | ||
case FB_IIFE_PROD: | ||
return `build/facebook-www/${filename}`; | ||
case RN_OSS_DEV: | ||
case RN_OSS_PROD: | ||
|
@@ -88,6 +94,9 @@ function getBundleOutputPath(bundleType, filename, packageName) { | |
default: | ||
throw new Error('Unknown RN package.'); | ||
} | ||
case IIFE_DEV: | ||
case IIFE_PROD: | ||
return `build/node_modules/${packageName}/iife/${filename}`; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Similar here: let's remove the |
||
default: | ||
throw new Error('Unknown bundle type.'); | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,6 +22,10 @@ const { | |
RN_FB_DEV, | ||
RN_FB_PROD, | ||
RN_FB_PROFILING, | ||
IIFE_DEV, | ||
IIFE_PROD, | ||
FB_IIFE_DEV, | ||
FB_IIFE_PROD, | ||
} = bundleTypes; | ||
|
||
const {RECONCILER} = moduleTypes; | ||
|
@@ -294,6 +298,55 @@ ${license} | |
* ${'@gen' + 'erated'} | ||
*/ | ||
|
||
${source}`; | ||
}, | ||
|
||
[IIFE_DEV](source, globalName, filename, moduleType) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can skip this. Remember these files are going to get sent straight to the browser with no post-processing by a bundler or minifier. Don't want the extra bytes. |
||
return `/** | ||
* @license React | ||
* ${filename} | ||
* | ||
${license} | ||
*/ | ||
${source}`; | ||
}, | ||
[IIFE_PROD](source, globalName, filename, moduleType) { | ||
return `/** | ||
* @license React | ||
* ${filename} | ||
* | ||
${license} | ||
*/ | ||
${source}`; | ||
}, | ||
[FB_IIFE_DEV](source, globalName, filename, moduleType) { | ||
return `/** | ||
${license} | ||
* | ||
* @noflow | ||
* @nolint | ||
* @preventMunge | ||
* @preserve-invariant-messages | ||
*/ | ||
|
||
'use strict'; | ||
|
||
if (__DEV__) { | ||
(function() { | ||
${source} | ||
})(); | ||
}`; | ||
}, | ||
[FB_IIFE_PROD](source, globalName, filename, moduleType) { | ||
return `/** | ||
${license} | ||
* | ||
* @noflow | ||
* @nolint | ||
* @preventMunge | ||
* @preserve-invariant-messages | ||
*/ | ||
|
||
${source}`; | ||
}, | ||
}; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think it's worth having a dev build of this. It doesn't have any warnings or anything. Let's just do prod only.