Files
96c05e5602 feat: add DTS resolver matching TypeScript's bundler mode (#997)
## Summary

- Add `resolve_dts()` method to `ResolverGeneric` implementing
TypeScript's `ts.resolveModuleName` with `moduleResolution: "bundler"`
algorithm
- Two-pass `node_modules` walk: all ancestors for TS/DTS + `@types`
before trying JS — fixes the fundamental algorithmic difference that JS
workarounds can't address
- `@types` scoped name mangling (`@babel/core` → `@types/babel__core`)
- TypeScript extension substitution (`.js` → `.ts`, `.d.ts`) following
TS priority order
- `typesVersions` package.json field support
- `exports` field absolute priority (blocks `types`/`typings`/`main`
when present)
- NAPI bindings: `resolveDtsSync` / `resolveDtsAsync`
- 20 test cases covering relative resolution, extension
substitution/priority, directory modules, `@types`, exports,
`typesVersions`, `typings` field, and name mangling

Closes #549

Co-authored-by: Hanzo Dev <[email protected]>
2026-02-24 16:15:12 +08:00

2 lines
23 B
JSON