发布

  • fix(cli): unify virtual TypeScript compiler host resolution (#3182)

    frostbyte_neo 发布于 2026-06-24 14:28:45 +00:00

    Summary

    This PR resolves the TODO in
    ts/packages/cli/src/generation/typescript/transpile.ts by extracting
    the shared virtual TypeScript compiler-host logic used by both
    production transpilation and test validation.

    While doing that refactor, it also fixes a real virtual
    module-resolution issue: TypeScript may resolve in-memory files using
    ./file.ts, file.ts, or absolute paths, and the previous setup did
    not handle those lookups consistently.

    Changes

    • added
      ts/packages/cli/src/generation/typescript/virtual-compiler-host.ts
    • extracted shared helpers for virtual file-map creation, compiler-host
      patching, and diagnostic formatting
    • updated ts/packages/cli/src/generation/typescript/transpile.ts to
      use the shared helper
    • updated ts/packages/cli/test/__utils__/typescript-compiler.ts to use
      the same shared helper
    • updated affected tests to validate complete generated module sets
      instead of incomplete single-file inputs
    • added a patch changeset for @composio/cli

    Type of change

    • Bug fix
    • Refactor/Chore

    How Has This Been Tested?

    Ran focused checks on the touched CLI TypeScript
    generation/compiler-host paths:

    pnpm --dir ts/packages/cli exec prettier --check src/generation/typescript/transpile.ts src/generation/typescript/virtual-compiler-host.ts test/__utils__/typescript-compiler.ts test/src/generation/typescript/generate.test.ts test/src/commands/ts/ts.generate.cmd.test.ts
    pnpm --dir ts/packages/cli exec vitest run test/__utils__/typescript-compiler.ts
    pnpm --dir ts/packages/cli exec vitest run test/src/generation/typescript/generate.test.ts
    
    ---------
    
    Co-authored-by: Alberto Schiabel <jkomyno@users.noreply.github.com>
    Co-authored-by: jkomyno <alberto@composio.dev>
    
    下载附件