'use strict';

const index = require('./index2.cjs');

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 index.normalize(require.resolve(id, { paths: getModulePaths(paths) }));
}
function requireModule(id, paths) {
  return require(resolveModule(id, paths));
}
function getNearestPackage(id, paths) {
  while (index.dirname(id) !== id) {
    try {
      return requireModule(id + "/package.json", paths);
    } catch {
    }
    id = index.dirname(id);
  }
  return null;
}

exports.getModulePaths = getModulePaths;
exports.getNearestPackage = getNearestPackage;
exports.requireModule = requireModule;
