Rename references to "forget" in playground
ghstack-source-id: fc2d58e4d5195c3ec157f65b3e1c94de39ff2070 Pull Request resolved: https://github.com/facebook/react-forget/pull/2836
Lauren Tan committed
Apr 10, 2024 at 17:46 UTC
9ae3e74c3e480f4fa433ed52344b5b049ed50706
6 files changed
+15
-18
compiler/apps/playground/.gitignore
-1
@@ -4,7 +4,6 @@
4
/node_modules
5
/.pnp
6
.pnp.js
7
-/forget
7
8
# testing
9
/coverage
compiler/apps/playground/app/index.tsx
+2
-2
@@ -17,8 +17,8 @@ const Home: NextPage = () => {
17
<Head>
18
<title>
19
{process.env.NODE_ENV === "development"
20
- ? "[DEV] React Forget Playground"
21
- : "React Forget Playground"}
20
+ ? "[DEV] React Compiler Playground"
21
+ : "React Compiler Playground"}
22
</title>
23
<meta
24
name="viewport"
compiler/apps/playground/app/layout.tsx
+3
-3
@@ -12,14 +12,14 @@ export default function RootLayout({
12
}: {
13
children: React.ReactNode;
14
}) {
15
- "use no forget";
15
+ "use no memo";
16
return (
17
<html lang="en">
18
<head>
19
<title>
20
{process.env.NODE_ENV === "development"
21
- ? "[DEV] React Forget Playground"
22
- : "React Forget Playground"}
21
+ ? "[DEV] React Compiler Playground"
22
+ : "React Compiler Playground"}
23
</title>
24
<meta
25
name="viewport"
compiler/apps/playground/components/Editor/Input.tsx
+2
-3
@@ -5,14 +5,13 @@
5
* LICENSE file in the root directory of this source tree.
6
*/
7
8
-
8
import MonacoEditor, { loader, type Monaco } from "@monaco-editor/react";
9
import { CompilerErrorDetail } from "babel-plugin-react-forget/src";
10
import invariant from "invariant";
11
import type { editor } from "monaco-editor";
12
import * as monaco from "monaco-editor";
13
import { useEffect, useState } from "react";
15
-import { renderForgetMarkers } from "../../lib/forgetMonacoDiagnostics";
14
+import { renderReactCompilerMarkers } from "../../lib/reactCompilerMonacoDiagnostics";
15
import { useStore, useStoreDispatch } from "../StoreContext";
16
import { monacoOptions } from "./monacoOptions";
17
// TODO: Make TS recognize .d.ts files, in addition to loading them with webpack.
@@ -36,7 +35,7 @@ export default function Input({ errors }: Props) {
35
const uri = monaco.Uri.parse(`file:///index.js`);
36
const model = monaco.editor.getModel(uri);
37
invariant(model, "Model must exist for the selected input file.");
39
- renderForgetMarkers({ monaco, model, details: errors });
38
+ renderReactCompilerMarkers({ monaco, model, details: errors });
39
// N.B. that `tabSize` is a model property, not an editor property.
40
// So, the tab size has to be set per model.
41
model.updateOptions({ tabSize: 2 });
compiler/apps/playground/components/Header.tsx
+1
-1
@@ -58,7 +58,7 @@ export default function Header() {
58
process.env.NODE_ENV === "development" && "text-yellow-600",
59
)}
60
/>
61
- <p className="hidden select-none sm:block">React Forget Playground</p>
61
+ <p className="hidden select-none sm:block">React Compiler Playground</p>
62
</div>
63
<div className="flex items-center text-[15px] gap-4">
64
<button
compiler/apps/playground/lib/reactCompilerMonacoDiagnostics.ts
renamed
+7
-8
@@ -5,7 +5,6 @@
5
* LICENSE file in the root directory of this source tree.
6
*/
7
8
-
8
import { Monaco } from "@monaco-editor/react";
9
import {
10
CompilerErrorDetail,
@@ -13,7 +12,7 @@ import {
12
} from "babel-plugin-react-forget/src";
13
import { MarkerSeverity, type editor } from "monaco-editor";
14
16
-function mapForgetSeverityToMonaco(
15
+function mapReactCompilerSeverityToMonaco(
16
level: ErrorSeverity,
17
monaco: Monaco,
18
): MarkerSeverity {
@@ -25,14 +24,14 @@ function mapForgetSeverityToMonaco(
24
}
25
}
26
28
-function mapForgetDiagnosticToMonacoMarker(
27
+function mapReactCompilerDiagnosticToMonacoMarker(
28
detail: CompilerErrorDetail,
29
monaco: Monaco,
30
): editor.IMarkerData | null {
31
if (detail.loc == null || typeof detail.loc === "symbol") {
32
return null;
33
}
35
- const severity = mapForgetSeverityToMonaco(detail.severity, monaco);
34
+ const severity = mapReactCompilerSeverityToMonaco(detail.severity, monaco);
35
let message = detail.printErrorMessage();
36
return {
37
severity,
@@ -44,20 +43,20 @@ function mapForgetDiagnosticToMonacoMarker(
43
};
44
}
45
47
-type ForgetMarkerConfig = {
46
+type ReactCompilerMarkerConfig = {
47
monaco: Monaco;
48
model: editor.ITextModel;
49
details: CompilerErrorDetail[];
50
};
51
let decorations: string[] = [];
53
-export function renderForgetMarkers({
52
+export function renderReactCompilerMarkers({
53
monaco,
54
model,
55
details,
57
-}: ForgetMarkerConfig): void {
56
+}: ReactCompilerMarkerConfig): void {
57
let markers = [];
58
for (const detail of details) {
60
- const marker = mapForgetDiagnosticToMonacoMarker(detail, monaco);
59
+ const marker = mapReactCompilerDiagnosticToMonacoMarker(detail, monaco);
60
if (marker == null) {
61
continue;
62
}