mirror of
https://github.com/danbulant/oxc
synced 2026-05-24 20:32:10 +00:00
React JSX transform contains some confusing logic (ported directly from Babel) where in automatic mode, imports are inserted in one place, and then used in another. Logic for which imports are needed is duplicated in both places, and it's hard to figure out whether they're in sync or not (I don't think they are in all cases). This PR unifies the logic in one place. Imports are now added as and when they're used. The `Bindings` enum is responsible for creating imports and also holds the state of which "mode" the plugin is working in: 1. Classic 2. Automatic script 3. Automatic module Combining the two choices classic/automatic and script/module into a single enum: 1. clarifies the logic 2. reduces branching 3. reduces lookups on `ReactJsx::options` (which is behind an `Rc` and therefore costly to read from). |
||
|---|---|---|
| .. | ||
| oxc | ||
| oxc_allocator | ||
| oxc_ast | ||
| oxc_ast_macros | ||
| oxc_codegen | ||
| oxc_diagnostics | ||
| oxc_index | ||
| oxc_js_regex | ||
| oxc_language_server | ||
| oxc_linter | ||
| oxc_macros | ||
| oxc_minifier | ||
| oxc_module_lexer | ||
| oxc_parser | ||
| oxc_prettier | ||
| oxc_semantic | ||
| oxc_sourcemap | ||
| oxc_span | ||
| oxc_syntax | ||
| oxc_transformer | ||
| oxc_traverse | ||
| oxc_wasm | ||