mirror of
https://github.com/hanzoai/swc.git
synced 2026-10-30 19:42:53 +00:00
## Summary
This PR completes the remaining Flow strip parser gap for `declare
export default interface ...`.
### What changed
- Added a Flow-specific `declare export default` branch for `interface`
in `swc_ecma_parser`.
- Parses `declare export default interface Foo { ... }` as
`Decl::TsInterface`, then marks it `declare` via the existing
`make_decl_declare` path.
- Kept existing fallback behavior for `declare export default <type>;`
unchanged.
- Added a new parser fixture suite:
-
`crates/swc_ecma_parser/tests/flow/declare-export-default-interface/basic.js`
- Extended flow-strip e2e fixture input:
- `crates/swc/tests/fixture/flow-strip/input/index.js`
## Scope notes
- Intentionally **not** changing behavior for:
- `declare export default opaque type ...`
- semicolon-separated declare-export specifier lists like `declare
export { Foo; Bar }`
## Testing
- `git submodule update --init --recursive`
- `UPDATE=1 cargo test -p swc_ecma_parser --test flow --features flow --
--ignored`
- `cargo test -p swc_ecma_parser --test flow --features flow --
--ignored`
- `UPDATE=1 cargo test -p swc --test projects -F flow -- --ignored
flow_strip`
- `cargo test -p swc --test projects -F flow -- --ignored flow_strip`
- `cargo fmt --all`
- `cargo clippy --all --all-targets -- -D warnings`
- `cargo test -p swc_ecma_parser`
- `cargo test -p swc` *(fails in `source_map` tests in this environment
due missing Node module `sourcemap-validator`)*