Function
resolveMainModuleUrl
(argv1: string | undefined = process.argv[1])
Source from the content-addressed store, hash-verified
| 103 | } |
| 104 | |
| 105 | function isZeroExitError(error: unknown): boolean { |
| 106 | return typeof error === 'object' && error !== null && 'exitCode' in error && (error as { exitCode?: unknown }).exitCode === 0; |
| 107 | } |
| 108 | |
| 109 | export function resolveMainModuleUrl(argv1: string | undefined = process.argv[1]): string { |
| 110 | try { |
| 111 | return pathToFileURL(realpathSync(argv1 ?? '')).href; |
| 112 | } catch { |
| 113 | try { |
| 114 | return pathToFileURL(argv1 ?? '').href; |
| 115 | } catch { |
| 116 | return ''; |
| 117 | } |
| 118 | } |
Tested by
no test coverage detected