Add flag
Sathya Gunasekaran committed
Aug 31, 2023 at 11:15 UTC
da61d47e87cb2b223fc33824ed73dcddc8a345f4
2 files changed
+8
compiler/packages/babel-plugin-react-forget/src/HIR/Environment.ts
+3
@@ -50,6 +50,9 @@ export type Hook = {
50
export type EnvironmentConfig = Partial<{
51
customHooks: Map<string, Hook>;
52
53
+ // 🌲
54
+ enableForest: boolean;
55
+
56
/**
57
* Enable memoization of JSX elements in addition to other types of values. When disabled,
58
* other types (objects, arrays, call expressions, etc) are memoized, but not known JSX
compiler/packages/fixture-test-utils/src/compiler-utils.ts
+5
@@ -28,6 +28,7 @@ export function transformFixtureInput(
28
let validateNoSetStateInRender = true;
29
let enableEmitFreeze = null;
30
let compilationMode: CompilationMode = "all";
31
+ let enableForest = false;
32
33
if (firstLine.indexOf("@compilationMode(annotation)") !== -1) {
34
assert(
@@ -83,6 +84,9 @@ export function transformFixtureInput(
84
importSpecifierName: "makeReadOnly",
85
};
86
}
87
+ if (firstLine.includes("@enableForest true")) {
88
+ enableForest = true;
89
+ }
90
91
return pluginFn(
92
input,
@@ -111,6 +115,7 @@ export function transformFixtureInput(
115
validateNoSetStateInRender,
116
enableEmitFreeze,
117
assertValidMutableRanges: true,
118
+ enableForest,
119
},
120
compilationMode,
121
logger: null,