( filePath: string, functionName: string | undefined, args: unknown[], // biome-ignore lint/suspicious/noExplicitAny: I think this is hotloading JS )
| 37 | } |
| 38 | |
| 39 | export async function loadFromJavaScriptFile( |
| 40 | filePath: string, |
| 41 | functionName: string | undefined, |
| 42 | args: unknown[], |
| 43 | // biome-ignore lint/suspicious/noExplicitAny: I think this is hotloading JS |
| 44 | ): Promise<any> { |
| 45 | const requiredModule = await importModule(filePath, functionName); |
| 46 | if (functionName && typeof requiredModule[functionName] === 'function') { |
| 47 | return requiredModule[functionName](...args); |
| 48 | } else if (typeof requiredModule === 'function') { |
| 49 | return requiredModule(...args); |
| 50 | } else if (requiredModule.default && typeof requiredModule.default === 'function') { |
| 51 | return requiredModule.default(...args); |
| 52 | } else { |
| 53 | throw new Error( |
| 54 | `Assertion malformed: ${filePath} must export a function or have a default export as a function`, |
| 55 | ); |
| 56 | } |
| 57 | } |
| 58 | |
| 59 | export function processFileReference(fileRef: string): object | string { |
| 60 | const basePath = cliState.basePath || ''; |
no test coverage detected
searching dependent graphs…