async function getAssetPaths(document, file, options = {}, strict = true) {
  const {base, rebase = {}, assetPaths = []} = options;
  const {history = [], url: docurl = '', urlObj} = document;
  const {from, to} = rebase;
  const {pathname: urlPath} = urlObj || {};
  const [docpath] = history;

  if (isVinyl(file)) {
    return [];
  }

  // consider base tag in document
  const baseTagHref = document?.contents?.toString()?.match(/<base\s+href=['"]([^'"]+)['"]/)?.[1];
  // Remove double dots in the middle
  const normalized = path.join(file);
  // Count directory hops
  const hops = normalized.split(path.sep).reduce((cnt, part) => (part === '..' ? cnt + 1 : cnt), 0);
  // Also findup first real dir path
  const [first] = normalized.split(path.sep).filter((p) => p && p !== '..'); // eslint-disable-line unicorn/prefer-array-find
  const mappedAssetPaths = base ? assetPaths.map((a) => joinPath(base, a)) : [];

  // Make a list of possible paths
  const paths = [
    ...new Set([
      base,
      baseTagHref,
      baseTagHref && !isRemote(baseTagHref) && path.join(base, baseTagHref),
      base && isRelative(base) && path.join(process.cwd(), base),
      docurl,
      urlPath && urlResolve(urlObj.href, path.dirname(urlPath)),
      urlPath && !/\/$/.test(path.dirname(urlPath)) && urlResolve(urlObj.href, `${path.dirname(urlPath)}/`),
      docurl && urlResolve(docurl, file),
      docpath && path.dirname(docpath),
      ...assetPaths,
      ...mappedAssetPaths,
      to,
      from,
      base && docpath && path.join(base, path.dirname(docpath)),
      base && to && path.join(base, path.dirname(to)),
      base && from && path.join(base, path.dirname(from)),
      base && isRelative(file) && hops ? path.join(base, ...Array.from({length: hops}).fill('tmpdir'), file) : '',
      process.cwd(),
    ]),
  ];

  // Filter non-existent paths
  const filtered = await filterAsync(paths, (f) => {
    if (!f || (isAbsolute(f) && !f?.includes(process.cwd()))) {
      return false;
    }

    return !strict || fileExists(f, options);
  });

  // Findup first directory in search path and add to the list if available
  const all = await reduceAsync(filtered, [...new Set(filtered)], async (result, cwd) => {
    if (isRemote(cwd)) {
      return [...result, cwd];
    }

    // const up = await findUp(first, {cwd, type: 'directory'});
    const up = await findUpMultiple(first, {cwd, type: 'directory', stopAt: process.cwd()});
    const additionalDirectories = up.flatMap((u) => {
      const upDir = path.dirname(u);

      if (hops) {
        // Add additional directories based on dirHops
        const additional = path.relative(upDir, cwd).split(path.sep).slice(0, hops);

        return [upDir, path.join(upDir, ...additional)];
      }

      return [upDir];
    });

    return [...result, ...additionalDirectories];
  });

  debug(`(getAssetPaths) Search file "${file}" in:`, [...new Set(all)]);

  // Return uniquq result
  return [...new Set(all)];
}
Get a list of possible asset paths
Guess this is rather expensive so this method should only be used if
there's no other possible way

@param {Vinyl} document Html document
@param {string} file File path
@param {object} options Critical options
@param {boolean} strict Check for file existence
@returns {Promise<[string]>} List of asset paths