mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Rename {r,R}unReactForgetBabelPlugin
ghstack-source-id: e7f00aab61dd749dc6ba11ce7e4d14603bfeeab9 Pull Request resolved: https://github.com/facebook/react-forget/pull/2928
This commit is contained in:
-7
@@ -1,10 +1,3 @@
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/// <reference types="next" />
|
||||
/// <reference types="next/image-types/global" />
|
||||
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
|
||||
const { tests } = require("./eslint-plugin-react-hooks-test-cases");
|
||||
const {
|
||||
runReactForgetBabelPlugin,
|
||||
} = require("../dist/Babel/RunReactForgetBabelPlugin");
|
||||
runBabelPluginReactCompiler,
|
||||
} = require("../dist/Babel/RunReactCompilerBabelPlugin");
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
const prettier = require("prettier");
|
||||
@@ -45,14 +45,19 @@ for (const fixture of fixtures) {
|
||||
let passes = true;
|
||||
try {
|
||||
// Does the fixture pass with hooks validation disabled? if not skip it
|
||||
runReactForgetBabelPlugin(fixture.code, "rules-of-hooks.js", "typescript", {
|
||||
environment: {
|
||||
validateHooksUsage: false,
|
||||
},
|
||||
});
|
||||
runBabelPluginReactCompiler(
|
||||
fixture.code,
|
||||
"rules-of-hooks.js",
|
||||
"typescript",
|
||||
{
|
||||
environment: {
|
||||
validateHooksUsage: false,
|
||||
},
|
||||
}
|
||||
);
|
||||
// Does the fixture pass with hooks validation enabled?
|
||||
try {
|
||||
runReactForgetBabelPlugin(
|
||||
runBabelPluginReactCompiler(
|
||||
fixture.code,
|
||||
"rules-of-hooks.js",
|
||||
"typescript",
|
||||
|
||||
+1
-1
@@ -13,7 +13,7 @@ import type { PluginOptions } from "../Entrypoint";
|
||||
import ReactForgetBabelPlugin from "./BabelPlugin";
|
||||
|
||||
export const DEFAULT_PLUGINS = ["babel-plugin-fbt", "babel-plugin-fbt-runtime"];
|
||||
export function runReactForgetBabelPlugin(
|
||||
export function runBabelPluginReactCompiler(
|
||||
text: string,
|
||||
file: string,
|
||||
language: "flow" | "typescript",
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
import * as t from "@babel/types";
|
||||
import invariant from "invariant";
|
||||
import { runReactForgetBabelPlugin } from "../Babel/RunReactForgetBabelPlugin";
|
||||
import { runBabelPluginReactCompiler } from "../Babel/RunReactCompilerBabelPlugin";
|
||||
import type { Logger, LoggerEvent } from "../Entrypoint";
|
||||
|
||||
it("logs succesful compilation", () => {
|
||||
@@ -18,7 +18,7 @@ it("logs succesful compilation", () => {
|
||||
},
|
||||
};
|
||||
|
||||
const _ = runReactForgetBabelPlugin(
|
||||
const _ = runBabelPluginReactCompiler(
|
||||
"function Component(props) { return <div>{props}</div> }",
|
||||
"test.js",
|
||||
"flow",
|
||||
@@ -43,7 +43,7 @@ it("logs failed compilation", () => {
|
||||
};
|
||||
|
||||
expect(() => {
|
||||
runReactForgetBabelPlugin(
|
||||
runBabelPluginReactCompiler(
|
||||
"function Component(props) { props.foo = 1; return <div>{props}</div> }",
|
||||
"test.js",
|
||||
"flow",
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
export { runReactForgetBabelPlugin } from "./Babel/RunReactForgetBabelPlugin";
|
||||
export { runBabelPluginReactCompiler } from "./Babel/RunReactCompilerBabelPlugin";
|
||||
export {
|
||||
CompilerError,
|
||||
CompilerErrorDetail,
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
import {
|
||||
ErrorSeverity,
|
||||
runReactForgetBabelPlugin,
|
||||
runBabelPluginReactCompiler,
|
||||
type CompilerErrorDetailOptions,
|
||||
type PluginOptions,
|
||||
} from "babel-plugin-react-compiler/src";
|
||||
@@ -65,7 +65,7 @@ function isActionableDiagnostic(detail: CompilerErrorDetailOptions) {
|
||||
|
||||
function compile(sourceCode: string, filename: string) {
|
||||
try {
|
||||
runReactForgetBabelPlugin(
|
||||
runBabelPluginReactCompiler(
|
||||
sourceCode,
|
||||
filename,
|
||||
"typescript",
|
||||
|
||||
Reference in New Issue
Block a user