// dataLoader.ts
import { writable } from 'svelte/store';
import dataSources from 'virtual:data-sources-list';

// The store that holds the data sets
export const dataStore = writable({});

// Dynamically import the data modules and assign them to the store
dataSources.forEach(src => {
    import(`/src/lib/data/${src}.ts`).then(module => {
        // Here, explicitly extract the required data or function from the module
        const moduleData = module[src] || module.default;

        dataStore.update(store => ({ ...store, [src]: moduleData }));
    });
});