Skip to content

feat(tsconfig): expose outDir, declarationDir, resolveJsonModule, checkJs#1257

Merged
Boshen merged 2 commits into
mainfrom
expose-tsconfig-output-options
Jul 1, 2026
Merged

feat(tsconfig): expose outDir, declarationDir, resolveJsonModule, checkJs#1257
Boshen merged 2 commits into
mainfrom
expose-tsconfig-output-options

Conversation

@Boshen

@Boshen Boshen commented Jul 1, 2026

Copy link
Copy Markdown
Member

Expose four compilerOptions fields on the public CompilerOptions so downstream crates can read them from a parsed TsConfig:

  • out_dir, declaration_dir — normalized (with ${configDir} support) in parse() and build(), mirroring how base_url / root_dirs are handled.
  • resolve_json_module, check_js — plain booleans.

All four are inherited from a base config in extend_tsconfig(). The change is additive and non-breaking (new pub fields on a struct that already has private #[serde(skip)] fields). Adds unit + fixture tests.

Motivation

The experimental oxc_type_checker crate needs these to enumerate a project's files the way tsc does: outDir/declarationDir feed the default exclude, and resolveJsonModule/checkJs decide whether .json/.js are in scope.

…ckJs

Expose these four fields on `CompilerOptions` so downstream crates can read them from a parsed `TsConfig`:

- `out_dir`, `declaration_dir` are normalized (with `${configDir}` support) in `parse()` and `build()`, mirroring `base_url`/`root_dirs`.
- `resolve_json_module`, `check_js` are plain booleans.

All four are inherited from a base config in `extend_tsconfig()`. Adds unit and fixture tests.
@codecov

codecov Bot commented Jul 1, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 92.68293% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 93.87%. Comparing base (6d0e7af) to head (503ff20).
⚠️ Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
src/tsconfig.rs 92.68% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1257      +/-   ##
==========================================
- Coverage   93.88%   93.87%   -0.02%     
==========================================
  Files          21       21              
  Lines        4236     4277      +41     
==========================================
+ Hits         3977     4015      +38     
- Misses        259      262       +3     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@codspeed-hq

codspeed-hq Bot commented Jul 1, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

⚡ 1 improved benchmark
❌ 2 regressed benchmarks
✅ 18 untouched benchmarks
⏩ 5 skipped benchmarks1

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Benchmark BASE HEAD Efficiency
pm/bun-flat 877.5 µs 957.2 µs -8.33%
pm/pnpm-isolated 1 ms 1 ms -3.24%
pm/yarn-flat 943.5 µs 910.5 µs +3.63%

Tip

Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.


Comparing expose-tsconfig-output-options (503ff20) with main (5750c8b)

Open in CodSpeed

Footnotes

  1. 5 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

Fold the outDir/declarationDir/resolveJsonModule/checkJs assertions into
the existing comprehensive `test_extend_tsconfig` via the shared
`cases/extends` base fixture, and drop the three redundant tests plus
their two fixtures.

Also collapse the output-dir if-let nesting into let-chains to satisfy
clippy::collapsible_if.
@Boshen Boshen added the merge label Jul 1, 2026
Boshen added a commit to oxc-project/oxc that referenced this pull request Jul 1, 2026
Add an `oxc_tsc` binary (a `bpaf` CLI) that discovers a tsconfig.json (via `-p`/`--project`, or an upward search from the cwd) and prints the project's TypeScript files.

tsconfig parsing is delegated to `oxc_resolver::TsConfig`; the file matcher and enumeration are a faithful port of typescript-go:

- `tspath` / `extension`: path and extension helpers (internal/tspath)
- `vfsmatch`: regex-free glob matcher + directory walker (internal/vfs/vfsmatch)
- `tsconfig`: default include/exclude, spec validation, extension-priority dedup
- `project`: findConfigFile + `-p` resolution (internal/execute/tsc.go)

The outDir/declarationDir/resolveJsonModule/checkJs compiler options are read directly from the tsconfig text, since the published `oxc_resolver::CompilerOptions` does not expose them yet; this keeps the crate building against the released `oxc_resolver`. Once oxc-project/oxc-resolver#1257 ships they can be read from the parsed `TsConfig`.
@Boshen
Boshen marked this pull request as ready for review July 1, 2026 23:41

Boshen commented Jul 1, 2026

Copy link
Copy Markdown
Member Author

Merge activity

  • Jul 1, 11:41 PM UTC: The merge label 'merge' was detected. This PR will be added to the Graphite merge queue once it meets the requirements.
  • Jul 1, 11:41 PM UTC: Boshen added this pull request to the Graphite merge queue.

@Boshen
Boshen merged commit af3f527 into main Jul 1, 2026
18 checks passed
@Boshen
Boshen deleted the expose-tsconfig-output-options branch July 1, 2026 23:41
@oxc-guard oxc-guard Bot mentioned this pull request Jul 1, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 503ff20f99

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/tsconfig.rs
if let Some(out_dir) = &mut tsconfig.compiler_options.out_dir
&& !out_dir.to_string_lossy().starts_with(TEMPLATE_VARIABLE)
{
*out_dir = canonical_directory.normalize_with(&out_dir);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Resolve output dirs from the extends path

When a base tsconfig is reached through a symlink (the repo already has extends-symlink coverage for this case), canonical_directory is the real target directory, so outDir: './dist' is exposed as the target's dist. tsc --showConfig resolves outDir/declarationDir against the path used in the extends chain, and consumers use these fields for default excludes; with this normalization (and the same assignment for declarationDir below) they will exclude the wrong directory in symlinked shared-config setups.

Useful? React with 👍 / 👎.

Boshen added a commit to oxc-project/oxc that referenced this pull request Jul 1, 2026
Add an `oxc_tsc` binary (a `bpaf` CLI) that discovers a tsconfig.json (via `-p`/`--project`, or an upward search from the cwd) and prints the project's TypeScript files.

tsconfig parsing is delegated to `oxc_resolver::TsConfig`; the file matcher and enumeration are a faithful port of typescript-go:

- `tspath` / `extension`: path and extension helpers (internal/tspath)
- `vfsmatch`: regex-free glob matcher + directory walker (internal/vfs/vfsmatch)
- `tsconfig`: default include/exclude, spec validation, extension-priority dedup
- `project`: findConfigFile + `-p` resolution (internal/execute/tsc.go)

The outDir/declarationDir/resolveJsonModule/checkJs compiler options are read directly from the tsconfig text, since the published `oxc_resolver::CompilerOptions` does not expose them yet; this keeps the crate building against the released `oxc_resolver`. Once oxc-project/oxc-resolver#1257 ships they can be read from the parsed `TsConfig`.
Boshen added a commit to oxc-project/oxc that referenced this pull request Jul 2, 2026
Add an `oxc_tsc` binary (a `bpaf` CLI) that discovers a tsconfig.json (via `-p`/`--project`, or an upward search from the cwd) and prints the project's TypeScript files.

tsconfig parsing is delegated to `oxc_resolver::TsConfig`; the file matcher and enumeration are a faithful port of typescript-go:

- `tspath` / `extension`: path and extension helpers (internal/tspath)
- `vfsmatch`: regex-free glob matcher + directory walker (internal/vfs/vfsmatch)
- `tsconfig`: default include/exclude, spec validation, extension-priority dedup
- `project`: findConfigFile + `-p` resolution (internal/execute/tsc.go)

The outDir/declarationDir/resolveJsonModule/checkJs compiler options are read directly from the tsconfig text, since the published `oxc_resolver::CompilerOptions` does not expose them yet; this keeps the crate building against the released `oxc_resolver`. Once oxc-project/oxc-resolver#1257 ships they can be read from the parsed `TsConfig`.
Boshen added a commit to oxc-project/oxc that referenced this pull request Jul 2, 2026
Add an `oxc_tsc` binary (a `bpaf` CLI) that discovers a tsconfig.json (via `-p`/`--project`, or an upward search from the cwd) and prints the project's TypeScript files.

tsconfig parsing is delegated to `oxc_resolver::TsConfig`; the file matcher and enumeration are a faithful port of typescript-go:

- `tspath` / `extension`: path and extension helpers (internal/tspath)
- `vfsmatch`: regex-free glob matcher + directory walker (internal/vfs/vfsmatch)
- `tsconfig`: default include/exclude, spec validation, extension-priority dedup
- `project`: findConfigFile + `-p` resolution (internal/execute/tsc.go)

The outDir/declarationDir/resolveJsonModule/checkJs compiler options are read directly from the tsconfig text, since the published `oxc_resolver::CompilerOptions` does not expose them yet; this keeps the crate building against the released `oxc_resolver`. Once oxc-project/oxc-resolver#1257 ships they can be read from the parsed `TsConfig`.
Boshen added a commit to oxc-project/oxc that referenced this pull request Jul 2, 2026
Add an `oxc_tsc` binary (a `bpaf` CLI) that discovers a tsconfig.json (via `-p`/`--project`, or an upward search from the cwd) and prints the project's TypeScript files.

tsconfig parsing is delegated to `oxc_resolver::TsConfig`; the file matcher and enumeration are a faithful port of typescript-go:

- `tspath` / `extension`: path and extension helpers (internal/tspath)
- `vfsmatch`: regex-free glob matcher + directory walker (internal/vfs/vfsmatch)
- `tsconfig`: default include/exclude, spec validation, extension-priority dedup
- `project`: findConfigFile + `-p` resolution (internal/execute/tsc.go)

The outDir/declarationDir/resolveJsonModule/checkJs compiler options are read directly from the tsconfig text, since the published `oxc_resolver::CompilerOptions` does not expose them yet; this keeps the crate building against the released `oxc_resolver`. Once oxc-project/oxc-resolver#1257 ships they can be read from the parsed `TsConfig`.
Boshen pushed a commit that referenced this pull request Jul 2, 2026
## 🤖 New release

* `oxc_resolver`: 11.22.0 -> 11.23.0
* `oxc_resolver_napi`: 11.22.0 -> 11.23.0

<details><summary><i><b>Changelog</b></i></summary><p>

## `oxc_resolver`

<blockquote>

##
[11.23.0](v11.22.0...v11.23.0)
- 2026-07-02

### <!-- 0 -->🚀 Features

- *(tsconfig)* expose outDir, declarationDir, resolveJsonModule, checkJs
([#1257](#1257)) (by
@Boshen)

### <!-- 1 -->🐛 Bug Fixes

- *(exports)* propagate the last error in array target resolution
([#1267](#1267)) (by
@Boshen)

### <!-- 2 -->🚜 Refactor

- deduplicate cross-file helpers, drop stale lint allows
([#1269](#1269)) (by
@Boshen)
- *(dts)* deduplicate package entry selection and remove dead code
([#1266](#1266)) (by
@Boshen)
- *(tsconfig)* skip TsConfig deep clone for non-root configs
([#1265](#1265)) (by
@Boshen)
- *(alias)* compile fallback aliases once at construction
([#1264](#1264)) (by
@Boshen)

### <!-- 4 -->⚡ Performance

- *(alias)* scan a packed first-byte array instead of striding over
alias entries
([#1260](#1260)) (by
@Boshen)

### Contributors

* @Boshen
</blockquote>



</p></details>

---
This PR was generated with
[release-plz](https://github.com/release-plz/release-plz/).

Co-authored-by: oxc-guard[bot] <276638029+oxc-guard[bot]@users.noreply.github.com>
Sign up for free to 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