From e34ba6953f95bac6590436a1d739e6d32e6b4197 Mon Sep 17 00:00:00 2001 From: SukkaW Date: Thu, 21 Jul 2022 17:36:47 +0800 Subject: [PATCH] refactor: remove `tryToExtractExportedConstValue` --- .../build/analysis/extract-const-value.ts | 20 ------------------- 1 file changed, 20 deletions(-) diff --git a/packages/next/build/analysis/extract-const-value.ts b/packages/next/build/analysis/extract-const-value.ts index 2e415ba30d5f..db9ce53187e7 100644 --- a/packages/next/build/analysis/extract-const-value.ts +++ b/packages/next/build/analysis/extract-const-value.ts @@ -61,26 +61,6 @@ export function extractExportedConstValue( throw new NoSuchDeclarationError() } -/** - * A wrapper on top of `extractExportedConstValue` that returns undefined - * instead of throwing when the thrown error is known. - */ -export function tryToExtractExportedConstValue( - module: Module, - exportedName: string -) { - try { - return extractExportedConstValue(module, exportedName) - } catch (error) { - if ( - error instanceof UnsupportedValueError || - error instanceof NoSuchDeclarationError - ) { - return undefined - } - } -} - function isExportDeclaration(node: Node): node is ExportDeclaration { return node.type === 'ExportDeclaration' }