( overlay: VirtualDeclarations, result: Declarations, frontend: Frontend, sourceRoot: string | undefined, cwd: string )
| 255 | ) |
| 256 | |
| 257 | const addOverlayForProject = ( |
| 258 | overlay: VirtualDeclarations, |
| 259 | result: Declarations, |
| 260 | frontend: Frontend, |
| 261 | sourceRoot: string | undefined, |
| 262 | cwd: string |
| 263 | ): void => { |
| 264 | overlay.add(result.files) |
| 265 | // when a downstream composite project imports a referenced project's source |
| 266 | // file, TypeScript redirects it to the output .d.ts but resolves relative |
| 267 | // imports inside that .d.ts (like `./~arktype.js`) from the upstream source |
| 268 | // rootDir; expose the virtual ~arktype.d.ts there too so it resolves cleanly |
| 269 | const sharedText = result.files[frontend.sharedPath] |
| 270 | if (sharedText !== undefined && sourceRoot) { |
| 271 | const sourceSharedPath = `${tsPath(sourceRoot)}/${sharedDeclarationFile}` |
| 272 | if ( |
| 273 | canonicalConfigPath(sourceSharedPath, cwd) !== |
| 274 | canonicalConfigPath(frontend.sharedPath, cwd) |
| 275 | ) |
| 276 | overlay.addFile(sourceSharedPath, sharedText) |
| 277 | } |
| 278 | } |
| 279 | |
| 280 | export type SourceRootOptions = { |
| 281 | rootDir?: string | undefined |
no test coverage detected