Skip to content

feat: walk up to discover parent tsconfig.json#569

Open
fengmk2 wants to merge 3 commits intooxc-project:mainfrom
fengmk2:feat/tsconfig-walk-up-discovery
Open

feat: walk up to discover parent tsconfig.json#569
fengmk2 wants to merge 3 commits intooxc-project:mainfrom
fengmk2:feat/tsconfig-walk-up-discovery

Conversation

@fengmk2
Copy link
Copy Markdown
Contributor

@fengmk2 fengmk2 commented Apr 24, 2026

When oxnode is run from a sub-project of a monorepo that has no local
tsconfig.json, previously the root workspace's tsconfig.json was
silently ignored. This made settings like experimentalDecorators
configured at the root inapplicable to sub-projects.

init_resolver now walks up cwd.ancestors() to find a tsconfig.json when:

  • neither TS_NODE_PROJECT nor OXC_TSCONFIG_PATH is set, and
  • cwd/tsconfig.json does not exist.

Explicit env var settings are still honored as-is, so a non-existent
path in TS_NODE_PROJECT/OXC_TSCONFIG_PATH disables discovery entirely
(escape hatch). Matches the behavior of tsc, ts-node, and tsx.

fengmk2 added 2 commits April 24, 2026 23:25
When oxnode is run from a sub-project of a monorepo that has no local
tsconfig.json, previously the root workspace's tsconfig.json was
silently ignored. This made settings like experimentalDecorators
configured at the root inapplicable to sub-projects.

init_resolver now walks up cwd.ancestors() to find a tsconfig.json when:
  - neither TS_NODE_PROJECT nor OXC_TSCONFIG_PATH is set, and
  - cwd/tsconfig.json does not exist.

Explicit env var settings are still honored as-is, so a non-existent
path in TS_NODE_PROJECT/OXC_TSCONFIG_PATH disables discovery entirely
(escape hatch). Matches the behavior of tsc, ts-node, and tsx.
…check

- Track tsconfig_exists inline with path resolution so the manual
  TsconfigDiscovery gate no longer re-stats the same path.
- Use Path::is_absolute() so an absolute TS_NODE_PROJECT/OXC_TSCONFIG_PATH
  on Windows (e.g. C:\\proj\\tsconfig.json) is not joined with cwd.
@fengmk2
Copy link
Copy Markdown
Contributor Author

fengmk2 commented Apr 24, 2026

@cursor review

@cursor
Copy link
Copy Markdown

cursor Bot commented Apr 24, 2026

Skipping Bugbot: Bugbot is disabled for this repository. Visit the Bugbot dashboard to update your settings.

The subprocess pattern used by this spec (`node --input-type=module -e`
with an inline `await import("@oxc-node/core")`) crashes when
NAPI_RS_FORCE_WASI=1 is inherited into the child — the forced-WASI
worker init fails inside a nested inline ESM script. The walk-up
logic itself is platform-agnostic and already exercised on every
native target in CI.
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