Skip to content

Commit

Permalink
[rcr] Update default runtimeModule to react-compiler-runtime
Browse files Browse the repository at this point in the history
Updates the compiler to always import from `react-compiler-runtime` by
default. The runtime then decides whether to use the official or
userspace implementation of useMemoCache.

ghstack-source-id: ae8abdc498577417c17a10185cd701fcdd0f28f1
Pull Request resolved: #31054
  • Loading branch information
poteto committed Sep 27, 2024
1 parent a26808d commit 29bf920
Show file tree
Hide file tree
Showing 884 changed files with 905 additions and 893 deletions.
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 @@ -298,7 +298,7 @@ export function compileProgram(
return;
}
const useMemoCacheIdentifier = program.scope.generateUidIdentifier('c');
const moduleName = pass.opts.runtimeModule ?? 'react/compiler-runtime';
const moduleName = pass.opts.runtimeModule ?? 'react-compiler-runtime';

/*
* Record lint errors and critical errors as depending on Forget's config,
Expand Down Expand Up @@ -638,7 +638,7 @@ function shouldSkipCompilation(
}
}

const moduleName = pass.opts.runtimeModule ?? 'react/compiler-runtime';
const moduleName = pass.opts.runtimeModule ?? 'react-compiler-runtime';
if (hasMemoCacheFunctionImport(program, moduleName)) {
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export const FIXTURE_ENTRYPOINT = {
## Code

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

function Component() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function Component() {
## Code

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

```javascript
import { c as _c } from "react/compiler-runtime";
import { c as _c } from "react-compiler-runtime";
function component(a) {
const $ = _c(2);
let x;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ function component() {
## Code

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

```javascript
import { c as _c } from "react/compiler-runtime";
import { c as _c } from "react-compiler-runtime";
function component() {
const $ = _c(1);
let x;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function mutate(x, y) {}
## Code

```javascript
import { c as _c } from "react/compiler-runtime";
import { c as _c } from "react-compiler-runtime";
function foo(cond) {
const $ = _c(2);
let a;
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";
import { c as _c } from "react-compiler-runtime";
import { mutate } from "shared-runtime";

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export const FIXTURE_ENTRYPOINT = {
## Code
```javascript
import { c as _c } from "react/compiler-runtime";
import { c as _c } from "react-compiler-runtime";
import { getNull } from "shared-runtime";

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

```javascript
import { c as _c } from "react/compiler-runtime";
import { c as _c } from "react-compiler-runtime";
import { mutate } from "shared-runtime";
/**
* Fixture showing that it's not sufficient to only align direct scoped
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export const FIXTURE_ENTRYPOINT = {
## Code

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

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

function useFoo(t0) {
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";
import { c as _c } from "react-compiler-runtime";
import { arrayPush, mutate } from "shared-runtime";

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

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

function Foo() {
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";
import { c as _c } from "react-compiler-runtime";
import { Stringify, identity, makeArray, mutate } from "shared-runtime";

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export const FIXTURE_ENTRYPOINT = {
## Code
```javascript
import { c as _c } from "react/compiler-runtime"; /**
import { c as _c } from "react-compiler-runtime"; /**
* This is a weird case as data has type `BuiltInMixedReadonly`.
* The only scoped value we currently infer in this program is the
* PropertyLoad `data?.toString`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export const FIXTURE_ENTRYPOINT = {
## Code

```javascript
import { c as _c } from "react/compiler-runtime"; // bar(props.b) is an allocating expression that produces a primitive, which means
import { c as _c } from "react-compiler-runtime"; // bar(props.b) is an allocating expression that produces a primitive, which means
// that Forget should memoize it.
// Correctness:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function AllocatingPrimitiveAsDep(props) {
## Code

```javascript
import { c as _c } from "react/compiler-runtime"; // bar(props.b) is an allocating expression that produces a primitive, which means
import { c as _c } from "react-compiler-runtime"; // bar(props.b) is an allocating expression that produces a primitive, which means
// that Forget should memoize it.
// Correctness:
// - y depends on either bar(props.b) or bar(props.b) + 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export const FIXTURE_ENTRYPOINT = {
## Code

```javascript
import { c as _c } from "react/compiler-runtime"; // @validatePreserveExistingMemoizationGuarantees
import { c as _c } from "react-compiler-runtime"; // @validatePreserveExistingMemoizationGuarantees
import { useCallback, useEffect, useState } from "react";

let someGlobal = {};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export const FIXTURE_ENTRYPOINT = {
## Code

```javascript
import { c as _c } from "react/compiler-runtime";
import { c as _c } from "react-compiler-runtime";
import { useEffect, useState } from "react";

let someGlobal = {};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export const FIXTURE_ENTRYPOINT = {
## Code

```javascript
import { c as _c } from "react/compiler-runtime";
import { c as _c } from "react-compiler-runtime";
import { useCallback, useEffect, useState } from "react";

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

```javascript
import { c as _c } from "react/compiler-runtime";
import { c as _c } from "react-compiler-runtime";
import { useEffect, useState } from "react";

let someGlobal = false;
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";
import { c as _c } from "react-compiler-runtime";
import { useEffect, useState } from "react";

let someGlobal = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export const FIXTURE_ENTRYPOINT = {
## Code

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

const someGlobal = { value: 0 };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export const FIXTURE_ENTRYPOINT = {
## Code

```javascript
import { c as _c } from "react/compiler-runtime";
import { c as _c } from "react-compiler-runtime";
import { useEffect, useState } from "react";

let someGlobal = { value: null };
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"; // @validateRefAccessDuringRender
import { c as _c } from "react-compiler-runtime"; // @validateRefAccessDuringRender
import { useRef } from "react";

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

```javascript
import { c as _c } from "react/compiler-runtime"; // @validateRefAccessDuringRender
import { c as _c } from "react-compiler-runtime"; // @validateRefAccessDuringRender
import { useRef } from "react";

function Component() {
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"; // @validateRefAccessDuringRender
import { c as _c } from "react-compiler-runtime"; // @validateRefAccessDuringRender
import { useRef } from "react";

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

```javascript
import { c as _c } from "react/compiler-runtime"; // @validateRefAccessDuringRender
import { c as _c } from "react-compiler-runtime"; // @validateRefAccessDuringRender
import { useRef } from "react";

function Component() {
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";
import { c as _c } from "react-compiler-runtime";
function Component(props) {
const $ = _c(1);
const ref = useRef(null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export const FIXTURE_ENTRYPOINT = {
## Code

```javascript
import { c as _c } from "react/compiler-runtime";
import { c as _c } from "react-compiler-runtime";
function Component() {
const $ = _c(1);
const onClick = _temp;
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"; // @validateRefAccessDuringRender @validateNoSetStateInRender:false
import { c as _c } from "react-compiler-runtime"; // @validateRefAccessDuringRender @validateNoSetStateInRender:false
import { useCallback, useEffect, useRef, useState } from "react";

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

```javascript
import { c as _c } from "react/compiler-runtime"; // @validateRefAccessDuringRender
import { c as _c } from "react-compiler-runtime"; // @validateRefAccessDuringRender
import { useEffect, useRef, useState } from "react";

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

```javascript
import { c as _c } from "react/compiler-runtime"; // @validateRefAccessDuringRender
import { c as _c } from "react-compiler-runtime"; // @validateRefAccessDuringRender
import { useEffect, useRef, useState } from "react";

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

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

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

```javascript
import { c as _c } from "react/compiler-runtime"; // arrayInstance.at should have the following effects:
import { c as _c } from "react-compiler-runtime"; // arrayInstance.at should have the following effects:
// - read on arg0
// - read on receiver
// - mutate on lvalue
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function Component(props) {
## Code

```javascript
import { c as _c } from "react/compiler-runtime"; // x's mutable range should extend to `mutate(y)`
import { c as _c } from "react-compiler-runtime"; // x's mutable range should extend to `mutate(y)`

function Component(props) {
const $ = _c(2);
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";
import { c as _c } from "react-compiler-runtime";
import { mutate } from "shared-runtime";

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export const FIXTURE_ENTRYPOINT = {
## Code

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

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

```javascript
import { c as _c } from "react/compiler-runtime";
import { c as _c } from "react-compiler-runtime";
function Component(props) {
const $ = _c(6);
let t0;
Expand Down
Loading

0 comments on commit 29bf920

Please sign in to comment.