mirror of
https://github.com/danbulant/oxc
synced 2026-05-19 20:28:58 +00:00
An alternative version of #6177. Convert `ModuleImports` into a common transform. Works much as before, but it inserts `import` / `require` statements by passing them to `TopLevelStatements` common transform, so they get inserted in one go with any other inserted top-level statements. This avoids shuffling up the `Vec<Statement>` multiple times, which can be slow with large files. `VarDeclarations` also inserts any declarations via `TopLevelStatements` but runs after `ModuleImports`, so can control whether a `var` statement is inserted before or after `import` statements by inserting it via `VarDeclarations` (to appear after `import` statements) or directly into `TopLevelStatements` (to appear before `import` statements). Insertion order is not actually important, but allows us to match Babel's output and pass its tests. |
||
|---|---|---|
| .. | ||
| misc | ||
| snapshots | ||
| src | ||
| Cargo.toml | ||
| README.md | ||
Coverage
Tools are tested against test262, babel and TypeScript for conformance.
Clone the test repositories beforehand:
just submodules
Development
# full run
cargo coverage
cargo coverage js # for test262
cargo coverage babel # for babel
cargo coverage ts # for typescript
# run in watch
cargo watch -x 'coverage js'
# filter for a file path
cargo watch -x 'coverage js --filter filter-file-path'
# find crash scene by turning off rayon and print out the test cases in serial
cargo coverage -- --debug
# Run after submodules are updated
UPDATE_SNAPSHOT=1 just c