You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
perf(egg-bin): boot TypeScript via @oxc-node/core instead of ts-node (#6007)
## Motivation
Every forked `egg-bin` CLI (and every `egg-bin dev/test/cov` child)
booted TypeScript through `ts-node/register` + a hardcoded `ts-node/esm`
`--loader`. ts-node is a JS-based TS compiler and the deprecated
`--loader` hook is slow to spin up — on Windows CI this loader startup
dominates the `Test bin` job (tens of seconds **per fork**, ~109 forks).
The rest of the repo already moved its runtime `.ts` transpilation to
`@oxc-node/core/register` (Rust/oxc) in #5965. This PR brings egg-bin in
line.
## What changed
- **`baseCommand.ts`** — default `--tscompiler` is now
`@oxc-node/core/register`. oxc installs **both** a CJS require hook (via
pirates) and an ESM `module.register()` hook from a single `--import`,
so:
- it is injected as one `--import` for CJS *and* ESM apps (its export is
`import`-only, so it is resolved through the package main rather than
CJS-resolved / `--require`d);
- ESM apps no longer get a separate `ts-node/esm` `--loader`.
- `tsconfig-paths/register` is still injected (oxc does not resolve
tsconfig `paths`).
- **Backward compatible**: legacy compilers keep their exact old path.
`--tscompiler=ts-node/register`, `@swc-node/register`,
`esbuild-register`, `pkg.egg.tscompiler` and `TS_COMPILER` all still
resolve a CJS register + the `ts-node/esm` ESM loader, unchanged.
`ts-node` stays a dependency for explicit opt-in.
- **`test/coffee.ts`** — the test harness forks the egg-bin CLI itself
via `--import @oxc-node/core/register` (this is the part that paid the
Windows tax).
- Help summary + the one assertion that pinned `ts-node/register`
updated; stale `ts-node/esm` comments refreshed.
- Add `@oxc-node/core` (`catalog:` → `^0.1.0`,
decorator-metadata-correct).
## Test evidence
Ran the full egg-bin suite **built, CI-style** (`build → vitest run`) on
both the pristine `next` (ts-node) and this branch (oxc), then diffed
the per-test pass/fail sets:
| | total | passed | failed | skipped |
|---|---|---|---|---|
| `next` (ts-node) | 125 | 86 | 0 | 39 |
| this PR (oxc) | 125 | 86 | 0 | 39 |
**Regressions: none. Test set: identical. Failures: none.**
Decorator-heavy fixtures, ESM/CJS apps, and the explicit `--tscompiler`
override tests all still pass. `tsgo` typecheck and `oxlint
--type-aware` clean.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
* **New Features**
* Updated TypeScript startup to use import-based runtime registration
via `@oxc-node/core/register`, and refreshed `--tscompiler` help text.
* Aligned forked TypeScript CLI startup to match the new runtime
registration approach.
* **Bug Fixes**
* Improved consistency across command, snapshot, and test flows for ESM
vs CommonJS loader behavior, with clearer snapshot messaging.
* **Tests**
* Added Vitest coverage for the legacy (non-oxc) `--tscompiler`
initialization path with environment isolation.
* Updated related help-text/comment expectations.
* **Chores**
* Updated tooling/template dependencies and refreshed Windows CI
concurrency guidance (no behavior change).
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
---------
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
0 commit comments