MCPcopy Create free account
hub / github.com/chakra-ui/panda / getModuleSpecifierSourceFile

Function getModuleSpecifierSourceFile

packages/extractor/src/maybe-box-node.ts:820–838  ·  view source on GitHub ↗
(declaration: ExportDeclaration | ImportDeclaration)

Source from the content-addressed store, hash-verified

818 * @see https://github.com/dsherret/ts-morph/blob/42d811ed9a5177fc678a5bfec4923a2048124fe0/packages/ts-morph/src/compiler/ast/module/ExportDeclaration.ts#L160
819 */
820export const getModuleSpecifierSourceFile = (declaration: ExportDeclaration | ImportDeclaration) => {
821 const project = declaration.getProject()
822 const moduleName = declaration.getModuleSpecifierValue()
823
824 if (!moduleName) return
825
826 const containingFile = declaration.getSourceFile().getFilePath()
827 const resolved = ts.resolveModuleName(
828 moduleName,
829 containingFile,
830 project.getCompilerOptions(),
831 project.getModuleResolutionHost(),
832 )
833 if (!resolved.resolvedModule) return
834
835 const sourceFile = project.addSourceFileAtPath(resolved.resolvedModule.resolvedFileName)
836
837 return sourceFile
838}
839
840function resolveVarDeclarationFromExportWithName(
841 symbolName: string,

Callers 2

getDeclarationForFunction · 0.90

Calls 1

getFilePathMethod · 0.80

Tested by

no test coverage detected