feat(tsconfig): expose outDir, declarationDir, resolveJsonModule, checkJs#1257
Conversation
…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 Report❌ Patch coverage is
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. 🚀 New features to boost your workflow:
|
Merging this PR will not alter performance
Warning Please fix the performance issues or acknowledge them on CodSpeed. Performance Changes
Tip Investigate this regression by commenting Comparing Footnotes
|
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.
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`.
Merge activity
|
There was a problem hiding this comment.
💡 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".
| 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); |
There was a problem hiding this comment.
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 👍 / 👎.
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`.
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`.
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`.
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`.
## 🤖 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>
Expose four
compilerOptionsfields on the publicCompilerOptionsso downstream crates can read them from a parsedTsConfig:out_dir,declaration_dir— normalized (with${configDir}support) inparse()andbuild(), mirroring howbase_url/root_dirsare 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 (newpubfields on a struct that already has private#[serde(skip)]fields). Adds unit + fixture tests.Motivation
The experimental
oxc_type_checkercrate needs these to enumerate a project's files the waytscdoes:outDir/declarationDirfeed the defaultexclude, andresolveJsonModule/checkJsdecide whether.json/.jsare in scope.