( requireFn: typeof require, specifier: string )
| 98 | * Do lots of error-handling so that, worst case, we require without the cache, and users are not blocked. |
| 99 | */ |
| 100 | export function attemptRequireWithV8CompileCache( |
| 101 | requireFn: typeof require, |
| 102 | specifier: string |
| 103 | ) { |
| 104 | try { |
| 105 | const v8CC = ( |
| 106 | require('v8-compile-cache-lib') as typeof import('v8-compile-cache-lib') |
| 107 | ).install(); |
| 108 | try { |
| 109 | return requireFn(specifier); |
| 110 | } finally { |
| 111 | v8CC?.uninstall(); |
| 112 | } |
| 113 | } catch (e) { |
| 114 | return requireFn(specifier); |
| 115 | } |
| 116 | } |
| 117 | |
| 118 | /** |
| 119 | * Helper to discover dependencies relative to a user's project, optionally |
no outgoing calls
no test coverage detected
searching dependent graphs…