[be] Update feature defaults to reflect usage

Updates feature flag default values to match the flags we have turned on 
internally for some time w/o issues.
This commit is contained in:
Joe Savona
2023-10-03 14:49:58 -07:00
parent 34890556ec
commit 44a6a602a7
22 changed files with 130 additions and 197 deletions
@@ -251,6 +251,10 @@ const DEFAULT_ENVIRONMENT_CONFIG: CompleteEnvironmentConfig = {
enableTreatHooksAsFunctions: true,
memoizeJsxElements: true,
enableFunctionCallSignatureOptimizations: true,
inlineUseMemo: true,
validateHooksUsage: true,
enableNoAliasOptimizations: true,
assertValidMutableRanges: false,
bailoutOnHoleyArrays: false,
@@ -258,13 +262,9 @@ const DEFAULT_ENVIRONMENT_CONFIG: CompleteEnvironmentConfig = {
enableAssumeHooksFollowRulesOfReact: false,
enableEmitFreeze: null,
enableForest: false,
enableFunctionCallSignatureOptimizations: false,
enableMergeConsecutiveScopes: false,
enableNoAliasOptimizations: false,
inlineUseMemo: false,
validateFrozenLambdas: false,
validateHooksUsage: false,
validateNoSetStateInRender: false,
validateRefAccessDuringRender: false,
};
@@ -2,7 +2,6 @@
## Input
```javascript
// @enableNoAliasOptimizations
function Component(props) {
// This item is part of the receiver, should be memoized
const item = { a: props.a };
@@ -22,7 +21,7 @@ export const FIXTURE_ENTRYPOINT = {
## Code
```javascript
import { unstable_useMemoCache as useMemoCache } from "react"; // @enableNoAliasOptimizations
import { unstable_useMemoCache as useMemoCache } from "react";
function Component(props) {
const $ = useMemoCache(2);
const c_0 = $[0] !== props.a;
@@ -1,4 +1,3 @@
// @enableNoAliasOptimizations
function Component(props) {
// This item is part of the receiver, should be memoized
const item = { a: props.a };
@@ -2,7 +2,6 @@
## Input
```javascript
// @enableNoAliasOptimizations
function Component(props) {
const x = [];
<dif>{x}</dif>;
@@ -21,7 +20,7 @@ export const FIXTURE_ENTRYPOINT = {
## Code
```javascript
import { unstable_useMemoCache as useMemoCache } from "react"; // @enableNoAliasOptimizations
import { unstable_useMemoCache as useMemoCache } from "react";
function Component(props) {
const $ = useMemoCache(3);
let t0;
@@ -1,4 +1,3 @@
// @enableNoAliasOptimizations
function Component(props) {
const x = [];
<dif>{x}</dif>;
@@ -22,7 +22,7 @@ export const FIXTURE_ENTRYPOINT = {
```javascript
import { unstable_useMemoCache as useMemoCache } from "react";
function Component(props) {
const $ = useMemoCache(4);
const $ = useMemoCache(3);
let t0;
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
t0 = [];
@@ -31,29 +31,22 @@ function Component(props) {
t0 = $[0];
}
const x = t0;
let t2;
let t1;
if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
let t1;
if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
t1 = (item) => item;
$[2] = t1;
} else {
t1 = $[2];
}
t2 = x.map(t1);
$[1] = t2;
t1 = x.map((item) => item);
$[1] = t1;
} else {
t2 = $[1];
t1 = $[1];
}
const y = t2;
let t3;
if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
t3 = [x, y];
$[3] = t3;
const y = t1;
let t2;
if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
t2 = [x, y];
$[2] = t2;
} else {
t3 = $[3];
t2 = $[2];
}
return t3;
return t2;
}
export const FIXTURE_ENTRYPOINT = {
@@ -2,7 +2,6 @@
## Input
```javascript
// @enableNoAliasOptimizations
function Component(props) {
const x = [];
const y = x.map((item) => {
@@ -23,7 +22,7 @@ export const FIXTURE_ENTRYPOINT = {
## Code
```javascript
import { unstable_useMemoCache as useMemoCache } from "react"; // @enableNoAliasOptimizations
import { unstable_useMemoCache as useMemoCache } from "react";
function Component(props) {
const $ = useMemoCache(3);
let t0;
@@ -1,4 +1,3 @@
// @enableNoAliasOptimizations
function Component(props) {
const x = [];
const y = x.map((item) => {
@@ -24,37 +24,30 @@ export const FIXTURE_ENTRYPOINT = {
```javascript
import { unstable_useMemoCache as useMemoCache } from "react";
function Component(props) {
const $ = useMemoCache(4);
let t1;
const $ = useMemoCache(3);
let t0;
let x;
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
x = [];
let t0;
if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
t0 = (item) => {
item.updated = true;
return item;
};
$[2] = t0;
} else {
t0 = $[2];
}
t1 = x.map(t0);
$[0] = t1;
t0 = x.map((item) => {
item.updated = true;
return item;
});
$[0] = t0;
$[1] = x;
} else {
t1 = $[0];
t0 = $[0];
x = $[1];
}
const y = t1;
let t2;
if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
t2 = [x, y];
$[3] = t2;
const y = t0;
let t1;
if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
t1 = [x, y];
$[2] = t1;
} else {
t2 = $[3];
t1 = $[2];
}
return t2;
return t1;
}
export const FIXTURE_ENTRYPOINT = {
@@ -2,7 +2,6 @@
## Input
```javascript
// @enableNoAliasOptimizations
function Component(props) {
const f = (item) => item;
const x = [...props.items].map(f); // `f` doesn't escape here...
@@ -20,7 +19,7 @@ export const FIXTURE_ENTRYPOINT = {
## Code
```javascript
import { unstable_useMemoCache as useMemoCache } from "react"; // @enableNoAliasOptimizations
import { unstable_useMemoCache as useMemoCache } from "react";
function Component(props) {
const $ = useMemoCache(5);
let t0;
@@ -1,4 +1,3 @@
// @enableNoAliasOptimizations
function Component(props) {
const f = (item) => item;
const x = [...props.items].map(f); // `f` doesn't escape here...
@@ -56,94 +56,87 @@ function useFragment(_arg1, _arg2) {
}
function Component(props) {
const $ = useMemoCache(17);
let t0;
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
t0 = graphql`...`;
$[0] = t0;
} else {
t0 = $[0];
}
const post = useFragment(t0, props.post);
const c_1 = $[1] !== post;
const $ = useMemoCache(16);
const post = useFragment(graphql`...`, props.post);
const c_0 = $[0] !== post;
let media;
let allUrls;
let onClick;
if (c_1) {
if (c_0) {
allUrls = [];
const { media: t1, comments: t3, urls: t5 } = post;
const c_5 = $[5] !== t1;
let t2;
if (c_5) {
t2 = t1 === undefined ? null : t1;
const { media: t0, comments: t2, urls: t4 } = post;
const c_4 = $[4] !== t0;
let t1;
if (c_4) {
t1 = t0 === undefined ? null : t0;
$[4] = t0;
$[5] = t1;
} else {
t1 = $[5];
}
media = t1;
const c_6 = $[6] !== t2;
let t3;
if (c_6) {
t3 = t2 === undefined ? [] : t2;
$[6] = t2;
} else {
t2 = $[6];
}
media = t2;
const c_7 = $[7] !== t3;
let t4;
if (c_7) {
t4 = t3 === undefined ? [] : t3;
$[7] = t3;
} else {
t3 = $[7];
}
const comments = t3;
const c_8 = $[8] !== t4;
let t5;
if (c_8) {
t5 = t4 === undefined ? [] : t4;
$[8] = t4;
} else {
t4 = $[8];
}
const comments = t4;
const c_9 = $[9] !== t5;
let t6;
if (c_9) {
t6 = t5 === undefined ? [] : t5;
$[9] = t5;
$[10] = t6;
} else {
t6 = $[10];
t5 = $[9];
}
const urls = t6;
const c_11 = $[11] !== comments.length;
let t7;
if (c_11) {
t7 = (e) => {
const urls = t5;
const c_10 = $[10] !== comments.length;
let t6;
if (c_10) {
t6 = (e) => {
if (!comments.length) {
return;
}
console.log(comments.length);
};
$[11] = comments.length;
$[12] = t7;
$[10] = comments.length;
$[11] = t6;
} else {
t7 = $[12];
t6 = $[11];
}
onClick = t7;
onClick = t6;
allUrls.push(...urls);
$[1] = post;
$[2] = media;
$[3] = allUrls;
$[4] = onClick;
$[0] = post;
$[1] = media;
$[2] = allUrls;
$[3] = onClick;
} else {
media = $[2];
allUrls = $[3];
onClick = $[4];
media = $[1];
allUrls = $[2];
onClick = $[3];
}
const c_13 = $[13] !== media;
const c_14 = $[14] !== allUrls;
const c_15 = $[15] !== onClick;
let t8;
if (c_13 || c_14 || c_15) {
t8 = <Stringify media={media} allUrls={allUrls} onClick={onClick} />;
$[13] = media;
$[14] = allUrls;
$[15] = onClick;
$[16] = t8;
const c_12 = $[12] !== media;
const c_13 = $[13] !== allUrls;
const c_14 = $[14] !== onClick;
let t7;
if (c_12 || c_13 || c_14) {
t7 = <Stringify media={media} allUrls={allUrls} onClick={onClick} />;
$[12] = media;
$[13] = allUrls;
$[14] = onClick;
$[15] = t7;
} else {
t8 = $[16];
t7 = $[15];
}
return t8;
return t7;
}
export const FIXTURE_ENTRYPOINT = {
@@ -30,60 +30,53 @@ function Component(props) {
```javascript
import { unstable_useMemoCache as useMemoCache } from "react";
function Component(props) {
const $ = useMemoCache(9);
let t0;
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
t0 = graphql`...`;
$[0] = t0;
} else {
t0 = $[0];
}
const post = useFragment(t0, props.post);
const c_1 = $[1] !== post;
const $ = useMemoCache(8);
const post = useFragment(graphql`...`, props.post);
const c_0 = $[0] !== post;
let media;
let onClick;
if (c_1) {
if (c_0) {
const allUrls = [];
const { media: t83, comments, urls } = post;
media = t83;
const c_4 = $[4] !== comments.length;
let t1;
if (c_4) {
t1 = (e) => {
const c_3 = $[3] !== comments.length;
let t0;
if (c_3) {
t0 = (e) => {
if (!comments.length) {
return;
}
console.log(comments.length);
};
$[4] = comments.length;
$[5] = t1;
$[3] = comments.length;
$[4] = t0;
} else {
t1 = $[5];
t0 = $[4];
}
onClick = t1;
onClick = t0;
allUrls.push(...urls);
$[1] = post;
$[2] = media;
$[3] = onClick;
$[0] = post;
$[1] = media;
$[2] = onClick;
} else {
media = $[2];
onClick = $[3];
media = $[1];
onClick = $[2];
}
const c_6 = $[6] !== media;
const c_7 = $[7] !== onClick;
let t2;
if (c_6 || c_7) {
t2 = <Media media={media} onClick={onClick} />;
$[6] = media;
$[7] = onClick;
$[8] = t2;
const c_5 = $[5] !== media;
const c_6 = $[6] !== onClick;
let t1;
if (c_5 || c_6) {
t1 = <Media media={media} onClick={onClick} />;
$[5] = media;
$[6] = onClick;
$[7] = t1;
} else {
t2 = $[8];
t1 = $[7];
}
return t2;
return t1;
}
```
@@ -2,7 +2,6 @@
## Input
```javascript
// @enableNoAliasOptimizations
import { useNoAlias } from "shared-runtime";
function Component(props) {
@@ -28,7 +27,7 @@ export const FIXTURE_ENTRYPOINT = {
## Code
```javascript
import { unstable_useMemoCache as useMemoCache } from "react"; // @enableNoAliasOptimizations
import { unstable_useMemoCache as useMemoCache } from "react";
import { useNoAlias } from "shared-runtime";
function Component(props) {
@@ -1,4 +1,3 @@
// @enableNoAliasOptimizations
import { useNoAlias } from "shared-runtime";
function Component(props) {
@@ -14,25 +14,18 @@ function Component(props) {
```javascript
import { unstable_useMemoCache as useMemoCache } from "react";
function Component(props) {
const $ = useMemoCache(3);
const $ = useMemoCache(2);
const item = useFragment(graphql`...`, props.item);
const c_0 = $[0] !== item.items;
let t0;
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
t0 = graphql`...`;
$[0] = t0;
if (c_0) {
t0 = item.items?.map((item_0) => renderItem(item_0)) ?? [];
$[0] = item.items;
$[1] = t0;
} else {
t0 = $[0];
t0 = $[1];
}
const item = useFragment(t0, props.item);
const c_1 = $[1] !== item.items;
let t1;
if (c_1) {
t1 = item.items?.map((item_0) => renderItem(item_0)) ?? [];
$[1] = item.items;
$[2] = t1;
} else {
t1 = $[2];
}
return t1;
return t0;
}
```
@@ -2,7 +2,6 @@
## Input
```javascript
// @enableNoAliasOptimizations
function Component(props) {
const x = makeObject();
const user = useFragment(
@@ -24,7 +23,7 @@ function Component(props) {
## Code
```javascript
import { unstable_useMemoCache as useMemoCache } from "react"; // @enableNoAliasOptimizations
import { unstable_useMemoCache as useMemoCache } from "react";
function Component(props) {
const $ = useMemoCache(3);
const x = makeObject();
@@ -1,4 +1,3 @@
// @enableNoAliasOptimizations
function Component(props) {
const x = makeObject();
const user = useFragment(
@@ -2,7 +2,6 @@
## Input
```javascript
// @enableNoAliasOptimizations
function Component(props) {
const user = useFragment(
graphql`fragment Component_user on User { ... }`,
@@ -22,7 +21,7 @@ function Component(props) {
## Code
```javascript
import { unstable_useMemoCache as useMemoCache } from "react"; // @enableNoAliasOptimizations
import { unstable_useMemoCache as useMemoCache } from "react";
function Component(props) {
const $ = useMemoCache(5);
const user = useFragment(
@@ -1,4 +1,3 @@
// @enableNoAliasOptimizations
function Component(props) {
const user = useFragment(
graphql`fragment Component_user on User { ... }`,
@@ -12,17 +12,8 @@ function Component(props) {
## Code
```javascript
import { unstable_useMemoCache as useMemoCache } from "react";
function Component(props) {
const $ = useMemoCache(1);
let t0;
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
t0 = graphql`fragment on User { name }`;
$[0] = t0;
} else {
t0 = $[0];
}
const user = useFragment(t0, props.user);
const user = useFragment(graphql`fragment on User { name }`, props.user);
return user.name;
}
@@ -28,7 +28,6 @@ export function transformFixtureInput(
let enableEmitFreeze = null;
let compilationMode: CompilationMode = "all";
let enableForest = false;
let enableNoAliasOptimizations = false;
let enableMergeConsecutiveScopes = false;
let bailoutOnHoleyArrays = false;
@@ -86,10 +85,6 @@ export function transformFixtureInput(
if (firstLine.includes("@enableForest true")) {
enableForest = true;
}
if (firstLine.includes("@enableNoAliasOptimizations")) {
enableNoAliasOptimizations = true;
}
if (firstLine.includes("@bailoutOnHoleyArrays")) {
bailoutOnHoleyArrays = true;
}
@@ -134,13 +129,9 @@ export function transformFixtureInput(
],
]),
enableAssumeHooksFollowRulesOfReact,
enableFunctionCallSignatureOptimizations: true,
enableNoAliasOptimizations,
disableAllMemoization,
enableTreatHooksAsFunctions,
inlineUseMemo: true,
memoizeJsxElements,
validateHooksUsage: true,
validateRefAccessDuringRender,
validateFrozenLambdas: true,
validateNoSetStateInRender,