Commit Graph

3 Commits

Author SHA1 Message Date
overlookmotel ef0f33eb7d test(all): run conformance with panic = "unwind" (#26260)
Conformance tests for `oxc_lexer` crate rely on using `catch_unwind` to catch panics and report them, rather than crashing the whole process. Currently this doesn't work because conformance is compiled with `panic = "abort"` (inherited from `release` profile).

This PR fixes that by adding `panic = "unwind"` to `coverage` profile.

I've measured the time it takes to run conformance locally before/after this change, and the difference is within noise (+/- 2%), so this seems to have no adverse effects.

`codegen-conformance` profile only existed to add `panic = "unwind"` too, so after this change it becomes identical to `coverage` profile. That makes it redundant, so this PR removes it in favour of just using `coverage` everywhere.
2026-09-03 10:59:04 +00:00
camc314 cd25e4f56e fix(codegen): surface conformance reference panics (#25552)
## Summary

Make Codegen conformance failures visible when the Rust reference panics.

- Preserve `null` for source text with parser diagnostics.
- Return a N-API error for a caught reference panic.
- Let Vitest fail the affected fixture instead of silently skipping it.
2026-08-12 17:09:00 +00:00
overlookmotel a4478e960a feat(codegen): add oxc-codegen package (#25488)
Add `oxc-codegen` package - a printer written in TS.

### Features

- Prints JS, JSX, TS, TSX.
- Matches `oxc_codegen` exactly on all Test262, TypeScript, Acorn-JSX fixtures.
- Very fast.

### Deficiencies

- Pretty-printing only (no compact/minified output).
- No support for printing comments.
- Source map support is semi-there, but largely untested, and poor API (design doc has some ideas on how to improve it).

### This PR adds

- The printer code.
- Conformance testing infra.
- Further tests for edge cases.
- README.
- Design doc - how it differs from `oxc_codegen` and why, what produces the perf.

### This PR doesn't add

- Not integrated into CI or release pipeline.

### Notes

This started as a slop port of `oxc_codegen`. I've iterated on that base, cleaned it up a lot, and at least skimmed through all of it. I think it's in fairly decent shape.

The design doc is I think worth a read. It explains the rationale for the choices, in particular the "1 codebase, 4 builds" approach.

I've put it in a new top-level directory called `packages`. It's not an app, so didn't seem to me to fit alongside `apps/oxlint` and `apps/oxfmt`. It's pure JS, so not like e.g. `napi/parser`. And it felt too heavyweight to put into `npm` dir. But maybe there's a better place for it.

Co-authored-by: Cameron <cameron.clark@hey.com>
2026-08-12 13:41:31 +00:00