import {PREPROCESSOR_EXTENSIONS} from "../core/ssr/css.js";
function getViteTransform(viteConfig) {
  const viteCSSPlugin = viteConfig.plugins.find(({name}) => name === "vite:css");
  if (!viteCSSPlugin)
    throw new Error(`vite:css plugin couldn\u2019t be found`);
  if (!viteCSSPlugin.transform)
    throw new Error(`vite:css has no transform() hook`);
  return viteCSSPlugin.transform.bind(null);
}
async function transformWithVite({value, attrs, transformHook, id, ssr}) {
  const lang = (`.${attrs.lang}` || "").toLowerCase();
  if (!PREPROCESSOR_EXTENSIONS.has(lang)) {
    return null;
  }
  return transformHook(value, id + `?astro&type=style&lang${lang}`, ssr);
}
export {
  getViteTransform,
  transformWithVite
};
//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsiLi4vLi4vc3JjL3ZpdGUtcGx1Z2luLWFzdHJvL3N0eWxlcy50cyJdLAogICJtYXBwaW5ncyI6ICJBQUVBO0FBS08sMEJBQTBCLFlBQWdEO0FBQy9FLFFBQU0sZ0JBQWdCLFdBQVcsUUFBUSxLQUFLLENBQUMsQ0FBRSxVQUFXLFNBQVM7QUFDckUsTUFBSSxDQUFDO0FBQWUsVUFBTSxJQUFJLE1BQU07QUFDcEMsTUFBSSxDQUFDLGNBQWM7QUFBVyxVQUFNLElBQUksTUFBTTtBQUM5QyxTQUFPLGNBQWMsVUFBVSxLQUFLO0FBQUE7QUFZdEMsaUNBQXdDLENBQUUsT0FBTyxPQUFPLGVBQWUsSUFBSSxNQUF1RTtBQUNoSixRQUFNLE9BQVEsS0FBSSxNQUFNLFVBQVUsSUFBSTtBQUN0QyxNQUFJLENBQUMsd0JBQXdCLElBQUksT0FBTztBQUN0QyxXQUFPO0FBQUE7QUFFVCxTQUFPLGNBQWMsT0FBTyxLQUFLLHlCQUF5QixRQUFRO0FBQUE7IiwKICAibmFtZXMiOiBbXQp9Cg==
