How to find filesystem path of an export of a Node module?

Viewed 246

I'm working with a project that exports some functions from an exports.js file.

// some-project/exports.js
export { loginFunction } from "./login/function"
export { registerFunction } from "./register/function"

I want to develop a tool that can import such a file and output the filesystem paths of all its exports. For example,

const projectExports = require("some-project/exports")

const exportPaths = findExportPaths(projectExports)

console.log(exportPaths) // ["/Projects/some-project/login/function.js", "/Projects/some-project/register/function.js"]

How can I implement the functionality of findExportPaths?

I have tried the following methods/tools to accomplish this, but could not make them work:

Any help would be greatly appreciated.

0 Answers
Related