(file, suppliedSource)
| 12 | let revision = 0; |
| 13 | |
| 14 | export async function loadModule(file, suppliedSource) { |
| 15 | const source = suppliedSource ?? (await readFile(file, 'utf8')); |
| 16 | revision += 1; |
| 17 | const url = `${pathToFileURL(file).href}?v=${revision}`; |
| 18 | try { |
| 19 | const mod = await import(url); |
| 20 | return { source, module: mod, error: null }; |
| 21 | } catch (error) { |
| 22 | /* A syntax error here is the author's, not ours, and the stack is the only |
| 23 | thing that says which line. Passed through rather than summarised. */ |
| 24 | return { source, module: null, error }; |
| 25 | } |
| 26 | } |
no outgoing calls
no test coverage detected