import serviceNames from 'virtual:services-list';

const services: { [key: string]: Function } = {};

serviceNames.forEach(path => {
    const serviceName = path.split('/').pop().replace('.ts', '');
    services[serviceName] = () => import(/* @vite-ignore */ `/src/lib/services/${path}`)
        .then(mod => {
            console.log(`Loaded service ${serviceName} with the following properties:`, Object.keys(mod));
            if (mod.default) return mod.default;
            return mod;
        });
});

export default services;