mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
00a58cdab1
Adds a new compiler option `validateNoUseBeforeDefine`, which enables a
post-codegen pass to validate that there are no usages of values before they are
defined (which causes a ReferenceError at runtime). This can occur when a value
is accessed when its in the TDZ (temporary dead zone), after the hoisted
_declaration_ but before the variable is defined:
```javascript
function foo() {
x; // x is in the TDX here: the binding from the subsequent statement is
hoisted, but x is not yet defined.
let x;
}
```
* The validation is off by default, but enabled in transform-test
* The validation crashes compilation, rather than bailout, because the code has
already been mangled and we can't roll back at the point the validation runs.
* The validator uses ESLint's no-use-before-define rule by printing the program
to source and then configuring ESLint to use Hermes parser.
* transform-test now supports tests prefixed with "error." to indicate tests for
which compilation is expected to crash (not just bailout), and the expect file
includes the error message.
65 lines
1.9 KiB
JSON
65 lines
1.9 KiB
JSON
{
|
|
"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": "tsc && scripts/hash-dist.sh",
|
|
"bundle:meta": "scripts/bundle-meta.sh",
|
|
"dev": "concurrently \"yarn:build --watch\" \"yarn:playground\"",
|
|
"playground": "cd packages/playground && yarn && yarn dev",
|
|
"test": "yarn build && jest",
|
|
"ts:analyze-trace": "scripts/ts-analyze-trace.sh"
|
|
},
|
|
"repository": {
|
|
"type": "git",
|
|
"url": "git+https://github.com/huxpro/react-forget.git"
|
|
},
|
|
"dependencies": {
|
|
"@babel/generator": "7.2.0",
|
|
"@babel/plugin-syntax-jsx": "^7.18.6",
|
|
"@babel/types": "^7.19.0",
|
|
"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",
|
|
"@hpcc-js/wasm": "^1.15.0",
|
|
"@testing-library/react": "^13.4.0",
|
|
"@tsconfig/node16-strictest": "^1.0.3",
|
|
"@types/eslint": "^8.4.6",
|
|
"@types/invariant": "^2.2.35",
|
|
"@types/jest": "^29.0.3",
|
|
"@types/node": "^18.7.18",
|
|
"babel-jest": "^29.0.3",
|
|
"concurrently": "^7.4.0",
|
|
"eslint": "^8.25.0",
|
|
"hermes-eslint": "^0.9.0",
|
|
"jest": "^29.0.3",
|
|
"jest-environment-jsdom": "^29.0.3",
|
|
"react": "^18.2.0",
|
|
"react-dom": "^18.2.0",
|
|
"ts-jest": "^29.0.1",
|
|
"ts-node": "^10.9.1",
|
|
"typescript": "^4.8.3"
|
|
},
|
|
"resolutions": {
|
|
"./**/@babel/parser": "7.7.4",
|
|
"./**/@babel/types": "7.7.4",
|
|
"@babel/core": "7.2.0",
|
|
"@babel/traverse": "7.1.6"
|
|
}
|
|
}
|