Skip to content

refactor(codemode): route transpilation through a #transpile conditional import - #42121

Merged
kitlangton merged 1 commit into
v2from
codemode-transpile-condition
Aug 12, 2026
Merged

refactor(codemode): route transpilation through a #transpile conditional import#42121
kitlangton merged 1 commit into
v2from
codemode-transpile-condition

Conversation

@kitlangton

Copy link
Copy Markdown
Contributor

What / Why

Runtimes bundled with the workerd condition cannot carry the TypeScript transpiler dependency: the compiler is large and probes Node internals during module initialization.

Route interpreter transpilation through a #transpile conditional import. Node and Bun resolve the extracted TypeScript implementation, preserving the existing path byte-for-byte, while workerd bundles resolve an inert variant that passes JavaScript through without importing the compiler. TypeScript-only syntax then fails at the interpreter parse boundary with a clear parse error.

This follows the #global-roots conditional-import precedent in packages/util from #41918.

Scope

  • Adds the #transpile package imports map in packages/codemode.
  • Extracts the existing Node/Bun transpilation implementation without changing its compiler options or diagnostic formatting.
  • Adds the workerd pass-through implementation.
  • Does not add TypeScript transpilation support to workerd.

Testing

  • bun run typecheck in packages/codemode
  • bun run test in packages/codemode (1,089 passing)
  • Push hook: bun turbo typecheck --concurrency=3 (32 packages passing)

@kitlangton
kitlangton enabled auto-merge (squash) August 12, 2026 19:40
@kitlangton
kitlangton merged commit 56197e6 into v2Aug 12, 2026
12 of 14 checks passed
@kitlangton
kitlangton deleted the codemode-transpile-condition branch August 12, 2026 19:43
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@kitlangton