Skip to content

Commit 308be6e

Browse files
authored
[compiler] Add option for firing effect functions (#31794)
Config flag for `fire` -- --- [//]: # (BEGIN SAPLING FOOTER) Stack created with [Sapling](https://sapling-scm.com). Best reviewed with [ReviewStack](https://reviewstack.dev/facebook/react/pull/31794). * #31811 * #31798 * #31797 * #31796 * #31795 * __->__ #31794
1 parent d325f87 commit 308be6e

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

compiler/packages/babel-plugin-react-compiler/src/HIR/Environment.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,8 @@ const EnvironmentConfigSchema = z.object({
249249
*/
250250
enableOptionalDependencies: z.boolean().default(true),
251251

252+
enableFire: z.boolean().default(false),
253+
252254
/**
253255
* Enables inference and auto-insertion of effect dependencies. Takes in an array of
254256
* configurable module and import pairs to allow for user-land experimentation. For example,

compiler/packages/snap/src/compiler.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ function makePluginOptions(
5858
let validatePreserveExistingMemoizationGuarantees = false;
5959
let customMacros: null | Array<Macro> = null;
6060
let validateBlocklistedImports = null;
61+
let enableFire = false;
6162
let target: CompilerReactTarget = '19';
6263

6364
if (firstLine.indexOf('@compilationMode(annotation)') !== -1) {
@@ -129,6 +130,10 @@ function makePluginOptions(
129130
validatePreserveExistingMemoizationGuarantees = true;
130131
}
131132

133+
if (firstLine.includes('@enableFire')) {
134+
enableFire = true;
135+
}
136+
132137
const hookPatternMatch = /@hookPattern:"([^"]+)"/.exec(firstLine);
133138
if (
134139
hookPatternMatch &&
@@ -207,6 +212,7 @@ function makePluginOptions(
207212
hookPattern,
208213
validatePreserveExistingMemoizationGuarantees,
209214
validateBlocklistedImports,
215+
enableFire,
210216
},
211217
compilationMode,
212218
logger,

0 commit comments

Comments
 (0)