Repository: facebook/react
Pull request: [rcr] Remove runtimeModule compiler option

Now that the compiler always injects `react-compiler-runtime`, this
option is unnecessary.

Changed files:
filename: compiler/packages/babel-plugin-react-compiler/src/Entrypoint/Options.ts
patch: @@ -87,17 +87,6 @@ export type PluginOptions = {
    */
   compilationMode: CompilationMode;
 
-  /*
-   * If enabled, Forget will import `useMemoCache` from the given module
-   * instead of `react/compiler-runtime`.
-   *
-   * ```
-   * // If set to "react-compiler-runtime"
-   * import {c as useMemoCache} from 'react-compiler-runtime';
-   * ```
-   */
-  runtimeModule?: string | null | undefined;
-
   /**
    * By default React Compiler will skip compilation of code that suppresses the default
    * React ESLint rules, since this is a strong indication that the code may be breaking React rules
@@ -214,7 +203,6 @@ export const defaultOptions: PluginOptions = {
   logger: null,
   gating: null,
   noEmit: false,
-  runtimeModule: null,
   eslintSuppressionRules: null,
   flowSuppressions: true,
   ignoreUseNoForget: false,

filename: compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/userspace-use-memo-cache.expect.md
patch: @@ -1,80 +0,0 @@
-
-## Input
-
-```javascript
-// @runtimeModule="react-compiler-runtime"
-import {useState} from 'react';
-
-function Component(props) {
-  const [x, setX] = useState(1);
-  let y;
-  if (props.cond) {
-    y = x * 2;
-  }
-  return (
-    <button
-      onClick={() => {
-        setX(10 * y);
-      }}>
-      Click me
-    </button>
-  );
-}
-
-export const FIXTURE_ENTRYPOINT = {
-  fn: Component,
-  params: [true],
-  isComponent: true,
-};
-
-```
-
-## Code
-
-```javascript
-import { c as _c } from "react/compiler-runtime"; // @runtimeModule="react-compiler-runtime"
-import { useState } from "react";
-
-function Component(props) {
-  const $ = _c(5);
-  const [x, setX] = useState(1);
-  let y;
-  if ($[0] !== props.cond || $[1] !== x) {
-    if (props.cond) {
-      y = x * 2;
-    }
-    $[0] = props.cond;
-    $[1] = x;
-    $[2] = y;
-  } else {
-    y = $[2];
-  }
-
-  const t0 = y;
-  let t1;
-  if ($[3] !== t0) {
-    t1 = (
-      <button
-        onClick={() => {
-          setX(10 * y);
-        }}
-      >
-        Click me
-      </button>
-    );
-    $[3] = t0;
-    $[4] = t1;
-  } else {
-    t1 = $[4];
-  }
-  return t1;
-}
-
-export const FIXTURE_ENTRYPOINT = {
-  fn: Component,
-  params: [true],
-  isComponent: true,
-};
-
-```
-      
\ No newline at end of file

filename: compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/userspace-use-memo-cache.js
patch: @@ -1,24 +0,0 @@
-// @runtimeModule="react-compiler-runtime"
-import {useState} from 'react';
-
-function Component(props) {
-  const [x, setX] = useState(1);
-  let y;
-  if (props.cond) {
-    y = x * 2;
-  }
-  return (
-    <button
-      onClick={() => {
-        setX(10 * y);
-      }}>
-      Click me
-    </button>
-  );
-}
-
-export const FIXTURE_ENTRYPOINT = {
-  fn: Component,
-  params: [true],
-  isComponent: true,
-};

filename: compiler/packages/snap/src/compiler.ts
patch: @@ -48,7 +48,6 @@ function makePluginOptions(
   let enableEmitFreeze = null;
   let enableEmitHookGuards = null;
   let compilationMode: CompilationMode = 'all';
-  let runtimeModule = null;
   let panicThreshold: PanicThresholdOptions = 'all_errors';
   let hookPattern: string | null = null;
   // TODO(@mofeiZ) rewrite snap fixtures to @validatePreserveExistingMemo:false
@@ -104,10 +103,6 @@ function makePluginOptions(
       importSpecifierName: '$dispatcherGuard',
     };
   }
-  const runtimeModuleMatch = /@runtimeModule="([^"]+)"/.exec(firstLine);
-  if (runtimeModuleMatch) {
-    runtimeModule = runtimeModuleMatch[1];
-  }
 
   const targetMatch = /@target="([^"]+)"/.exec(firstLine);
   if (targetMatch) {
@@ -251,7 +246,6 @@ function makePluginOptions(
     gating,
     panicThreshold,
     noEmit: false,
-    runtimeModule,
     eslintSuppressionRules,
     flowSuppressions,
     ignoreUseNoForget,