async function transformToken(token, config, options, vol) {
  const to_ret = structuredClone(token);

  const transforms = /** @type {Transform[]} */ (config.transforms) || [];

  for (let i = 0; i < transforms.length; i++) {
    const transform = transforms[i];

    if (!transform.filter || transform.filter(to_ret, options)) {
      if (transform.type === transformTypeName) {
        to_ret.name = /** @type {string} */ (
          await _transformTokenWrapper(transform, to_ret, config, options, vol)
        );
      }
      // Don't try to transform the value if it is referencing another value
      // Only try to transform if the value is not a string or if it has '{}'
      if (
        transform.type === transformTypeValue &&
        !usesReferences(options.usesDtcg ? token.$value : token.value)
      ) {
        // Only transform non-referenced values (from original)
        // and transitive transforms if the value has been resolved
        if (
          !usesReferences(options.usesDtcg ? token.original.$value : token.original.value) ||
          transform.transitive
        ) {
          const transformedValue = await _transformTokenWrapper(
            transform,
            to_ret,
            config,
            options,
            vol,
          );
          if (transformedValue === undefined) {
            return undefined;
          }
          to_ret[options.usesDtcg ? '$value' : 'value'] = transformedValue;
        }
      }

      if (transform.type === transformTypeAttribute) {
        const attrs = /** @type {Record<string, unknown>} */ (
          await _transformTokenWrapper(transform, to_ret, config, options, vol)
        );

        to_ret.attributes = {
          ...to_ret.attributes,
          ...attrs,
        };
      }
    }
  }

  return to_ret;
}
Applies all transforms to a token. This is a pure function,
it returns a new token object rather than mutating it inline.
@private
@param {Token} token
@param {PlatformConfig} config
@param {Config} options
@param {Volume} [vol]
@returns {Promise<Token|undefined>} - A new property object with transforms applied.