deno
5950fb4f - fix(publish): vite import.meta.hot not type checking (#32127)

Commit
230 days ago
fix(publish): vite import.meta.hot not type checking (#32127) Ambient types from `compilerOptions.types` need to be available during `deno publish` type checking. ## Problem `create_publish_graph()` passes `imports: Vec::new()`, excluding all tsconfig imports. The `to_graph_imports()` method on `CompilerOptionsResolver` includes both: 1. `tsconfig.json` `files` entries (should be excluded from publish) 2. `compilerOptions.types` entries (should be included for type checking) By excluding everything, ambient types from `compilerOptions.types` are unavailable during publish's type checking, causing errors for code that depends on type augmentations (e.g. Vite's `import.meta.hot`). ## Solution - Add `to_compiler_options_types_imports()` on `CompilerOptionsResolver` that returns only `compilerOptions.types` entries, excluding tsconfig `files` entries. Refactor `to_graph_imports()` to reuse it internally. - In `create_publish_graph`, clone the publish graph and extend it with the types imports for type checking, keeping the publish graph itself clean (types `.d.ts` files are not included in published output). - Add both a positive test (publish succeeds with types) and a negative test (publish type-checking fails without types, confirming the fix is load-bearing). Closes #32126 --------- Co-authored-by: Bartek IwaƄczuk <biwanczuk@gmail.com> Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Parents
Loading