getRequireResolvePaths = async (code, { paths = [] }) => {
  /**
   * @type {string[]}
   */
  const resolvedPaths = [];
  const visitor = {
    // @ts-ignore
    enter({ node }) {
      const isImportExportNode = isImportDeclaration(node) || isExportDeclaration(node);
      if (!isImportExportNode) {
        return;
      }
      // @ts-ignore
      const { source } = node;
      // example: `import sth from source.value;`
      const initialSource = source?.value;
      const isRelativeSource = initialSource?.startsWith('.');
      if (!isRelativeSource) {
        return;
      }
      const require = createRequire(import.meta.url);
      const resolvedPath = require.resolve(initialSource, { paths });
      resolvedPaths.push(resolvedPath);
    },
  };
  transformCode(code, visitor);
  return resolvedPaths;
}
Get the paths returned by require.resolve for each
import or export declaration found in the given `code`
@param {string} code
@param {{paths: string[]}} options
@returns {Promise<string[]>}