Skip to content

fix(run): route tsconfig override into runtime resolution #97

Description

@speak-agent

环境

  • OS/架构: Linux x86_64
  • mcpp/工具链: mcpp 2026.7.31.1, GCC 16 lane toolchain
  • mbun 版本: mbun 2026.07.18.0; Bun 1.3.14 compatible; Node v26.3.0 compatible
  • 基线: W43 pre-Wave-B binary at commit 0350565

复现步骤

Create an entry importing an alias whose valid mapping exists only in a non-nearest config, then invoke either valued spelling:

tools/integration/safe-test.sh 15 <mbun> run --tsconfig-override <tmp>/custom.json <tmp>/index.ts
tools/integration/safe-test.sh 15 <mbun> run --tsconfig-override=<tmp>/custom.json <tmp>/index.ts

Corpus reproduction:

tools/integration/safe-test.sh 30 <mbun> test compat/bun/test/cli/run/tsconfig-override.test.ts

期望 vs 实际

期望: both valued spellings are parsed, the config path is made absolute against the option-parse cwd, and that explicit config wins over nearest tsconfig.json lookup for every import. Existing baseUrl, paths, monorepo cwd, and extends behavior must be reused.

实际: the two-token form treats --tsconfig-override as the run target; the equals form treats the whole flag token as the target. The corpus file is 0 pass / 6 fail.

报错信息

error: Script not found "--tsconfig-override"
error: Module not found "--tsconfig-override=<config>"

初步分析

  • src/main.cpp has no valued run-flag arm for --tsconfig-override.
  • modules/jsc/src/runtime/engine.inc already loads, parses, caches, and follows extends for the nearest config, then passes TsconfigPaths into the existing resolver.
  • The missing piece is process-level runtime resolution context: publish one absolute override path before entry execution and make the existing config loader prefer it. A second CLI resolver or ad-hoc path substitution is unnecessary and unsafe.
  • The explicit path must be its own cache key and must not become relative to the entry/importing file.

相关资料

  • Upstream acceptance: compat/bun/test/cli/run/tsconfig-override.test.ts
  • Upstream parse/handoff: compat/bun/src/cli/Arguments.rs (tsconfig_override)
  • Upstream resolver option: compat/bun/src/bundler/options.rs
  • Existing mbun parser/resolver: modules/resolver/src/resolver.cppm
  • Existing mbun runtime config loader: modules/jsc/src/runtime/engine.inc

Parent sprint: #80

Metadata

Metadata

Assignees

No one assigned

    Labels

    AI 主导 | agent-led主要由 agent 完成 / mostly agent-authored缺陷 | bug修复缺陷 / bug fix

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions