oxc-project
oxc-resolver
BlogDocsChangelog

feat: implement tsconfig include/exclude/files matching

#790
Comparing
test/tsconfig-include-exclude
(
1fd4a65
) with
main
(
9de3088
)
CodSpeed Performance Gauge
0%
Untouched
10
Skipped
5

Benchmarks

Skipped (5)

parallel_batch_4_files
benches/resolver.rs::resolver::bench_package_json_deserialization::package_json_deserialization
Skipped
91.1 µs*
batch_4_files
benches/resolver.rs::resolver::bench_package_json_deserialization::package_json_deserialization
Skipped
78.6 µs*
resolver[resolve from symlinks]
benches/resolver.rs::resolver::bench_resolver
Skipped
61 ms*
resolver[multi-thread]
benches/resolver.rs::resolver::bench_resolver
Skipped
508.7 µs*
resolver[single-thread]
benches/resolver.rs::resolver::bench_resolver
Skipped
476.3 µs*

Passed

resolver_memory[multi-thread]
benches/resolver.rs::resolver::bench_resolver_memory
CodSpeed Performance Gauge
+4%
517.1 µs499.4 µs
resolver_memory[resolve from symlinks]
benches/resolver.rs::resolver::bench_resolver_memory
CodSpeed Performance Gauge
0%
61.3 ms61.2 ms
resolver_memory[single-thread]
benches/resolver.rs::resolver::bench_resolver_memory
CodSpeed Performance Gauge
0%
503.5 µs502.7 µs
resolver_real[resolve from symlinks]
benches/resolver.rs::resolver::bench_resolver_real
CodSpeed Performance Gauge
0%
61.5 ms61.4 ms
complex_real
benches/resolver.rs::resolver::bench_package_json_deserialization::package_json_deserialization
CodSpeed Performance Gauge
0%
23.4 µs23.4 µs
small
benches/resolver.rs::resolver::bench_package_json_deserialization::package_json_deserialization
CodSpeed Performance Gauge
0%
11.3 µs11.3 µs
resolver_real[single-thread]
benches/resolver.rs::resolver::bench_resolver_real
CodSpeed Performance Gauge
0%
502.8 µs504.2 µs
large
benches/resolver.rs::resolver::bench_package_json_deserialization::package_json_deserialization
CodSpeed Performance Gauge
0%
27.8 µs27.9 µs
medium
benches/resolver.rs::resolver::bench_package_json_deserialization::package_json_deserialization
CodSpeed Performance Gauge
0%
17.3 µs17.3 µs
resolver_real[multi-thread]
benches/resolver.rs::resolver::bench_resolver_real
CodSpeed Performance Gauge
-4%
526.1 µs545.9 µs

Commits

Click on a commit to change the comparison range
Base
main
9de3088
+0.17%
feat: implement tsconfig include/exclude filtering for path resolution Refactors tests to use full resolution flow and implements actual include/exclude filtering during module resolution. ## Changes ### Core Implementation (src/lib.rs) - Add include/exclude check in `load_tsconfig_paths()` before applying path mappings - Only check actual files, not directories (to support directory-based resolution) - If importer doesn't match tsconfig patterns, skip that tsconfig's path mappings ### File Matcher Creation (src/tsconfig/mod.rs) - Ensure file_matcher is always created for non-empty tsconfigs - Defaults to include: ["**/*"] when no patterns specified - All tsconfigs now have a file_matcher (except explicit empty case) ### Test Strategy (src/tests/tsconfig_include_exclude.rs) - Refactor from testing `matches_file()` directly to testing full `resolver.resolve()` - Verify path aliases work when importer is included - Verify path aliases don't work when importer is excluded - Test cases cover: include patterns, exclude patterns, default behavior ### Fixtures - Add imports to test fixtures (index.ts files) - Add path aliases (baseUrl/paths) to tsconfig.json files - Create helper.ts for exclude_basic fixture ## Testing All 158 tests pass, including new resolution-based include/exclude tests. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
2a6e0a9
7 days ago
by Boshen
+0.58%
test: add unit tests for TsconfigFileMatcher pattern matching Add comprehensive unit tests that directly test pattern matching logic in isolation, using the previously unused fixtures. ## Changes - Create `src/tests/tsconfig_file_matcher.rs` with 10 unit tests - Each test covers a specific pattern type: - `test_globstar_patterns` - Tests **/*.ts (matches at any depth) - `test_wildcard_patterns` - Tests src/*.ts (single level) - `test_character_set_patterns` - Tests [A-Z]*.ts (character ranges) - `test_complex_patterns` - Tests src/**/test/**/*.spec.ts (nested) - `test_monorepo_patterns` - Tests packages/*/src/**/* (monorepo) - `test_files_priority` - Tests files array overrides exclude - `test_outdir_exclude` - Tests automatic outDir exclusion - `test_absolute_patterns` - Tests absolute path handling - `test_configdir_syntax` - Tests ${configDir} template variable - `test_without_baseurl` - Tests default include/exclude - Helper function `create_matcher_from_fixture()` reads tsconfig.json and creates TsconfigFileMatcher with template substitution - All 10 fixtures that were created but unused are now tested - Total: 168 tests passing (10 new unit tests added) ## Benefits - Tests pattern matching in isolation (faster than integration tests) - Clear documentation of all supported pattern types - Better coverage of edge cases - Reuses existing fixture infrastructure 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
ee68d1a
7 days ago
by Boshen
-0.86%
fix: address PR review comments for tsconfig file matching - Fix critical bug in files array matching: normalize files in constructor and use exact match only (prevents false positives) - Fix include empty check: None should default to **/* not be treated as empty - Remove duplicate empty pattern check - Add tests for fixture files in dist/ and node_modules/ - Fix test assertions for extends inheritance and paths outside root - Update character set pattern test (TypeScript doesn't support [A-Z] syntax) - Fix outdir_exclude fixture to include .js and .d.ts files - Add test case verifying excluded dist directory cannot use path mappings 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1fd4a65
5 days ago
by Boshen
© 2025 CodSpeed Technology
Home Terms Privacy Docs