-
Notifications
You must be signed in to change notification settings - Fork 47.5k
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
Scaffolding for react-dom/unstable_external-server-runtime #25482
Merged
acdlite
merged 2 commits into
facebook:main
from
acdlite:scaffolding-for-fizz-external-runtime
Oct 15, 2022
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
packages/react-dom/src/server/ReactDOMServerExternalRuntime.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// TODO: Add Flow types | ||
import { | ||
clientRenderBoundary, | ||
completeBoundaryWithStyles, | ||
completeBoundary, | ||
completeSegment, | ||
} from 'react-dom-bindings/src/server/fizz-instruction-set/ReactDOMFizzInstructionSet'; | ||
|
||
// Intentionally does nothing. Implementation will be added in future PR. | ||
// eslint-disable-next-line no-unused-vars | ||
const observer = new MutationObserver(mutations => { | ||
// These are only called so I can check what the module output looks like. The | ||
// code is unreachable. | ||
clientRenderBoundary(); | ||
completeBoundaryWithStyles(); | ||
completeBoundary(); | ||
completeSegment(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -60,6 +60,7 @@ const { | |
RN_FB_DEV, | ||
RN_FB_PROD, | ||
RN_FB_PROFILING, | ||
BROWSER_SCRIPT, | ||
} = Bundles.bundleTypes; | ||
|
||
const {getFilename} = Bundles; | ||
|
@@ -93,19 +94,6 @@ const isWatchMode = argv.watch; | |
const syncFBSourcePath = argv['sync-fbsource']; | ||
const syncWWWPath = argv['sync-www']; | ||
|
||
const closureOptions = { | ||
compilation_level: 'SIMPLE', | ||
language_in: 'ECMASCRIPT_2015', | ||
language_out: 'ECMASCRIPT5_STRICT', | ||
env: 'CUSTOM', | ||
warning_level: 'QUIET', | ||
apply_input_source_maps: false, | ||
use_types_for_optimization: false, | ||
process_common_js_modules: false, | ||
rewrite_polyfills: false, | ||
inject_libraries: false, | ||
}; | ||
|
||
// Non-ES2015 stuff applied before closure compiler. | ||
const babelPlugins = [ | ||
// These plugins filter out non-ES2015. | ||
|
@@ -224,6 +212,8 @@ function getFormat(bundleType) { | |
return `cjs`; | ||
case NODE_ESM: | ||
return `es`; | ||
case BROWSER_SCRIPT: | ||
return `iife`; | ||
} | ||
} | ||
|
||
|
@@ -247,6 +237,7 @@ function isProductionBundleType(bundleType) { | |
case RN_OSS_PROFILING: | ||
case RN_FB_PROD: | ||
case RN_FB_PROFILING: | ||
case BROWSER_SCRIPT: | ||
return true; | ||
default: | ||
throw new Error(`Unknown type: ${bundleType}`); | ||
|
@@ -267,6 +258,7 @@ function isProfilingBundleType(bundleType) { | |
case RN_OSS_PROD: | ||
case UMD_DEV: | ||
case UMD_PROD: | ||
case BROWSER_SCRIPT: | ||
return false; | ||
case FB_WWW_PROFILING: | ||
case NODE_PROFILING: | ||
|
@@ -371,14 +363,24 @@ function getPlugins( | |
isUMDBundle && entry === 'react-art' && commonjs(), | ||
// Apply dead code elimination and/or minification. | ||
isProduction && | ||
closure( | ||
Object.assign({}, closureOptions, { | ||
// Don't let it create global variables in the browser. | ||
// https://github.com/facebook/react/issues/10909 | ||
assume_function_wrapper: !isUMDBundle, | ||
renaming: !shouldStayReadable, | ||
}) | ||
), | ||
closure({ | ||
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. ✅ No abstraction. |
||
compilation_level: 'SIMPLE', | ||
language_in: 'ECMASCRIPT_2015', | ||
language_out: | ||
bundleType === BROWSER_SCRIPT ? 'ECMASCRIPT5' : 'ECMASCRIPT5_STRICT', | ||
env: 'CUSTOM', | ||
warning_level: 'QUIET', | ||
apply_input_source_maps: false, | ||
use_types_for_optimization: false, | ||
process_common_js_modules: false, | ||
rewrite_polyfills: false, | ||
inject_libraries: false, | ||
|
||
// Don't let it create global variables in the browser. | ||
// https://github.com/facebook/react/issues/10909 | ||
assume_function_wrapper: !isUMDBundle, | ||
renaming: !shouldStayReadable, | ||
}), | ||
// HACK to work around the fact that Rollup isn't removing unused, pure-module imports. | ||
// Note that this plugin must be called after closure applies DCE. | ||
isProduction && stripUnusedImports(pureExternalModules), | ||
|
@@ -582,6 +584,7 @@ async function createBundle(bundle, bundleType) { | |
}, | ||
}; | ||
const mainOutputPath = Packaging.getBundleOutputPath( | ||
bundle, | ||
bundleType, | ||
filename, | ||
packageName | ||
|
@@ -724,7 +727,8 @@ async function buildEverything() { | |
[bundle, RN_OSS_PROFILING], | ||
[bundle, RN_FB_DEV], | ||
[bundle, RN_FB_PROD], | ||
[bundle, RN_FB_PROFILING] | ||
[bundle, RN_FB_PROFILING], | ||
[bundle, BROWSER_SCRIPT] | ||
); | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
🤬 Abstraction.