import { kebabCase } from 'unplugin-vue-components';

"use strict";
const isSSR = Boolean(process.env.SSR || process.env.SSG || process.env.VITE_SSR || process.env.VITE_SSG);
const moduleType = isSSR ? "lib" : "es";
function getSideEffects(dirName, options) {
  const { importStyle = true } = options;
  if (!importStyle || isSSR) return;
  if (importStyle === "scss") {
    return [`@me-framework/me-ui/${moduleType}/${dirName}/style/scss`, "@me-framework/me-ui/es/theme.scss"];
  } else {
    return `@me-framework/me-ui/${moduleType}/${dirName}/style/index`;
  }
}
function MeLibResolver(options = {}) {
  return {
    type: "component",
    // 组件类型
    resolve: (name) => {
      const prefix = "Me";
      if (name.toUpperCase().startsWith(prefix.toUpperCase())) {
        const partialName = name.slice(2);
        return {
          // 组件名称
          name,
          // 从哪个路径导入，es/lib
          from: `@me-framework/me-ui/${moduleType}`,
          // 根据组件名称获取到对应的 css 导入路径。BackTop => es/back-top/style/index
          sideEffects: getSideEffects(kebabCase(partialName), options)
        };
      }
    }
  };
}

export { MeLibResolver };
//# sourceMappingURL=resolver.mjs.map
