Scaffold workspaces

![image](https://github.com/facebook/react-forget/assets/1390709/bb27e33f-6a88-4b71-8ce2-aeb8db0372f7) 

This is an attempt to scaffold yarn workspaces into our repo with as minimal as 
possible changes to our current setup and directory structure. Essentially this 
PR moves current `src` into `packages/babel-plugin-react-forget` as a first step 
to keep everything working. Later on when we're ready we can split out a 
`react-compiler` package that is decoupled from Babel, but it's too early for 
that now
This commit is contained in:
Lauren Tan
2023-06-05 13:35:39 -04:00
parent 3744930728
commit 40d1459115
1193 changed files with 4117 additions and 314 deletions
+5 -7
View File
@@ -17,15 +17,13 @@ jobs:
cache-dependency-path: forget/yarn.lock
- run: yarn install --immutable --immutable-cache
working-directory: forget
- run: yarn prettier:ci
- run: yarn workspace babel-plugin-react-forget run prettier:ci
working-directory: forget
- run: yarn build
- run: yarn workspace babel-plugin-react-forget run build
working-directory: forget
- run: yarn lint
- run: yarn workspace babel-plugin-react-forget run lint
working-directory: forget
- run: yarn test
- run: yarn workspace babel-plugin-react-forget run test
working-directory: forget
- run: yarn install --immutable --immutable-cache
working-directory: forget/packages/snap
- run: yarn snap:build && yarn snap
- run: yarn workspace babel-plugin-react-forget run snap:build && yarn workspace babel-plugin-react-forget run snap
working-directory: forget
+1 -1
View File
@@ -18,7 +18,7 @@ jobs:
cache-dependency-path: forget/yarn.lock
- run: yarn install --immutable --immutable-cache
working-directory: forget
- run: yarn build
- run: yarn workspace babel-plugin-react-forget run build
working-directory: forget
- id: test262
name: Run test262
+13 -70
View File
@@ -1,80 +1,23 @@
{
"name": "babel-plugin-react-forget",
"version": "0.0.1",
"description": "Babel plugin for React Forget.",
"main": "dist/index.js",
"license": "MIT",
"files": [
"src"
],
"scripts": {
"build": "rimraf dist && tsc",
"bundle:meta": "scripts/bundle-meta.sh",
"dev": "concurrently --kill-others \"tsc --watch\" \"yarn:playground\"",
"hash": "scripts/hash-dist.sh",
"playground": "cd packages/playground && yarn && yarn dev",
"test": "tsc && jest",
"snap": "node packages/snap/dist/main.js",
"snap:build": "cd packages/snap && yarn build",
"ts:analyze-trace": "scripts/ts-analyze-trace.sh",
"test262": "yarn run --silent test262-harness --preprocessor=scripts/test262-preprocessor.js",
"test262:all": "yarn run --silent test262 'test262/test/**/*.js'",
"test262:ci": "scripts/test262.sh",
"prettier": "node ./scripts/prettier.js write-changed",
"prettier:all": "node ./scripts/prettier.js write",
"prettier:ci": "prettier --check .",
"lint": "yarn eslint src"
"private": true,
"workspaces": {
"packages": ["packages/*"],
"nohoist": ["**/next", "**/next/**"]
},
"repository": {
"type": "git",
"url": "git+https://github.com/facebook/react-forget.git"
},
"dependencies": {
"@babel/generator": "7.2.0",
"@babel/plugin-syntax-jsx": "^7.18.6",
"@babel/types": "^7.19.0",
"chalk": "4",
"invariant": "^2.2.4",
"prettier": "2.7.1",
"pretty-format": "^24"
"scripts": {
"start": "yarn workspace playground run start",
"next": "yarn workspace playground run dev",
"build": "yarn workspaces run build",
"dev": "concurrently --kill-others \"yarn workspace babel-plugin-react-forget run tsc --watch\" \"yarn workspace playground run dev\"",
"snap": "yarn workspace babel-plugin-react-forget run snap",
"snap:build": "yarn workspace snap run build"
},
"dependencies": {},
"devDependencies": {
"@babel/core": "^7.19.1",
"@babel/parser": "^7.19.1",
"@babel/plugin-syntax-typescript": "^7.18.6",
"@babel/plugin-transform-block-scoping": "^7.18.9",
"@babel/plugin-transform-modules-commonjs": "^7.18.6",
"@babel/preset-react": "^7.18.6",
"@babel/preset-typescript": "^7.18.6",
"@babel/traverse": "^7.19.1",
"@testing-library/react": "^13.4.0",
"@tsconfig/node16-strictest": "^1.0.3",
"@types/glob": "^8.1.0",
"@types/invariant": "^2.2.35",
"@types/jest": "^29.0.3",
"@types/node": "^18.7.18",
"@typescript-eslint/eslint-plugin": "^5.51.0",
"@typescript-eslint/parser": "^5.51.0",
"babel-jest": "^29.0.3",
"babel-plugin-fbt": "^1.0.0",
"babel-plugin-fbt-runtime": "^1.0.0",
"concurrently": "^7.4.0",
"eslint": "^8.33.0",
"glob": "^7.1.6",
"jest": "^29.0.3",
"jest-environment-jsdom": "^29.0.3",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"rimraf": "^3.0.2",
"test262-harness": "^8.0.0",
"ts-jest": "^29.0.1",
"ts-node": "^10.9.1",
"typescript": "^5.1.0"
},
"resolutions": {
"./**/@babel/parser": "7.7.4",
"./**/@babel/types": "7.7.4",
"@babel/core": "7.2.0",
"@babel/traverse": "7.1.6"
"concurrently": "^7.4.0"
}
}
@@ -65,7 +65,7 @@ module.exports = {
parser: "@typescript-eslint/parser",
plugins: ["@typescript-eslint"],
root: true,
ignorePatterns: ["src/__tests__/**/*", "src/**/*.d.ts", "packages/**/*"],
ignorePatterns: ["src/__tests__/**/*", "src/**/*.d.ts"],
// If rules need to be disabled then the rule is insufficiently high signal
// and should be diasbled altogether or customized (in either case via a standalone PR)
@@ -0,0 +1,5 @@
**/dist
**/__tests__/fixtures/**/*.expect.md
**/__tests__/fixtures/**/*.flow.js
*.md
*.json
@@ -0,0 +1,73 @@
{
"name": "babel-plugin-react-forget",
"version": "0.0.1",
"description": "Babel plugin for React Forget.",
"main": "dist/index.js",
"license": "MIT",
"files": [
"src"
],
"scripts": {
"build": "rimraf dist && tsc",
"bundle:meta": "scripts/bundle-meta.sh",
"hash": "scripts/hash-dist.sh",
"test": "tsc && jest",
"snap": "node ../snap/dist/main.js",
"snap:build": "yarn workspace snap run build",
"ts:analyze-trace": "scripts/ts-analyze-trace.sh",
"test262": "yarn run --silent test262-harness --preprocessor=scripts/test262-preprocessor.js",
"test262:all": "yarn run --silent test262 '../../test262/test/**/*.js'",
"test262:ci": "scripts/test262.sh",
"prettier": "node ./scripts/prettier.js write-changed",
"prettier:all": "node ./scripts/prettier.js write",
"prettier:ci": "prettier --check .",
"lint": "yarn eslint src"
},
"dependencies": {
"@babel/generator": "7.2.0",
"@babel/plugin-syntax-jsx": "^7.18.6",
"@babel/types": "^7.19.0",
"chalk": "4",
"invariant": "^2.2.4",
"prettier": "2.7.1",
"pretty-format": "^24"
},
"devDependencies": {
"@babel/core": "^7.19.1",
"@babel/parser": "^7.19.1",
"@babel/plugin-syntax-typescript": "^7.18.6",
"@babel/plugin-transform-block-scoping": "^7.18.9",
"@babel/plugin-transform-modules-commonjs": "^7.18.6",
"@babel/preset-react": "^7.18.6",
"@babel/preset-typescript": "^7.18.6",
"@babel/traverse": "^7.19.1",
"@testing-library/react": "^13.4.0",
"@tsconfig/node16-strictest": "^1.0.3",
"@types/glob": "^8.1.0",
"@types/invariant": "^2.2.35",
"@types/jest": "^29.0.3",
"@types/node": "^18.7.18",
"@typescript-eslint/eslint-plugin": "^5.51.0",
"@typescript-eslint/parser": "^5.51.0",
"babel-jest": "^29.0.3",
"babel-plugin-fbt": "^1.0.0",
"babel-plugin-fbt-runtime": "^1.0.0",
"eslint": "^8.33.0",
"glob": "^7.1.6",
"jest": "^29.0.3",
"jest-environment-jsdom": "^29.0.3",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"rimraf": "^3.0.2",
"test262-harness": "^8.0.0",
"ts-jest": "^29.0.1",
"ts-node": "^10.9.1",
"typescript": "^5.1.0"
},
"resolutions": {
"./**/@babel/parser": "7.7.4",
"./**/@babel/types": "7.7.4",
"@babel/core": "7.2.0",
"@babel/traverse": "7.1.6"
}
}
@@ -3,11 +3,11 @@ set -eo pipefail
TMPFILE=$(mktemp /tmp/forget-test262-XXXXX)
yarn run --silent test262-harness \
yarn workspace babel-plugin-react-forget run --silent test262-harness \
--threads=10 \
--preprocessor=scripts/test262-preprocessor.js \
--reporter=json \
--reporter-keys=file,result \
'test262/test/**/*.js' >> $TMPFILE
'../../test262/test/**/*.js' >> $TMPFILE
jq '. | group_by(.result.pass,.result.message) | map({"pass": .[0].result.pass, "message": .[0].result.message, "count": length}) | tostring' $TMPFILE
@@ -5,10 +5,10 @@
* LICENSE file in the root directory of this source tree.
*/
import { Node, NodePath } from "@babel/traverse";
import { SourceLocation as BabelSourceLocation } from "@babel/types";
import { SourceLocation } from "./HIR";
import { ExtractClassProperties } from "./Utils/types";
import type { Node, NodePath } from "@babel/traverse";
import type { SourceLocation as BabelSourceLocation } from "@babel/types";
import type { SourceLocation } from "./HIR";
import type { ExtractClassProperties } from "./Utils/types";
import { assertExhaustive } from "./Utils/utils";
export enum ErrorSeverity {
@@ -1,5 +1,5 @@
import { NodePath } from "@babel/traverse";
import * as t from "@babel/types";
import type { NodePath } from "@babel/traverse";
import type * as t from "@babel/types";
import { CompilerError } from "../CompilerError";
import { GeneratedSource } from "./HIR";
@@ -30,7 +30,7 @@ export function findContextIdentifiers(
state.currentLambda.push(fn);
},
exit(
fn: NodePath<t.FunctionExpression>,
_fn: NodePath<t.FunctionExpression>,
state: FindContextIdentifierState
): void {
state.currentLambda.pop();
@@ -45,7 +45,7 @@ export function findContextIdentifiers(
state.currentLambda.push(fn);
},
exit(
fn: NodePath<t.ArrowFunctionExpression>,
_fn: NodePath<t.ArrowFunctionExpression>,
state: FindContextIdentifierState
): void {
state.currentLambda.pop();

Some files were not shown because too many files have changed in this diff Show More