const { TRANSFORM_RULES } = require("../constants");

const VITE_BABEL_CONFIG = {
  presets: ["@bigbinary/neeto"],
  plugins: [
    [
      "module-resolver",
      {
        root: ["./src"],
        alias: {
          "dayjs/plugin/customParseFormat":
            "@bigbinary/neeto-commons-frontend/utils/customParseFormatPlugin",
          "dayjs/plugin/timezone":
            "@bigbinary/neeto-commons-frontend/utils/timezonePlugin",
        },
        loglevel: "silent",
      },
    ],
  ],
};

const BABEL_CONFIG = {
  presets: ["@bigbinary/neeto"],
  plugins: [
    [
      "module-resolver",
      {
        root: ["./src"],
        alias: {
          "dayjs/plugin/customParseFormat":
            "@bigbinary/neeto-commons-frontend/utils/customParseFormatPlugin",
          "dayjs/plugin/timezone":
            "@bigbinary/neeto-commons-frontend/utils/timezonePlugin",
        },
        loglevel: "silent",
      },
    ],
    ...TRANSFORM_RULES,
  ],
};

const DEFAULT_VISUALIZER_TEMPLATE = "treemap";

const NODE_MODULES_PKG_REGEX = /node_modules\/(@bigbinary\/[^/]+)\/(.*)/;

module.exports = {
  BABEL_CONFIG,
  VITE_BABEL_CONFIG,
  DEFAULT_VISUALIZER_TEMPLATE,
  NODE_MODULES_PKG_REGEX,
};
