addPragmaToFixture() — react Function Reference
Architecture documentation for the addPragmaToFixture() function in enable-feature-flag.js from the react codebase.
Entity Profile
Dependency Diagram
graph TD 58164e4d_3af0_d588_b322_d2416e5a91c6["addPragmaToFixture()"] fdb06a3a_b735_af93_2b10_31380c21c8b7["enable-feature-flag.js"] 58164e4d_3af0_d588_b322_d2416e5a91c6 -->|defined in| fdb06a3a_b735_af93_2b10_31380c21c8b7 ab68ec04_512e_f89e_9e49_ae73608023f0["main()"] ab68ec04_512e_f89e_9e49_ae73608023f0 -->|calls| 58164e4d_3af0_d588_b322_d2416e5a91c6 style 58164e4d_3af0_d588_b322_d2416e5a91c6 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
compiler/scripts/enable-feature-flag.js lines 174–205
function addPragmaToFixture(filePath, flagName) {
const content = fs.readFileSync(filePath, 'utf8');
const lines = content.split('\n');
if (lines.length === 0) {
console.warn(`Warning: Empty file ${filePath}`);
return false;
}
const firstLine = lines[0];
const pragma = `@${flagName}:false`;
// Check if pragma already exists
if (firstLine.includes(pragma)) {
return false; // Already has the pragma
}
// Check if first line is a single-line comment
if (firstLine.trim().startsWith('//')) {
// Append pragma to existing comment
lines[0] = firstLine + ' ' + pragma;
} else if (firstLine.trim().startsWith('/*')) {
// Multi-line comment - insert new line before it
lines.unshift('// ' + pragma);
} else {
// No comment - insert new comment as first line
lines.unshift('// ' + pragma);
}
fs.writeFileSync(filePath, lines.join('\n'), 'utf8');
return true;
}
Domain
Subdomains
Defined In
Called By
Source
Frequently Asked Questions
What does addPragmaToFixture() do?
addPragmaToFixture() is a function in the react codebase, defined in compiler/scripts/enable-feature-flag.js.
Where is addPragmaToFixture() defined?
addPragmaToFixture() is defined in compiler/scripts/enable-feature-flag.js at line 174.
What calls addPragmaToFixture()?
addPragmaToFixture() is called by 1 function(s): main.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free