Get the absolute path to an asset referenced by a relative path in assets.json, which Webpack generates.
547048
function getWebpackAssetAbsolutePath(
  batfishConfig: BatfishConfiguration,
  assetPath: string
): string {
  let pathWithoutBase = assetPath;
  if (batfishConfig.siteBasePath) {
    pathWithoutBase = assetPath.replace(
      new RegExp(`^${batfishConfig.siteBasePath}`),
      ''
    );
  }
  return path.join(batfishConfig.outputDirectory, pathWithoutBase);
}
301488
def _absolute_path(path, relative_to=None):
    '''
    
    '''

    if path and os.path.isabs(path):
        return path
    if path and relative_to is not None:
        _abspath = os.path.join(relative_to, path)
        if os.path.isfile(_abspath):
            log.debug(
                'Relative path \'%s\' converted to existing absolute path '
                '\'%s\'', path, _abspath
            )
            return _abspath
    return path
1047735
private URL getRelativePath(FacesContext facesContext, String path) throws IOException
    {
        URL url = (URL) _relativePaths.get(path);
        if (url == null)
        {
            url = _factory.resolveURL(facesContext, _src, path);
            if (url != null)
            {
                ViewResource viewResource = (ViewResource) facesContext.getAttributes().get(
                    FaceletFactory.LAST_RESOURCE_RESOLVED);
                if (viewResource != null)
                {
                    // If a view resource has been used to resolve a resource, the cache is in
                    // the ResourceHandler implementation. No need to cache in _relativeLocations.
                }
                else
                {
                    _relativePaths.put(path, url);
                }
            }
        }
        return url;
    }
93037
def _to_relative_path(self, path):
        """"""
        if not osp.isabs(path):
            return path
        if self.repo.bare:
            raise InvalidGitRepositoryError("require non-bare repository")
        if not path.startswith(self.repo.working_tree_dir):
            raise ValueError("Absolute path %r is not in git repository at %r" % (path, self.repo.working_tree_dir))
        return os.path.relpath(path, self.repo.working_tree_dir)
1268933
function resolveAssetLink(client, type) {
    var defaultPath = '/assets/' + client.name + '/' + client.id + '.' + type,
      pack = options.packedAssets,
      link = pack !== undefined ? (pack.cdn !== undefined ? pack.cdn[type] : void 0) : void 0;
    if (link) {
      if (typeof link === 'function') {
        var file = {
          id: client.id,
          name: client.name,
          extension: type,
          path: defaultPath
        };
        return link(file);
      } else if (typeof link === 'string') {
        return link;
      } else {
        throw new Error('CDN ' + type + ' param must be a Function or String');
      }
    } else {
      return defaultPath;
    }
  }
788722
def relative_path(path):
    
    return os.path.join(os.path.dirname(__file__), path)
885701
def get_absolute_path(cls, roots, path):
        
        for root in roots:
            abspath = os.path.abspath(os.path.join(root, path))
            if abspath.startswith(root) and os.path.exists(abspath):
                return abspath
        # XXX TODO
        return 'file-not-found'
923458
function mkPath(absPath) {
    let localPrefix = absPath.substring(absPath.indexOf(dir_of_interest) + dir_of_interest.length)
    if (localPrefix.startsWith("/")) localPrefix = localPrefix.substring(1)
    return path.resolve(dir_of_interest,
        'node_modules',
        '@areslabs',
        'babel-plugin-import-css',
        'rncsscache',
        localPrefix + '.js'
    )
}
970876
function findPackage(filename) {
    if (!ctr)
        return;
    filename = filename || require.main.filename;
    var parsed = path_1.parse(filename);
    var curPath = path_1.join(parsed.dir, 'package.json');
    if (!fs_1.existsSync(curPath)) {
        ctr--;
        return findPackage(parsed.dir);
    }
    else {
        return chek_1.tryRequire(curPath, {});
    }
}
562978
function (assetFilePath, cb) {
    if (this.verbose) {
      console.log('compileSingleAsset: compiling ' + assetFilePath);
    }
    var self = this;
    // Normalize the path
    assetFilePath = path.resolve(assetFilePath);
    // Find which asset root the file is in
    var baseDir;
    for (var i = 0; i < this.paths.length; ++i) {
      var p = this.paths[i];
      if (assetFilePath.indexOf(p) === 0) {
        baseDir = p;
        break;
      }
    }
    if (!baseDir) {
      cb(new Error('Asset must be in one of the asset paths'));
    } else {
      var asset = this.bundle.addAsset(baseDir, assetFilePath);
      if (!asset.compiled) {
        async.waterfall([
          function (wfCb) {
            executePhase(self.phases.singleDiscovery, asset, wfCb);
          },
          function (a, wfCb) {
            var dependencies = self.bundle.getRequiredFiles(assetFilePath).map(function (dependency) {
              return self.bundle.getAsset(dependency);
            });
            dependencies.push(asset); // Add the final asset we're making to the end
            async.eachSeries(dependencies, function (dep, eachCb) {
              setImmediateCompat(function() {
                dep.reset(); // Ensure the file gets compiled even if it's already been compiled before
                executePhase(self.phases.compilation, dep, eachCb);
              });
            }, wfCb);
          },
          function (wfCb) {
            executePhase(self.phases.postCompilation, asset, wfCb);
          },
          function (a, wfCb) {
            executePhase(self.phases.output, asset, wfCb);
          }
        ], cb);
      } else {
        cb(null, asset);
      }
    }
  }
52702
function find(id) {
  let filepath = '';

  if ('string' == typeof id) {
    try {
      // Resolve relative to buddy package
      filepath = require.resolve(id);
    } catch (err) {
      // Resolve relative to project package
      filepath = resolve(path.resolve('package.json'), id);
    }
  }

  return filepath;
}
1123011
function findPackage(dir, packageName) {
    let d = dir || '.';
    do {
        let f = path.join(d, 'package.json');
        if ( fs.existsSync(f) ) {
            // require(f) would look for paths relative to this module,
            // but we need it to be relative to process.cwd()
            if ( !path.isAbsolute(f) ) {
                f = fs.realpathSync(f);
            }
            const p = requireJSON(f);
            // Look for a specific project name
            if ( packageName ) {
                if ( p ) {
                    if ( p.name == packageName ) {
                        return f;
                    }
                }
            }
            // Look for any project except this one (verup)
            else {
                if ( p ) {
                    if ( (p.extra && p.extra.verup || p.verup) && p.name != 'verup' ) {
                        return f;
                    }
                }
            }
        }
        dir = d;
        d = path.join(d, '..');
    } while (d != dir && dir.slice(0,2) != '..');
    return false;
}
506125
@Override
    public Asset<?> assetAt(String path) {
        Asset<?> asset = getAssetFromFS(path);
        if (asset == null) {
            asset = getAssetFromBundle(path);
        }
        return asset;
    }
856071
function(location) {
  var found = false;

  while(!found) {
    if (exists(location + '/package.json')) {
      found = location;
    } else if (location !== '/') {
      location = path.dirname(location);
    } else {
      return false;
    }
  }

  return location;
}
227585
function findProjectRoot(currentPath) {
  var result = undefined;

  try {
    var packageStats = lstatSync(path.join(currentPath, 'package.json'));

    if (packageStats.isFile()) {
      result = currentPath;
    }
  } catch (error) {
    if (currentPath !== path.resolve('/')) {
      result = findProjectRoot(path.join(currentPath, '..'));
    }
  }

  return result;
}
535459
function resolveDependencies(self, paths) {
  var assets = [], cache = {};

  _.forEach(paths, function (p) {
    var asset;

    if (p === self.pathname) {
      if (!cache[p]) {
        cache[p] = true;
        assets.push(self);
      }
      return;
    }

    asset = self.environment.findAsset(p, { bundle: false });

    if (asset) {
      asset.__requiredAssets__.forEach(function (asset_dependency) {
        if (!cache[asset_dependency.pathname]) {
          cache[asset_dependency.pathname] = true;
          assets.push(asset_dependency);
        }
      });
    }
  });

  return assets;
}
359294
function resolveImportPaths(filePath, importPaths){
  var dir = path.dirname(filePath);
  return importPaths.map(function(relativePath){
    if(!path.extname(relativePath)){
      relativePath += '.less';
    }
    return path.resolve(dir, relativePath);
  });
}