validateOrAdd = async (
    rootPath,
    targetName,
    log = defaultLog,
    options = {},
  ) => {
    const metaText = await loadMetaText(targetName, log);

    /** @type {BundleMeta | undefined} */
    let meta = metaText ? JSON.parse(metaText) : undefined;

    if (meta !== undefined) {
      try {
        meta = await validate(targetName, rootPath, log, meta, {
          format: options.format,
          noTransforms: options.noTransforms,
          elideComments: options.elideComments,
          conditions: options.conditions,
        });
        const {
          bundleTime,
          bundleSize,
          contents,
          noTransforms,
          elideComments,
          format = 'endoZipBase64',
          conditions = [],
        } = meta;
        log(
          `${wr}`,
          toBundleName(targetName),
          'valid:',
          contents.length,
          'files bundled at',
          bundleTime,
          'with size',
          bundleSize,
          `${noTransforms ? 'w/o transforms' : 'with transforms'}${elideComments ? ' and comments elided' : ''}`,
          'with format',
          format,
          'and conditions',
          JSON.stringify(conditions),
        );
      } catch (invalid) {
        meta = undefined;
        log(invalid);
      }
    }

    if (meta === undefined) {
      log(`${wr}`, 'add:', targetName, 'from', rootPath);
      meta = await add(rootPath, targetName, log, options);
      const {
        bundleFileName,
        bundleTime,
        contents,
        noTransforms,
        elideComments,
        format = 'endoZipBase64',
        conditions = [],
      } = meta;
      log(
        `${wr}`,
        'bundled',
        contents.length,
        'files in',
        bundleFileName,
        'at',
        bundleTime,
        `${noTransforms ? 'w/o transforms' : 'with transforms'}${elideComments ? ' and comments elided' : ''}`,
        'with format',
        format,
        'and conditions',
        JSON.stringify(conditions),
      );
    }

    return meta;
  }
@param {string} rootPath
@param {string} targetName
@param {Logger} [log]
@param {object} [options]
@param {boolean} [options.noTransforms]
@param {boolean} [options.elideComments]
@param {ModuleFormat} [options.format]
@param {string[]} [options.conditions]
@returns {Promise<BundleMeta>}