deno
786457cc - feat: support sync-types without node_modules (#35966)

Commit
21 hours ago
feat: support sync-types without node_modules (#35966) `deno sync-types` generates a stock `tsconfig.json` and type mappings so stock and native TypeScript tooling (tsc, tsgo, editors) can type-check a Deno project. Until now it required a local `node_modules` for npm dependency types. This makes it work in global-cache mode (`nodeModulesDir: "none"`) as well, without materializing a `node_modules` tree. In global-cache mode each resolved npm package copy gets a generated TypeScript project under `.deno/npm/` whose `paths` map the copy's dependency aliases to the exact cache folders selected by Deno's npm snapshot. The root config references these projects, so TypeScript's project-reference redirects reproduce Deno's per-referrer resolution for duplicate versions and peer-dependency copies without a node_modules tree. JSR and Node-compat types live under `.deno/npm-compat`, http(s) modules are mirrored under `.deno/remote`, and every generated config carries a `_deno_generated` sentinel so Deno ignores them in its own tsconfig graph (keeping repeated runs idempotent). `deno sync-types` also now accepts file/directory arguments to scope dependency discovery to those module-graph roots. JSR specifiers map to the generated `.d.ts` declaration, falling back to the `.ts` source only when no declaration is shipped, so tsc doesn't type-check dependency sources; and per-package projects resolve a dependency's subpath imports through its `package.json` `exports` map rather than a literal wildcard. Generated configs are machine-specific (they embed absolute cache paths) and must be regenerated after moving the project, changing `DENO_DIR`, or changing dependency resolution. --------- Co-authored-by: Bartek IwaƄczuk <biwanczuk@gmail.com>
Author
Parents
Loading