async function toImportFn(stories) {
    const objectEntries = stories.map((file) => {
        return `  '${toImportPath(
            normalizePath(path.relative(process.cwd(), file))
        )}': async () => import('/@fs/${file}')`;
    });

    return `
    const importers = {
      ${objectEntries.join(',\n')}
    };

    export async function importFn(path) {
        return importers[path]();
    }
  `;
}
/**
 * This function takes an array of stories and creates a mapping between the stories' relative paths
 * to the working directory and their dynamic imports. The import is done in an asynchronous function
 * to delay loading. It then creates a function, `importFn(path)`, which resolves a path to an import
 * function and this is called by Storybook to fetch a story dynamically when needed.
 * @param stories An array of absolute story paths.
 * @returns {Promise<string>}
 */
This function takes an array of stories and creates a mapping between the stories' relative paths
to the working directory and their dynamic imports. The import is done in an asynchronous function
to delay loading. It then creates a function, `importFn(path)`, which resolves a path to an import
function and this is called by Storybook to fetch a story dynamically when needed.
@param stories An array of absolute story paths.
@returns {Promise}
This function takes an array of stories and creates a mapping between the stories ' relative paths to the working directory and their dynamic imports . The import is done in an asynchronous function to delay loading . It then creates a function ` importFn ( path ) ` which resolves a path to an import function and this is called by Storybook to fetch a story dynamically when needed . @param stories An array of absolute story paths . @returns { Promise }
async function toImportFn(stories) {
    const objectEntries = stories.map((file) => {
        return `  '${toImportPath(
            normalizePath(path.relative(process.cwd(), file))
        )}': async () => import('/@fs/${file}')`;
    });
    return `
    const importers = {
      ${objectEntries.join(',\n')}
    };
    export async function importFn(path) {
        return importers[path]();
    }
  `;
}
async function toImportFn ( stories ) { const objectEntries = stories . map ( ( file ) => { return ` ${ toImportPath ( normalizePath ( path . relative ( process . cwd ( ) , file ) ) ) } ${ file } ` ; } ) ; return ` ${ objectEntries . join ( ',\n' ) } ` ; }
This function takes an array of stories and creates a mapping between the stories' relative paths
 to the working directory and their dynamic imports.
This function takes an array of stories and creates a mapping between the stories ' relative paths to the working directory and their dynamic imports .