Skip to content

test(runtime): guard tsx/esm→esbuild transform path on boot (#5757)#5773

Merged
diegosouzapw merged 1 commit into
release/v3.8.43from
test/tsx-runtime-transform-5757
Jul 1, 2026
Merged

test(runtime): guard tsx/esm→esbuild transform path on boot (#5757)#5773
diegosouzapw merged 1 commit into
release/v3.8.43from
test/tsx-runtime-transform-5757

Conversation

@diegosouzapw

Copy link
Copy Markdown
Owner

Addresses #5757 — a fresh npm install omniroute@3.8.42 pulls esbuild@0.28.1 transitively via tsx, and the reporter proposed forcing esbuild@0.27.4.

Why not the proposed override

overrides: { esbuild: "0.27.4" } is unsafe here:

  • tsx@4.22.4 declares esbuild@~0.28.0 and fumadocs-mdx@15 (also a runtime dependency) declares esbuild@^0.28.0. Forcing 0.27.x pushes esbuild below both ranges.
  • esbuild@0.28.1 is currently the latest release — there is no fixed 0.28.2 to pin up to.

Why the failure doesn't reproduce

The quoted error ("Transforming destructuring to the configured target environment is not supported yet") only fires when esbuild lowers to a pre-ES2015 target. In OmniRoute that path can't be reached on a supported runtime:

  • tsconfig target is ES2022 (destructuring is native → no lowering).
  • Minimum supported Node is 22.2 (bin/nodeRuntimeSupport.mjs) — all support destructuring.
  • tsx targets the running Node, not the tsconfig downlevel target (verified empirically: even a hostile target: es5 tsconfig transforms cleanly via tsx/esm on Node 24 with esbuild@0.28.1).

What this PR adds (a safe guard instead of a version pin)

tests/unit/tsx-runtime-transform-5757.test.ts + tests/unit/_fixtures/tsx-runtime-modern-syntax.ts:

  1. Functional guard — spawns the real node --import tsx/esm loader (exactly what bin/omniroute.mjs registers at boot) on a fixture packed with modern syntax (destructuring/spread, class + private fields, optional chaining, nullish, logical assignment, async + top-level await) and asserts it transforms + runs correctly. Fails loudly if a future esbuild regresses the boot path.
  2. Dependency-shape guard — asserts the resolved esbuild stays within tsx's declared range (self-maintaining: reads tsx's dependencies.esbuild), so nobody reintroduces the out-of-range override this issue proposed. Proven to catch 0.27.x.

No production code changed; no esbuild version pinned.

Validation

  • Both guards pass (node --import tsx/esm --test … → 2/2), and both proven to have teeth (dependency guard rejects 0.27.4/0.27.7; functional guard fails on non-zero child status).
  • typecheck:core clean · lint 0 errors · the _fixtures/ file is not matched by the test:unit glob.

Refs #5757 (kept open pending the reporter's actual error log / exact repro command — see issue comment).

#5757 reported that a fresh `npm install omniroute` pulls `esbuild@0.28.1`
transitively via `tsx` (a runtime dependency the CLI registers at boot in
`bin/omniroute.mjs`), and proposed forcing `esbuild@0.27.4`.

That override is unsafe: `tsx@4.22.4` requires `esbuild@~0.28.0` and
`fumadocs-mdx@15` (also a runtime dep) requires `esbuild@^0.28.0`; forcing 0.27.x
pushes esbuild below both, and 0.28.1 is currently the latest release. The
reported transform failure also does not reproduce — OmniRoute targets ES2022,
its minimum supported Node is 22.2 (destructuring is native), and tsx targets the
running Node, so esbuild never lowers to an unsupported target.

Instead of an unsafe version pin, add two regression guards:
- functional: spawn the real `node --import tsx/esm` loader on a fixture packed
  with modern syntax (destructuring/spread, class+private fields, optional
  chaining, nullish, logical assignment, async + top-level await) and assert it
  transforms + runs correctly. Fails if a future esbuild regresses the boot path.
- dependency-shape: assert the resolved esbuild stays within tsx's declared
  range, so nobody reintroduces the out-of-range override this issue proposed.

No production code changed; no esbuild version pinned.
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@diegosouzapw diegosouzapw merged commit 7522f6e into release/v3.8.43 Jul 1, 2026
4 of 7 checks passed
@diegosouzapw diegosouzapw deleted the test/tsx-runtime-transform-5757 branch July 1, 2026 19:24
@diegosouzapw diegosouzapw mentioned this pull request Jul 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant