(filePath: string)
| 101 | * @private |
| 102 | */ |
| 103 | export function solvePath(filePath: string): string { |
| 104 | // Convert to file URL |
| 105 | if(path.isAbsolute(filePath)) return pathToFileURL(filePath).href; |
| 106 | |
| 107 | // Return immediately if it's a file URL |
| 108 | if (filePath.startsWith('file://')) return filePath; |
| 109 | |
| 110 | const stackLines = new Error().stack?.split('\n'); |
| 111 | if(stackLines){ |
| 112 | stackLines?.shift(); |
| 113 | const callerLine = stackLines?.find((line) => { return line.indexOf(moduleFilename) === -1; }); |
| 114 | const match = callerLine?.match(/(file:\/\/)?(((\/?)(\w:))?([/\\].+)):\d+:\d+/); |
| 115 | |
| 116 | if (match) { |
| 117 | const dir = `${match[5] ?? ""}${path.dirname(match[6])}`; |
| 118 | return pathToFileURL(path.resolve(dir, filePath)).href; |
| 119 | } |
| 120 | } |
| 121 | |
| 122 | throw new Error(`Could not locate task file ${filePath}`); |
| 123 | } |
| 124 | |
| 125 | /** |
| 126 | * Validates a cron expression to ensure it follows the correct format. |
no test coverage detected