| 369 | } |
| 370 | |
| 371 | function getEditUrl(config: BuildConfig, fileUrlPath: string | undefined) { |
| 372 | if (fileUrlPath) { |
| 373 | const rootRelPath = fileUrlPath.slice(fileUrlPath.indexOf('dts-out') + 'dts-out'.length + 1); |
| 374 | |
| 375 | const tsxPath = join(config.rootDir, rootRelPath).replace(`.d.ts`, `.tsx`); |
| 376 | if (existsSync(tsxPath)) { |
| 377 | const url = new URL(rootRelPath, `https://github.com/QwikDev/qwik/tree/main/`); |
| 378 | return url.href.replace(`.d.ts`, `.tsx`); |
| 379 | } |
| 380 | |
| 381 | const tsPath = join(config.rootDir, rootRelPath).replace(`.d.ts`, `.ts`); |
| 382 | if (existsSync(tsPath)) { |
| 383 | const url = new URL(rootRelPath, `https://github.com/QwikDev/qwik/tree/main/`); |
| 384 | return url.href.replace(`.d.ts`, `.ts`); |
| 385 | } |
| 386 | } |
| 387 | return undefined; |
| 388 | } |