mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Add env config to infer effect deps
This commit is contained in:
@@ -232,7 +232,12 @@ const EnvironmentConfigSchema = z.object({
|
||||
enableUseTypeAnnotations: z.boolean().default(false),
|
||||
|
||||
enableFunctionDependencyRewrite: z.boolean().default(true),
|
||||
|
||||
|
||||
/**
|
||||
* Enables inference of effect dependencies. Still experimental.
|
||||
*/
|
||||
EXPERIMENTAL_inferEffectDependencies: z.boolean().default(false),
|
||||
|
||||
/**
|
||||
* Enables inlining ReactElement object literals in place of JSX
|
||||
* An alternative to the standard JSX transform which replaces JSX with React's jsxProd() runtime
|
||||
|
||||
@@ -173,7 +173,12 @@ function makePluginOptions(
|
||||
.map(s => s.trim())
|
||||
.filter(s => s.length > 0);
|
||||
}
|
||||
|
||||
|
||||
let inferEffectDependencies = false;
|
||||
if (firstLine.includes('@inferEffectDependencies')) {
|
||||
inferEffectDependencies = true;
|
||||
}
|
||||
|
||||
let logs: Array<{filename: string | null; event: LoggerEvent}> = [];
|
||||
let logger: Logger | null = null;
|
||||
if (firstLine.includes('@logger')) {
|
||||
@@ -197,6 +202,7 @@ function makePluginOptions(
|
||||
hookPattern,
|
||||
validatePreserveExistingMemoizationGuarantees,
|
||||
validateBlocklistedImports,
|
||||
EXPERIMENTAL_inferEffectDependencies: inferEffectDependencies,
|
||||
},
|
||||
compilationMode,
|
||||
logger,
|
||||
|
||||
Reference in New Issue
Block a user