Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[rcr] Update default runtimeModule to react-compiler-runtime #31054

Open
wants to merge 17 commits into
base: gh/poteto/13/base
Choose a base branch
from
Prev Previous commit
Next Next commit
Update
[ghstack-poisoned]
  • Loading branch information
poteto committed Oct 1, 2024
commit 25f1ea7c829d44206cddfe1a50b705dbef105079
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/

const ReactCompilerRuntime = require('react-compiler-runtime');
const ReactCompilerRuntime = require('react/compiler-runtime');

/*
* Our e2e babel transform currently only compiles functions, not programs.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export const FIXTURE_ENTRYPOINT = {
## Code

```javascript
import { c as _c } from "react/compiler-runtime"; // @enablePropagateDepsInHIR
import { c as _c } from "react-compiler-runtime"; // @enablePropagateDepsInHIR
/**
* props.b *does* influence `a`
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export const FIXTURE_ENTRYPOINT = {
## Code

```javascript
import { c as _c } from "react/compiler-runtime"; // @enablePropagateDepsInHIR
import { c as _c } from "react-compiler-runtime"; // @enablePropagateDepsInHIR
/**
* props.b does *not* influence `a`
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ function mayMutate() {}
## Code

```javascript
import { c as _c } from "react/compiler-runtime"; // @enablePropagateDepsInHIR
import { c as _c } from "react-compiler-runtime"; // @enablePropagateDepsInHIR
function ComponentA(props) {
const $ = _c(4);
let t0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export const FIXTURE_ENTRYPOINT = {
## Code

```javascript
import { c as _c } from "react/compiler-runtime"; // @enablePropagateDepsInHIR
import { c as _c } from "react-compiler-runtime"; // @enablePropagateDepsInHIR
function Component(props) {
const $ = _c(7);
let t0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export const FIXTURE_ENTRYPOINT = {
## Code

```javascript
import { c as _c } from "react/compiler-runtime"; // @enablePropagateDepsInHIR
import { c as _c } from "react-compiler-runtime"; // @enablePropagateDepsInHIR
import { makeArray } from "shared-runtime";

function Component(props) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export const FIXTURE_ENTRYPOINT = {
## Code

```javascript
import { c as _c } from "react/compiler-runtime"; // @enablePropagateDepsInHIR
import { c as _c } from "react-compiler-runtime"; // @enablePropagateDepsInHIR
function Component(props) {
const $ = _c(3);
let items;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,49 +12,58 @@ function Foo(props) {
* as it is arg[0] of a component function
*/
const arr = [];
if (cond) {
if (props.cond) {
arr.push(identity(props.value));
}
return <Stringify arr={arr} />;
}

export const FIXTURE_ENTRYPOINT = {
fn: Foo,
params: [{value: 2}],
params: [{value: 2, cond: true}],
};

```

## Code

```javascript
import { c as _c } from "react/compiler-runtime"; // @enablePropagateDepsInHIR
import { c as _c } from "react-compiler-runtime"; // @enablePropagateDepsInHIR
import { identity, Stringify } from "shared-runtime";

function Foo(props) {
const $ = _c(2);
const $ = _c(5);
let t0;
if ($[0] !== props.value) {
if ($[0] !== props.cond || $[1] !== props.value) {
const arr = [];
if (cond) {
arr.push(identity(props.value));
if (props.cond) {
let t1;
if ($[3] !== props.value) {
t1 = identity(props.value);
$[3] = props.value;
$[4] = t1;
} else {
t1 = $[4];
}
arr.push(t1);
}

t0 = <Stringify arr={arr} />;
$[0] = props.value;
$[1] = t0;
$[0] = props.cond;
$[1] = props.value;
$[2] = t0;
} else {
t0 = $[1];
t0 = $[2];
}
return t0;
}

export const FIXTURE_ENTRYPOINT = {
fn: Foo,
params: [{ value: 2 }],
params: [{ value: 2, cond: true }],
};

```

### Eval output
(kind: exception) cond is not defined
(kind: ok) <div>{"arr":[2]}</div>
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ function Foo(props) {
* as it is arg[0] of a component function
*/
const arr = [];
if (cond) {
if (props.cond) {
arr.push(identity(props.value));
}
return <Stringify arr={arr} />;
}

export const FIXTURE_ENTRYPOINT = {
fn: Foo,
params: [{value: 2}],
params: [{value: 2, cond: true}],
};
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export const FIXTURE_ENTRYPOINT = {
## Code

```javascript
import { c as _c } from "react/compiler-runtime"; // @enablePropagateDepsInHIR
import { c as _c } from "react-compiler-runtime"; // @enablePropagateDepsInHIR
import { identity, useIdentity } from "shared-runtime";

function useFoo(t0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export const FIXTURE_ENTRYPOINT = {
## Code

```javascript
import { c as _c } from "react/compiler-runtime"; // @enablePropagateDepsInHIR
import { c as _c } from "react-compiler-runtime"; // @enablePropagateDepsInHIR
import { makeObject_Primitives } from "shared-runtime";

function Component(props) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export const FIXTURE_ENTRYPOINT = {
## Code

```javascript
import { c as _c } from "react/compiler-runtime"; // @enablePropagateDepsInHIR
import { c as _c } from "react-compiler-runtime"; // @enablePropagateDepsInHIR
function Component(props) {
const $ = _c(6);
let y;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export const FIXTURE_ENTRYPOINT = {
## Code

```javascript
import { c as _c } from "react/compiler-runtime"; // @enablePropagateDepsInHIR
import { c as _c } from "react-compiler-runtime"; // @enablePropagateDepsInHIR
import { makeArray } from "shared-runtime";

function Component(props) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export const FIXTURE_ENTRYPOINT = {
## Code

```javascript
import { c as _c } from "react/compiler-runtime"; // @enablePropagateDepsInHIR
import { c as _c } from "react-compiler-runtime"; // @enablePropagateDepsInHIR
function Component(props) {
const $ = _c(4);
let t0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export const FIXTURE_ENTRYPOINT = {
## Code

```javascript
import { c as _c } from "react/compiler-runtime"; // @debug @enablePropagateDepsInHIR
import { c as _c } from "react-compiler-runtime"; // @debug @enablePropagateDepsInHIR
function Component(props) {
const $ = _c(4);
let t0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ function Component(props) {
## Code

```javascript
import { c as _c } from "react/compiler-runtime"; // @enablePropagateDepsInHIR
import { c as _c } from "react-compiler-runtime"; // @enablePropagateDepsInHIR
function Component(props) {
const $ = _c(2);
let t0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export const FIXTURE_ENTRYPOINT = {
## Code

```javascript
import { c as _c } from "react/compiler-runtime"; // @enablePropagateDepsInHIR
import { c as _c } from "react-compiler-runtime"; // @enablePropagateDepsInHIR
import { mutate } from "shared-runtime";

function useFoo(props) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export const FIXTURE_ENTRYPOINT = {
## Code

```javascript
import { c as _c } from "react/compiler-runtime";
import { c as _c } from "react-compiler-runtime";
import { identity } from "shared-runtime";

/**
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.