resolveEntryFork() — react Function Reference
Architecture documentation for the resolveEntryFork() function in setupHostConfigs.js from the react codebase.
Entity Profile
Dependency Diagram
graph TD 133bf7fa_8985_c0a5_3da9_a5c107850923["resolveEntryFork()"] f7b15576_7c44_3158_5a8c_06d9077fff73["setupHostConfigs.js"] 133bf7fa_8985_c0a5_3da9_a5c107850923 -->|defined in| f7b15576_7c44_3158_5a8c_06d9077fff73 bdc8165d_165c_bd68_526c_cd95d04005b1["mockReact()"] bdc8165d_165c_bd68_526c_cd95d04005b1 -->|calls| 133bf7fa_8985_c0a5_3da9_a5c107850923 style 133bf7fa_8985_c0a5_3da9_a5c107850923 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
scripts/jest/setupHostConfigs.js lines 7–99
function resolveEntryFork(resolvedEntry, isFBBundle) {
// Pick which entry point fork to use:
// .modern.fb.js
// .classic.fb.js
// .fb.js
// .stable.js
// .experimental.js
// .js
// or any of those plus .development.js
if (isFBBundle) {
// FB builds for react-dom need to alias both react-dom and react-dom/client to the same
// entrypoint since there is only a single build for them.
if (
resolvedEntry.endsWith('react-dom/index.js') ||
resolvedEntry.endsWith('react-dom/client.js') ||
resolvedEntry.endsWith('react-dom/unstable_testing.js')
) {
let specifier;
let entrypoint;
if (resolvedEntry.endsWith('index.js')) {
specifier = 'react-dom';
entrypoint = __EXPERIMENTAL__
? 'src/ReactDOMFB.modern.js'
: 'src/ReactDOMFB.js';
} else if (resolvedEntry.endsWith('client.js')) {
specifier = 'react-dom/client';
entrypoint = __EXPERIMENTAL__
? 'src/ReactDOMFB.modern.js'
: 'src/ReactDOMFB.js';
} else {
// must be unstable_testing
specifier = 'react-dom/unstable_testing';
entrypoint = __EXPERIMENTAL__
? 'src/ReactDOMTestingFB.modern.js'
: 'src/ReactDOMTestingFB.js';
}
resolvedEntry = nodePath.join(resolvedEntry, '..', entrypoint);
const devEntry = resolvedEntry.replace('.js', '.development.js');
if (__DEV__ && fs.existsSync(devEntry)) {
return devEntry;
}
if (fs.existsSync(resolvedEntry)) {
return resolvedEntry;
}
const fbReleaseChannel = __EXPERIMENTAL__ ? 'www-modern' : 'www-classic';
throw new Error(
`${fbReleaseChannel} tests are expected to alias ${specifier} to ${entrypoint} but this file was not found`
);
}
const resolvedFBEntry = resolvedEntry.replace(
'.js',
__EXPERIMENTAL__ ? '.modern.fb.js' : '.classic.fb.js'
);
const devFBEntry = resolvedFBEntry.replace('.js', '.development.js');
if (__DEV__ && fs.existsSync(devFBEntry)) {
return devFBEntry;
}
if (fs.existsSync(resolvedFBEntry)) {
return resolvedFBEntry;
}
const resolvedGenericFBEntry = resolvedEntry.replace('.js', '.fb.js');
const devGenericFBEntry = resolvedGenericFBEntry.replace(
'.js',
'.development.js'
);
if (__DEV__ && fs.existsSync(devGenericFBEntry)) {
return devGenericFBEntry;
}
if (fs.existsSync(resolvedGenericFBEntry)) {
return resolvedGenericFBEntry;
}
// Even if it's a FB bundle we fallthrough to pick stable or experimental if we don't have an FB fork.
}
const resolvedForkedEntry = resolvedEntry.replace(
'.js',
__EXPERIMENTAL__ ? '.experimental.js' : '.stable.js'
);
const devForkedEntry = resolvedForkedEntry.replace('.js', '.development.js');
if (__DEV__ && fs.existsSync(devForkedEntry)) {
Domain
Subdomains
Defined In
Called By
Source
Frequently Asked Questions
What does resolveEntryFork() do?
resolveEntryFork() is a function in the react codebase, defined in scripts/jest/setupHostConfigs.js.
Where is resolveEntryFork() defined?
resolveEntryFork() is defined in scripts/jest/setupHostConfigs.js at line 7.
What calls resolveEntryFork()?
resolveEntryFork() is called by 1 function(s): mockReact.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free