Skip to content

Commit

Permalink
[compiler] Add option for firing effect functions
Browse files Browse the repository at this point in the history
  • Loading branch information
jbrown215 committed Dec 15, 2024
1 parent e06c72f commit 13e848a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,8 @@ const EnvironmentConfigSchema = z.object({
* the dependency.
*/
enableOptionalDependencies: z.boolean().default(true),

enableFire: z.boolean().default(false),

/**
* Enables inference and auto-insertion of effect dependencies. Takes in an array of
Expand Down
6 changes: 6 additions & 0 deletions compiler/packages/snap/src/compiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ function makePluginOptions(
let validatePreserveExistingMemoizationGuarantees = false;
let customMacros: null | Array<Macro> = null;
let validateBlocklistedImports = null;
let enableFire = false;
let target: CompilerReactTarget = '19';

if (firstLine.indexOf('@compilationMode(annotation)') !== -1) {
Expand Down Expand Up @@ -127,6 +128,10 @@ function makePluginOptions(
validatePreserveExistingMemoizationGuarantees = true;
}

if (firstLine.includes('@enableFire')) {
enableFire = true;
}

const hookPatternMatch = /@hookPattern:"([^"]+)"/.exec(firstLine);
if (
hookPatternMatch &&
Expand Down Expand Up @@ -205,6 +210,7 @@ function makePluginOptions(
hookPattern,
validatePreserveExistingMemoizationGuarantees,
validateBlocklistedImports,
enableFire,
},
compilationMode,
logger,
Expand Down

0 comments on commit 13e848a

Please sign in to comment.