[heft] Add .d.ts shims for secondary module kinds
Summary
Modifies the multi-emit logic for the Heft TypeScript plugin to generate .d.ts shim files for non-primary output kinds, that redirect to the primary .d.ts files.
Details
Creates shim files containing:
export * from '../path/to/declaration';
// If a default export exists
export { default as default } from '../path/to/declaration';
The motivation is to better support separation of transpilation and type-checking by having the transpilation step emit .d.ts stubs that can be trivially generated from the source files in an isolated per-module fashion, which at generation time may point to a declaration file that does not yet exist. The real declaration files would be generated later, during type-checking, so that downstream packages can still type-check correctly, even with deep imports.
How it was tested
Enabled multi-emit and isolatedModules in the node rig temporarily. Verified output content.
I'm not entirely happy with how the opt-in currently works. I expect it may be best to have an express option in the moduleKindsToEmit collection to emit the shim.