Skip to content

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

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

Closed
wants to merge 17 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions compiler/packages/babel-plugin-react-compiler/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"dist"
],
"scripts": {
"postinstall": "./scripts/link-react-compiler-runtime.sh",
"build": "rimraf dist && rollup --config --bundleConfigAsCjs",
"test": "yarn snap:ci",
"jest": "yarn build && ts-node node_modules/.bin/jest",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env bash
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.

set -eo pipefail

yarn --silent workspace react-compiler-runtime link
yarn --silent workspace babel-plugin-react-compiler link react-compiler-runtime
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
Loading