import { n as normalize, d as dirname } from './index2.mjs';

function getModulePaths(paths) {
  return [].concat(global.__NUXT_PREPATHS__, ...Array.isArray(paths) ? paths : [paths], process.cwd(), global.__NUXT_PATHS__).filter(Boolean);
}
function resolveModule(id, paths) {
  return normalize(require.resolve(id, { paths: getModulePaths(paths) }));
}
function requireModule(id, paths) {
  return require(resolveModule(id, paths));
}
function getNearestPackage(id, paths) {
  while (dirname(id) !== id) {
    try {
      return requireModule(id + "/package.json", paths);
    } catch {
    }
    id = dirname(id);
  }
  return null;
}

export { getNearestPackage as a, getModulePaths as g, requireModule as r };
