(url, context, nextLoad)
| 7 | // hooks. |
| 8 | function addHook(hook, options) { |
| 9 | function load(url, context, nextLoad) { |
| 10 | const result = nextLoad(url, context); |
| 11 | const index = url.lastIndexOf('.'); |
| 12 | const ext = url.slice(index); |
| 13 | if (!options.exts.includes(ext)) { |
| 14 | return result; |
| 15 | } |
| 16 | const filename = fileURLToPath(url); |
| 17 | if (!options.matcher(filename)) { |
| 18 | return result; |
| 19 | } |
| 20 | return { ...result, source: hook(result.source.toString(), filename) } |
| 21 | } |
| 22 | |
| 23 | const registered = registerHooks({ load }); |
| 24 |
nothing calls this directly
no test coverage detected