Add `basedir`, `node_modules` contained in the `basedir` and its ancestors to `module.paths`
@param {String} basedir
352181
function extendResolvePath(basedir) {
    // using module internals isn't good, but restarting with corrected NODE_PATH looks more ugly, IMO
    module.paths.push(basedir);

    const _basedir = basedir.split('/'),
        size = basedir.length;
    let i = 0;

    while (size > i++) {
        const modulesPath = _basedir.slice(0, i).join('/') + '/node_modules';

        if (module.paths.indexOf(modulesPath) === -1) {
            module.paths.push(modulesPath);
        }
    }
}
234723
function pkgPath(pkg) {
    pkg = pkg.pkg || pkg;
    var pkgPath = npmResolve(pkg, { basedir:opts.basedir, paths:builtins } );
    if (!pkgPath) throw new Error('cannot resolve module ' + pkg);
    return pkgPath;
  }
1153582
def find_includes(basedirs, source, log=None):
  

  all_basedirs = [os.path.dirname(source)]
  all_basedirs.extend(basedirs)

  includes = set()
  with open(source, 'r') as thrift:
    for line in thrift.readlines():
      match = INCLUDE_PARSER.match(line)
      if match:
        capture = match.group(1)
        added = False
        for basedir in all_basedirs:
          include = os.path.join(basedir, capture)
          if os.path.exists(include):
            if log:
              log.debug('{} has include {}'.format(source, include))
            includes.add(include)
            added = True
        if not added:
          raise ValueError("{} included in {} not found in bases {}"
                           .format(include, source, all_basedirs))
  return includes
562573
def install_traversals(cls, node_set):
    
    rels = cls.defined_properties(rels=True, aliases=False, properties=False)

    for key, value in rels.items():
        if hasattr(node_set, key):
            raise ValueError("Can't install traversal '{0}' exists on NodeSet".format(key))

        rel = getattr(cls, key)
        rel._lookup_node_class()

        traversal = Traversal(source=node_set, name=key, definition=rel.definition)
        setattr(node_set, key, traversal)
1258864
def add_node_parents(root: ast.AST) -> None:
    
    for node in ast.walk(root):
        for child in ast.iter_child_nodes(node):
            child.parent = node
155911
function nodeModulesPaths (start, cb) {
    var splitRe = process.platform === 'win32' ? /[\/\\]/ : /\/+/;
    var parts = start.split(splitRe);

    var dirs = [];
    for (var i = parts.length - 1; i >= 0; i--) {
        if (parts[i] === 'node_modules') continue;
        var dir = path.join.apply(
            path, parts.slice(0, i + 1).concat(['node_modules'])
        );
        if (!parts[0].match(/([A-Za-z]:)/)) {
            dir = '/' + dir;
        }
        dirs.push(dir);
    }
    return dirs;
}
746676
function(filePath, baseURL, System) {
      // Convert file paths to module name by stripping the baseURL and the ".js" extension
      if (System.defaultJSExtensions) {
        filePath = filePath.replace(/\.js$/, '');
      }
      return filePath
        .replace(new RegExp('^' + baseURL.replace('/', '\/')), '');
    }
473183
def _add_current_codedir(self, path):
        
        dirpath = self.tramp.dirname(path)
        if dirpath not in self.basepaths:
            self.basepaths.append(dirpath)
            self.rescan()
417906
public void addClassesToCheck(File basedir, String... relativeNames) throws IOException {
    addClassesToCheck(basedir, Arrays.asList(relativeNames));
  }
1111390
function linkModules (pkg, target, cb) {
  log.silly(pkg.modules, "linkModules")
  log.verbose(target, "linkModules")
  if (target === npm.root
      && !target.match(/node_modules$/)
      && -1 === require.paths.indexOf(target)) {
    log.warn("modules installing to "+target+", outside NODE_PATH")
  }
  if (!pkg.modules) pkg.modules = {}
  var mod = pkg.modules

  // FIXME: remove in 0.3.0, and uncomment this functionality in
  // lib/utils/read-json.js
  if (pkg.main) {
    mod["index.js"] = pkg.main
    delete pkg.main
  }

  var versionDir = path.join(npm.dir, pkg.name, pkg.version)
    , pkgDir = path.join(versionDir, "package")

  asyncMap(Object.keys(mod), function (key, cb) {
    writeShim
      ( path.join(pkgDir, mod[key])
      , path.join(target, key.replace(/\.js$/, '')+".js")
      , path.join(versionDir, "node_modules")
      , cb
      )
  }, function (er) {
    if (er) return cb(er)
    mkdir(target, function (er) {
      if (er) return cb(er)
      pkg._npmConfig = npm.config.get()
      pkg._env = {}
      Object.keys(process.env).forEach(function (e) {
        if (!e.match(/^npm_/i)) return
        pkg._env[e] = process.env[e]
      })
      pkg._npmPaths = { root : npm.root
                      , dir : npm.dir
                      , cache : npm.cache
                      , tmp : npm.tmp
                      , package : pkgDir
                      , modules : target
                      , dependencies : path.join(versionDir, "node_modules")
                      }
      var pkgCode = "module.exports = "
                  + JSON.stringify(pkg, null, 2)
                  + "\n"
      delete pkg._npmConfig
      delete pkg._npmPaths
      fs.writeFile(path.join(target,"package.json.js"), pkgCode, "utf8", cb)
    })
  })
}
1191387
function (options, callback) {
        options = extend({}, MODULE_LOADER_DEFAULTS, options)
        var modulesFolder = options.uri

        iterateFiles(modulesFolder, loadModule, callback, isJsFile)

        function loadModule(fileName) {
            if (options.skip && options.skip.test(fileName)) {
                return
            }
            var module = require(fileName)
            var name = path.relative(options.uri, fileName)
            options.core.add(name, module)
        }
    }
1168751
public function addStaticPartial($baseDir, $name)
    {
        $file = $this->createPartialPath($baseDir, $name);

        if (!is_file($file)) {
            throw new LogicException(sprintf('Invalid base directory or file name provided "%s"', $file));
        }

        $this->staticPartials[$name] = $file;
        return $this;
    }
379253
function getPaths(src, baseDir, output) {
    return new Elixir.GulpPaths()
        .src(src, baseDir || config.get('assets.svg.folder'))
        .output(output || config.get('public.svg.outputFolder'));
}
354036
private function setPaths($baseDirectory)
    {
        $this->setOption('ROOT', rtrim($baseDirectory, '/') . '/');
        $this->setOption('CORE', dirname(dirname(dirname(__DIR__))) . '/');
        $this->setOption('PUBLIC', self::ROOT() . 'public/');
        $this->setOption('TEMPLATES', self::ROOT() . 'templates/');
        $this->setOption('MODULES', self::ROOT() . 'modules/');
        $this->setOption('PLUGINS', self::ROOT() . 'plugins/');
        $this->setOption('COMPONENTS', self::ROOT() . 'components/');
    }
1334194
function addToTree (elem, callback) {
    const pathElems = toPathComponents(elem.path || '')
    let parent = tree
    const lastIndex = pathElems.length - 1

    let currentPath = ''
    eachOfSeries(pathElems, (pathElem, index, callback) => {
      if (currentPath) {
        currentPath += '/'
      }
      currentPath += pathElem
      const last = (index === lastIndex)
      parent.dirty = true
      parent.multihash = null
      parent.size = null

      if (last) {
        waterfall([
          (callback) => parent.put(pathElem, elem, callback),
          (callback) => flatToShard(null, parent, options.shardSplitThreshold, options, callback),
          (newRoot, callback) => {
            tree = newRoot
            callback()
          }
        ], callback)
      } else {
        parent.get(pathElem, (err, treeNode) => {
          if (err) {
            callback(err)
            return // early
          }
          let dir = treeNode
          if (!dir || !(dir instanceof Dir)) {
            dir = DirFlat({
              dir: true,
              parent: parent,
              parentKey: pathElem,
              path: currentPath,
              dirty: true,
              flat: true
            }, options)
          }
          const parentDir = parent
          parent = dir
          parentDir.put(pathElem, dir, callback)
        })
      }
    }, callback)
  }
1097000
def add_maps(self, parent, root_path=""):
        
        for mapsource in self.map_folders[root_path]['maps']:
            parent.append(self.get_network_link(mapsource))
        for folder in self.map_folders[root_path]['folders']:
            kml_folder_obj = kml_folder(folder)
            parent.append(kml_folder_obj)
            self.add_maps(parent=kml_folder_obj, root_path=F_SEP.join((root_path, folder)))
1315921
function find_from_node_modules(id, options){
  var basedir = options.filename ? path.dirname(options.filename) : options.basedir;
  var folders = find_node_module_folder(basedir);

  var entry;

  for(var i = 0; i< folders.length; i++){
    entry = find_node_module_entry(folders[i], id, options);

    if(entry) return entry;
  }
}