Skip to content

Commit

Permalink
lint-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
cspotcode committed Jan 21, 2022
1 parent d6d11ec commit 9ecc037
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,15 +96,20 @@ export function cachedLookup<T, R>(fn: (arg: T) => R): (arg: T) => R {
* Require something with v8-compile-cache, which should make subsequent requires faster.
* Do lots of error-handling so that, worst case, we require without the cache, and users are not blocked.
*/
export function attemptRequireWithV8CompileCache(requireFn: typeof require, specifier: string) {
export function attemptRequireWithV8CompileCache(
requireFn: typeof require,
specifier: string
) {
try {
const v8CC = (require('v8-compile-cache-lib') as typeof import('v8-compile-cache-lib')).install();
const v8CC = (
require('v8-compile-cache-lib') as typeof import('v8-compile-cache-lib')
).install();
try {
return requireFn(specifier);
} finally {
v8CC?.uninstall();
}
} catch(e) {
} catch (e) {
return requireFn(specifier);
}
}

0 comments on commit 9ecc037

Please sign in to comment.