createFlowConfigs.js — react Source File
Architecture documentation for createFlowConfigs.js, a javascript file in the react codebase.
Entity Profile
Relationship Graph
Source Code
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
'use strict';
const chalk = require('chalk');
const fs = require('fs');
const path = require('path');
const mkdirp = require('mkdirp');
const inlinedHostConfigs = require('../shared/inlinedHostConfigs');
const flowVersion = require('../../package.json').devDependencies['flow-bin'];
const configTemplate = fs
.readFileSync(__dirname + '/config/flowconfig')
.toString();
// stores all forks discovered during config generation
const allForks = new Set();
// maps forked file to the base path containing it and it's forks (it's parent)
const forkedFiles = new Map();
function findForks(file) {
const basePath = path.join(file, '..');
const forksPath = path.join(basePath, 'forks');
const forks = fs.readdirSync(path.join('packages', forksPath));
forks.forEach(f => allForks.add('forks/' + f));
forkedFiles.set(file, basePath);
return basePath;
}
function addFork(forks, renderer, file) {
let basePath = forkedFiles.get(file);
if (!basePath) {
basePath = findForks(file);
}
const baseFilename = file.slice(basePath.length + 1);
const parts = renderer.split('-');
while (parts.length) {
const candidate = `forks/${baseFilename}.${parts.join('-')}.js`;
if (allForks.has(candidate)) {
forks.set(candidate, `${baseFilename}$$`);
return;
}
parts.pop();
}
throw new Error(`Cannot find fork for ${file} for renderer ${renderer}`);
}
function writeConfig(
renderer,
rendererInfo,
isServerSupported,
isFlightSupported,
) {
// ... (93 more lines)
Domain
Subdomains
Functions
Source
Frequently Asked Questions
What does createFlowConfigs.js do?
createFlowConfigs.js is a source file in the react codebase, written in javascript. It belongs to the BabelCompiler domain, Entrypoint subdomain.
What functions are defined in createFlowConfigs.js?
createFlowConfigs.js defines 3 function(s): addFork, findForks, writeConfig.
Where is createFlowConfigs.js in the architecture?
createFlowConfigs.js is located at scripts/flow/createFlowConfigs.js (domain: BabelCompiler, subdomain: Entrypoint, directory: scripts/flow).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free