import twigInstance from '@vituum/vite-plugin-twig';
import fs from 'node:fs';
import nodePath from 'node:path';
import { appData, envData } from './app.js';
import { absPath, pathSrc } from './path.js';

const tablerIconsAbsPath = nodePath.join(absPath.node, '@tabler', 'icons', 'icons');

const twigConfig = {
  root: pathSrc,
  globals: getTwigGlobals(),
  namespaces: {
    node: absPath.node,
    component: absPath.component,
    layout: absPath.layout,
    view: absPath.view,
    ti: nodePath.join(tablerIconsAbsPath, 'outline'),
    'ti-filled': nodePath.join(tablerIconsAbsPath, 'filled'),
  },
};

const twig = () => twigInstance(twigConfig);

function getTwigGlobals() {
  return {};
}

export default twig;
