oxc/tasks/transform_conformance
Dunqing f1fcdde593 feat(transformer): support react fast refresh (#4587)
close: #3943

## Further improvements

There is a double visit here. We need to collect all react hooks calling in `Function` and `ArrowFunctionExpression`. If we want to remove this implementation, we may wait for #4188.

d797e595d2/crates/oxc_transformer/src/react/refresh.rs (L744-L947)

## Tests

All tests copy from https://github.com/facebook/react/blob/main/packages/react-refresh/src/__tests__/ReactFresh-test.js

There are still 4 tests that have not been passed

**1. refresh/can-handle-implicit-arrow-returns/input.jsx**

Related to #4767. transform correct, just output doesn't match the expected output

**2. refresh/registers-identifiers-used-in-jsx-at-definition-site/input.jsx**
**3. refresh/registers-identifiers-used-in-react-create-element-at-definition-site/input.jsx**

Blocked by #4746

**4. refresh/supports-typescript-namespace-syntax/input.tsx**

oxc transforms ts to js first, so probably we can ignore this case. If we really want to pass this test, we also need to turn off `TypeScript` plugin.

## What's next?

### Options:

1. Support transform `refresh_reg` and `refresh_sig` options to `MemberExpression`. Currently `import.meta.xxxx` still is an `Identifier`
2. Support `emit_full_signatures` option

### Other
NAPI, testing in `monitor-oxc`, etc..
2024-08-15 16:41:30 +00:00
..
src feat(transformer): support logical-assignment-operators plugin (#4890) 2024-08-15 10:10:36 +00:00
tests feat(transformer): support react fast refresh (#4587) 2024-08-15 16:41:30 +00:00
babel.snap.md feat(transformer): support logical-assignment-operators plugin (#4890) 2024-08-15 10:10:36 +00:00
babel_exec.snap.md feat(transformer): support logical-assignment-operators plugin (#4890) 2024-08-15 10:10:36 +00:00
Cargo.toml feat(transformer_conformance): test ScopeTree and SymbolTable for correctness after transformation (#4581) 2024-08-04 11:45:10 +00:00
oxc.snap.md feat(transformer): support react fast refresh (#4587) 2024-08-15 16:41:30 +00:00
oxc_exec.snap.md chore: bump test262, babel and TypeScript submodules (#3644) 2024-06-12 18:42:32 +08:00
README.md feat(transformer_conformance): use bun to run babel exec.js test cases (#1012) 2023-10-25 03:06:07 +00:00
typescript.snap.md chore: remove trailing whitespaces for all files; add .editorconfig (#3639) 2024-06-12 15:47:26 +08:00

Transformation Conformance Test Runner

Execution

This test runner uses the transformation plugin test suite from the babel repository.

The failing test cases are listed in ./babel.snap.md

To get started, run

cargo run -p oxc_transform_conformance

or watch for changes

just watch 'run -p oxc_transform_conformance'

Options

--filter

To filter for a specific test case, apply the --filter path option, e.g.

cargo run -p oxc_transform_conformance -- --filter react/arrow-functions

--exec

The babel test suite contains many exec.js files, they need to be executed by a runtime.

Bun is the preferred way to execute these tests, which you may install them via https://bun.sh/docs/installation.

Once bun is installed, apply the --exec flag:

cargo run -p oxc_transform_conformance -- --exec

The failing test cases are listed in ./babel_exec.snap.md.