function validateMediaQuery(query) {
  // The below is needed for consumption with webpack.
  const mediaParserFn = 'default' in mediaParser ? mediaParser.default : mediaParser;
  const mediaTree = mediaParserFn(query);
  const nodeTypes = new Set(['media-type', 'keyword', 'media-feature']);

  const stack = [mediaTree];

  while (stack.length > 0) {
    const node = stack.pop();

    if (nodeTypes.has(node.type) && !validateMediaType(node)) {
      return false;
    }

    if (node.nodes) {
      stack.push(...node.nodes);
    }
  }

  return true;
}
@param {string} Media query to validate
@returns {boolean}

This function performs a basic media query validation
to ensure the values passed as part of the 'media' config
is HTML safe and does not cause any injection issue