async function getExtendDocsResults({
  referenceProjectPaths,
  allowlistReference,
  extensions,
  prefixCfg,
  allowlist,
  cwd,
}) {
  const monoPkgs = await InputDataService.getMonoRepoPackages(cwd);

  const results = await _providenceModule.providence(
    await QueryService.getQueryConfigFromAnalyzer(MatchPathsAnalyzer, { prefix: prefixCfg }),
    {
      gatherFilesConfig: {
        extensions: extensions || /** @type {GatherFilesConfig['extensions']} */ (['.js']),
        allowlist: allowlist || ['!coverage', '!test'],
      },
      gatherFilesConfigReference: {
        extensions: extensions || ['.js'],
        allowlist: allowlistReference || ['!coverage', '!test'],
      },
      queryMethod: 'ast',
      report: false,
      targetProjectPaths: [cwd],
      referenceProjectPaths,
      // For mono repos, a match between root package.json and ref project will not exist.
      // Disable this check, so it won't be a blocker for extendin docs
      skipCheckMatchCompatibility: Boolean(monoPkgs),
    },
  );

  const queryOutputs = flatten(
    results.map(result => result.queryOutput).filter(o => typeof o !== 'string'), // filter out '[no-dependency]' etc.
  );

  /**
   * @param {string} pathStr ./packages/lea-tabs/lea-tabs.js
   * @param {{path:string;name:string}[]} pkgs ['packages/lea-tabs', ...]
   */
  function replaceToMonoRepoPath(pathStr, pkgs) {
    let result = pathStr;
    pkgs.some(({ path: p, name }) => {
      // for instance ./packages/lea-tabs/lea-tabs.js  starts with 'packages/lea-tabs'
      const normalizedP = `./${p}`;
      if (pathStr.startsWith(normalizedP)) {
        const localPath = pathStr.replace(normalizedP, ''); // 'lea-tabs.js'
        result = toPosixPath(path.join(name, localPath)); // 'lea-tabs/lea-tabs.js'
        return true;
      }
      return false;
    });
    return result;
  }

  if (monoPkgs) {
    queryOutputs.forEach(resultObj => {
      if (resultObj.variable) {
        resultObj.variable.paths.forEach(pathObj => {
          // eslint-disable-next-line no-param-reassign
          pathObj.to = replaceToMonoRepoPath(pathObj.to, monoPkgs);
        });
      }
      if (resultObj.tag) {
        resultObj.tag.paths.forEach(pathObj => {
          // eslint-disable-next-line no-param-reassign
          pathObj.to = replaceToMonoRepoPath(pathObj.to, monoPkgs);
        });
      }
    });
  }

  return queryOutputs;
}
@param {{
 referenceProjectPaths: PathFromSystemRoot[];
 prefixCfg:{from:string;to:string};
 extensions:GatherFilesConfig['extensions'];
 allowlist?:string[];
 allowlistReference?:string[];
 cwd:PathFromSystemRoot
}} opts
@returns